return vk_error(VK_ERROR_INVALID_MEMORY_SIZE);
}
- const struct anv_format *format_info =
- anv_format_for_vk_format(pCreateInfo->format);
-
image = anv_device_alloc(device, sizeof(*image), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (!image)
memset(image, 0, sizeof(*image));
image->type = pCreateInfo->imageType;
image->extent = pCreateInfo->extent;
- image->format = pCreateInfo->format;
+ image->format = anv_format_for_vk_format(pCreateInfo->format);
image->levels = pCreateInfo->mipLevels;
image->array_size = pCreateInfo->arraySize;
image->surf_type = surf_type;
- if (likely(!format_info->has_stencil || format_info->depth_format)) {
+ if (likely(!image->format->has_stencil || image->format->depth_format)) {
/* The image's primary surface is a color or depth surface. */
r = anv_image_make_surface(create_info, &image->size, &image->alignment,
&image->primary_surface);
goto fail;
}
- if (format_info->has_stencil) {
+ if (image->format->has_stencil) {
/* From the GPU's perspective, the depth buffer and stencil buffer are
* separate buffers. From Vulkan's perspective, though, depth and
* stencil reside in the same image. To satisfy Vulkan and the GPU, we
const VkImageSubresourceRange *subresource;
const struct anv_image_view_info *view_info;
const struct anv_format *view_format_info;
- const struct anv_format *image_format_info;
/* Validate structure type before dereferencing it. */
assert(pCreateInfo);
/* Validate format is in range before using it. */
assert(pCreateInfo->format >= VK_FORMAT_BEGIN_RANGE);
assert(pCreateInfo->format <= VK_FORMAT_END_RANGE);
- image_format_info = anv_format_for_vk_format(image->format);
view_format_info = anv_format_for_vk_format(pCreateInfo->format);
/* Validate channel swizzles. */
/* Validate format. */
switch (subresource->aspect) {
case VK_IMAGE_ASPECT_COLOR:
- assert(!image_format_info->depth_format);
- assert(!image_format_info->has_stencil);
+ 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_info->cpp);
+ assert(view_format_info->cpp == image->format->cpp);
break;
case VK_IMAGE_ASPECT_DEPTH:
- assert(image_format_info->depth_format);
+ assert(image->format->depth_format);
assert(view_format_info->depth_format);
- assert(view_format_info->cpp == image_format_info->cpp);
+ 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_info->has_stencil);
+ assert(image->format->has_stencil);
assert(view_format_info->has_stencil);
break;
default:
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
struct anv_surface *depth_surface = &image->primary_surface;
struct anv_surface *stencil_surface = &image->stencil_surface;
- const struct anv_format *format =
- anv_format_for_vk_format(image->format);
view->base.attachment_type = ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL;
view->depth_stride = depth_surface->stride;
view->depth_offset = image->offset + depth_surface->offset;
- view->depth_format = format->depth_format;
+ view->depth_format = image->format->depth_format;
view->depth_qpitch = 0; /* FINISHME: QPitch */
view->stencil_stride = stencil_surface->stride;
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
.viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = src_image->format,
+ .format = src_image->format->vk_format,
.channels = {
VK_CHANNEL_SWIZZLE_R,
VK_CHANNEL_SWIZZLE_G,
&(VkAttachmentViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
.image = destImage,
- .format = src_image->format,
+ .format = src_image->format->vk_format,
.mipLevel = pRegions[r].destSubresource.mipLevel,
.baseArraySlice = pRegions[r].destSubresource.arraySlice,
.arraySize = 1,
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
.viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = src_image->format,
+ .format = src_image->format->vk_format,
.channels = {
VK_CHANNEL_SWIZZLE_R,
VK_CHANNEL_SWIZZLE_G,
&(VkAttachmentViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
.image = destImage,
- .format = dest_image->format,
+ .format = dest_image->format->vk_format,
.mipLevel = pRegions[r].destSubresource.mipLevel,
.baseArraySlice = pRegions[r].destSubresource.arraySlice,
.arraySize = 1,
&(VkImageCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = VK_IMAGE_TYPE_2D,
- .format = dest_image->format,
+ .format = dest_image->format->vk_format,
.extent = {
.width = pRegions[r].imageExtent.width,
.height = pRegions[r].imageExtent.height,
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = anv_image_to_handle(src_image),
.viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = dest_image->format,
+ .format = dest_image->format->vk_format,
.channels = {
VK_CHANNEL_SWIZZLE_R,
VK_CHANNEL_SWIZZLE_G,
&(VkAttachmentViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
.image = anv_image_to_handle(dest_image),
- .format = dest_image->format,
+ .format = dest_image->format->vk_format,
.mipLevel = pRegions[r].imageSubresource.mipLevel,
.baseArraySlice = pRegions[r].imageSubresource.arraySlice,
.arraySize = 1,
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = srcImage,
.viewType = VK_IMAGE_VIEW_TYPE_2D,
- .format = src_image->format,
+ .format = src_image->format->vk_format,
.channels = {
VK_CHANNEL_SWIZZLE_R,
VK_CHANNEL_SWIZZLE_G,
&(VkImageCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = VK_IMAGE_TYPE_2D,
- .format = src_image->format,
+ .format = src_image->format->vk_format,
.extent = {
.width = pRegions[r].imageExtent.width,
.height = pRegions[r].imageExtent.height,
&(VkAttachmentViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
.image = destImage,
- .format = src_image->format,
+ .format = src_image->format->vk_format,
.mipLevel = 0,
.baseArraySlice = 0,
.arraySize = 1,
&(VkAttachmentViewCreateInfo) {
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
.image = _image,
- .format = image->format,
+ .format = image->format->vk_format,
.mipLevel = pRanges[r].baseMipLevel + l,
.baseArraySlice = pRanges[r].baseArraySlice + s,
.arraySize = 1,