summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-08-30 16:56:25 -0700
committerJason Ekstrand <[email protected]>2016-09-13 12:40:13 -0700
commit6bcb1f753eb0da05e3aa8cb281f3ce9dd82aa398 (patch)
treec96537b0cb52163cb31d0e39d5c375e5ca55ea69 /src/intel
parent57e87862eb23e20b06637ec1768018fceff95bc9 (diff)
anv: Use blorp for ClearColorImage
Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_blorp.c56
-rw-r--r--src/intel/vulkan/anv_meta_clear.c21
2 files changed, 56 insertions, 21 deletions
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 72d7bea7fb7..d056fcfa213 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -666,3 +666,59 @@ void anv_CmdUpdateBuffer(
blorp_batch_finish(&batch);
}
+
+void anv_CmdClearColorImage(
+ VkCommandBuffer commandBuffer,
+ VkImage _image,
+ VkImageLayout imageLayout,
+ const VkClearColorValue* pColor,
+ uint32_t rangeCount,
+ const VkImageSubresourceRange* pRanges)
+{
+ ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
+ ANV_FROM_HANDLE(anv_image, image, _image);
+
+ static const bool color_write_disable[4] = { false, false, false, false };
+
+ struct blorp_batch batch;
+ blorp_batch_init(&cmd_buffer->device->blorp, &batch, cmd_buffer);
+
+ union isl_color_value clear_color;
+ memcpy(clear_color.u32, pColor->uint32, sizeof(pColor->uint32));
+
+ struct blorp_surf surf;
+ get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT, &surf);
+
+ for (unsigned r = 0; r < rangeCount; r++) {
+ if (pRanges[r].aspectMask == 0)
+ continue;
+
+ assert(pRanges[r].aspectMask == VK_IMAGE_ASPECT_COLOR_BIT);
+
+ struct anv_format src_format =
+ anv_get_format(&cmd_buffer->device->info, image->vk_format,
+ VK_IMAGE_ASPECT_COLOR_BIT, image->tiling);
+
+ unsigned base_layer = pRanges[r].baseArrayLayer;
+ unsigned layer_count = pRanges[r].layerCount;
+
+ for (unsigned i = 0; i < pRanges[r].levelCount; i++) {
+ const unsigned level = pRanges[r].baseMipLevel + i;
+ const unsigned level_width = anv_minify(image->extent.width, level);
+ const unsigned level_height = anv_minify(image->extent.height, level);
+
+ if (image->type == VK_IMAGE_TYPE_3D) {
+ base_layer = 0;
+ layer_count = anv_minify(image->extent.depth, level);
+ }
+
+ blorp_clear(&batch, &surf,
+ src_format.isl_format, src_format.swizzle,
+ level, base_layer, layer_count,
+ 0, 0, level_width, level_height,
+ clear_color, color_write_disable);
+ }
+ }
+
+ blorp_batch_finish(&batch);
+}
diff --git a/src/intel/vulkan/anv_meta_clear.c b/src/intel/vulkan/anv_meta_clear.c
index dddad34cc31..ed4d1db9d45 100644
--- a/src/intel/vulkan/anv_meta_clear.c
+++ b/src/intel/vulkan/anv_meta_clear.c
@@ -900,27 +900,6 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
}
}
-void anv_CmdClearColorImage(
- VkCommandBuffer commandBuffer,
- VkImage image_h,
- VkImageLayout imageLayout,
- const VkClearColorValue* pColor,
- uint32_t rangeCount,
- const VkImageSubresourceRange* pRanges)
-{
- ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
- ANV_FROM_HANDLE(anv_image, image, image_h);
- struct anv_meta_saved_state saved_state;
-
- meta_clear_begin(&saved_state, cmd_buffer);
-
- anv_cmd_clear_image(cmd_buffer, image, imageLayout,
- (VkClearValue) { .color = *pColor },
- rangeCount, pRanges);
-
- meta_clear_end(&saved_state, cmd_buffer);
-}
-
void anv_CmdClearDepthStencilImage(
VkCommandBuffer commandBuffer,
VkImage image_h,