diff options
author | Bas Nieuwenhuizen <[email protected]> | 2018-03-25 16:22:46 +0200 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-22 20:54:02 -0700 |
commit | 5780af9880537b9036147eb0b287057263632660 (patch) | |
tree | 02a1ba758993a3f69cf8445a83ce0aab4870d6f6 /src/amd/vulkan | |
parent | 506a07e4e3a414c712e4b14596f1a6ba6dd3c066 (diff) |
radv: Add shader info support for image deref instructions.
Acked-by: Rob Clark <[email protected]>
Acked-by: Bas Nieuwenhuizen <[email protected]>
Acked-by: Dave Airlie <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_shader_info.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/amd/vulkan/radv_shader_info.c b/src/amd/vulkan/radv_shader_info.c index 7dd158d0b7e..448babb3ca0 100644 --- a/src/amd/vulkan/radv_shader_info.c +++ b/src/amd/vulkan/radv_shader_info.c @@ -239,9 +239,7 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr, case nir_intrinsic_image_var_atomic_exchange: case nir_intrinsic_image_var_atomic_comp_swap: case nir_intrinsic_image_var_size: { - const struct glsl_type *type = instr->variables[0]->var->type; - if(instr->variables[0]->deref.child) - type = instr->variables[0]->deref.child->type; + const struct glsl_type *type = glsl_without_array(instr->variables[0]->var->type); enum glsl_sampler_dim dim = glsl_get_sampler_dim(type); if (dim == GLSL_SAMPLER_DIM_SUBPASS || @@ -265,6 +263,42 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr, } break; } + case nir_intrinsic_image_deref_load: + case nir_intrinsic_image_deref_store: + case nir_intrinsic_image_deref_atomic_add: + case nir_intrinsic_image_deref_atomic_min: + case nir_intrinsic_image_deref_atomic_max: + case nir_intrinsic_image_deref_atomic_and: + case nir_intrinsic_image_deref_atomic_or: + case nir_intrinsic_image_deref_atomic_xor: + case nir_intrinsic_image_deref_atomic_exchange: + case nir_intrinsic_image_deref_atomic_comp_swap: + case nir_intrinsic_image_deref_size: { + nir_variable *var = nir_deref_instr_get_variable(nir_instr_as_deref(instr->src[0].ssa->parent_instr)); + const struct glsl_type *type = glsl_without_array(var->type); + + enum glsl_sampler_dim dim = glsl_get_sampler_dim(type); + if (dim == GLSL_SAMPLER_DIM_SUBPASS || + dim == GLSL_SAMPLER_DIM_SUBPASS_MS) { + info->ps.layer_input = true; + info->ps.uses_input_attachments = true; + } + mark_sampler_desc(var, info); + + if (nir_intrinsic_image_deref_store || + nir_intrinsic_image_deref_atomic_add || + nir_intrinsic_image_deref_atomic_min || + nir_intrinsic_image_deref_atomic_max || + nir_intrinsic_image_deref_atomic_and || + nir_intrinsic_image_deref_atomic_or || + nir_intrinsic_image_deref_atomic_xor || + nir_intrinsic_image_deref_atomic_exchange || + nir_intrinsic_image_deref_atomic_comp_swap) { + if (nir->info.stage == MESA_SHADER_FRAGMENT) + info->ps.writes_memory = true; + } + break; + } case nir_intrinsic_store_ssbo: case nir_intrinsic_ssbo_atomic_add: case nir_intrinsic_ssbo_atomic_imin: |