From 2975e4c56a7aeade5a324aa4d446f18cc176fa06 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 28 Sep 2017 16:25:31 -0700 Subject: intel: Rewrite the world of push/pull params This moves us away to the array of pointers model and onto a model where each param is represented by a generic uint32_t handle. We reserve 2^16 of these handles for builtins that get generated by somewhere inside the compiler and have well-defined meanings. Generic params have handles whose meanings are defined by the driver. The primary downside to this new approach is that it moves a little bit of the work that we would normally do at compile time to draw time. On my laptop this hurts OglBatch6 by no more than 1% and doesn't seem to have any measurable affect on OglBatch7. So, while this may come back to bite us, it doesn't look too bad. Reviewed-by: Jordan Justen Reviewed-by: Kenneth Graunke --- src/intel/vulkan/anv_pipeline.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/intel/vulkan/anv_pipeline.c') diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 3db9b9a6246..e6a7393a3d3 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -415,8 +415,7 @@ anv_pipeline_compile(struct anv_pipeline *pipeline, if (prog_data->nr_params > 0) { /* XXX: I think we're leaking this */ - prog_data->param = (const union gl_constant_value **) - malloc(prog_data->nr_params * sizeof(union gl_constant_value *)); + prog_data->param = malloc(prog_data->nr_params * sizeof(uint32_t)); /* We now set the param values to be offsets into a * anv_push_constant_data structure. Since the compiler doesn't @@ -427,8 +426,8 @@ anv_pipeline_compile(struct anv_pipeline *pipeline, 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] = (const union gl_constant_value *) - &null_data->client_data[i * sizeof(float)]; + prog_data->param[i] = ANV_PARAM_PUSH( + (uintptr_t)&null_data->client_data[i * sizeof(float)]); } } @@ -540,7 +539,7 @@ anv_pipeline_compile_vs(struct anv_pipeline *pipeline, unsigned code_size; const unsigned *shader_code = brw_compile_vs(compiler, NULL, mem_ctx, &key, &prog_data, nir, - NULL, false, -1, &code_size, NULL); + false, -1, &code_size, NULL); if (shader_code == NULL) { ralloc_free(mem_ctx); return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); -- cgit v1.2.3