Fixes serialization of RenderPassCacheQuery struct.

- Since we were recording everything, the sparse representation caused uninitialized data to be recorded in the cache key causing cache key inequality at times.

Bug: dawn:549
Change-Id: I7dc3ea34a7dd91addc7b5ca52c79b3354733966b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87609
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Loko Kung 2022-04-26 01:39:41 +00:00 committed by Dawn LUCI CQ
parent f4a861dd60
commit 7b20709d0e
1 changed files with 15 additions and 6 deletions

View File

@ -229,12 +229,21 @@ namespace dawn::native {
void CacheKeySerializer<vulkan::RenderPassCacheQuery>::Serialize(
CacheKey* key,
const vulkan::RenderPassCacheQuery& t) {
key->Record(t.colorMask.to_ulong(), t.resolveTargetMask.to_ulong())
.RecordIterable(t.colorFormats)
.RecordIterable(t.colorLoadOp)
.RecordIterable(t.colorStoreOp)
.Record(t.hasDepthStencil, t.depthStencilFormat, t.depthLoadOp, t.depthStoreOp,
t.stencilLoadOp, t.stencilStoreOp, t.readOnlyDepthStencil, t.sampleCount);
key->Record(t.colorMask.to_ulong(), t.resolveTargetMask.to_ulong(), t.sampleCount);
// Manually iterate the color attachment indices and their corresponding format/load/store
// ops because the data is sparse and may be uninitialized. Since we record the colorMask
// member above, recording sparse data should be fine here.
for (ColorAttachmentIndex i : IterateBitSet(t.colorMask)) {
key->Record(t.colorFormats[i], t.colorLoadOp[i], t.colorStoreOp[i]);
}
// Serialize the depth-stencil toggle bit, and the parameters if applicable.
key->Record(t.hasDepthStencil);
if (t.hasDepthStencil) {
key->Record(t.depthStencilFormat, t.depthLoadOp, t.depthStoreOp, t.stencilLoadOp,
t.stencilStoreOp, t.readOnlyDepthStencil);
}
}
template <>