radv: Add single plane image views & meta operations.
Copies & clear of multiplane images is not allowed so we do not have to handle that case. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
@@ -4215,7 +4215,7 @@ radv_initialise_color_surface(struct radv_device *device,
|
|||||||
unsigned ntype, format, swap, endian;
|
unsigned ntype, format, swap, endian;
|
||||||
unsigned blend_clamp = 0, blend_bypass = 0;
|
unsigned blend_clamp = 0, blend_bypass = 0;
|
||||||
uint64_t va;
|
uint64_t va;
|
||||||
const struct radv_image_plane *plane = &iview->image->planes[0];
|
const struct radv_image_plane *plane = &iview->image->planes[iview->plane_id];
|
||||||
const struct radeon_surf *surf = &plane->surface;
|
const struct radeon_surf *surf = &plane->surface;
|
||||||
|
|
||||||
desc = vk_format_description(iview->vk_format);
|
desc = vk_format_description(iview->vk_format);
|
||||||
|
|||||||
@@ -1157,6 +1157,38 @@ radv_image_view_make_descriptor(struct radv_image_view *iview,
|
|||||||
blk_w, is_stencil, is_storage_image, descriptor);
|
blk_w, is_stencil, is_storage_image, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned
|
||||||
|
radv_plane_from_aspect(VkImageAspectFlags mask)
|
||||||
|
{
|
||||||
|
switch(mask) {
|
||||||
|
case VK_IMAGE_ASPECT_PLANE_1_BIT:
|
||||||
|
return 1;
|
||||||
|
case VK_IMAGE_ASPECT_PLANE_2_BIT:
|
||||||
|
return 2;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VkFormat
|
||||||
|
radv_get_aspect_format(struct radv_image *image, VkImageAspectFlags mask)
|
||||||
|
{
|
||||||
|
switch(mask) {
|
||||||
|
case VK_IMAGE_ASPECT_PLANE_0_BIT:
|
||||||
|
return image->planes[0].format;
|
||||||
|
case VK_IMAGE_ASPECT_PLANE_1_BIT:
|
||||||
|
return image->planes[1].format;
|
||||||
|
case VK_IMAGE_ASPECT_PLANE_2_BIT:
|
||||||
|
return image->planes[2].format;
|
||||||
|
case VK_IMAGE_ASPECT_STENCIL_BIT:
|
||||||
|
return vk_format_stencil_only(image->vk_format);
|
||||||
|
case VK_IMAGE_ASPECT_DEPTH_BIT:
|
||||||
|
return vk_format_depth_only(image->vk_format);
|
||||||
|
default:
|
||||||
|
return image->vk_format;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
radv_image_view_init(struct radv_image_view *iview,
|
radv_image_view_init(struct radv_image_view *iview,
|
||||||
struct radv_device *device,
|
struct radv_device *device,
|
||||||
@@ -1182,6 +1214,7 @@ radv_image_view_init(struct radv_image_view *iview,
|
|||||||
iview->type = pCreateInfo->viewType;
|
iview->type = pCreateInfo->viewType;
|
||||||
iview->vk_format = pCreateInfo->format;
|
iview->vk_format = pCreateInfo->format;
|
||||||
iview->aspect_mask = pCreateInfo->subresourceRange.aspectMask;
|
iview->aspect_mask = pCreateInfo->subresourceRange.aspectMask;
|
||||||
|
iview->plane_id = radv_plane_from_aspect(pCreateInfo->subresourceRange.aspectMask);
|
||||||
|
|
||||||
if (iview->aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT) {
|
if (iview->aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||||
iview->vk_format = vk_format_stencil_only(iview->vk_format);
|
iview->vk_format = vk_format_stencil_only(iview->vk_format);
|
||||||
@@ -1203,7 +1236,7 @@ radv_image_view_init(struct radv_image_view *iview,
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iview->vk_format != image->vk_format) {
|
if (iview->vk_format != image->planes[iview->plane_id].format) {
|
||||||
unsigned view_bw = vk_format_get_blockwidth(iview->vk_format);
|
unsigned view_bw = vk_format_get_blockwidth(iview->vk_format);
|
||||||
unsigned view_bh = vk_format_get_blockheight(iview->vk_format);
|
unsigned view_bh = vk_format_get_blockheight(iview->vk_format);
|
||||||
unsigned img_bw = vk_format_get_blockwidth(image->vk_format);
|
unsigned img_bw = vk_format_get_blockwidth(image->vk_format);
|
||||||
@@ -1258,8 +1291,8 @@ radv_image_view_init(struct radv_image_view *iview,
|
|||||||
iview->base_mip = range->baseMipLevel;
|
iview->base_mip = range->baseMipLevel;
|
||||||
iview->level_count = radv_get_levelCount(image, range);
|
iview->level_count = radv_get_levelCount(image, range);
|
||||||
|
|
||||||
radv_image_view_make_descriptor(iview, device, &pCreateInfo->components, false, 0);
|
radv_image_view_make_descriptor(iview, device, &pCreateInfo->components, false, iview->plane_id);
|
||||||
radv_image_view_make_descriptor(iview, device, &pCreateInfo->components, true, 0);
|
radv_image_view_make_descriptor(iview, device, &pCreateInfo->components, true, iview->plane_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool radv_layout_has_htile(const struct radv_image *image,
|
bool radv_layout_has_htile(const struct radv_image *image,
|
||||||
@@ -1376,7 +1409,10 @@ void radv_GetImageSubresourceLayout(
|
|||||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||||
int level = pSubresource->mipLevel;
|
int level = pSubresource->mipLevel;
|
||||||
int layer = pSubresource->arrayLayer;
|
int layer = pSubresource->arrayLayer;
|
||||||
struct radv_image_plane *plane = &image->planes[0];
|
|
||||||
|
unsigned plane_id = radv_plane_from_aspect(pSubresource->aspectMask);
|
||||||
|
|
||||||
|
struct radv_image_plane *plane = &image->planes[plane_id];
|
||||||
struct radeon_surf *surface = &plane->surface;
|
struct radeon_surf *surface = &plane->surface;
|
||||||
|
|
||||||
if (device->physical_device->rad_info.chip_class >= GFX9) {
|
if (device->physical_device->rad_info.chip_class >= GFX9) {
|
||||||
|
|||||||
@@ -84,11 +84,7 @@ blit_surf_for_image_level_layer(struct radv_image *image,
|
|||||||
VkImageLayout layout,
|
VkImageLayout layout,
|
||||||
const VkImageSubresourceLayers *subres)
|
const VkImageSubresourceLayers *subres)
|
||||||
{
|
{
|
||||||
VkFormat format = image->vk_format;
|
VkFormat format = radv_get_aspect_format(image, subres->aspectMask);
|
||||||
if (subres->aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT)
|
|
||||||
format = vk_format_depth_only(format);
|
|
||||||
else if (subres->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT)
|
|
||||||
format = vk_format_stencil_only(format);
|
|
||||||
|
|
||||||
if (!radv_image_has_dcc(image) &&
|
if (!radv_image_has_dcc(image) &&
|
||||||
!(radv_image_is_tc_compat_htile(image)))
|
!(radv_image_is_tc_compat_htile(image)))
|
||||||
|
|||||||
@@ -1677,6 +1677,7 @@ struct radv_image_view {
|
|||||||
VkImageViewType type;
|
VkImageViewType type;
|
||||||
VkImageAspectFlags aspect_mask;
|
VkImageAspectFlags aspect_mask;
|
||||||
VkFormat vk_format;
|
VkFormat vk_format;
|
||||||
|
unsigned plane_id;
|
||||||
uint32_t base_layer;
|
uint32_t base_layer;
|
||||||
uint32_t layer_count;
|
uint32_t layer_count;
|
||||||
uint32_t base_mip;
|
uint32_t base_mip;
|
||||||
@@ -1713,6 +1714,8 @@ void radv_image_view_init(struct radv_image_view *view,
|
|||||||
struct radv_device *device,
|
struct radv_device *device,
|
||||||
const VkImageViewCreateInfo* pCreateInfo);
|
const VkImageViewCreateInfo* pCreateInfo);
|
||||||
|
|
||||||
|
VkFormat radv_get_aspect_format(struct radv_image *image, VkImageAspectFlags mask);
|
||||||
|
|
||||||
struct radv_buffer_view {
|
struct radv_buffer_view {
|
||||||
struct radeon_winsys_bo *bo;
|
struct radeon_winsys_bo *bo;
|
||||||
VkFormat vk_format;
|
VkFormat vk_format;
|
||||||
|
|||||||
Reference in New Issue
Block a user