Silently ignore attempts to delete default VAO. The spec for glDeleteVertexArrays states that "Unused names in arrays are silently ignored, as is the value zero." b/116699321 Change-Id: I7cca0336dd9841b360f8fa20f6c0ac9677ec3ce1 Reviewed-on: https://swiftshader-review.googlesource.com/21048 Reviewed-by: Chris Forbes <chrisforbes@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com> Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/libGLESv2/libGLESv2.cpp b/src/OpenGL/libGLESv2/libGLESv2.cpp index 4c31d44..541b116 100644 --- a/src/OpenGL/libGLESv2/libGLESv2.cpp +++ b/src/OpenGL/libGLESv2/libGLESv2.cpp
@@ -1179,7 +1179,7 @@ { for(int i = 0; i < n; i++) { - if(framebuffers[i] != 0) + if(framebuffers[i] != 0) // Attempts to delete default framebuffer silently ignored. { context->deleteFramebuffer(framebuffers[i]); } @@ -1300,7 +1300,7 @@ { for(int i = 0; i < n; i++) { - if(textures[i] != 0) + if(textures[i] != 0) // Attempts to delete default texture silently ignored. { context->deleteTexture(textures[i]); }
diff --git a/src/OpenGL/libGLESv2/libGLESv3.cpp b/src/OpenGL/libGLESv2/libGLESv3.cpp index 709c129..89055d8 100644 --- a/src/OpenGL/libGLESv2/libGLESv3.cpp +++ b/src/OpenGL/libGLESv2/libGLESv3.cpp
@@ -1499,7 +1499,10 @@ { for(int i = 0; i < n; i++) { - context->deleteVertexArray(arrays[i]); + if(arrays[i] != 0) // Attempts to delete default vertex array silently ignored. + { + context->deleteVertexArray(arrays[i]); + } } } } @@ -3374,7 +3377,7 @@ { for(int i = 0; i < n; i++) { - if(ids[i] != 0) + if(ids[i] != 0) // Attempts to delete default transform feedback silently ignored. { es2::TransformFeedback *transformFeedbackObject = context->getTransformFeedback(ids[i]);