summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vulkan/anv_image.c58
-rw-r--r--src/vulkan/anv_meta.c10
-rw-r--r--src/vulkan/anv_private.h3
-rw-r--r--src/vulkan/gen7_state.c2
-rw-r--r--src/vulkan/gen8_state.c2
5 files changed, 44 insertions, 31 deletions
diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c
index dce4208ed5f..2045aa27219 100644
--- a/src/vulkan/anv_image.c
+++ b/src/vulkan/anv_image.c
@@ -415,8 +415,7 @@ anv_validate_CreateImageView(VkDevice _device,
assert(pCreateInfo->channels.a <= VK_CHANNEL_SWIZZLE_END_RANGE);
/* Validate subresource. */
- assert(subresource->aspect >= VK_IMAGE_ASPECT_BEGIN_RANGE);
- assert(subresource->aspect <= VK_IMAGE_ASPECT_END_RANGE);
+ assert(subresource->aspectMask != 0);
assert(subresource->mipLevels > 0);
assert(subresource->arraySize > 0);
assert(subresource->baseMipLevel < image->levels);
@@ -430,28 +429,33 @@ anv_validate_CreateImageView(VkDevice _device,
assert(subresource->arraySize % 6 == 0);
}
+ const VkImageAspectFlags ds_flags = VK_IMAGE_ASPECT_DEPTH_BIT
+ | VK_IMAGE_ASPECT_STENCIL_BIT;
+
/* Validate format. */
- switch (subresource->aspect) {
- case VK_IMAGE_ASPECT_COLOR:
+ if (subresource->aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
+ assert(subresource->aspectMask == VK_IMAGE_ASPECT_COLOR_BIT);
assert(!image->format->depth_format);
assert(!image->format->has_stencil);
assert(!view_format_info->depth_format);
assert(!view_format_info->has_stencil);
assert(view_format_info->cpp == image->format->cpp);
- break;
- case VK_IMAGE_ASPECT_DEPTH:
- assert(image->format->depth_format);
- assert(view_format_info->depth_format);
- assert(view_format_info->cpp == image->format->cpp);
- break;
- case VK_IMAGE_ASPECT_STENCIL:
- /* FINISHME: Is it legal to have an R8 view of S8? */
- assert(image->format->has_stencil);
- assert(view_format_info->has_stencil);
- break;
- default:
- assert(!"bad VkImageAspect");
- break;
+ } else if (subresource->aspectMask & ds_flags) {
+ assert((subresource->aspectMask & ~ds_flags) == 0);
+
+ if (subresource->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) {
+ assert(image->format->depth_format);
+ assert(view_format_info->depth_format);
+ assert(view_format_info->cpp == image->format->cpp);
+ }
+
+ if (subresource->aspectMask & VK_IMAGE_ASPECT_STENCIL) {
+ /* FINISHME: Is it legal to have an R8 view of S8? */
+ assert(image->format->has_stencil);
+ assert(view_format_info->has_stencil);
+ }
+ } else {
+ assert(!"bad VkImageSubresourceRange::aspectFlags");
}
return anv_CreateImageView(_device, pCreateInfo, pView);
@@ -528,19 +532,27 @@ anv_depth_stencil_view_init(struct anv_depth_stencil_view *view,
}
struct anv_surface *
-anv_image_get_surface_for_aspect(struct anv_image *image, VkImageAspect aspect)
+anv_image_get_surface_for_aspect_mask(struct anv_image *image, VkImageAspectFlags aspect_mask)
{
- switch (aspect) {
- case VK_IMAGE_ASPECT_COLOR:
+ switch (aspect_mask) {
+ case VK_IMAGE_ASPECT_COLOR_BIT:
assert(anv_format_is_color(image->format));
return &image->color_surface;
- case VK_IMAGE_ASPECT_DEPTH:
+ case VK_IMAGE_ASPECT_DEPTH_BIT:
assert(image->format->depth_format);
return &image->depth_surface;
- case VK_IMAGE_ASPECT_STENCIL:
+ case VK_IMAGE_ASPECT_STENCIL_BIT:
assert(image->format->has_stencil);
anv_finishme("stencil image views");
return &image->stencil_surface;
+ case VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT:
+ /* FINISHME: Support combined depthstencil aspect. Does the Vulkan spec
+ * allow is to reject it? Until we support it, filter out the stencil
+ * aspect and use only the depth aspect.
+ */
+ anv_finishme("combined depthstencil aspect");
+ assert(image->format->depth_format);
+ return &image->depth_surface;
default:
unreachable("image does not have aspect");
return NULL;
diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c
index e43d11b06ee..dd8f3a958a6 100644
--- a/src/vulkan/anv_meta.c
+++ b/src/vulkan/anv_meta.c
@@ -1013,7 +1013,7 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
VK_CHANNEL_SWIZZLE_A
},
.subresourceRange = {
- .aspect = VK_IMAGE_ASPECT_COLOR,
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0,
.mipLevels = 1,
.baseArraySlice = 0,
@@ -1161,7 +1161,7 @@ void anv_CmdCopyImage(
VK_CHANNEL_SWIZZLE_A
},
.subresourceRange = {
- .aspect = pRegions[r].srcSubresource.aspect,
+ .aspectMask = 1 << pRegions[r].srcSubresource.aspect,
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
.mipLevels = 1,
.baseArraySlice = pRegions[r].srcSubresource.arraySlice,
@@ -1247,7 +1247,7 @@ void anv_CmdBlitImage(
VK_CHANNEL_SWIZZLE_A
},
.subresourceRange = {
- .aspect = pRegions[r].srcSubresource.aspect,
+ .aspectMask = 1 << pRegions[r].srcSubresource.aspect,
.baseMipLevel = pRegions[r].srcSubresource.mipLevel,
.mipLevels = 1,
.baseArraySlice = pRegions[r].srcSubresource.arraySlice,
@@ -1377,7 +1377,7 @@ void anv_CmdCopyBufferToImage(
VK_CHANNEL_SWIZZLE_A
},
.subresourceRange = {
- .aspect = proxy_aspect,
+ .aspectMask = 1 << proxy_aspect,
.baseMipLevel = 0,
.mipLevels = 1,
.baseArraySlice = 0,
@@ -1464,7 +1464,7 @@ void anv_CmdCopyImageToBuffer(
VK_CHANNEL_SWIZZLE_A
},
.subresourceRange = {
- .aspect = pRegions[r].imageSubresource.aspect,
+ .aspectMask = 1 << pRegions[r].imageSubresource.aspect,
.baseMipLevel = pRegions[r].imageSubresource.mipLevel,
.mipLevels = 1,
.baseArraySlice = pRegions[r].imageSubresource.arraySlice,
diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h
index f0d288342d6..a2211bb76b3 100644
--- a/src/vulkan/anv_private.h
+++ b/src/vulkan/anv_private.h
@@ -1273,7 +1273,8 @@ VkResult anv_image_create(VkDevice _device,
VkImage *pImage);
struct anv_surface *
-anv_image_get_surface_for_aspect(struct anv_image *image, VkImageAspect aspect);
+anv_image_get_surface_for_aspect_mask(struct anv_image *image,
+ VkImageAspectFlags aspect_mask);
struct anv_surface *
anv_image_get_surface_for_color_attachment(struct anv_image *image);
diff --git a/src/vulkan/gen7_state.c b/src/vulkan/gen7_state.c
index faf99a5aef8..f93349da0b0 100644
--- a/src/vulkan/gen7_state.c
+++ b/src/vulkan/gen7_state.c
@@ -274,7 +274,7 @@ gen7_image_view_init(struct anv_image_view *iview,
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
struct anv_surface_view *view = &iview->view;
struct anv_surface *surface =
- anv_image_get_surface_for_aspect(image, range->aspect);
+ anv_image_get_surface_for_aspect_mask(image, range->aspectMask);
const struct anv_format *format =
anv_format_for_vk_format(pCreateInfo->format);
diff --git a/src/vulkan/gen8_state.c b/src/vulkan/gen8_state.c
index 5646637e4a0..3709a50005d 100644
--- a/src/vulkan/gen8_state.c
+++ b/src/vulkan/gen8_state.c
@@ -150,7 +150,7 @@ gen8_image_view_init(struct anv_image_view *iview,
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
struct anv_surface_view *view = &iview->view;
struct anv_surface *surface =
- anv_image_get_surface_for_aspect(image, range->aspect);
+ anv_image_get_surface_for_aspect_mask(image, range->aspectMask);
uint32_t depth = 1; /* RENDER_SURFACE_STATE::Depth */
uint32_t rt_view_extent = 1; /* RENDER_SURFACE_STATE::RenderTargetViewExtent */