Skip to content

Commit

Permalink
Vulkan: support of VK_KHR_maintenance3 extension (#2504)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qining authored Dec 27, 2018
1 parent 9827ce7 commit b71fb57
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
36 changes: 32 additions & 4 deletions gapis/api/vulkan/api/descriptor.api
Original file line number Diff line number Diff line change
Expand Up @@ -1038,18 +1038,46 @@ sub void registerDescriptorUser!T(ref!T user, VkDescriptorSet descSet, u32 bindi
// Descriptor set layout //
///////////////////////////

@indirect("VkDevice")
cmd void vkGetDescriptorSetLayoutSupport(
sub void GetDescriptorSetLayoutSupport(
VkDevice device,
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
VkDescriptorSetLayoutSupport* pSupport) {
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pCreateInfo == null { vkErrorNullPointer("VkDescriptorSetLayoutCreateInfo") }
info := pCreateInfo[0]
_ = info.pBindings[0:info.bindingCount]
// TODO: pNext pointer

// handle pNext pointer
if info.pNext != null {
numPNext := numberOfPNext(
as!const void*(info.pNext))
next := MutableVoidPtr(as!void*(info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
fence
support := ?
if pSupport == null { vkErrorNullPointer("VkDescriptorSetLayoutSupport") }
pSupport[0] = support
// handle pNext pointer
if support.pNext != null {
numPNext := numberOfPNext(
as!const void*(support.pNext))
next := MutableVoidPtr(as!void*(support.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}

@indirect("VkDevice")
cmd void vkGetDescriptorSetLayoutSupport(
VkDevice device,
const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
VkDescriptorSetLayoutSupport* pSupport) {
GetDescriptorSetLayoutSupport(device, pCreateInfo, pSupport)
}
4 changes: 4 additions & 0 deletions gapis/api/vulkan/api/enums.api
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ enum VkStructureType {
VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR = 1000117002,
VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR = 1000117003,

//@extension("VK_KHR_maintenance3")
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR = 1000168000,
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR = 1000168001,

// Vulkan 1.1 core
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = 1000094000,
VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO = 1000157000,
Expand Down
6 changes: 6 additions & 0 deletions gapis/api/vulkan/api/physical_device.api
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

// Vulkan 1.1 core
@unused ref!PointClippingProperties PointClippingProperties
@unused ref!Maintenance3Properties Maintenance3Properties
}

@internal class PhysicalDevicesAndProperties {
Expand Down Expand Up @@ -121,4 +122,9 @@ cmd VkResult vkEnumeratePhysicalDevices(

@internal class PointClippingProperties {
VkPointClippingBehavior PointClippingBehavior
}

@internal class Maintenance3Properties {
u32 MaxPerSetDescriptors
VkDeviceSize MaxMemoryAllocationSize
}
10 changes: 10 additions & 0 deletions gapis/api/vulkan/api/properties_features_requirements.api
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ sub void GetPhysicalDeviceProperties2(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: {
_ = as!VkPhysicalDevicePointClippingProperties*(next.Ptr)[0]
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: {
_ = as!VkPhysicalDeviceMaintenance3Properties*(next.Ptr)[0]
}
}
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
Expand Down Expand Up @@ -477,6 +480,13 @@ sub void GetPhysicalDeviceProperties2(
PointClippingBehavior: ext.pointClippingBehavior
)
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES: {
ext := as!VkPhysicalDeviceMaintenance3Properties*(next.Ptr)[0]
phyDev.Maintenance3Properties = new!Maintenance3Properties(
MaxPerSetDescriptors: ext.maxPerSetDescriptors,
MaxMemoryAllocationSize: ext.maxMemoryAllocationSize,
)
}
}
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
Expand Down
1 change: 1 addition & 0 deletions gapis/api/vulkan/vulkan.api
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ sub ref!ExtensionSet supportedDeviceExtensions() {
supported.ExtensionNames["VK_KHR_16bit_storage"] = true
supported.ExtensionNames["VK_KHR_maintenance1"] = true
supported.ExtensionNames["VK_KHR_maintenance2"] = true
supported.ExtensionNames["VK_KHR_maintenance3"] = true
return supported
}

Expand Down

0 comments on commit b71fb57

Please sign in to comment.