diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-08-01 11:03:15 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-12 12:42:59 -0700 |
commit | 2efa025b055965c64301b5e497cdf2250d26b9ee (patch) | |
tree | 651d119242ee6f589fd20403d994ca79a9355c34 /src/panfrost/midgard | |
parent | e881aa8c12c1447423c4acee4bbaaf503b19b057 (diff) |
panfrost: Add SSBO system value
For each SSBO index we get from Gallium/NIR, we need two pieces of
information in the shader:
1. The address of the SSBO in GPU memory. Within the shader, we'll be
accessing it with raw memory load/store, so we need the actual address,
not just an index.
2. The size of the SSBO. This is not strictly necessary, but at some
point, we may like to do bounds checking on SSBO accesses.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r-- | src/panfrost/midgard/midgard_compile.c | 12 | ||||
-rw-r--r-- | src/panfrost/midgard/midgard_compile.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index d5770b20e2d..c3752784b6b 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -306,6 +306,16 @@ midgard_nir_lower_fdot2_body(nir_builder *b, nir_alu_instr *alu) } static int +midgard_sysval_for_ssbo(nir_intrinsic_instr *instr) +{ + nir_src index = instr->src[0]; + assert(nir_src_is_const(index)); + uint32_t uindex = nir_src_as_uint(index); + + return PAN_SYSVAL(SSBO, uindex); +} + +static int midgard_nir_sysval_for_intrinsic(nir_intrinsic_instr *instr) { switch (instr->intrinsic) { @@ -313,6 +323,8 @@ midgard_nir_sysval_for_intrinsic(nir_intrinsic_instr *instr) return PAN_SYSVAL_VIEWPORT_SCALE; case nir_intrinsic_load_viewport_offset: return PAN_SYSVAL_VIEWPORT_OFFSET; + case nir_intrinsic_load_ssbo: + return midgard_sysval_for_ssbo(instr); default: return -1; } diff --git a/src/panfrost/midgard/midgard_compile.h b/src/panfrost/midgard/midgard_compile.h index 389dd1e305f..a15d6c0cded 100644 --- a/src/panfrost/midgard/midgard_compile.h +++ b/src/panfrost/midgard/midgard_compile.h @@ -66,6 +66,7 @@ enum { PAN_SYSVAL_VIEWPORT_SCALE = 1, PAN_SYSVAL_VIEWPORT_OFFSET = 2, PAN_SYSVAL_TEXTURE_SIZE = 3, + PAN_SYSVAL_SSBO = 4, } pan_sysval; #define PAN_TXS_SYSVAL_ID(texidx, dim, is_array) \ |