Commit dafae035 by Alexis Hetu Committed by Alexis Hétu

glBufferSubData fix

According to the OpenGL ES 3.0 spec (section 2.9.2 Creating Buffer Object Data Stores) "If data is NULL, then the contents of the buffer object’s data store are undefined." So the function should behave the same way, perform the same checks, but simply skip the copy. Change-Id: If49e37a8e836618389e105b5377ff183ac3e3107 Reviewed-on: https://swiftshader-review.googlesource.com/3601Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent be381599
...@@ -72,7 +72,7 @@ void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage) ...@@ -72,7 +72,7 @@ void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset) void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
{ {
if(mContents) if(mContents && data)
{ {
char *buffer = (char*)mContents->lock(sw::PUBLIC); char *buffer = (char*)mContents->lock(sw::PUBLIC);
memcpy(buffer + offset, data, size); memcpy(buffer + offset, data, size);
......
...@@ -814,11 +814,6 @@ void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid ...@@ -814,11 +814,6 @@ void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid
return error(GL_INVALID_VALUE); return error(GL_INVALID_VALUE);
} }
if(data == NULL)
{
return;
}
es2::Context *context = es2::getContext(); es2::Context *context = es2::getContext();
if(context) if(context)
......
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