Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: Support for external memory/fence/semaphore capabilities #2511

Merged
merged 2 commits into from
Jan 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions gapis/api/vulkan/api/enums.api
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,21 @@ enum VkStructureType {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR = 1000168000,
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR = 1000168001,

//@extension("VK_KHR_external_memory_capabilities")
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = 1000071000,
VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = 1000071001,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = 1000071002,
VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = 1000071003,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = 1000071004,

//@extension("VK_KHR_external_semaphore_capabilities")
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = 1000076000,
VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = 1000076001,

//@extension("VK_KHR_external_fence_capabilities")
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = 1000112000,
VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = 1000112001,

// Vulkan 1.1 core
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = 1000094000,
VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO = 1000157000,
Expand Down
149 changes: 149 additions & 0 deletions gapis/api/vulkan/api/properties_features_requirements.api
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,155 @@ cmd void vkGetPhysicalDeviceQueueFamilyProperties2(
physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties)
}

sub void GetPhysicalDeviceExternalBufferProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo,
VkExternalBufferProperties* pExternalBufferProperties) {
if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) }
if pExternalBufferInfo == null {
vkErrorNullPointer("const VkPhysicalDeviceExternalBufferInfo")
} else {
info := pExternalBufferInfo[0]
// handle pNext in pExternalBufferInfo
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
// handle future extensions VkPhysicalDeviceExternalBufferInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}

fence

if pExternalBufferProperties == null { vkErrorNullPointer("VkExternalBufferProperties") }
pExternalBufferProperties[0] = ?
props := pExternalBufferProperties[0]
// handle pNext in pExternalBufferProperties
if props.pNext != null {
numPNext := numberOfPNext(as!const void*(props.pNext))
next := MutableVoidPtr(props.pNext)
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// handle future extensions for VkExternalBufferProperties
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}

@threadSafety("system")
@indirect("VkPhysicalDevice", "VkInstance")
cmd void vkGetPhysicalDeviceExternalBufferProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo,
VkExternalBufferProperties* pExternalBufferProperties) {
GetPhysicalDeviceExternalBufferProperties(
physicalDevice, pExternalBufferInfo, pExternalBufferProperties)
}

sub void GetPhysicalDeviceExternalSemaphoreProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo,
VkExternalSemaphoreProperties* pExternalSemaphoreProperties) {
if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) }
if pExternalSemaphoreInfo == null {
vkErrorNullPointer("const VkPhysicalDeviceExternalSemaphoreInfo")
} else {
info := pExternalSemaphoreInfo[0]
// handle pNext in pExternalSemaphoreInfo
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
// handle future extensions for VkPhysicalDeviceExternalSemaphoreInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}

fence

if pExternalSemaphoreProperties == null { vkErrorNullPointer("VkExternalBufferProperties") }
pExternalSemaphoreProperties[0] = ?
props := pExternalSemaphoreProperties[0]
// handle pNext in pExternalSemaphoreProperties
if props.pNext != null {
numPNext := numberOfPNext(as!const void*(props.pNext))
next := MutableVoidPtr(props.pNext)
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// handle future extensions for VkExternalSemaphoreProperties
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}

@threadSafety("system")
@indirect("VkPhysicalDevice", "VkInstance")
cmd void vkGetPhysicalDeviceExternalSemaphoreProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo,
VkExternalSemaphoreProperties* pExternalSemaphoreProperties) {
GetPhysicalDeviceExternalSemaphoreProperties(
physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties)
}

sub void GetPhysicalDeviceExternalFenceProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo,
VkExternalFenceProperties* pExternalFenceProperties) {
if !(physicalDevice in PhysicalDevices) { vkErrorInvalidPhysicalDevice(physicalDevice) }
if pExternalFenceInfo == null {
vkErrorNullPointer("const VkPhysicalDeviceExternalFenceInfo")
} else {
info := pExternalFenceInfo[0]
// handle pNext in pExternalFenceInfo
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
// handle future extensions for VkPhysicalDeviceExternalFenceInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}

fence

if pExternalFenceProperties == null { vkErrorNullPointer("VkExternalBufferProperties") }
pExternalFenceProperties[0] = ?
props := pExternalFenceProperties[0]
// handle pNext in pExternalFenceProperties
if props.pNext != null {
numPNext := numberOfPNext(as!const void*(props.pNext))
next := MutableVoidPtr(props.pNext)
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// handle future extensions for VkExternalFenceProperties
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}

@threadSafety("system")
@indirect("VkPhysicalDevice", "VkInstance")
cmd void vkGetPhysicalDeviceExternalFenceProperties(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo,
VkExternalFenceProperties* pExternalFenceProperties) {
GetPhysicalDeviceExternalFenceProperties(
physicalDevice, pExternalFenceInfo, pExternalFenceProperties)
}

////////////
// Buffer //
Expand Down
51 changes: 51 additions & 0 deletions gapis/api/vulkan/extensions/khr_16bit_storage.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (C) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Based off of the original vulkan.h header file which has the following
// license.

// Copyright (c) 2015 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and/or associated documentation files (the
// "Materials"), to deal in the Materials without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Materials, and to
// permit persons to whom the Materials are furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Materials.
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

/////////////
// Structs //
/////////////

@extension("VK_KHR_16bit_storage")
class VkPhysicalDevice16BitStorageFeaturesKHR{
VkStructureType sType
void* pNext
VkBool32 storageBuffer16BitAccess
VkBool32 uniformAndStorageBuffer16BitAccess
VkBool32 storagePushConstant16
VkBool32 storageInputOutput16
}
91 changes: 91 additions & 0 deletions gapis/api/vulkan/extensions/khr_bind_memory2.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright (C) 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Based off of the original vulkan.h header file which has the following
// license.

// Copyright (c) 2015 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and/or associated documentation files (the
// "Materials"), to deal in the Materials without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Materials, and to
// permit persons to whom the Materials are furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Materials.
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

///////////////
// Bitfields //
///////////////

// Updated in api/bitfields.api

/////////////
// Structs //
/////////////

@extension("VK_KHR_bind_memory2")
class VkBindBufferMemoryInfoKHR {
VkStructureType sType
const void* pNext
VkBuffer buffer
VkDeviceMemory memory
VkDeviceSize memoryOffset
}

@extension("VK_KHR_bind_memory2")
class VkBindImageMemoryInfoKHR {
VkStructureType sType
const void* pNext
VkImage image
VkDeviceMemory memory
VkDeviceSize memoryOffset
}

//////////////
// Commands //
//////////////

@extension("VK_KHR_bind_memory2")
@indirect("VkDevice")
cmd VkResult vkBindBufferMemory2KHR(
VkDevice device,
u32 bindInfoCount,
const VkBindBufferMemoryInfoKHR* pBindInfos) {
BindBufferMemory2(device, bindInfoCount,
as!const VkBindBufferMemoryInfo*(pBindInfos))
return ?
}

@extension("VK_KHR_bind_memory2")
@indirect("VkDevice")
cmd VkResult vkBindImageMemory2KHR(
VkDevice device,
u32 bindInfoCount,
const VkBindImageMemoryInfoKHR* pBindInfos) {
BindImageMemory2(device, bindInfoCount,
as!const VkBindImageMemoryInfo*(pBindInfos))
return ?
}
Loading