mesa: add support to query GL_OFFSET for GL_TRANSFORM_FEEDBACK_VARYING
authorTimothy Arceri <timothy.arceri@collabora.com>
Thu, 10 Mar 2016 00:40:37 +0000 (11:40 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 31 Mar 2016 01:52:43 +0000 (12:52 +1100)
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/compiler/glsl/link_varyings.cpp
src/mesa/main/mtypes.h
src/mesa/main/shader_query.cpp

index d486b691f58cd1c195f9b7091735d239acd7e18f..b091eaf55128899dc4b18619b4b8dff8887f378e 100644 (file)
@@ -742,6 +742,7 @@ tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog,
    } else {
       xfb_offset = info->Buffers[buffer].Stride;
    }
+   info->Varyings[info->NumVarying].Offset = xfb_offset * 4;
 
    unsigned location = this->location;
    unsigned location_frac = this->location_frac;
index 1e15b69ab7055c54cbf21dab29f53b3ac75cee06..320297cdfe979251ed9e2490037cee3dd066520a 100644 (file)
@@ -1619,6 +1619,7 @@ struct gl_transform_feedback_varying_info
    char *Name;
    GLenum Type;
    GLint Size;
+   GLint Offset;
 };
 
 
index 247a26d4fdaba86f570e1197fedfe07d4055856c..15cc49afbfc2d684eef1aed24b57027e4aaeb4ed 100644 (file)
@@ -1186,9 +1186,17 @@ _mesa_program_resource_prop(struct gl_shader_program *shProg,
          goto invalid_operation;
       }
    case GL_OFFSET:
-      VALIDATE_TYPE_2(GL_UNIFORM, GL_BUFFER_VARIABLE);
-      *val = RESOURCE_UNI(res)->offset;
-      return 1;
+      switch (res->Type) {
+      case GL_UNIFORM:
+      case GL_BUFFER_VARIABLE:
+         *val = RESOURCE_UNI(res)->offset;
+         return 1;
+      case GL_TRANSFORM_FEEDBACK_VARYING:
+         *val = RESOURCE_XFV(res)->Offset;
+         return 1;
+      default:
+         goto invalid_operation;
+      }
    case GL_BLOCK_INDEX:
       VALIDATE_TYPE_2(GL_UNIFORM, GL_BUFFER_VARIABLE);
       *val = RESOURCE_UNI(res)->block_index;