}
OPT_V(s, nir_lower_regs_to_ssa);
- OPT_V(s, ir3_nir_lower_io_offsets);
if (key) {
if (s->info.stage == MESA_SHADER_VERTEX) {
*/
const bool ubo_progress = !key && OPT(s, ir3_nir_analyze_ubo_ranges, shader);
const bool idiv_progress = OPT(s, nir_lower_idiv, nir_lower_idiv_fast);
+ /* UBO offset lowering has to come after we've decided what will be left as load_ubo */
+ OPT_V(s, ir3_nir_lower_io_offsets);
+
if (ubo_progress || idiv_progress)
ir3_optimize_loop(s);
struct ir3_ubo_range r;
int offset = nir_src_as_uint(instr->src[1]);
- if (instr->intrinsic == nir_intrinsic_load_ubo_ir3)
- offset *= 16;
const int bytes = nir_intrinsic_dest_components(instr) * 4;
r.start = ROUND_DOWN_TO(offset, 16 * 4);
* offset is in units of 16 bytes, so we need to multiply by 4. And
* also the same for the constant part of the offset:
*/
-
- const int shift = instr->intrinsic == nir_intrinsic_load_ubo_ir3 ? 2 : -2;
- nir_ssa_def *new_offset = ir3_nir_try_propagate_bit_shift(b, ubo_offset, shift);
+ const int shift = -2;
+ nir_ssa_def *new_offset = ir3_nir_try_propagate_bit_shift(b, ubo_offset, -2);
nir_ssa_def *uniform_offset = NULL;
if (new_offset) {
uniform_offset = new_offset;
nir_ushr(b, ubo_offset, nir_imm_int(b, -shift));
}
- if (instr->intrinsic == nir_intrinsic_load_ubo_ir3) {
- const_offset <<= 2;
- const_offset += nir_intrinsic_base(instr);
- } else {
- debug_assert(!(const_offset & 0x3));
- const_offset >>= 2;
- }
+ debug_assert(!(const_offset & 0x3));
+ const_offset >>= 2;
const int range_offset = ((int)range->offset - (int)range->start) / 4;
const_offset += range_offset;
return false;
nir_intrinsic_op op = nir_instr_as_intrinsic(instr)->intrinsic;
- return op == nir_intrinsic_load_ubo || op == nir_intrinsic_load_ubo_ir3;
+
+ /* ir3_nir_lower_io_offsets happens after this pass. */
+ assert(op != nir_intrinsic_load_ubo_ir3);
+
+ return op == nir_intrinsic_load_ubo;
}
bool