From: Samuel Pitoiset Date: Thu, 9 Jul 2020 09:05:54 +0000 (+0200) Subject: radv: add radv_pipeline_init_input_assembly_state() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=749d513467560e2dd2e153abb2db125bc4942059;p=mesa.git radv: add radv_pipeline_init_input_assembly_state() Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index 6d17fdbb238..9e43e73d10b 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -1335,6 +1335,31 @@ static uint32_t radv_pipeline_needed_dynamic_state(const VkGraphicsPipelineCreat return states; } +static void +radv_pipeline_init_input_assembly_state(struct radv_pipeline *pipeline, + const VkGraphicsPipelineCreateInfo *pCreateInfo, + const struct radv_graphics_pipeline_create_info *extra) +{ + const VkPipelineInputAssemblyStateCreateInfo *ia_state = pCreateInfo->pInputAssemblyState; + struct radv_shader_variant *tes = pipeline->shaders[MESA_SHADER_TESS_EVAL]; + struct radv_shader_variant *gs = pipeline->shaders[MESA_SHADER_GEOMETRY]; + + pipeline->graphics.prim_restart_enable = !!ia_state->primitiveRestartEnable; + pipeline->graphics.can_use_guardband = radv_prim_can_use_guardband(ia_state->topology); + + if (radv_pipeline_has_gs(pipeline)) { + if (si_conv_gl_prim_to_gs_out(gs->info.gs.output_prim) == V_028A6C_OUTPRIM_TYPE_TRISTRIP) + pipeline->graphics.can_use_guardband = true; + } else if (radv_pipeline_has_tess(pipeline)) { + if (!tes->info.tes.point_mode && + si_conv_gl_prim_to_gs_out(tes->info.tes.primitive_mode) == V_028A6C_OUTPRIM_TYPE_TRISTRIP) + pipeline->graphics.can_use_guardband = true; + } + + if (extra && extra->use_rectlist) { + pipeline->graphics.can_use_guardband = true; + } +} static void radv_pipeline_init_dynamic_state(struct radv_pipeline *pipeline, @@ -4780,28 +4805,23 @@ radv_pipeline_init(struct radv_pipeline *pipeline, radv_pipeline_init_multisample_state(pipeline, &blend, pCreateInfo); uint32_t gs_out; - pipeline->graphics.can_use_guardband = radv_prim_can_use_guardband(pCreateInfo->pInputAssemblyState->topology); - if (radv_pipeline_has_gs(pipeline)) { gs_out = si_conv_gl_prim_to_gs_out(pipeline->shaders[MESA_SHADER_GEOMETRY]->info.gs.output_prim); - pipeline->graphics.can_use_guardband = gs_out == V_028A6C_OUTPRIM_TYPE_TRISTRIP; } else if (radv_pipeline_has_tess(pipeline)) { if (pipeline->shaders[MESA_SHADER_TESS_EVAL]->info.tes.point_mode) gs_out = V_028A6C_OUTPRIM_TYPE_POINTLIST; else gs_out = si_conv_gl_prim_to_gs_out(pipeline->shaders[MESA_SHADER_TESS_EVAL]->info.tes.primitive_mode); - pipeline->graphics.can_use_guardband = gs_out == V_028A6C_OUTPRIM_TYPE_TRISTRIP; } else { gs_out = si_conv_prim_to_gs_out(pCreateInfo->pInputAssemblyState->topology); } if (extra && extra->use_rectlist) { gs_out = V_028A6C_OUTPRIM_TYPE_TRISTRIP; - pipeline->graphics.can_use_guardband = true; if (radv_pipeline_has_ngg(pipeline)) gs_out = V_028A6C_VGT_OUT_RECT_V0; } - pipeline->graphics.prim_restart_enable = !!pCreateInfo->pInputAssemblyState->primitiveRestartEnable; + radv_pipeline_init_input_assembly_state(pipeline, pCreateInfo, extra); radv_pipeline_init_dynamic_state(pipeline, pCreateInfo, extra); /* Ensure that some export memory is always allocated, for two reasons: