[Mesa-dev] [PATCH 20/21] mesa: add LOCATION_COMPONENT support to GetProgramResourceiv

Timothy Arceri timothy.arceri at collabora.com
Mon Dec 21 22:02:07 PST 2015


>From Section 7.3.1.1 (Naming Active Resources) of the OpenGL 4.5 spec:

   "For the property LOCATION_COMPONENT, a single integer indicating the first
   component of the location assigned to an active input or output variable is
   written to params. For input and output variables with a component specified
   by a layout qualifier, the specified component is written. For all other
   input and output variables, the value zero is written."
---
 src/mesa/main/shader_query.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index ced10a9..bb0fb0d 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1245,6 +1245,15 @@ _mesa_program_resource_prop(struct gl_shader_program *shProg,
       default:
          goto invalid_operation;
       }
+   case GL_LOCATION_COMPONENT:
+      switch (res->Type) {
+      case GL_PROGRAM_INPUT:
+      case GL_PROGRAM_OUTPUT:
+         *val = RESOURCE_VAR(res)->data.location_frac;
+         return 1;
+      default:
+         goto invalid_operation;
+      }
    case GL_LOCATION_INDEX:
       if (res->Type != GL_PROGRAM_OUTPUT)
          goto invalid_operation;
-- 
2.4.3



More information about the mesa-dev mailing list