summaryrefslogtreecommitdiff
path: root/src/freedreno/ir3
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2022-12-21 20:17:13 -0800
committerMarge Bot <emma+marge@anholt.net>2022-12-29 17:42:42 +0000
commit75eb0d2891c2eb7574bd943a6a40493484047b48 (patch)
tree74ceeb7b6511cb9a39601d9805bd746ec16ae693 /src/freedreno/ir3
parent7cf7bf8b9ee87691816cf7d33d522b6417099f4b (diff)
downloadmesa-75eb0d2891c2eb7574bd943a6a40493484047b48.tar.gz
freedreno/ir3: Allow isam for non-bindless ssbo loads
We already had the infrastructure for this, dating back to a5xx, so this is low hanging fruit to hit the faster isam path. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20429>
Diffstat (limited to 'src/freedreno/ir3')
-rw-r--r--src/freedreno/ir3/ir3_compiler_nir.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 3d2109f8ee7..45cd8647814 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -1337,7 +1337,7 @@ struct tex_src_info {
* to handle with the image_mapping table..
*/
static struct tex_src_info
-get_image_ssbo_samp_tex_src(struct ir3_context *ctx, nir_src *src)
+get_image_ssbo_samp_tex_src(struct ir3_context *ctx, nir_src *src, bool image)
{
struct ir3_block *b = ctx->block;
struct tex_src_info info = {0};
@@ -1382,9 +1382,13 @@ get_image_ssbo_samp_tex_src(struct ir3_context *ctx, nir_src *src)
} else {
info.flags |= IR3_INSTR_S2EN;
unsigned slot = nir_src_as_uint(*src);
- unsigned tex_idx = ir3_image_to_tex(&ctx->so->image_mapping, slot);
+ unsigned tex_idx = image ?
+ ir3_image_to_tex(&ctx->so->image_mapping, slot) :
+ ir3_ssbo_to_tex(&ctx->so->image_mapping, slot);
struct ir3_instruction *texture, *sampler;
+ ctx->so->num_samp = MAX2(ctx->so->num_samp, tex_idx + 1);
+
texture = create_immed_typed(ctx->block, tex_idx, TYPE_U16);
sampler = create_immed_typed(ctx->block, tex_idx, TYPE_U16);
@@ -1440,7 +1444,7 @@ emit_intrinsic_load_image(struct ir3_context *ctx, nir_intrinsic_instr *intr,
}
struct ir3_block *b = ctx->block;
- struct tex_src_info info = get_image_ssbo_samp_tex_src(ctx, &intr->src[0]);
+ struct tex_src_info info = get_image_ssbo_samp_tex_src(ctx, &intr->src[0], true);
struct ir3_instruction *sam;
struct ir3_instruction *const *src0 = ir3_get_src(ctx, &intr->src[1]);
struct ir3_instruction *coords[4];
@@ -1482,7 +1486,7 @@ emit_intrinsic_image_size_tex(struct ir3_context *ctx,
struct ir3_instruction **dst)
{
struct ir3_block *b = ctx->block;
- struct tex_src_info info = get_image_ssbo_samp_tex_src(ctx, &intr->src[0]);
+ struct tex_src_info info = get_image_ssbo_samp_tex_src(ctx, &intr->src[0], true);
struct ir3_instruction *sam, *lod;
unsigned flags, ncoords = ir3_get_image_coords(intr, &flags);
type_t dst_type = nir_dest_bit_size(intr->dest) == 16 ? TYPE_U16 : TYPE_U32;
@@ -1526,7 +1530,6 @@ emit_intrinsic_load_ssbo(struct ir3_context *ctx,
{
/* Note: isam currently can't handle vectorized loads/stores */
if (!(nir_intrinsic_access(intr) & ACCESS_CAN_REORDER) ||
- !ir3_bindless_resource(intr->src[0]) ||
intr->dest.ssa.num_components > 1) {
ctx->funcs->emit_intrinsic_load_ssbo(ctx, intr, dst);
return;
@@ -1535,7 +1538,7 @@ emit_intrinsic_load_ssbo(struct ir3_context *ctx,
struct ir3_block *b = ctx->block;
struct ir3_instruction *offset = ir3_get_src(ctx, &intr->src[2])[0];
struct ir3_instruction *coords = ir3_collect(b, offset, create_immed(b, 0));
- struct tex_src_info info = get_image_ssbo_samp_tex_src(ctx, &intr->src[0]);
+ struct tex_src_info info = get_image_ssbo_samp_tex_src(ctx, &intr->src[0], false);
unsigned num_components = intr->dest.ssa.num_components;
struct ir3_instruction *sam =