yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Merge pull request #2082 from FernandoS27/txq-stl

Fix TXQ not using the component mask.
This commit is contained in:
bunnei 2019-02-04 20:22:32 -05:00 committed by GitHub
commit bb4549a73d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -981,6 +981,10 @@ union Instruction {
} }
return false; return false;
} }
bool IsComponentEnabled(std::size_t component) const {
return ((1ULL << component) & component_mask) != 0;
}
} txq; } txq;
union { union {

View File

@ -324,15 +324,18 @@ u32 ShaderIR::DecodeMemory(BasicBlock& bb, const BasicBlock& code, u32 pc) {
const auto& sampler = const auto& sampler =
GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false); GetSampler(instr.sampler, Tegra::Shader::TextureType::Texture2D, false, false);
u32 indexer = 0;
switch (instr.txq.query_type) { switch (instr.txq.query_type) {
case Tegra::Shader::TextureQueryType::Dimension: { case Tegra::Shader::TextureQueryType::Dimension: {
for (u32 element = 0; element < 4; ++element) { for (u32 element = 0; element < 4; ++element) {
MetaTexture meta{sampler, element}; if (instr.txq.IsComponentEnabled(element)) {
const Node value = Operation(OperationCode::F4TextureQueryDimensions, MetaTexture meta{sampler, element};
std::move(meta), GetRegister(instr.gpr8)); const Node value = Operation(OperationCode::F4TextureQueryDimensions,
SetTemporal(bb, element, value); 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)); SetRegister(bb, instr.gpr0.Value() + i, GetTemporal(i));
} }
break; break;
@ -734,4 +737,4 @@ std::tuple<std::size_t, std::size_t> ShaderIR::ValidateAndGetCoordinateElement(
return {coord_count, total_coord_count}; return {coord_count, total_coord_count};
} }
} // namespace VideoCommon::Shader } // namespace VideoCommon::Shader