freedreno/a6xx: Switch over to bindless IBO

This allows support for SSBOs/images in all shader stages.  And also,
unlike the bindful IBO state, does not introduce a dependency on the
program state.  With bindless descriptors, SSBO and image fetch lowered
to isam can re-use the same descriptor.  This will let us remove the
TEX state dependency on PROG state (in a following cleanup commit).

Note, this does not yet switch the pipe caps to reflect that we can
support SSBOs/images in other shader stages.. because ir3 still tells us
nibo>0 even though we are using bindless and that triggers an assert in
the build_ibo() path.  Probably we want ir3 to be more clever.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20687>
This commit is contained in:
Rob Clark
2023-01-01 13:35:47 -08:00
committed by Marge Bot
parent e51975142c
commit ce1e73f441
2 changed files with 12 additions and 2 deletions

View File

@@ -62,6 +62,7 @@
#include "common/freedreno_uuid.h"
#include "a2xx/ir2.h"
#include "ir3/ir3_descriptor.h"
#include "ir3/ir3_gallium.h"
#include "ir3/ir3_nir.h"

View File

@@ -41,6 +41,7 @@
#include "ir3/ir3_cache.h"
#include "ir3/ir3_compiler.h"
#include "ir3/ir3_descriptor.h"
#include "ir3/ir3_gallium.h"
#include "ir3/ir3_nir.h"
#include "ir3/ir3_shader.h"
@@ -306,6 +307,9 @@ ir3_shader_compute_state_create(struct pipe_context *pctx,
nir = tgsi_to_nir(cso->prog, pctx->screen, false);
}
if (ctx->screen->gen >= 6)
ir3_nir_lower_io_to_bindless(nir);
struct ir3_shader *shader =
ir3_shader_from_nir(compiler, nir, &(struct ir3_shader_options){
/* TODO: force to single on a6xx with legacy
@@ -364,6 +368,9 @@ ir3_shader_state_create(struct pipe_context *pctx,
nir = tgsi_to_nir(cso->tokens, pctx->screen, false);
}
if (ctx->screen->gen >= 6)
ir3_nir_lower_io_to_bindless(nir);
/*
* Create ir3_shader:
*
@@ -548,8 +555,10 @@ ir3_screen_init(struct pipe_screen *pscreen)
struct fd_screen *screen = fd_screen(pscreen);
struct ir3_compiler_options options = {
.bindless_fb_read_descriptor = -1,
.bindless_fb_read_slot = -1,
.bindless_fb_read_descriptor =
ir3_shader_descriptor_set(PIPE_SHADER_FRAGMENT),
.bindless_fb_read_slot =
IR3_BINDLESS_IMAGE_OFFSET + IR3_BINDLESS_IMAGE_COUNT - 1,
};
screen->compiler = ir3_compiler_create(screen->dev, screen->dev_id, &options);