anv/pipeline: Whack nir->num_uniforms to MAX_PUSH_CONSTANT_SIZE
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 29 Sep 2017 18:09:04 +0000 (11:09 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 13 Oct 2017 05:39:31 +0000 (22:39 -0700)
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.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/vulkan/anv_pipeline.c

index 148d080e9c31461638ad983b83469cecdbb5d9d4..bac2a1eeea616f370535abda05d841d9ab994ca5 100644 (file)
@@ -401,6 +401,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);
    }
 
@@ -433,10 +434,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;
 }