mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 16:10:36 +02:00
aco: fix integer tg4 workaround with unnormalized coordinates
Same as LLVM from 2abf62d348.
fossil-db (GFX8):
Totals from 15 (0.01% of 147787) affected shaders:
VGPRs: 744 -> 748 (+0.54%)
CodeSize: 100472 -> 100732 (+0.26%)
Instrs: 19995 -> 20059 (+0.32%)
Latency: 1001530 -> 1001859 (+0.03%)
InvThroughput: 378508 -> 378747 (+0.06%)
SClause: 676 -> 675 (-0.15%)
Copies: 1655 -> 1654 (-0.06%)
PreSGPRs: 735 -> 742 (+0.95%)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10053>
This commit is contained in:
parent
5a70c4d4a0
commit
835c5b7ebf
1 changed files with 18 additions and 0 deletions
|
|
@ -9036,6 +9036,24 @@ void visit_tex(isel_context *ctx, nir_tex_instr *instr)
|
|||
half_texel[i] = bld.vop2(aco_opcode::v_mul_f32, bld.def(v1), Operand(0xbf000000/*-0.5*/), half_texel[i]);
|
||||
}
|
||||
|
||||
if (instr->sampler_dim == GLSL_SAMPLER_DIM_2D && !instr->is_array) {
|
||||
/* In vulkan, whether the sampler uses unnormalized
|
||||
* coordinates or not is a dynamic property of the
|
||||
* sampler. Hence, to figure out whether or not we
|
||||
* need to divide by the texture size, we need to test
|
||||
* the sampler at runtime. This tests the bit set by
|
||||
* radv_init_sampler().
|
||||
*/
|
||||
unsigned bit_idx = ffs(S_008F30_FORCE_UNNORMALIZED(1)) - 1;
|
||||
Temp not_needed = bld.sopc(aco_opcode::s_bitcmp0_b32, bld.def(s1, scc), sampler, Operand(bit_idx));
|
||||
|
||||
not_needed = bool_to_vector_condition(ctx, not_needed);
|
||||
half_texel[0] = bld.vop2(aco_opcode::v_cndmask_b32, bld.def(v1),
|
||||
Operand(0xbf000000/*-0.5*/), half_texel[0], not_needed);
|
||||
half_texel[1] = bld.vop2(aco_opcode::v_cndmask_b32, bld.def(v1),
|
||||
Operand(0xbf000000/*-0.5*/), half_texel[1], not_needed);
|
||||
}
|
||||
|
||||
Temp new_coords[2] = {
|
||||
bld.vop2(aco_opcode::v_add_f32, bld.def(v1), coords[0], half_texel[0]),
|
||||
bld.vop2(aco_opcode::v_add_f32, bld.def(v1), coords[1], half_texel[1])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue