mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 04:08:52 +01:00
[dxvk] Add blending toggle to swap chain blitter pipelines
This commit is contained in:
parent
836e990dc5
commit
dbaa4d8df4
@ -494,14 +494,24 @@ namespace dxvk {
|
||||
msState.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
|
||||
msState.pSampleMask = &sampleMask;
|
||||
|
||||
VkPipelineColorBlendAttachmentState cbOpaqueAttachment = { };
|
||||
cbOpaqueAttachment.colorWriteMask =
|
||||
VkPipelineColorBlendAttachmentState cbAttachment = { };
|
||||
cbAttachment.colorWriteMask =
|
||||
VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
|
||||
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||
|
||||
VkPipelineColorBlendStateCreateInfo cbOpaqueState = { VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO };
|
||||
cbOpaqueState.attachmentCount = 1;
|
||||
cbOpaqueState.pAttachments = &cbOpaqueAttachment;
|
||||
if (key.needsBlending) {
|
||||
cbAttachment.blendEnable = VK_TRUE;
|
||||
cbAttachment.colorBlendOp = VK_BLEND_OP_ADD;
|
||||
cbAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
|
||||
cbAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||
cbAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
|
||||
cbAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
|
||||
cbAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||
}
|
||||
|
||||
VkPipelineColorBlendStateCreateInfo cbState = { VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO };
|
||||
cbState.attachmentCount = 1;
|
||||
cbState.pAttachments = &cbAttachment;
|
||||
|
||||
static const std::array<VkDynamicState, 2> dynStates = {
|
||||
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT,
|
||||
@ -520,7 +530,7 @@ namespace dxvk {
|
||||
blitInfo.pViewportState = &vpState;
|
||||
blitInfo.pRasterizationState = &rsState;
|
||||
blitInfo.pMultisampleState = &msState;
|
||||
blitInfo.pColorBlendState = &cbOpaqueState;
|
||||
blitInfo.pColorBlendState = &cbState;
|
||||
blitInfo.pDynamicState = &dynState;
|
||||
blitInfo.layout = m_pipelineLayout;
|
||||
blitInfo.basePipelineIndex = -1;
|
||||
|
@ -43,6 +43,8 @@ namespace dxvk {
|
||||
VkBool32 needsBlit = VK_FALSE;
|
||||
/// Bit indicating whether a gamma curve is to be applied.
|
||||
VkBool32 needsGamma = VK_FALSE;
|
||||
/// Bit indicating whether alpha blending is required
|
||||
VkBool32 needsBlending = VK_FALSE;
|
||||
|
||||
size_t hash() const {
|
||||
DxvkHashState hash;
|
||||
@ -53,6 +55,7 @@ namespace dxvk {
|
||||
hash.add(uint32_t(dstFormat));
|
||||
hash.add(uint32_t(needsBlit));
|
||||
hash.add(uint32_t(needsGamma));
|
||||
hash.add(uint32_t(needsBlending));
|
||||
return hash;
|
||||
}
|
||||
|
||||
@ -63,7 +66,8 @@ namespace dxvk {
|
||||
&& dstSpace == other.dstSpace
|
||||
&& dstFormat == other.dstFormat
|
||||
&& needsBlit == other.needsBlit
|
||||
&& needsGamma == other.needsGamma;
|
||||
&& needsGamma == other.needsGamma
|
||||
&& needsBlending == other.needsBlending;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user