summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorJose Fonseca <[email protected]>2015-04-28 21:49:36 +0100
committerJose Fonseca <[email protected]>2015-04-29 06:42:12 +0100
commit114ac39a888509b133f15ddae813fcf64adc72a7 (patch)
treea5b7e9bb6f08b0f3e1f90d9ca001568a13256462 /src/mesa/main
parentc66c158e59298fc4183148c466dd4eecb945f87c (diff)
mesa: Fix glGetProgramiv(GL_ACTIVE_ATTRIBUTES).
It's returning random values, because RESOURCE_VAR() is casting different objects into ir_variable pointers. This updates _mesa_count_active_attribs to filter the resources with the same logic used in _mesa_longest_attribute_name_length. https://bugs.freedesktop.org/show_bug.cgi?id=90207 Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/shader_query.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index a84ec84090d..d2ca49b43a7 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -302,8 +302,10 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
struct gl_program_resource *res = shProg->ProgramResourceList;
unsigned count = 0;
for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) {
- if (is_active_attrib(RESOURCE_VAR(res)))
- count++;
+ if (res->Type == GL_PROGRAM_INPUT &&
+ res->StageReferences & (1 << MESA_SHADER_VERTEX) &&
+ is_active_attrib(RESOURCE_VAR(res)))
+ count++;
}
return count;
}