X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fintel%2Fvulkan%2Fanv_dump.c;h=f3447f43b2190af65616cfaec9b69abe8b3baa8c;hb=c9bebae2877e55cdcd94f9f9f3f6805238caeb28;hp=0a359a0015f4425d928cd8bd64e414b485d4c5ca;hpb=4c9dec80edeb7f1d1774ca51faa806241c1c59cb;p=mesa.git diff --git a/src/intel/vulkan/anv_dump.c b/src/intel/vulkan/anv_dump.c index 0a359a0015f..f3447f43b21 100644 --- a/src/intel/vulkan/anv_dump.c +++ b/src/intel/vulkan/anv_dump.c @@ -62,7 +62,7 @@ dump_image_init(struct anv_device *device, struct dump_image *image, uint32_t width, uint32_t height, const char *filename) { VkDevice vk_device = anv_device_to_handle(device); - MAYBE_UNUSED VkResult result; + ASSERTED VkResult result; image->filename = filename; image->extent = (VkExtent2D) { width, height }; @@ -200,7 +200,7 @@ static void dump_image_write_to_ppm(struct anv_device *device, struct dump_image *image) { VkDevice vk_device = anv_device_to_handle(device); - MAYBE_UNUSED VkResult result; + ASSERTED VkResult result; VkMemoryRequirements reqs; anv_GetImageMemoryRequirements(vk_device, image->image, &reqs); @@ -249,7 +249,14 @@ anv_dump_image_to_ppm(struct anv_device *device, const char *filename) { VkDevice vk_device = anv_device_to_handle(device); - MAYBE_UNUSED VkResult result; + ASSERTED VkResult result; + + PFN_vkBeginCommandBuffer BeginCommandBuffer = + (void *)anv_GetDeviceProcAddr(anv_device_to_handle(device), + "vkBeginCommandBuffer"); + PFN_vkEndCommandBuffer EndCommandBuffer = + (void *)anv_GetDeviceProcAddr(anv_device_to_handle(device), + "vkEndCommandBuffer"); const uint32_t width = anv_minify(image->extent.width, miplevel); const uint32_t height = anv_minify(image->extent.height, miplevel); @@ -276,7 +283,7 @@ anv_dump_image_to_ppm(struct anv_device *device, }, &cmd); assert(result == VK_SUCCESS); - result = anv_BeginCommandBuffer(cmd, + result = BeginCommandBuffer(cmd, &(VkCommandBufferBeginInfo) { .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, .flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT, @@ -286,7 +293,7 @@ anv_dump_image_to_ppm(struct anv_device *device, dump_image_do_blit(device, &dump, anv_cmd_buffer_from_handle(cmd), image, aspect, miplevel, array_layer); - result = anv_EndCommandBuffer(cmd); + result = EndCommandBuffer(cmd); assert(result == VK_SUCCESS); VkFence fence; @@ -403,34 +410,38 @@ dump_add_image(struct anv_cmd_buffer *cmd_buffer, struct anv_image *image, } void -anv_dump_add_framebuffer(struct anv_cmd_buffer *cmd_buffer, - struct anv_framebuffer *fb) +anv_dump_add_attachments(struct anv_cmd_buffer *cmd_buffer) { if (!dump_lock(ANV_DUMP_FRAMEBUFFERS_BIT)) return; unsigned dump_idx = dump_count++; - for (unsigned i = 0; i < fb->attachment_count; i++) { - struct anv_image_view *iview = fb->attachments[i]; + for (unsigned i = 0; i < cmd_buffer->state.pass->attachment_count; i++) { + struct anv_image_view *iview = cmd_buffer->state.attachments[i].image_view; uint32_t b; for_each_bit(b, iview->image->aspects) { VkImageAspectFlagBits aspect = (1 << b); - char suffix; + const char *suffix; switch (aspect) { - case VK_IMAGE_ASPECT_COLOR_BIT: suffix = 'c'; break; - case VK_IMAGE_ASPECT_DEPTH_BIT: suffix = 'd'; break; - case VK_IMAGE_ASPECT_STENCIL_BIT: suffix = 's'; break; + case VK_IMAGE_ASPECT_COLOR_BIT: suffix = "c"; break; + case VK_IMAGE_ASPECT_DEPTH_BIT: suffix = "d"; break; + case VK_IMAGE_ASPECT_STENCIL_BIT: suffix = "s"; break; + case VK_IMAGE_ASPECT_PLANE_0_BIT: suffix = "c0"; break; + case VK_IMAGE_ASPECT_PLANE_1_BIT: suffix = "c1"; break; + case VK_IMAGE_ASPECT_PLANE_2_BIT: suffix = "c2"; break; default: unreachable("Invalid aspect"); } - char *filename = ralloc_asprintf(dump_ctx, "framebuffer%04d-%d%c.ppm", + char *filename = ralloc_asprintf(dump_ctx, "attachment%04d-%d%s.ppm", dump_idx, i, suffix); + unsigned plane = anv_image_aspect_to_plane(iview->image->aspects, aspect); dump_add_image(cmd_buffer, (struct anv_image *)iview->image, aspect, - iview->isl.base_level, iview->isl.base_array_layer, + iview->planes[plane].isl.base_level, + iview->planes[plane].isl.base_array_layer, filename); } }