diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index aa8ce5a7a..218ca5261 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -367,20 +367,23 @@ public: | |||
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | /// Generates code representing a uniform (C buffer) register, interpreted as the input type. | 369 | /// Generates code representing a uniform (C buffer) register, interpreted as the input type. |
| 370 | std::string GetUniform(u64 index, u64 offset, GLSLRegister::Type type) { | 370 | std::string GetUniform(u64 index, u64 offset, GLSLRegister::Type type, |
| 371 | Register::Size size = Register::Size::Word) { | ||
| 371 | declr_const_buffers[index].MarkAsUsed(index, offset, stage); | 372 | declr_const_buffers[index].MarkAsUsed(index, offset, stage); |
| 372 | std::string value = 'c' + std::to_string(index) + '[' + std::to_string(offset / 4) + "][" + | 373 | std::string value = 'c' + std::to_string(index) + '[' + std::to_string(offset / 4) + "][" + |
| 373 | std::to_string(offset % 4) + ']'; | 374 | std::to_string(offset % 4) + ']'; |
| 374 | 375 | ||
| 375 | if (type == GLSLRegister::Type::Float) { | 376 | if (type == GLSLRegister::Type::Float) { |
| 376 | return value; | 377 | // Do nothing, default |
| 377 | } else if (type == GLSLRegister::Type::Integer) { | 378 | } else if (type == GLSLRegister::Type::Integer) { |
| 378 | return "floatBitsToInt(" + value + ')'; | 379 | value = "floatBitsToInt(" + value + ')'; |
| 379 | } else if (type == GLSLRegister::Type::UnsignedInteger) { | 380 | } else if (type == GLSLRegister::Type::UnsignedInteger) { |
| 380 | return "floatBitsToUint(" + value + ')'; | 381 | value = "floatBitsToUint(" + value + ')'; |
| 381 | } else { | 382 | } else { |
| 382 | UNREACHABLE(); | 383 | UNREACHABLE(); |
| 383 | } | 384 | } |
| 385 | |||
| 386 | return ConvertIntegerSize(value, size); | ||
| 384 | } | 387 | } |
| 385 | 388 | ||
| 386 | std::string GetUniformIndirect(u64 cbuf_index, s64 offset, const std::string& index_str, | 389 | std::string GetUniformIndirect(u64 cbuf_index, s64 offset, const std::string& index_str, |
| @@ -1251,11 +1254,24 @@ private: | |||
| 1251 | 1, instr.alu.saturate_d, 0, instr.conversion.dest_size); | 1254 | 1, instr.alu.saturate_d, 0, instr.conversion.dest_size); |
| 1252 | break; | 1255 | break; |
| 1253 | } | 1256 | } |
| 1254 | case OpCode::Id::I2F_R: { | 1257 | case OpCode::Id::I2F_R: |
| 1258 | case OpCode::Id::I2F_C: { | ||
| 1255 | ASSERT_MSG(instr.conversion.dest_size == Register::Size::Word, "Unimplemented"); | 1259 | ASSERT_MSG(instr.conversion.dest_size == Register::Size::Word, "Unimplemented"); |
| 1256 | ASSERT_MSG(!instr.conversion.selector, "Unimplemented"); | 1260 | ASSERT_MSG(!instr.conversion.selector, "Unimplemented"); |
| 1257 | std::string op_a = regs.GetRegisterAsInteger( | 1261 | |
| 1258 | instr.gpr20, 0, instr.conversion.is_input_signed, instr.conversion.src_size); | 1262 | std::string op_a{}; |
| 1263 | |||
| 1264 | if (instr.is_b_gpr) { | ||
| 1265 | op_a = | ||
| 1266 | regs.GetRegisterAsInteger(instr.gpr20, 0, instr.conversion.is_input_signed, | ||
| 1267 | instr.conversion.src_size); | ||
| 1268 | } else { | ||
| 1269 | op_a = regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset, | ||
| 1270 | instr.conversion.is_input_signed | ||
| 1271 | ? GLSLRegister::Type::Integer | ||
| 1272 | : GLSLRegister::Type::UnsignedInteger, | ||
| 1273 | instr.conversion.src_size); | ||
| 1274 | } | ||
| 1259 | 1275 | ||
| 1260 | if (instr.conversion.abs_a) { | 1276 | if (instr.conversion.abs_a) { |
| 1261 | op_a = "abs(" + op_a + ')'; | 1277 | op_a = "abs(" + op_a + ')'; |