Commit 2d4b7be6 by Nicolas Capens

Don't crash when using a buffer with no data.

It's undefined behavior when an application attempts to use a buffer for which no data has been allocated yet, but this is trivial for us to check for and produce a non-fatal error. Bug chromium:736639 Change-Id: I795c22363ada1b5e325d1fb5061a9e7673609879 Reviewed-on: https://swiftshader-review.googlesource.com/10309Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 8fe836ad
...@@ -153,7 +153,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat ...@@ -153,7 +153,7 @@ GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, Translat
Buffer *buffer = attrib.mBoundBuffer; Buffer *buffer = attrib.mBoundBuffer;
if(!buffer && attrib.mPointer == nullptr) if((!buffer && attrib.mPointer == nullptr) || (buffer && !buffer->data()))
{ {
// This is an application error that would normally result in a crash, but we catch it and return an error // This is an application error that would normally result in a crash, but we catch it and return an error
ERR("An enabled vertex array has no buffer and no pointer."); ERR("An enabled vertex array has no buffer and no 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