summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-02-05 02:22:32 +0100
committerGitHub <noreply@github.com>2019-02-05 02:22:32 +0100
commitbb4549a73d207637a1407cffe662fa58ee58d594 (patch)
tree15eab5ac226a0fd6db21b96ecbcc79ef0b1461c4 /src/video_core
parentMerge pull request #2074 from ReinUsesLisp/shader-ir-unify-offset (diff)
parentUpdate src/video_core/engines/shader_bytecode.h (diff)
downloadyuzu-bb4549a73d207637a1407cffe662fa58ee58d594.tar
yuzu-bb4549a73d207637a1407cffe662fa58ee58d594.tar.gz
yuzu-bb4549a73d207637a1407cffe662fa58ee58d594.tar.bz2
yuzu-bb4549a73d207637a1407cffe662fa58ee58d594.tar.lz
yuzu-bb4549a73d207637a1407cffe662fa58ee58d594.tar.xz
yuzu-bb4549a73d207637a1407cffe662fa58ee58d594.tar.zst
yuzu-bb4549a73d207637a1407cffe662fa58ee58d594.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/engines/shader_bytecode.h4
-rw-r--r--src/video_core/shader/decode/memory.cpp15
2 files changed, 13 insertions, 6 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h
index 713b01c9f..8e915e2ae 100644
--- a/src/video_core/engines/shader_bytecode.h
+++ b/src/video_core/engines/shader_bytecode.h
@@ -981,6 +981,10 @@ union Instruction {
}
return false;
}
+
+ bool IsComponentEnabled(std::size_t component) const {
+ return ((1ULL << component) & component_mask) != 0;
+ }
} txq;
union {
diff --git a/src/video_core/shader/decode/memory.cpp b/src/video_core/shader/decode/memory.cpp
index 4d075f088..1f418b4e6 100644
--- a/src/video_core/shader/decode/memory.cpp
+++ b/src/video_core/shader/decode/memory.cpp
@@ -324,15 +324,18 @@ u32 ShaderIR::DecodeMemory(BasicBlock& bb, const BasicBlock& code, u32 pc) {
const auto& sampler =
GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false);
+ u32 indexer = 0;
switch (instr.txq.query_type) {
case Tegra::Shader::TextureQueryType::Dimension: {
for (u32 element = 0; element < 4; ++element) {
- MetaTexture meta{sampler, element};
- const Node value = Operation(OperationCode::F4TextureQueryDimensions,
- std::move(meta), GetRegister(instr.gpr8));
- SetTemporal(bb, element, value);
+ if (instr.txq.IsComponentEnabled(element)) {
+ MetaTexture meta{sampler, element};
+ const Node value = Operation(OperationCode::F4TextureQueryDimensions,
+ std::move(meta), GetRegister(instr.gpr8));
+ SetTemporal(bb, indexer++, value);
+ }
}
- for (u32 i = 0; i < 4; ++i) {
+ for (u32 i = 0; i < indexer; ++i) {
SetRegister(bb, instr.gpr0.Value() + i, GetTemporal(i));
}
break;
@@ -734,4 +737,4 @@ std::tuple<std::size_t, std::size_t> ShaderIR::ValidateAndGetCoordinateElement(
return {coord_count, total_coord_count};
}
-} // namespace VideoCommon::Shader \ No newline at end of file
+} // namespace VideoCommon::Shader