Merge pull request #272 from cdavis5e/khr-maintenance2
Support the VK_KHR_maintenance2 extension.
This commit is contained in:
commit
ac10059a6b
@ -86,7 +86,7 @@ public:
|
||||
void getProperties(VkPhysicalDeviceProperties* properties);
|
||||
|
||||
/** 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. */
|
||||
bool getFormatIsSupported(VkFormat format);
|
||||
|
@ -73,9 +73,9 @@ void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties* properties) {
|
||||
if (properties) { *properties = _properties; }
|
||||
}
|
||||
|
||||
void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2KHR* properties) {
|
||||
void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2* 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;
|
||||
auto* next = (VkStructureType*)properties->pNext;
|
||||
while (next) {
|
||||
@ -86,8 +86,14 @@ void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2KHR* properties
|
||||
next = (VkStructureType*)pushDescProps->pNext;
|
||||
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:
|
||||
next = (VkStructureType*)((VkPhysicalDeviceProperties2KHR*)next)->pNext;
|
||||
next = (VkStructureType*)((VkPhysicalDeviceProperties2*)next)->pNext;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -291,6 +291,7 @@ protected:
|
||||
|
||||
MVKImage* _image;
|
||||
VkImageSubresourceRange _subresourceRange;
|
||||
VkImageUsageFlags _usage;
|
||||
id<MTLTexture> _mtlTexture;
|
||||
std::mutex _lock;
|
||||
MTLPixelFormat _mtlPixelFormat;
|
||||
|
@ -471,6 +471,10 @@ MVKImage::MVKImage(MVKDevice* device, const VkImageCreateInfo* pCreateInfo) : MV
|
||||
|
||||
_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
|
||||
// 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.
|
||||
@ -656,9 +660,26 @@ id<MTLTexture> MVKImageView::newMTLTexture() {
|
||||
|
||||
MVKImageView::MVKImageView(MVKDevice* device, const VkImageViewCreateInfo* pCreateInfo) : MVKBaseDeviceObject(device) {
|
||||
|
||||
validateImageViewConfig(pCreateInfo);
|
||||
|
||||
_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;
|
||||
}
|
||||
}
|
||||
|
||||
validateImageViewConfig(pCreateInfo);
|
||||
|
||||
// Remember the subresource range, and determine the actual number of mip levels and texture slices
|
||||
_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 (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."));
|
||||
} 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."));
|
||||
} 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.");
|
||||
}
|
||||
}
|
||||
|
@ -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_image_format_list, KHR_IMAGE_FORMAT_LIST)
|
||||
MVK_EXTENSION(KHR_maintenance1, KHR_MAINTENANCE1)
|
||||
MVK_EXTENSION(KHR_maintenance2, KHR_MAINTENANCE2)
|
||||
MVK_EXTENSION(KHR_push_descriptor, KHR_PUSH_DESCRIPTOR)
|
||||
MVK_EXTENSION(KHR_shader_draw_parameters, KHR_SHADER_DRAW_PARAMETERS)
|
||||
MVK_EXTENSION(KHR_surface, KHR_SURFACE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user