lavapipe: don't access pColorBlendState when not legal

This state isn't valid unless some conditions are met.

Fixes VK-GL-CTS
dEQP-VK.api.pipeline.pipeline_invalid_pointers_unused_structs.graphics

Fixes: 578190c0fe ("lavapipe: implement VK_EXT_color_write_enable")

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12984>
This commit is contained in:
Dave Airlie 2021-09-23 12:48:57 +10:00 committed by Marge Bot
parent 6413b2b6a2
commit b7bfba5983

View file

@ -833,7 +833,11 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
} else
pipeline->line_rectangular = true;
if (!dynamic_state_contains(pipeline->graphics_create_info.pDynamicState, VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT)) {
bool rasterization_disabled = !dynamic_state_contains(pipeline->graphics_create_info.pDynamicState, VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT) &&
pipeline->graphics_create_info.pRasterizationState->rasterizerDiscardEnable;
LVP_FROM_HANDLE(lvp_render_pass, pass, pipeline->graphics_create_info.renderPass);
if (!dynamic_state_contains(pipeline->graphics_create_info.pDynamicState, VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT) &&
!rasterization_disabled && pass->has_color_attachment) {
const VkPipelineColorWriteCreateInfoEXT *cw_state =
vk_find_struct_const(pCreateInfo->pColorBlendState, PIPELINE_COLOR_WRITE_CREATE_INFO_EXT);
if (cw_state) {