From 06fa2928b8953e2f6163178c19b9974464c547b2 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Mon, 17 Feb 2020 16:07:32 +0100 Subject: v3dv: add an assert to catch applications trying to clear invalid aspects I accidentally tried to clear D+S of a depth-only image which was not caught by the validation layers in my environment. This made the simulator crash, but tracking down the crash to the actual error was not trivial. This should make it immediately obvious. Part-of: --- src/broadcom/vulkan/v3dv_meta_copy.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/broadcom/vulkan/v3dv_meta_copy.c b/src/broadcom/vulkan/v3dv_meta_copy.c index 2fd1ffb1db3..f5e734269ba 100644 --- a/src/broadcom/vulkan/v3dv_meta_copy.c +++ b/src/broadcom/vulkan/v3dv_meta_copy.c @@ -935,6 +935,11 @@ clear_image_tlb(struct v3dv_cmd_buffer *cmd_buffer, v3dv_cmd_buffer_start_frame(cmd_buffer, &framebuffer.fb); v3dv_job_emit_binning_flush(job); + /* If this triggers it is an application bug: the spec requires + * that any aspects to clear are present in the image. + */ + assert(range->aspectMask & image->aspects); + emit_clear_image_rcl(job, image, &framebuffer, &hw_clear_value, range->aspectMask, layer, level); -- cgit v1.2.3