From d5ce78232c94ebf461008a8faabd420a54c6adde Mon Sep 17 00:00:00 2001 From: Qining Lu Date: Tue, 18 Dec 2018 15:39:32 -0500 Subject: [PATCH] Vulkan: A list of low hang extensions toward Vulkan 1.1 support * VK_KHR_bind_memory2 * VK_KHR_variable_pointers * VK_KHR_16bit_storage And pure shader extensions (just need to add to the list of supported extensions) * VK_KHR_shader_draw_parameters * VK_KHR_relaxed_block-layout * VK_KHR_storage_buffer_storage_class --- gapil/template/constant_sets.go | 8 +- gapis/api/vulkan/api/bitfields.api | 5 + gapis/api/vulkan/api/buffer.api | 79 +++++++-- gapis/api/vulkan/api/device.api | 35 +++- gapis/api/vulkan/api/enums.api | 14 ++ gapis/api/vulkan/api/image.api | 167 ++++++++++++------ gapis/api/vulkan/api/memory.api | 1 + .../api/properties_features_requirements.api | 66 ++++++- .../khr_get_physical_device_properties2.api | 24 +-- gapis/api/vulkan/vulkan.api | 6 + 10 files changed, 310 insertions(+), 95 deletions(-) diff --git a/gapil/template/constant_sets.go b/gapil/template/constant_sets.go index 934cc4d27a..3f6a027fcb 100644 --- a/gapil/template/constant_sets.go +++ b/gapil/template/constant_sets.go @@ -185,10 +185,10 @@ func buildConstantSets(api *semantic.API, mappings *semantic.Mappings) *Constant if !ok { panic(fmt.Sprintf("Unsupported enum number type: %v", e.NumberType)) } - if l, ok := labels[value]; ok { - panic(fmt.Sprintf("Enum %v has multiple labels for value %v: %v, %v", - e.Named, value, l, entry.Named)) - } + // In cases a constant value has multiple labels (multiple + // labels defining the same constant value in the same enum), + // the last label will be adopted as the name of the constant + // value. labels[value] = string(entry.Named) } constsets[e] = b.addLabels(labels, e.IsBitfield) diff --git a/gapis/api/vulkan/api/bitfields.api b/gapis/api/vulkan/api/bitfields.api index c215938d13..e72aa7aeca 100644 --- a/gapis/api/vulkan/api/bitfields.api +++ b/gapis/api/vulkan/api/bitfields.api @@ -57,6 +57,7 @@ bitfield VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, /// Format can be used as the destination image of blits with vkCommandBlitImage VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, + //@extension("VK_KHR_maintenance1") VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000, VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000, // Vulkan 1.1 core @@ -94,6 +95,10 @@ bitfield VkImageCreateFlagBits { VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, /// Image should support constent data access to physical memory blocks mapped into multiple locations of sparse images VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, /// Allows image views to have different format than the base image VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, /// Allows creating image views with cube type from the created image + + //@extension("VK_KHR_maintenance1") + VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = 0x00000020, + // Vulkan 1.1 core VK_IMAGE_CREATE_ALIAS_BIT = 0x00000400, VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT = 0x00000040, diff --git a/gapis/api/vulkan/api/buffer.api b/gapis/api/vulkan/api/buffer.api index 31c9d50c98..9b183899cd 100644 --- a/gapis/api/vulkan/api/buffer.api +++ b/gapis/api/vulkan/api/buffer.api @@ -59,6 +59,7 @@ @untracked @unused ref!QueueObject LastBoundQueue @unused ref!VulkanDebugMarkerInfo DebugInfo VkMemoryRequirements MemoryRequirements + // Vulkan 1.1 promoted from extension: VK_KHR_dedicated_allocation ref!DedicatedRequirements DedicatedRequirements } @@ -238,6 +239,29 @@ cmd void vkDestroyBufferView( } } +sub void BindBufferMemory( + VkBuffer buffer, + VkDeviceMemory memory, + VkDeviceSize memoryOffset) { + if !(memory in DeviceMemories) { + vkErrorInvalidDeviceMemory(memory) + } else { + if !(buffer in Buffers) { + vkErrorInvalidBuffer(buffer) + } else { + Buffers[buffer].Memory = DeviceMemories[memory] + Buffers[buffer].MemoryOffset = memoryOffset + DeviceMemories[memory].BoundObjects[as!u64(buffer)] = memoryOffset + if (Buffers[buffer].Info.DedicatedAllocationNV != null) && (DeviceMemories[memory].DedicatedAllocationNV == null) { + vkErrorExpectNVDedicatedlyAllocatedHandle("VkBuffer", as!u64(buffer)) + } + if (Buffers[buffer].Info.DedicatedAllocationNV == null) && (DeviceMemories[memory].DedicatedAllocationNV != null) { + vkErrorExpectNVDedicatedlyAllocatedHandle("VkDeviceMemory", as!u64(memory)) + } + } + } +} + @indirect("VkDevice") cmd VkResult vkBindBufferMemory( VkDevice device, @@ -245,17 +269,50 @@ cmd VkResult vkBindBufferMemory( VkDeviceMemory memory, VkDeviceSize memoryOffset) { if !(device in Devices) { vkErrorInvalidDevice(device) } - if !(memory in DeviceMemories) { vkErrorInvalidDeviceMemory(memory) } - if !(buffer in Buffers) { vkErrorInvalidBuffer(buffer) } - Buffers[buffer].Memory = DeviceMemories[memory] - Buffers[buffer].MemoryOffset = memoryOffset - DeviceMemories[memory].BoundObjects[as!u64(buffer)] = memoryOffset - if (Buffers[buffer].Info.DedicatedAllocationNV != null) && (DeviceMemories[memory].DedicatedAllocationNV == null) { - vkErrorExpectNVDedicatedlyAllocatedHandle("VkBuffer", as!u64(buffer)) - } - if (Buffers[buffer].Info.DedicatedAllocationNV == null) && (DeviceMemories[memory].DedicatedAllocationNV != null) { - vkErrorExpectNVDedicatedlyAllocatedHandle("VkDeviceMemory", as!u64(memory)) - } + BindBufferMemory(buffer, memory, memoryOffset) return ? } +// ---------------------------------------------------------------------------- +// Vulkan 1.1 Commands +// ---------------------------------------------------------------------------- + +//////////// +// Buffer // +//////////// + +sub void BindBufferMemory2( + VkDevice device, + u32 bindInfoCount, + const VkBindBufferMemoryInfo* pBindInfos) { + if !(device in Devices) { vkErrorInvalidDevice(device) } + if pBindInfos == null { + vkErrorNullPointer("VkBindBufferMemoryInfo(KHR)") + } else { + infos := pBindInfos[0:bindInfoCount] + for i in (0 .. bindInfoCount) { + info := infos[i] + // handle pNext + if info.pNext != null { + numPNext := numberOfPNext(info.pNext) + next := MutableVoidPtr(as!void*(info.pNext)) + for i in (0 .. numPNext) { + sType := as!const VkStructureType*(next.Ptr)[0:1][0] + _ = sType + // TODO: handle extensions for VkBindBufferMemoryInfo + next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext + } + } + BindBufferMemory(info.buffer, info.memory, info.memoryOffset) + } + } +} + +@indirect("VkDevice") +cmd VkResult vkBindBufferMemory2( + VkDevice device, + u32 bindInfoCount, + const VkBindBufferMemoryInfo* pBindInfos) { + BindBufferMemory2(device, bindInfoCount, pBindInfos) + return ? +} diff --git a/gapis/api/vulkan/api/device.api b/gapis/api/vulkan/api/device.api index 10c0d42284..4e4833f678 100644 --- a/gapis/api/vulkan/api/device.api +++ b/gapis/api/vulkan/api/device.api @@ -51,6 +51,10 @@ @unused VkPhysicalDeviceFeatures EnabledFeatures @unused VkDevice VulkanHandle @unused ref!VulkanDebugMarkerInfo DebugInfo + + // Vulkan 1.1 + @unused ref!VariablePointerFeatures VariablePointerFeatures + @unused ref!HalfPrecisionStorageFeatures HalfPrecisionStorageFeatures } @indirect("VkDevice") @@ -135,7 +139,24 @@ sub ref!DeviceObject createDeviceObject(const VkDeviceCreateInfo* data) { next := MutableVoidPtr(as!void*(info.pNext)) for i in (0 .. numPNext) { sType := as!const VkStructureType*(next.Ptr)[0:1][0] - _ = sType + switch sType { + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: { + ext := as!VkPhysicalDeviceVariablePointerFeatures*(next.Ptr)[0] + object.VariablePointerFeatures = new!VariablePointerFeatures( + VariablePointerStorageBuffer: ext.variablePointersStorageBuffer, + VariablePointers: ext.variablePointers) + } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: { + ext := as!VkPhysicalDevice16BitStorageFeatures*(next.Ptr)[0] + object.HalfPrecisionStorageFeatures = new!HalfPrecisionStorageFeatures(StorageBuffer16BitAccess: ext.storageBuffer16BitAccess, + UniformAndStorageBuffer16BitAccess: ext.uniformAndStorageBuffer16BitAccess, + StoragePushConstant16: ext.storagePushConstant16, + StorageInputOutput16: ext.storageInputOutput16) + } + default: { + // do nothing + } + } // TODO: handle extensions for VkDeviceCreateInfo next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext } @@ -185,3 +206,15 @@ sub ref!DeviceObject createDeviceObject(const VkDeviceCreateInfo* data) { return object } + +@internal class VariablePointerFeatures { + VkBool32 VariablePointerStorageBuffer + VkBool32 VariablePointers +} + +@internal class HalfPrecisionStorageFeatures{ + VkBool32 StorageBuffer16BitAccess + VkBool32 UniformAndStorageBuffer16BitAccess + VkBool32 StoragePushConstant16 + VkBool32 StorageInputOutput16 +} \ No newline at end of file diff --git a/gapis/api/vulkan/api/enums.api b/gapis/api/vulkan/api/enums.api index a09cf601e3..28cb5484f7 100644 --- a/gapis/api/vulkan/api/enums.api +++ b/gapis/api/vulkan/api/enums.api @@ -83,8 +83,12 @@ enum VkResult { //@extension("VK_EXT_debug_report") VK_ERROR_VALIDATION_FAILED_EXT = 0xC4650B07, // -1000011001 + //@extension("VK_NV_glsl_shader") VK_ERROR_INVALID_SHADER_NV = 0x3B9AF8E0, // -1000012000 + //@extension("VK_KHR_maintenance1") + VK_ERROR_OUT_OF_POOL_MEMORY_KHR = 0xC4642878, // -1000069000 + // Vulkan 1.1 core VK_ERROR_OUT_OF_POOL_MEMORY = 0xC4642878, // -1000069000 VK_ERROR_INVALID_EXTERNAL_HANDLE = 0xC4641CBD, // -1000072003 @@ -215,6 +219,16 @@ enum VkStructureType { VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, + //@extension("VK_KHR_bind_memory2") + VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR = 1000157000, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = 1000157001, + + //@extension("VK_KHR_variable_pointers") + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000, + + //@extension("VK_KHR_16bit_storage") + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = 1000083000, + // Vulkan 1.1 core VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = 1000094000, VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO = 1000157000, diff --git a/gapis/api/vulkan/api/image.api b/gapis/api/vulkan/api/image.api index dfb183ca88..a982a1b459 100644 --- a/gapis/api/vulkan/api/image.api +++ b/gapis/api/vulkan/api/image.api @@ -73,6 +73,7 @@ @unused ref!VulkanDebugMarkerInfo DebugInfo VkMemoryRequirements MemoryRequirements map!(u32, VkSparseImageMemoryRequirements) SparseMemoryRequirements + // Vulkan 1.1 promoted from extension: VK_KHR_dedicated_allocation ref!DedicatedRequirements DedicatedRequirements // If ever layer/level is set to the same queue, then set it here instead. // This can save expensive looping through Aspects/Layers/Levels @@ -320,70 +321,82 @@ cmd void vkGetImageSubresourceLayout( pLayout[0] = ? } -@indirect("VkDevice") -cmd VkResult vkBindImageMemory( - VkDevice device, +sub void BindImageMemory( VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) { - if !(device in Devices) { vkErrorInvalidDevice(device) } - if !(memory in DeviceMemories) { vkErrorInvalidDeviceMemory(memory) } - if !(image in Images) { vkErrorInvalidImage(image) } else { - imageObject := Images[image] - imageObject.BoundMemory = DeviceMemories[memory] - imageObject.BoundMemoryOffset = memoryOffset - DeviceMemories[memory].BoundObjects[as!u64(image)] = memoryOffset - - for _ , _ , aspectBit in unpackImageAspectFlags(imageObject.ImageAspect) { - aspect := imageObject.Aspects[aspectBit] - for j in (0 .. imageObject.Info.ArrayLayers) { - for i in (0 .. imageObject.Info.MipLevels) { - level := aspect.Layers[j].Levels[i] - elementAndTexelBlockSize := getElementAndTexelBlockSize(imageObject.Info.Format) - depthElementSize := getDepthElementSize(imageObject.Info.Format, false) - // Roundup the width and height in the number of blocks. - widthInBlocks := roundUpTo(level.Width, elementAndTexelBlockSize.TexelBlockSize.Width) - heightInBlocks := roundUpTo(level.Height, elementAndTexelBlockSize.TexelBlockSize.Height) - elementSize := switch (aspectBit) { - case VK_IMAGE_ASPECT_COLOR_BIT: - elementAndTexelBlockSize.ElementSize - case VK_IMAGE_ASPECT_DEPTH_BIT: - depthElementSize - case VK_IMAGE_ASPECT_STENCIL_BIT: - // stencil element is always 1 byte wide - as!u32(1) - } - tightlyPackedSize := widthInBlocks * heightInBlocks * level.Depth * elementSize - - // If the image has LINEAR tiling and the image level has layout - // PREINITIALIZED and size larger than our calculated tightly packed - // size, link the data back to the bound device memory. Otherwise - // creates its own shadow memory pool. - // TODO: If the image as a whole requires more memory than we - // calculated, we should link the data back to the bound device memory - // no matter whether the tiling is LINEAR or OPTIMAL. But we need to - // come up with a 'linear layout' in GAPID. - if (imageObject.Info.Tiling == VK_IMAGE_TILING_LINEAR) && - (level.Layout == VK_IMAGE_LAYOUT_PREINITIALIZED) && - (level.LinearLayout != null) && - (as!u64(level.LinearLayout.size) > as!u64(tightlyPackedSize)) { - loffset := as!u64(memoryOffset + level.LinearLayout.offset) - lsize := as!u64(level.LinearLayout.size) - level.Data = imageObject.BoundMemory.Data[loffset:loffset + lsize] - } else { - level.Data = make!u8(tightlyPackedSize) + if !(memory in DeviceMemories) { + vkErrorInvalidDeviceMemory(memory) + } else { + if !(image in Images) { + vkErrorInvalidImage(image) + } else { + imageObject := Images[image] + imageObject.BoundMemory = DeviceMemories[memory] + imageObject.BoundMemoryOffset = memoryOffset + DeviceMemories[memory].BoundObjects[as!u64(image)] = memoryOffset + + for _ , _ , aspectBit in unpackImageAspectFlags(imageObject.ImageAspect) { + aspect := imageObject.Aspects[aspectBit] + for j in (0 .. imageObject.Info.ArrayLayers) { + for i in (0 .. imageObject.Info.MipLevels) { + level := aspect.Layers[j].Levels[i] + elementAndTexelBlockSize := getElementAndTexelBlockSize(imageObject.Info.Format) + depthElementSize := getDepthElementSize(imageObject.Info.Format, false) + // Roundup the width and height in the number of blocks. + widthInBlocks := roundUpTo(level.Width, elementAndTexelBlockSize.TexelBlockSize.Width) + heightInBlocks := roundUpTo(level.Height, elementAndTexelBlockSize.TexelBlockSize.Height) + elementSize := switch (aspectBit) { + case VK_IMAGE_ASPECT_COLOR_BIT: + elementAndTexelBlockSize.ElementSize + case VK_IMAGE_ASPECT_DEPTH_BIT: + depthElementSize + case VK_IMAGE_ASPECT_STENCIL_BIT: + // stencil element is always 1 byte wide + as!u32(1) + } + tightlyPackedSize := widthInBlocks * heightInBlocks * level.Depth * elementSize + + // If the image has LINEAR tiling and the image level has layout + // PREINITIALIZED and size larger than our calculated tightly packed + // size, link the data back to the bound device memory. Otherwise + // creates its own shadow memory pool. + // TODO: If the image as a whole requires more memory than we + // calculated, we should link the data back to the bound device memory + // no matter whether the tiling is LINEAR or OPTIMAL. But we need to + // come up with a 'linear layout' in GAPID. + if (imageObject.Info.Tiling == VK_IMAGE_TILING_LINEAR) && + (level.Layout == VK_IMAGE_LAYOUT_PREINITIALIZED) && + (level.LinearLayout != null) && + (as!u64(level.LinearLayout.size) > as!u64(tightlyPackedSize)) { + loffset := as!u64(memoryOffset + level.LinearLayout.offset) + lsize := as!u64(level.LinearLayout.size) + level.Data = imageObject.BoundMemory.Data[loffset:loffset + lsize] + } else { + level.Data = make!u8(tightlyPackedSize) + } } } } - } - if (Images[image].Info.DedicatedAllocationNV != null) && (DeviceMemories[memory].DedicatedAllocationNV == null) { - vkErrorExpectNVDedicatedlyAllocatedHandle("VkImage", as!u64(image)) - } - if (Images[image].Info.DedicatedAllocationNV == null) && (DeviceMemories[memory].DedicatedAllocationNV != null) { - vkErrorExpectNVDedicatedlyAllocatedHandle("VkDeviceMemory", as!u64(memory)) + if (Images[image].Info.DedicatedAllocationNV != null) && (DeviceMemories[memory].DedicatedAllocationNV == null) { + vkErrorExpectNVDedicatedlyAllocatedHandle("VkImage", as!u64(image)) + } + if (Images[image].Info.DedicatedAllocationNV == null) && (DeviceMemories[memory].DedicatedAllocationNV != null) { + vkErrorExpectNVDedicatedlyAllocatedHandle("VkDeviceMemory", as!u64(memory)) + } } } +} + +@indirect("VkDevice") +cmd VkResult vkBindImageMemory( + VkDevice device, + VkImage image, + VkDeviceMemory memory, + VkDeviceSize memoryOffset) { + if !(device in Devices) { vkErrorInvalidDevice(device) } + BindImageMemory(image, memory, memoryOffset) return ? } @@ -731,3 +744,47 @@ sub void transitionImageLayout(ref!ImageObject img, VkImageSubresourceRange rng, } } } + +// ---------------------------------------------------------------------------- +// Vulkan 1.1 Commands +// ---------------------------------------------------------------------------- + +/////////// +// Image // +/////////// + +sub void BindImageMemory2( + VkDevice device, + u32 bindInfoCount, + const VkBindImageMemoryInfo* pBindInfos) { + if !(device in Devices) { vkErrorInvalidDevice(device) } + if pBindInfos == null { + vkErrorNullPointer("VkBindImageMemoryInfo(KHR)") + } else { + infos := pBindInfos[0:bindInfoCount] + for i in (0 .. bindInfoCount) { + info := infos[i] + // handle pNext + if info.pNext != null { + numPNext := numberOfPNext(info.pNext) + next := MutableVoidPtr(as!void*(info.pNext)) + for i in (0 .. numPNext) { + sType := as!const VkStructureType*(next.Ptr)[0:1][0] + _ = sType + // TODO: handle extensions for VkBindImageMemoryInfo + next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext + } + } + BindImageMemory(info.image, info.memory, info.memoryOffset) + } + } +} + +@indirect("VkDevice") +cmd VkResult vkBindImageMemory2( + VkDevice device, + u32 bindInfoCount, + const VkBindImageMemoryInfo* pBindInfos) { + BindImageMemory2(device, bindInfoCount, pBindInfos) + return ? +} \ No newline at end of file diff --git a/gapis/api/vulkan/api/memory.api b/gapis/api/vulkan/api/memory.api index fd683aa93a..055fce2def 100644 --- a/gapis/api/vulkan/api/memory.api +++ b/gapis/api/vulkan/api/memory.api @@ -53,6 +53,7 @@ @hidden @nobox @internal u8[] Data @unused ref!VulkanDebugMarkerInfo DebugInfo ref!MemoryDedicatedAllocationInfo DedicatedAllocationNV + // Vulkan 1.1 promoted from extension: VK_KHR_dedicated_allocation ref!MemoryDedicatedAllocationInfo DedicatedAllocationKHR } diff --git a/gapis/api/vulkan/api/properties_features_requirements.api b/gapis/api/vulkan/api/properties_features_requirements.api index 71a6059cb2..72a40348a0 100644 --- a/gapis/api/vulkan/api/properties_features_requirements.api +++ b/gapis/api/vulkan/api/properties_features_requirements.api @@ -331,9 +331,31 @@ sub void GetPhysicalDeviceFeatures2( } else { if pFeatures == null { vkErrorNullPointer("VkPhysicalDeviceFeatures2(KHR)") - } else { - pFeatures[0] = ? - // TODO: handle pNext + } + } + fence + if (physicalDevice in PhysicalDevices) { + pFeatures[0] = ? + features := pFeatures[0] + // TODO: handle pNext + if features.pNext != null { + numPNext := numberOfPNext( + as!const void*(features.pNext)) + next := MutableVoidPtr(as!void*(features.pNext)) + for i in (0 .. numPNext) { + sType := as!const VkStructureType*(next.Ptr)[0:1][0] + switch sType { + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: { + ext := as!VkPhysicalDeviceVariablePointerFeatures*(next.Ptr)[0] + _ = ext + } + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: { + ext := as!VkPhysicalDevice16BitStorageFeatures*(next.Ptr)[0] + _ = ext + } + } + next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext + } } } } @@ -510,6 +532,44 @@ cmd void vkGetPhysicalDeviceSparseImageFormatProperties2( physicalDevice, pFormatInfo, pPropertyCount, pProperties) } +sub void GetPhysicalDeviceQueueFamilyProperties2( + VkPhysicalDevice physicalDevice, + u32* pQueueFamilyPropertyCount, + VkQueueFamilyProperties2* pQueueFamilyProperties) { + if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) } + if pQueueFamilyPropertyCount == null { vkErrorNullPointer("uint32_t") } + _ = pQueueFamilyPropertyCount[0] + + fence + + if pQueueFamilyProperties == null { + pQueueFamilyPropertyCount[0] = ? + } else { + count := as!u32(?) + properties := pQueueFamilyProperties[0:count] + for i in (0 .. count) { + properties[i] = ? + // TODO: handle pNext + } + pQueueFamilyPropertyCount[0] = count + if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) } + for i in (0 .. count) { + PhysicalDevices[physicalDevice].QueueFamilyProperties[i] = properties[i].queueFamilyProperties + } + } +} + +@threadSafety("system") +@indirect("VkPhysicalDevice", "VkInstance") +cmd void vkGetPhysicalDeviceQueueFamilyProperties2( + VkPhysicalDevice physicalDevice, + u32* pQueueFamilyPropertyCount, + VkQueueFamilyProperties2* pQueueFamilyProperties) { + GetPhysicalDeviceQueueFamilyProperties2( + physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties) +} + + //////////// // Buffer // //////////// diff --git a/gapis/api/vulkan/extensions/khr_get_physical_device_properties2.api b/gapis/api/vulkan/extensions/khr_get_physical_device_properties2.api index 68fed47dfb..bd2a018a65 100644 --- a/gapis/api/vulkan/extensions/khr_get_physical_device_properties2.api +++ b/gapis/api/vulkan/extensions/khr_get_physical_device_properties2.api @@ -166,27 +166,9 @@ cmd void vkGetPhysicalDeviceQueueFamilyProperties2KHR( VkPhysicalDevice physicalDevice, u32* pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR* pQueueFamilyProperties) { - if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) } - if pQueueFamilyPropertyCount == null { vkErrorNullPointer("uint32_t") } - _ = pQueueFamilyPropertyCount[0] - - fence - - if pQueueFamilyProperties == null { - pQueueFamilyPropertyCount[0] = ? - } else { - count := as!u32(?) - properties := pQueueFamilyProperties[0:count] - for i in (0 .. count) { - properties[i] = ? - // TODO: handle pNext - } - pQueueFamilyPropertyCount[0] = count - if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) } - for i in (0 .. count) { - PhysicalDevices[physicalDevice].QueueFamilyProperties[i] = properties[i].queueFamilyProperties - } - } + GetPhysicalDeviceQueueFamilyProperties2( + physicalDevice, pQueueFamilyPropertyCount, + as!VkQueueFamilyProperties2*(pQueueFamilyProperties)) } @threadSafety("system") diff --git a/gapis/api/vulkan/vulkan.api b/gapis/api/vulkan/vulkan.api index 544f937dd0..3ce142f881 100644 --- a/gapis/api/vulkan/vulkan.api +++ b/gapis/api/vulkan/vulkan.api @@ -205,6 +205,12 @@ sub ref!ExtensionSet supportedDeviceExtensions() { supported.ExtensionNames["VK_NV_dedicated_allocation"] = true supported.ExtensionNames["VK_KHR_get_memory_requirements2"] = true supported.ExtensionNames["VK_KHR_dedicated_allocation"] = true + supported.ExtensionNames["VK_KHR_bind_memory2"] = true + supported.ExtensionNames["VK_KHR_storage_buffer_storage_class"] = true + supported.ExtensionNames["VK_KHR_variable_pointers"] = true + supported.ExtensionNames["VK_KHR_shader_draw_parameters"] = true + supported.ExtensionNames["VK_KHR_relaxed_block_layout"] = true + supported.ExtensionNames["VK_KHR_16bit_storage"] = true return supported }