summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-03-20 05:04:12 -0300
committerGravatar ameerj2021-07-22 21:51:23 -0400
commitf91859efd259995806c2944f7941b105b58300d3 (patch)
tree489e587bcac6c0833c02378a106222c4db107c14 /src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
parentshader: Implement ISCADD (imm) (diff)
downloadyuzu-f91859efd259995806c2944f7941b105b58300d3.tar.gz
yuzu-f91859efd259995806c2944f7941b105b58300d3.tar.xz
yuzu-f91859efd259995806c2944f7941b105b58300d3.zip
shader: Implement I2F
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
index e444dcd4f..c9af83010 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/impl.cpp
@@ -121,6 +121,22 @@ IR::F64 TranslatorVisitor::GetDoubleCbuf(u64 insn) {
121 return ir.PackDouble2x32(ir.CompositeConstruct(lower_bits, value)); 121 return ir.PackDouble2x32(ir.CompositeConstruct(lower_bits, value));
122} 122}
123 123
124IR::U64 TranslatorVisitor::GetPackedCbuf(u64 insn) {
125 union {
126 u64 raw;
127 BitField<20, 1, u64> unaligned;
128 } const cbuf{insn};
129
130 if (cbuf.unaligned != 0) {
131 throw NotImplementedException("Unaligned packed constant buffer read");
132 }
133 const auto [binding, lower_offset]{CbufAddr(insn)};
134 const IR::U32 upper_offset{ir.Imm32(lower_offset.U32() + 4)};
135 const IR::U32 lower_value{ir.GetCbuf(binding, lower_offset)};
136 const IR::U32 upper_value{ir.GetCbuf(binding, upper_offset)};
137 return ir.PackUint2x32(ir.CompositeConstruct(lower_value, upper_value));
138}
139
124IR::U32 TranslatorVisitor::GetImm20(u64 insn) { 140IR::U32 TranslatorVisitor::GetImm20(u64 insn) {
125 union { 141 union {
126 u64 raw; 142 u64 raw;
@@ -158,6 +174,11 @@ IR::F64 TranslatorVisitor::GetDoubleImm20(u64 insn) {
158 return ir.Imm64(Common::BitCast<f64>(value | sign_bit)); 174 return ir.Imm64(Common::BitCast<f64>(value | sign_bit));
159} 175}
160 176
177IR::U64 TranslatorVisitor::GetPackedImm20(u64 insn) {
178 const s64 value{GetImm20(insn).U32()};
179 return ir.Imm64(static_cast<u64>(static_cast<s64>(value) << 32));
180}
181
161IR::U32 TranslatorVisitor::GetImm32(u64 insn) { 182IR::U32 TranslatorVisitor::GetImm32(u64 insn) {
162 union { 183 union {
163 u64 raw; 184 u64 raw;