mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-03 16:39:01 -06:00 
			
		
		
		
	gl_shader_decompiler: Support multi-destination for TEXS.
This commit is contained in:
		@@ -261,6 +261,11 @@ union Instruction {
 | 
			
		||||
        BitField<50, 1, u64> saturate_a;
 | 
			
		||||
    } conversion;
 | 
			
		||||
 | 
			
		||||
    union {
 | 
			
		||||
        // TODO(bunnei): This is just a guess, needs to be verified
 | 
			
		||||
        BitField<52, 1, u64> enable_g_component;
 | 
			
		||||
    } texs;
 | 
			
		||||
 | 
			
		||||
    BitField<61, 1, u64> is_b_imm;
 | 
			
		||||
    BitField<60, 1, u64> is_b_gpr;
 | 
			
		||||
    BitField<59, 1, u64> is_c_gpr;
 | 
			
		||||
 
 | 
			
		||||
@@ -903,9 +903,25 @@ private:
 | 
			
		||||
                ++shader.scope;
 | 
			
		||||
                shader.AddLine(coord);
 | 
			
		||||
                const std::string texture = "texture(" + sampler + ", coords)";
 | 
			
		||||
                for (unsigned elem = 0; elem < instr.attribute.fmt20.size; ++elem) {
 | 
			
		||||
                    regs.SetRegisterToFloat(instr.gpr0, elem, texture, 1, 4, false, elem);
 | 
			
		||||
 | 
			
		||||
                // TEXS has two destination registers. RG goes into gpr0+0 and gpr0+1, and BA goes
 | 
			
		||||
                // into gpr28+0 and gpr28+1
 | 
			
		||||
                size_t offset{};
 | 
			
		||||
                for (const auto& dest : {instr.gpr0.Value(), instr.gpr28.Value()}) {
 | 
			
		||||
                    for (unsigned elem = 0; elem < 2; ++elem) {
 | 
			
		||||
                        if (dest + elem >= Register::ZeroIndex) {
 | 
			
		||||
                            // Skip invalid register values
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        regs.SetRegisterToFloat(dest, elem + offset, texture, 1, 4, false, elem);
 | 
			
		||||
                        if (!instr.texs.enable_g_component) {
 | 
			
		||||
                            // Skip the second component
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    offset += 2;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                --shader.scope;
 | 
			
		||||
                shader.AddLine("}");
 | 
			
		||||
                break;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user