shader: Properly scale image reads and add GL SPIR-V support

Thanks for everything!
This commit is contained in:
ReinUsesLisp 2021-08-01 18:57:45 -03:00 committed by Fernando Sahmkow
parent fc9bb3c3fe
commit e66d5b88a6
25 changed files with 228 additions and 77 deletions

View file

@ -432,6 +432,7 @@ void VisitUsages(Info& info, IR::Inst& inst) {
break;
case IR::Opcode::ResolutionDownFactor:
case IR::Opcode::IsTextureScaled:
case IR::Opcode::IsImageScaled:
info.uses_rescaling_uniform = true;
break;
case IR::Opcode::LaneId:

View file

@ -129,8 +129,7 @@ void PatchImageFetch(IR::Block& block, IR::Inst& inst) {
void PatchImageRead(IR::Block& block, IR::Inst& inst) {
IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)};
const auto info{inst.Flags<IR::TextureInstInfo>()};
// TODO: Scale conditionally
const IR::U1 is_scaled{IR::Value{true}};
const IR::U1 is_scaled{ir.IsImageScaled(ir.Imm32(info.descriptor_index))};
ScaleIntegerCoord(ir, inst, is_scaled);
}