diff options
| author | 2021-09-24 01:14:49 +0200 | |
|---|---|---|
| committer | 2021-10-17 03:38:09 +0200 | |
| commit | 3f4444b552c47e07ff934750e25740a60382db0b (patch) | |
| tree | b2d1e5c84ba8e2fae8eb8dc2f6c4a87b971372f9 /src/shader_recompiler/ir_opt/texture_pass.cpp | |
| parent | Vulkan Query Cache: make sure to wait for the query result. (diff) | |
| download | yuzu-3f4444b552c47e07ff934750e25740a60382db0b.tar.gz yuzu-3f4444b552c47e07ff934750e25740a60382db0b.tar.xz yuzu-3f4444b552c47e07ff934750e25740a60382db0b.zip | |
Shader Compiler: avoid overflowed indices on indixed samplers.
Diffstat (limited to 'src/shader_recompiler/ir_opt/texture_pass.cpp')
| -rw-r--r-- | src/shader_recompiler/ir_opt/texture_pass.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp index 44ad10d43..225c238fb 100644 --- a/src/shader_recompiler/ir_opt/texture_pass.cpp +++ b/src/shader_recompiler/ir_opt/texture_pass.cpp | |||
| @@ -492,7 +492,8 @@ void TexturePass(Environment& env, IR::Program& program) { | |||
| 492 | const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)}; | 492 | const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)}; |
| 493 | IR::IREmitter ir{*texture_inst.block, insert_point}; | 493 | IR::IREmitter ir{*texture_inst.block, insert_point}; |
| 494 | const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))}; | 494 | const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))}; |
| 495 | inst->SetArg(0, ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift)); | 495 | inst->SetArg(0, ir.SMin(ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift), |
| 496 | ir.Imm32(DESCRIPTOR_SIZE - 1))); | ||
| 496 | } else { | 497 | } else { |
| 497 | inst->SetArg(0, IR::Value{}); | 498 | inst->SetArg(0, IR::Value{}); |
| 498 | } | 499 | } |