Commit 5f6937ca by Jamie Madill

Align static and streaming vertex data to 16-byte boundaries.

Certain vertex formats using fewer than 4 bytes could confuse our buffer code, giving us improperly aligned offsets. Aligning vertex data across the board should fix the problem, and minimal cost. Change-Id: I6884b4ddcfb91ef309a970593aaf7932cb65712e Reviewed-on: https://chromium-review.googlesource.com/185196Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 4a667fe9
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "libGLESv2/renderer/Renderer.h" #include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/VertexAttribute.h" #include "libGLESv2/VertexAttribute.h"
#include "libGLESv2/renderer/BufferStorage.h" #include "libGLESv2/renderer/BufferStorage.h"
#include "common/mathutil.h"
namespace rx namespace rx
{ {
...@@ -120,6 +121,9 @@ bool VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &att ...@@ -120,6 +121,9 @@ bool VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &att
mWritePosition += spaceRequired; mWritePosition += spaceRequired;
// Align to 16-byte boundary
mWritePosition = rx::roundUp(mWritePosition, 16u);
return true; return true;
} }
...@@ -138,6 +142,10 @@ bool VertexBufferInterface::reserveVertexSpace(const gl::VertexAttribute &attrib ...@@ -138,6 +142,10 @@ bool VertexBufferInterface::reserveVertexSpace(const gl::VertexAttribute &attrib
} }
mReservedSpace += requiredSpace; mReservedSpace += requiredSpace;
// Align to 16-byte boundary
mReservedSpace = rx::roundUp(mReservedSpace, 16u);
return true; return true;
} }
......
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