About robust buffer access

When I learn GLSC2.0, I find GL_KHR_robustness extensions has been adopted as part of core GLSC spec, then I learn KHR_robustness. But I could not know under what circumstances it will work. In(KHR_robustness.txt), having such a passage:

When enabled(robust buffer accsee), indices within the element array that reference vertex data that lies outside the enabled attribute’s vertex buffer object
[for OpenGL ES] result in undefined values
[for OpenGL] result in reading zero
for the corresponding attributes, but cannot result in application failure.

I try to change my test code :

vertexArray[ ]={
  -0.5,0.5,0.0,1.0,
  -1.0,0.5,0.0,1.0,
  -0.5,0.0,0.0,1.0,
  -0.5,1.0,0.0,1.0,
}
indices[ ]={
  0,1,2
  1,2,3,
}
glDrawElements(GL_TRIANGLES,12,GL_UNSINGED_SHORT,0);

to

vertexArray[ ]={
  -0.5,0.5,0.0,1.0,
  -1.0,0.5,0.0,1.0,
  -0.5,0.0,0.0,1.0,
  -0.5,1.0,0.0,1.0,
}
indices[ ]={
  0,1,2
  1,2,4,
}
glDrawElements(GL_TRIANGLES,12,GL_UNSINGED_SHORT,0);

indices[6]=4, while vertexArray[4] is out of this array, I thought in this case, out of buffer access happened.(Is it right?)

but regardless of whether I enable robust buffer access or not, the result of draw is to replace the wrong index point with (0.0,0.0,0.0,1.0) point.
I want to konw if I misunderstand this passage(In my code, indices[ ] is element array index, vertexArray[ ] is attribute vertex buffer object, that’s my understanding).

How did you determine that it was being replaced with (0, 0, 0, 1) instead of (0, 0, 0, 0)?

Also, undefined behavior mean undefined undefined. If an implementation wants to provide the effect of robust access even if you don’t ask for it, that is its right.

Yes, I made a mistake. I am not sure if the return is (0.0,0.0,0.0,0.0) or(0.0,0.0,0.0,1.0) or w ranges in [0.0,1.0].I will test it again.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.