Merge pull request #361 from cdavis5e/khr-maintenance3
Support the VK_KHR_maintenance3 extension.
This commit is contained in:
commit
1b99ba03ab
@ -321,6 +321,10 @@ public:
|
||||
/** Block the current thread until all queues in this device are idle. */
|
||||
VkResult waitIdle();
|
||||
|
||||
/** Returns whether or not the given descriptor set layout is supported. */
|
||||
void getDescriptorSetLayoutSupport(const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
|
||||
VkDescriptorSetLayoutSupport* pSupport);
|
||||
|
||||
|
||||
#pragma mark Object lifecycle
|
||||
|
||||
|
@ -91,18 +91,25 @@ void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2* properties) {
|
||||
auto* next = (VkStructureType*)properties->pNext;
|
||||
while (next) {
|
||||
switch (*next) {
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR: {
|
||||
auto* pushDescProps = (VkPhysicalDevicePushDescriptorPropertiesKHR*)next;
|
||||
pushDescProps->maxPushDescriptors = _properties.limits.maxPerStageResources;
|
||||
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;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: {
|
||||
auto* maint3Props = (VkPhysicalDeviceMaintenance3Properties*)next;
|
||||
maint3Props->maxPerSetDescriptors = (_metalFeatures.maxPerStageBufferCount + _metalFeatures.maxPerStageTextureCount + _metalFeatures.maxPerStageSamplerCount) * 2;
|
||||
maint3Props->maxMemoryAllocationSize = _metalFeatures.maxMTLBufferSize;
|
||||
next = (VkStructureType*)maint3Props->pNext;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR: {
|
||||
auto* pushDescProps = (VkPhysicalDevicePushDescriptorPropertiesKHR*)next;
|
||||
pushDescProps->maxPushDescriptors = _properties.limits.maxPerStageResources;
|
||||
next = (VkStructureType*)pushDescProps->pNext;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT: {
|
||||
auto* divisorProps = (VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT*)next;
|
||||
divisorProps->maxVertexAttribDivisor = kMVKUndefinedLargeUInt32;
|
||||
@ -1251,6 +1258,19 @@ VkResult MVKDevice::waitIdle() {
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void MVKDevice::getDescriptorSetLayoutSupport(const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
|
||||
VkDescriptorSetLayoutSupport* pSupport) {
|
||||
// According to the Vulkan spec:
|
||||
// "If the descriptor set layout satisfies the VkPhysicalDeviceMaintenance3Properties::maxPerSetDescriptors
|
||||
// limit, this command is guaranteed to return VK_TRUE in VkDescriptorSetLayout::supported...
|
||||
// "This command does not consider other limits such as maxPerStageDescriptor*..."
|
||||
uint32_t descriptorCount = 0;
|
||||
for (uint32_t i = 0; i < pCreateInfo->bindingCount; i++) {
|
||||
descriptorCount += pCreateInfo->pBindings[i].descriptorCount;
|
||||
}
|
||||
pSupport->supported = (descriptorCount < ((_physicalDevice->_metalFeatures.maxPerStageBufferCount + _physicalDevice->_metalFeatures.maxPerStageTextureCount + _physicalDevice->_metalFeatures.maxPerStageSamplerCount) * 2));
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Object lifecycle
|
||||
|
||||
|
@ -297,6 +297,7 @@ void MVKInstance::initProcAddrs() {
|
||||
ADD_PROC_ADDR(vkGetPhysicalDeviceMemoryProperties2KHR);
|
||||
ADD_PROC_ADDR(vkGetPhysicalDeviceSparseImageFormatProperties2KHR);
|
||||
ADD_PROC_ADDR(vkTrimCommandPoolKHR);
|
||||
ADD_PROC_ADDR(vkGetDescriptorSetLayoutSupportKHR);
|
||||
ADD_PROC_ADDR(vkCmdPushDescriptorSetKHR);
|
||||
ADD_PROC_ADDR(vkCmdPushDescriptorSetWithTemplateKHR);
|
||||
ADD_PROC_ADDR(vkDestroySurfaceKHR);
|
||||
|
@ -37,6 +37,7 @@ MVK_EXTENSION(KHR_get_physical_device_properties2, KHR_GET_PHYSICAL_DEVICE_PROPE
|
||||
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_maintenance3, KHR_MAINTENANCE3)
|
||||
MVK_EXTENSION(KHR_push_descriptor, KHR_PUSH_DESCRIPTOR)
|
||||
MVK_EXTENSION(KHR_sampler_mirror_clamp_to_edge, KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE)
|
||||
MVK_EXTENSION(KHR_shader_draw_parameters, KHR_SHADER_DRAW_PARAMETERS)
|
||||
|
@ -1617,6 +1617,18 @@ MVK_PUBLIC_SYMBOL void vkTrimCommandPoolKHR(
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark VK_KHR_maintenance3 extension
|
||||
|
||||
MVK_PUBLIC_SYMBOL void vkGetDescriptorSetLayoutSupportKHR(
|
||||
VkDevice device,
|
||||
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
|
||||
VkDescriptorSetLayoutSupportKHR* pSupport) {
|
||||
MVKDevice* mvkDevice = (MVKDevice*)device;
|
||||
mvkDevice->getDescriptorSetLayoutSupport(pCreateInfo, pSupport);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark VK_KHR_push_descriptor extension
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user