panvk: Handle empty shaders gracefully

Fixes dEQP-VK.spirv_assembly.instruction.compute.shader_default_output.int.uninitialized

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16123>
This commit is contained in:
Alyssa Rosenzweig 2022-04-23 18:55:00 -04:00 committed by Marge Bot
parent c9b33fe7dc
commit 179d9e3511
2 changed files with 14 additions and 2 deletions

View file

@ -24,5 +24,6 @@ include = [
"dEQP-VK.pipeline.input_assembly.*",
"dEQP-VK.pipeline.sampler.view_type.*.format.r*.address_modes.all_mode_clamp_to_border*",
"dEQP-VK.spirv_assembly.instruction.compute.opquantize.*",
"dEQP-VK.spirv_assembly.instruction.compute.shader_default_output.*",
"dEQP-VK.ssbo.layout.single_basic_type.*",
]

View file

@ -162,6 +162,12 @@ static VkResult
panvk_pipeline_builder_upload_shaders(struct panvk_pipeline_builder *builder,
struct panvk_pipeline *pipeline)
{
/* In some cases, the optimized shader is empty. Don't bother allocating
* anything in this case.
*/
if (builder->shader_total_size == 0)
return VK_SUCCESS;
struct panfrost_bo *bin_bo =
panfrost_bo_create(&builder->device->physical_device->pdev,
builder->shader_total_size, PAN_BO_EXECUTE,
@ -335,8 +341,13 @@ panvk_pipeline_builder_init_shaders(struct panvk_pipeline_builder *builder,
if (i == MESA_SHADER_VERTEX && shader->info.vs.writes_point_size)
pipeline->ia.writes_point_size = true;
mali_ptr shader_ptr = pipeline->binary_bo->ptr.gpu +
builder->stages[i].shader_offset;
mali_ptr shader_ptr = 0;
/* Handle empty shaders gracefully */
if (util_dynarray_num_elements(&builder->shaders[i]->binary, uint8_t)) {
shader_ptr = pipeline->binary_bo->ptr.gpu +
builder->stages[i].shader_offset;
}
void *rsd = pipeline->state_bo->ptr.cpu + builder->stages[i].rsd_offset;
mali_ptr gpu_rsd = pipeline->state_bo->ptr.gpu + builder->stages[i].rsd_offset;