radv: rely on non-NULL binaries when inserting shaders to the cache
With GPL, a stage can be imported from a library which means that the binary is NULL (it's freed right after compilation) but the shader is non-NULL. To avoid crashing, rely on non-NULL binaries because this implies that the shader is non-NULL as well. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22264>
This commit is contained in:
committed by
Marge Bot
parent
1239fcab4d
commit
ba967e1a28
@@ -482,7 +482,7 @@ radv_pipeline_cache_insert_shaders(struct radv_device *device, struct radv_pipel
|
||||
|
||||
size_t size = sizeof(*entry) + sizeof(struct radv_pipeline_shader_stack_size) * num_rt_groups;
|
||||
for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; ++i)
|
||||
if (pipeline->shaders[i])
|
||||
if (binaries[i])
|
||||
size += binaries[i]->total_size;
|
||||
if (ps_epilog_binary)
|
||||
size += ps_epilog_binary->total_size;
|
||||
@@ -501,7 +501,7 @@ radv_pipeline_cache_insert_shaders(struct radv_device *device, struct radv_pipel
|
||||
char *p = entry->code;
|
||||
|
||||
for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; ++i) {
|
||||
if (!pipeline->shaders[i])
|
||||
if (!binaries[i])
|
||||
continue;
|
||||
|
||||
entry->binary_sizes[i] = binaries[i]->total_size;
|
||||
@@ -551,8 +551,9 @@ radv_pipeline_cache_insert_shaders(struct radv_device *device, struct radv_pipel
|
||||
* items.
|
||||
*/
|
||||
for (int i = 0; i < MESA_VULKAN_SHADER_STAGES; ++i) {
|
||||
if (!pipeline->shaders[i])
|
||||
if (!binaries[i])
|
||||
continue;
|
||||
assert(pipeline->shaders[i]);
|
||||
|
||||
entry->shaders[i] = pipeline->shaders[i];
|
||||
radv_shader_ref(pipeline->shaders[i]);
|
||||
|
||||
Reference in New Issue
Block a user