summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-03-21 21:01:47 -0300
committerGravatar ameerj2021-07-22 21:51:24 -0400
commit96b7ced6ec32ccd3da94ebfcfe74a7568cce509f (patch)
tree0e67e6da69ffb0168c606971005ea5e6397b28c0
parentshader: Implement DMNMX, DSET, DSETP (diff)
downloadyuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.tar.gz
yuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.tar.xz
yuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.zip
shader: Better but still partial interpolation support
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp
index 2922145ee..516ffec2d 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp
@@ -141,14 +141,16 @@ void TranslatorVisitor::IPA(u64 insn) {
141 const IR::Attribute attribute{ipa.attribute}; 141 const IR::Attribute attribute{ipa.attribute};
142 IR::F32 value{ir.GetAttribute(attribute)}; 142 IR::F32 value{ir.GetAttribute(attribute)};
143 if (IR::IsGeneric(attribute)) { 143 if (IR::IsGeneric(attribute)) {
144 // const bool is_perspective{UnimplementedReadHeader(GenericAttributeIndex(attribute))}; 144 const ProgramHeader& sph{env.SPH()};
145 const bool is_perspective{false}; 145 const u32 attr_index{IR::GenericAttributeIndex(attribute)};
146 const u32 element{static_cast<u32>(attribute) % 4};
147 const std::array input_map{sph.ps.GenericInputMap(attr_index)};
148 const bool is_perspective{input_map[element] == Shader::PixelImap::Perspective};
146 if (is_perspective) { 149 if (is_perspective) {
147 const IR::F32 rcp_position_w{ir.FPRecip(ir.GetAttribute(IR::Attribute::PositionW))}; 150 const IR::F32 position_w{ir.GetAttribute(IR::Attribute::PositionW)};
148 value = ir.FPMul(value, rcp_position_w); 151 value = ir.FPMul(value, position_w);
149 } 152 }
150 } 153 }
151
152 switch (ipa.interpolation_mode) { 154 switch (ipa.interpolation_mode) {
153 case InterpolationMode::Pass: 155 case InterpolationMode::Pass:
154 break; 156 break;