Panzerschrek/Chasm-Reverse

Vertex attribute aligment issue

BSzili opened this issue · 3 comments

PanzerChasm used to run fine with my nVidia card, but recently I switched to an AMD one and the OpenGL renderer no longer works. It does to a certain degree, but if I start to enable various features I eventually get a segfault in glDrawElements:

1  atioglxx!DrvPresentBuffers                                  0x5e7f3c27 
2  atioglxx!DrvPresentBuffers                                  0x5e8733cc 
3  atioglxx!DrvPresentBuffers                                  0x5e956210 
4  atioglxx!DrvPresentBuffers                                  0x5ee062b3 
5  r_PolygonBuffer::Draw               polygon_buffer.cpp 148  0x488db9   
6  PanzerChasm::MapDrawerGL::DrawWalls map_drawer_gl.cpp  1584 0x4161e5   
7  PanzerChasm::MapDrawerGL::Draw      map_drawer_gl.cpp  499  0x4119ae   
8  PanzerChasm::Client::Draw           client.cpp         404  0x403457   
9  PanzerChasm::Host::Loop             host.cpp           223  0x443b1f   
10 SDL_main                            main.cpp           28   0x447c60   
11 main                                                        0x48f426   

I'm getting warnings about the vertex attribute array alignment, which is probably related:

glDrawArrays uses input attribute 'VERTEX_ATTRIB[1]' with offset '6' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawArrays uses input attribute 'VERTEX_ATTRIB[3]' with offset '11' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawArrays uses input attribute 'VERTEX_ATTRIB[4]' with offset '13' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawArrays uses input attribute 'VERTEX_ATTRIB[1]' with offset '6' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawArrays uses input attribute 'VERTEX_ATTRIB[3]' with offset '11' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawArrays uses input attribute 'VERTEX_ATTRIB[4]' with offset '13' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawArrays uses input attribute 'VERTEX_ATTRIB[1]' with offset '6' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawArrays uses input attribute 'VERTEX_ATTRIB[3]' with offset '11' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawArrays uses input attribute 'VERTEX_ATTRIB[4]' with offset '13' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawElements uses input attribute 'VERTEX_ATTRIB[1]' with offset '6' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawElements uses input attribute 'VERTEX_ATTRIB[3]' with offset '11' that is not optimally aligned; consider aligning on a 4-byte boundary
glDrawElements uses input attribute 'VERTEX_ATTRIB[4]' with offset '13' that is not optimally aligned; consider aligning on a 4-byte boundary

Hi.
Looks like serious problem.
What means "renderer no longer works". It crashes? Or something else?

Yes, it crashes if I enable various features in the options. The warnings about the offset alignments are constant.

I managed to fix this by padding the WallVertex structure in #6