radv_process_color_image(struct radv_cmd_buffer *cmd_buffer,
struct radv_image *image,
const VkImageSubresourceRange *subresourceRange,
- VkPipeline *pipeline)
+ bool decompress_dcc)
{
struct radv_meta_saved_state saved_state;
+ VkPipeline *pipeline;
+
+ if (decompress_dcc && radv_dcc_enabled(image, subresourceRange->baseMipLevel)) {
+ pipeline = &cmd_buffer->device->meta_state.fast_clear_flush.dcc_decompress_pipeline;
+ } else if (radv_image_has_fmask(image) && !image->tc_compatible_cmask) {
+ pipeline = &cmd_buffer->device->meta_state.fast_clear_flush.fmask_decompress_pipeline;
+ } else {
+ pipeline = &cmd_buffer->device->meta_state.fast_clear_flush.cmask_eliminate_pipeline;
+ }
if (!*pipeline) {
VkResult ret;
VK_PIPELINE_BIND_POINT_GRAPHICS, *pipeline);
for (uint32_t l = 0; l < radv_get_levelCount(image, subresourceRange); ++l) {
- uint32_t width =
- radv_minify(image->info.width,
+ uint32_t width, height;
+
+ /* Do not decompress levels without DCC. */
+ if (decompress_dcc &&
+ !radv_dcc_enabled(image, subresourceRange->baseMipLevel + l))
+ continue;
+
+ width = radv_minify(image->info.width,
subresourceRange->baseMipLevel + l);
- uint32_t height =
- radv_minify(image->info.height,
+ height = radv_minify(image->info.height,
subresourceRange->baseMipLevel + l);
radv_CmdSetViewport(radv_cmd_buffer_to_handle(cmd_buffer), 0, 1,
bool decompress_dcc)
{
bool old_predicating = false;
- VkPipeline *pipeline;
assert(cmd_buffer->queue_family_index == RADV_QUEUE_GENERAL);
- if (decompress_dcc && radv_dcc_enabled(image, subresourceRange->baseMipLevel)) {
- pipeline = &cmd_buffer->device->meta_state.fast_clear_flush.dcc_decompress_pipeline;
- } else if (radv_image_has_fmask(image)) {
- pipeline = &cmd_buffer->device->meta_state.fast_clear_flush.fmask_decompress_pipeline;
- } else {
- pipeline = &cmd_buffer->device->meta_state.fast_clear_flush.cmask_eliminate_pipeline;
- }
-
if (radv_dcc_enabled(image, subresourceRange->baseMipLevel)) {
uint64_t pred_offset = decompress_dcc ? image->dcc_pred_offset :
image->fce_pred_offset;
cmd_buffer->state.predicating = true;
}
- radv_process_color_image(cmd_buffer, image, subresourceRange, pipeline);
+ radv_process_color_image(cmd_buffer, image, subresourceRange,
+ decompress_dcc);
if (radv_dcc_enabled(image, subresourceRange->baseMipLevel)) {
uint64_t pred_offset = decompress_dcc ? image->dcc_pred_offset :
device->meta_state.fast_clear_flush.dcc_decompress_compute_pipeline);
for (uint32_t l = 0; l < radv_get_levelCount(image, subresourceRange); l++) {
+ uint32_t width, height;
/* Do not decompress levels without DCC. */
if (!radv_dcc_enabled(image, subresourceRange->baseMipLevel + l))
continue;
- radv_image_view_init(&iview, cmd_buffer->device,
- &(VkImageViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- .image = radv_image_to_handle(image),
- .viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = image->vk_format,
- .subresourceRange = {
- .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
- .baseMipLevel = subresourceRange->baseMipLevel + l,
- .levelCount = 1,
- .baseArrayLayer = 0,
- .layerCount = 1
- },
- });
-
- radv_meta_push_descriptor_set(cmd_buffer,
- VK_PIPELINE_BIND_POINT_COMPUTE,
- device->meta_state.fast_clear_flush.dcc_decompress_compute_p_layout,
- 0, /* set */
- 2, /* descriptorWriteCount */
- (VkWriteDescriptorSet[]) {
- {
- .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
- .dstBinding = 0,
- .dstArrayElement = 0,
- .descriptorCount = 1,
- .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
- .pImageInfo = (VkDescriptorImageInfo[]) {
- {
- .sampler = VK_NULL_HANDLE,
- .imageView = radv_image_view_to_handle(&iview),
- .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
- },
- }
- },
+ width = radv_minify(image->info.width,
+ subresourceRange->baseMipLevel + l);
+ height = radv_minify(image->info.height,
+ subresourceRange->baseMipLevel + l);
+
+ for (uint32_t s = 0; s < radv_get_layerCount(image, subresourceRange); s++) {
+ radv_image_view_init(&iview, cmd_buffer->device,
+ &(VkImageViewCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+ .image = radv_image_to_handle(image),
+ .viewType = VK_IMAGE_VIEW_TYPE_2D,
+ .format = image->vk_format,
+ .subresourceRange = {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .baseMipLevel = subresourceRange->baseMipLevel + l,
+ .levelCount = 1,
+ .baseArrayLayer = subresourceRange->baseArrayLayer + s,
+ .layerCount = 1
+ },
+ });
+
+ radv_meta_push_descriptor_set(cmd_buffer,
+ VK_PIPELINE_BIND_POINT_COMPUTE,
+ device->meta_state.fast_clear_flush.dcc_decompress_compute_p_layout,
+ 0, /* set */
+ 2, /* descriptorWriteCount */
+ (VkWriteDescriptorSet[]) {
{
- .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
- .dstBinding = 1,
- .dstArrayElement = 0,
- .descriptorCount = 1,
- .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
- .pImageInfo = (VkDescriptorImageInfo[]) {
- {
- .sampler = VK_NULL_HANDLE,
- .imageView = radv_image_view_to_handle(&iview),
- .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
- },
- }
- }
- });
-
- radv_unaligned_dispatch(cmd_buffer, image->info.width, image->info.height, 1);
+ .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
+ .dstBinding = 0,
+ .dstArrayElement = 0,
+ .descriptorCount = 1,
+ .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
+ .pImageInfo = (VkDescriptorImageInfo[]) {
+ {
+ .sampler = VK_NULL_HANDLE,
+ .imageView = radv_image_view_to_handle(&iview),
+ .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
+ },
+ }
+ },
+ {
+ .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
+ .dstBinding = 1,
+ .dstArrayElement = 0,
+ .descriptorCount = 1,
+ .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
+ .pImageInfo = (VkDescriptorImageInfo[]) {
+ {
+ .sampler = VK_NULL_HANDLE,
+ .imageView = radv_image_view_to_handle(&iview),
+ .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
+ },
+ }
+ }
+ });
+
+ radv_unaligned_dispatch(cmd_buffer, width, height, 1);
+ }
}
/* Mark this image as actually being decompressed. */
radv_meta_restore(&saved_state, cmd_buffer);
state->flush_bits |= RADV_CMD_FLAG_CS_PARTIAL_FLUSH |
- RADV_CMD_FLAG_INV_VMEM_L1;
+ RADV_CMD_FLAG_INV_VCACHE;
- state->flush_bits |= radv_clear_dcc(cmd_buffer, image, subresourceRange,
- 0xffffffff);
- state->flush_bits |= RADV_CMD_FLAG_FLUSH_AND_INV_CB |
- RADV_CMD_FLAG_FLUSH_AND_INV_CB_META;
+ /* Initialize the DCC metadata as "fully expanded". */
+ radv_initialize_dcc(cmd_buffer, image, subresourceRange, 0xffffffff);
}
void