Mesa (staging/21.3): zink: don't add dynamic vertex pipeline states if no attribs are used
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Oct 27 18:01:35 UTC 2021
Module: Mesa
Branch: staging/21.3
Commit: 249b24815c88d2e1ef6deda16f564a6f772a5b40
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=249b24815c88d2e1ef6deda16f564a6f772a5b40
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Mon Oct 25 14:11:50 2021 -0400
zink: don't add dynamic vertex pipeline states if no attribs are used
adding the states requires that vertex attribs be bound, but it's illegal
to bind 0 attribs
cc: mesa-stable
fixes #5558
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13519>
(cherry picked from commit 90228a80ea2867126cc8a165f61d604803443b5b)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_pipeline.c | 14 ++++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 53d77225a99..cc1b38b9399 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -265,7 +265,7 @@
"description": "zink: don't add dynamic vertex pipeline states if no attribs are used",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/zink/zink_pipeline.c b/src/gallium/drivers/zink/zink_pipeline.c
index b16b64701dc..6a5b583cac7 100644
--- a/src/gallium/drivers/zink/zink_pipeline.c
+++ b/src/gallium/drivers/zink/zink_pipeline.c
@@ -53,7 +53,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
{
struct zink_rasterizer_hw_state *hw_rast_state = (void*)state;
VkPipelineVertexInputStateCreateInfo vertex_input_state;
- if (!screen->info.have_EXT_vertex_input_dynamic_state) {
+ if (!screen->info.have_EXT_vertex_input_dynamic_state || !state->element_state->num_attribs) {
memset(&vertex_input_state, 0, sizeof(vertex_input_state));
vertex_input_state.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
vertex_input_state.pVertexBindingDescriptions = state->element_state->b.bindings;
@@ -201,10 +201,12 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VIEWPORT;
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_SCISSOR;
}
- if (screen->info.have_EXT_vertex_input_dynamic_state)
- dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_EXT;
- else if (screen->info.have_EXT_extended_dynamic_state)
- dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT;
+ if (state->element_state->num_attribs) {
+ if (screen->info.have_EXT_vertex_input_dynamic_state)
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_EXT;
+ else if (screen->info.have_EXT_extended_dynamic_state)
+ dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT;
+ }
if (screen->info.have_EXT_extended_dynamic_state2)
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT;
@@ -231,7 +233,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
pci.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
pci.layout = prog->base.layout;
pci.renderPass = state->render_pass->render_pass;
- if (!screen->info.have_EXT_vertex_input_dynamic_state)
+ if (!screen->info.have_EXT_vertex_input_dynamic_state || !state->element_state->num_attribs)
pci.pVertexInputState = &vertex_input_state;
pci.pInputAssemblyState = &primitive_state;
pci.pRasterizationState = &rast_state;
More information about the mesa-commit
mailing list