1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[dxvk] Add method to swizzle clear color values

This commit is contained in:
Philip Rebohle 2019-05-14 21:21:14 +02:00
parent 3efec8960c
commit 0b61901424
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 19 additions and 0 deletions

View File

@ -150,6 +150,21 @@ namespace dxvk::util {
}
VkClearColorValue swizzleClearColor(
VkClearColorValue color,
VkComponentMapping mapping) {
VkClearColorValue result;
auto swizzles = &mapping.r;
for (uint32_t i = 0; i < 4; i++) {
uint32_t index = getComponentIndex(swizzles[i], i);
result.uint32[i] = color.uint32[index];
}
return result;
}
bool isBlendConstantBlendFactor(VkBlendFactor factor) {
return factor == VK_BLEND_FACTOR_CONSTANT_COLOR
|| factor == VK_BLEND_FACTOR_CONSTANT_ALPHA

View File

@ -223,6 +223,10 @@ namespace dxvk::util {
VkComponentSwizzle component,
uint32_t identity);
VkClearColorValue swizzleClearColor(
VkClearColorValue color,
VkComponentMapping mapping);
bool isBlendConstantBlendFactor(
VkBlendFactor factor);