mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
spirv: Use explicit lods outside of fragment shaders
This commit is contained in:
parent
dbbd4b5496
commit
7cfa403683
1 changed files with 16 additions and 5 deletions
|
@ -310,11 +310,22 @@ Id EmitBoundImageWrite(EmitContext&) {
|
||||||
Id EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords,
|
Id EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords,
|
||||||
Id bias_lc, const IR::Value& offset) {
|
Id bias_lc, const IR::Value& offset) {
|
||||||
const auto info{inst->Flags<IR::TextureInstInfo>()};
|
const auto info{inst->Flags<IR::TextureInstInfo>()};
|
||||||
const ImageOperands operands(ctx, info.has_bias != 0, false, info.has_lod_clamp != 0, bias_lc,
|
if (ctx.stage == Stage::Fragment) {
|
||||||
offset);
|
const ImageOperands operands(ctx, info.has_bias != 0, false, info.has_lod_clamp != 0,
|
||||||
|
bias_lc, offset);
|
||||||
return Emit(&EmitContext::OpImageSparseSampleImplicitLod,
|
return Emit(&EmitContext::OpImageSparseSampleImplicitLod,
|
||||||
&EmitContext::OpImageSampleImplicitLod, ctx, inst, ctx.F32[4], Texture(ctx, index),
|
&EmitContext::OpImageSampleImplicitLod, ctx, inst, ctx.F32[4],
|
||||||
coords, operands.Mask(), operands.Span());
|
Texture(ctx, index), coords, operands.Mask(), operands.Span());
|
||||||
|
} else {
|
||||||
|
// We can't use implicit lods on non-fragment stages on SPIR-V. Maxwell hardware behaves as
|
||||||
|
// if the lod was explicitly zero. This may change on Turing with implicit compute
|
||||||
|
// derivatives
|
||||||
|
const Id lod{ctx.Const(0)};
|
||||||
|
const ImageOperands operands(ctx, false, true, info.has_lod_clamp != 0, lod, offset);
|
||||||
|
return Emit(&EmitContext::OpImageSparseSampleExplicitLod,
|
||||||
|
&EmitContext::OpImageSampleExplicitLod, ctx, inst, ctx.F32[4],
|
||||||
|
Texture(ctx, index), coords, operands.Mask(), operands.Span());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Id EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords,
|
Id EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords,
|
||||||
|
|
Loading…
Reference in a new issue