summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-08-15 16:25:02 +0200
committerSubv <subv2112@gmail.com>2018-08-15 16:25:02 +0200
commit38592a3b5ebff505162a1806c9c9a9511c7c51b5 (patch)
tree6ab39e4639df7de12259c39708f27c8e2719595b /src/video_core
parentShader/F2I: Implemented the negate bit in the I2F instruction (diff)
downloadyuzu-38592a3b5ebff505162a1806c9c9a9511c7c51b5.tar
yuzu-38592a3b5ebff505162a1806c9c9a9511c7c51b5.tar.gz
yuzu-38592a3b5ebff505162a1806c9c9a9511c7c51b5.tar.bz2
yuzu-38592a3b5ebff505162a1806c9c9a9511c7c51b5.tar.lz
yuzu-38592a3b5ebff505162a1806c9c9a9511c7c51b5.tar.xz
yuzu-38592a3b5ebff505162a1806c9c9a9511c7c51b5.tar.zst
yuzu-38592a3b5ebff505162a1806c9c9a9511c7c51b5.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp30
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:
}
/// Generates code representing a uniform (C buffer) register, interpreted as the input type.
- std::string GetUniform(u64 index, u64 offset, GLSLRegister::Type type) {
+ std::string GetUniform(u64 index, u64 offset, GLSLRegister::Type type,
+ Register::Size size = Register::Size::Word) {
declr_const_buffers[index].MarkAsUsed(index, offset, stage);
std::string value = 'c' + std::to_string(index) + '[' + std::to_string(offset / 4) + "][" +
std::to_string(offset % 4) + ']';
if (type == GLSLRegister::Type::Float) {
- return value;
+ // Do nothing, default
} else if (type == GLSLRegister::Type::Integer) {
- return "floatBitsToInt(" + value + ')';
+ value = "floatBitsToInt(" + value + ')';
} else if (type == GLSLRegister::Type::UnsignedInteger) {
- return "floatBitsToUint(" + value + ')';
+ value = "floatBitsToUint(" + value + ')';
} else {
UNREACHABLE();
}
+
+ return ConvertIntegerSize(value, size);
}
std::string GetUniformIndirect(u64 cbuf_index, s64 offset, const std::string& index_str,
@@ -1251,11 +1254,24 @@ private:
1, instr.alu.saturate_d, 0, instr.conversion.dest_size);
break;
}
- case OpCode::Id::I2F_R: {
+ case OpCode::Id::I2F_R:
+ case OpCode::Id::I2F_C: {
ASSERT_MSG(instr.conversion.dest_size == Register::Size::Word, "Unimplemented");
ASSERT_MSG(!instr.conversion.selector, "Unimplemented");
- std::string op_a = regs.GetRegisterAsInteger(
- instr.gpr20, 0, instr.conversion.is_input_signed, instr.conversion.src_size);
+
+ std::string op_a{};
+
+ if (instr.is_b_gpr) {
+ op_a =
+ regs.GetRegisterAsInteger(instr.gpr20, 0, instr.conversion.is_input_signed,
+ instr.conversion.src_size);
+ } else {
+ op_a = regs.GetUniform(instr.cbuf34.index, instr.cbuf34.offset,
+ instr.conversion.is_input_signed
+ ? GLSLRegister::Type::Integer
+ : GLSLRegister::Type::UnsignedInteger,
+ instr.conversion.src_size);
+ }
if (instr.conversion.abs_a) {
op_a = "abs(" + op_a + ')';