pan/bi: Canonicalize terminate_discarded_threads
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 2 Oct 2020 17:27:15 +0000 (13:27 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Sat, 10 Oct 2020 20:53:09 +0000 (16:53 -0400)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>

src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/bifrost.h
src/panfrost/bifrost/disassemble.c

index b77ef2c..8fef1a4 100644 (file)
@@ -47,7 +47,7 @@ bi_pack_header(bi_clause *clause, bi_clause *next_1, bi_clause *next_2, bool is_
         struct bifrost_header header = {
                 .back_to_back = clause->back_to_back,
                 .no_end_of_shader = (next_1 != NULL),
-                .elide_writes = is_fragment,
+                .terminate_discarded_threads = is_fragment,
                 .branch_cond = clause->branch_conditional || clause->back_to_back,
                 .datareg_writebarrier = clause->data_register_write_barrier,
                 .datareg = clause->data_register,
index ca34ab7..acb1035 100644 (file)
@@ -83,19 +83,11 @@ struct bifrost_header {
         unsigned back_to_back : 1;
         unsigned no_end_of_shader: 1;
         unsigned unk2 : 2;
-        // Set to true for fragment shaders, to implement this bit of spec text
-        // from section 7.1.5 of the GLSL ES spec:
-        //
-        // "Stores to image and buffer variables performed by helper invocations
-        // have no effect on the underlying image or buffer memory."
-        //
-        // Helper invocations are threads (invocations) corresponding to pixels in
-        // a quad that aren't actually part of the triangle, but are included to
-        // make derivatives work correctly. They're usually turned on, but they
-        // need to be masked off for GLSL-level stores. This bit seems to be the
-        // only bit that's actually different between fragment shaders and other
-        // shaders, so this is probably what it's doing.
-        unsigned elide_writes : 1;
+
+        /* Terminate discarded threads, rather than continuing execution. Set
+         * for fragment shaders for standard GL behaviour of DISCARD. */
+        unsigned terminate_discarded_threads : 1;
+
         // If backToBack is off:
         // - true for conditional branches and fallthrough
         // - false for unconditional branches
index fe1b116..0b972b4 100644 (file)
@@ -115,9 +115,6 @@ static void dump_header(FILE *fp, struct bifrost_header header, bool verbose)
                         fprintf(fp, "branch-uncond ");
         }
 
-        if (header.elide_writes)
-                fprintf(fp, "we ");
-
         if (header.suppress_inf)
                 fprintf(fp, "inf_suppress ");
         if (header.suppress_nan)
@@ -146,6 +143,9 @@ static void dump_header(FILE *fp, struct bifrost_header header, bool verbose)
         if (header.unk4)
                 fprintf(fp, "unk4 ");
 
+        if (header.terminate_discarded_threads)
+                fprintf(fp, "td ");
+
         fprintf(fp, "\n");
 
         if (verbose) {