summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend')
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc6
-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
3 files changed, 17 insertions, 25 deletions
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index 79baacd08..e82db0cd2 100644
--- a/src/shader_recompiler/frontend/ir/opcodes.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -378,7 +378,7 @@ OPCODE(BindlessImageSampleDrefImplicitLod, F32, U32,
378OPCODE(BindlessImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) 378OPCODE(BindlessImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, )
379OPCODE(BindlessImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) 379OPCODE(BindlessImageGather, F32x4, U32, Opaque, Opaque, Opaque, )
380OPCODE(BindlessImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) 380OPCODE(BindlessImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, )
381OPCODE(BindlessImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 381OPCODE(BindlessImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, )
382OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, ) 382OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, )
383OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) 383OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, )
384OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 384OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
@@ -389,7 +389,7 @@ OPCODE(BoundImageSampleDrefImplicitLod, F32, U32,
389OPCODE(BoundImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) 389OPCODE(BoundImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, )
390OPCODE(BoundImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) 390OPCODE(BoundImageGather, F32x4, U32, Opaque, Opaque, Opaque, )
391OPCODE(BoundImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) 391OPCODE(BoundImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, )
392OPCODE(BoundImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 392OPCODE(BoundImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, )
393OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, ) 393OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, )
394OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) 394OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, )
395OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 395OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
@@ -400,7 +400,7 @@ OPCODE(ImageSampleDrefImplicitLod, F32, U32,
400OPCODE(ImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) 400OPCODE(ImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, )
401OPCODE(ImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) 401OPCODE(ImageGather, F32x4, U32, Opaque, Opaque, Opaque, )
402OPCODE(ImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) 402OPCODE(ImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, )
403OPCODE(ImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 403OPCODE(ImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, )
404OPCODE(ImageQueryDimensions, U32x4, U32, U32, ) 404OPCODE(ImageQueryDimensions, U32x4, U32, U32, )
405OPCODE(ImageQueryLod, F32x4, U32, Opaque, ) 405OPCODE(ImageQueryLod, F32x4, U32, Opaque, )
406OPCODE(ImageGradient, F32x4, U32, Opaque, Opaque, Opaque, F32, ) 406OPCODE(ImageGradient, F32x4, U32, Opaque, Opaque, Opaque, F32, )
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) {
124 } 124 }
125 if (tld.lod != 0) { 125 if (tld.lod != 0) {
126 lod = v.X(meta_reg++); 126 lod = v.X(meta_reg++);
127 } else {
128 lod = v.ir.Imm32(0U);
127 } 129 }
128 if (tld.aoffi != 0) { 130 if (tld.aoffi != 0) {
129 offset = MakeOffset(v, meta_reg, tld.type); 131 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) {
74 const IR::Reg reg_a{tlds.src_reg_a}; 74 const IR::Reg reg_a{tlds.src_reg_a};
75 const IR::Reg reg_b{tlds.src_reg_b}; 75 const IR::Reg reg_b{tlds.src_reg_b};
76 IR::Value coords; 76 IR::Value coords;
77 IR::U32 lod; 77 IR::U32 lod{v.ir.Imm32(0U)};
78 IR::Value offsets; 78 IR::Value offsets;
79 IR::U32 multisample; 79 IR::U32 multisample;
80 Shader::TextureType texture_type; 80 Shader::TextureType texture_type{};
81 switch (tlds.encoding) { 81 switch (tlds.encoding) {
82 case 0: { 82 case 0:
83 texture_type = Shader::TextureType::Color1D; 83 texture_type = Shader::TextureType::Color1D;
84 coords = v.X(reg_a); 84 coords = v.X(reg_a);
85 break; 85 break;
86 } 86 case 1:
87 case 1: {
88 texture_type = Shader::TextureType::Color1D; 87 texture_type = Shader::TextureType::Color1D;
89 coords = v.X(reg_a); 88 coords = v.X(reg_a);
90 lod = v.X(reg_b); 89 lod = v.X(reg_b);
91 break; 90 break;
92 } 91 case 2:
93 case 2: {
94 texture_type = Shader::TextureType::Color2D; 92 texture_type = Shader::TextureType::Color2D;
95 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_b)); 93 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_b));
96 break; 94 break;
97 } 95 case 4:
98 case 4: {
99 CheckAlignment(reg_a, 2); 96 CheckAlignment(reg_a, 2);
100 texture_type = Shader::TextureType::Color2D; 97 texture_type = Shader::TextureType::Color2D;
101 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1)); 98 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1));
102 offsets = MakeOffset(v, reg_b); 99 offsets = MakeOffset(v, reg_b);
103 break; 100 break;
104 } 101 case 5:
105 case 5: {
106 CheckAlignment(reg_a, 2); 102 CheckAlignment(reg_a, 2);
107 texture_type = Shader::TextureType::Color2D; 103 texture_type = Shader::TextureType::Color2D;
108 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1)); 104 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1));
109 lod = v.X(reg_b); 105 lod = v.X(reg_b);
110 break; 106 break;
111 } 107 case 6:
112 case 6: {
113 CheckAlignment(reg_a, 2); 108 CheckAlignment(reg_a, 2);
114 texture_type = Shader::TextureType::Color2D; 109 texture_type = Shader::TextureType::Color2D;
115 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1)); 110 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1));
116 multisample = v.X(reg_b); 111 multisample = v.X(reg_b);
117 break; 112 break;
118 } 113 case 7:
119 case 7: {
120 CheckAlignment(reg_a, 2); 114 CheckAlignment(reg_a, 2);
121 texture_type = Shader::TextureType::Color3D; 115 texture_type = Shader::TextureType::Color3D;
122 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1), v.X(reg_b)); 116 coords = v.ir.CompositeConstruct(v.X(reg_a), v.X(reg_a + 1), v.X(reg_b));
123 break; 117 break;
124 }
125 case 8: { 118 case 8: {
126 CheckAlignment(reg_b, 2); 119 CheckAlignment(reg_b, 2);
120 const IR::U32 array{v.ir.BitFieldExtract(v.X(reg_a), v.ir.Imm32(0), v.ir.Imm32(16))};
127 texture_type = Shader::TextureType::ColorArray2D; 121 texture_type = Shader::TextureType::ColorArray2D;
128 IR::U32 array = v.ir.BitFieldExtract(v.X(reg_a), v.ir.Imm32(0), v.ir.Imm32(16));
129 coords = v.ir.CompositeConstruct(v.X(reg_b), v.X(reg_b + 1), array); 122 coords = v.ir.CompositeConstruct(v.X(reg_b), v.X(reg_b + 1), array);
130 break; 123 break;
131 } 124 }
132 case 12: { 125 case 12:
133 CheckAlignment(reg_a, 2); 126 CheckAlignment(reg_a, 2);
134 CheckAlignment(reg_b, 2); 127 CheckAlignment(reg_b, 2);
135 texture_type = Shader::TextureType::Color2D; 128 texture_type = Shader::TextureType::Color2D;
@@ -137,11 +130,8 @@ IR::Value Sample(TranslatorVisitor& v, u64 insn) {
137 lod = v.X(reg_b); 130 lod = v.X(reg_b);
138 offsets = MakeOffset(v, reg_b + 1); 131 offsets = MakeOffset(v, reg_b + 1);
139 break; 132 break;
140 } 133 default:
141 default: {
142 throw NotImplementedException("Illegal encoding {}", tlds.encoding.Value()); 134 throw NotImplementedException("Illegal encoding {}", tlds.encoding.Value());
143 break;
144 }
145 } 135 }
146 IR::TextureInstInfo info{}; 136 IR::TextureInstInfo info{};
147 if (tlds.precision == Precision::F16) { 137 if (tlds.precision == Precision::F16) {