From ccb16259cbd4d19de409cb4394fad17807c38d5a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 17 May 2023 12:09:05 +1000 Subject: [PATCH] lavapipe: handle some mesh shader stage differences. certain state info is no long required if you using mesh/task in the pipeline. Reviewed-by: Mike Blumenkrantz Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/frontends/lavapipe/lvp_execute.c | 14 ++++++++------ src/gallium/frontends/lavapipe/lvp_pipeline.c | 7 +++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index cf2bcc7..0c2c1ca 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -1024,12 +1024,14 @@ static void handle_graphics_pipeline(struct vk_cmd_queue_entry *cmd, } if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_VI_BINDING_STRIDES)) { - u_foreach_bit(b, ps->vi->bindings_valid) - state->vb[b].stride = ps->vi->bindings[b].stride; - state->vb_dirty = true; + if (ps->vi) { + u_foreach_bit(b, ps->vi->bindings_valid) + state->vb[b].stride = ps->vi->bindings[b].stride; + state->vb_dirty = true; + } } - if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_VI)) { + if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_VI) && ps->vi) { u_foreach_bit(a, ps->vi->attributes_valid) { uint32_t b = ps->vi->attributes[a].binding; state->velem.velems[a].src_offset = ps->vi->attributes[a].offset; @@ -1056,11 +1058,11 @@ static void handle_graphics_pipeline(struct vk_cmd_queue_entry *cmd, state->ve_dirty = true; } - if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_IA_PRIMITIVE_TOPOLOGY)) { + if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_IA_PRIMITIVE_TOPOLOGY) && ps->ia) { state->info.mode = vk_conv_topology(ps->ia->primitive_topology); state->rs_dirty = true; } - if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_IA_PRIMITIVE_RESTART_ENABLE)) + if (!BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_IA_PRIMITIVE_RESTART_ENABLE) && ps->ia) state->info.primitive_restart = ps->ia->primitive_restart_enable; if (ps->ts && !BITSET_TEST(ps->dynamic, MESA_VK_DYNAMIC_TS_PATCH_CONTROL_POINTS)) { diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c index 38126c7..7dd851a 100644 --- a/src/gallium/frontends/lavapipe/lvp_pipeline.c +++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c @@ -860,10 +860,9 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline, if (result != VK_SUCCESS) return result; - assert(pipeline->library || pipeline->stages == (VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT | - VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT | - VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT | - VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT)); + assert(pipeline->library || pipeline->stages & (VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT | + VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT | + VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT)); pipeline->device = device; -- 2.7.4