I am using glfw as my windowing API for my example. But it can be glut too.
I am having problems rendering with bindless vertex buffers (bindless textures, bindless ubos work just fine)
Specifically:
-I request a 4.5 context like so:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
-The sequence of calls is like so:
ASSERT_NO_GL_ERRORS(FILE, LINE) // no errors up until that point
glVertexAttribFormatNV(locations.vertexLoc, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex));
ASSERT_NO_GL_ERRORS(FILE, LINE); //-> assert (invalid operation)
Observations:
-Specifying 2.0 context works (application renders correctly)
-Not specifying any hints (commenting out the lines) works (application renders correctly)
-glVertexAttribFormatNV or glVertexAttribFormat does not matter. assert in both cases
Side note:
-what’s the difference between the last parameter to glVertexAttribFormat(NV)?
-In the opengl docs it indicates stride
-But per nvidia specs its an offset?
https://www.khronos.org/registry/OpenGL/extensions/NV/NV_vertex_buffer_unified_memory.txt
I do understand the reason for the error (if I consider OpenGL 3+) is that vertex attrib format needs a bound vao, but as per the nvidia specifications:
https://www.khronos.org/registry/OpenGL/extensions/NV/NV_vertex_buffer_unified_memory.txt
I see this:
“They do not inspect the current ARRAY_BUFFER binding for any error checks, nor do they modify the pointer state or vertex attribute buffer bindings. The parameters are interpreted as they are in the corresponding functions”
which I understand to mean that vao need not be bound.
If so, why am I getting this error? And what is the correct way of doing this? I am not doing anything different than the nvidia gameworks samples (bindless graphics, command list). For example, the bindless graphics sample does exactly the same sequence of calls, ie:
glVertexAttribFormatNV …
glEnableVertexAttribArray …
glEnableClientState(GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV);
glEnableClientState(GL_ELEMENT_ARRAY_UNIFIED_NV);
glBufferAddressRangeNV(GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV …
glBufferAddressRangeNV(GL_ELEMENT_ARRAY_ADDRESS_NV …
glDrawElements(…
I tried to replicate by giving the same contexts in the samples (noticed there are no hints provided at all to glfw), but it leads to access violation in getting extensions.
the glfw docs confused me further: “GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR are not hard constraints, but creation will fail if the OpenGL version of the created context is less than the one requested. It is therefore perfectly safe to use the default of version 1.0 for legacy code and you will still get backwards-compatible contexts of version 3.0 and above when available.”
But creation has not failed :-(
Important: Using GLUT also causes these errors if I do something like this:
glutInitContextVersion(4, 1);
Any help in understanding the problem, hints will help.
Thanks.