1
0
Fork 0
forked from suyu/suyu

Merge pull request #7222 from FernandoS27/fix-indixed-textures-again

TexturePass: Fix clamping  of images as this allowed negative indices.
This commit is contained in:
Ameer J 2021-10-24 15:16:31 -04:00 committed by GitHub
commit aed5878dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -492,7 +492,7 @@ void TexturePass(Environment& env, IR::Program& program) {
const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)}; const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)};
IR::IREmitter ir{*texture_inst.block, insert_point}; IR::IREmitter ir{*texture_inst.block, insert_point};
const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))}; const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))};
inst->SetArg(0, ir.SMin(ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift), inst->SetArg(0, ir.UMin(ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift),
ir.Imm32(DESCRIPTOR_SIZE - 1))); ir.Imm32(DESCRIPTOR_SIZE - 1)));
} else { } else {
inst->SetArg(0, IR::Value{}); inst->SetArg(0, IR::Value{});