diff options
| author | 2023-01-28 16:09:58 -0500 | |
|---|---|---|
| committer | 2023-01-28 16:25:18 -0500 | |
| commit | 2c2e019a44e353921d5fdf3cc6ab4304502eb2bd (patch) | |
| tree | 37c9582394bca3fe15fe2827d82f4b0da4e450a8 /src | |
| parent | Merge pull request #9685 from liamwhite/minmax (diff) | |
| download | yuzu-2c2e019a44e353921d5fdf3cc6ab4304502eb2bd.tar.gz yuzu-2c2e019a44e353921d5fdf3cc6ab4304502eb2bd.tar.xz yuzu-2c2e019a44e353921d5fdf3cc6ab4304502eb2bd.zip | |
shader_recompiler: TXQ: Skip QueryLevels when possible
Diffstat (limited to 'src')
11 files changed, 37 insertions, 29 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp index e67e80fac..ec633a297 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | |||
| @@ -531,7 +531,7 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 531 | } | 531 | } |
| 532 | 532 | ||
| 533 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 533 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 534 | ScalarS32 lod) { | 534 | ScalarS32 lod, [[maybe_unused]] const IR::Value& skip_mips) { |
| 535 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 535 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 536 | const std::string texture{Texture(ctx, info, index)}; | 536 | const std::string texture{Texture(ctx, info, index)}; |
| 537 | const std::string_view type{TextureType(info)}; | 537 | const std::string_view type{TextureType(info)}; |
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h index eaaf9ba39..d16fb7d37 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h +++ b/src/shader_recompiler/backend/glasm/emit_glasm_instructions.h | |||
| @@ -582,7 +582,7 @@ void EmitImageGatherDref(EmitContext& ctx, IR::Inst& inst, const IR::Value& inde | |||
| 582 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 582 | void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 583 | const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms); | 583 | const IR::Value& coord, const IR::Value& offset, ScalarS32 lod, ScalarS32 ms); |
| 584 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 584 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 585 | ScalarS32 lod); | 585 | ScalarS32 lod, const IR::Value& skip_mips); |
| 586 | void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord); | 586 | void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, Register coord); |
| 587 | void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 587 | void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 588 | const IR::Value& coord, const IR::Value& derivatives, | 588 | const IR::Value& coord, const IR::Value& derivatives, |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index cecdbb9d6..a7e433f7d 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -455,27 +455,27 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 457 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 458 | std::string_view lod) { | 458 | std::string_view lod, const IR::Value& skip_mips_val) { |
| 459 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 459 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 460 | const auto texture{Texture(ctx, info, index)}; | 460 | const auto texture{Texture(ctx, info, index)}; |
| 461 | const bool skip_mips{skip_mips_val.U1()}; | ||
| 462 | const auto mips{ | ||
| 463 | [&] { return skip_mips ? "0u" : fmt::format("uint(textureQueryLevels({}))", texture); }}; | ||
| 461 | switch (info.type) { | 464 | switch (info.type) { |
| 462 | case TextureType::Color1D: | 465 | case TextureType::Color1D: |
| 463 | return ctx.AddU32x4( | 466 | return ctx.AddU32x4("{}=uvec4(uint(textureSize({},int({}))),0u,0u,{});", inst, texture, lod, |
| 464 | "{}=uvec4(uint(textureSize({},int({}))),0u,0u,uint(textureQueryLevels({})));", inst, | 467 | mips()); |
| 465 | texture, lod, texture); | ||
| 466 | case TextureType::ColorArray1D: | 468 | case TextureType::ColorArray1D: |
| 467 | case TextureType::Color2D: | 469 | case TextureType::Color2D: |
| 468 | case TextureType::ColorCube: | 470 | case TextureType::ColorCube: |
| 469 | case TextureType::Color2DRect: | 471 | case TextureType::Color2DRect: |
| 470 | return ctx.AddU32x4( | 472 | return ctx.AddU32x4("{}=uvec4(uvec2(textureSize({},int({}))),0u,{});", inst, texture, lod, |
| 471 | "{}=uvec4(uvec2(textureSize({},int({}))),0u,uint(textureQueryLevels({})));", inst, | 473 | mips()); |
| 472 | texture, lod, texture); | ||
| 473 | case TextureType::ColorArray2D: | 474 | case TextureType::ColorArray2D: |
| 474 | case TextureType::Color3D: | 475 | case TextureType::Color3D: |
| 475 | case TextureType::ColorArrayCube: | 476 | case TextureType::ColorArrayCube: |
| 476 | return ctx.AddU32x4( | 477 | return ctx.AddU32x4("{}=uvec4(uvec3(textureSize({},int({}))),{});", inst, texture, lod, |
| 477 | "{}=uvec4(uvec3(textureSize({},int({}))),uint(textureQueryLevels({})));", inst, texture, | 478 | mips()); |
| 478 | lod, texture); | ||
| 479 | case TextureType::Buffer: | 479 | case TextureType::Buffer: |
| 480 | throw NotImplementedException("EmitImageQueryDimensions Texture buffers"); | 480 | throw NotImplementedException("EmitImageQueryDimensions Texture buffers"); |
| 481 | } | 481 | } |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h index 4151c89de..02f91f2f4 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h +++ b/src/shader_recompiler/backend/glsl/emit_glsl_instructions.h | |||
| @@ -655,7 +655,7 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 655 | std::string_view coords, std::string_view offset, std::string_view lod, | 655 | std::string_view coords, std::string_view offset, std::string_view lod, |
| 656 | std::string_view ms); | 656 | std::string_view ms); |
| 657 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 657 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 658 | std::string_view lod); | 658 | std::string_view lod, const IR::Value& skip_mips); |
| 659 | void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 659 | void EmitImageQueryLod(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 660 | std::string_view coords); | 660 | std::string_view coords); |
| 661 | void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 661 | void EmitImageGradient(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp index c898ce12f..3b969d915 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | |||
| @@ -445,11 +445,13 @@ Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id c | |||
| 445 | TextureImage(ctx, info, index), coords, operands.MaskOptional(), operands.Span()); | 445 | TextureImage(ctx, info, index), coords, operands.MaskOptional(), operands.Span()); |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id lod) { | 448 | Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id lod, |
| 449 | const IR::Value& skip_mips_val) { | ||
| 449 | const auto info{inst->Flags<IR::TextureInstInfo>()}; | 450 | const auto info{inst->Flags<IR::TextureInstInfo>()}; |
| 450 | const Id image{TextureImage(ctx, info, index)}; | 451 | const Id image{TextureImage(ctx, info, index)}; |
| 451 | const Id zero{ctx.u32_zero_value}; | 452 | const Id zero{ctx.u32_zero_value}; |
| 452 | const auto mips{[&] { return ctx.OpImageQueryLevels(ctx.U32[1], image); }}; | 453 | const bool skip_mips{skip_mips_val.U1()}; |
| 454 | const auto mips{[&] { return skip_mips ? zero : ctx.OpImageQueryLevels(ctx.U32[1], image); }}; | ||
| 453 | switch (info.type) { | 455 | switch (info.type) { |
| 454 | case TextureType::Color1D: | 456 | case TextureType::Color1D: |
| 455 | return ctx.OpCompositeConstruct(ctx.U32[4], ctx.OpImageQuerySizeLod(ctx.U32[1], image, lod), | 457 | return ctx.OpCompositeConstruct(ctx.U32[4], ctx.OpImageQuerySizeLod(ctx.U32[1], image, lod), |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h index e31cdc5e8..1b99f648d 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv_instructions.h | |||
| @@ -540,7 +540,8 @@ Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | |||
| 540 | const IR::Value& offset, const IR::Value& offset2, Id dref); | 540 | const IR::Value& offset, const IR::Value& offset2, Id dref); |
| 541 | Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset, | 541 | Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset, |
| 542 | Id lod, Id ms); | 542 | Id lod, Id ms); |
| 543 | Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id lod); | 543 | Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id lod, |
| 544 | const IR::Value& skip_mips); | ||
| 544 | Id EmitImageQueryLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords); | 545 | Id EmitImageQueryLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords); |
| 545 | Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, | 546 | Id EmitImageGradient(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, |
| 546 | Id derivates, Id offset, Id lod_clamp); | 547 | Id derivates, Id offset, Id lod_clamp); |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index eb2e49a68..8b379c920 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -1851,15 +1851,16 @@ Value IREmitter::ImageFetch(const Value& handle, const Value& coords, const Valu | |||
| 1851 | return Inst(op, Flags{info}, handle, coords, offset, lod, multisampling); | 1851 | return Inst(op, Flags{info}, handle, coords, offset, lod, multisampling); |
| 1852 | } | 1852 | } |
| 1853 | 1853 | ||
| 1854 | Value IREmitter::ImageQueryDimension(const Value& handle, const IR::U32& lod) { | 1854 | Value IREmitter::ImageQueryDimension(const Value& handle, const IR::U32& lod, |
| 1855 | const IR::U1& skip_mips) { | ||
| 1855 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageQueryDimensions | 1856 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageQueryDimensions |
| 1856 | : Opcode::BindlessImageQueryDimensions}; | 1857 | : Opcode::BindlessImageQueryDimensions}; |
| 1857 | return Inst(op, handle, lod); | 1858 | return Inst(op, handle, lod, skip_mips); |
| 1858 | } | 1859 | } |
| 1859 | 1860 | ||
| 1860 | Value IREmitter::ImageQueryDimension(const Value& handle, const IR::U32& lod, | 1861 | Value IREmitter::ImageQueryDimension(const Value& handle, const IR::U32& lod, |
| 1861 | TextureInstInfo info) { | 1862 | const IR::U1& skip_mips, TextureInstInfo info) { |
| 1862 | return Inst(Opcode::ImageQueryDimensions, Flags{info}, handle, lod); | 1863 | return Inst(Opcode::ImageQueryDimensions, Flags{info}, handle, lod, skip_mips); |
| 1863 | } | 1864 | } |
| 1864 | 1865 | ||
| 1865 | Value IREmitter::ImageQueryLod(const Value& handle, const Value& coords, TextureInstInfo info) { | 1866 | Value IREmitter::ImageQueryLod(const Value& handle, const Value& coords, TextureInstInfo info) { |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 7aaaa4ab0..df158c928 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -320,9 +320,10 @@ public: | |||
| 320 | [[nodiscard]] F32 ImageSampleDrefExplicitLod(const Value& handle, const Value& coords, | 320 | [[nodiscard]] F32 ImageSampleDrefExplicitLod(const Value& handle, const Value& coords, |
| 321 | const F32& dref, const F32& lod, | 321 | const F32& dref, const F32& lod, |
| 322 | const Value& offset, TextureInstInfo info); | 322 | const Value& offset, TextureInstInfo info); |
| 323 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod); | ||
| 324 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod, | 323 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod, |
| 325 | TextureInstInfo info); | 324 | const IR::U1& skip_mips); |
| 325 | [[nodiscard]] Value ImageQueryDimension(const Value& handle, const IR::U32& lod, | ||
| 326 | const IR::U1& skip_mips, TextureInstInfo info); | ||
| 326 | 327 | ||
| 327 | [[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords, | 328 | [[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords, |
| 328 | TextureInstInfo info); | 329 | TextureInstInfo info); |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 1fe3749cc..4ba262b84 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -483,7 +483,7 @@ OPCODE(BindlessImageSampleDrefExplicitLod, F32, U32, | |||
| 483 | OPCODE(BindlessImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) | 483 | OPCODE(BindlessImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 484 | OPCODE(BindlessImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) | 484 | OPCODE(BindlessImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) |
| 485 | OPCODE(BindlessImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, ) | 485 | OPCODE(BindlessImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, ) |
| 486 | OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, ) | 486 | OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, U1, ) |
| 487 | OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) | 487 | OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) |
| 488 | OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) | 488 | OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) |
| 489 | OPCODE(BindlessImageRead, U32x4, U32, Opaque, ) | 489 | OPCODE(BindlessImageRead, U32x4, U32, Opaque, ) |
| @@ -496,7 +496,7 @@ OPCODE(BoundImageSampleDrefExplicitLod, F32, U32, | |||
| 496 | OPCODE(BoundImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) | 496 | OPCODE(BoundImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 497 | OPCODE(BoundImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) | 497 | OPCODE(BoundImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) |
| 498 | OPCODE(BoundImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, ) | 498 | OPCODE(BoundImageFetch, F32x4, U32, Opaque, Opaque, U32, Opaque, ) |
| 499 | OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, ) | 499 | OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, U1, ) |
| 500 | OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) | 500 | OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) |
| 501 | OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) | 501 | OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) |
| 502 | OPCODE(BoundImageRead, U32x4, U32, Opaque, ) | 502 | OPCODE(BoundImageRead, U32x4, U32, Opaque, ) |
| @@ -509,7 +509,7 @@ OPCODE(ImageSampleDrefExplicitLod, F32, Opaq | |||
| 509 | OPCODE(ImageGather, F32x4, Opaque, Opaque, Opaque, Opaque, ) | 509 | OPCODE(ImageGather, F32x4, Opaque, Opaque, Opaque, Opaque, ) |
| 510 | OPCODE(ImageGatherDref, F32x4, Opaque, Opaque, Opaque, Opaque, F32, ) | 510 | OPCODE(ImageGatherDref, F32x4, Opaque, Opaque, Opaque, Opaque, F32, ) |
| 511 | OPCODE(ImageFetch, F32x4, Opaque, Opaque, Opaque, U32, Opaque, ) | 511 | OPCODE(ImageFetch, F32x4, Opaque, Opaque, Opaque, U32, Opaque, ) |
| 512 | OPCODE(ImageQueryDimensions, U32x4, Opaque, U32, ) | 512 | OPCODE(ImageQueryDimensions, U32x4, Opaque, U32, U1, ) |
| 513 | OPCODE(ImageQueryLod, F32x4, Opaque, Opaque, ) | 513 | OPCODE(ImageQueryLod, F32x4, Opaque, Opaque, ) |
| 514 | OPCODE(ImageGradient, F32x4, Opaque, Opaque, Opaque, Opaque, Opaque, ) | 514 | OPCODE(ImageGradient, F32x4, Opaque, Opaque, Opaque, Opaque, Opaque, ) |
| 515 | OPCODE(ImageRead, U32x4, Opaque, Opaque, ) | 515 | OPCODE(ImageRead, U32x4, Opaque, Opaque, ) |
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp index f8cfd4ab6..39af62559 100644 --- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp +++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_query.cpp | |||
| @@ -15,11 +15,13 @@ enum class Mode : u64 { | |||
| 15 | SamplePos = 5, | 15 | SamplePos = 5, |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | IR::Value Query(TranslatorVisitor& v, const IR::U32& handle, Mode mode, IR::Reg src_reg) { | 18 | IR::Value Query(TranslatorVisitor& v, const IR::U32& handle, Mode mode, IR::Reg src_reg, u64 mask) { |
| 19 | switch (mode) { | 19 | switch (mode) { |
| 20 | case Mode::Dimension: { | 20 | case Mode::Dimension: { |
| 21 | const bool needs_num_mips{((mask >> 3) & 1) != 0}; | ||
| 22 | const IR::U1 skip_mips{v.ir.Imm1(!needs_num_mips)}; | ||
| 21 | const IR::U32 lod{v.X(src_reg)}; | 23 | const IR::U32 lod{v.X(src_reg)}; |
| 22 | return v.ir.ImageQueryDimension(handle, lod); | 24 | return v.ir.ImageQueryDimension(handle, lod, skip_mips); |
| 23 | } | 25 | } |
| 24 | case Mode::TextureType: | 26 | case Mode::TextureType: |
| 25 | case Mode::SamplePos: | 27 | case Mode::SamplePos: |
| @@ -46,7 +48,7 @@ void Impl(TranslatorVisitor& v, u64 insn, std::optional<u32> cbuf_offset) { | |||
| 46 | handle = v.X(src_reg); | 48 | handle = v.X(src_reg); |
| 47 | ++src_reg; | 49 | ++src_reg; |
| 48 | } | 50 | } |
| 49 | const IR::Value query{Query(v, handle, txq.mode, src_reg)}; | 51 | const IR::Value query{Query(v, handle, txq.mode, src_reg, txq.mask)}; |
| 50 | IR::Reg dest_reg{txq.dest_reg}; | 52 | IR::Reg dest_reg{txq.dest_reg}; |
| 51 | for (int element = 0; element < 4; ++element) { | 53 | for (int element = 0; element < 4; ++element) { |
| 52 | if (((txq.mask >> element) & 1) == 0) { | 54 | if (((txq.mask >> element) & 1) == 0) { |
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp index 9718c6921..fdc350ef4 100644 --- a/src/shader_recompiler/ir_opt/texture_pass.cpp +++ b/src/shader_recompiler/ir_opt/texture_pass.cpp | |||
| @@ -452,7 +452,8 @@ void PatchImageSampleImplicitLod(IR::Block& block, IR::Inst& inst) { | |||
| 452 | const IR::Value coord(inst.Arg(1)); | 452 | const IR::Value coord(inst.Arg(1)); |
| 453 | const IR::Value handle(ir.Imm32(0)); | 453 | const IR::Value handle(ir.Imm32(0)); |
| 454 | const IR::U32 lod{ir.Imm32(0)}; | 454 | const IR::U32 lod{ir.Imm32(0)}; |
| 455 | const IR::Value texture_size = ir.ImageQueryDimension(handle, lod, info); | 455 | const IR::U1 skip_mips{ir.Imm1(true)}; |
| 456 | const IR::Value texture_size = ir.ImageQueryDimension(handle, lod, skip_mips, info); | ||
| 456 | inst.SetArg( | 457 | inst.SetArg( |
| 457 | 1, ir.CompositeConstruct( | 458 | 1, ir.CompositeConstruct( |
| 458 | ir.FPMul(IR::F32(ir.CompositeExtract(coord, 0)), | 459 | ir.FPMul(IR::F32(ir.CompositeExtract(coord, 0)), |