pan/bi: Flesh out ATEST in IR
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 19 Mar 2020 03:02:12 +0000 (23:02 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 19 Mar 2020 03:23:07 +0000 (03:23 +0000)
ATEST actually takes two sources and has a destination. Although the
details are a little funny, we should still model this correctly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4242>

src/panfrost/bifrost/bi_tables.c
src/panfrost/bifrost/bifrost_compile.c

index 03d1bb72a4853fcbaa67a2476ffe16297b2601fa..72d2ccf2155c94b99d9e401cba1835bf1cc90af1 100644 (file)
@@ -28,7 +28,7 @@
 
 unsigned bi_class_props[BI_NUM_CLASSES] = {
         [BI_ADD]               = BI_GENERIC | BI_MODS | BI_SCHED_ALL,
-        [BI_ATEST]             = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR,
+        [BI_ATEST]             = BI_SCHED_HI_LATENCY | BI_SCHED_ADD,
         [BI_BRANCH]            = BI_SCHED_HI_LATENCY | BI_SCHED_ADD,
         [BI_CMP]               = BI_GENERIC | BI_MODS | BI_SCHED_ALL,
         [BI_BLEND]             = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR,
index 144afe6187356df2fdc17f3667c367f001b2fcc4..e19f0961e9be60ba324a3a0cfff39f6411208dfc 100644 (file)
@@ -120,7 +120,22 @@ bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr)
 {
         if (!ctx->emitted_atest) {
                 bi_instruction ins = {
-                        .type = BI_ATEST
+                        .type = BI_ATEST,
+                        .src = {
+                                BIR_INDEX_REGISTER | 60 /* TODO: RA */,
+                                bir_src_index(&instr->src[0])
+                        },
+                        .src_types = {
+                                nir_type_uint32,
+                                nir_type_float32
+                        },
+                        .swizzle = {
+                                { 0 },
+                                { 3, 0 } /* swizzle out the alpha */
+                        },
+                        .dest = BIR_INDEX_REGISTER | 60 /* TODO: RA */,
+                        .dest_type = nir_type_uint32,
+                        .writemask = 0xF
                 };
 
                 bi_emit(ctx, ins);