From 63e240dd0573968a3602424da3b963ba82d5cf6b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 2 Aug 2019 17:10:18 -0700 Subject: [PATCH] pan/midgard: Clamp sysval component count We don't want to load a 128-bit sysval when 64-bits will do. Fixes RA failures with SSBO indirect writes. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 2 +- src/panfrost/midgard/midgard_compile.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 899b4c60074..38bf1ecfaca 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -537,7 +537,7 @@ emit_ubo_read( unsigned index); void -emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override); +emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override, unsigned nr_components); void midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr); diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index fb3921effbc..72ed1ef064c 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -1219,7 +1219,8 @@ emit_varying_read( } void -emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override) +emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override, + unsigned nr_components) { unsigned dest = 0; @@ -1234,7 +1235,10 @@ emit_sysval_read(compiler_context *ctx, nir_instr *instr, signed dest_override) unsigned uniform = ((uintptr_t) val) - 1; /* Emit the read itself -- this is never indirect */ - emit_ubo_read(ctx, dest, uniform, NULL, 0); + midgard_instruction *ins = + emit_ubo_read(ctx, dest, uniform, NULL, 0); + + ins->mask = mask_of(nr_components); } static void @@ -1440,7 +1444,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr) case nir_intrinsic_load_viewport_scale: case nir_intrinsic_load_viewport_offset: - emit_sysval_read(ctx, &instr->instr, -1); + emit_sysval_read(ctx, &instr->instr, -1, 3); break; default: @@ -1667,7 +1671,7 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr) emit_texop_native(ctx, instr, TEXTURE_OP_TEXEL_FETCH); break; case nir_texop_txs: - emit_sysval_read(ctx, &instr->instr, -1); + emit_sysval_read(ctx, &instr->instr, -1, 4); break; default: unreachable("Unhanlded texture op"); -- 2.30.2