1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 07:24:15 +01:00

[dxvk] Add methods to check which dynamic states a pipeline uses

This commit is contained in:
Philip Rebohle 2019-01-16 19:31:38 +01:00
parent 59462f3231
commit 190f114449
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 34 additions and 1 deletions

View File

@ -27,7 +27,7 @@ namespace dxvk {
using DxvkGraphicsPipelineFlags = Flags<DxvkGraphicsPipelineFlag>;
/**
* \brief Graphics pipeline state info
*
@ -46,6 +46,28 @@ namespace dxvk {
bool operator == (const DxvkGraphicsPipelineStateInfo& other) const;
bool operator != (const DxvkGraphicsPipelineStateInfo& other) const;
bool useDynamicStencilRef() const {
return dsEnableStencilTest;
}
bool useDynamicDepthBias() const {
return rsDepthBiasEnable;
}
bool useDynamicBlendConstants() const {
bool result = false;
for (uint32_t i = 0; i < MaxNumRenderTargets && !result; i++) {
result |= omBlendAttachments[i].blendEnable
&& (util::isBlendConstantBlendFactor(omBlendAttachments[i].srcColorBlendFactor)
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].dstColorBlendFactor)
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].srcAlphaBlendFactor)
|| util::isBlendConstantBlendFactor(omBlendAttachments[i].dstAlphaBlendFactor));
}
return result;
}
DxvkBindingMask bsBindingMask;

View File

@ -150,6 +150,14 @@ namespace dxvk::util {
}
bool isBlendConstantBlendFactor(VkBlendFactor factor) {
return factor == VK_BLEND_FACTOR_CONSTANT_COLOR
|| factor == VK_BLEND_FACTOR_CONSTANT_ALPHA
|| factor == VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
|| factor == VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA;
}
bool isDualSourceBlendFactor(VkBlendFactor factor) {
return factor == VK_BLEND_FACTOR_SRC1_COLOR
|| factor == VK_BLEND_FACTOR_SRC1_ALPHA

View File

@ -212,6 +212,9 @@ namespace dxvk::util {
VkComponentSwizzle component,
uint32_t identity);
bool isBlendConstantBlendFactor(
VkBlendFactor factor);
bool isDualSourceBlendFactor(
VkBlendFactor factor);