Commit a6c8e1c0 by Cody Northrop Committed by Commit Bot

Capture/Replay: Fix default uniform matrix capture

We were only reading back a single location, rather than multiple locations required for arrayed types. Test: Angry Birds 2 MEC Bug: b/157672184 Change-Id: I8029dc5ece3b9dbff7c3c84c188996e622362767 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2231804 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 82809fcd
......@@ -1533,12 +1533,20 @@ void CaptureUpdateUniformValues(const gl::State &replayState,
const gl::UniformTypeInfo *typeInfo = uniform.typeInfo;
int uniformSize = uniformCount * typeInfo->componentCount;
// For arrayed uniforms, we'll need to increment a read location
gl::UniformLocation readLoc = uniformLoc;
switch (typeInfo->componentType)
{
case GL_FLOAT:
{
std::vector<GLfloat> uniformBuffer(uniformSize);
program->getUniformfv(context, uniformLoc, uniformBuffer.data());
for (int index = 0; index < uniformCount; index++, readLoc.value++)
{
program->getUniformfv(
context, readLoc,
static_cast<GLfloat *>(uniformBuffer.data() + index * sizeof(GLfloat)));
}
switch (typeInfo->type)
{
// Note: All matrix uniforms are populated without transpose
......@@ -1612,7 +1620,12 @@ void CaptureUpdateUniformValues(const gl::State &replayState,
case GL_INT:
{
std::vector<GLint> uniformBuffer(uniformSize);
program->getUniformiv(context, uniformLoc, uniformBuffer.data());
for (int index = 0; index < uniformCount; index++, readLoc.value++)
{
program->getUniformiv(
context, readLoc,
static_cast<GLint *>(uniformBuffer.data() + index * sizeof(GLint)));
}
switch (typeInfo->componentCount)
{
case 4:
......@@ -1641,7 +1654,12 @@ void CaptureUpdateUniformValues(const gl::State &replayState,
case GL_UNSIGNED_INT:
{
std::vector<GLuint> uniformBuffer(uniformSize);
program->getUniformuiv(context, uniformLoc, uniformBuffer.data());
for (int index = 0; index < uniformCount; index++, readLoc.value++)
{
program->getUniformuiv(
context, readLoc,
static_cast<GLuint *>(uniformBuffer.data() + index * sizeof(GLuint)));
}
switch (typeInfo->componentCount)
{
case 4:
......
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