Commit 901dd545 by Mohan Maiya Committed by Commit Bot

Rectify bug in initialization of offsets for uniform variables

Make sure to set a uniform's flattenedOffsetInParentArrays value only if it has a valid parent array index. Serialize/Deserialize flattenedOffsetInParentArrays value. Bug: angleproject:3216 Bug: angleproject:3217 Bug: angleproject:3665 Change-Id: I6e4d003b1dd74b330bcf153f8d3df92414f198dd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1704219 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 523dbf40
......@@ -621,6 +621,7 @@ void WriteShaderVar(BinaryOutputStream *stream, const sh::ShaderVariable &var)
stream->writeInt(var.staticUse);
stream->writeInt(var.active);
stream->writeString(var.structName);
stream->writeInt(var.hasParentArrayIndex() ? var.parentArrayIndex() : -1);
ASSERT(var.fields.empty());
}
......@@ -634,6 +635,7 @@ void LoadShaderVar(BinaryInputStream *stream, sh::ShaderVariable *var)
var->staticUse = stream->readBool();
var->active = stream->readBool();
var->structName = stream->readString();
var->setParentArrayIndex(stream->readInt<int>());
}
void WriteShaderVariableBuffer(BinaryOutputStream *stream, const ShaderVariableBuffer &var)
......
......@@ -468,7 +468,10 @@ class FlattenUniformVisitor : public sh::VariableNameVisitor
linkedUniform.mappedName = fullMappedNameWithArrayIndex;
linkedUniform.active = mMarkActive;
linkedUniform.staticUse = mMarkStaticUse;
linkedUniform.setParentArrayIndex(variable.parentArrayIndex());
if (variable.hasParentArrayIndex())
{
linkedUniform.setParentArrayIndex(variable.parentArrayIndex());
}
if (mMarkActive)
{
linkedUniform.setActive(mShaderType, 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