diff options
author | Jason Ekstrand <[email protected]> | 2015-10-29 22:24:54 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-10-29 22:26:36 -0700 |
commit | 3883728730f293b763a5641560375b18d4f97782 (patch) | |
tree | c4f5524a0eee4662ad0b7abb8dfd3a40c304fb3e /src/vulkan/anv_pipeline.c | |
parent | 1f2624e6dd75860156a0385c3ccfb351a9206cec (diff) |
anv: Add better push constant support
What we had before was kind of a hack where we made certain untrue
assumptions about the incoming data. This new support, while it still
doesn't support indirects properly (that will come), at least pulls the
offsets and strides from SPIR-V like it's supposed to.
Diffstat (limited to 'src/vulkan/anv_pipeline.c')
-rw-r--r-- | src/vulkan/anv_pipeline.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c index 59f304f55df..9fb5ddba20b 100644 --- a/src/vulkan/anv_pipeline.c +++ b/src/vulkan/anv_pipeline.c @@ -357,22 +357,12 @@ anv_pipeline_compile(struct anv_pipeline *pipeline, if (nir == NULL) return NULL; - bool have_push_constants = false; - nir_foreach_variable(var, &nir->uniforms) { - const struct glsl_type *type = var->type; - if (glsl_type_is_array(type)) - type = glsl_get_array_element(type); - - if (!glsl_type_is_sampler(type)) { - have_push_constants = true; - break; - } - } + anv_nir_lower_push_constants(nir, is_scalar_shader_stage(compiler, stage)); /* Figure out the number of parameters */ prog_data->nr_params = 0; - if (have_push_constants) { + if (nir->num_uniforms > 0) { /* If the shader uses any push constants at all, we'll just give * them the maximum possible number */ @@ -394,7 +384,7 @@ 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 (have_push_constants) { + 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 gl_constant_value *) |