[Mesa-stable] [PATCH 1/3] i965/nir: Switch on shader stage in nir_lower_outputs().
Kenneth Graunke
kenneth at whitecape.org
Thu Oct 15 15:32:05 PDT 2015
On Thursday, October 15, 2015 03:17:19 PM Kenneth Graunke wrote:
> VS, GS, and FS continue doing the same thing they did before. We can
> simplify the FS code a bit because it is always scalar.
>
> Compute shaders now assert that there are no outputs instead of doing
> a loop over 0 outputs.
>
> Cc: mesa-stable at lists.freedesktop.org
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/i965/brw_nir.c | 26 +++++++++++++++++++++-----
> 1 file changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
> index af9d041..1b4dace 100644
> --- a/src/mesa/drivers/dri/i965/brw_nir.c
> +++ b/src/mesa/drivers/dri/i965/brw_nir.c
> @@ -112,11 +112,27 @@ brw_nir_lower_inputs(nir_shader *nir, bool is_scalar)
> static void
> brw_nir_lower_outputs(nir_shader *nir, bool is_scalar)
> {
> - if (is_scalar) {
> - nir_assign_var_locations(&nir->outputs, &nir->num_outputs, type_size_scalar);
> - } else {
> - nir_foreach_variable(var, &nir->outputs)
> - var->data.driver_location = var->data.location;
> + switch (nir->stage) {
> + case MESA_SHADER_VERTEX:
> + case MESA_SHADER_GEOMETRY:
> + if (is_scalar) {
> + nir_assign_var_locations(&nir->outputs, &nir->num_outputs,
> + type_size_scalar);
> + } else {
> + nir_foreach_variable(var, &nir->outputs)
> + var->data.driver_location = var->data.location;
> + }
> + break;
> + case MESA_SHADER_FRAGMENT:
> + nir_assign_var_locations(&nir->outputs, &nir->num_outputs,
> + type_size_scalar);
> + break;
> + case MESA_SHADER_COMPUTE:
> + /* Compute shaders have no outputs. */
> + assert(exec_list_is_empty(&nir->outputs));
> + break;
> + default:
> + unreachable("unsupported shader stage");
> }
> }
>
>
Ilia pointed out that the GLSL IR level varying packing makes it so
float/vec2 arrays don't happen - they get packed to vec4 arrays.
However, varying packing doesn't happen for tessellation stages.
So, I think we should drop the Cc: stable on these. I'd still
like to include them in master, however.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-stable/attachments/20151015/38428895/attachment.sig>
More information about the mesa-stable
mailing list