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