mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-18 01:30:36 +01:00
nvk: Use suld for EDB uniform texel buffers
The tricks we play for texel buffers with VK_EXT_descriptor_buffer don't
work with tld with very large buffers. suld, on the other hand, doesn't
seem to have these limitations.
Fixes: 3b94c5c22a ("nvk: Lower descriptors for VK_EXT_descriptor_buffer buffer views")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33610>
This commit is contained in:
parent
1c7a4c4f38
commit
2183bc73a6
1 changed files with 23 additions and 7 deletions
|
|
@ -1221,17 +1221,33 @@ lower_edb_buffer_tex_instr(nir_builder *b, nir_tex_instr *tex,
|
|||
nir_def *in_bounds = edb_buffer_view_coord_is_in_bounds(b, desc, coord);
|
||||
|
||||
nir_def *index = edb_buffer_view_index(b, desc, in_bounds);
|
||||
nir_src_rewrite(&tex->src[texture_src_idx].src, index);
|
||||
tex->src[texture_src_idx].src_type = nir_tex_src_texture_handle;
|
||||
|
||||
nir_def *new_coord = adjust_edb_buffer_view_coord(b, desc, coord);
|
||||
nir_src_rewrite(&tex->src[coord_src_idx].src, new_coord);
|
||||
nir_def *u = nir_undef(b, 1, 32);
|
||||
|
||||
/* The tricks we play for EDB use very large texel buffer views. These
|
||||
* don't seem to play nicely with the tld instruction which thinks
|
||||
* buffers are a 1D texture. However, suld seems fine with it so we'll
|
||||
* rewrite to use that.
|
||||
*/
|
||||
nir_def *res = nir_bindless_image_load(b, tex->def.num_components,
|
||||
tex->def.bit_size,
|
||||
index,
|
||||
nir_vec4(b, new_coord, u, u, u),
|
||||
u, /* sample_id */
|
||||
nir_imm_int(b, 0), /* LOD */
|
||||
.image_dim = GLSL_SAMPLER_DIM_BUF,
|
||||
.image_array = false,
|
||||
.format = PIPE_FORMAT_NONE,
|
||||
.dest_type = tex->dest_type);
|
||||
if (tex->is_sparse) {
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(res->parent_instr);
|
||||
intr->intrinsic = nir_intrinsic_bindless_image_sparse_load;
|
||||
}
|
||||
|
||||
b->cursor = nir_after_instr(&tex->instr);
|
||||
nir_def *res = &tex->def;
|
||||
res = fixup_edb_buffer_view_result(b, desc, in_bounds,
|
||||
res, tex->dest_type);
|
||||
nir_def_rewrite_uses_after(&tex->def, res, res->parent_instr);
|
||||
|
||||
nir_def_rewrite_uses(&tex->def, res);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue