[Mesa-dev] [PATCH 5/6] glsl: Disable transform feedback of varying structs.

Paul Berry stereotype441 at gmail.com
Mon Jan 21 14:16:25 PST 2013


It is not clear from the GLSL ES 3.00 spec how transform feedback is
supposed to apply to varying structs:

- There is no specification for how the structure is to be packed when
  it is recorded into the transform feedback buffer.

- There is no reasonable value for GetTransformFeedbackVarying to
  return as the "type" of the variable.

We currently have a Khronos bug requesting clarification on how this
feature is supposed to work
(https://cvs.khronos.org/bugzilla/show_bug.cgi?id=9856).

This patch just disables transform feedback of varying structs for
now; we can implement the proper behaviour once we find out from
Khronos what it is.
---
 src/glsl/link_varyings.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index d8f501c..25681d6 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -411,8 +411,17 @@ tfeedback_decl::find_output_var(gl_shader_program *prog,
    const char *name = this->is_clip_distance_mesa
       ? "gl_ClipDistanceMESA" : this->var_name;
    ir_variable *var = producer->symbols->get_variable(name);
-   if (var && var->mode == ir_var_shader_out)
+   if (var && var->mode == ir_var_shader_out) {
+      const glsl_type *type = var->type;
+      while (type->base_type == GLSL_TYPE_ARRAY)
+         type = type->fields.array;
+      if (type->base_type == GLSL_TYPE_STRUCT) {
+         linker_error(prog, "Transform feedback of varying structs not "
+                      "implemented yet.");
+         return NULL;
+      }
       return var;
+   }
 
    /* From GL_EXT_transform_feedback:
     *   A program will fail to link if:
-- 
1.8.1.1



More information about the mesa-dev mailing list