vendredi 24 juin 2016

OpenGL: Access violation when using glTransformFeedbackVaryings and glDrawElements

My shader works fine and now I want to add transform feedback during the same render pass by simply specifying one additional out variable in my geometry shader out vec3 vertexPosition. However when I add glTransformFeedbackVaryings(_programHandle, _numVaryings, _varyings, _bufferMode); then my drawCall: glDrawElements(GL_TRIANGLES, meshRenderable._mesh->_indices.size(), GL_UNSIGNED_INT, NULL); results in an access violation. Exception thrown at 0x000000005851968A (atio6axx.dll) in Shady.exe: 0xC0000005: Access violation reading location 0x0000000000000014. If there is a handler for this exception, the program may be safely continued.` Without glTransformFeedbackVaryings the glDrawElements call works fine. The shader consists of a vertex shader, a geometry shader (which transforms each triangle into 4 triangles) and a fragment shader. Why would specifying the transformFeedback varyings cause an access violation? I did not even use glGetBufferSubData yet and neither did create a buffer for TF and I assume the bound VAO is fine otherwise I would not get a corect draw call without the glTransformFeedbackVaryings! I used glGetString to verify that EXT_transform_feedback is supported and the EXT shows up and also validated the shader which returned Validation successful. Update: The reason drawElements caused an access violation was likely because I did not specify all TF elements (no buffer, no TF object, no glBindBufferBase). I assumed if I never call glBeginTransformFeedback this would not cause any side effects as no transform feedback would be active. However, this seems to be a wrong assumption. It would be very nice if someone could explain if it is valid to specify varyings and why OpenGL requires a proper setup for TF even if TF is never enabled.

Aucun commentaire:

Enregistrer un commentaire