anv/clear: Handle ClearImage on 3-D images
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 31 May 2016 18:26:06 +0000 (11:26 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 4 Jun 2016 02:29:28 +0000 (19:29 -0700)
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
src/intel/vulkan/anv_meta_clear.c

index 18dfae8817d297fec601ada6899cf55cba74b5f5..fe750c859f8f2117eeae37963128fb7e528286c9 100644 (file)
@@ -761,9 +761,11 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,
 
    for (uint32_t r = 0; r < range_count; r++) {
       const VkImageSubresourceRange *range = &ranges[r];
-
       for (uint32_t l = 0; l < anv_get_levelCount(image, range); ++l) {
-         for (uint32_t s = 0; s < anv_get_layerCount(image, range); ++s) {
+         const uint32_t layer_count = image->type == VK_IMAGE_TYPE_3D ?
+                                      anv_minify(image->extent.depth, l) :
+                                      anv_get_layerCount(image, range);
+         for (uint32_t s = 0; s < layer_count; ++s) {
             struct anv_image_view iview;
             anv_image_view_init(&iview, cmd_buffer->device,
                &(VkImageViewCreateInfo) {