add blend info to gfx pipeline struct & add info messages for debug printf
This commit is contained in:
parent
a97a1d4d16
commit
09cfc2ce80
66
vulkan.d
66
vulkan.d
@ -242,6 +242,42 @@ enum PipelineType : int
|
||||
|
||||
alias PT = PipelineType;
|
||||
|
||||
enum BlendFactor : VkBlendFactor
|
||||
{
|
||||
Zero = VK_BLEND_FACTOR_ZERO,
|
||||
One = VK_BLEND_FACTOR_ONE,
|
||||
SrcColor = VK_BLEND_FACTOR_SRC_COLOR,
|
||||
OneMinusSrcColor = VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR,
|
||||
DstColor = VK_BLEND_FACTOR_DST_COLOR,
|
||||
OneMinusDstColor = VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR,
|
||||
SrcAlpha = VK_BLEND_FACTOR_SRC_ALPHA,
|
||||
OneMinusSrcAlpha = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
|
||||
DstAlpha = VK_BLEND_FACTOR_DST_ALPHA,
|
||||
OneMinusDstAlpha = VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA,
|
||||
ConstColor = VK_BLEND_FACTOR_CONSTANT_COLOR,
|
||||
OneMinusConstColor = VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
|
||||
ConstAlpha = VK_BLEND_FACTOR_CONSTANT_ALPHA,
|
||||
OneMinusConstAlpha = VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA,
|
||||
SrcAlphaSaturate = VK_BLEND_FACTOR_SRC_ALPHA_SATURATE,
|
||||
Src1Color = VK_BLEND_FACTOR_SRC1_COLOR,
|
||||
OneMinusSrc1Color = VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR,
|
||||
Src1Alpha = VK_BLEND_FACTOR_SRC1_ALPHA,
|
||||
OneMinusSrc1Alpha = VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA,
|
||||
}
|
||||
|
||||
alias BF = BlendFactor;
|
||||
|
||||
enum BlendOp : VkBlendOp
|
||||
{
|
||||
Add = VK_BLEND_OP_ADD,
|
||||
Sub = VK_BLEND_OP_SUBTRACT,
|
||||
ReverseSub = VK_BLEND_OP_REVERSE_SUBTRACT,
|
||||
Min = VK_BLEND_OP_MIN,
|
||||
Max = VK_BLEND_OP_MAX,
|
||||
}
|
||||
|
||||
alias BO = BlendOp;
|
||||
|
||||
struct Specialization
|
||||
{
|
||||
u64 size;
|
||||
@ -261,6 +297,12 @@ struct GfxPipelineInfo
|
||||
bool self_dependency;
|
||||
PipelineLayout layout;
|
||||
FrontFace front_face;
|
||||
VkBlendFactor src_color;
|
||||
VkBlendFactor dst_color;
|
||||
VkBlendOp color_op;
|
||||
VkBlendFactor src_alpha;
|
||||
VkBlendFactor dst_alpha;
|
||||
VkBlendOp alpha_op;
|
||||
}
|
||||
|
||||
struct CompPipelineInfo
|
||||
@ -1765,12 +1807,12 @@ CreateGraphicsPipeline(Vulkan* vk, Pipeline* pipeline_handle, GfxPipelineInfo* b
|
||||
VkPipelineColorBlendAttachmentState blend_state = {
|
||||
colorWriteMask: VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT,
|
||||
blendEnable: VK_TRUE,
|
||||
srcColorBlendFactor: VK_BLEND_FACTOR_SRC_ALPHA,
|
||||
dstColorBlendFactor: VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
|
||||
colorBlendOp: VK_BLEND_OP_ADD,
|
||||
srcAlphaBlendFactor: VK_BLEND_FACTOR_SRC_ALPHA,
|
||||
dstAlphaBlendFactor: VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
|
||||
alphaBlendOp: VK_BLEND_OP_ADD,
|
||||
srcColorBlendFactor: build_info.src_color,
|
||||
dstColorBlendFactor: build_info.dst_color,
|
||||
colorBlendOp: build_info.color_op,
|
||||
srcAlphaBlendFactor: build_info.src_alpha,
|
||||
dstAlphaBlendFactor: build_info.dst_alpha,
|
||||
alphaBlendOp: build_info.alpha_op,
|
||||
};
|
||||
|
||||
VkPipelineColorBlendStateCreateInfo blend_info = {
|
||||
@ -3293,10 +3335,16 @@ EnableVLayers(Vulkan* vk)
|
||||
|
||||
if (g_VLAYER_SUPPORT)
|
||||
{
|
||||
VkDebugUtilsMessageSeverityFlagBitsEXT severity_flags = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
|
||||
VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
|
||||
if (g_DEBUG_PRINTF)
|
||||
{
|
||||
severity_flags |= VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT;
|
||||
}
|
||||
|
||||
VkDebugUtilsMessengerCreateInfoEXT info = {
|
||||
sType: VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
|
||||
messageSeverity: VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
|
||||
VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT,
|
||||
messageSeverity: severity_flags,
|
||||
messageType: VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
|
||||
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
|
||||
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT,
|
||||
@ -3340,4 +3388,4 @@ PrintShaderDisassembly(Vulkan* vk, Pipeline pipeline_id, VkShaderStageFlagBits s
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user