Only allow direct vertex buffers binding with attribute with 4 byte aligned offsets.

TRAC #22647 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1947 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 0693fc37
...@@ -67,7 +67,9 @@ static bool directStoragePossible(VertexBufferInterface* vb, const gl::VertexAtt ...@@ -67,7 +67,9 @@ static bool directStoragePossible(VertexBufferInterface* vb, const gl::VertexAtt
gl::Buffer *buffer = attrib.mBoundBuffer.get(); gl::Buffer *buffer = attrib.mBoundBuffer.get();
BufferStorage *storage = buffer ? buffer->getStorage() : NULL; BufferStorage *storage = buffer ? buffer->getStorage() : NULL;
return storage && storage->supportsDirectBinding() && !vb->getVertexBuffer()->requiresConversion(attrib) && attrib.stride() % 4 == 0; const bool isAligned = (attrib.stride() % 4 == 0) && (attrib.mOffset % 4 == 0);
return storage && storage->supportsDirectBinding() && !vb->getVertexBuffer()->requiresConversion(attrib) && isAligned;
} }
GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances) GLenum VertexDataManager::prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instances)
......
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