VkFilter blit_filter)
{
struct radv_device *device = cmd_buffer->device;
+ uint32_t src_width = radv_minify(src_iview->image->info.width, src_iview->base_mip);
+ uint32_t src_height = radv_minify(src_iview->image->info.height, src_iview->base_mip);
+ uint32_t src_depth = radv_minify(src_iview->image->info.depth, src_iview->base_mip);
+ uint32_t dst_width = radv_minify(dest_iview->image->info.width, dest_iview->base_mip);
+ uint32_t dst_height = radv_minify(dest_iview->image->info.height, dest_iview->base_mip);
assert(src_image->info.samples == dest_image->info.samples);
float vertex_push_constants[5] = {
- (float)src_offset_0.x / (float)src_iview->extent.width,
- (float)src_offset_0.y / (float)src_iview->extent.height,
- (float)src_offset_1.x / (float)src_iview->extent.width,
- (float)src_offset_1.y / (float)src_iview->extent.height,
- (float)src_offset_0.z / (float)src_iview->extent.depth,
+ (float)src_offset_0.x / (float)src_width,
+ (float)src_offset_0.y / (float)src_height,
+ (float)src_offset_1.x / (float)src_width,
+ (float)src_offset_1.y / (float)src_height,
+ (float)src_offset_0.z / (float)src_depth,
};
radv_CmdPushConstants(radv_cmd_buffer_to_handle(cmd_buffer),
.pAttachments = (VkImageView[]) {
radv_image_view_to_handle(dest_iview),
},
- .width = dest_iview->extent.width,
- .height = dest_iview->extent.height,
+ .width = dst_width,
+ .height = dst_height,
.layers = 1,
}, &cmd_buffer->pool->alloc, &fb);
VkPipeline pipeline;
unreachable(!"bad VkImageType");
}
- if (cmd_buffer->state.pipeline != radv_pipeline_from_handle(pipeline)) {
- radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
- VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
- }
+ radv_CmdBindPipeline(radv_cmd_buffer_to_handle(cmd_buffer),
+ VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);
radv_meta_push_descriptor_set(cmd_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
device->meta_state.blit.pipeline_layout,
assert(src_image->info.samples == 1);
assert(dest_image->info.samples == 1);
- radv_meta_save_graphics_reset_vport_scissor_novertex(&saved_state, cmd_buffer);
+ radv_meta_save(&saved_state, cmd_buffer,
+ RADV_META_SAVE_GRAPHICS_PIPELINE |
+ RADV_META_SAVE_CONSTANTS |
+ RADV_META_SAVE_DESCRIPTORS);
for (unsigned r = 0; r < regionCount; r++) {
const VkImageSubresourceLayers *src_res = &pRegions[r].srcSubresource;
.baseArrayLayer = src_res->baseArrayLayer,
.layerCount = 1
},
- },
- cmd_buffer, VK_IMAGE_USAGE_SAMPLED_BIT);
+ });
unsigned dst_start, dst_end;
if (dest_image->type == VK_IMAGE_TYPE_3D) {
dest_box.extent.height = abs(dst_y1 - dst_y0);
struct radv_image_view dest_iview;
- unsigned usage;
- if (dst_res->aspectMask == VK_IMAGE_ASPECT_COLOR_BIT)
- usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
- else
- usage = VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
-
const unsigned num_layers = dst_end - dst_start;
for (unsigned i = 0; i < num_layers; i++) {
const VkOffset3D dest_offset_0 = {
.baseArrayLayer = dest_array_slice,
.layerCount = 1
},
- },
- cmd_buffer, usage);
+ });
meta_emit_blit(cmd_buffer,
src_image, &src_iview,
src_offset_0, src_offset_1,
void
radv_device_finish_meta_blit_state(struct radv_device *device)
{
- for (unsigned i = 0; i < NUM_META_FS_KEYS; ++i) {
- if (device->meta_state.blit.render_pass[i])
- radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit.render_pass[i],
- &device->meta_state.alloc);
- if (device->meta_state.blit.pipeline_1d_src[i])
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.pipeline_1d_src[i],
- &device->meta_state.alloc);
- if (device->meta_state.blit.pipeline_2d_src[i])
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.pipeline_2d_src[i],
- &device->meta_state.alloc);
- if (device->meta_state.blit.pipeline_3d_src[i])
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.pipeline_3d_src[i],
- &device->meta_state.alloc);
- }
+ struct radv_meta_state *state = &device->meta_state;
- if (device->meta_state.blit.depth_only_rp)
- radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit.depth_only_rp,
- &device->meta_state.alloc);
- if (device->meta_state.blit.depth_only_1d_pipeline)
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.depth_only_1d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.depth_only_2d_pipeline)
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.depth_only_2d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.depth_only_3d_pipeline)
- radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.depth_only_3d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.stencil_only_rp)
+ for (unsigned i = 0; i < NUM_META_FS_KEYS; ++i) {
radv_DestroyRenderPass(radv_device_to_handle(device),
- device->meta_state.blit.stencil_only_rp,
- &device->meta_state.alloc);
- if (device->meta_state.blit.stencil_only_1d_pipeline)
+ state->blit.render_pass[i],
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.stencil_only_1d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.stencil_only_2d_pipeline)
+ state->blit.pipeline_1d_src[i],
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.stencil_only_2d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.stencil_only_3d_pipeline)
+ state->blit.pipeline_2d_src[i],
+ &state->alloc);
radv_DestroyPipeline(radv_device_to_handle(device),
- device->meta_state.blit.stencil_only_3d_pipeline,
- &device->meta_state.alloc);
- if (device->meta_state.blit.pipeline_layout)
- radv_DestroyPipelineLayout(radv_device_to_handle(device),
- device->meta_state.blit.pipeline_layout,
- &device->meta_state.alloc);
- if (device->meta_state.blit.ds_layout)
- radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
- device->meta_state.blit.ds_layout,
- &device->meta_state.alloc);
+ state->blit.pipeline_3d_src[i],
+ &state->alloc);
+ }
+
+ radv_DestroyRenderPass(radv_device_to_handle(device),
+ state->blit.depth_only_rp, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.depth_only_1d_pipeline, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.depth_only_2d_pipeline, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.depth_only_3d_pipeline, &state->alloc);
+
+ radv_DestroyRenderPass(radv_device_to_handle(device),
+ state->blit.stencil_only_rp, &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.stencil_only_1d_pipeline,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.stencil_only_2d_pipeline,
+ &state->alloc);
+ radv_DestroyPipeline(radv_device_to_handle(device),
+ state->blit.stencil_only_3d_pipeline,
+ &state->alloc);
+
+ radv_DestroyPipelineLayout(radv_device_to_handle(device),
+ state->blit.pipeline_layout, &state->alloc);
+ radv_DestroyDescriptorSetLayout(radv_device_to_handle(device),
+ state->blit.ds_layout, &state->alloc);
}
static VkFormat pipeline_formats[] = {
VK_FORMAT_R8G8B8A8_UNORM,
VK_FORMAT_R8G8B8A8_UINT,
VK_FORMAT_R8G8B8A8_SINT,
+ VK_FORMAT_A2R10G10B10_UINT_PACK32,
+ VK_FORMAT_A2R10G10B10_SINT_PACK32,
VK_FORMAT_R16G16B16A16_UNORM,
VK_FORMAT_R16G16B16A16_SNORM,
VK_FORMAT_R16G16B16A16_UINT,
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
.attachmentCount = 1,
.pAttachments = &(VkAttachmentDescription) {
- .format = 0,
+ .format = VK_FORMAT_D32_SFLOAT,
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
.initialLayout = VK_IMAGE_LAYOUT_GENERAL,
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
.attachmentCount = 1,
.pAttachments = &(VkAttachmentDescription) {
- .format = 0,
+ .format = VK_FORMAT_S8_UINT,
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
.initialLayout = VK_IMAGE_LAYOUT_GENERAL,
{
VkResult result;
struct radv_shader_module vs = {0};
- zero(device->meta_state.blit);
VkDescriptorSetLayoutCreateInfo ds_layout_info = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,