mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-07 07:11:06 +00:00
GL: Fallback for uniform lookup for arrays of dimension 1 Closes #3047
ie.
struct A {
vec3 m1;
vec3 m2;
vec3 m2;
};
uniform A a[1];
with a[0] being passed to a function.
Previously it would look for "a.m1", if that is not found then it looks for "a[0].m1" etc.
This commit is contained in:
@@ -2176,6 +2176,16 @@ void GLReplay::OpenGLFillCBufferVariables(ResourceId shader, GLuint prog, bool b
|
||||
|
||||
GLuint idx = GL.glGetProgramResourceIndex(prog, eGL_UNIFORM, fullname.c_str());
|
||||
|
||||
// if this is an array of size 1 try looking for <array_variable_name>[0].<member_name>
|
||||
if((idx == GL_INVALID_INDEX) && (desc.elements == 1))
|
||||
{
|
||||
rdcstr arrayZeroName = prefix;
|
||||
if(!arrayZeroName.empty() && arrayZeroName.back() == '.')
|
||||
arrayZeroName.pop_back();
|
||||
arrayZeroName += "[0]." + var.name;
|
||||
|
||||
idx = GL.glGetProgramResourceIndex(prog, eGL_UNIFORM, arrayZeroName.c_str());
|
||||
}
|
||||
if(idx == GL_INVALID_INDEX)
|
||||
{
|
||||
// this might not be an error, this might be the corresponding member in an array-of-structs
|
||||
|
||||
Reference in New Issue
Block a user