Module: Mesa
Branch: master
Commit: c848e642d2ec75ed6b58fe15e6ac13cbfbe1e85c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c848e642d2ec75ed6b58fe15e6ac13cbfbe1e85c

Author: Bas Nieuwenhuizen <[email protected]>
Date:   Wed Aug 16 21:57:29 2017 +0200

ac/nir: Determine if input attachments are used in the info pass.

Reviewed-by: Dave Airlie <[email protected]>

---

 src/amd/common/ac_shader_info.c | 11 ++++++++++-
 src/amd/common/ac_shader_info.h |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_shader_info.c b/src/amd/common/ac_shader_info.c
index 8668c4c344..ca59965e2d 100644
--- a/src/amd/common/ac_shader_info.c
+++ b/src/amd/common/ac_shader_info.c
@@ -64,9 +64,18 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, struct 
ac_shader_info *info)
        case nir_intrinsic_image_atomic_xor:
        case nir_intrinsic_image_atomic_exchange:
        case nir_intrinsic_image_atomic_comp_swap:
-       case nir_intrinsic_image_size:
+       case nir_intrinsic_image_size: {
+               const struct glsl_type *type = instr->variables[0]->var->type;
+               if(instr->variables[0]->deref.child)
+                       type = instr->variables[0]->deref.child->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.uses_input_attachments = true;
                mark_sampler_desc(instr->variables[0]->var, info);
                break;
+       }
        default:
                break;
        }
diff --git a/src/amd/common/ac_shader_info.h b/src/amd/common/ac_shader_info.h
index 965ad542a2..886b5e84b5 100644
--- a/src/amd/common/ac_shader_info.h
+++ b/src/amd/common/ac_shader_info.h
@@ -38,6 +38,7 @@ struct ac_shader_info {
        struct {
                bool force_persample;
                bool needs_sample_positions;
+               bool uses_input_attachments;
        } ps;
        struct {
                uint8_t grid_components_used;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to