mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
panfrost: Take texture/sampler_index into account in lower_res_indices
We currently rely on nir_lower_tex_options::lower_index_to_offset but there's really no reason for this. Our pan_nir_res_handle() helper can already take both an immediate and a dynamic index. Reviewed-by: Ryan Mckeever <ryan.mckeever@collabora.com> Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41320>
This commit is contained in:
parent
0a69efb22b
commit
4412f3bad7
1 changed files with 7 additions and 6 deletions
|
|
@ -15,10 +15,11 @@ lower_tex(nir_builder *b, nir_tex_instr *tex)
|
|||
b->cursor = nir_before_instr(&tex->instr);
|
||||
|
||||
nir_def *tex_offset = nir_steal_tex_src(tex, nir_tex_src_texture_offset);
|
||||
nir_def *sampler_offset = nir_steal_tex_src(tex, nir_tex_src_sampler_offset);
|
||||
nir_def *samp_offset = nir_steal_tex_src(tex, nir_tex_src_sampler_offset);
|
||||
|
||||
if (tex_offset != NULL) {
|
||||
tex_offset = pan_nir_res_handle(b, PAN_TABLE_TEXTURE, 0, tex_offset);
|
||||
tex_offset = pan_nir_res_handle(b, PAN_TABLE_TEXTURE,
|
||||
tex->texture_index, tex_offset);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_texture_offset, tex_offset);
|
||||
} else {
|
||||
tex->texture_index =
|
||||
|
|
@ -30,10 +31,10 @@ lower_tex(nir_builder *b, nir_tex_instr *tex)
|
|||
*/
|
||||
if (!nir_tex_instr_need_sampler(tex)) {
|
||||
tex->sampler_index = pan_res_handle(PAN_TABLE_SAMPLER, 0);
|
||||
} else if (sampler_offset != NULL) {
|
||||
sampler_offset =
|
||||
pan_nir_res_handle(b, PAN_TABLE_SAMPLER, 0, sampler_offset);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_sampler_offset, sampler_offset);
|
||||
} else if (samp_offset != NULL) {
|
||||
samp_offset = pan_nir_res_handle(b, PAN_TABLE_SAMPLER,
|
||||
tex->sampler_index, samp_offset);
|
||||
nir_tex_instr_add_src(tex, nir_tex_src_sampler_offset, samp_offset);
|
||||
} else {
|
||||
tex->sampler_index =
|
||||
pan_res_handle(PAN_TABLE_SAMPLER, tex->sampler_index);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue