diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp index 64292bc1e9..84c1e0b9b2 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp @@ -1856,7 +1856,15 @@ bool LabelShaderKey(std::span key, std::size_t at, std::siz bool LabelContentKey(std::span key, bool draw, bool movable, std::vector& labels) { labels.assign(key.size(), static_cast(Component::Layout)); - if (!draw) return LabelShaderKey(key, 0, key.size(), movable, labels); + if (!draw) { + if (LabelShaderKey(key, 0, key.size(), movable, labels)) return true; + if (key.size() < 2) return false; + labels.assign(key.size(), static_cast(Component::Layout)); + if (!LabelShaderKey(key, 0, key.size() - 2, movable, labels)) return false; + labels[key.size() - 2] = static_cast(Component::Other); + labels[key.size() - 1] = static_cast(Component::Other); + return true; + } if (key.size() < 4) return false; std::fill(labels.begin() + 1, labels.begin() + 3, static_cast(Component::Other)); std::size_t at = 4; diff --git a/core/libs/prx/libSceAgcDriver/tests/KeyMiss.cpp b/core/libs/prx/libSceAgcDriver/tests/KeyMiss.cpp index e2dfb0db44..c34019b2d6 100644 --- a/core/libs/prx/libSceAgcDriver/tests/KeyMiss.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/KeyMiss.cpp @@ -87,6 +87,25 @@ void testDispatchKey() { expectOnly(diff, std::nullopt, "data words are not part of the key without dataWords"); } +std::vector withDevice(std::vector key, std::uint32_t device) { + key.push_back(device); + key.push_back(0u); + return key; +} + +void testDispatchKeyWithDevice() { + ContentKeyDiff diff; + const auto base = withDevice(shaderKey(false, false, bindings()), 5); + check(ShaderResources::DiffContentKeys(base, base, false, diff), "dispatch key with device words was not comparable"); + expectOnly(diff, std::nullopt, "equal dispatch keys with device words reported a difference"); + auto buffer = bindings(); + buffer[0].words[0] += 1; + check(ShaderResources::DiffContentKeys(base, withDevice(shaderKey(false, false, buffer), 5), false, diff), "dispatch V# word 0 with device words"); + expectOnly(diff, ContentKeyComponent::BufferWord0, "dispatch V# word 0 with device words"); + check(ShaderResources::DiffContentKeys(base, withDevice(shaderKey(false, false, bindings()), 6), false, diff), "dispatch device change"); + expectOnly(diff, ContentKeyComponent::Other, "dispatch device change"); +} + void testDrawKey() { ContentKeyDiff diff; const auto base = drawKey(5, shaderKey(true, true, bindings()), 0x1000); @@ -109,6 +128,7 @@ void testDrawKey() { int main() { try { testDispatchKey(); + testDispatchKeyWithDevice(); testDrawKey(); std::puts("Key miss attribution passed"); return 0;