diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-09-24 01:14:49 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-10-17 03:38:09 +0200 |
commit | 3f4444b552c47e07ff934750e25740a60382db0b (patch) | |
tree | b2d1e5c84ba8e2fae8eb8dc2f6c4a87b971372f9 /src/shader_recompiler/ir_opt/texture_pass.cpp | |
parent | d702b393a4db452f354c6976c18d7093c934a003 (diff) |
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 44ad10d43f..225c238fb6 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) { const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)}; IR::IREmitter ir{*texture_inst.block, insert_point}; const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))}; - inst->SetArg(0, ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift)); + inst->SetArg(0, ir.SMin(ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift), + ir.Imm32(DESCRIPTOR_SIZE - 1))); } else { inst->SetArg(0, IR::Value{}); } |