anv/image: Add an aspects field

This makes several checks easier and allows us to avoid calling
anv_format_for_vk_format in a number of cases.
This commit is contained in:
Jason Ekstrand
2016-05-13 12:50:11 -07:00
parent 1bda8d06e5
commit 234ecf26c6
4 changed files with 10 additions and 8 deletions

View File

@@ -233,12 +233,14 @@ anv_image_create(VkDevice _device,
image->tiling = pCreateInfo->tiling;
if (likely(anv_format_is_color(format))) {
image->aspects |= VK_IMAGE_ASPECT_COLOR_BIT;
r = make_surface(device, image, create_info,
VK_IMAGE_ASPECT_COLOR_BIT);
if (r != VK_SUCCESS)
goto fail;
} else {
if (image->format->has_depth) {
image->aspects |= VK_IMAGE_ASPECT_DEPTH_BIT;
r = make_surface(device, image, create_info,
VK_IMAGE_ASPECT_DEPTH_BIT);
if (r != VK_SUCCESS)
@@ -246,6 +248,7 @@ anv_image_create(VkDevice _device,
}
if (image->format->has_stencil) {
image->aspects |= VK_IMAGE_ASPECT_STENCIL_BIT;
r = make_surface(device, image, create_info,
VK_IMAGE_ASPECT_STENCIL_BIT);
if (r != VK_SUCCESS)