move color blend state to AttachmentInfo

updatetemplate
cosmonaut 2022-02-25 17:37:42 -08:00
parent a38a9d461d
commit a26d3e3689
2 changed files with 20 additions and 19 deletions

View File

@ -447,7 +447,7 @@ typedef struct Refresh_StencilOpState
uint32_t reference; uint32_t reference;
} Refresh_StencilOpState; } Refresh_StencilOpState;
typedef struct Refresh_ColorTargetBlendState typedef struct Refresh_ColorAttachmentBlendState
{ {
uint8_t blendEnable; uint8_t blendEnable;
Refresh_BlendFactor srcColorBlendFactor; Refresh_BlendFactor srcColorBlendFactor;
@ -457,7 +457,7 @@ typedef struct Refresh_ColorTargetBlendState
Refresh_BlendFactor dstAlphaBlendFactor; Refresh_BlendFactor dstAlphaBlendFactor;
Refresh_BlendOp alphaBlendOp; Refresh_BlendOp alphaBlendOp;
Refresh_ColorComponentFlags colorWriteMask; Refresh_ColorComponentFlags colorWriteMask;
} Refresh_ColorTargetBlendState; } Refresh_ColorAttachmentBlendState;
typedef struct Refresh_ComputePipelineLayoutCreateInfo typedef struct Refresh_ComputePipelineLayoutCreateInfo
{ {
@ -538,14 +538,12 @@ typedef struct Refresh_DepthStencilState
float maxDepthBounds; float maxDepthBounds;
} Refresh_DepthStencilState; } Refresh_DepthStencilState;
typedef struct Refresh_ColorBlendState typedef struct Refresh_PipelineColorBlendState
{ {
uint8_t logicOpEnable; uint8_t logicOpEnable;
Refresh_LogicOp logicOp; Refresh_LogicOp logicOp;
const Refresh_ColorTargetBlendState *blendStates;
uint32_t blendStateCount;
float blendConstants[4]; float blendConstants[4];
} Refresh_ColorBlendState; } Refresh_PipelineColorBlendState;
typedef struct Refresh_ComputePipelineCreateInfo typedef struct Refresh_ComputePipelineCreateInfo
{ {
@ -557,11 +555,12 @@ typedef struct Refresh_ColorAttachmentDescription
{ {
Refresh_TextureFormat format; Refresh_TextureFormat format;
Refresh_SampleCount sampleCount; Refresh_SampleCount sampleCount;
Refresh_ColorAttachmentBlendState blendState;
} Refresh_ColorAttachmentDescription; } Refresh_ColorAttachmentDescription;
typedef struct Refresh_GraphicsPipelineAttachmentInfo typedef struct Refresh_GraphicsPipelineAttachmentInfo
{ {
const Refresh_ColorAttachmentDescription *colorAttachmentDescriptions; Refresh_ColorAttachmentDescription *colorAttachmentDescriptions;
uint32_t colorAttachmentCount; uint32_t colorAttachmentCount;
uint8_t hasDepthStencilAttachment; uint8_t hasDepthStencilAttachment;
Refresh_TextureFormat depthStencilFormat; Refresh_TextureFormat depthStencilFormat;
@ -577,7 +576,7 @@ typedef struct Refresh_GraphicsPipelineCreateInfo
Refresh_RasterizerState rasterizerState; Refresh_RasterizerState rasterizerState;
Refresh_MultisampleState multisampleState; Refresh_MultisampleState multisampleState;
Refresh_DepthStencilState depthStencilState; Refresh_DepthStencilState depthStencilState;
Refresh_ColorBlendState colorBlendState; Refresh_PipelineColorBlendState colorBlendState;
Refresh_GraphicsPipelineLayoutCreateInfo pipelineLayoutCreateInfo; Refresh_GraphicsPipelineLayoutCreateInfo pipelineLayoutCreateInfo;
Refresh_GraphicsPipelineAttachmentInfo attachmentInfo; Refresh_GraphicsPipelineAttachmentInfo attachmentInfo;
} Refresh_GraphicsPipelineCreateInfo; } Refresh_GraphicsPipelineCreateInfo;

View File

@ -5127,7 +5127,7 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
VkPipelineColorBlendStateCreateInfo colorBlendStateCreateInfo; VkPipelineColorBlendStateCreateInfo colorBlendStateCreateInfo;
VkPipelineColorBlendAttachmentState *colorBlendAttachmentStates = SDL_stack_alloc( VkPipelineColorBlendAttachmentState *colorBlendAttachmentStates = SDL_stack_alloc(
VkPipelineColorBlendAttachmentState, VkPipelineColorBlendAttachmentState,
pipelineCreateInfo->colorBlendState.blendStateCount pipelineCreateInfo->attachmentInfo.colorAttachmentCount
); );
VulkanRenderer *renderer = (VulkanRenderer*) driverData; VulkanRenderer *renderer = (VulkanRenderer*) driverData;
@ -5344,30 +5344,32 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
/* Color Blend */ /* Color Blend */
for (i = 0; i < pipelineCreateInfo->colorBlendState.blendStateCount; i += 1) for (i = 0; i < pipelineCreateInfo->attachmentInfo.colorAttachmentCount; i += 1)
{ {
Refresh_ColorAttachmentBlendState blendState = pipelineCreateInfo->attachmentInfo.colorAttachmentDescriptions[i].blendState;
colorBlendAttachmentStates[i].blendEnable = colorBlendAttachmentStates[i].blendEnable =
pipelineCreateInfo->colorBlendState.blendStates[i].blendEnable; blendState.blendEnable;
colorBlendAttachmentStates[i].srcColorBlendFactor = RefreshToVK_BlendFactor[ colorBlendAttachmentStates[i].srcColorBlendFactor = RefreshToVK_BlendFactor[
pipelineCreateInfo->colorBlendState.blendStates[i].srcColorBlendFactor blendState.srcColorBlendFactor
]; ];
colorBlendAttachmentStates[i].dstColorBlendFactor = RefreshToVK_BlendFactor[ colorBlendAttachmentStates[i].dstColorBlendFactor = RefreshToVK_BlendFactor[
pipelineCreateInfo->colorBlendState.blendStates[i].dstColorBlendFactor blendState.dstColorBlendFactor
]; ];
colorBlendAttachmentStates[i].colorBlendOp = RefreshToVK_BlendOp[ colorBlendAttachmentStates[i].colorBlendOp = RefreshToVK_BlendOp[
pipelineCreateInfo->colorBlendState.blendStates[i].colorBlendOp blendState.colorBlendOp
]; ];
colorBlendAttachmentStates[i].srcAlphaBlendFactor = RefreshToVK_BlendFactor[ colorBlendAttachmentStates[i].srcAlphaBlendFactor = RefreshToVK_BlendFactor[
pipelineCreateInfo->colorBlendState.blendStates[i].srcAlphaBlendFactor blendState.srcAlphaBlendFactor
]; ];
colorBlendAttachmentStates[i].dstAlphaBlendFactor = RefreshToVK_BlendFactor[ colorBlendAttachmentStates[i].dstAlphaBlendFactor = RefreshToVK_BlendFactor[
pipelineCreateInfo->colorBlendState.blendStates[i].dstAlphaBlendFactor blendState.dstAlphaBlendFactor
]; ];
colorBlendAttachmentStates[i].alphaBlendOp = RefreshToVK_BlendOp[ colorBlendAttachmentStates[i].alphaBlendOp = RefreshToVK_BlendOp[
pipelineCreateInfo->colorBlendState.blendStates[i].alphaBlendOp blendState.alphaBlendOp
]; ];
colorBlendAttachmentStates[i].colorWriteMask = colorBlendAttachmentStates[i].colorWriteMask =
pipelineCreateInfo->colorBlendState.blendStates[i].colorWriteMask; blendState.colorWriteMask;
} }
colorBlendStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; colorBlendStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
@ -5379,7 +5381,7 @@ static Refresh_GraphicsPipeline* VULKAN_CreateGraphicsPipeline(
pipelineCreateInfo->colorBlendState.logicOp pipelineCreateInfo->colorBlendState.logicOp
]; ];
colorBlendStateCreateInfo.attachmentCount = colorBlendStateCreateInfo.attachmentCount =
pipelineCreateInfo->colorBlendState.blendStateCount; pipelineCreateInfo->attachmentInfo.colorAttachmentCount;
colorBlendStateCreateInfo.pAttachments = colorBlendStateCreateInfo.pAttachments =
colorBlendAttachmentStates; colorBlendAttachmentStates;
colorBlendStateCreateInfo.blendConstants[0] = colorBlendStateCreateInfo.blendConstants[0] =