Skip to content

r600/asm: Support sampler index mode in r600_bytecode_add_tex

This change makes it possible (or at least implements one of the dependencies) to use dynamic indexing for both the resource and the sampler in texture fetch instructions, including if they use different CF_INDEX registers. In Vulkan, textures and samplers can be dynamically indexed separately from each other, so this is required to support dynamic indexing there.

It seems that SFN still uses egcm_load_index_reg through functions like r600_bytecode_add_tex (called in AssamblerVisitor::visit(const TexInstr& tex_instr)), though I'm not entirely sure, but I think the area of the code that's modified here is still relevant.

Here I renamed egcm_load_index_reg to …regs and made it accept a bitfield of which index registers (CF_INDEX0 and/or CF_INDEX1) should be loaded, to make sure that if both indices need to be loaded and inside_alu_clause is true, the ALU clause is closed only once (CF ALU {…, MOVA, MOVA}, CF FETCH) rather than twice (CF ALU {…, MOVA}, CF ALU {MOVA}, CF FETCH). I'm not sure how dirty those 1 << that I added in 3 places are, but if they look unintuitive, I can write a small …reg wrapper calling …regs with 1 << id.

Edited by Triang3l (Vitaliy Kuzmin)

Merge request reports