Commit fcef3366 by Jamie Madill

Fix bug with nested struct uniforms.

TRAC #22875 Change-Id: I204cea18a710f6b9206a578a69f1dbc1e13fbd71 Signed-off-by: Shannon Woods Signed-off-by: Geoff Lang
parent c6a2dcf8
......@@ -2377,7 +2377,7 @@ TextureType ProgramBinary::getTextureType(GLenum samplerType, InfoLog &infoLog)
bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, InfoLog &infoLog)
{
if (!constant.fields.empty())
if (constant.isStruct())
{
if (constant.arraySize > 0)
{
......@@ -2389,8 +2389,11 @@ bool ProgramBinary::defineUniform(GLenum shader, const sh::Uniform &constant, In
{
const sh::Uniform &field = constant.fields[fieldIndex];
const std::string &uniformName = constant.name + arrayString(elementIndex) + "." + field.name;
const sh::Uniform fieldUniform(field.type, field.precision, uniformName.c_str(), field.arraySize,
elementRegisterIndex, field.elementIndex);
sh::Uniform fieldUniform(field.type, field.precision, uniformName.c_str(), field.arraySize,
elementRegisterIndex, field.elementIndex);
fieldUniform.fields = field.fields;
if (!defineUniform(shader, fieldUniform, infoLog))
{
return false;
......
......@@ -69,6 +69,7 @@ bool Uniform::isInDefaultBlock() const
size_t Uniform::dataSize() const
{
ASSERT(type != GL_STRUCT_ANGLEX);
return UniformInternalSize(type) * elementCount();
}
......
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