vk/0.170.2: Update VkImageSubresourceRange

Replace 'aspect' with 'aspectMask'.
This commit is contained in:
Chad Versace
2015-10-05 06:48:14 -07:00
parent 568654d606
commit 7a089bd1a6
6 changed files with 45 additions and 32 deletions

View File

@@ -1505,7 +1505,7 @@ typedef struct {
} VkChannelMapping; } VkChannelMapping;
typedef struct { typedef struct {
VkImageAspect aspect; VkImageAspectFlags aspectMask;
uint32_t baseMipLevel; uint32_t baseMipLevel;
uint32_t mipLevels; uint32_t mipLevels;
uint32_t baseArraySlice; uint32_t baseArraySlice;

View File

@@ -415,8 +415,7 @@ anv_validate_CreateImageView(VkDevice _device,
assert(pCreateInfo->channels.a <= VK_CHANNEL_SWIZZLE_END_RANGE); assert(pCreateInfo->channels.a <= VK_CHANNEL_SWIZZLE_END_RANGE);
/* Validate subresource. */ /* Validate subresource. */
assert(subresource->aspect >= VK_IMAGE_ASPECT_BEGIN_RANGE); assert(subresource->aspectMask != 0);
assert(subresource->aspect <= VK_IMAGE_ASPECT_END_RANGE);
assert(subresource->mipLevels > 0); assert(subresource->mipLevels > 0);
assert(subresource->arraySize > 0); assert(subresource->arraySize > 0);
assert(subresource->baseMipLevel < image->levels); assert(subresource->baseMipLevel < image->levels);
@@ -430,28 +429,33 @@ anv_validate_CreateImageView(VkDevice _device,
assert(subresource->arraySize % 6 == 0); assert(subresource->arraySize % 6 == 0);
} }
const VkImageAspectFlags ds_flags = VK_IMAGE_ASPECT_DEPTH_BIT
| VK_IMAGE_ASPECT_STENCIL_BIT;
/* Validate format. */ /* Validate format. */
switch (subresource->aspect) { if (subresource->aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
case VK_IMAGE_ASPECT_COLOR: assert(subresource->aspectMask == VK_IMAGE_ASPECT_COLOR_BIT);
assert(!image->format->depth_format); assert(!image->format->depth_format);
assert(!image->format->has_stencil); assert(!image->format->has_stencil);
assert(!view_format_info->depth_format); assert(!view_format_info->depth_format);
assert(!view_format_info->has_stencil); assert(!view_format_info->has_stencil);
assert(view_format_info->cpp == image->format->cpp); assert(view_format_info->cpp == image->format->cpp);
break; } else if (subresource->aspectMask & ds_flags) {
case VK_IMAGE_ASPECT_DEPTH: assert((subresource->aspectMask & ~ds_flags) == 0);
assert(image->format->depth_format);
assert(view_format_info->depth_format); if (subresource->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) {
assert(view_format_info->cpp == image->format->cpp); assert(image->format->depth_format);
break; assert(view_format_info->depth_format);
case VK_IMAGE_ASPECT_STENCIL: assert(view_format_info->cpp == image->format->cpp);
/* FINISHME: Is it legal to have an R8 view of S8? */ }
assert(image->format->has_stencil);
assert(view_format_info->has_stencil); if (subresource->aspectMask & VK_IMAGE_ASPECT_STENCIL) {
break; /* FINISHME: Is it legal to have an R8 view of S8? */
default: assert(image->format->has_stencil);
assert(!"bad VkImageAspect"); assert(view_format_info->has_stencil);
break; }
} else {
assert(!"bad VkImageSubresourceRange::aspectFlags");
} }
return anv_CreateImageView(_device, pCreateInfo, pView); return anv_CreateImageView(_device, pCreateInfo, pView);
@@ -528,19 +532,27 @@ anv_depth_stencil_view_init(struct anv_depth_stencil_view *view,
} }
struct anv_surface * 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) { switch (aspect_mask) {
case VK_IMAGE_ASPECT_COLOR: case VK_IMAGE_ASPECT_COLOR_BIT:
assert(anv_format_is_color(image->format)); assert(anv_format_is_color(image->format));
return &image->color_surface; return &image->color_surface;
case VK_IMAGE_ASPECT_DEPTH: case VK_IMAGE_ASPECT_DEPTH_BIT:
assert(image->format->depth_format); assert(image->format->depth_format);
return &image->depth_surface; return &image->depth_surface;
case VK_IMAGE_ASPECT_STENCIL: case VK_IMAGE_ASPECT_STENCIL_BIT:
assert(image->format->has_stencil); assert(image->format->has_stencil);
anv_finishme("stencil image views"); anv_finishme("stencil image views");
return &image->stencil_surface; 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: default:
unreachable("image does not have aspect"); unreachable("image does not have aspect");
return NULL; return NULL;

View File

@@ -1013,7 +1013,7 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
VK_CHANNEL_SWIZZLE_A VK_CHANNEL_SWIZZLE_A
}, },
.subresourceRange = { .subresourceRange = {
.aspect = VK_IMAGE_ASPECT_COLOR, .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = 0, .baseMipLevel = 0,
.mipLevels = 1, .mipLevels = 1,
.baseArraySlice = 0, .baseArraySlice = 0,
@@ -1161,7 +1161,7 @@ void anv_CmdCopyImage(
VK_CHANNEL_SWIZZLE_A VK_CHANNEL_SWIZZLE_A
}, },
.subresourceRange = { .subresourceRange = {
.aspect = pRegions[r].srcSubresource.aspect, .aspectMask = 1 << pRegions[r].srcSubresource.aspect,
.baseMipLevel = pRegions[r].srcSubresource.mipLevel, .baseMipLevel = pRegions[r].srcSubresource.mipLevel,
.mipLevels = 1, .mipLevels = 1,
.baseArraySlice = pRegions[r].srcSubresource.arraySlice, .baseArraySlice = pRegions[r].srcSubresource.arraySlice,
@@ -1247,7 +1247,7 @@ void anv_CmdBlitImage(
VK_CHANNEL_SWIZZLE_A VK_CHANNEL_SWIZZLE_A
}, },
.subresourceRange = { .subresourceRange = {
.aspect = pRegions[r].srcSubresource.aspect, .aspectMask = 1 << pRegions[r].srcSubresource.aspect,
.baseMipLevel = pRegions[r].srcSubresource.mipLevel, .baseMipLevel = pRegions[r].srcSubresource.mipLevel,
.mipLevels = 1, .mipLevels = 1,
.baseArraySlice = pRegions[r].srcSubresource.arraySlice, .baseArraySlice = pRegions[r].srcSubresource.arraySlice,
@@ -1377,7 +1377,7 @@ void anv_CmdCopyBufferToImage(
VK_CHANNEL_SWIZZLE_A VK_CHANNEL_SWIZZLE_A
}, },
.subresourceRange = { .subresourceRange = {
.aspect = proxy_aspect, .aspectMask = 1 << proxy_aspect,
.baseMipLevel = 0, .baseMipLevel = 0,
.mipLevels = 1, .mipLevels = 1,
.baseArraySlice = 0, .baseArraySlice = 0,
@@ -1464,7 +1464,7 @@ void anv_CmdCopyImageToBuffer(
VK_CHANNEL_SWIZZLE_A VK_CHANNEL_SWIZZLE_A
}, },
.subresourceRange = { .subresourceRange = {
.aspect = pRegions[r].imageSubresource.aspect, .aspectMask = 1 << pRegions[r].imageSubresource.aspect,
.baseMipLevel = pRegions[r].imageSubresource.mipLevel, .baseMipLevel = pRegions[r].imageSubresource.mipLevel,
.mipLevels = 1, .mipLevels = 1,
.baseArraySlice = pRegions[r].imageSubresource.arraySlice, .baseArraySlice = pRegions[r].imageSubresource.arraySlice,

View File

@@ -1273,7 +1273,8 @@ VkResult anv_image_create(VkDevice _device,
VkImage *pImage); VkImage *pImage);
struct anv_surface * 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 * struct anv_surface *
anv_image_get_surface_for_color_attachment(struct anv_image *image); anv_image_get_surface_for_color_attachment(struct anv_image *image);

View File

@@ -274,7 +274,7 @@ gen7_image_view_init(struct anv_image_view *iview,
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange; const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
struct anv_surface_view *view = &iview->view; struct anv_surface_view *view = &iview->view;
struct anv_surface *surface = 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 = const struct anv_format *format =
anv_format_for_vk_format(pCreateInfo->format); anv_format_for_vk_format(pCreateInfo->format);

View File

@@ -150,7 +150,7 @@ gen8_image_view_init(struct anv_image_view *iview,
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange; const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
struct anv_surface_view *view = &iview->view; struct anv_surface_view *view = &iview->view;
struct anv_surface *surface = 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 depth = 1; /* RENDER_SURFACE_STATE::Depth */
uint32_t rt_view_extent = 1; /* RENDER_SURFACE_STATE::RenderTargetViewExtent */ uint32_t rt_view_extent = 1; /* RENDER_SURFACE_STATE::RenderTargetViewExtent */