[Mesa-dev] [PATCH 15/21] anv/pipeline: Whack nir->num_uniforms to MAX_PUSH_CONSTANT_SIZE

Kenneth Graunke kenneth at whitecape.org
Fri Oct 13 00:07:48 UTC 2017


On Friday, September 29, 2017 2:25:15 PM PDT Jason Ekstrand wrote:
> This way any image uniforms end up having locations higher than
> MAX_PUSH_CONSTANT_SIZE.  There's no bug here at the moment, but this
> consistency will make the next commit easier.  Also, because
> nir_apply_pipeline_layout properly increments nir->num_uniforms when
> it expands the param array, we no longer need to stomp it to match
> prog_data::nr_params because it already does.
> ---
>  src/intel/vulkan/anv_pipeline.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
> index 191ae55..691cdf8 100644
> --- a/src/intel/vulkan/anv_pipeline.c
> +++ b/src/intel/vulkan/anv_pipeline.c
> @@ -399,6 +399,7 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
>         * them the maximum possible number
>         */
>        assert(nir->num_uniforms <= MAX_PUSH_CONSTANTS_SIZE);
> +      nir->num_uniforms = MAX_PUSH_CONSTANTS_SIZE;
>        prog_data->nr_params += MAX_PUSH_CONSTANTS_SIZE / sizeof(float);
>     }
>  
> @@ -431,10 +432,7 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
>     if (pipeline->layout)
>        anv_nir_apply_pipeline_layout(pipeline, nir, prog_data, map);
>  
> -   /* nir_lower_io will only handle the push constants; we need to set this
> -    * to the full number of possible uniforms.
> -    */
> -   nir->num_uniforms = prog_data->nr_params * 4;
> +   assert(nir->num_uniforms == prog_data->nr_params * 4);
>  
>     return nir;
>  }
> 

I don't like this.  There are a bunch of places in the compiler that
assume that nir->num_uniforms / 4 is the number of uniforms...which
is already pretty bogus, to be honest, but...now it's like we've given
up all pretense of having units or having a meaningful value here...

Maybe we should just get rid of it altogether...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171012/c66290b2/attachment.sig>


More information about the mesa-dev mailing list