summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-04-17 03:19:54 -0300
committerGravatar ameerj2021-07-22 21:51:28 -0400
commitc9e4609d87570fc407014cd4b34a60611ad63fac (patch)
treeb0249d79349ff6e3b54948755750f61dea8fd0bf
parentspirv: Use explicit lods outside of fragment shaders (diff)
downloadyuzu-c9e4609d87570fc407014cd4b34a60611ad63fac.tar.gz
yuzu-c9e4609d87570fc407014cd4b34a60611ad63fac.tar.xz
yuzu-c9e4609d87570fc407014cd4b34a60611ad63fac.zip
spirv: Fix implicit lod type
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.h4
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_image.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.h b/src/shader_recompiler/backend/spirv/emit_context.h
index 9db2b0c94..7567fdcac 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.h
+++ b/src/shader_recompiler/backend/spirv/emit_context.h
@@ -101,6 +101,10 @@ public:
101 return Constant(U32[1], value); 101 return Constant(U32[1], value);
102 } 102 }
103 103
104 Id Const(f32 value) {
105 return Constant(F32[1], value);
106 }
107
104 Id Const(u32 element_1, u32 element_2) { 108 Id Const(u32 element_1, u32 element_2) {
105 return ConstantComposite(U32[2], Const(element_1), Const(element_2)); 109 return ConstantComposite(U32[2], Const(element_1), Const(element_2));
106 } 110 }
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
index fea3bc112..7a4388e7e 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp
@@ -320,7 +320,7 @@ Id EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value&
320 // We can't use implicit lods on non-fragment stages on SPIR-V. Maxwell hardware behaves as 320 // We can't use implicit lods on non-fragment stages on SPIR-V. Maxwell hardware behaves as
321 // if the lod was explicitly zero. This may change on Turing with implicit compute 321 // if the lod was explicitly zero. This may change on Turing with implicit compute
322 // derivatives 322 // derivatives
323 const Id lod{ctx.Const(0)}; 323 const Id lod{ctx.Const(0.0f)};
324 const ImageOperands operands(ctx, false, true, info.has_lod_clamp != 0, lod, offset); 324 const ImageOperands operands(ctx, false, true, info.has_lod_clamp != 0, lod, offset);
325 return Emit(&EmitContext::OpImageSparseSampleExplicitLod, 325 return Emit(&EmitContext::OpImageSparseSampleExplicitLod,
326 &EmitContext::OpImageSampleExplicitLod, ctx, inst, ctx.F32[4], 326 &EmitContext::OpImageSampleExplicitLod, ctx, inst, ctx.F32[4],