You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have multiple pipelines where the only difference is color blend state, the pipeline cache may choose the wrong cached pipeline.
This is caused by GraphicsState hash being computed from a copy of the GraphicsState and GraphicsState not being copy safe. Specifically, the pAttachments member points to the wrong address on copy. Ideally it would always point to it's accompanied m_colorBlendAttachments[0].
One solution would be to add a copy ctor. However, since only a single copy is made, and that copy is only used by the hash function, we can simply fix the hash function.
In GraphicsState::GetHash()
Replace m_colorBlendState.pAttachments[i] with m_colorBlendAttachments[i]
eg.
// NOTE: Copy of m_colorBlendState.pAttachments is incorrect. Use m_colorBlendAttachments instead, same as GetColorBlendAttachmentState()
for (auto i = 0U; i < m_colorBlendState.attachmentCount; ++i)
{
cb->colorWriteMask = static_cast<uint32_t>(m_colorBlendAttachments[i].colorWriteMask);
cb->blendEnable = m_colorBlendAttachments[i].blendEnable;
cb->srcColorBlendFactor = static_cast<uint32_t>(m_colorBlendAttachments[i].srcColorBlendFactor);
cb->dstColorBlendFactor = static_cast<uint32_t>(m_colorBlendAttachments[i].dstColorBlendFactor);
cb->colorBlendOp = static_cast<uint32_t>(m_colorBlendAttachments[i].colorBlendOp);
cb->srcAlphaBlendFactor = static_cast<uint32_t>(m_colorBlendAttachments[i].srcAlphaBlendFactor);
cb->dstAlphaBlendFactor = static_cast<uint32_t>(m_colorBlendAttachments[i].dstAlphaBlendFactor);
cb->alphaBlendOp = static_cast<uint32_t>(m_colorBlendAttachments[i].alphaBlendOp);
++cb;
}
The text was updated successfully, but these errors were encountered:
If you have multiple pipelines where the only difference is color blend state, the pipeline cache may choose the wrong cached pipeline.
This is caused by GraphicsState hash being computed from a copy of the GraphicsState and GraphicsState not being copy safe. Specifically, the
pAttachments
member points to the wrong address on copy. Ideally it would always point to it's accompaniedm_colorBlendAttachments[0]
.One solution would be to add a copy ctor. However, since only a single copy is made, and that copy is only used by the hash function, we can simply fix the hash function.
In
GraphicsState::GetHash()
Replace
m_colorBlendState.pAttachments[i]
withm_colorBlendAttachments[i]
eg.
The text was updated successfully, but these errors were encountered: