freedreno/ir3: Let driver specify fb-read descriptor
Let the driver control where the shader should look for fb-read descriptor. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20687>
This commit is contained in:
@@ -55,6 +55,12 @@ struct ir3_compiler_options {
|
||||
* caching.
|
||||
*/
|
||||
bool disable_cache;
|
||||
|
||||
/* If >= 0, this specifies the bindless descriptor set + descriptor to use
|
||||
* for txf_ms_fb
|
||||
*/
|
||||
int bindless_fb_read_descriptor;
|
||||
int bindless_fb_read_slot;
|
||||
};
|
||||
|
||||
struct ir3_compiler {
|
||||
|
@@ -3161,10 +3161,21 @@ emit_tex(struct ir3_context *ctx, nir_tex_instr *tex)
|
||||
compile_assert(ctx, ctx->so->type == MESA_SHADER_FRAGMENT);
|
||||
|
||||
ctx->so->fb_read = true;
|
||||
info.samp_tex = ir3_collect(
|
||||
b, create_immed_typed(ctx->block, ctx->so->num_samp, TYPE_U16),
|
||||
create_immed_typed(ctx->block, ctx->so->num_samp, TYPE_U16));
|
||||
info.flags = IR3_INSTR_S2EN;
|
||||
if (ctx->compiler->options.bindless_fb_read_descriptor >= 0) {
|
||||
ctx->so->bindless_tex = true;
|
||||
|
||||
info.flags = IR3_INSTR_B | IR3_INSTR_A1EN;
|
||||
info.base = ctx->compiler->options.bindless_fb_read_descriptor;
|
||||
info.a1_val = ctx->compiler->options.bindless_fb_read_slot << 3;
|
||||
} else {
|
||||
/* Otherwise append a sampler to be patched into the texture
|
||||
* state:
|
||||
*/
|
||||
info.samp_tex = ir3_collect(
|
||||
b, create_immed_typed(ctx->block, ctx->so->num_samp, TYPE_U16),
|
||||
create_immed_typed(ctx->block, ctx->so->num_samp, TYPE_U16));
|
||||
info.flags = IR3_INSTR_S2EN;
|
||||
}
|
||||
|
||||
ctx->so->num_samp++;
|
||||
} else {
|
||||
|
@@ -2119,6 +2119,8 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
|
||||
.robust_buffer_access2 = robust_buffer_access2,
|
||||
.push_ubo_with_preamble = true,
|
||||
.disable_cache = true,
|
||||
.bindless_fb_read_descriptor = -1,
|
||||
.bindless_fb_read_slot = -1,
|
||||
});
|
||||
if (!device->compiler) {
|
||||
result = vk_startup_errorf(physical_device->instance,
|
||||
|
@@ -547,8 +547,11 @@ ir3_screen_init(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct fd_screen *screen = fd_screen(pscreen);
|
||||
|
||||
screen->compiler = ir3_compiler_create(screen->dev, screen->dev_id,
|
||||
&(struct ir3_compiler_options) {});
|
||||
struct ir3_compiler_options options = {
|
||||
.bindless_fb_read_descriptor = -1,
|
||||
.bindless_fb_read_slot = -1,
|
||||
};
|
||||
screen->compiler = ir3_compiler_create(screen->dev, screen->dev_id, &options);
|
||||
|
||||
/* TODO do we want to limit things to # of fast cores, or just limit
|
||||
* based on total # of both big and little cores. The little cores
|
||||
|
Reference in New Issue
Block a user