[Mesa-dev] [PATCH 33/37] mesa: add support to query GL_OFFSET for GL_TRANSFORM_FEEDBACK_VARYING

Timothy Arceri timothy.arceri at collabora.com
Tue Mar 15 12:57:23 UTC 2016


---
 src/compiler/glsl/link_varyings.cpp |  1 +
 src/mesa/main/mtypes.h              |  1 +
 src/mesa/main/shader_query.cpp      | 14 +++++++++++---
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index a97dcc6..fb56d93 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -808,6 +808,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;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 217afe8..99745c1 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1620,6 +1620,7 @@ struct gl_transform_feedback_varying_info
    char *Name;
    GLenum Type;
    GLint Size;
+   GLint Offset;
 };
 
 
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index f2d4332..6263b0e 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -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;
-- 
2.5.0



More information about the mesa-dev mailing list