summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sebastian Valle2018-05-30 07:31:46 -0500
committerGravatar GitHub2018-05-30 07:31:46 -0500
commit8df011a57fc393853bc94421dca1e5913e30a0c8 (patch)
tree56e96700d450fd7679efa7471454b05954b92044
parentMerge pull request #482 from Subv/r8 (diff)
parentgl_shader_decompiler: F2F_R instruction: Implement abs. (diff)
downloadyuzu-8df011a57fc393853bc94421dca1e5913e30a0c8.tar.gz
yuzu-8df011a57fc393853bc94421dca1e5913e30a0c8.tar.xz
yuzu-8df011a57fc393853bc94421dca1e5913e30a0c8.zip
Merge pull request #483 from bunnei/sonic
Several GPU fixes to boot Sonic Mania
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp20
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.h4
-rw-r--r--src/video_core/engines/shader_bytecode.h6
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp13
5 files changed, 35 insertions, 10 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index e979b9707..7872d1e09 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -16,7 +16,11 @@ u32 nvhost_ctrl::ioctl(Ioctl command, const std::vector<u8>& input, std::vector<
16 case IoctlCommand::IocGetConfigCommand: 16 case IoctlCommand::IocGetConfigCommand:
17 return NvOsGetConfigU32(input, output); 17 return NvOsGetConfigU32(input, output);
18 case IoctlCommand::IocCtrlEventWaitCommand: 18 case IoctlCommand::IocCtrlEventWaitCommand:
19 return IocCtrlEventWait(input, output); 19 return IocCtrlEventWait(input, output, false);
20 case IoctlCommand::IocCtrlEventWaitAsyncCommand:
21 return IocCtrlEventWait(input, output, true);
22 case IoctlCommand::IocCtrlEventRegisterCommand:
23 return IocCtrlEventRegister(input, output);
20 } 24 }
21 UNIMPLEMENTED_MSG("Unimplemented ioctl"); 25 UNIMPLEMENTED_MSG("Unimplemented ioctl");
22 return 0; 26 return 0;
@@ -45,11 +49,13 @@ u32 nvhost_ctrl::NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>&
45 return 0; 49 return 0;
46} 50}
47 51
48u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output) { 52u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output,
53 bool is_async) {
49 IocCtrlEventWaitParams params{}; 54 IocCtrlEventWaitParams params{};
50 std::memcpy(&params, input.data(), sizeof(params)); 55 std::memcpy(&params, input.data(), sizeof(params));
51 NGLOG_WARNING(Service_NVDRV, "(STUBBED) called, syncpt_id={} threshold={} timeout={}", 56 NGLOG_WARNING(Service_NVDRV,
52 params.syncpt_id, params.threshold, params.timeout); 57 "(STUBBED) called, syncpt_id={}, threshold={}, timeout={}, is_async={}",
58 params.syncpt_id, params.threshold, params.timeout, is_async);
53 59
54 // TODO(Subv): Implement actual syncpt waiting. 60 // TODO(Subv): Implement actual syncpt waiting.
55 params.value = 0; 61 params.value = 0;
@@ -57,4 +63,10 @@ u32 nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>&
57 return 0; 63 return 0;
58} 64}
59 65
66u32 nvhost_ctrl::IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output) {
67 NGLOG_WARNING(Service_NVDRV, "(STUBBED) called");
68 // TODO(bunnei): Implement this.
69 return 0;
70}
71
60} // namespace Service::Nvidia::Devices 72} // namespace Service::Nvidia::Devices
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
index aa9b5a14b..090261a60 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h
@@ -134,7 +134,9 @@ private:
134 134
135 u32 NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output); 135 u32 NvOsGetConfigU32(const std::vector<u8>& input, std::vector<u8>& output);
136 136
137 u32 IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output); 137 u32 IocCtrlEventWait(const std::vector<u8>& input, std::vector<u8>& output, bool is_async);
138
139 u32 IocCtrlEventRegister(const std::vector<u8>& input, std::vector<u8>& output);
138}; 140};
139 141
140} // namespace Service::Nvidia::Devices 142} // namespace Service::Nvidia::Devices
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index d75de85e2..198a470c0 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -456,9 +456,9 @@ private:
456 INST("00011110--------", Id::FMUL32_IMM, Type::Arithmetic, "FMUL32_IMM"), 456 INST("00011110--------", Id::FMUL32_IMM, Type::Arithmetic, "FMUL32_IMM"),
457 INST("0101000010000---", Id::MUFU, Type::Arithmetic, "MUFU"), 457 INST("0101000010000---", Id::MUFU, Type::Arithmetic, "MUFU"),
458 INST("0101110010010---", Id::RRO, Type::Arithmetic, "RRO"), 458 INST("0101110010010---", Id::RRO, Type::Arithmetic, "RRO"),
459 INST("0100110010101---", Id::F2F_C, Type::Arithmetic, "F2F_C"), 459 INST("0100110010101---", Id::F2F_C, Type::Conversion, "F2F_C"),
460 INST("0101110010101---", Id::F2F_R, Type::Arithmetic, "F2F_R"), 460 INST("0101110010101---", Id::F2F_R, Type::Conversion, "F2F_R"),
461 INST("0011100-10101---", Id::F2F_IMM, Type::Arithmetic, "F2F_IMM"), 461 INST("0011100-10101---", Id::F2F_IMM, Type::Conversion, "F2F_IMM"),
462 INST("0100110010110---", Id::F2I_C, Type::Arithmetic, "F2I_C"), 462 INST("0100110010110---", Id::F2I_C, Type::Arithmetic, "F2I_C"),
463 INST("0101110010110---", Id::F2I_R, Type::Arithmetic, "F2I_R"), 463 INST("0101110010110---", Id::F2I_R, Type::Arithmetic, "F2I_R"),
464 INST("0011100-10110---", Id::F2I_IMM, Type::Arithmetic, "F2I_IMM"), 464 INST("0011100-10110---", Id::F2I_IMM, Type::Arithmetic, "F2I_IMM"),
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 5bb34037b..ac3e4bf27 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -45,7 +45,7 @@ struct FormatTuple {
45 45
46static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{ 46static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_format_tuples = {{
47 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false}, // ABGR8 47 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, false}, // ABGR8
48 {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false}, // B5G6R5 48 {GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, false}, // B5G6R5
49 {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false}, // A2B10G10R10 49 {GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false}, // A2B10G10R10
50 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false}, // A1B5G5R5 50 {GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false}, // A1B5G5R5
51 {GL_R8, GL_RED, GL_UNSIGNED_BYTE, false}, // R8 51 {GL_R8, GL_RED, GL_UNSIGNED_BYTE, false}, // R8
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 75822e750..70ddea643 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -834,13 +834,14 @@ private:
834 } 834 }
835 case OpCode::Type::Conversion: { 835 case OpCode::Type::Conversion: {
836 ASSERT_MSG(instr.conversion.size == Register::Size::Word, "Unimplemented"); 836 ASSERT_MSG(instr.conversion.size == Register::Size::Word, "Unimplemented");
837 ASSERT_MSG(!instr.conversion.selector, "Unimplemented");
838 ASSERT_MSG(!instr.conversion.negate_a, "Unimplemented"); 837 ASSERT_MSG(!instr.conversion.negate_a, "Unimplemented");
839 ASSERT_MSG(!instr.conversion.saturate_a, "Unimplemented"); 838 ASSERT_MSG(!instr.conversion.saturate_a, "Unimplemented");
840 839
841 switch (opcode->GetId()) { 840 switch (opcode->GetId()) {
842 case OpCode::Id::I2I_R: 841 case OpCode::Id::I2I_R:
843 case OpCode::Id::I2F_R: { 842 case OpCode::Id::I2F_R: {
843 ASSERT_MSG(!instr.conversion.selector, "Unimplemented");
844
844 std::string op_a = 845 std::string op_a =
845 regs.GetRegisterAsInteger(instr.gpr20, 0, instr.conversion.is_signed); 846 regs.GetRegisterAsInteger(instr.gpr20, 0, instr.conversion.is_signed);
846 847
@@ -851,6 +852,16 @@ private:
851 regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_signed, 0, op_a, 1, 1); 852 regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_signed, 0, op_a, 1, 1);
852 break; 853 break;
853 } 854 }
855 case OpCode::Id::F2F_R: {
856 std::string op_a = regs.GetRegisterAsFloat(instr.gpr20);
857
858 if (instr.conversion.abs_a) {
859 op_a = "abs(" + op_a + ')';
860 }
861
862 regs.SetRegisterToFloat(instr.gpr0, 0, op_a, 1, 1);
863 break;
864 }
854 default: { 865 default: {
855 NGLOG_CRITICAL(HW_GPU, "Unhandled conversion instruction: {}", opcode->GetName()); 866 NGLOG_CRITICAL(HW_GPU, "Unhandled conversion instruction: {}", opcode->GetName());
856 UNREACHABLE(); 867 UNREACHABLE();