summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/decode
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-12-26 05:33:56 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-15 21:54:53 +0100
commit5af82a8ed4e2e0b7abc9c7da9f7bb5fa1c83de29 (patch)
tree2982046f3f11a2177905e731bd264d21635e3010 /src/video_core/shader/decode
parentshader_decode: Fixup R2P (diff)
downloadyuzu-5af82a8ed4e2e0b7abc9c7da9f7bb5fa1c83de29.tar
yuzu-5af82a8ed4e2e0b7abc9c7da9f7bb5fa1c83de29.tar.gz
yuzu-5af82a8ed4e2e0b7abc9c7da9f7bb5fa1c83de29.tar.bz2
yuzu-5af82a8ed4e2e0b7abc9c7da9f7bb5fa1c83de29.tar.lz
yuzu-5af82a8ed4e2e0b7abc9c7da9f7bb5fa1c83de29.tar.xz
yuzu-5af82a8ed4e2e0b7abc9c7da9f7bb5fa1c83de29.tar.zst
yuzu-5af82a8ed4e2e0b7abc9c7da9f7bb5fa1c83de29.zip
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r--src/video_core/shader/decode/memory.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp
index ce3445512..679e7f01b 100644
--- a/src/video_core/shader/decode/memory.cpp
+++ b/src/video_core/shader/decode/memory.cpp
@@ -219,8 +219,7 @@ u32 ShaderIR::DecodeMemory(BasicBlock& bb, u32 pc) {
if (instr.texs.fp32_flag) {
WriteTexsInstructionFloat(bb, instr, texture);
} else {
- UNIMPLEMENTED();
- // WriteTexsInstructionHalfFloat(bb, instr, texture);
+ WriteTexsInstructionHalfFloat(bb, instr, texture);
}
break;
}
@@ -416,39 +415,52 @@ const Sampler& ShaderIR::GetSampler(const Tegra::Shader::Sampler& sampler, Textu
return *used_samplers.emplace(entry).first;
}
-void ShaderIR::WriteTexsInstructionFloat(BasicBlock& bb, Tegra::Shader::Instruction instr,
- Node texture) {
+void ShaderIR::WriteTexsInstructionFloat(BasicBlock& bb, Instruction instr, Node texture) {
// TEXS has two destination registers and a swizzle. The first two elements in the swizzle
// go into gpr0+0 and gpr0+1, and the rest goes into gpr28+0 and gpr28+1
MetaComponents meta;
std::array<Node, 4> dest;
-
- std::size_t written_components = 0;
for (u32 component = 0; component < 4; ++component) {
if (!instr.texs.IsComponentEnabled(component)) {
continue;
}
- meta.components_map[written_components] = static_cast<u32>(component);
+ meta.components_map[meta.count] = component;
- if (written_components < 2) {
+ if (meta.count < 2) {
// Write the first two swizzle components to gpr0 and gpr0+1
- dest[written_components] = GetRegister(instr.gpr0.Value() + written_components % 2);
+ dest[meta.count] = GetRegister(instr.gpr0.Value() + meta.count % 2);
} else {
ASSERT(instr.texs.HasTwoDestinations());
// Write the rest of the swizzle components to gpr28 and gpr28+1
- dest[written_components] = GetRegister(instr.gpr28.Value() + written_components % 2);
+ dest[meta.count] = GetRegister(instr.gpr28.Value() + meta.count % 2);
}
-
- ++written_components;
+ ++meta.count;
}
- std::generate(dest.begin() + written_components, dest.end(), [&]() { return GetRegister(RZ); });
+ std::generate(dest.begin() + meta.count, dest.end(), [&]() { return GetRegister(RZ); });
bb.push_back(Operation(OperationCode::AssignComposite, meta, texture, dest[0], dest[1], dest[2],
dest[3]));
}
+void ShaderIR::WriteTexsInstructionHalfFloat(BasicBlock& bb, Instruction instr, Node texture) {
+ // TEXS.F16 destionation registers are packed in two registers in pairs (just like any half
+ // float instruction).
+
+ MetaComponents meta;
+ for (u32 component = 0; component < 4; ++component) {
+ if (!instr.texs.IsComponentEnabled(component))
+ continue;
+ meta.components_map[meta.count++] = component;
+ }
+ if (meta.count == 0)
+ return;
+
+ bb.push_back(Operation(OperationCode::AssignCompositeHalf, meta, texture,
+ GetRegister(instr.gpr0), GetRegister(instr.gpr28)));
+}
+
Node ShaderIR::GetTextureCode(Instruction instr, TextureType texture_type,
TextureProcessMode process_mode, bool depth_compare, bool is_array,
std::size_t array_offset, std::size_t bias_offset,