mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 18:38:11 +02:00
nir/lower_tex: optimize offset lowering for has_texture_scaling
Generates much better code and even helps to beat a blob driver. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24054>
This commit is contained in:
parent
9383009809
commit
f831883af6
1 changed files with 9 additions and 2 deletions
|
|
@ -176,8 +176,15 @@ lower_offset(nir_builder *b, nir_tex_instr *tex)
|
|||
if (tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) {
|
||||
offset_coord = nir_fadd(b, coord, nir_i2f32(b, offset));
|
||||
} else {
|
||||
nir_ssa_def *txs = nir_i2f32(b, nir_get_texture_size(b, tex));
|
||||
nir_ssa_def *scale = nir_frcp(b, txs);
|
||||
nir_ssa_def *scale = NULL;
|
||||
|
||||
if (b->shader->options->has_texture_scaling) {
|
||||
nir_ssa_def *idx = nir_imm_int(b, tex->texture_index);
|
||||
scale = nir_load_texture_scale(b, 32, idx);
|
||||
} else {
|
||||
nir_ssa_def *txs = nir_i2f32(b, nir_get_texture_size(b, tex));
|
||||
scale = nir_frcp(b, txs);
|
||||
}
|
||||
|
||||
offset_coord = nir_fadd(b, coord,
|
||||
nir_fmul(b,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue