summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaith Ekstrand <faith.ekstrand@collabora.com>2024-08-26 17:28:44 -0500
committerEric Engestrom <eric@engestrom.ch>2024-08-29 18:42:36 +0200
commitb336bc37e611562eb1a44fdf04c028c7777d4376 (patch)
treecb2e0675467f6cc6feaf819154f08eb71f22d117
parentc3cdff396e4369a31f0c164ed2681ae2b7b78a2a (diff)
vulkan/pipeline: Handle VIEW_INDEX_FROM_DEVICE_INDEX_BIT
The rehash we're doing here is a bit of a hack but it's a back-portable hack. We'll fix it properly in following commits. Fixes: 9308e8d90d26 ("vulkan: Add generic graphics and compute VkPipeline implementations") Reviewed-by: Ivan Briano <ivan.briano@intel.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30876> (cherry picked from commit c0191b20de5f41c0c66ac534d6b735275c4916bb)
-rw-r--r--.pick_status.json2
-rw-r--r--src/vulkan/runtime/vk_pipeline.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index cf5306420b8..86afdd7c7fc 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -234,7 +234,7 @@
"description": "vulkan/pipeline: Handle VIEW_INDEX_FROM_DEVICE_INDEX_BIT",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "9308e8d90d26fca678fe72380d899cdae77415b5",
"notes": null
diff --git a/src/vulkan/runtime/vk_pipeline.c b/src/vulkan/runtime/vk_pipeline.c
index ac08df2be87..4e81df5ffea 100644
--- a/src/vulkan/runtime/vk_pipeline.c
+++ b/src/vulkan/runtime/vk_pipeline.c
@@ -820,6 +820,16 @@ vk_pipeline_precompile_shader(struct vk_device *device,
uint8_t stage_sha1[SHA1_DIGEST_LENGTH];
vk_pipeline_hash_shader_stage(info, &rs, stage_sha1);
+ /* This bit affects shader compilation but isn't taken into account in
+ * vk_pipeline_hash_shader_stage(). Re-hash the SHA1 if it's set.
+ */
+ if (pipeline_flags & VK_PIPELINE_CREATE_2_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR) {
+ struct mesa_sha1 ctx;
+ _mesa_sha1_init(&ctx);
+ _mesa_sha1_update(&ctx, stage_sha1, sizeof(stage_sha1));
+ _mesa_sha1_final(&ctx, stage_sha1);
+ }
+
if (cache != NULL) {
struct vk_pipeline_cache_object *cache_obj =
vk_pipeline_cache_lookup_object(cache, stage_sha1, sizeof(stage_sha1),
@@ -847,6 +857,9 @@ vk_pipeline_precompile_shader(struct vk_device *device,
if (result != VK_SUCCESS)
return result;
+ if (pipeline_flags & VK_PIPELINE_CREATE_2_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR)
+ NIR_PASS(_, nir, nir_lower_view_index_to_device_index);
+
if (ops->preprocess_nir != NULL)
ops->preprocess_nir(device->physical, nir);