summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-29 11:18:04 -0700
committerJason Ekstrand <[email protected]>2017-10-12 22:39:31 -0700
commit2e317a4b6d77ab078bdc9b21765f6051c4577c5e (patch)
tree947d3c320be2a2a3fe607c7afa7e6bdae41722d0 /src
parent6b31229592df76eefc1aa41d5b936ad2bb6b5598 (diff)
anv/pipeline: Refactor setup of the prog_data::param array
Now that the only thing we put in the array up-front are client push constants, we can simplify anv_pipeline_compile a bit. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/anv_pipeline.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 97bc840e617..7bfdb5c5509 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -393,22 +393,15 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
- /* Figure out the number of parameters */
- prog_data->nr_params = 0;
-
if (nir->num_uniforms > 0) {
+ assert(prog_data->nr_params == 0);
+
/* If the shader uses any push constants at all, we'll just give
* 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);
- }
-
- if (nir->info.num_ssbos > 0 || nir->info.num_images > 0)
- pipeline->needs_data_cache = true;
-
- if (prog_data->nr_params > 0) {
prog_data->param = ralloc_array(mem_ctx, uint32_t, prog_data->nr_params);
/* We now set the param values to be offsets into a
@@ -417,14 +410,16 @@ anv_pipeline_compile(struct anv_pipeline *pipeline,
* params array, it doesn't really matter what we put here.
*/
struct anv_push_constants *null_data = NULL;
- if (nir->num_uniforms > 0) {
- /* Fill out the push constants section of the param array */
- for (unsigned i = 0; i < MAX_PUSH_CONSTANTS_SIZE / sizeof(float); i++)
- prog_data->param[i] = ANV_PARAM_PUSH(
- (uintptr_t)&null_data->client_data[i * sizeof(float)]);
+ /* Fill out the push constants section of the param array */
+ for (unsigned i = 0; i < MAX_PUSH_CONSTANTS_SIZE / sizeof(float); i++) {
+ prog_data->param[i] = ANV_PARAM_PUSH(
+ (uintptr_t)&null_data->client_data[i * sizeof(float)]);
}
}
+ if (nir->info.num_ssbos > 0 || nir->info.num_images > 0)
+ pipeline->needs_data_cache = true;
+
/* Apply the actual pipeline layout to UBOs, SSBOs, and textures */
if (pipeline->layout)
anv_nir_apply_pipeline_layout(pipeline, nir, prog_data, map);