[Mesa-dev] [PATCH 05/10] glsl/linker: Defer recording transform feedback locations.

Eric Anholt eric at anholt.net
Wed Dec 12 13:32:30 PST 2012


Paul Berry <stereotype441 at gmail.com> writes:

> This patch subdivides the loop that assigns varying locations into two
> phases: one phase to match up varyings between shader stages (and
> assign them varying locations), and a second phase to record the
> varying assignments for use by transform feedback.


> -bool
> -tfeedback_decl::accumulate_num_outputs(struct gl_shader_program *prog,
> -                                       unsigned *count)
> +unsigned
> +tfeedback_decl::accumulate_num_outputs(struct gl_shader_program *prog)
>  {
>     if (!this->is_varying()) {
> -      return true;
> -   }
> -
> -   if (!this->is_assigned()) {
> -      /* From GL_EXT_transform_feedback:
> -       *   A program will fail to link if:
> -       *
> -       *   * any variable name specified in the <varyings> array is not
> -       *     declared as an output in the geometry shader (if present) or
> -       *     the vertex shader (if no geometry shader is present);
> -       */
> -      linker_error(prog, "Transform feedback varying %s undeclared.",
> -                   this->orig_name);
> -      return false;
> +      return 0;
>     }
>  
>     unsigned translated_size = this->size;
>     if (this->is_clip_distance_mesa)
>        translated_size = (translated_size + 3) / 4;
>  
> -   *count += translated_size * this->matrix_columns;
> -
> -   return true;
> +   return translated_size * this->matrix_columns;
>  }

It looks like this function is no longer accumulate_num_outputs(), and
might be better called get_num_outputs() now.  Also I think the prog
argument can go away.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20121212/0af161cf/attachment-0001.pgp>


More information about the mesa-dev mailing list