summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-08-01 07:26:02 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2021-11-16 22:11:29 +0100
commitfc9bb3c3fed4721b06bda46deea3770e5285b104 (patch)
treec1e3efd2e418e9df2d9ab72ef7261366f5202468 /src/shader_recompiler
parenttexture_cache: Add getter to query if image view is rescaled (diff)
downloadyuzu-fc9bb3c3fed4721b06bda46deea3770e5285b104.tar
yuzu-fc9bb3c3fed4721b06bda46deea3770e5285b104.tar.gz
yuzu-fc9bb3c3fed4721b06bda46deea3770e5285b104.tar.bz2
yuzu-fc9bb3c3fed4721b06bda46deea3770e5285b104.tar.lz
yuzu-fc9bb3c3fed4721b06bda46deea3770e5285b104.tar.xz
yuzu-fc9bb3c3fed4721b06bda46deea3770e5285b104.tar.zst
yuzu-fc9bb3c3fed4721b06bda46deea3770e5285b104.zip
Diffstat (limited to 'src/shader_recompiler')
-rw-r--r--src/shader_recompiler/ir_opt/rescaling_pass.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/shader_recompiler/ir_opt/rescaling_pass.cpp b/src/shader_recompiler/ir_opt/rescaling_pass.cpp
index d5b98ae6e..86c8f0c69 100644
--- a/src/shader_recompiler/ir_opt/rescaling_pass.cpp
+++ b/src/shader_recompiler/ir_opt/rescaling_pass.cpp
@@ -84,10 +84,8 @@ void PatchImageQueryDimensions(IR::Block& block, IR::Inst& inst) {
}
}
-void PatchImageFetch(IR::Block& block, IR::Inst& inst) {
- IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)};
+void ScaleIntegerCoord(IR::IREmitter& ir, IR::Inst& inst, const IR::U1& is_scaled) {
const auto info{inst.Flags<IR::TextureInstInfo>()};
- const IR::U1 is_scaled{ir.IsTextureScaled(ir.Imm32(info.descriptor_index))};
const IR::Value coord{inst.Arg(1)};
switch (info.type) {
case TextureType::Color1D:
@@ -121,6 +119,21 @@ void PatchImageFetch(IR::Block& block, IR::Inst& inst) {
}
}
+void PatchImageFetch(IR::Block& block, IR::Inst& inst) {
+ IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)};
+ const auto info{inst.Flags<IR::TextureInstInfo>()};
+ const IR::U1 is_scaled{ir.IsTextureScaled(ir.Imm32(info.descriptor_index))};
+ ScaleIntegerCoord(ir, inst, is_scaled);
+}
+
+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}};
+ ScaleIntegerCoord(ir, inst, is_scaled);
+}
+
void Visit(const IR::Program& program, IR::Block& block, IR::Inst& inst) {
const bool is_fragment_shader{program.stage == Stage::Fragment};
switch (inst.GetOpcode()) {
@@ -144,6 +157,9 @@ void Visit(const IR::Program& program, IR::Block& block, IR::Inst& inst) {
case IR::Opcode::ImageFetch:
PatchImageFetch(block, inst);
break;
+ case IR::Opcode::ImageRead:
+ PatchImageRead(block, inst);
+ break;
default:
break;
}