vk: Add anv_image::usage
It's a copy of VkImageCreateInfo::usage. Will be used for the VkAttachmentView/VkImageView merge.
This commit is contained in:
parent
cf603714cb
commit
44143a1f46
|
@ -304,8 +304,21 @@ anv_image_create(VkDevice _device,
|
|||
image->format = anv_format_for_vk_format(pCreateInfo->format);
|
||||
image->levels = pCreateInfo->mipLevels;
|
||||
image->array_size = pCreateInfo->arraySize;
|
||||
image->usage = pCreateInfo->usage;
|
||||
image->surf_type = surf_type;
|
||||
|
||||
if (pCreateInfo->usage & VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT) {
|
||||
/* Meta will transfer from the image by binding it as a texture. */
|
||||
image->usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||
}
|
||||
|
||||
if (pCreateInfo->usage & VK_IMAGE_USAGE_TRANSFER_DESTINATION_BIT) {
|
||||
/* Meta will transfer to the image by binding it as a color attachment,
|
||||
* even if the image format is not a color format.
|
||||
*/
|
||||
image->usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
}
|
||||
|
||||
if (likely(anv_format_is_color(image->format))) {
|
||||
r = anv_image_make_surface(create_info, image->format,
|
||||
&image->size, &image->alignment,
|
||||
|
@ -458,6 +471,11 @@ anv_image_view_init(struct anv_image_view *iview,
|
|||
const VkImageViewCreateInfo* pCreateInfo,
|
||||
struct anv_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
||||
|
||||
assert(image->usage & (VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||
VK_IMAGE_USAGE_STORAGE_BIT));
|
||||
|
||||
switch (device->info.gen) {
|
||||
case 7:
|
||||
gen7_image_view_init(iview, device, pCreateInfo, cmd_buffer);
|
||||
|
@ -506,6 +524,8 @@ anv_depth_stencil_view_init(struct anv_image_view *iview,
|
|||
{
|
||||
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
||||
|
||||
assert(image->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_BIT);
|
||||
|
||||
iview->image = image;
|
||||
iview->format = anv_format_for_vk_format(pCreateInfo->format);
|
||||
|
||||
|
@ -565,6 +585,10 @@ anv_color_attachment_view_init(struct anv_image_view *iview,
|
|||
const VkAttachmentViewCreateInfo* pCreateInfo,
|
||||
struct anv_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
||||
|
||||
assert(image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
|
||||
|
||||
switch (device->info.gen) {
|
||||
case 7:
|
||||
gen7_color_attachment_view_init(iview, device, pCreateInfo, cmd_buffer);
|
||||
|
|
|
@ -1202,6 +1202,7 @@ struct anv_image {
|
|||
VkExtent3D extent;
|
||||
uint32_t levels;
|
||||
uint32_t array_size;
|
||||
VkImageUsageFlags usage; /**< VkImageCreateInfo::usage */
|
||||
|
||||
VkDeviceSize size;
|
||||
uint32_t alignment;
|
||||
|
|
|
@ -369,6 +369,7 @@ gen7_color_attachment_view_init(struct anv_image_view *iview,
|
|||
struct anv_surface *surface =
|
||||
anv_image_get_surface_for_color_attachment(image);
|
||||
|
||||
assert(image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
|
||||
anv_assert(pCreateInfo->arraySize > 0);
|
||||
anv_assert(pCreateInfo->mipLevel < image->levels);
|
||||
anv_assert(pCreateInfo->baseArraySlice + pCreateInfo->arraySize <= image->array_size);
|
||||
|
|
|
@ -295,6 +295,7 @@ gen8_color_attachment_view_init(struct anv_image_view *iview,
|
|||
uint32_t depth = 1; /* RENDER_SURFACE_STATE::Depth */
|
||||
uint32_t rt_view_extent = 1; /* RENDER_SURFACE_STATE::RenderTargetViewExtent */
|
||||
|
||||
assert(image->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
|
||||
anv_assert(pCreateInfo->arraySize > 0);
|
||||
anv_assert(pCreateInfo->mipLevel < image->levels);
|
||||
anv_assert(pCreateInfo->baseArraySlice + pCreateInfo->arraySize <= image->array_size);
|
||||
|
|
Loading…
Reference in New Issue