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>
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;
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;
* 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]);