[Mesa-dev] [PATCH v4 01/38] mesa/st: translate SO info in glsl_to_nir() case

Marek Olšák maraeo at gmail.com
Thu Jan 11 01:16:01 UTC 2018


On Wed, Jan 10, 2018 at 3:54 AM, Karol Herbst <kherbst at redhat.com> wrote:
> From: Rob Clark <robdclark at gmail.com>
>
> This was handled for VS, but not for GS.
>
> Fixes for gallium drivers using nir:
> spec at arb_gpu_shader5@arb_gpu_shader5-xfb-streams-without-invocations
> spec at arb_gpu_shader5@arb_gpu_shader5-xfb-streams*
> spec at arb_transform_feedback3@arb_transform_feedback3-ext_interleaved_two_bufs_gs*
> spec at ext_transform_feedback@geometry-shaders-basic
> spec at ext_transform_feedback@* use_gs
> spec at glsl-1.50@execution at geometry@primitive-id*
> spec at glsl-1.50@execution at geometry@tri-strip-ordering-with-prim-restart gl_triangle_strip *
> spec at glsl-1.50@transform-feedback-builtins
> spec at glsl-1.50@transform-feedback-type-and-size
>
> v2: we don't need this for TCP
>
> Signed-off-by: Rob Clark <robdclark at gmail.com>
> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
> Tested-by: Karol Herbst <kherbst at redhat.com>
> ---
>  src/mesa/state_tracker/st_program.c | 57 ++++++++++++++++++++++++++++++++++---
>  1 file changed, 53 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
> index 05e6042f42..2a1a695948 100644
> --- a/src/mesa/state_tracker/st_program.c
> +++ b/src/mesa/state_tracker/st_program.c
> @@ -1421,6 +1421,50 @@ st_translate_program_common(struct st_context *st,
>     }
>  }
>
> +/**
> + * Update stream-output info for GS/TCS/TES.  Normally this is done in
> + * st_translate_program_common() but that is not called for glsl_to_nir
> + * case.
> + */
> +static void
> +st_translate_program_stream_output(struct gl_program *prog,
> +                                   struct pipe_stream_output_info *stream_output)
> +{
> +   if (!prog->sh.LinkedTransformFeedback)
> +      return;
> +
> +   ubyte outputMapping[VARYING_SLOT_TESS_MAX];
> +   GLuint attr;
> +   uint num_outputs = 0;
> +
> +   memset(outputMapping, 0, sizeof(outputMapping));
> +
> +   /*
> +    * Determine number of outputs, the (default) output register
> +    * mapping and the semantic information for each output.
> +    */
> +   for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
> +      if (prog->info.outputs_written & BITFIELD64_BIT(attr)) {
> +         GLuint slot = num_outputs++;
> +
> +         outputMapping[attr] = slot;
> +      }
> +   }
> +
> +   /* Also add patch outputs. */
> +   for (attr = 0; attr < 32; attr++) {
> +      if (prog->info.patch_outputs_written & (1u << attr)) {
> +         GLuint slot = num_outputs++;
> +         GLuint patch_attr = VARYING_SLOT_PATCH0 + attr;
> +
> +         outputMapping[patch_attr] = slot;
> +      }
> +   }

There are no patch outputs in shader stages supporting transform feedback.

Marek


More information about the mesa-dev mailing list