diff options
-rw-r--r-- | include/vulkan/vulkan.h | 7 | ||||
-rw-r--r-- | src/vulkan/anv_formats.c | 43 |
2 files changed, 46 insertions, 4 deletions
diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 1bcc31c59d9..26827b6847f 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -1210,8 +1210,11 @@ typedef struct { } VkExtent3D; typedef struct { - uint64_t maxResourceSize; - uint32_t maxSamples; + VkExtent3D maxExtent; + uint32_t maxMipLevels; + uint32_t maxArraySize; + VkSampleCountFlags sampleCounts; + VkDeviceSize maxResourceSize; } VkImageFormatProperties; typedef struct { diff --git a/src/vulkan/anv_formats.c b/src/vulkan/anv_formats.c index 8f36bc9a7ce..f5bae0ae0aa 100644 --- a/src/vulkan/anv_formats.c +++ b/src/vulkan/anv_formats.c @@ -344,6 +344,9 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( const struct anv_format *format = anv_format_for_vk_format(_format); VkFormatProperties format_props; VkFormatFeatureFlags format_feature_flags; + VkExtent3D maxExtent; + uint32_t maxMipLevels; + uint32_t maxArraySize; VkResult result; result = anv_physical_device_get_format_properties(physical_device, format, @@ -362,6 +365,35 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( unreachable("bad VkImageTiling"); } + switch (type) { + default: + unreachable("bad VkImageType"); + case VK_IMAGE_TYPE_1D: + maxExtent.width = 16384; + maxExtent.height = 1; + maxExtent.depth = 1; + maxMipLevels = 15; /* log2(maxWidth) + 1 */ + maxArraySize = 2048; + break; + case VK_IMAGE_TYPE_2D: + /* FINISHME: Does this really differ for cube maps? The documentation + * for RENDER_SURFACE_STATE suggests so. + */ + maxExtent.width = 16384; + maxExtent.height = 16384; + maxExtent.depth = 1; + maxMipLevels = 15; /* log2(maxWidth) + 1 */ + maxArraySize = 2048; + break; + case VK_IMAGE_TYPE_3D: + maxExtent.width = 2048; + maxExtent.height = 2048; + maxExtent.depth = 2048; + maxMipLevels = 12; /* log2(maxWidth) + 1 */ + maxArraySize = 1; + break; + } + if (usage & VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT) { /* Meta implements transfers by sampling from the source image. */ if (!(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) { @@ -415,8 +447,12 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( } *pImageFormatProperties = (VkImageFormatProperties) { + .maxExtent = maxExtent, + .maxMipLevels = maxMipLevels, + .maxArraySize = maxArraySize, + /* FINISHME: Support multisampling */ - .maxSamples = 1, + .sampleCounts = VK_SAMPLE_COUNT_1_BIT, /* FINISHME: Accurately calculate * VkImageFormatProperties::maxResourceSize. @@ -428,7 +464,10 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( unsupported: *pImageFormatProperties = (VkImageFormatProperties) { - .maxSamples = 0, + .maxExtent = { 0, 0, 0 }, + .maxMipLevels = 0, + .maxArraySize = 0, + .sampleCounts = 0, .maxResourceSize = 0, }; |