aboutsummaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-07-15 09:56:24 -0400
committerMarge Bot <[email protected]>2020-07-15 22:19:37 +0000
commitda2eed36f3ccdd8ada2dc701d722f475dcf3dbea (patch)
tree2f1eb3f56e0359cde5ae44013f5950ce1121ed75 /src/panfrost/midgard
parentb2749c141d542191c22fb2e824b6bb2d8e684250 (diff)
pan/mdg: Implement gl_SampleID
Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5929>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/midgard_compile.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index d8780dfd60b..fa9ff9eb07f 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1636,6 +1636,22 @@ emit_vertex_builtin(compiler_context *ctx, nir_intrinsic_instr *instr)
}
static void
+emit_msaa_builtin(compiler_context *ctx, nir_intrinsic_instr *instr)
+{
+ unsigned reg = nir_dest_index(&instr->dest);
+
+ midgard_instruction ld = m_ld_color_buffer_32u(reg, 0);
+ ld.load_store.op = midgard_op_ld_color_buffer_32u_old;
+ ld.load_store.address = 97;
+ ld.load_store.arg_2 = 0x1E;
+
+ for (int i = 0; i < 4; ++i)
+ ld.swizzle[0][i] = COMPONENT_X;
+
+ emit_mir_instruction(ctx, ld);
+}
+
+static void
emit_control_barrier(compiler_context *ctx)
{
midgard_instruction ins = {
@@ -2015,6 +2031,10 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
emit_vertex_builtin(ctx, instr);
break;
+ case nir_intrinsic_load_sample_id:
+ emit_msaa_builtin(ctx, instr);
+ break;
+
case nir_intrinsic_memory_barrier_buffer:
case nir_intrinsic_memory_barrier_shared:
break;