[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>
This commit is contained in:
Jim Van Verth 2022-06-30 16:42:58 -04:00 committed by SkCQ
parent 44d58be8bd
commit d9eeef0790

View File

@ -579,7 +579,7 @@ UniqueKey MtlCaps::makeGraphicsPipelineKey(const GraphicsPipelineDesc& pipelineD
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 @@ UniqueKey MtlCaps::makeGraphicsPipelineKey(const GraphicsPipelineDesc& pipelineD
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();
}