summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/maxwell/translate
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-03-29 06:08:25 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:25 +0200
commitcb6fc03e55e9eff0826173a6bcacef3034322f7c (patch)
tree6d9488a0ad2c6a28d52e3be72386bfe0770ce09e /src/shader_recompiler/frontend/maxwell/translate
parentshader: Implement TXD (diff)
downloadyuzu-cb6fc03e55e9eff0826173a6bcacef3034322f7c.tar
yuzu-cb6fc03e55e9eff0826173a6bcacef3034322f7c.tar.gz
yuzu-cb6fc03e55e9eff0826173a6bcacef3034322f7c.tar.bz2
yuzu-cb6fc03e55e9eff0826173a6bcacef3034322f7c.tar.lz
yuzu-cb6fc03e55e9eff0826173a6bcacef3034322f7c.tar.xz
yuzu-cb6fc03e55e9eff0826173a6bcacef3034322f7c.tar.zst
yuzu-cb6fc03e55e9eff0826173a6bcacef3034322f7c.zip
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/texture_load.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp34
2 files changed, 14 insertions, 22 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load.cpp
index b4063fa6e..df38f87a3 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load.cpp
@@ -124,6 +124,8 @@ void Impl(TranslatorVisitor& v, u64 insn, bool is_bindless) {
}
if (tld.lod != 0) {
lod = v.X(meta_reg++);
+ } else {
+ lod = v.ir.Imm32(0U);
}
if (tld.aoffi != 0) {
offset = MakeOffset(v, meta_reg, tld.type);
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp
index 3e6ebd911..623b8fc23 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_load_swizzled.cpp
@@ -74,62 +74,55 @@ IR::Value Sample(TranslatorVisitor& v, u64 insn) {
const IR::Reg reg_a{tlds.src_reg_a};
const IR::Reg reg_b{tlds.src_reg_b};
IR::Value coords;
- IR::U32 lod;
+ IR::U32 lod{v.ir.Imm32(0U)};
IR::Value offsets;
IR::U32 multisample;
- Shader::TextureType texture_type;
+ Shader::TextureType texture_type{};
switch (tlds.encoding) {
- case 0: {
+ case 0:
texture_type = Shader::TextureType::Color1D;
coords = v.X(reg_a);
break;
- }
- case 1: {
+ case 1:
texture_type = Shader::TextureType::Color1D;
coords = v.X(reg_a);
lod = v.X(reg_b);
break;
- }
- case 2: {
+ case 2:
texture_type = Shader::TextureType::Color2D;
coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_b));
break;
- }
- case 4: {
+ case 4:
CheckAlignment(reg_a, 2);
texture_type = Shader::TextureType::Color2D;
coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1));
offsets = MakeOffset(v, reg_b);
break;
- }
- case 5: {
+ case 5:
CheckAlignment(reg_a, 2);
texture_type = Shader::TextureType::Color2D;
coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1));
lod = v.X(reg_b);
break;
- }
- case 6: {
+ case 6:
CheckAlignment(reg_a, 2);
texture_type = Shader::TextureType::Color2D;
coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1));
multisample = v.X(reg_b);
break;
- }
- case 7: {
+ case 7:
CheckAlignment(reg_a, 2);
texture_type = Shader::TextureType::Color3D;
coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1), v.X(reg_b));
break;
- }
case 8: {
CheckAlignment(reg_b, 2);
+ const IR::U32 array{v.ir.BitFieldExtract(v.X(reg_a), v.ir.Imm32(0), v.ir.Imm32(16))};
texture_type = Shader::TextureType::ColorArray2D;
- IR::U32 array = v.ir.BitFieldExtract(v.X(reg_a), v.ir.Imm32(0), v.ir.Imm32(16));
coords = v.ir.CompositeConstruct(v.X(reg_b), v.X(reg_b + 1), array);
break;
}
- case 12: {
+ case 12:
CheckAlignment(reg_a, 2);
CheckAlignment(reg_b, 2);
texture_type = Shader::TextureType::Color2D;
@@ -137,11 +130,8 @@ IR::Value Sample(TranslatorVisitor& v, u64 insn) {
lod = v.X(reg_b);
offsets = MakeOffset(v, reg_b + 1);
break;
- }
- default: {
+ default:
throw NotImplementedException("Illegal encoding {}", tlds.encoding.Value());
- break;
- }
}
IR::TextureInstInfo info{};
if (tlds.precision == Precision::F16) {