nv2a/vk: Drop fragment shader when only depth attachment is cleared

This commit is contained in:
Matt Borgerson 2024-07-26 17:21:01 -07:00 committed by mborgerson
parent 126a51724b
commit b0e3d00a5d
1 changed files with 14 additions and 10 deletions
hw/xbox/nv2a/pgraph/vk

View File

@ -448,20 +448,24 @@ static void create_clear_pipeline(PGRAPHState *pg)
bool partial_color_clear =
clear_any_color_channels && !clear_all_color_channels;
VkPipelineShaderStageCreateInfo shader_stages[] = {
int num_active_shader_stages = 0;
VkPipelineShaderStageCreateInfo shader_stages[2];
shader_stages[num_active_shader_stages++] =
(VkPipelineShaderStageCreateInfo){
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
.stage = VK_SHADER_STAGE_VERTEX_BIT,
.module = r->quad_vert_module->module,
.pName = "main",
},
(VkPipelineShaderStageCreateInfo){
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
.stage = VK_SHADER_STAGE_FRAGMENT_BIT,
.module = r->solid_frag_module->module,
.pName = "main",
},
};
};
if (clear_any_color_channels) {
shader_stages[num_active_shader_stages++] =
(VkPipelineShaderStageCreateInfo){
.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,
.stage = VK_SHADER_STAGE_FRAGMENT_BIT,
.module = r->solid_frag_module->module,
.pName = "main",
};
}
VkPipelineVertexInputStateCreateInfo vertex_input = {
.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
@ -565,7 +569,7 @@ static void create_clear_pipeline(PGRAPHState *pg)
VkGraphicsPipelineCreateInfo pipeline_info = {
.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,
.stageCount = ARRAY_SIZE(shader_stages),
.stageCount = num_active_shader_stages,
.pStages = shader_stages,
.pVertexInputState = &vertex_input,
.pInputAssemblyState = &input_assembly,