glsl: Disable transform feedback of varying structs.
authorPaul Berry <stereotype441@gmail.com>
Thu, 17 Jan 2013 21:45:30 +0000 (13:45 -0800)
committerPaul Berry <stereotype441@gmail.com>
Fri, 25 Jan 2013 00:30:46 +0000 (16:30 -0800)
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.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/link_varyings.cpp

index d8f501cfd8bb577869f4164369f96805bc9385c7..25681d6185bdd8c982689e5d2120304974069c93 100644 (file)
@@ -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: