summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
diff options
context:
space:
mode:
authorGravatar FernandoS272021-03-26 16:02:04 +0100
committerGravatar ameerj2021-07-22 21:51:24 -0400
commit742d11c2ad948c8630be15901514ec9e5e5fcd20 (patch)
tree4d9e0976f8c95fbb5c8006b46579200315b04f0f /src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
parentshader: Fix Array Indices in TEX/TLD4 (diff)
downloadyuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.gz
yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.xz
yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.zip
shader: Implement TLD4.PTP
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv_image.cpp')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_image.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
index 589013773..776afd4ab 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
@@ -30,10 +30,13 @@ public:
30 } 30 }
31 } 31 }
32 32
33 explicit ImageOperands([[maybe_unused]] EmitContext& ctx, Id offset) { 33 explicit ImageOperands([[maybe_unused]] EmitContext& ctx, Id offset, Id offset2) {
34 if (Sirit::ValidId(offset)) { 34 if (Sirit::ValidId(offset)) {
35 Add(spv::ImageOperandsMask::Offset, offset); 35 Add(spv::ImageOperandsMask::Offset, offset);
36 } 36 }
37 if (Sirit::ValidId(offset2)) {
38 Add(spv::ImageOperandsMask::ConstOffsets, offset2);
39 }
37 } 40 }
38 41
39 void Add(spv::ImageOperandsMask new_mask, Id value) { 42 void Add(spv::ImageOperandsMask new_mask, Id value) {
@@ -177,7 +180,7 @@ Id EmitImageSampleDrefExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Va
177Id EmitImageGather(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset, 180Id EmitImageGather(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset,
178 [[maybe_unused]] Id offset2) { 181 [[maybe_unused]] Id offset2) {
179 const auto info{inst->Flags<IR::TextureInstInfo>()}; 182 const auto info{inst->Flags<IR::TextureInstInfo>()};
180 const ImageOperands operands(ctx, offset); 183 const ImageOperands operands(ctx, offset, offset2);
181 return Emit(&EmitContext::OpImageSparseGather, &EmitContext::OpImageGather, ctx, inst, 184 return Emit(&EmitContext::OpImageSparseGather, &EmitContext::OpImageGather, ctx, inst,
182 ctx.F32[4], Texture(ctx, index), coords, 185 ctx.F32[4], Texture(ctx, index), coords,
183 ctx.Constant(ctx.U32[1], info.gather_component.Value()), operands.Mask(), 186 ctx.Constant(ctx.U32[1], info.gather_component.Value()), operands.Mask(),
@@ -187,7 +190,7 @@ Id EmitImageGather(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id
187Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, 190Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords,
188 Id offset, [[maybe_unused]] Id offset2, Id dref) { 191 Id offset, [[maybe_unused]] Id offset2, Id dref) {
189 const auto info{inst->Flags<IR::TextureInstInfo>()}; 192 const auto info{inst->Flags<IR::TextureInstInfo>()};
190 const ImageOperands operands(ctx, offset); 193 const ImageOperands operands(ctx, offset, offset2);
191 return Emit(&EmitContext::OpImageSparseDrefGather, &EmitContext::OpImageDrefGather, ctx, inst, 194 return Emit(&EmitContext::OpImageSparseDrefGather, &EmitContext::OpImageDrefGather, ctx, inst,
192 ctx.F32[4], Texture(ctx, index), coords, dref, operands.Mask(), operands.Span()); 195 ctx.F32[4], Texture(ctx, index), coords, dref, operands.Mask(), operands.Span());
193} 196}