Can someone tell me if there is an OpenGL implementation that performs strict conformity testing on the commands used? For example we recently had a problem where people used non 4-byte aligned stride for glVertexAttribPointer which broke some implementations and others not. I’d like to enforce conformity so it is more or less guaranteed to act and look the same on multiple platforms.
There is a conformance test for OpenGL, and its my understanding that modern vendors use it. But I have no idea how comprehensive this test is.
It’s been a long-standing piece of advice that attributes should always be 4-byte aligned (though mainly for performance reasons. Even if the implementation didn’t break, I highly doubt it would have been fast). Unfortunately, it’s not a particularly publicized one.
I’d like to enforce conformity so it is more or less guaranteed to act and look the same on multiple platforms.
Yeah, that’s not a reasonable expectation at this point. The only way you can reasonably guarantee that your code will work the same across platforms is to test them yourself.
I mean yes, we should be able to expect this. But the reality of OpenGL implementations is what it is.
Edit: How about Vulkan? Will the standard validation layers do what I want or is something else recommended?
Ok, follow up question: Is there a portable solution to dump OpenGL commands in a way that I can quickly create a standalone binary from them if only a gcc and OpenGL libs for the new platform are available?
Vulkan started off with a conformance test suite, and Khronos requires implementations to validate against it.
Again, how comprehensive it is is unknown. There is, as far as I can tell, less variance among implementations of Vulkan than there are of OpenGL. But there are always bugs, particularly for corner cases.
I don’t know what you mean by that. Most graphics debugging tools have a way to log what OpenGL calls your code makes.
Something like GLIntercept would get you started with this; it’s not portable, and while it would give you commands and their parameters it wouldn’t give you data (e.g. the contents of buffer objects), so you’d need to do some grunt work yourself to get a complete representation of what you want.
I’m looking for a tool that basically extracts all the OpenGL commands and resources from the application and produces sourcecode from it or anything that can be compiled in a platform independent way.
I tried the C++ export from Nvidia Nsight and it creates a nice compilable project but a file namesd nvgles.h is missing which is supposedly from an sdk but I downloaded all of Jetson SDK and cannot find it.
Ok. You might try just commenting out the #include of it and see what happens. Searching for nvgles.h in combination with one or more of those undefined symbols might generate some hits … or give you a clue what header you can include instead of nvgles.h.
Yes they will. They do a very good job of verifying you are using the API correctly. Given that Vulkan implementations do very little error checking - they mostly crash when used incorrectly - it is essential to use the validation layers during development.
The conformance tests have a different purpose, which is to verify that implementations are in conformance with the spec. In the case of OpenGL, since the spec gives implementations leeway in many areas, no matter how rigorous the conformance tests, they cannot guarantee that apps will run correctly on any implementation. A validation layer for OpenGL apps would be the place to do that but, as far as I know, no such thing exists.