Commit c1ef1ada by Alexis Hetu Committed by Alexis Hétu

glVertexAttribPointer validation

GL_INVALID_OPERATION is generated if a non-zero vertex array object is bound, zero is bound to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL. Change-Id: I48e73dca96bac2bd0496c202785e46e7d754dc11 Reviewed-on: https://swiftshader-review.googlesource.com/13830Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 94ca5b63
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "Texture.h" #include "Texture.h"
#include "Query.h" #include "Query.h"
#include "TransformFeedback.h" #include "TransformFeedback.h"
#include "VertexArray.h"
#include "common/debug.h" #include "common/debug.h"
#include "Common/Version.h" #include "Common/Version.h"
...@@ -6186,6 +6187,14 @@ void VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normal ...@@ -6186,6 +6187,14 @@ void VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normal
if(context) if(context)
{ {
es2::VertexArray* vertexArray = context->getCurrentVertexArray();
if((context->getArrayBufferName() == 0) && vertexArray && (vertexArray->name != 0) && ptr)
{
// GL_INVALID_OPERATION is generated if a non-zero vertex array object is bound, zero is bound
// to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.
return error(GL_INVALID_OPERATION);
}
context->setVertexAttribState(index, context->getArrayBuffer(), size, type, (normalized == GL_TRUE), stride, ptr); context->setVertexAttribState(index, context->getArrayBuffer(), size, type, (normalized == GL_TRUE), stride, ptr);
} }
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "Texture.h" #include "Texture.h"
#include "mathutil.h" #include "mathutil.h"
#include "TransformFeedback.h" #include "TransformFeedback.h"
#include "VertexArray.h"
#include "common/debug.h" #include "common/debug.h"
#include <GLES3/gl3.h> #include <GLES3/gl3.h>
...@@ -2068,6 +2069,14 @@ GL_APICALL void GL_APIENTRY glVertexAttribIPointer(GLuint index, GLint size, GLe ...@@ -2068,6 +2069,14 @@ GL_APICALL void GL_APIENTRY glVertexAttribIPointer(GLuint index, GLint size, GLe
if(context) if(context)
{ {
es2::VertexArray* vertexArray = context->getCurrentVertexArray();
if((context->getArrayBufferName() == 0) && vertexArray && (vertexArray->name != 0) && pointer)
{
// GL_INVALID_OPERATION is generated if a non-zero vertex array object is bound, zero is bound
// to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.
return error(GL_INVALID_OPERATION);
}
context->setVertexAttribState(index, context->getArrayBuffer(), size, type, false, stride, pointer); context->setVertexAttribState(index, context->getArrayBuffer(), size, type, false, stride, pointer);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment