radv: Implement VK_MESA_image_alignment_control
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no> Co-authored-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Co-authored-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29129>
This commit is contained in:

committed by
Marge Bot

parent
14457b358f
commit
6c3457033a
@@ -665,6 +665,7 @@ Khronos extensions that are not part of any Vulkan version:
|
||||
VK_INTEL_shader_integer_functions2 DONE (anv, hasvk, radv)
|
||||
VK_KHR_map_memory2 DONE (anv, nvk, radv, tu)
|
||||
VK_EXT_map_memory_placed DONE (anv, nvk, radv, tu)
|
||||
VK_MESA_image_alignment_control DONE (radv)
|
||||
|
||||
|
||||
|
||||
|
@@ -1,2 +1,3 @@
|
||||
VK_KHR_dynamic_rendering_local_read on RADV
|
||||
VK_EXT_legacy_vertex_attributes on lavapipe, ANV, Turnip and RADV
|
||||
VK_MESA_image_alignment_control on RADV
|
||||
|
@@ -605,10 +605,13 @@ radv_get_surface_flags(struct radv_device *device, struct radv_image *image, uns
|
||||
const VkImageCreateInfo *pCreateInfo, VkFormat image_format)
|
||||
{
|
||||
const struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
const struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
uint64_t flags;
|
||||
unsigned array_mode = radv_choose_tiling(device, pCreateInfo, image_format);
|
||||
VkFormat format = radv_image_get_plane_format(pdev, image, plane_id);
|
||||
const struct util_format_description *desc = vk_format_description(format);
|
||||
const VkImageAlignmentControlCreateInfoMESA *alignment =
|
||||
vk_find_struct_const(pCreateInfo->pNext, IMAGE_ALIGNMENT_CONTROL_CREATE_INFO_MESA);
|
||||
bool is_depth, is_stencil;
|
||||
|
||||
is_depth = util_format_has_depth(desc);
|
||||
@@ -692,6 +695,24 @@ radv_get_surface_flags(struct radv_device *device, struct radv_image *image, uns
|
||||
if (!(pCreateInfo->usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT)))
|
||||
flags |= RADEON_SURF_NO_TEXTURE;
|
||||
|
||||
if (alignment && alignment->maximumRequestedAlignment && !(instance->debug_flags & RADV_DEBUG_FORCE_COMPRESS)) {
|
||||
bool is_4k_capable;
|
||||
|
||||
if (!vk_format_is_depth_or_stencil(image_format)) {
|
||||
is_4k_capable =
|
||||
!(pCreateInfo->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) && (flags & RADEON_SURF_DISABLE_DCC) &&
|
||||
(flags & RADEON_SURF_NO_FMASK);
|
||||
} else {
|
||||
/* Depth-stencil format without DEPTH_STENCIL usage does not work either. */
|
||||
is_4k_capable = false;
|
||||
}
|
||||
|
||||
if (is_4k_capable && alignment->maximumRequestedAlignment <= 4096)
|
||||
flags |= RADEON_SURF_PREFER_4K_ALIGNMENT;
|
||||
if (alignment->maximumRequestedAlignment <= 64 * 1024)
|
||||
flags |= RADEON_SURF_PREFER_64K_ALIGNMENT;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
@@ -702,6 +702,7 @@ radv_physical_device_get_supported_extensions(const struct radv_physical_device
|
||||
.GOOGLE_hlsl_functionality1 = true,
|
||||
.GOOGLE_user_type = true,
|
||||
.INTEL_shader_integer_functions2 = true,
|
||||
.MESA_image_alignment_control = true,
|
||||
.NV_compute_shader_derivatives = true,
|
||||
.NV_device_generated_commands = !pdev->use_llvm && instance->drirc.enable_dgc,
|
||||
.NV_device_generated_commands_compute = !pdev->use_llvm && instance->drirc.enable_dgc,
|
||||
@@ -1219,6 +1220,9 @@ radv_physical_device_get_features(const struct radv_physical_device *pdev, struc
|
||||
|
||||
/* VK_EXT_legacy_vertex_attributes */
|
||||
.legacyVertexAttributes = true,
|
||||
|
||||
/* VK_MESA_image_alignment_control */
|
||||
.imageAlignmentControl = true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1918,6 +1922,11 @@ radv_get_physical_device_properties(struct radv_physical_device *pdev)
|
||||
|
||||
/* VK_EXT_legacy_vertex_attributes */
|
||||
p->nativeUnalignedPerformance = false;
|
||||
|
||||
/* VK_MESA_image_alignment_control */
|
||||
p->supportedImageAlignmentMask = (4 * 1024) | (64 * 1024);
|
||||
if (gfx11plus)
|
||||
p->supportedImageAlignmentMask |= 256 * 1024;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
Reference in New Issue
Block a user