pan/bi: Implement store_vary for vertex shaders
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 6 Mar 2020 14:44:19 +0000 (09:44 -0500)
committerMarge Bot <eric+marge@anholt.net>
Sat, 7 Mar 2020 00:37:39 +0000 (00:37 +0000)
As far as I/O goes, these four should hold us over for a while.

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

src/panfrost/bifrost/bifrost_compile.c

index a22d6420117185767af88c187245d09e824c50bc..c48a3d37d4dfc70c1af45481f5d45f5dc9deb0f9 100644 (file)
@@ -140,6 +140,31 @@ bi_emit_ld_attr(bi_context *ctx, nir_intrinsic_instr *instr)
         bi_emit(ctx, load);
 }
 
+static void
+bi_emit_st_vary(bi_context *ctx, nir_intrinsic_instr *instr)
+{
+        nir_src *offset = nir_get_io_offset_src(instr);
+        assert(nir_src_is_const(*offset)); /* no indirects */
+
+        bi_instruction address = {
+                .type = BI_LOAD_VAR_ADDRESS,
+                .load = bi_direct_load_for_instr(instr),
+                .dest_type = nir_intrinsic_type(instr),
+                .dest = bi_make_temp(ctx)
+        };
+
+        bi_instruction st = {
+                .type = BI_STORE_VAR,
+                .src = {
+                        address.dest,
+                        bir_src_index(&instr->src[0])
+                }
+        };
+
+        bi_emit(ctx, address);
+        bi_emit(ctx, st);
+}
+
 static void
 emit_intrinsic(bi_context *ctx, nir_intrinsic_instr *instr)
 {
@@ -162,9 +187,10 @@ emit_intrinsic(bi_context *ctx, nir_intrinsic_instr *instr)
         case nir_intrinsic_store_output:
                 if (ctx->stage == MESA_SHADER_FRAGMENT)
                         bi_emit_frag_out(ctx, instr);
-                else {
-                        /* TODO */
-                }
+                else if (ctx->stage == MESA_SHADER_VERTEX)
+                        bi_emit_st_vary(ctx, instr);
+                else
+                        unreachable("Unsupported shader stage");
                 break;
         default:
                 /* todo */