mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-03 16:39:01 -06:00 
			
		
		
		
	Merge pull request #483 from bunnei/sonic
Several GPU fixes to boot Sonic Mania
This commit is contained in:
		@@ -456,9 +456,9 @@ private:
 | 
			
		||||
            INST("00011110--------", Id::FMUL32_IMM, Type::Arithmetic, "FMUL32_IMM"),
 | 
			
		||||
            INST("0101000010000---", Id::MUFU, Type::Arithmetic, "MUFU"),
 | 
			
		||||
            INST("0101110010010---", Id::RRO, Type::Arithmetic, "RRO"),
 | 
			
		||||
            INST("0100110010101---", Id::F2F_C, Type::Arithmetic, "F2F_C"),
 | 
			
		||||
            INST("0101110010101---", Id::F2F_R, Type::Arithmetic, "F2F_R"),
 | 
			
		||||
            INST("0011100-10101---", Id::F2F_IMM, Type::Arithmetic, "F2F_IMM"),
 | 
			
		||||
            INST("0100110010101---", Id::F2F_C, Type::Conversion, "F2F_C"),
 | 
			
		||||
            INST("0101110010101---", Id::F2F_R, Type::Conversion, "F2F_R"),
 | 
			
		||||
            INST("0011100-10101---", Id::F2F_IMM, Type::Conversion, "F2F_IMM"),
 | 
			
		||||
            INST("0100110010110---", Id::F2I_C, Type::Arithmetic, "F2I_C"),
 | 
			
		||||
            INST("0101110010110---", Id::F2I_R, Type::Arithmetic, "F2I_R"),
 | 
			
		||||
            INST("0011100-10110---", Id::F2I_IMM, Type::Arithmetic, "F2I_IMM"),
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ struct FormatTuple {
 | 
			
		||||
 | 
			
		||||
static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{
 | 
			
		||||
    {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false},                    // ABGR8
 | 
			
		||||
    {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false},                       // B5G6R5
 | 
			
		||||
    {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, false},                           // B5G6R5
 | 
			
		||||
    {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false},              // A2B10G10R10
 | 
			
		||||
    {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false},                // A1B5G5R5
 | 
			
		||||
    {GL_R8, GL_RED, GL_UNSIGNED_BYTE, false},                                   // R8
 | 
			
		||||
 
 | 
			
		||||
@@ -834,13 +834,14 @@ private:
 | 
			
		||||
        }
 | 
			
		||||
        case OpCode::Type::Conversion: {
 | 
			
		||||
            ASSERT_MSG(instr.conversion.size == Register::Size::Word, "Unimplemented");
 | 
			
		||||
            ASSERT_MSG(!instr.conversion.selector, "Unimplemented");
 | 
			
		||||
            ASSERT_MSG(!instr.conversion.negate_a, "Unimplemented");
 | 
			
		||||
            ASSERT_MSG(!instr.conversion.saturate_a, "Unimplemented");
 | 
			
		||||
 | 
			
		||||
            switch (opcode->GetId()) {
 | 
			
		||||
            case OpCode::Id::I2I_R:
 | 
			
		||||
            case OpCode::Id::I2F_R: {
 | 
			
		||||
                ASSERT_MSG(!instr.conversion.selector, "Unimplemented");
 | 
			
		||||
 | 
			
		||||
                std::string op_a =
 | 
			
		||||
                    regs.GetRegisterAsInteger(instr.gpr20, 0, instr.conversion.is_signed);
 | 
			
		||||
 | 
			
		||||
@@ -851,6 +852,16 @@ private:
 | 
			
		||||
                regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_signed, 0, op_a, 1, 1);
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            case OpCode::Id::F2F_R: {
 | 
			
		||||
                std::string op_a = regs.GetRegisterAsFloat(instr.gpr20);
 | 
			
		||||
 | 
			
		||||
                if (instr.conversion.abs_a) {
 | 
			
		||||
                    op_a = "abs(" + op_a + ')';
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                regs.SetRegisterToFloat(instr.gpr0, 0, op_a, 1, 1);
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
            default: {
 | 
			
		||||
                NGLOG_CRITICAL(HW_GPU, "Unhandled conversion instruction: {}", opcode->GetName());
 | 
			
		||||
                UNREACHABLE();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user