Support the VK_KHR_maintenance2 extension.
We don't really restrict which usages you can request on an image, so the `VK_IMAGE_CREATE_EXTENDED_USAGE_BIT` doesn't really apply to us. Since we don't yet support tessellation, we don't support `VkPipelineTessellationDomainOriginStateCreateInfo`, either. Finally, as near as I can tell, we don't really do anything with input attachments, so any `VkRenderPassInputAttachmentAspectCreateInfo` will be ignored. I'm not sure if creating image views of compressed images using an uncompressed format will work. Metal's docs say texture views between any two color formats of the same size will work, but they also specifically call out converting between sRGB and non-sRGB compressed formats, which implies that, say, creating an `RG32Uint` view on a `BC1_RGBA` texture may not work. Thus, I've logged any uses of the `VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT`.
This commit is contained in:
parent
aab8b9a798
commit
32d4702265
@ -86,7 +86,7 @@ public:
|
|||||||
void getProperties(VkPhysicalDeviceProperties* properties);
|
void getProperties(VkPhysicalDeviceProperties* properties);
|
||||||
|
|
||||||
/** Populates the specified structure with the properties of this device. */
|
/** Populates the specified structure with the properties of this device. */
|
||||||
void getProperties(VkPhysicalDeviceProperties2KHR* properties);
|
void getProperties(VkPhysicalDeviceProperties2* properties);
|
||||||
|
|
||||||
/** Returns whether the specified format is supported on this device. */
|
/** Returns whether the specified format is supported on this device. */
|
||||||
bool getFormatIsSupported(VkFormat format);
|
bool getFormatIsSupported(VkFormat format);
|
||||||
|
@ -73,9 +73,9 @@ void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties* properties) {
|
|||||||
if (properties) { *properties = _properties; }
|
if (properties) { *properties = _properties; }
|
||||||
}
|
}
|
||||||
|
|
||||||
void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2KHR* properties) {
|
void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2* properties) {
|
||||||
if (properties) {
|
if (properties) {
|
||||||
properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
|
properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
||||||
properties->properties = _properties;
|
properties->properties = _properties;
|
||||||
auto* next = (VkStructureType*)properties->pNext;
|
auto* next = (VkStructureType*)properties->pNext;
|
||||||
while (next) {
|
while (next) {
|
||||||
@ -86,8 +86,14 @@ void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2KHR* properties
|
|||||||
next = (VkStructureType*)pushDescProps->pNext;
|
next = (VkStructureType*)pushDescProps->pNext;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: {
|
||||||
|
auto* pointClipProps = (VkPhysicalDevicePointClippingProperties*)next;
|
||||||
|
pointClipProps->pointClippingBehavior = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES;
|
||||||
|
next = (VkStructureType*)pointClipProps->pNext;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
next = (VkStructureType*)((VkPhysicalDeviceProperties2KHR*)next)->pNext;
|
next = (VkStructureType*)((VkPhysicalDeviceProperties2*)next)->pNext;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,6 +291,7 @@ protected:
|
|||||||
|
|
||||||
MVKImage* _image;
|
MVKImage* _image;
|
||||||
VkImageSubresourceRange _subresourceRange;
|
VkImageSubresourceRange _subresourceRange;
|
||||||
|
VkImageUsageFlags _usage;
|
||||||
id<MTLTexture> _mtlTexture;
|
id<MTLTexture> _mtlTexture;
|
||||||
std::mutex _lock;
|
std::mutex _lock;
|
||||||
MTLPixelFormat _mtlPixelFormat;
|
MTLPixelFormat _mtlPixelFormat;
|
||||||
|
@ -471,6 +471,10 @@ MVKImage::MVKImage(MVKDevice* device, const VkImageCreateInfo* pCreateInfo) : MV
|
|||||||
|
|
||||||
_byteAlignment = _device->_pProperties->limits.minTexelBufferOffsetAlignment;
|
_byteAlignment = _device->_pProperties->limits.minTexelBufferOffsetAlignment;
|
||||||
|
|
||||||
|
if (pCreateInfo->flags & VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT) {
|
||||||
|
mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImage() : Metal may not allow uncompressed views of compressed images.");
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust the info components to be compatible with Metal, then use the modified versions
|
// Adjust the info components to be compatible with Metal, then use the modified versions
|
||||||
// to set other config info. Vulkan allows unused extent dimensions to be zero, but Metal
|
// to set other config info. Vulkan allows unused extent dimensions to be zero, but Metal
|
||||||
// requires minimum of one. Adjust samples and miplevels for the right texture type.
|
// requires minimum of one. Adjust samples and miplevels for the right texture type.
|
||||||
@ -659,6 +663,23 @@ MVKImageView::MVKImageView(MVKDevice* device, const VkImageViewCreateInfo* pCrea
|
|||||||
validateImageViewConfig(pCreateInfo);
|
validateImageViewConfig(pCreateInfo);
|
||||||
|
|
||||||
_image = (MVKImage*)pCreateInfo->image;
|
_image = (MVKImage*)pCreateInfo->image;
|
||||||
|
_usage = _image->_usage;
|
||||||
|
|
||||||
|
auto* next = (VkStructureType*)pCreateInfo->pNext;
|
||||||
|
while (next) {
|
||||||
|
switch (*next) {
|
||||||
|
case VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO: {
|
||||||
|
auto* pViewUsageInfo = (VkImageViewUsageCreateInfo*)next;
|
||||||
|
if (!(pViewUsageInfo->usage & ~_usage))
|
||||||
|
_usage = pViewUsageInfo->usage;
|
||||||
|
next = (VkStructureType*)pViewUsageInfo->pNext;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
next = (VkStructureType*)((VkImageViewCreateInfo*)next)->pNext;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remember the subresource range, and determine the actual number of mip levels and texture slices
|
// Remember the subresource range, and determine the actual number of mip levels and texture slices
|
||||||
_subresourceRange = pCreateInfo->subresourceRange;
|
_subresourceRange = pCreateInfo->subresourceRange;
|
||||||
@ -685,9 +706,9 @@ void MVKImageView::validateImageViewConfig(const VkImageViewCreateInfo* pCreateI
|
|||||||
if ((viewType == VK_IMAGE_VIEW_TYPE_2D || viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY) && (imgType == VK_IMAGE_TYPE_3D)) {
|
if ((viewType == VK_IMAGE_VIEW_TYPE_2D || viewType == VK_IMAGE_VIEW_TYPE_2D_ARRAY) && (imgType == VK_IMAGE_TYPE_3D)) {
|
||||||
if (pCreateInfo->subresourceRange.layerCount != image->_extent.depth) {
|
if (pCreateInfo->subresourceRange.layerCount != image->_extent.depth) {
|
||||||
setConfigurationResult(mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImageView(): Metal does not support views on a subset of a 3D texture."));
|
setConfigurationResult(mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImageView(): Metal does not support views on a subset of a 3D texture."));
|
||||||
} else if (!(image->_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)) {
|
} else if (!(_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)) {
|
||||||
setConfigurationResult(mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImageView(): 2D views on 3D images are only supported for color attachments."));
|
setConfigurationResult(mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImageView(): 2D views on 3D images are only supported for color attachments."));
|
||||||
} else if (image->_usage & ~VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
|
} else if (_usage & ~VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
|
||||||
mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImageView(): 2D views on 3D images are only supported for color attachments.");
|
mvkNotifyErrorWithText(VK_ERROR_FEATURE_NOT_PRESENT, "vkCreateImageView(): 2D views on 3D images are only supported for color attachments.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ MVK_EXTENSION(KHR_get_memory_requirements2, KHR_GET_MEMORY_REQUIREMENTS_2)
|
|||||||
MVK_EXTENSION(KHR_get_physical_device_properties2, KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2)
|
MVK_EXTENSION(KHR_get_physical_device_properties2, KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2)
|
||||||
MVK_EXTENSION(KHR_image_format_list, KHR_IMAGE_FORMAT_LIST)
|
MVK_EXTENSION(KHR_image_format_list, KHR_IMAGE_FORMAT_LIST)
|
||||||
MVK_EXTENSION(KHR_maintenance1, KHR_MAINTENANCE1)
|
MVK_EXTENSION(KHR_maintenance1, KHR_MAINTENANCE1)
|
||||||
|
MVK_EXTENSION(KHR_maintenance2, KHR_MAINTENANCE2)
|
||||||
MVK_EXTENSION(KHR_push_descriptor, KHR_PUSH_DESCRIPTOR)
|
MVK_EXTENSION(KHR_push_descriptor, KHR_PUSH_DESCRIPTOR)
|
||||||
MVK_EXTENSION(KHR_shader_draw_parameters, KHR_SHADER_DRAW_PARAMETERS)
|
MVK_EXTENSION(KHR_shader_draw_parameters, KHR_SHADER_DRAW_PARAMETERS)
|
||||||
MVK_EXTENSION(KHR_surface, KHR_SURFACE)
|
MVK_EXTENSION(KHR_surface, KHR_SURFACE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user