[graphite] Add sampleCount to pipeline key.
Without this fix, a Pipeline created for an attachment with one
sampleCount could be found and used for an attachment with a different
sampleCount, which is invalid.
Change-Id: Ibab0736e0e8dd7b920485eec54d70f00ab8507c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/554999
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/graphite/mtl/MtlCaps.mm b/src/gpu/graphite/mtl/MtlCaps.mm
index dace068..1db578a 100644
--- a/src/gpu/graphite/mtl/MtlCaps.mm
+++ b/src/gpu/graphite/mtl/MtlCaps.mm
@@ -579,7 +579,7 @@
static const skgpu::UniqueKey::Domain kGraphicsPipelineDomain = UniqueKey::GenerateDomain();
SkSpan<const uint32_t> pipelineDescKey = pipelineDesc.asKey();
UniqueKey::Builder builder(&pipelineKey, kGraphicsPipelineDomain,
- pipelineDescKey.size() + 1, "GraphicsPipeline");
+ pipelineDescKey.size() + 2, "GraphicsPipeline");
// add graphicspipelinedesc key
for (unsigned int i = 0; i < pipelineDescKey.size(); ++i) {
builder[i] = pipelineDescKey[i];
@@ -589,8 +589,10 @@
renderPassDesc.fColorAttachment.fTextureInfo.getMtlTextureInfo(&colorInfo);
renderPassDesc.fDepthStencilAttachment.fTextureInfo.getMtlTextureInfo(&depthStencilInfo);
SkASSERT(colorInfo.fFormat < 65535 && depthStencilInfo.fFormat < 65535);
- uint32_t renderPassKey = colorInfo.fFormat << 16 | depthStencilInfo.fFormat;
- builder[pipelineDescKey.size()] = renderPassKey;
+ uint32_t colorAttachmentKey = colorInfo.fFormat << 16 | colorInfo.fSampleCount;
+ uint32_t dsAttachmentKey = depthStencilInfo.fFormat << 16 | depthStencilInfo.fSampleCount;
+ builder[pipelineDescKey.size()] = colorAttachmentKey;
+ builder[pipelineDescKey.size()+1] = dsAttachmentKey;
builder.finish();
}