summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-03-22 01:01:47 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:24 +0200
commit96b7ced6ec32ccd3da94ebfcfe74a7568cce509f (patch)
tree0e67e6da69ffb0168c606971005ea5e6397b28c0 /src
parentshader: Implement DMNMX, DSET, DSETP (diff)
downloadyuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.tar
yuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.tar.gz
yuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.tar.bz2
yuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.tar.lz
yuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.tar.xz
yuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.tar.zst
yuzu-96b7ced6ec32ccd3da94ebfcfe74a7568cce509f.zip
Diffstat (limited to 'src')
-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) {
const IR::Attribute attribute{ipa.attribute};
IR::F32 value{ir.GetAttribute(attribute)};
if (IR::IsGeneric(attribute)) {
- // const bool is_perspective{UnimplementedReadHeader(GenericAttributeIndex(attribute))};
- const bool is_perspective{false};
+ const ProgramHeader& sph{env.SPH()};
+ const u32 attr_index{IR::GenericAttributeIndex(attribute)};
+ const u32 element{static_cast<u32>(attribute) % 4};
+ const std::array input_map{sph.ps.GenericInputMap(attr_index)};
+ const bool is_perspective{input_map[element] == Shader::PixelImap::Perspective};
if (is_perspective) {
- const IR::F32 rcp_position_w{ir.FPRecip(ir.GetAttribute(IR::Attribute::PositionW))};
- value = ir.FPMul(value, rcp_position_w);
+ const IR::F32 position_w{ir.GetAttribute(IR::Attribute::PositionW)};
+ value = ir.FPMul(value, position_w);
}
}
-
switch (ipa.interpolation_mode) {
case InterpolationMode::Pass:
break;