+ if (!meta_state->depth_decomp[samples_log2].decompress_pipeline) {
+ VkResult ret = create_pipeline(cmd_buffer->device, VK_NULL_HANDLE, samples,
+ meta_state->depth_decomp[samples_log2].pass,
+ meta_state->depth_decomp[samples_log2].p_layout,
+ &meta_state->depth_decomp[samples_log2].decompress_pipeline,
+ &meta_state->depth_decomp[samples_log2].resummarize_pipeline);
+ if (ret != VK_SUCCESS) {
+ cmd_buffer->record_result = ret;
+ return;
+ }
+ }
+
+ radv_meta_save(&saved_state, cmd_buffer,
+ RADV_META_SAVE_GRAPHICS_PIPELINE |
+ RADV_META_SAVE_SAMPLE_LOCATIONS |
+ RADV_META_SAVE_PASS);
+
+ switch (op) {
+ case DEPTH_DECOMPRESS:
+ pipeline_h = meta_state->depth_decomp[samples_log2].decompress_pipeline;
+ break;
+ case DEPTH_RESUMMARIZE:
+ pipeline_h = meta_state->depth_decomp[samples_log2].resummarize_pipeline;
+ break;
+ default:
+ unreachable("unknown operation");
+ }
+
+ radv_CmdBindPipeline(cmd_buffer_h, VK_PIPELINE_BIND_POINT_GRAPHICS,
+ pipeline_h);
+
+ radv_CmdSetViewport(cmd_buffer_h, 0, 1, &(VkViewport) {
+ .x = 0,
+ .y = 0,
+ .width = width,
+ .height = height,
+ .minDepth = 0.0f,
+ .maxDepth = 1.0f
+ });
+
+ radv_CmdSetScissor(cmd_buffer_h, 0, 1, &(VkRect2D) {
+ .offset = { 0, 0 },
+ .extent = { width, height },
+ });
+
+ if (sample_locs) {
+ assert(image->flags & VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT);
+
+ /* Set the sample locations specified during explicit or
+ * automatic layout transitions, otherwise the depth decompress
+ * pass uses the default HW locations.
+ */
+ radv_CmdSetSampleLocationsEXT(cmd_buffer_h, &(VkSampleLocationsInfoEXT) {
+ .sampleLocationsPerPixel = sample_locs->per_pixel,
+ .sampleLocationGridSize = sample_locs->grid_size,
+ .sampleLocationsCount = sample_locs->count,
+ .pSampleLocations = sample_locs->locations,
+ });
+ }