VERY experimental Nintendo Switch 2 emulator
C++
Shader Compiler: avoid overflowed indices on indixed samplers.
Fernando Sahmkow1a0006ef55ec
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cppindex 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{});}