Mesa (main): venus: Don't encode ignored pTessellationState
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue May 17 19:54:08 UTC 2022
Module: Mesa
Branch: main
Commit: fe3e850dfb2176e41ea6413b6739ae12cc4d32f7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe3e850dfb2176e41ea6413b6739ae12cc4d32f7
Author: Chad Versace <chad at kiwitree.net>
Date: Mon May 2 12:56:24 2022 -0700
venus: Don't encode ignored pTessellationState
The spec says that VkGraphicsPipelineCreateInfo::pTessellationState is
ignored and may be an invalid pointer in some cases. When ignored,
patch the pCreateInfo with `pTessellationState = NULL`, so the encoder
doesn't attempt to encode an invalid pointer.
Tested in Borealis, with debug build of venus, with a minimal test app
that sets `.pTesselationState = 0x17`. Pre-patch, the app crashes;
post-patch, the app works.
Signed-off-by: Chad Versace <chadversary at chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16284>
---
src/virtio/vulkan/vn_pipeline.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/virtio/vulkan/vn_pipeline.c b/src/virtio/vulkan/vn_pipeline.c
index dbab41c7272..a5b45ce5504 100644
--- a/src/virtio/vulkan/vn_pipeline.c
+++ b/src/virtio/vulkan/vn_pipeline.c
@@ -242,6 +242,8 @@ vn_MergePipelineCaches(VkDevice device,
/* pipeline commands */
struct vn_graphics_pipeline_create_info_fix {
+ bool ignore_tessellation_state;
+
/* Ignore the following:
* pViewportState
* pMultisampleState
@@ -269,6 +271,21 @@ vn_fix_graphics_pipeline_create_info(
struct vn_graphics_pipeline_create_info_fix fix = { 0 };
bool any_fix = false;
+ VkShaderStageFlags stages = 0;
+ for (uint32_t i = 0; i < info->stageCount; ++i) {
+ stages |= info->pStages[i].stage;
+ }
+
+ /* Fix pTessellationState?
+ * VUID-VkGraphicsPipelineCreateInfo-pStages-00731
+ */
+ if (info->pTessellationState &&
+ (!(stages & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT) ||
+ !(stages & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT))) {
+ fix.ignore_tessellation_state = true;
+ any_fix = true;
+ }
+
/* FIXME: Conditions for ignoring pDepthStencilState and
* pColorBlendState miss some cases that depend on the render pass. Make
* them agree with the VUIDs.
@@ -311,6 +328,9 @@ vn_fix_graphics_pipeline_create_info(
VkGraphicsPipelineCreateInfo *info = &infos[i];
struct vn_graphics_pipeline_create_info_fix fix = fixes[i];
+ if (fix.ignore_tessellation_state)
+ info->pTessellationState = NULL;
+
if (fix.ignore_raster_dedicated_states) {
info->pViewportState = NULL;
info->pMultisampleState = NULL;
More information about the mesa-commit
mailing list