mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
vulkan/pipeline: Always init pipeline cache objects
vk_shader_init_cache_obj() is fast enough and the already-found case is
rare enough that there's no good reason to avoid the init. This allows
us to use vk_shader_unref instead of vk_shader_destroy which is probably
a touch safer over-all. It also fixes the assert that the two shaders
have matching keys.
Fixes: bb8b11d806 ("vulkan/pipeline: Handle fully compiled library shaders properly")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10752
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27993>
This commit is contained in:
parent
def0c275c4
commit
d1cf01dc52
1 changed files with 6 additions and 5 deletions
|
|
@ -1375,11 +1375,11 @@ vk_graphics_pipeline_compile_shaders(struct vk_device *device,
|
|||
for (uint32_t i = partition[p]; i < partition[p + 1]; i++) {
|
||||
struct vk_pipeline_stage *stage = &stages[i];
|
||||
|
||||
if (stage->shader == NULL) {
|
||||
shader_key.stage = stage->stage;
|
||||
vk_shader_init_cache_obj(device, shaders[i], &shader_key,
|
||||
sizeof(shader_key));
|
||||
shader_key.stage = stage->stage;
|
||||
vk_shader_init_cache_obj(device, shaders[i], &shader_key,
|
||||
sizeof(shader_key));
|
||||
|
||||
if (stage->shader == NULL) {
|
||||
struct vk_pipeline_cache_object *cache_obj =
|
||||
&shaders[i]->pipeline.cache_obj;
|
||||
if (cache != NULL)
|
||||
|
|
@ -1395,7 +1395,8 @@ vk_graphics_pipeline_compile_shaders(struct vk_device *device,
|
|||
assert(memcmp(&stage->shader->pipeline.cache_key,
|
||||
&shaders[i]->pipeline.cache_key,
|
||||
sizeof(shaders[i]->pipeline.cache_key)) == 0);
|
||||
vk_shader_destroy(device, shaders[i], &device->alloc);
|
||||
|
||||
vk_shader_unref(device, shaders[i]);
|
||||
}
|
||||
|
||||
stage_feedbacks[stage->stage].duration += part_end - part_start;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue