[Mesa-dev] [PATCH 2/4] panfrost: Use nir_gather_info information about discards

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Wed Jul 24 00:05:58 UTC 2019


No need to track this ourselves!

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 src/gallium/drivers/panfrost/pan_assemble.c | 2 +-
 src/panfrost/midgard/compiler.h             | 3 ---
 src/panfrost/midgard/midgard_compile.c      | 4 ----
 src/panfrost/midgard/midgard_compile.h      | 1 -
 4 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index 334ea83305a..75158089c88 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -91,7 +91,7 @@ panfrost_shader_compile(struct panfrost_context *ctx, struct mali_shader_meta *m
         meta->varying_count = program.varying_count;
         meta->midgard1.work_count = program.work_register_count;
 
-        state->can_discard = program.can_discard;
+        state->can_discard = s->info.fs.uses_discard;
         state->writes_point_size = program.writes_point_size;
         state->reads_point_coord = false;
         state->helper_invocations = s->info.fs.needs_helper_invocations;
diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h
index a3e174cb30c..2d5f07451a5 100644
--- a/src/panfrost/midgard/compiler.h
+++ b/src/panfrost/midgard/compiler.h
@@ -244,9 +244,6 @@ typedef struct compiler_context {
         /* Mapping of texture register -> SSA index for unaliasing */
         int texture_index[2];
 
-        /* If any path hits a discard instruction */
-        bool can_discard;
-
         /* The number of uniforms allowable for the fast path */
         int uniform_cutoff;
 
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 5e5356ff72b..251eaed44e0 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1248,8 +1248,6 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
                 struct midgard_instruction discard = v_branch(conditional, false);
                 discard.branch.target_type = TARGET_DISCARD;
                 emit_mir_instruction(ctx, discard);
-
-                ctx->can_discard = true;
                 break;
         }
 
@@ -2702,8 +2700,6 @@ midgard_compile_shader_nir(struct midgard_screen *screen, nir_shader *nir, midga
 
         /* Deal with off-by-one related to the fencepost problem */
         program->work_register_count = ctx->work_registers + 1;
-
-        program->can_discard = ctx->can_discard;
         program->uniform_cutoff = ctx->uniform_cutoff;
 
         program->blend_patch_offset = ctx->blend_constant_offset;
diff --git a/src/panfrost/midgard/midgard_compile.h b/src/panfrost/midgard/midgard_compile.h
index 2c86ccbca7b..f76715e7a53 100644
--- a/src/panfrost/midgard/midgard_compile.h
+++ b/src/panfrost/midgard/midgard_compile.h
@@ -89,7 +89,6 @@ typedef struct {
         unsigned varyings[32];
 
         /* Boolean properties of the program */
-        bool can_discard;
         bool writes_point_size;
 
         int first_tag;
-- 
2.20.1



More information about the mesa-dev mailing list