2 #include "blend_backend.h"
10 unsigned get_vulkan_blend_equation(BlendEquation eq)
14 case ADD: return VK_BLEND_OP_ADD;
15 case SUBTRACT: return VK_BLEND_OP_SUBTRACT;
16 case REVERSE_SUBTRACT: return VK_BLEND_OP_REVERSE_SUBTRACT;
17 case MIN: return VK_BLEND_OP_MIN;
18 case MAX: return VK_BLEND_OP_MAX;
19 default: throw invalid_argument("get_vulkan_blend_equation");
23 unsigned get_vulkan_blend_factor(BlendFactor factor)
27 case ZERO: return VK_BLEND_FACTOR_ZERO;
28 case ONE: return VK_BLEND_FACTOR_ONE;
29 case SRC_COLOR: return VK_BLEND_FACTOR_SRC_COLOR;
30 case ONE_MINUS_SRC_COLOR: return VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR;
31 case SRC_ALPHA: return VK_BLEND_FACTOR_SRC_ALPHA;
32 case ONE_MINUS_SRC_ALPHA: return VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
33 case DST_COLOR: return VK_BLEND_FACTOR_DST_COLOR;
34 case ONE_MINUS_DST_COLOR: return VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR;
35 case DST_ALPHA: return VK_BLEND_FACTOR_DST_ALPHA;
36 case ONE_MINUS_DST_ALPHA: return VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA;
37 case CONSTANT_COLOR: return VK_BLEND_FACTOR_CONSTANT_COLOR;
38 case ONE_MINUS_CONSTANT_COLOR: return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
39 case CONSTANT_ALPHA: return VK_BLEND_FACTOR_CONSTANT_ALPHA;
40 case ONE_MINUS_CONSTANT_ALPHA: return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA;
41 default: throw invalid_argument("get_vulkan_blend_factor");
45 unsigned get_vulkan_color_mask(ColorWriteMask mask)
49 result |= VK_COLOR_COMPONENT_R_BIT;
51 result |= VK_COLOR_COMPONENT_G_BIT;
53 result |= VK_COLOR_COMPONENT_B_BIT;
55 result |= VK_COLOR_COMPONENT_A_BIT;