aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFslNopper <Norbert.Nopper@freescale.com>2015-05-14 09:47:05 +0200
committerFslNopper <Norbert.Nopper@freescale.com>2015-05-14 09:48:44 +0200
commit93e9d9bcc6624b6939421206a64180d35cd28ca8 (patch)
tree07e5e3fd420d38314685805328770ec41180a96a
parent4ca3cec22dbdd1f1b1a3eab5b2aa70477bef1c7c (diff)
parentdd87ec823847334730fe017c4efe2b3d9deac719 (diff)
downloadusermoji-93e9d9bcc6624b6939421206a64180d35cd28ca8.tar.xz
Merge branch 'master' of
https://gitlab.khronos.org/vulkan/LoaderAndTools.git
-rw-r--r--demos/cube.c19
-rw-r--r--demos/tri.c16
-rw-r--r--icd/nulldrv/nulldrv.c23
-rw-r--r--include/vkLayer.h8
-rw-r--r--include/vulkan.h46
-rw-r--r--layers/CMakeLists.txt1
-rwxr-xr-xlayers/draw_state.cpp17
-rw-r--r--layers/glave_snapshot.c8
-rw-r--r--layers/mem_tracker.cpp58
-rw-r--r--layers/object_track.h1
-rw-r--r--layers/param_checker.cpp28
-rw-r--r--layers/shader_checker.cpp63
-rw-r--r--layers/spirv/spirv.h1898
-rw-r--r--loader/CMakeLists.txt23
-rw-r--r--loader/gpa_helper.h339
-rw-r--r--loader/loader.c15
-rw-r--r--loader/table_ops.h431
-rw-r--r--loader/trampoline.c1150
-rw-r--r--loader/vulkan.def157
-rwxr-xr-xvk-generate.py11
-rwxr-xr-xvk-layer-generate.py350
-rwxr-xr-xvulkan.py22
22 files changed, 3616 insertions, 1068 deletions
diff --git a/demos/cube.c b/demos/cube.c
index d879800e..9784e680 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -699,7 +699,7 @@ static void demo_prepare_depth(struct demo *demo)
assert(!err);
/* bind memory */
- err = vkQueueBindObjectMemory(demo->queue,
+ err = vkBindObjectMemory(demo->device,
VK_OBJECT_TYPE_IMAGE, demo->depth.image,
i, demo->depth.mem[i], 0);
assert(!err);
@@ -942,7 +942,7 @@ static void demo_prepare_texture_image(struct demo *demo,
assert(!err);
/* bind memory */
- err = vkQueueBindObjectMemory(demo->queue,
+ err = vkBindObjectMemory(demo->device,
VK_OBJECT_TYPE_IMAGE, tex_obj->image,
j, tex_obj->mem[j], 0);
assert(!err);
@@ -991,7 +991,7 @@ static void demo_destroy_texture_image(struct demo *demo, struct texture_object
{
/* clean up staging resources */
for (uint32_t j = 0; j < tex_objs->num_mem; j ++) {
- vkQueueBindObjectMemory(demo->queue,
+ vkBindObjectMemory(demo->device,
VK_OBJECT_TYPE_IMAGE, tex_objs->image, j, VK_NULL_HANDLE, 0);
vkFreeMemory(demo->device, tex_objs->mem[j]);
}
@@ -1179,7 +1179,7 @@ void demo_prepare_cube_data_buffer(struct demo *demo)
err = vkUnmapMemory(demo->device, demo->uniform_data.mem[i]);
assert(!err);
- err = vkQueueBindObjectMemory(demo->queue,
+ err = vkBindObjectMemory(demo->device,
VK_OBJECT_TYPE_BUFFER, demo->uniform_data.buf,
i, demo->uniform_data.mem[i], 0);
assert(!err);
@@ -1953,10 +1953,9 @@ static void demo_init_vk(struct demo *demo)
// Graphics queue and MemMgr queue can be separate.
// TODO: Add support for separate queues, including synchronization,
- // and appropriate tracking for QueueSubmit and QueueBindObjectMemory
+ // and appropriate tracking for QueueSubmit
for (i = 0; i < queue_count; i++) {
- if ((demo->queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) &&
- (demo->queue_props[i].queueFlags & VK_QUEUE_MEMMGR_BIT) )
+ if (demo->queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
break;
}
assert(i < queue_count);
@@ -2051,7 +2050,7 @@ static void demo_cleanup(struct demo *demo)
for (i = 0; i < DEMO_TEXTURE_COUNT; i++) {
vkDestroyObject(demo->device, VK_OBJECT_TYPE_IMAGE_VIEW, demo->textures[i].view);
- vkQueueBindObjectMemory(demo->queue, VK_OBJECT_TYPE_IMAGE, demo->textures[i].image, 0, VK_NULL_HANDLE, 0);
+ vkBindObjectMemory(demo->device, VK_OBJECT_TYPE_IMAGE, demo->textures[i].image, 0, VK_NULL_HANDLE, 0);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_IMAGE, demo->textures[i].image);
for (j = 0; j < demo->textures[i].num_mem; j++)
vkFreeMemory(demo->device, demo->textures[i].mem[j]);
@@ -2061,14 +2060,14 @@ static void demo_cleanup(struct demo *demo)
vkDestroySwapChainWSI(demo->swap_chain);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW, demo->depth.view);
- vkQueueBindObjectMemory(demo->queue, VK_OBJECT_TYPE_IMAGE, demo->depth.image, 0, VK_NULL_HANDLE, 0);
+ vkBindObjectMemory(demo->device, VK_OBJECT_TYPE_IMAGE, demo->depth.image, 0, VK_NULL_HANDLE, 0);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_IMAGE, demo->depth.image);
for (j = 0; j < demo->depth.num_mem; j++) {
vkFreeMemory(demo->device, demo->depth.mem[j]);
}
vkDestroyObject(demo->device, VK_OBJECT_TYPE_BUFFER_VIEW, demo->uniform_data.view);
- vkQueueBindObjectMemory(demo->queue, VK_OBJECT_TYPE_BUFFER, demo->uniform_data.buf, 0, VK_NULL_HANDLE, 0);
+ vkBindObjectMemory(demo->device, VK_OBJECT_TYPE_BUFFER, demo->uniform_data.buf, 0, VK_NULL_HANDLE, 0);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_BUFFER, demo->uniform_data.buf);
for (j = 0; j < demo->uniform_data.num_mem; j++)
vkFreeMemory(demo->device, demo->uniform_data.mem[j]);
diff --git a/demos/tri.c b/demos/tri.c
index 58d19a24..625036b8 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -497,7 +497,7 @@ static void demo_prepare_depth(struct demo *demo)
assert(!err);
/* bind memory */
- err = vkQueueBindObjectMemory(demo->queue,
+ err = vkBindObjectMemory(demo->device,
VK_OBJECT_TYPE_IMAGE, demo->depth.image,
i, demo->depth.mem[i], 0);
assert(!err);
@@ -580,7 +580,7 @@ static void demo_prepare_texture_image(struct demo *demo,
assert(!err);
/* bind memory */
- err = vkQueueBindObjectMemory(demo->queue,
+ err = vkBindObjectMemory(demo->device,
VK_OBJECT_TYPE_IMAGE, tex_obj->image,
j, tex_obj->mem[j], 0);
assert(!err);
@@ -632,7 +632,7 @@ static void demo_destroy_texture_image(struct demo *demo, struct texture_object
{
/* clean up staging resources */
for (uint32_t j = 0; j < tex_obj->num_mem; j ++) {
- vkQueueBindObjectMemory(demo->queue,
+ vkBindObjectMemory(demo->device,
VK_OBJECT_TYPE_IMAGE, tex_obj->image, j, VK_NULL_HANDLE, 0);
vkFreeMemory(demo->device, tex_obj->mem[j]);
}
@@ -811,7 +811,7 @@ static void demo_prepare_vertices(struct demo *demo)
err = vkUnmapMemory(demo->device, demo->vertices.mem[i]);
assert(!err);
- err = vkQueueBindObjectMemory(demo->queue,
+ err = vkBindObjectMemory(demo->device,
VK_OBJECT_TYPE_BUFFER, demo->vertices.buf,
i, demo->vertices.mem[i], 0);
assert(!err);
@@ -1453,8 +1453,6 @@ static void demo_init_vk(struct demo *demo)
for (i = 0; i < queue_count; i++) {
if (demo->queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
break;
- if (demo->queue_props[i].queueFlags & VK_QUEUE_MEMMGR_BIT)
- break;
}
assert(i < queue_count);
demo->graphics_queue_node_index = i;
@@ -1549,14 +1547,14 @@ static void demo_cleanup(struct demo *demo)
vkDestroyObject(demo->device, VK_OBJECT_TYPE_PIPELINE_LAYOUT, demo->pipeline_layout);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT, demo->desc_layout);
- vkQueueBindObjectMemory(demo->queue, VK_OBJECT_TYPE_BUFFER, demo->vertices.buf, 0, VK_NULL_HANDLE, 0);
+ vkBindObjectMemory(demo->device, VK_OBJECT_TYPE_BUFFER, demo->vertices.buf, 0, VK_NULL_HANDLE, 0);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_BUFFER, demo->vertices.buf);
for (j = 0; j < demo->vertices.num_mem; j++)
vkFreeMemory(demo->device, demo->vertices.mem[j]);
for (i = 0; i < DEMO_TEXTURE_COUNT; i++) {
vkDestroyObject(demo->device, VK_OBJECT_TYPE_IMAGE_VIEW, demo->textures[i].view);
- vkQueueBindObjectMemory(demo->queue, VK_OBJECT_TYPE_IMAGE, demo->textures[i].image, 0, VK_NULL_HANDLE, 0);
+ vkBindObjectMemory(demo->device, VK_OBJECT_TYPE_IMAGE, demo->textures[i].image, 0, VK_NULL_HANDLE, 0);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_IMAGE, demo->textures[i].image);
for (j = 0; j < demo->textures[i].num_mem; j++)
vkFreeMemory(demo->device, demo->textures[i].mem[j]);
@@ -1565,7 +1563,7 @@ static void demo_cleanup(struct demo *demo)
}
vkDestroyObject(demo->device, VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW, demo->depth.view);
- vkQueueBindObjectMemory(demo->queue, VK_OBJECT_TYPE_IMAGE, demo->depth.image, 0, VK_NULL_HANDLE, 0);
+ vkBindObjectMemory(demo->device, VK_OBJECT_TYPE_IMAGE, demo->depth.image, 0, VK_NULL_HANDLE, 0);
vkDestroyObject(demo->device, VK_OBJECT_TYPE_IMAGE, demo->depth.image);
for (j = 0; j < demo->depth.num_mem; j++) {
vkFreeMemory(demo->device, demo->depth.mem[j]);
diff --git a/icd/nulldrv/nulldrv.c b/icd/nulldrv/nulldrv.c
index b7e42dd0..d6472c85 100644
--- a/icd/nulldrv/nulldrv.c
+++ b/icd/nulldrv/nulldrv.c
@@ -1054,16 +1054,6 @@ ICD_EXPORT void VKAPI vkCmdCopyImageToBuffer(
NULLDRV_LOG_FUNC;
}
-ICD_EXPORT void VKAPI vkCmdCloneImageData(
- VkCmdBuffer cmdBuffer,
- VkImage srcImage,
- VkImageLayout srcImageLayout,
- VkImage destImage,
- VkImageLayout destImageLayout)
-{
- NULLDRV_LOG_FUNC;
-}
-
ICD_EXPORT void VKAPI vkCmdUpdateBuffer(
VkCmdBuffer cmdBuffer,
VkBuffer destBuffer,
@@ -1527,7 +1517,7 @@ ICD_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(
if (pData == NULL) {
return ret;
}
- props->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_MEMMGR_BIT;
+ props->queueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_SPARSE_MEMMGR_BIT;
props->queueCount = 1;
props->maxAtomicCounters = 1;
props->supportsTimestamps = false;
@@ -1878,8 +1868,8 @@ ICD_EXPORT VkResult VKAPI vkGetObjectInfo(
return base->get_info(base, infoType, pDataSize, pData);
}
-ICD_EXPORT VkResult VKAPI vkQueueBindObjectMemory(
- VkQueue queue,
+ICD_EXPORT VkResult VKAPI vkBindObjectMemory(
+ VkDevice device,
VkObjectType objType,
VkObject object,
uint32_t allocationIdx,
@@ -1890,10 +1880,9 @@ ICD_EXPORT VkResult VKAPI vkQueueBindObjectMemory(
return VK_SUCCESS;
}
-ICD_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(
+ICD_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
VkQueue queue,
- VkObjectType objType,
- VkObject object,
+ VkBuffer buffer,
uint32_t allocationIdx,
VkDeviceSize rangeOffset,
VkDeviceSize rangeSize,
@@ -1904,7 +1893,7 @@ ICD_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(
return VK_SUCCESS;
}
-ICD_EXPORT VkResult VKAPI vkQueueBindImageMemoryRange(
+ICD_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(
VkQueue queue,
VkImage image,
uint32_t allocationIdx,
diff --git a/include/vkLayer.h b/include/vkLayer.h
index e95811b8..7239ba55 100644
--- a/include/vkLayer.h
+++ b/include/vkLayer.h
@@ -26,6 +26,7 @@ typedef struct VkBaseLayerObject_
typedef struct VkLayerDispatchTable_
{
PFN_vkGetProcAddr GetProcAddr;
+ PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
PFN_vkCreateInstance CreateInstance;
PFN_vkDestroyInstance DestroyInstance;
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
@@ -54,9 +55,9 @@ typedef struct VkLayerDispatchTable_
PFN_vkOpenPeerImage OpenPeerImage;
PFN_vkDestroyObject DestroyObject;
PFN_vkGetObjectInfo GetObjectInfo;
- PFN_vkQueueBindObjectMemory QueueBindObjectMemory;
- PFN_vkQueueBindObjectMemoryRange QueueBindObjectMemoryRange;
- PFN_vkQueueBindImageMemoryRange QueueBindImageMemoryRange;
+ PFN_vkBindObjectMemory BindObjectMemory;
+ PFN_vkQueueBindSparseBufferMemory QueueBindSparseBufferMemory;
+ PFN_vkQueueBindSparseImageMemory QueueBindSparseImageMemory;
PFN_vkCreateFence CreateFence;
PFN_vkGetFenceStatus GetFenceStatus;
PFN_vkResetFences ResetFences;
@@ -119,7 +120,6 @@ typedef struct VkLayerDispatchTable_
PFN_vkCmdBlitImage CmdBlitImage;
PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
- PFN_vkCmdCloneImageData CmdCloneImageData;
PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
PFN_vkCmdFillBuffer CmdFillBuffer;
PFN_vkCmdClearColorImage CmdClearColorImage;
diff --git a/include/vulkan.h b/include/vulkan.h
index 00ebbf51..8829222f 100644
--- a/include/vulkan.h
+++ b/include/vulkan.h
@@ -33,7 +33,7 @@
#include "vk_platform.h"
// Vulkan API version supported by this file
-#define VK_API_VERSION VK_MAKE_VERSION(0, 93, 0)
+#define VK_API_VERSION VK_MAKE_VERSION(0, 93, 1)
#ifdef __cplusplus
extern "C"
@@ -970,7 +970,7 @@ typedef enum VkQueueFlagBits_
VK_QUEUE_GRAPHICS_BIT = VK_BIT(0), // Queue supports graphics operations
VK_QUEUE_COMPUTE_BIT = VK_BIT(1), // Queue supports compute operations
VK_QUEUE_DMA_BIT = VK_BIT(2), // Queue supports DMA operations
- VK_QUEUE_MEMMGR_BIT = VK_BIT(3), // Queue supports memory management operations
+ VK_QUEUE_SPARSE_MEMMGR_BIT = VK_BIT(3), // Queue supports sparse resource memory management operations
VK_QUEUE_EXTENDED_BIT = VK_BIT(30), // Extended queue
} VkQueueFlagBits;
@@ -1071,11 +1071,10 @@ typedef VkFlags VkImageCreateFlags;
typedef enum VkImageCreateFlagBits_
{
VK_IMAGE_CREATE_INVARIANT_DATA_BIT = VK_BIT(0),
- VK_IMAGE_CREATE_CLONEABLE_BIT = VK_BIT(1),
- VK_IMAGE_CREATE_SHAREABLE_BIT = VK_BIT(2), // Image should be shareable
- VK_IMAGE_CREATE_SPARSE_BIT = VK_BIT(3), // Image should support sparse backing
- VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = VK_BIT(4), // Allows image views to have different format than the base image
- VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = VK_BIT(5), // Allows creating image views with cube type from the created image
+ VK_IMAGE_CREATE_SHAREABLE_BIT = VK_BIT(1), // Image should be shareable
+ VK_IMAGE_CREATE_SPARSE_BIT = VK_BIT(2), // Image should support sparse backing
+ VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = VK_BIT(3), // Allows image views to have different format than the base image
+ VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = VK_BIT(4), // Allows creating image views with cube type from the created image
} VkImageCreateFlagBits;
// Depth-stencil view creation flags
@@ -1402,7 +1401,7 @@ typedef struct VkMemoryRequirements_
{
VkDeviceSize size; // Specified in bytes
VkDeviceSize alignment; // Specified in bytes
- VkDeviceSize granularity; // Granularity on which vkQueueBindObjectMemoryRange can bind sub-ranges of memory specified in bytes (usually the page size)
+ VkDeviceSize granularity; // Granularity at which memory can be bound to resource sub-ranges specified in bytes (usually the page size)
VkMemoryPropertyFlags memPropsAllowed; // Allowed memory property flags
VkMemoryPropertyFlags memPropsRequired; // Required memory property flags
} VkMemoryRequirements;
@@ -2136,6 +2135,7 @@ typedef VkResult (VKAPI *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCrea
typedef VkResult (VKAPI *PFN_vkDestroyInstance)(VkInstance instance);
typedef VkResult (VKAPI *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceInfo)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData);
+typedef void * (VKAPI *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char * pName);
typedef void * (VKAPI *PFN_vkGetProcAddr)(VkPhysicalDevice physicalDevice, const char * pName);
typedef VkResult (VKAPI *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice);
typedef VkResult (VKAPI *PFN_vkDestroyDevice)(VkDevice device);
@@ -2161,9 +2161,9 @@ typedef VkResult (VKAPI *PFN_vkOpenPeerMemory)(VkDevice device, const VkPeerMemo
typedef VkResult (VKAPI *PFN_vkOpenPeerImage)(VkDevice device, const VkPeerImageOpenInfo* pOpenInfo, VkImage* pImage, VkDeviceMemory* pMem);
typedef VkResult (VKAPI *PFN_vkDestroyObject)(VkDevice device, VkObjectType objType, VkObject object);
typedef VkResult (VKAPI *PFN_vkGetObjectInfo)(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData);
-typedef VkResult (VKAPI *PFN_vkQueueBindObjectMemory)(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset);
-typedef VkResult (VKAPI *PFN_vkQueueBindObjectMemoryRange)(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset);
-typedef VkResult (VKAPI *PFN_vkQueueBindImageMemoryRange)(VkQueue queue, VkImage image, uint32_t allocationIdx, const VkImageMemoryBindInfo* pBindInfo, VkDeviceMemory mem, VkDeviceSize memOffset);
+typedef VkResult (VKAPI *PFN_vkBindObjectMemory)(VkDevice device, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset);
+typedef VkResult (VKAPI *PFN_vkQueueBindSparseBufferMemory)(VkQueue queue, VkBuffer buffer, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset);
+typedef VkResult (VKAPI *PFN_vkQueueBindSparseImageMemory)(VkQueue queue, VkImage image, uint32_t allocationIdx, const VkImageMemoryBindInfo* pBindInfo, VkDeviceMemory mem, VkDeviceSize memOffset);
typedef VkResult (VKAPI *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo* pCreateInfo, VkFence* pFence);
typedef VkResult (VKAPI *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, VkFence* pFences);
typedef VkResult (VKAPI *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence);
@@ -2226,7 +2226,6 @@ typedef void (VKAPI *PFN_vkCmdCopyImage)(VkCmdBuffer cmdBuffer, VkImage srcI
typedef void (VKAPI *PFN_vkCmdBlitImage)(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions);
typedef void (VKAPI *PFN_vkCmdCopyBufferToImage)(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
typedef void (VKAPI *PFN_vkCmdCopyImageToBuffer)(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
-typedef void (VKAPI *PFN_vkCmdCloneImageData)(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout);
typedef void (VKAPI *PFN_vkCmdUpdateBuffer)(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData);
typedef void (VKAPI *PFN_vkCmdFillBuffer)(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data);
typedef void (VKAPI *PFN_vkCmdClearColorImage)(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColor* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
@@ -2271,10 +2270,13 @@ VkResult VKAPI vkGetPhysicalDeviceInfo(
size_t* pDataSize,
void* pData);
+void * VKAPI vkGetInstanceProcAddr(
+ VkInstance instance,
+ const char* pName);
+
void * VKAPI vkGetProcAddr(
VkPhysicalDevice physicalDevice,
const char* pName);
-
// Device functions
VkResult VKAPI vkCreateDevice(
@@ -2418,25 +2420,24 @@ VkResult VKAPI vkGetObjectInfo(
// Memory management API functions
-VkResult VKAPI vkQueueBindObjectMemory(
- VkQueue queue,
+VkResult VKAPI vkBindObjectMemory(
+ VkDevice device,
VkObjectType objType,
VkObject object,
uint32_t allocationIdx,
VkDeviceMemory mem,
VkDeviceSize memOffset);
-VkResult VKAPI vkQueueBindObjectMemoryRange(
+VkResult VKAPI vkQueueBindSparseBufferMemory(
VkQueue queue,
- VkObjectType objType,
- VkObject object,
+ VkBuffer buffer,
uint32_t allocationIdx,
VkDeviceSize rangeOffset,
VkDeviceSize rangeSize,
VkDeviceMemory mem,
VkDeviceSize memOffset);
-VkResult VKAPI vkQueueBindImageMemoryRange(
+VkResult VKAPI vkQueueBindSparseImageMemory(
VkQueue queue,
VkImage image,
uint32_t allocationIdx,
@@ -2831,13 +2832,6 @@ void VKAPI vkCmdCopyImageToBuffer(
uint32_t regionCount,
const VkBufferImageCopy* pRegions);
-void VKAPI vkCmdCloneImageData(
- VkCmdBuffer cmdBuffer,
- VkImage srcImage,
- VkImageLayout srcImageLayout,
- VkImage destImage,
- VkImageLayout destImageLayout);
-
void VKAPI vkCmdUpdateBuffer(
VkCmdBuffer cmdBuffer,
VkBuffer destBuffer,
diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt
index ff746a0d..6988d8d8 100644
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -38,7 +38,6 @@ endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../loader
- ${CMAKE_CURRENT_SOURCE_DIR}/../../glslang
${CMAKE_CURRENT_BINARY_DIR}
)
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index f73e533d..7836198f 100755
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -2299,21 +2299,6 @@ VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer,
nextTable.CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
}
-VK_LAYER_EXPORT void VKAPI vkCmdCloneImageData(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout)
-{
- GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
- if (pCB) {
- updateCBTracking(cmdBuffer);
- addCmd(pCB, CMD_CLONEIMAGEDATA);
- }
- else {
- char str[1024];
- sprintf(str, "Attempt to use CmdBuffer %p that doesn't exist!", (void*)cmdBuffer);
- layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_INVALID_CMD_BUFFER, "DS", str);
- }
- nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout);
-}
-
VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData)
{
GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
@@ -2848,8 +2833,6 @@ VK_LAYER_EXPORT void* VKAPI vkGetProcAddr(VkPhysicalDevice gpu, const char* func
return (void*) vkCmdCopyBufferToImage;
if (!strcmp(funcName, "vkCmdCopyImageToBuffer"))
return (void*) vkCmdCopyImageToBuffer;
- if (!strcmp(funcName, "vkCmdCloneImageData"))
- return (void*) vkCmdCloneImageData;
if (!strcmp(funcName, "vkCmdUpdateBuffer"))
return (void*) vkCmdUpdateBuffer;
if (!strcmp(funcName, "vkCmdFillBuffer"))
diff --git a/layers/glave_snapshot.c b/layers/glave_snapshot.c
index c924355e..120656d6 100644
--- a/layers/glave_snapshot.c
+++ b/layers/glave_snapshot.c
@@ -1407,14 +1407,6 @@ VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage
nextTable.CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
}
-VK_LAYER_EXPORT void VKAPI vkCmdCloneImageData(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout)
-{
- loader_platform_thread_lock_mutex(&objLock);
- ll_increment_use_count((void*)cmdBuffer, VK_OBJECT_TYPE_CMD_BUFFER);
- loader_platform_thread_unlock_mutex(&objLock);
- nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout);
-}
-
VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkGpuSize destOffset, VkGpuSize dataSize, const uint32_t* pData)
{
loader_platform_thread_lock_mutex(&objLock);
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index d8a1df80..3d3a9965 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -1177,7 +1177,7 @@ VK_LAYER_EXPORT VkResult VKAPI vkDestroyObject(
else {
char str[1024];
sprintf(str, "Destroying obj %p that is still bound to memory object %p\nYou should first clear binding "
- "by calling vkQueueBindObjectMemory(queue, %p, 0, VK_NULL_HANDLE, 0)",
+ "by calling vkBindObjectMemory(queue, %p, 0, VK_NULL_HANDLE, 0)",
object, (void*)pDelInfo->pMemObjInfo->mem, object);
layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, object, 0, MEMTRACK_DESTROY_OBJECT_ERROR, "MEM", str);
// From the spec : If an object has previous memory binding, it is required to unbind memory
@@ -1203,22 +1203,22 @@ VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(
void *pData)
{
// TODO : What to track here?
- // Could potentially save returned mem requirements and validate values passed into QueueBindObjectMemory for this object
+ // Could potentially save returned mem requirements and validate values passed into BindObjectMemory for this object
// From spec : The only objects that are guaranteed to have no external memory requirements are devices, queues,
// command buffers, shaders and memory objects.
VkResult result = nextTable.GetObjectInfo(device, objType, object, infoType, pDataSize, pData);
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemory(
- VkQueue queue,
+VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemory(
+ VkDevice device,
VkObjectType objType,
VkObject object,
uint32_t allocationIdx,
VkDeviceMemory mem,
VkDeviceSize offset)
{
- VkResult result = nextTable.QueueBindObjectMemory(queue, objType, object, allocationIdx, mem, offset);
+ VkResult result = nextTable.BindObjectMemory(device, objType, object, allocationIdx, mem, offset);
loader_platform_thread_lock_mutex(&globalLock);
// Track objects tied to memory
if (VK_FALSE == updateObjectBinding(object, mem)) {
@@ -1232,23 +1232,22 @@ VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemory(
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(
+VK_LAYER_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(
VkQueue queue,
- VkObjectType objType,
- VkObject object,
+ VkBuffer buffer,
uint32_t allocationIdx,
VkDeviceSize rangeOffset,
VkDeviceSize rangeSize,
VkDeviceMemory mem,
VkDeviceSize memOffset)
{
- VkResult result = nextTable.QueueBindObjectMemoryRange(queue, objType, object, allocationIdx, rangeOffset, rangeSize, mem, memOffset);
+ VkResult result = nextTable.QueueBindSparseBufferMemory(queue, buffer, allocationIdx, rangeOffset, rangeSize, mem, memOffset);
loader_platform_thread_lock_mutex(&globalLock);
// Track objects tied to memory
- if (VK_FALSE == updateObjectBinding(object, mem)) {
+ if (VK_FALSE == updateObjectBinding(buffer, mem)) {
char str[1024];
- sprintf(str, "Unable to set object %p binding to mem obj %p", (void*)object, (void*)mem);
- layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, object, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str);
+ sprintf(str, "Unable to set object %p binding to mem obj %p", (void*)buffer, (void*)mem);
+ layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, buffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str);
}
printObjList();
printMemList();
@@ -1909,31 +1908,6 @@ VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(
nextTable.CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
}
-VK_LAYER_EXPORT void VKAPI vkCmdCloneImageData(
- VkCmdBuffer cmdBuffer,
- VkImage srcImage,
- VkImageLayout srcImageLayout,
- VkImage destImage,
- VkImageLayout destImageLayout)
-{
- // TODO : Each image will have mem mapping so track them
- loader_platform_thread_lock_mutex(&globalLock);
- VkDeviceMemory mem = getMemBindingFromObject(srcImage);
- if (VK_FALSE == updateCBBinding(cmdBuffer, mem)) {
- char str[1024];
- sprintf(str, "In vkCmdCloneImageData() call unable to update binding of srcImage buffer %p to cmdBuffer %p", srcImage, cmdBuffer);
- layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str);
- }
- mem = getMemBindingFromObject(destImage);
- if (VK_FALSE == updateCBBinding(cmdBuffer, mem)) {
- char str[1024];
- sprintf(str, "In vkCmdCloneImageData() call unable to update binding of destImage buffer %p to cmdBuffer %p", destImage, cmdBuffer);
- layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, cmdBuffer, 0, MEMTRACK_MEMORY_BINDING_ERROR, "MEM", str);
- }
- loader_platform_thread_unlock_mutex(&globalLock);
- nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout);
-}
-
VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(
VkCmdBuffer cmdBuffer,
VkBuffer destBuffer,
@@ -2270,10 +2244,10 @@ VK_LAYER_EXPORT void* VKAPI vkGetProcAddr(
return (void*) vkDestroyObject;
if (!strcmp(funcName, "vkGetObjectInfo"))
return (void*) vkGetObjectInfo;
- if (!strcmp(funcName, "vkQueueBindObjectMemory"))
- return (void*) vkQueueBindObjectMemory;
- if (!strcmp(funcName, "vkQueueBindObjectMemoryRange"))
- return (void*) vkQueueBindObjectMemoryRange;
+ if (!strcmp(funcName, "vkBindObjectMemory"))
+ return (void*) vkBindObjectMemory;
+ if (!strcmp(funcName, "vkQueueBindSparseBufferMemory"))
+ return (void*) vkQueueBindSparseBufferMemory;
if (!strcmp(funcName, "vkCreateFence"))
return (void*) vkCreateFence;
if (!strcmp(funcName, "vkGetFenceStatus"))
@@ -2352,8 +2326,6 @@ VK_LAYER_EXPORT void* VKAPI vkGetProcAddr(
return (void*) vkCmdCopyBufferToImage;
if (!strcmp(funcName, "vkCmdCopyImageToBuffer"))
return (void*) vkCmdCopyImageToBuffer;
- if (!strcmp(funcName, "vkCmdCloneImageData"))
- return (void*) vkCmdCloneImageData;
if (!strcmp(funcName, "vkCmdUpdateBuffer"))
return (void*) vkCmdUpdateBuffer;
if (!strcmp(funcName, "vkCmdFillBuffer"))
diff --git a/layers/object_track.h b/layers/object_track.h
index 9c45e2a7..65b368e5 100644
--- a/layers/object_track.h
+++ b/layers/object_track.h
@@ -151,7 +151,6 @@ static const char* string_from_vulkan_object_type(uint32_t type) {
typedef struct _OBJTRACK_NODE {
VkObject vkObj;
VkObjectType objType;
- uint64_t numUses;
OBJECT_STATUS status;
} OBJTRACK_NODE;
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 50f61571..e9e8bb9f 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -516,32 +516,32 @@ VK_LAYER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType obj
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemory(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset)
+VK_LAYER_EXPORT VkResult VKAPI vkBindObjectMemory(VkDevice device, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset)
{
- VkResult result = nextTable.QueueBindObjectMemory(queue, objType, object, allocationIdx, mem, offset);
+ VkResult result = nextTable.BindObjectMemory(device, objType, object, allocationIdx, mem, offset);
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkQueueBindObjectMemoryRange(VkQueue queue, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset)
+VK_LAYER_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(VkQueue queue, VkBuffer buffer, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset)
{
- VkResult result = nextTable.QueueBindObjectMemoryRange(queue, objType, object, allocationIdx, rangeOffset, rangeSize, mem, memOffset);
+ VkResult result = nextTable.QueueBindSparseBufferMemory(queue, buffer, allocationIdx, rangeOffset, rangeSize, mem, memOffset);
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkQueueBindImageMemoryRange(VkQueue queue, VkImage image, uint32_t allocationIdx, const VkImageMemoryBindInfo* pBindInfo, VkDeviceMemory mem, VkDeviceSize memOffset)
+VK_LAYER_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(VkQueue queue, VkImage image, uint32_t allocationIdx, const VkImageMemoryBindInfo* pBindInfo, VkDeviceMemory mem, VkDeviceSize memOffset)
{
char str[1024];
if (!pBindInfo) {
- sprintf(str, "Struct ptr parameter pBindInfo to function QueueBindImageMemoryRange is NULL.");
+ sprintf(str, "Struct ptr parameter pBindInfo to function QueueBindSparseImageMemory is NULL.");
layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
}
else if (!vk_validate_vkimagememorybindinfo(pBindInfo)) {
sprintf(str, "Parameter pBindInfo to function BindImageMemoryRange contains an invalid value.");
layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
}
- VkResult result = nextTable.QueueBindImageMemoryRange(queue, image, allocationIdx, pBindInfo, mem, memOffset);
+ VkResult result = nextTable.QueueBindSparseImageMemory(queue, image, allocationIdx, pBindInfo, mem, memOffset);
return result;
}
@@ -1376,20 +1376,6 @@ VK_LAYER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage
nextTable.CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
}
-VK_LAYER_EXPORT void VKAPI vkCmdCloneImageData(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout)
-{
- char str[1024];
- if (!validate_VkImageLayout(srcImageLayout)) {
- sprintf(str, "Parameter srcImageLayout to function CmdCloneImageData has invalid value of %i.", (int)srcImageLayout);
- layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
- }
- if (!validate_VkImageLayout(destImageLayout)) {
- sprintf(str, "Parameter destImageLayout to function CmdCloneImageData has invalid value of %i.", (int)destImageLayout);
- layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str);
- }
- nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout);
-}
-
VK_LAYER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData)
{
diff --git a/layers/shader_checker.cpp b/layers/shader_checker.cpp
index bd9a62e5..8e08b372 100644
--- a/layers/shader_checker.cpp
+++ b/layers/shader_checker.cpp
@@ -33,12 +33,13 @@
#include "vkLayer.h"
#include "layers_config.h"
#include "layers_msg.h"
+#include "vk_enum_string_helper.h"
#include "shader_checker.h"
// The following is #included again to catch certain OS-specific functions
// being used:
#include "loader_platform.h"
-#include "SPIRV/spirv.h"
+#include "spirv/spirv.h"
static std::unordered_map<void *, VkLayerDispatchTable *> tableMap;
@@ -584,6 +585,38 @@ get_format_type(VkFormat fmt) {
}
+/* characterizes a SPIR-V type appearing in an interface to a FF stage,
+ * for comparison to a VkFormat's characterization above. */
+static unsigned
+get_fundamental_type(shader_source const *src, unsigned type)
+{
+ auto type_def_it = src->type_def_index.find(type);
+
+ if (type_def_it == src->type_def_index.end()) {
+ return FORMAT_TYPE_UNDEFINED;
+ }
+
+ unsigned int const *code = (unsigned int const *)&src->words[type_def_it->second];
+ unsigned opcode = code[0] & 0x0ffffu;
+ switch (opcode) {
+ case spv::OpTypeInt:
+ return code[3] ? FORMAT_TYPE_SINT : FORMAT_TYPE_UINT;
+ case spv::OpTypeFloat:
+ return FORMAT_TYPE_FLOAT;
+ case spv::OpTypeVector:
+ return get_fundamental_type(src, code[2]);
+ case spv::OpTypeMatrix:
+ return get_fundamental_type(src, code[2]);
+ case spv::OpTypeArray:
+ return get_fundamental_type(src, code[2]);
+ case spv::OpTypePointer:
+ return get_fundamental_type(src, code[3]);
+ default:
+ return FORMAT_TYPE_UNDEFINED;
+ }
+}
+
+
static void
validate_vi_against_vs_inputs(VkPipelineVertexInputCreateInfo const *vi, shader_source const *vs)
{
@@ -620,7 +653,18 @@ validate_vi_against_vs_inputs(VkPipelineVertexInputCreateInfo const *vi, shader_
it_b++;
}
else {
- /* TODO: type check */
+ unsigned attrib_type = get_format_type(it_a->second->format);
+ unsigned input_type = get_fundamental_type(vs, it_b->second.type_id);
+
+ /* type checking */
+ if (attrib_type != FORMAT_TYPE_UNDEFINED && input_type != FORMAT_TYPE_UNDEFINED && attrib_type != input_type) {
+ char vs_type[1024];
+ describe_type(vs_type, vs, it_b->second.type_id);
+ sprintf(str, "Attribute type of `%s` at location %d does not match VS input type of `%s`",
+ string_VkFormat(it_a->second->format), a_first, vs_type);
+ layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC", str);
+ }
+
/* OK! */
it_a++;
it_b++;
@@ -670,7 +714,7 @@ validate_fs_outputs_against_cb(shader_source const *fs, VkPipelineCbStateCreateI
* are currently dense, but the parallel with matching between shader stages is nice.
*/
- while (outputs.size() > 0 && (it != outputs.end() || attachment < cb->attachmentCount)) {
+ while ((outputs.size() > 0 && it != outputs.end()) || attachment < cb->attachmentCount) {
if (attachment == cb->attachmentCount || it->first < attachment) {
sprintf(str, "FS writes to output location %d with no matching attachment", it->first);
layerCbMsg(VK_DBG_MSG_WARNING, VK_VALIDATION_LEVEL_0, NULL, 0, SHADER_CHECKER_OUTPUT_NOT_CONSUMED, "SC", str);
@@ -682,8 +726,19 @@ validate_fs_outputs_against_cb(shader_source const *fs, VkPipelineCbStateCreateI
attachment++;
}
else {
+ unsigned output_type = get_fundamental_type(fs, it->second.type_id);
+ unsigned att_type = get_format_type(cb->pAttachments[attachment].format);
+
+ /* type checking */
+ if (att_type != FORMAT_TYPE_UNDEFINED && output_type != FORMAT_TYPE_UNDEFINED && att_type != output_type) {
+ char fs_type[1024];
+ describe_type(fs_type, fs, it->second.type_id);
+ sprintf(str, "Attachment %d of type `%s` does not match FS output type of `%s`",
+ attachment, string_VkFormat(cb->pAttachments[attachment].format), fs_type);
+ layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC", str);
+ }
+
/* OK! */
- /* TODO: typecheck */
it++;
attachment++;
}
diff --git a/layers/spirv/spirv.h b/layers/spirv/spirv.h
index 7404d6fd..f3d18a3f 100644
--- a/layers/spirv/spirv.h
+++ b/layers/spirv/spirv.h
@@ -1,762 +1,1304 @@
/*
-** Copyright (c) 2014-2015 The Khronos Group Inc.
+** 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:
+** 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 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.
+** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
+** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
+** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
+**
+** 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.
*/
-//
-// Enumeration tokens for SPIR V.
-//
+/*
+** This header is automatically generated by the same tool that creates
+** the Binary Section of the SPIR-V specification.
+*/
+
+/*
+** Specification revision 30.
+** Enumeration tokens for SPIR-V, in three styles: C, C++, generic.
+** - C++ will have the tokens in the "spv" name space, with no prefix.
+** - C will have tokens with as "Spv" prefix.
+**
+** Some tokens act like mask values, which can be OR'd together,
+** while others are mutually exclusive. The mask-like ones have
+** "Mask" in their name, and a parallel enum that has the shift
+** amount (1 << x) for each corresponding enumerant.
+*/
-#pragma once
#ifndef spirv_H
#define spirv_H
#ifdef __cplusplus
-namespace spv{
-#endif
+
+namespace spv {
const int MagicNumber = 0x07230203;
const int Version = 99;
typedef unsigned int Id;
-const Id NoResult = 0;
-const Id NoType = 0;
-
const unsigned int OpCodeMask = 0xFFFF;
const unsigned int WordCountShift = 16;
-// Set of capabilities. Generally, something is assumed to be in core,
-// if nothing else is said. So, these are used to identify when something
-// requires a specific capability to be declared.
-enum Capability {
- CapMatrix,
- CapShader,
- CapGeom,
- CapTess,
- CapAddr,
- CapLink,
- CapKernel
-};
-
-// What language is the source code in? Note the OpSource instruction has a separate
-// operand for the version number, this is just the language name. The GLSL
-// compatibility profile will be indicated by using an OpSourceExtension string.
enum SourceLanguage {
- LangUnknown,
- LangESSL,
- LangGLSL,
- LangOpenCL,
-
- LangCount // guard for validation, "default:" statements, etc.
+ SourceLanguageUnknown = 0,
+ SourceLanguageESSL = 1,
+ SourceLanguageGLSL = 2,
+ SourceLanguageOpenCL = 3,
};
-// Used per entry point to communicate the "stage" or other model of
-// execution used by that entry point.
-// See OpEntryPoint.
enum ExecutionModel {
- ModelVertex,
- ModelTessellationControl,
- ModelTessellationEvaluation,
- ModelGeometry,
- ModelFragment,
- ModelGLCompute,
- ModelKernel,
-
- ModelCount // guard for validation, "default:" statements, etc.
+ ExecutionModelVertex = 0,
+ ExecutionModelTessellationControl = 1,
+ ExecutionModelTessellationEvaluation = 2,
+ ExecutionModelGeometry = 3,
+ ExecutionModelFragment = 4,
+ ExecutionModelGLCompute = 5,
+ ExecutionModelKernel = 6,
};
-// Used as an argument to OpMemoryModel
enum AddressingModel {
- AddressingLogical,
- AddressingPhysical32,
- AddressingPhysical64,
-
- AddressingCount // guard for validation, "default:" statements, etc.
+ AddressingModelLogical = 0,
+ AddressingModelPhysical32 = 1,
+ AddressingModelPhysical64 = 2,
};
-// Used as an argment to OpMemoryModel
enum MemoryModel {
- MemorySimple,
- MemoryGLSL450,
- MemoryOCL12,
- MemoryOCL20,
- MemoryOCL21,
-
- MemoryCount // guard for validation, "default:" statements, etc.
+ MemoryModelSimple = 0,
+ MemoryModelGLSL450 = 1,
+ MemoryModelOpenCL12 = 2,
+ MemoryModelOpenCL20 = 3,
+ MemoryModelOpenCL21 = 4,
};
-// Used per entry point to communicate modes related to input, output, and execution.
-// See OpExecutionMode.
enum ExecutionMode {
- ExecutionInvocations,
- ExecutionSpacingEqual,
- ExecutionSpacingFractionalEven,
- ExecutionSpacingFractionalOdd,
- ExecutionVertexOrderCw,
- ExecutionVertexOrderCcw,
- ExecutionPixelCenterInteger,
- ExecutionOriginUpperLeft,
- ExecutionEarlyFragmentTests,
- ExecutionPointMode,
- ExecutionXfb,
- ExecutionDepthReplacing,
- ExecutionDepthAny,
- ExecutionDepthGreater,
- ExecutionDepthLess,
- ExecutionDepthUnchanged,
- ExecutionLocalSize,
- ExecutionLocalSizeHint,
-
- ExecutionInputPoints,
- ExecutionInputLines,
- ExecutionInputLinesAdjacency,
- ExecutionInputTriangles,
- ExecutionInputTrianglesAdjacency,
- ExecutionInputQuads,
- ExecutionInputIsolines,
-
- ExecutionOutputVertices,
- ExecutionOutputPoints,
- ExecutionOutputLineStrip,
- ExecutionOutputTriangleStrip,
-
- ExecutionVecTypeHint,
- ExecutionContractionOff,
- ExecutionModeCount // guard for validation, "default:" statements, etc.
+ ExecutionModeInvocations = 0,
+ ExecutionModeSpacingEqual = 1,
+ ExecutionModeSpacingFractionalEven = 2,
+ ExecutionModeSpacingFractionalOdd = 3,
+ ExecutionModeVertexOrderCw = 4,
+ ExecutionModeVertexOrderCcw = 5,
+ ExecutionModePixelCenterInteger = 6,
+ ExecutionModeOriginUpperLeft = 7,
+ ExecutionModeEarlyFragmentTests = 8,
+ ExecutionModePointMode = 9,
+ ExecutionModeXfb = 10,
+ ExecutionModeDepthReplacing = 11,
+ ExecutionModeDepthAny = 12,
+ ExecutionModeDepthGreater = 13,
+ ExecutionModeDepthLess = 14,
+ ExecutionModeDepthUnchanged = 15,
+ ExecutionModeLocalSize = 16,
+ ExecutionModeLocalSizeHint = 17,
+ ExecutionModeInputPoints = 18,
+ ExecutionModeInputLines = 19,
+ ExecutionModeInputLinesAdjacency = 20,
+ ExecutionModeInputTriangles = 21,
+ ExecutionModeInputTrianglesAdjacency = 22,
+ ExecutionModeInputQuads = 23,
+ ExecutionModeInputIsolines = 24,
+ ExecutionModeOutputVertices = 25,
+ ExecutionModeOutputPoints = 26,
+ ExecutionModeOutputLineStrip = 27,
+ ExecutionModeOutputTriangleStrip = 28,
+ ExecutionModeVecTypeHint = 29,
+ ExecutionModeContractionOff = 30,
};
enum StorageClass {
- StorageConstantUniform,
- StorageInput,
- StorageUniform,
- StorageOutput,
- StorageWorkgroupLocal,
- StorageWorkgroupGlobal,
- StoragePrivateGlobal,
- StorageFunction,
- StorageGeneric,
- StoragePrivate,
- StorageAtomicCounter,
- StorageCount // guard for validation, "default:" statements, etc.
-};
-
-// Dimensionalities currently used for sampling.
-// See TypeSampler in TypeClass.
-enum Dimensionality {
- Dim1D,
- Dim2D,
- Dim3D,
- DimCube,
- DimRect,
- DimBuffer,
-
- DimCount // guard for validation, "default:" statements, etc.
-};
-
-// Sampler addressing mode.
+ StorageClassUniformConstant = 0,
+ StorageClassInput = 1,
+ StorageClassUniform = 2,
+ StorageClassOutput = 3,
+ StorageClassWorkgroupLocal = 4,
+ StorageClassWorkgroupGlobal = 5,
+ StorageClassPrivateGlobal = 6,
+ StorageClassFunction = 7,
+ StorageClassGeneric = 8,
+ StorageClassPrivate = 9,
+ StorageClassAtomicCounter = 10,
+};
+
+enum Dim {
+ Dim1D = 0,
+ Dim2D = 1,
+ Dim3D = 2,
+ DimCube = 3,
+ DimRect = 4,
+ DimBuffer = 5,
+};
+
enum SamplerAddressingMode {
- SamplerAddressingNone = 0,
- SamplerAddressingClampToEdge = 2,
- SamplerAddressingClamp = 4,
- SamplerAddressingRepeat = 6,
- SamplerAddressingRepeatMirrored = 8,
- SamplerAddressingModeLast,
+ SamplerAddressingModeNone = 0,
+ SamplerAddressingModeClampToEdge = 1,
+ SamplerAddressingModeClamp = 2,
+ SamplerAddressingModeRepeat = 3,
+ SamplerAddressingModeRepeatMirrored = 4,
};
-// Sampler filter mode.
enum SamplerFilterMode {
- SamplerFilterNearest = 0x10,
- SamplerFilterLinear = 0x20,
- SamplerFilterModeLast,
+ SamplerFilterModeNearest = 0,
+ SamplerFilterModeLinear = 1,
};
-// FP Fast Math Mode.
-enum FPFastMath {
- FPFastMathNNan = 0, // assume parameters and result are not NaN.
- FPFastMathNInf = 0x02, // assume parameters and result are not +/- Inf.
- FPFastMathNSZ = 0x04, // treat the sign of a zero parameter or result as insignificant.
- FPFastMathARcp = 0x08, // allow the usage of reciprocal rather than perform a division.
- FPFastMathFast = 0x10, // allow Algebraic transformations according to real number associative and distibutive algebra. This flag implies all the others.
- FPFastMathLast,
+enum FPFastMathModeShift {
+ FPFastMathModeNotNaNShift = 0,
+ FPFastMathModeNotInfShift = 1,
+ FPFastMathModeNSZShift = 2,
+ FPFastMathModeAllowRecipShift = 3,
+ FPFastMathModeFastShift = 4,
+};
+
+enum FPFastMathModeMask {
+ FPFastMathModeMaskNone = 0,
+ FPFastMathModeNotNaNMask = 0x00000001,
+ FPFastMathModeNotInfMask = 0x00000002,
+ FPFastMathModeNSZMask = 0x00000004,
+ FPFastMathModeAllowRecipMask = 0x00000008,
+ FPFastMathModeFastMask = 0x00000010,
};
-// FP Fast Math Mode.
enum FPRoundingMode {
- FPRoundRTE, // round to nearest even.
- FPRoundRTZ, // round towards zero.
- FPRoundRTP, // round towards positive infinity.
- FPRoundRTN, // round towards negative infinity.
- FPRoundLast,
+ FPRoundingModeRTE = 0,
+ FPRoundingModeRTZ = 1,
+ FPRoundingModeRTP = 2,
+ FPRoundingModeRTN = 3,
};
-// Global identifier linkage types (by default the linkage type of global identifiers is private. This means that they are only accessible to objects inside the module.)
enum LinkageType {
- LinkageExport, // accessible by objects in other modules as well.
- LinkageImport, // a forward declaration to a global identifier that exists in another module.
- LinkageLast,
+ LinkageTypeExport = 0,
+ LinkageTypeImport = 1,
};
-// Access Qualifiers for OpenCL pipes and images
enum AccessQualifier {
- AccessQualReadOnly,
- AccessQualWriteOnly,
- AccessQualReadWrite,
- AccessQualLast,
+ AccessQualifierReadOnly = 0,
+ AccessQualifierWriteOnly = 1,
+ AccessQualifierReadWrite = 2,
};
-// Function argument attributes
enum FunctionParameterAttribute {
- FuncParamAttrZext, // value should be zero extended if needed
- FuncParamAttrSext, // value should be sign extended if needed
- FuncParamAttrByval, // only valid for pointer parameters (not for ret value), this indicates that the pointer parameter should really be passed by value to the function.
- FuncParamAttrSret, // indicates that the pointer parameter specifies the address of a structure that is the return value of the function in the source program. only applicable to the first parameter
- FuncParamAttrNoAlias,
- FuncParamAttrNoCapture,
- FuncParamAttrSVM,
- FuncParamAttrNoWrite,
- FuncParamAttrNoReadWrite,
- FuncParamAttrLast, // guard for validation, "default:" statements, etc.
+ FunctionParameterAttributeZext = 0,
+ FunctionParameterAttributeSext = 1,
+ FunctionParameterAttributeByVal = 2,
+ FunctionParameterAttributeSret = 3,
+ FunctionParameterAttributeNoAlias = 4,
+ FunctionParameterAttributeNoCapture = 5,
+ FunctionParameterAttributeSVM = 6,
+ FunctionParameterAttributeNoWrite = 7,
+ FunctionParameterAttributeNoReadWrite = 8,
};
-
-// Extra forms of "qualification" to add as needed. See OpDecorate.
enum Decoration {
- // For legacy ES precision qualifiers; newer language
- // designs can use the "num-bits" feature in TypeClass.
- // The precision qualifiers may be decorated on type <id>s or instruction <id>s.
- DecPrecisionLow,
- DecPrecisionMedium,
- DecPrecisionHigh,
-
- DecBlock, // basic in/out/uniform block, applied only to types of TypeStruct
- DecBufferBlock, // shader storage buffer block
- DecRowMajor,
- DecColMajor,
- DecGLSLShared,
- DecGLSLStd140,
- DecGLSLStd430,
- DecGLSLPacked,
- DecSmooth,
- DecNoperspective,
- DecFlat,
- DecPatch,
- DecCentroid,
- DecSample,
- DecInvariant,
- DecRestrict,
- DecAliased,
- DecVolatile,
- DecConstant,
- DecCoherent,
- DecNonwritable,
- DecNonreadable,
- DecUniform,
- DecNoStaticUse,
-
- DecCPacked,
- DecFPSaturatedConv,
-
- // these all take one additional operand
- DecStream,
- DecLocation,
- DecComponent,
- DecIndex,
- DecBinding,
- DecDescriptorSet,
- DecOffset,
- DecAlignment,
- DecXfbBuffer,
- DecStride,
- DecBuiltIn,
- DecFuncParamAttr,
- DecFPRoundingMode,
- DecFPFastMathMode,
- DecLinkageType,
- DecSpecId,
-
- DecCount // guard for validation, "default:" statements, etc.
+ DecorationPrecisionLow = 0,
+ DecorationPrecisionMedium = 1,
+ DecorationPrecisionHigh = 2,
+ DecorationBlock = 3,
+ DecorationBufferBlock = 4,
+ DecorationRowMajor = 5,
+ DecorationColMajor = 6,
+ DecorationGLSLShared = 7,
+ DecorationGLSLStd140 = 8,
+ DecorationGLSLStd430 = 9,
+ DecorationGLSLPacked = 10,
+ DecorationSmooth = 11,
+ DecorationNoperspective = 12,
+ DecorationFlat = 13,
+ DecorationPatch = 14,
+ DecorationCentroid = 15,
+ DecorationSample = 16,
+ DecorationInvariant = 17,
+ DecorationRestrict = 18,
+ DecorationAliased = 19,
+ DecorationVolatile = 20,
+ DecorationConstant = 21,
+ DecorationCoherent = 22,
+ DecorationNonwritable = 23,
+ DecorationNonreadable = 24,
+ DecorationUniform = 25,
+ DecorationNoStaticUse = 26,
+ DecorationCPacked = 27,
+ DecorationSaturatedConversion = 28,
+ DecorationStream = 29,
+ DecorationLocation = 30,
+ DecorationComponent = 31,
+ DecorationIndex = 32,
+ DecorationBinding = 33,
+ DecorationDescriptorSet = 34,
+ DecorationOffset = 35,
+ DecorationAlignment = 36,
+ DecorationXfbBuffer = 37,
+ DecorationStride = 38,
+ DecorationBuiltIn = 39,
+ DecorationFuncParamAttr = 40,
+ DecorationFPRoundingMode = 41,
+ DecorationFPFastMathMode = 42,
+ DecorationLinkageAttributes = 43,
+ DecorationSpecId = 44,
};
enum BuiltIn {
- BuiltInPosition,
- BuiltInPointSize,
- BuiltInClipVertex,
- BuiltInClipDistance,
- BuiltInCullDistance,
- BuiltInVertexId,
- BuiltInInstanceId,
- BuiltInPrimitiveId,
- BuiltInInvocationId,
- BuiltInLayer,
- BuiltInViewportIndex,
- BuiltInTessLevelOuter,
- BuiltInTessLevelInner,
- BuiltInTessCoord,
- BuiltInPatchVertices,
- BuiltInFragCoord,
- BuiltInPointCoord,
- BuiltInFrontFacing,
- BuiltInSampleId,
- BuiltInSamplePosition,
- BuiltInSampleMask,
- BuiltInFragColor,
- BuiltInFragDepth,
- BuiltInHelperInvocation,
-
- // OpenGL compute stage, OpenCL work item built-ins
- BuiltInNumWorkgroups, // number of work-groups that will execute a kernel
- BuiltInWorkgroupSize, // OpenCL number of local work-items
- BuiltInWorkgroupId, // OpenCL work group id
- BuiltInLocalInvocationId, // OpenCL local work item id (decorates a vector3 i32/i64)
- BuiltInGlobalInvocationId, // OpenCL global work item id (decorates a vector3 i32/i64)
- BuiltInLocalInvocationIndex, // not in use in OpenCL
- BuiltInWorkDim, // OpenCL number of dimensions in use (decorates a scalar i32/i64)
- BuiltInGlobalSize, // OpenCL number of global work items, per dimension (decorates a vector3 i32/i64)
- BuiltInEnqueuedWorkgroupSize, // OpenCL 2.0 only, get local size
- BuiltInGlobalOffset, // OpenCL offset values specified global_work_offset
- BuiltInGlobalLinearId, // OpenCL 2.0 only, work items 1-dimensional global ID.
- BuiltInWorkgroupLinearId, // OpenCL 2.0 only work items 1-dimensional local ID.
-
- // OpenCL 2.0 subgroups
- BuiltInSubgroupSize, // Returns the number of work-items in the subgroup
- BuiltInSubgroupMaxSize, // Returns the maximum size of a subgroup within the dispatch
- BuiltInNumSubgroups, // Returns the maximum size of a subgroup within the dispatch
- BuiltInNumEnqueuedSubgroups, // Returns the maximum size of a subgroup within the dispatch
- BuiltInSubgroupId, //
- BuiltInSubgroupLocalInvocationId, // Returns the unique work-item ID within the current subgroup
-
- BuiltInCount // guard for validation, "default:" statements, etc.
-};
-
-enum SelectControl {
- SelectControlNone,
- SelectControlFlatten,
- SelectControlDontFlatten,
-
- SelectControlCount, // guard for validation, "default:" statements, etc.
-};
-
-enum LoopControl {
- LoopControlNone,
- LoopControlUnroll,
- LoopControlDontUnroll,
-
- LoopControlCount,
+ BuiltInPosition = 0,
+ BuiltInPointSize = 1,
+ BuiltInClipVertex = 2,
+ BuiltInClipDistance = 3,
+ BuiltInCullDistance = 4,
+ BuiltInVertexId = 5,
+ BuiltInInstanceId = 6,
+ BuiltInPrimitiveId = 7,
+ BuiltInInvocationId = 8,
+ BuiltInLayer = 9,
+ BuiltInViewportIndex = 10,
+ BuiltInTessLevelOuter = 11,
+ BuiltInTessLevelInner = 12,
+ BuiltInTessCoord = 13,
+ BuiltInPatchVertices = 14,
+ BuiltInFragCoord = 15,
+ BuiltInPointCoord = 16,
+ BuiltInFrontFacing = 17,
+ BuiltInSampleId = 18,
+ BuiltInSamplePosition = 19,
+ BuiltInSampleMask = 20,
+ BuiltInFragColor = 21,
+ BuiltInFragDepth = 22,
+ BuiltInHelperInvocation = 23,
+ BuiltInNumWorkgroups = 24,
+ BuiltInWorkgroupSize = 25,
+ BuiltInWorkgroupId = 26,
+ BuiltInLocalInvocationId = 27,
+ BuiltInGlobalInvocationId = 28,
+ BuiltInLocalInvocationIndex = 29,
+ BuiltInWorkDim = 30,
+ BuiltInGlobalSize = 31,
+ BuiltInEnqueuedWorkgroupSize = 32,
+ BuiltInGlobalOffset = 33,
+ BuiltInGlobalLinearId = 34,
+ BuiltInWorkgroupLinearId = 35,
+ BuiltInSubgroupSize = 36,
+ BuiltInSubgroupMaxSize = 37,
+ BuiltInNumSubgroups = 38,
+ BuiltInNumEnqueuedSubgroups = 39,
+ BuiltInSubgroupId = 40,
+ BuiltInSubgroupLocalInvocationId = 41,
+};
+
+enum SelectionControlShift {
+ SelectionControlFlattenShift = 0,
+ SelectionControlDontFlattenShift = 1,
+};
+
+enum SelectionControlMask {
+ SelectionControlMaskNone = 0,
+ SelectionControlFlattenMask = 0x00000001,
+ SelectionControlDontFlattenMask = 0x00000002,
+};
+
+enum LoopControlShift {
+ LoopControlUnrollShift = 0,
+ LoopControlDontUnrollShift = 1,
+};
+
+enum LoopControlMask {
+ LoopControlMaskNone = 0,
+ LoopControlUnrollMask = 0x00000001,
+ LoopControlDontUnrollMask = 0x00000002,
+};
+
+enum FunctionControlShift {
+ FunctionControlInlineShift = 0,
+ FunctionControlDontInlineShift = 1,
+ FunctionControlPureShift = 2,
+ FunctionControlConstShift = 3,
};
enum FunctionControlMask {
- FunctionControlNone = 0x0,
- FunctionControlInline = 0x1,
- FunctionControlDontInline = 0x2,
- FunctionControlPure = 0x4,
- FunctionControlConst = 0x8,
+ FunctionControlMaskNone = 0,
+ FunctionControlInlineMask = 0x00000001,
+ FunctionControlDontInlineMask = 0x00000002,
+ FunctionControlPureMask = 0x00000004,
+ FunctionControlConstMask = 0x00000008,
+};
- FunctionControlCount = 4,
+enum MemorySemanticsShift {
+ MemorySemanticsRelaxedShift = 0,
+ MemorySemanticsSequentiallyConsistentShift = 1,
+ MemorySemanticsAcquireShift = 2,
+ MemorySemanticsReleaseShift = 3,
+ MemorySemanticsUniformMemoryShift = 4,
+ MemorySemanticsSubgroupMemoryShift = 5,
+ MemorySemanticsWorkgroupLocalMemoryShift = 6,
+ MemorySemanticsWorkgroupGlobalMemoryShift = 7,
+ MemorySemanticsAtomicCounterMemoryShift = 8,
+ MemorySemanticsImageMemoryShift = 9,
};
enum MemorySemanticsMask {
- MemorySemanticsRelaxed = 0x0001,
- MemorySemanticsSequentiallyConsistent = 0x0002,
- MemorySemanticsAcquire = 0x0004,
- MemorySemanticsRelease = 0x0008,
-
- MemorySemanticsUniform = 0x0010,
- MemorySemanticsSubgroup = 0x0020,
- MemorySemanticsWorkgroupLocal = 0x0040,
- MemorySemanticsWorkgroupGlobal = 0x0080,
- MemorySemanticsAtomicCounter = 0x0100,
- MemorySemanticsImage = 0x0200,
- MemorySemanticsAllMemory = 0x03FF,
+ MemorySemanticsMaskNone = 0,
+ MemorySemanticsRelaxedMask = 0x00000001,
+ MemorySemanticsSequentiallyConsistentMask = 0x00000002,
+ MemorySemanticsAcquireMask = 0x00000004,
+ MemorySemanticsReleaseMask = 0x00000008,
+ MemorySemanticsUniformMemoryMask = 0x00000010,
+ MemorySemanticsSubgroupMemoryMask = 0x00000020,
+ MemorySemanticsWorkgroupLocalMemoryMask = 0x00000040,
+ MemorySemanticsWorkgroupGlobalMemoryMask = 0x00000080,
+ MemorySemanticsAtomicCounterMemoryMask = 0x00000100,
+ MemorySemanticsImageMemoryMask = 0x00000200,
+};
- MemorySemanticsCount = 10
+enum MemoryAccessShift {
+ MemoryAccessVolatileShift = 0,
+ MemoryAccessAlignedShift = 1,
};
enum MemoryAccessMask {
- MemoryAccessVolatile = 0x0001,
- MemoryAccessAligned = 0x0002,
-
- MemoryAccessCount = 2
+ MemoryAccessMaskNone = 0,
+ MemoryAccessVolatileMask = 0x00000001,
+ MemoryAccessAlignedMask = 0x00000002,
};
enum ExecutionScope {
- ExecutionScopeCrossDevice,
- ExecutionScopeDevice,
- ExecutionScopeWorkgroup,
- ExecutionScopeSubgroup,
-
- ExecutionScopeCount // guard for validation, "default:" statements, etc.
+ ExecutionScopeCrossDevice = 0,
+ ExecutionScopeDevice = 1,
+ ExecutionScopeWorkgroup = 2,
+ ExecutionScopeSubgroup = 3,
};
enum GroupOperation {
- GroupOpReduce,
- GroupOpInclusiveScan,
- GroupOpExclusiveScan,
-
- GroupOpCount
+ GroupOperationReduce = 0,
+ GroupOperationInclusiveScan = 1,
+ GroupOperationExclusiveScan = 2,
};
enum KernelEnqueueFlags {
- EnqFlagNoWait,
- EnqFlagWaitKernel,
- EnqFlagWaitWaitWorgGroup,
-
- EnqFlagCount
-};
-
-enum KernelProfilingInfo {
- ProfInfoCmdExecTime = 0x01,
- ProfilingInfoCount = 1
-};
-
-enum OpCode {
- OpNop = 0, // Not used.
-
- OpSource,
- OpSourceExtension,
- OpExtension,
- OpExtInstImport,
-
- OpMemoryModel,
- OpEntryPoint,
- OpExecutionMode,
-
- OpTypeVoid,
- OpTypeBool,
- OpTypeInt,
- OpTypeFloat,
- OpTypeVector,
- OpTypeMatrix,
- OpTypeSampler,
- OpTypeFilter,
- OpTypeArray,
- OpTypeRuntimeArray,
- OpTypeStruct,
- OpTypeOpaque,
- OpTypePointer,
- OpTypeFunction,
- OpTypeEvent,
- OpTypeDeviceEvent,
- OpTypeReserveId,
- OpTypeQueue,
- OpTypePipe,
-
- OpConstantTrue,
- OpConstantFalse,
- OpConstant,
- OpConstantComposite,
- OpConstantSampler,
- OpConstantNullPointer,
- OpConstantNullObject,
-
- OpSpecConstantTrue,
- OpSpecConstantFalse,
- OpSpecConstant,
- OpSpecConstantComposite,
-
- OpVariable,
- OpVariableArray,
-
- OpFunction,
- OpFunctionParameter,
- OpFunctionEnd,
- OpFunctionCall,
-
- OpExtInst,
-
- OpUndef,
-
- OpLoad,
- OpStore,
-
- OpPhi,
-
- OpDecorationGroup,
- OpDecorate,
- OpMemberDecorate,
- OpGroupDecorate,
- OpGroupMemberDecorate,
-
- OpName,
- OpMemberName,
- OpString,
- OpLine,
-
- OpVectorExtractDynamic,
- OpVectorInsertDynamic,
- OpVectorShuffle,
-
- OpCompositeConstruct,
- OpCompositeExtract,
- OpCompositeInsert,
-
- OpCopyObject,
- OpCopyMemory,
- OpCopyMemorySized,
-
- OpSampler,
-
- OpTextureSample,
- OpTextureSampleDref,
- OpTextureSampleLod,
- OpTextureSampleProj,
- OpTextureSampleGrad,
- OpTextureSampleOffset,
- OpTextureSampleProjLod,
- OpTextureSampleProjGrad,
- OpTextureSampleLodOffset,
- OpTextureSampleProjOffset,
- OpTextureSampleGradOffset,
- OpTextureSampleProjLodOffset,
- OpTextureSampleProjGradOffset,
-
- OpTextureFetchTexel,
- OpTextureFetchTexelOffset,
- OpTextureFetchSample,
- OpTextureFetchBuffer,
- OpTextureGather,
- OpTextureGatherOffset,
- OpTextureGatherOffsets,
-
- OpTextureQuerySizeLod,
- OpTextureQuerySize,
- OpTextureQueryLod,
- OpTextureQueryLevels,
- OpTextureQuerySamples,
-
- OpAccessChain,
- OpInBoundsAccessChain,
-
- OpSNegate,
- OpFNegate,
-
- OpNot,
-
- OpAny,
- OpAll,
-
- OpConvertFToU,
- OpConvertFToS,
- OpConvertSToF,
- OpConvertUToF,
- OpUConvert,
- OpSConvert,
- OpFConvert,
- OpConvertPtrToU,
- OpConvertUToPtr,
- OpPtrCastToGeneric, // cast a pointer storage class to be in storage generic
- OpGenericCastToPtr, // cast a pointer in the generic storage class generic to another storage class
- OpBitcast,
-
- OpTranspose,
-
- OpIsNan,
- OpIsInf,
- OpIsFinite,
- OpIsNormal,
- OpSignBitSet,
- OpLessOrGreater,
- OpOrdered,
- OpUnordered,
-
- OpArrayLength,
-
- OpIAdd,
- OpFAdd,
- OpISub,
- OpFSub,
- OpIMul,
- OpFMul,
- OpUDiv,
- OpSDiv,
- OpFDiv,
-
- OpUMod,
- OpSRem,
- OpSMod,
- OpFRem,
- OpFMod,
-
- OpVectorTimesScalar,
- OpMatrixTimesScalar,
- OpVectorTimesMatrix,
- OpMatrixTimesVector,
- OpMatrixTimesMatrix,
- OpOuterProduct,
-
- OpDot,
-
- OpShiftRightLogical,
- OpShiftRightArithmetic,
- OpShiftLeftLogical,
- OpLogicalOr,
- OpLogicalXor,
- OpLogicalAnd,
-
- OpBitwiseOr,
- OpBitwiseXor,
- OpBitwiseAnd,
-
- OpSelect,
-
- OpIEqual,
- OpFOrdEqual,
- OpFUnordEqual,
-
- OpINotEqual,
- OpFOrdNotEqual,
- OpFUnordNotEqual,
-
- OpULessThan,
- OpSLessThan,
- OpFOrdLessThan,
- OpFUnordLessThan,
-
- OpUGreaterThan,
- OpSGreaterThan,
- OpFOrdGreaterThan,
- OpFUnordGreaterThan,
-
- OpULessThanEqual,
- OpSLessThanEqual,
- OpFOrdLessThanEqual,
- OpFUnordLessThanEqual,
-
- OpUGreaterThanEqual,
- OpSGreaterThanEqual,
- OpFOrdGreaterThanEqual,
- OpFUnordGreaterThanEqual,
-
- OpDPdx,
- OpDPdy,
- OpFwidth,
- OpDPdxFine,
- OpDPdyFine,
- OpFwidthFine,
- OpDPdxCoarse,
- OpDPdyCoarse,
- OpFwidthCoarse,
-
- OpEmitVertex,
- OpEndPrimitive,
- OpEmitStreamVertex,
- OpEndStreamPrimitive,
-
- OpControlBarrier,
- OpMemoryBarrier,
-
- OpImagePointer,
-
- OpAtomicInit,
- OpAtomicLoad,
- OpAtomicStore,
- OpAtomicExchange,
- OpAtomicCompareExchange,
- OpAtomicCompareExchangeWeak,
- OpAtomicIIncrement,
- OpAtomicIDecrement,
- OpAtomicIAdd,
- OpAtomicISub,
- OpAtomicUMin,
- OpAtomicUMax,
- OpAtomicAnd,
- OpAtomicOr,
- OpAtomicXor,
-
- OpLoopMerge,
- OpSelectionMerge,
- OpLabel,
- OpBranch,
- OpBranchConditional,
- OpSwitch,
- OpKill,
- OpReturn,
- OpReturnValue,
-
- OpUnreachable,
-
- OpLifetimeStart,
- OpLifetimeStop,
-
- OpCompileFlag,
-
- OpAsyncGroupCopy,
- OpWaitGroupEvents,
-
- OpGroupAll,
- OpGroupAny,
- OpGroupBroadcast,
-
- OpGroupIAdd,
- OpGroupFAdd,
- OpGroupFMin,
- OpGroupUMin,
- OpGroupSMin,
- OpGroupFMax,
- OpGroupUMax,
- OpGroupSMax,
-
- OpGenericCastToPtrExplicit,
- OpGenericPtrMemSemantics,
-
- OpReadPipe,
- OpWritePipe,
- OpReservedReadPipe,
- OpReservedWritePipe,
- OpReserveReadPipePackets,
- OpReserveWritePipePackets,
- OpCommitReadPipe,
- OpCommitWritePipe,
- OpIsValidReserveId,
- OpGetNumPipePackets,
- OpGetMaxPipePackets,
- OpGroupReserveReadPipePackets,
- OpGroupReserveWritePipePackets,
- OpGroupCommitReadPipe,
- OpGroupCommitWritePipe,
-
- OpEnqueueMarker,
- OpEnqueueKernel,
- OpGetKernelNDrangeSubGroupCount,
- OpGetKernelNDrangeMaxSubGroupSize,
-
- OpGetKernelWorkGroupSize,
- OpGetKernelPreferredWorkGroupSizeMultiple,
-
- OpRetainEvent,
- OpReleaseEvent,
-
- OpCreateUserEvent,
- OpIsValidEvent,
- OpSetUserEventStatus,
- OpCaptureEventProfilingInfo,
- OpGetDefaultQueue,
-
- OpBuildNDRange,
-
- OpCount // guard for validation, "default:" statements, etc.
+ KernelEnqueueFlagsNoWait = 0,
+ KernelEnqueueFlagsWaitKernel = 1,
+ KernelEnqueueFlagsWaitWorkGroup = 2,
+};
+
+enum KernelProfilingInfoShift {
+ KernelProfilingInfoCmdExecTimeShift = 0,
+};
+
+enum KernelProfilingInfoMask {
+ KernelProfilingInfoMaskNone = 0,
+ KernelProfilingInfoCmdExecTimeMask = 0x00000001,
+};
+
+enum Op {
+ OpNop = 0,
+ OpSource = 1,
+ OpSourceExtension = 2,
+ OpExtension = 3,
+ OpExtInstImport = 4,
+ OpMemoryModel = 5,
+ OpEntryPoint = 6,
+ OpExecutionMode = 7,
+ OpTypeVoid = 8,
+ OpTypeBool = 9,
+ OpTypeInt = 10,
+ OpTypeFloat = 11,
+ OpTypeVector = 12,
+ OpTypeMatrix = 13,
+ OpTypeSampler = 14,
+ OpTypeFilter = 15,
+ OpTypeArray = 16,
+ OpTypeRuntimeArray = 17,
+ OpTypeStruct = 18,
+ OpTypeOpaque = 19,
+ OpTypePointer = 20,
+ OpTypeFunction = 21,
+ OpTypeEvent = 22,
+ OpTypeDeviceEvent = 23,
+ OpTypeReserveId = 24,
+ OpTypeQueue = 25,
+ OpTypePipe = 26,
+ OpConstantTrue = 27,
+ OpConstantFalse = 28,
+ OpConstant = 29,
+ OpConstantComposite = 30,
+ OpConstantSampler = 31,
+ OpConstantNullPointer = 32,
+ OpConstantNullObject = 33,
+ OpSpecConstantTrue = 34,
+ OpSpecConstantFalse = 35,
+ OpSpecConstant = 36,
+ OpSpecConstantComposite = 37,
+ OpVariable = 38,
+ OpVariableArray = 39,
+ OpFunction = 40,
+ OpFunctionParameter = 41,
+ OpFunctionEnd = 42,
+ OpFunctionCall = 43,
+ OpExtInst = 44,
+ OpUndef = 45,
+ OpLoad = 46,
+ OpStore = 47,
+ OpPhi = 48,
+ OpDecorationGroup = 49,
+ OpDecorate = 50,
+ OpMemberDecorate = 51,
+ OpGroupDecorate = 52,
+ OpGroupMemberDecorate = 53,
+ OpName = 54,
+ OpMemberName = 55,
+ OpString = 56,
+ OpLine = 57,
+ OpVectorExtractDynamic = 58,
+ OpVectorInsertDynamic = 59,
+ OpVectorShuffle = 60,
+ OpCompositeConstruct = 61,
+ OpCompositeExtract = 62,
+ OpCompositeInsert = 63,
+ OpCopyObject = 64,
+ OpCopyMemory = 65,
+ OpCopyMemorySized = 66,
+ OpSampler = 67,
+ OpTextureSample = 68,
+ OpTextureSampleDref = 69,
+ OpTextureSampleLod = 70,
+ OpTextureSampleProj = 71,
+ OpTextureSampleGrad = 72,
+ OpTextureSampleOffset = 73,
+ OpTextureSampleProjLod = 74,
+ OpTextureSampleProjGrad = 75,
+ OpTextureSampleLodOffset = 76,
+ OpTextureSampleProjOffset = 77,
+ OpTextureSampleGradOffset = 78,
+ OpTextureSampleProjLodOffset = 79,
+ OpTextureSampleProjGradOffset = 80,
+ OpTextureFetchTexelLod = 81,
+ OpTextureFetchTexelOffset = 82,
+ OpTextureFetchSample = 83,
+ OpTextureFetchTexel = 84,
+ OpTextureGather = 85,
+ OpTextureGatherOffset = 86,
+ OpTextureGatherOffsets = 87,
+ OpTextureQuerySizeLod = 88,
+ OpTextureQuerySize = 89,
+ OpTextureQueryLod = 90,
+ OpTextureQueryLevels = 91,
+ OpTextureQuerySamples = 92,
+ OpAccessChain = 93,
+ OpInBoundsAccessChain = 94,
+ OpSNegate = 95,
+ OpFNegate = 96,
+ OpNot = 97,
+ OpAny = 98,
+ OpAll = 99,
+ OpConvertFToU = 100,
+ OpConvertFToS = 101,
+ OpConvertSToF = 102,
+ OpConvertUToF = 103,
+ OpUConvert = 104,
+ OpSConvert = 105,
+ OpFConvert = 106,
+ OpConvertPtrToU = 107,
+ OpConvertUToPtr = 108,
+ OpPtrCastToGeneric = 109,
+ OpGenericCastToPtr = 110,
+ OpBitcast = 111,
+ OpTranspose = 112,
+ OpIsNan = 113,
+ OpIsInf = 114,
+ OpIsFinite = 115,
+ OpIsNormal = 116,
+ OpSignBitSet = 117,
+ OpLessOrGreater = 118,
+ OpOrdered = 119,
+ OpUnordered = 120,
+ OpArrayLength = 121,
+ OpIAdd = 122,
+ OpFAdd = 123,
+ OpISub = 124,
+ OpFSub = 125,
+ OpIMul = 126,
+ OpFMul = 127,
+ OpUDiv = 128,
+ OpSDiv = 129,
+ OpFDiv = 130,
+ OpUMod = 131,
+ OpSRem = 132,
+ OpSMod = 133,
+ OpFRem = 134,
+ OpFMod = 135,
+ OpVectorTimesScalar = 136,
+ OpMatrixTimesScalar = 137,
+ OpVectorTimesMatrix = 138,
+ OpMatrixTimesVector = 139,
+ OpMatrixTimesMatrix = 140,
+ OpOuterProduct = 141,
+ OpDot = 142,
+ OpShiftRightLogical = 143,
+ OpShiftRightArithmetic = 144,
+ OpShiftLeftLogical = 145,
+ OpLogicalOr = 146,
+ OpLogicalXor = 147,
+ OpLogicalAnd = 148,
+ OpBitwiseOr = 149,
+ OpBitwiseXor = 150,
+ OpBitwiseAnd = 151,
+ OpSelect = 152,
+ OpIEqual = 153,
+ OpFOrdEqual = 154,
+ OpFUnordEqual = 155,
+ OpINotEqual = 156,
+ OpFOrdNotEqual = 157,
+ OpFUnordNotEqual = 158,
+ OpULessThan = 159,
+ OpSLessThan = 160,
+ OpFOrdLessThan = 161,
+ OpFUnordLessThan = 162,
+ OpUGreaterThan = 163,
+ OpSGreaterThan = 164,
+ OpFOrdGreaterThan = 165,
+ OpFUnordGreaterThan = 166,
+ OpULessThanEqual = 167,
+ OpSLessThanEqual = 168,
+ OpFOrdLessThanEqual = 169,
+ OpFUnordLessThanEqual = 170,
+ OpUGreaterThanEqual = 171,
+ OpSGreaterThanEqual = 172,
+ OpFOrdGreaterThanEqual = 173,
+ OpFUnordGreaterThanEqual = 174,
+ OpDPdx = 175,
+ OpDPdy = 176,
+ OpFwidth = 177,
+ OpDPdxFine = 178,
+ OpDPdyFine = 179,
+ OpFwidthFine = 180,
+ OpDPdxCoarse = 181,
+ OpDPdyCoarse = 182,
+ OpFwidthCoarse = 183,
+ OpEmitVertex = 184,
+ OpEndPrimitive = 185,
+ OpEmitStreamVertex = 186,
+ OpEndStreamPrimitive = 187,
+ OpControlBarrier = 188,
+ OpMemoryBarrier = 189,
+ OpImagePointer = 190,
+ OpAtomicInit = 191,
+ OpAtomicLoad = 192,
+ OpAtomicStore = 193,
+ OpAtomicExchange = 194,
+ OpAtomicCompareExchange = 195,
+ OpAtomicCompareExchangeWeak = 196,
+ OpAtomicIIncrement = 197,
+ OpAtomicIDecrement = 198,
+ OpAtomicIAdd = 199,
+ OpAtomicISub = 200,
+ OpAtomicUMin = 201,
+ OpAtomicUMax = 202,
+ OpAtomicAnd = 203,
+ OpAtomicOr = 204,
+ OpAtomicXor = 205,
+ OpLoopMerge = 206,
+ OpSelectionMerge = 207,
+ OpLabel = 208,
+ OpBranch = 209,
+ OpBranchConditional = 210,
+ OpSwitch = 211,
+ OpKill = 212,
+ OpReturn = 213,
+ OpReturnValue = 214,
+ OpUnreachable = 215,
+ OpLifetimeStart = 216,
+ OpLifetimeStop = 217,
+ OpCompileFlag = 218,
+ OpAsyncGroupCopy = 219,
+ OpWaitGroupEvents = 220,
+ OpGroupAll = 221,
+ OpGroupAny = 222,
+ OpGroupBroadcast = 223,
+ OpGroupIAdd = 224,
+ OpGroupFAdd = 225,
+ OpGroupFMin = 226,
+ OpGroupUMin = 227,
+ OpGroupSMin = 228,
+ OpGroupFMax = 229,
+ OpGroupUMax = 230,
+ OpGroupSMax = 231,
+ OpGenericCastToPtrExplicit = 232,
+ OpGenericPtrMemSemantics = 233,
+ OpReadPipe = 234,
+ OpWritePipe = 235,
+ OpReservedReadPipe = 236,
+ OpReservedWritePipe = 237,
+ OpReserveReadPipePackets = 238,
+ OpReserveWritePipePackets = 239,
+ OpCommitReadPipe = 240,
+ OpCommitWritePipe = 241,
+ OpIsValidReserveId = 242,
+ OpGetNumPipePackets = 243,
+ OpGetMaxPipePackets = 244,
+ OpGroupReserveReadPipePackets = 245,
+ OpGroupReserveWritePipePackets = 246,
+ OpGroupCommitReadPipe = 247,
+ OpGroupCommitWritePipe = 248,
+ OpEnqueueMarker = 249,
+ OpEnqueueKernel = 250,
+ OpGetKernelNDrangeSubGroupCount = 251,
+ OpGetKernelNDrangeMaxSubGroupSize = 252,
+ OpGetKernelWorkGroupSize = 253,
+ OpGetKernelPreferredWorkGroupSizeMultiple = 254,
+ OpRetainEvent = 255,
+ OpReleaseEvent = 256,
+ OpCreateUserEvent = 257,
+ OpIsValidEvent = 258,
+ OpSetUserEventStatus = 259,
+ OpCaptureEventProfilingInfo = 260,
+ OpGetDefaultQueue = 261,
+ OpBuildNDRange = 262,
+ OpSatConvertSToU = 263,
+ OpSatConvertUToS = 264,
+ OpAtomicIMin = 265,
+ OpAtomicIMax = 266,
};
-#ifdef __cplusplus
}; // end namespace spv
-#endif
-#endif // spirv_H
+#endif // #ifdef __cplusplus
+
+
+#ifndef __cplusplus
+
+const int SpvMagicNumber = 0x07230203;
+const int SpvVersion = 99;
+
+typedef unsigned int SpvId;
+
+const unsigned int SpvOpCodeMask = 0xFFFF;
+const unsigned int SpvWordCountShift = 16;
+
+typedef enum SpvSourceLanguage_ {
+ SpvSourceLanguageUnknown = 0,
+ SpvSourceLanguageESSL = 1,
+ SpvSourceLanguageGLSL = 2,
+ SpvSourceLanguageOpenCL = 3,
+} SpvSourceLanguage;
+
+typedef enum SpvExecutionModel_ {
+ SpvExecutionModelVertex = 0,
+ SpvExecutionModelTessellationControl = 1,
+ SpvExecutionModelTessellationEvaluation = 2,
+ SpvExecutionModelGeometry = 3,
+ SpvExecutionModelFragment = 4,
+ SpvExecutionModelGLCompute = 5,
+ SpvExecutionModelKernel = 6,
+} SpvExecutionModel;
+
+typedef enum SpvAddressingModel_ {
+ SpvAddressingModelLogical = 0,
+ SpvAddressingModelPhysical32 = 1,
+ SpvAddressingModelPhysical64 = 2,
+} SpvAddressingModel;
+
+typedef enum SpvMemoryModel_ {
+ SpvMemoryModelSimple = 0,
+ SpvMemoryModelGLSL450 = 1,
+ SpvMemoryModelOpenCL12 = 2,
+ SpvMemoryModelOpenCL20 = 3,
+ SpvMemoryModelOpenCL21 = 4,
+} SpvMemoryModel;
+
+typedef enum SpvExecutionMode_ {
+ SpvExecutionModeInvocations = 0,
+ SpvExecutionModeSpacingEqual = 1,
+ SpvExecutionModeSpacingFractionalEven = 2,
+ SpvExecutionModeSpacingFractionalOdd = 3,
+ SpvExecutionModeVertexOrderCw = 4,
+ SpvExecutionModeVertexOrderCcw = 5,
+ SpvExecutionModePixelCenterInteger = 6,
+ SpvExecutionModeOriginUpperLeft = 7,
+ SpvExecutionModeEarlyFragmentTests = 8,
+ SpvExecutionModePointMode = 9,
+ SpvExecutionModeXfb = 10,
+ SpvExecutionModeDepthReplacing = 11,
+ SpvExecutionModeDepthAny = 12,
+ SpvExecutionModeDepthGreater = 13,
+ SpvExecutionModeDepthLess = 14,
+ SpvExecutionModeDepthUnchanged = 15,
+ SpvExecutionModeLocalSize = 16,
+ SpvExecutionModeLocalSizeHint = 17,
+ SpvExecutionModeInputPoints = 18,
+ SpvExecutionModeInputLines = 19,
+ SpvExecutionModeInputLinesAdjacency = 20,
+ SpvExecutionModeInputTriangles = 21,
+ SpvExecutionModeInputTrianglesAdjacency = 22,
+ SpvExecutionModeInputQuads = 23,
+ SpvExecutionModeInputIsolines = 24,
+ SpvExecutionModeOutputVertices = 25,
+ SpvExecutionModeOutputPoints = 26,
+ SpvExecutionModeOutputLineStrip = 27,
+ SpvExecutionModeOutputTriangleStrip = 28,
+ SpvExecutionModeVecTypeHint = 29,
+ SpvExecutionModeContractionOff = 30,
+} SpvExecutionMode;
+
+typedef enum SpvStorageClass_ {
+ SpvStorageClassUniformConstant = 0,
+ SpvStorageClassInput = 1,
+ SpvStorageClassUniform = 2,
+ SpvStorageClassOutput = 3,
+ SpvStorageClassWorkgroupLocal = 4,
+ SpvStorageClassWorkgroupGlobal = 5,
+ SpvStorageClassPrivateGlobal = 6,
+ SpvStorageClassFunction = 7,
+ SpvStorageClassGeneric = 8,
+ SpvStorageClassPrivate = 9,
+ SpvStorageClassAtomicCounter = 10,
+} SpvStorageClass;
+
+typedef enum SpvDim_ {
+ SpvDim1D = 0,
+ SpvDim2D = 1,
+ SpvDim3D = 2,
+ SpvDimCube = 3,
+ SpvDimRect = 4,
+ SpvDimBuffer = 5,
+} SpvDim;
+
+typedef enum SpvSamplerAddressingMode_ {
+ SpvSamplerAddressingModeNone = 0,
+ SpvSamplerAddressingModeClampToEdge = 1,
+ SpvSamplerAddressingModeClamp = 2,
+ SpvSamplerAddressingModeRepeat = 3,
+ SpvSamplerAddressingModeRepeatMirrored = 4,
+} SpvSamplerAddressingMode;
+
+typedef enum SpvSamplerFilterMode_ {
+ SpvSamplerFilterModeNearest = 0,
+ SpvSamplerFilterModeLinear = 1,
+} SpvSamplerFilterMode;
+
+typedef enum SpvFPFastMathModeShift_ {
+ SpvFPFastMathModeNotNaNShift = 0,
+ SpvFPFastMathModeNotInfShift = 1,
+ SpvFPFastMathModeNSZShift = 2,
+ SpvFPFastMathModeAllowRecipShift = 3,
+ SpvFPFastMathModeFastShift = 4,
+} SpvFPFastMathModeShift;
+
+typedef enum SpvFPFastMathModeMask_ {
+ SpvFPFastMathModeMaskNone = 0,
+ SpvFPFastMathModeNotNaNMask = 0x00000001,
+ SpvFPFastMathModeNotInfMask = 0x00000002,
+ SpvFPFastMathModeNSZMask = 0x00000004,
+ SpvFPFastMathModeAllowRecipMask = 0x00000008,
+ SpvFPFastMathModeFastMask = 0x00000010,
+} SpvFPFastMathModeMask;
+
+typedef enum SpvFPRoundingMode_ {
+ SpvFPRoundingModeRTE = 0,
+ SpvFPRoundingModeRTZ = 1,
+ SpvFPRoundingModeRTP = 2,
+ SpvFPRoundingModeRTN = 3,
+} SpvFPRoundingMode;
+
+typedef enum SpvLinkageType_ {
+ SpvLinkageTypeExport = 0,
+ SpvLinkageTypeImport = 1,
+} SpvLinkageType;
+
+typedef enum SpvAccessQualifier_ {
+ SpvAccessQualifierReadOnly = 0,
+ SpvAccessQualifierWriteOnly = 1,
+ SpvAccessQualifierReadWrite = 2,
+} SpvAccessQualifier;
+
+typedef enum SpvFunctionParameterAttribute_ {
+ SpvFunctionParameterAttributeZext = 0,
+ SpvFunctionParameterAttributeSext = 1,
+ SpvFunctionParameterAttributeByVal = 2,
+ SpvFunctionParameterAttributeSret = 3,
+ SpvFunctionParameterAttributeNoAlias = 4,
+ SpvFunctionParameterAttributeNoCapture = 5,
+ SpvFunctionParameterAttributeSVM = 6,
+ SpvFunctionParameterAttributeNoWrite = 7,
+ SpvFunctionParameterAttributeNoReadWrite = 8,
+} SpvFunctionParameterAttribute;
+
+typedef enum SpvDecoration_ {
+ SpvDecorationPrecisionLow = 0,
+ SpvDecorationPrecisionMedium = 1,
+ SpvDecorationPrecisionHigh = 2,
+ SpvDecorationBlock = 3,
+ SpvDecorationBufferBlock = 4,
+ SpvDecorationRowMajor = 5,
+ SpvDecorationColMajor = 6,
+ SpvDecorationGLSLShared = 7,
+ SpvDecorationGLSLStd140 = 8,
+ SpvDecorationGLSLStd430 = 9,
+ SpvDecorationGLSLPacked = 10,
+ SpvDecorationSmooth = 11,
+ SpvDecorationNoperspective = 12,
+ SpvDecorationFlat = 13,
+ SpvDecorationPatch = 14,
+ SpvDecorationCentroid = 15,
+ SpvDecorationSample = 16,
+ SpvDecorationInvariant = 17,
+ SpvDecorationRestrict = 18,
+ SpvDecorationAliased = 19,
+ SpvDecorationVolatile = 20,
+ SpvDecorationConstant = 21,
+ SpvDecorationCoherent = 22,
+ SpvDecorationNonwritable = 23,
+ SpvDecorationNonreadable = 24,
+ SpvDecorationUniform = 25,
+ SpvDecorationNoStaticUse = 26,
+ SpvDecorationCPacked = 27,
+ SpvDecorationSaturatedConversion = 28,
+ SpvDecorationStream = 29,
+ SpvDecorationLocation = 30,
+ SpvDecorationComponent = 31,
+ SpvDecorationIndex = 32,
+ SpvDecorationBinding = 33,
+ SpvDecorationDescriptorSet = 34,
+ SpvDecorationOffset = 35,
+ SpvDecorationAlignment = 36,
+ SpvDecorationXfbBuffer = 37,
+ SpvDecorationStride = 38,
+ SpvDecorationBuiltIn = 39,
+ SpvDecorationFuncParamAttr = 40,
+ SpvDecorationFPRoundingMode = 41,
+ SpvDecorationFPFastMathMode = 42,
+ SpvDecorationLinkageAttributes = 43,
+ SpvDecorationSpecId = 44,
+} SpvDecoration;
+
+typedef enum SpvBuiltIn_ {
+ SpvBuiltInPosition = 0,
+ SpvBuiltInPointSize = 1,
+ SpvBuiltInClipVertex = 2,
+ SpvBuiltInClipDistance = 3,
+ SpvBuiltInCullDistance = 4,
+ SpvBuiltInVertexId = 5,
+ SpvBuiltInInstanceId = 6,
+ SpvBuiltInPrimitiveId = 7,
+ SpvBuiltInInvocationId = 8,
+ SpvBuiltInLayer = 9,
+ SpvBuiltInViewportIndex = 10,
+ SpvBuiltInTessLevelOuter = 11,
+ SpvBuiltInTessLevelInner = 12,
+ SpvBuiltInTessCoord = 13,
+ SpvBuiltInPatchVertices = 14,
+ SpvBuiltInFragCoord = 15,
+ SpvBuiltInPointCoord = 16,
+ SpvBuiltInFrontFacing = 17,
+ SpvBuiltInSampleId = 18,
+ SpvBuiltInSamplePosition = 19,
+ SpvBuiltInSampleMask = 20,
+ SpvBuiltInFragColor = 21,
+ SpvBuiltInFragDepth = 22,
+ SpvBuiltInHelperInvocation = 23,
+ SpvBuiltInNumWorkgroups = 24,
+ SpvBuiltInWorkgroupSize = 25,
+ SpvBuiltInWorkgroupId = 26,
+ SpvBuiltInLocalInvocationId = 27,
+ SpvBuiltInGlobalInvocationId = 28,
+ SpvBuiltInLocalInvocationIndex = 29,
+ SpvBuiltInWorkDim = 30,
+ SpvBuiltInGlobalSize = 31,
+ SpvBuiltInEnqueuedWorkgroupSize = 32,
+ SpvBuiltInGlobalOffset = 33,
+ SpvBuiltInGlobalLinearId = 34,
+ SpvBuiltInWorkgroupLinearId = 35,
+ SpvBuiltInSubgroupSize = 36,
+ SpvBuiltInSubgroupMaxSize = 37,
+ SpvBuiltInNumSubgroups = 38,
+ SpvBuiltInNumEnqueuedSubgroups = 39,
+ SpvBuiltInSubgroupId = 40,
+ SpvBuiltInSubgroupLocalInvocationId = 41,
+} SpvBuiltIn;
+
+typedef enum SpvSelectionControlShift_ {
+ SpvSelectionControlFlattenShift = 0,
+ SpvSelectionControlDontFlattenShift = 1,
+} SpvSelectionControlShift;
+
+typedef enum SpvSelectionControlMask_ {
+ SpvSelectionControlMaskNone = 0,
+ SpvSelectionControlFlattenMask = 0x00000001,
+ SpvSelectionControlDontFlattenMask = 0x00000002,
+} SpvSelectionControlMask;
+
+typedef enum SpvLoopControlShift_ {
+ SpvLoopControlUnrollShift = 0,
+ SpvLoopControlDontUnrollShift = 1,
+} SpvLoopControlShift;
+
+typedef enum SpvLoopControlMask_ {
+ SpvLoopControlMaskNone = 0,
+ SpvLoopControlUnrollMask = 0x00000001,
+ SpvLoopControlDontUnrollMask = 0x00000002,
+} SpvLoopControlMask;
+
+typedef enum SpvFunctionControlShift_ {
+ SpvFunctionControlInlineShift = 0,
+ SpvFunctionControlDontInlineShift = 1,
+ SpvFunctionControlPureShift = 2,
+ SpvFunctionControlConstShift = 3,
+} SpvFunctionControlShift;
+
+typedef enum SpvFunctionControlMask_ {
+ SpvFunctionControlMaskNone = 0,
+ SpvFunctionControlInlineMask = 0x00000001,
+ SpvFunctionControlDontInlineMask = 0x00000002,
+ SpvFunctionControlPureMask = 0x00000004,
+ SpvFunctionControlConstMask = 0x00000008,
+} SpvFunctionControlMask;
+
+typedef enum SpvMemorySemanticsShift_ {
+ SpvMemorySemanticsRelaxedShift = 0,
+ SpvMemorySemanticsSequentiallyConsistentShift = 1,
+ SpvMemorySemanticsAcquireShift = 2,
+ SpvMemorySemanticsReleaseShift = 3,
+ SpvMemorySemanticsUniformMemoryShift = 4,
+ SpvMemorySemanticsSubgroupMemoryShift = 5,
+ SpvMemorySemanticsWorkgroupLocalMemoryShift = 6,
+ SpvMemorySemanticsWorkgroupGlobalMemoryShift = 7,
+ SpvMemorySemanticsAtomicCounterMemoryShift = 8,
+ SpvMemorySemanticsImageMemoryShift = 9,
+} SpvMemorySemanticsShift;
+
+typedef enum SpvMemorySemanticsMask_ {
+ SpvMemorySemanticsMaskNone = 0,
+ SpvMemorySemanticsRelaxedMask = 0x00000001,
+ SpvMemorySemanticsSequentiallyConsistentMask = 0x00000002,
+ SpvMemorySemanticsAcquireMask = 0x00000004,
+ SpvMemorySemanticsReleaseMask = 0x00000008,
+ SpvMemorySemanticsUniformMemoryMask = 0x00000010,
+ SpvMemorySemanticsSubgroupMemoryMask = 0x00000020,
+ SpvMemorySemanticsWorkgroupLocalMemoryMask = 0x00000040,
+ SpvMemorySemanticsWorkgroupGlobalMemoryMask = 0x00000080,
+ SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000100,
+ SpvMemorySemanticsImageMemoryMask = 0x00000200,
+} SpvMemorySemanticsMask;
+
+typedef enum SpvMemoryAccessShift_ {
+ SpvMemoryAccessVolatileShift = 0,
+ SpvMemoryAccessAlignedShift = 1,
+} SpvMemoryAccessShift;
+
+typedef enum SpvMemoryAccessMask_ {
+ SpvMemoryAccessMaskNone = 0,
+ SpvMemoryAccessVolatileMask = 0x00000001,
+ SpvMemoryAccessAlignedMask = 0x00000002,
+} SpvMemoryAccessMask;
+
+typedef enum SpvExecutionScope_ {
+ SpvExecutionScopeCrossDevice = 0,
+ SpvExecutionScopeDevice = 1,
+ SpvExecutionScopeWorkgroup = 2,
+ SpvExecutionScopeSubgroup = 3,
+} SpvExecutionScope;
+
+typedef enum SpvGroupOperation_ {
+ SpvGroupOperationReduce = 0,
+ SpvGroupOperationInclusiveScan = 1,
+ SpvGroupOperationExclusiveScan = 2,
+} SpvGroupOperation;
+
+typedef enum SpvKernelEnqueueFlags_ {
+ SpvKernelEnqueueFlagsNoWait = 0,
+ SpvKernelEnqueueFlagsWaitKernel = 1,
+ SpvKernelEnqueueFlagsWaitWorkGroup = 2,
+} SpvKernelEnqueueFlags;
+
+typedef enum SpvKernelProfilingInfoShift_ {
+ SpvKernelProfilingInfoCmdExecTimeShift = 0,
+} SpvKernelProfilingInfoShift;
+
+typedef enum SpvKernelProfilingInfoMask_ {
+ SpvKernelProfilingInfoMaskNone = 0,
+ SpvKernelProfilingInfoCmdExecTimeMask = 0x00000001,
+} SpvKernelProfilingInfoMask;
+
+typedef enum SpvOp_ {
+ SpvOpNop = 0,
+ SpvOpSource = 1,
+ SpvOpSourceExtension = 2,
+ SpvOpExtension = 3,
+ SpvOpExtInstImport = 4,
+ SpvOpMemoryModel = 5,
+ SpvOpEntryPoint = 6,
+ SpvOpExecutionMode = 7,
+ SpvOpTypeVoid = 8,
+ SpvOpTypeBool = 9,
+ SpvOpTypeInt = 10,
+ SpvOpTypeFloat = 11,
+ SpvOpTypeVector = 12,
+ SpvOpTypeMatrix = 13,
+ SpvOpTypeSampler = 14,
+ SpvOpTypeFilter = 15,
+ SpvOpTypeArray = 16,
+ SpvOpTypeRuntimeArray = 17,
+ SpvOpTypeStruct = 18,
+ SpvOpTypeOpaque = 19,
+ SpvOpTypePointer = 20,
+ SpvOpTypeFunction = 21,
+ SpvOpTypeEvent = 22,
+ SpvOpTypeDeviceEvent = 23,
+ SpvOpTypeReserveId = 24,
+ SpvOpTypeQueue = 25,
+ SpvOpTypePipe = 26,
+ SpvOpConstantTrue = 27,
+ SpvOpConstantFalse = 28,
+ SpvOpConstant = 29,
+ SpvOpConstantComposite = 30,
+ SpvOpConstantSampler = 31,
+ SpvOpConstantNullPointer = 32,
+ SpvOpConstantNullObject = 33,
+ SpvOpSpecConstantTrue = 34,
+ SpvOpSpecConstantFalse = 35,
+ SpvOpSpecConstant = 36,
+ SpvOpSpecConstantComposite = 37,
+ SpvOpVariable = 38,
+ SpvOpVariableArray = 39,
+ SpvOpFunction = 40,
+ SpvOpFunctionParameter = 41,
+ SpvOpFunctionEnd = 42,
+ SpvOpFunctionCall = 43,
+ SpvOpExtInst = 44,
+ SpvOpUndef = 45,
+ SpvOpLoad = 46,
+ SpvOpStore = 47,
+ SpvOpPhi = 48,
+ SpvOpDecorationGroup = 49,
+ SpvOpDecorate = 50,
+ SpvOpMemberDecorate = 51,
+ SpvOpGroupDecorate = 52,
+ SpvOpGroupMemberDecorate = 53,
+ SpvOpName = 54,
+ SpvOpMemberName = 55,
+ SpvOpString = 56,
+ SpvOpLine = 57,
+ SpvOpVectorExtractDynamic = 58,
+ SpvOpVectorInsertDynamic = 59,
+ SpvOpVectorShuffle = 60,
+ SpvOpCompositeConstruct = 61,
+ SpvOpCompositeExtract = 62,
+ SpvOpCompositeInsert = 63,
+ SpvOpCopyObject = 64,
+ SpvOpCopyMemory = 65,
+ SpvOpCopyMemorySized = 66,
+ SpvOpSampler = 67,
+ SpvOpTextureSample = 68,
+ SpvOpTextureSampleDref = 69,
+ SpvOpTextureSampleLod = 70,
+ SpvOpTextureSampleProj = 71,
+ SpvOpTextureSampleGrad = 72,
+ SpvOpTextureSampleOffset = 73,
+ SpvOpTextureSampleProjLod = 74,
+ SpvOpTextureSampleProjGrad = 75,
+ SpvOpTextureSampleLodOffset = 76,
+ SpvOpTextureSampleProjOffset = 77,
+ SpvOpTextureSampleGradOffset = 78,
+ SpvOpTextureSampleProjLodOffset = 79,
+ SpvOpTextureSampleProjGradOffset = 80,
+ SpvOpTextureFetchTexelLod = 81,
+ SpvOpTextureFetchTexelOffset = 82,
+ SpvOpTextureFetchSample = 83,
+ SpvOpTextureFetchTexel = 84,
+ SpvOpTextureGather = 85,
+ SpvOpTextureGatherOffset = 86,
+ SpvOpTextureGatherOffsets = 87,
+ SpvOpTextureQuerySizeLod = 88,
+ SpvOpTextureQuerySize = 89,
+ SpvOpTextureQueryLod = 90,
+ SpvOpTextureQueryLevels = 91,
+ SpvOpTextureQuerySamples = 92,
+ SpvOpAccessChain = 93,
+ SpvOpInBoundsAccessChain = 94,
+ SpvOpSNegate = 95,
+ SpvOpFNegate = 96,
+ SpvOpNot = 97,
+ SpvOpAny = 98,
+ SpvOpAll = 99,
+ SpvOpConvertFToU = 100,
+ SpvOpConvertFToS = 101,
+ SpvOpConvertSToF = 102,
+ SpvOpConvertUToF = 103,
+ SpvOpUConvert = 104,
+ SpvOpSConvert = 105,
+ SpvOpFConvert = 106,
+ SpvOpConvertPtrToU = 107,
+ SpvOpConvertUToPtr = 108,
+ SpvOpPtrCastToGeneric = 109,
+ SpvOpGenericCastToPtr = 110,
+ SpvOpBitcast = 111,
+ SpvOpTranspose = 112,
+ SpvOpIsNan = 113,
+ SpvOpIsInf = 114,
+ SpvOpIsFinite = 115,
+ SpvOpIsNormal = 116,
+ SpvOpSignBitSet = 117,
+ SpvOpLessOrGreater = 118,
+ SpvOpOrdered = 119,
+ SpvOpUnordered = 120,
+ SpvOpArrayLength = 121,
+ SpvOpIAdd = 122,
+ SpvOpFAdd = 123,
+ SpvOpISub = 124,
+ SpvOpFSub = 125,
+ SpvOpIMul = 126,
+ SpvOpFMul = 127,
+ SpvOpUDiv = 128,
+ SpvOpSDiv = 129,
+ SpvOpFDiv = 130,
+ SpvOpUMod = 131,
+ SpvOpSRem = 132,
+ SpvOpSMod = 133,
+ SpvOpFRem = 134,
+ SpvOpFMod = 135,
+ SpvOpVectorTimesScalar = 136,
+ SpvOpMatrixTimesScalar = 137,
+ SpvOpVectorTimesMatrix = 138,
+ SpvOpMatrixTimesVector = 139,
+ SpvOpMatrixTimesMatrix = 140,
+ SpvOpOuterProduct = 141,
+ SpvOpDot = 142,
+ SpvOpShiftRightLogical = 143,
+ SpvOpShiftRightArithmetic = 144,
+ SpvOpShiftLeftLogical = 145,
+ SpvOpLogicalOr = 146,
+ SpvOpLogicalXor = 147,
+ SpvOpLogicalAnd = 148,
+ SpvOpBitwiseOr = 149,
+ SpvOpBitwiseXor = 150,
+ SpvOpBitwiseAnd = 151,
+ SpvOpSelect = 152,
+ SpvOpIEqual = 153,
+ SpvOpFOrdEqual = 154,
+ SpvOpFUnordEqual = 155,
+ SpvOpINotEqual = 156,
+ SpvOpFOrdNotEqual = 157,
+ SpvOpFUnordNotEqual = 158,
+ SpvOpULessThan = 159,
+ SpvOpSLessThan = 160,
+ SpvOpFOrdLessThan = 161,
+ SpvOpFUnordLessThan = 162,
+ SpvOpUGreaterThan = 163,
+ SpvOpSGreaterThan = 164,
+ SpvOpFOrdGreaterThan = 165,
+ SpvOpFUnordGreaterThan = 166,
+ SpvOpULessThanEqual = 167,
+ SpvOpSLessThanEqual = 168,
+ SpvOpFOrdLessThanEqual = 169,
+ SpvOpFUnordLessThanEqual = 170,
+ SpvOpUGreaterThanEqual = 171,
+ SpvOpSGreaterThanEqual = 172,
+ SpvOpFOrdGreaterThanEqual = 173,
+ SpvOpFUnordGreaterThanEqual = 174,
+ SpvOpDPdx = 175,
+ SpvOpDPdy = 176,
+ SpvOpFwidth = 177,
+ SpvOpDPdxFine = 178,
+ SpvOpDPdyFine = 179,
+ SpvOpFwidthFine = 180,
+ SpvOpDPdxCoarse = 181,
+ SpvOpDPdyCoarse = 182,
+ SpvOpFwidthCoarse = 183,
+ SpvOpEmitVertex = 184,
+ SpvOpEndPrimitive = 185,
+ SpvOpEmitStreamVertex = 186,
+ SpvOpEndStreamPrimitive = 187,
+ SpvOpControlBarrier = 188,
+ SpvOpMemoryBarrier = 189,
+ SpvOpImagePointer = 190,
+ SpvOpAtomicInit = 191,
+ SpvOpAtomicLoad = 192,
+ SpvOpAtomicStore = 193,
+ SpvOpAtomicExchange = 194,
+ SpvOpAtomicCompareExchange = 195,
+ SpvOpAtomicCompareExchangeWeak = 196,
+ SpvOpAtomicIIncrement = 197,
+ SpvOpAtomicIDecrement = 198,
+ SpvOpAtomicIAdd = 199,
+ SpvOpAtomicISub = 200,
+ SpvOpAtomicUMin = 201,
+ SpvOpAtomicUMax = 202,
+ SpvOpAtomicAnd = 203,
+ SpvOpAtomicOr = 204,
+ SpvOpAtomicXor = 205,
+ SpvOpLoopMerge = 206,
+ SpvOpSelectionMerge = 207,
+ SpvOpLabel = 208,
+ SpvOpBranch = 209,
+ SpvOpBranchConditional = 210,
+ SpvOpSwitch = 211,
+ SpvOpKill = 212,
+ SpvOpReturn = 213,
+ SpvOpReturnValue = 214,
+ SpvOpUnreachable = 215,
+ SpvOpLifetimeStart = 216,
+ SpvOpLifetimeStop = 217,
+ SpvOpCompileFlag = 218,
+ SpvOpAsyncGroupCopy = 219,
+ SpvOpWaitGroupEvents = 220,
+ SpvOpGroupAll = 221,
+ SpvOpGroupAny = 222,
+ SpvOpGroupBroadcast = 223,
+ SpvOpGroupIAdd = 224,
+ SpvOpGroupFAdd = 225,
+ SpvOpGroupFMin = 226,
+ SpvOpGroupUMin = 227,
+ SpvOpGroupSMin = 228,
+ SpvOpGroupFMax = 229,
+ SpvOpGroupUMax = 230,
+ SpvOpGroupSMax = 231,
+ SpvOpGenericCastToPtrExplicit = 232,
+ SpvOpGenericPtrMemSemantics = 233,
+ SpvOpReadPipe = 234,
+ SpvOpWritePipe = 235,
+ SpvOpReservedReadPipe = 236,
+ SpvOpReservedWritePipe = 237,
+ SpvOpReserveReadPipePackets = 238,
+ SpvOpReserveWritePipePackets = 239,
+ SpvOpCommitReadPipe = 240,
+ SpvOpCommitWritePipe = 241,
+ SpvOpIsValidReserveId = 242,
+ SpvOpGetNumPipePackets = 243,
+ SpvOpGetMaxPipePackets = 244,
+ SpvOpGroupReserveReadPipePackets = 245,
+ SpvOpGroupReserveWritePipePackets = 246,
+ SpvOpGroupCommitReadPipe = 247,
+ SpvOpGroupCommitWritePipe = 248,
+ SpvOpEnqueueMarker = 249,
+ SpvOpEnqueueKernel = 250,
+ SpvOpGetKernelNDrangeSubGroupCount = 251,
+ SpvOpGetKernelNDrangeMaxSubGroupSize = 252,
+ SpvOpGetKernelWorkGroupSize = 253,
+ SpvOpGetKernelPreferredWorkGroupSizeMultiple = 254,
+ SpvOpRetainEvent = 255,
+ SpvOpReleaseEvent = 256,
+ SpvOpCreateUserEvent = 257,
+ SpvOpIsValidEvent = 258,
+ SpvOpSetUserEventStatus = 259,
+ SpvOpCaptureEventProfilingInfo = 260,
+ SpvOpGetDefaultQueue = 261,
+ SpvOpBuildNDRange = 262,
+ SpvOpSatConvertSToU = 263,
+ SpvOpSatConvertUToS = 264,
+ SpvOpAtomicIMin = 265,
+ SpvOpAtomicIMax = 266,
+} SpvOp;
+
+#endif // #ifndef __cplusplus
+
+#endif // #ifndef spirv_H
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
index 274bc4dc..6365e8d1 100644
--- a/loader/CMakeLists.txt
+++ b/loader/CMakeLists.txt
@@ -1,20 +1,3 @@
-add_custom_command(OUTPUT dispatch.c
- COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py loader-entrypoints > dispatch.c
- DEPENDS ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py ${PROJECT_SOURCE_DIR}/vulkan.py
- ${PROJECT_SOURCE_DIR}/include/vkIcd.h)
-
-add_custom_command(OUTPUT table_ops.h
- COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py dispatch-table-ops loader > table_ops.h
- DEPENDS ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py ${PROJECT_SOURCE_DIR}/vulkan.py)
-
-add_custom_command(OUTPUT vulkan.def
- COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py win-def-file vulkan all > vulkan.def
- DEPENDS ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py ${PROJECT_SOURCE_DIR}/vulkan.py)
-
-add_custom_command(OUTPUT gpa_helper.h
- COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py loader-get-proc-addr loader > gpa_helper.h
- DEPENDS ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py ${PROJECT_SOURCE_DIR}/vulkan.py)
-
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
@@ -27,16 +10,16 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
if (WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES -D_CRT_SECURE_NO_WARNINGS -DXCB_NVIDIA")
- add_library(vulkan SHARED loader.c loader.h dirent_on_windows.c dispatch.c table_ops.h gpa_helper.h vulkan.def)
+ add_library(vulkan SHARED loader.c loader.h loader_platform.h dirent_on_windows.c trampoline.c table_ops.h gpa_helper.h vulkan.def)
set_target_properties(vulkan PROPERTIES LINK_FLAGS "/DEF:${PROJECT_SOURCE_DIR}/loader/vulkan.def")
- add_library(VKstatic STATIC loader.c loader.h dirent_on_windows.c dispatch.c table_ops.h gpa_helper.h)
+ add_library(VKstatic STATIC loader.c loader.h dirent_on_windows.c trampoline.c table_ops.h gpa_helper.h)
set_target_properties(VKstatic PROPERTIES OUTPUT_NAME VKstatic)
target_link_libraries(vulkan)
endif()
if (NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES -Wpointer-arith")
- add_library(vulkan SHARED loader.c dispatch.c table_ops.h gpa_helper.h)
+ add_library(vulkan SHARED loader.c trampoline.c loader.h loader_platform.h table_ops.h gpa_helper.h)
set_target_properties(vulkan PROPERTIES SOVERSION 0)
target_link_libraries(vulkan -ldl -lpthread)
endif()
diff --git a/loader/gpa_helper.h b/loader/gpa_helper.h
new file mode 100644
index 00000000..28bb9e3b
--- /dev/null
+++ b/loader/gpa_helper.h
@@ -0,0 +1,339 @@
+/*
+ * Vulkan
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is 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 Software.
+ *
+ * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <string.h>
+
+static inline void* globalGetProcAddr(const char *name)
+{
+ if (!name || name[0] != 'v' || name[1] != 'k')
+ return NULL;
+
+ name += 2;
+ if (!strcmp(name, "CreateInstance"))
+ return (void*) vkCreateInstance;
+ if (!strcmp(name, "DestroyInstance"))
+ return (void*) vkDestroyInstance;
+ if (!strcmp(name, "EnumeratePhysicalDevices"))
+ return (void*) vkEnumeratePhysicalDevices;
+ if (!strcmp(name, "GetPhysicalDeviceInfo"))
+ return (void*) vkGetPhysicalDeviceInfo;
+ if (!strcmp(name, "GetInstanceProcAddr"))
+ return (void*) vkGetInstanceProcAddr;
+ if (!strcmp(name, "GetProcAddr"))
+ return (void*) vkGetProcAddr;
+ if (!strcmp(name, "CreateDevice"))
+ return (void*) vkCreateDevice;
+ if (!strcmp(name, "DestroyDevice"))
+ return (void*) vkDestroyDevice;
+ if (!strcmp(name, "GetGlobalExtensionInfo"))
+ return (void*) vkGetGlobalExtensionInfo;
+ if (!strcmp(name, "GetPhysicalDeviceExtensionInfo"))
+ return (void*) vkGetPhysicalDeviceExtensionInfo;
+ if (!strcmp(name, "EnumerateLayers"))
+ return (void*) vkEnumerateLayers;
+ if (!strcmp(name, "GetDeviceQueue"))
+ return (void*) vkGetDeviceQueue;
+ if (!strcmp(name, "QueueSubmit"))
+ return (void*) vkQueueSubmit;
+ if (!strcmp(name, "QueueWaitIdle"))
+ return (void*) vkQueueWaitIdle;
+ if (!strcmp(name, "DeviceWaitIdle"))
+ return (void*) vkDeviceWaitIdle;
+ if (!strcmp(name, "AllocMemory"))
+ return (void*) vkAllocMemory;
+ if (!strcmp(name, "FreeMemory"))
+ return (void*) vkFreeMemory;
+ if (!strcmp(name, "SetMemoryPriority"))
+ return (void*) vkSetMemoryPriority;
+ if (!strcmp(name, "MapMemory"))
+ return (void*) vkMapMemory;
+ if (!strcmp(name, "UnmapMemory"))
+ return (void*) vkUnmapMemory;
+ if (!strcmp(name, "FlushMappedMemoryRanges"))
+ return (void*) vkFlushMappedMemoryRanges;
+ if (!strcmp(name, "InvalidateMappedMemoryRanges"))
+ return (void*) vkInvalidateMappedMemoryRanges;
+ if (!strcmp(name, "PinSystemMemory"))
+ return (void*) vkPinSystemMemory;
+ if (!strcmp(name, "GetMultiDeviceCompatibility"))
+ return (void*) vkGetMultiDeviceCompatibility;
+ if (!strcmp(name, "OpenSharedMemory"))
+ return (void*) vkOpenSharedMemory;
+ if (!strcmp(name, "OpenSharedSemaphore"))
+ return (void*) vkOpenSharedSemaphore;
+ if (!strcmp(name, "OpenPeerMemory"))
+ return (void*) vkOpenPeerMemory;
+ if (!strcmp(name, "OpenPeerImage"))
+ return (void*) vkOpenPeerImage;
+ if (!strcmp(name, "DestroyObject"))
+ return (void*) vkDestroyObject;
+ if (!strcmp(name, "GetObjectInfo"))
+ return (void*) vkGetObjectInfo;
+ if (!strcmp(name, "BindObjectMemory"))
+ return (void*) vkBindObjectMemory;
+ if (!strcmp(name, "QueueBindSparseBufferMemory"))
+ return (void*) vkQueueBindSparseBufferMemory;
+ if (!strcmp(name, "QueueBindSparseImageMemory"))
+ return (void*) vkQueueBindSparseImageMemory;
+ if (!strcmp(name, "CreateFence"))
+ return (void*) vkCreateFence;
+ if (!strcmp(name, "ResetFences"))
+ return (void*) vkResetFences;
+ if (!strcmp(name, "GetFenceStatus"))
+ return (void*) vkGetFenceStatus;
+ if (!strcmp(name, "WaitForFences"))
+ return (void*) vkWaitForFences;
+ if (!strcmp(name, "CreateSemaphore"))
+ return (void*) vkCreateSemaphore;
+ if (!strcmp(name, "QueueSignalSemaphore"))
+ return (void*) vkQueueSignalSemaphore;
+ if (!strcmp(name, "QueueWaitSemaphore"))
+ return (void*) vkQueueWaitSemaphore;
+ if (!strcmp(name, "CreateEvent"))
+ return (void*) vkCreateEvent;
+ if (!strcmp(name, "GetEventStatus"))
+ return (void*) vkGetEventStatus;
+ if (!strcmp(name, "SetEvent"))
+ return (void*) vkSetEvent;
+ if (!strcmp(name, "ResetEvent"))
+ return (void*) vkResetEvent;
+ if (!strcmp(name, "CreateQueryPool"))
+ return (void*) vkCreateQueryPool;
+ if (!strcmp(name, "GetQueryPoolResults"))
+ return (void*) vkGetQueryPoolResults;
+ if (!strcmp(name, "GetFormatInfo"))
+ return (void*) vkGetFormatInfo;
+ if (!strcmp(name, "CreateBuffer"))
+ return (void*) vkCreateBuffer;
+ if (!strcmp(name, "CreateBufferView"))
+ return (void*) vkCreateBufferView;
+ if (!strcmp(name, "CreateImage"))
+ return (void*) vkCreateImage;
+ if (!strcmp(name, "GetImageSubresourceInfo"))
+ return (void*) vkGetImageSubresourceInfo;
+ if (!strcmp(name, "CreateImageView"))
+ return (void*) vkCreateImageView;
+ if (!strcmp(name, "CreateColorAttachmentView"))
+ return (void*) vkCreateColorAttachmentView;
+ if (!strcmp(name, "CreateDepthStencilView"))
+ return (void*) vkCreateDepthStencilView;
+ if (!strcmp(name, "CreateShader"))
+ return (void*) vkCreateShader;
+ if (!strcmp(name, "CreateGraphicsPipeline"))
+ return (void*) vkCreateGraphicsPipeline;
+ if (!strcmp(name, "CreateGraphicsPipelineDerivative"))
+ return (void*) vkCreateGraphicsPipelineDerivative;
+ if (!strcmp(name, "CreateComputePipeline"))
+ return (void*) vkCreateComputePipeline;
+ if (!strcmp(name, "StorePipeline"))
+ return (void*) vkStorePipeline;
+ if (!strcmp(name, "LoadPipeline"))
+ return (void*) vkLoadPipeline;
+ if (!strcmp(name, "LoadPipelineDerivative"))
+ return (void*) vkLoadPipelineDerivative;
+ if (!strcmp(name, "CreatePipelineLayout"))
+ return (void*) vkCreatePipelineLayout;
+ if (!strcmp(name, "CreateSampler"))
+ return (void*) vkCreateSampler;
+ if (!strcmp(name, "CreateDescriptorSetLayout"))
+ return (void*) vkCreateDescriptorSetLayout;
+ if (!strcmp(name, "BeginDescriptorPoolUpdate"))
+ return (void*) vkBeginDescriptorPoolUpdate;
+ if (!strcmp(name, "EndDescriptorPoolUpdate"))
+ return (void*) vkEndDescriptorPoolUpdate;
+ if (!strcmp(name, "CreateDescriptorPool"))
+ return (void*) vkCreateDescriptorPool;
+ if (!strcmp(name, "ResetDescriptorPool"))
+ return (void*) vkResetDescriptorPool;
+ if (!strcmp(name, "AllocDescriptorSets"))
+ return (void*) vkAllocDescriptorSets;
+ if (!strcmp(name, "ClearDescriptorSets"))
+ return (void*) vkClearDescriptorSets;
+ if (!strcmp(name, "UpdateDescriptors"))
+ return (void*) vkUpdateDescriptors;
+ if (!strcmp(name, "CreateDynamicViewportState"))
+ return (void*) vkCreateDynamicViewportState;
+ if (!strcmp(name, "CreateDynamicRasterState"))
+ return (void*) vkCreateDynamicRasterState;
+ if (!strcmp(name, "CreateDynamicColorBlendState"))
+ return (void*) vkCreateDynamicColorBlendState;
+ if (!strcmp(name, "CreateDynamicDepthStencilState"))
+ return (void*) vkCreateDynamicDepthStencilState;
+ if (!strcmp(name, "CreateCommandBuffer"))
+ return (void*) vkCreateCommandBuffer;
+ if (!strcmp(name, "BeginCommandBuffer"))
+ return (void*) vkBeginCommandBuffer;
+ if (!strcmp(name, "EndCommandBuffer"))
+ return (void*) vkEndCommandBuffer;
+ if (!strcmp(name, "ResetCommandBuffer"))
+ return (void*) vkResetCommandBuffer;
+ if (!strcmp(name, "CmdBindPipeline"))
+ return (void*) vkCmdBindPipeline;
+ if (!strcmp(name, "CmdBindDynamicStateObject"))
+ return (void*) vkCmdBindDynamicStateObject;
+ if (!strcmp(name, "CmdBindDescriptorSets"))
+ return (void*) vkCmdBindDescriptorSets;
+ if (!strcmp(name, "CmdBindVertexBuffers"))
+ return (void*) vkCmdBindVertexBuffers;
+ if (!strcmp(name, "CmdBindIndexBuffer"))
+ return (void*) vkCmdBindIndexBuffer;
+ if (!strcmp(name, "CmdDraw"))
+ return (void*) vkCmdDraw;
+ if (!strcmp(name, "CmdDrawIndexed"))
+ return (void*) vkCmdDrawIndexed;
+ if (!strcmp(name, "CmdDrawIndirect"))
+ return (void*) vkCmdDrawIndirect;
+ if (!strcmp(name, "CmdDrawIndexedIndirect"))
+ return (void*) vkCmdDrawIndexedIndirect;
+ if (!strcmp(name, "CmdDispatch"))
+ return (void*) vkCmdDispatch;
+ if (!strcmp(name, "CmdDispatchIndirect"))
+ return (void*) vkCmdDispatchIndirect;
+ if (!strcmp(name, "CmdCopyBuffer"))
+ return (void*) vkCmdCopyBuffer;
+ if (!strcmp(name, "CmdCopyImage"))
+ return (void*) vkCmdCopyImage;
+ if (!strcmp(name, "CmdBlitImage"))
+ return (void*) vkCmdBlitImage;
+ if (!strcmp(name, "CmdCopyBufferToImage"))
+ return (void*) vkCmdCopyBufferToImage;
+ if (!strcmp(name, "CmdCopyImageToBuffer"))
+ return (void*) vkCmdCopyImageToBuffer;
+ if (!strcmp(name, "CmdUpdateBuffer"))
+ return (void*) vkCmdUpdateBuffer;
+ if (!strcmp(name, "CmdFillBuffer"))
+ return (void*) vkCmdFillBuffer;
+ if (!strcmp(name, "CmdClearColorImage"))
+ return (void*) vkCmdClearColorImage;
+ if (!strcmp(name, "CmdClearDepthStencil"))
+ return (void*) vkCmdClearDepthStencil;
+ if (!strcmp(name, "CmdResolveImage"))
+ return (void*) vkCmdResolveImage;
+ if (!strcmp(name, "CmdSetEvent"))
+ return (void*) vkCmdSetEvent;
+ if (!strcmp(name, "CmdResetEvent"))
+ return (void*) vkCmdResetEvent;
+ if (!strcmp(name, "CmdWaitEvents"))
+ return (void*) vkCmdWaitEvents;
+ if (!strcmp(name, "CmdPipelineBarrier"))
+ return (void*) vkCmdPipelineBarrier;
+ if (!strcmp(name, "CmdBeginQuery"))
+ return (void*) vkCmdBeginQuery;
+ if (!strcmp(name, "CmdEndQuery"))
+ return (void*) vkCmdEndQuery;
+ if (!strcmp(name, "CmdResetQueryPool"))
+ return (void*) vkCmdResetQueryPool;
+ if (!strcmp(name, "CmdWriteTimestamp"))
+ return (void*) vkCmdWriteTimestamp;
+ if (!strcmp(name, "CmdCopyQueryPoolResults"))
+ return (void*) vkCmdCopyQueryPoolResults;
+ if (!strcmp(name, "CmdInitAtomicCounters"))
+ return (void*) vkCmdInitAtomicCounters;
+ if (!strcmp(name, "CmdLoadAtomicCounters"))
+ return (void*) vkCmdLoadAtomicCounters;
+ if (!strcmp(name, "CmdSaveAtomicCounters"))
+ return (void*) vkCmdSaveAtomicCounters;
+ if (!strcmp(name, "CreateFramebuffer"))
+ return (void*) vkCreateFramebuffer;
+ if (!strcmp(name, "CreateRenderPass"))
+ return (void*) vkCreateRenderPass;
+ if (!strcmp(name, "CmdBeginRenderPass"))
+ return (void*) vkCmdBeginRenderPass;
+ if (!strcmp(name, "CmdEndRenderPass"))
+ return (void*) vkCmdEndRenderPass;
+ if (!strcmp(name, "DbgSetValidationLevel"))
+ return (void*) vkDbgSetValidationLevel;
+ if (!strcmp(name, "DbgRegisterMsgCallback"))
+ return (void*) vkDbgRegisterMsgCallback;
+ if (!strcmp(name, "DbgUnregisterMsgCallback"))
+ return (void*) vkDbgUnregisterMsgCallback;
+ if (!strcmp(name, "DbgSetMessageFilter"))
+ return (void*) vkDbgSetMessageFilter;
+ if (!strcmp(name, "DbgSetObjectTag"))
+ return (void*) vkDbgSetObjectTag;
+ if (!strcmp(name, "DbgSetGlobalOption"))
+ return (void*) vkDbgSetGlobalOption;
+ if (!strcmp(name, "DbgSetDeviceOption"))
+ return (void*) vkDbgSetDeviceOption;
+ if (!strcmp(name, "CmdDbgMarkerBegin"))
+ return (void*) vkCmdDbgMarkerBegin;
+ if (!strcmp(name, "CmdDbgMarkerEnd"))
+ return (void*) vkCmdDbgMarkerEnd;
+ if (!strcmp(name, "GetDisplayInfoWSI"))
+ return (void*) vkGetDisplayInfoWSI;
+ if (!strcmp(name, "CreateSwapChainWSI"))
+ return (void*) vkCreateSwapChainWSI;
+ if (!strcmp(name, "DestroySwapChainWSI"))
+ return (void*) vkDestroySwapChainWSI;
+ if (!strcmp(name, "GetSwapChainInfoWSI"))
+ return (void*) vkGetSwapChainInfoWSI;
+ if (!strcmp(name, "QueuePresentWSI"))
+ return (void*) vkQueuePresentWSI;
+
+ return NULL;
+}
+
+/* These functions require special handling by the loader.
+* They are not just generic trampoline code entrypoints.
+* Thus GPA must return loader entrypoint for these instead of first function
+* in the chain. */
+static inline void *loader_non_passthrough_gpa(const char *name)
+{
+ if (!name || name[0] != 'v' || name[1] != 'k')
+ return NULL;
+
+ name += 2;
+ if (!strcmp(name, "CreateInstance"))
+ return (void*) vkCreateInstance;
+ if (!strcmp(name, "DestroyInstance"))
+ return (void*) vkDestroyInstance;
+ if (!strcmp(name, "EnumeratePhysicalDevices"))
+ return (void*) vkEnumeratePhysicalDevices;
+ if (!strcmp(name, "GetPhysicalDeviceInfo"))
+ return (void*) vkGetPhysicalDeviceInfo;
+ if (!strcmp(name, "GetInstanceProcAddr"))
+ return (void*) vkGetInstanceProcAddr;
+ if (!strcmp(name, "GetProcAddr"))
+ return (void*) vkGetProcAddr;
+ if (!strcmp(name, "CreateDevice"))
+ return (void*) vkCreateDevice;
+ if (!strcmp(name, "GetGlobalExtensionInfo"))
+ return (void*) vkGetGlobalExtensionInfo;
+ if (!strcmp(name, "EnumerateLayers"))
+ return (void*) vkEnumerateLayers;
+ if (!strcmp(name, "GetDeviceQueue"))
+ return (void*) vkGetDeviceQueue;
+ if (!strcmp(name, "CreateCommandBuffer"))
+ return (void*) vkCreateCommandBuffer;
+ if (!strcmp(name, "DbgRegisterMsgCallback"))
+ return (void*) vkDbgRegisterMsgCallback;
+ if (!strcmp(name, "DbgUnregisterMsgCallback"))
+ return (void*) vkDbgUnregisterMsgCallback;
+ if (!strcmp(name, "DbgSetGlobalOption"))
+ return (void*) vkDbgSetGlobalOption;
+ if (!strcmp(name, "CreateSwapChainWSI"))
+ return (void*) vkCreateSwapChainWSI;
+
+ return NULL;
+}
diff --git a/loader/loader.c b/loader/loader.c
index f5e4472c..c452ce52 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -235,10 +235,10 @@ static void loader_log(VK_DBG_MSG_TYPE msg_type, int32_t msg_code,
#if defined(WIN32)
OutputDebugString(msg);
-#else
+#endif
fputs(msg, stderr);
fputc('\n', stderr);
-#endif
+
}
static bool has_extension(struct extension_property *exts, uint32_t count,
@@ -1288,6 +1288,17 @@ LOADER_EXPORT VkResult VKAPI vkEnumeratePhysicalDevices(
return (count > 0) ? VK_SUCCESS : res;
}
+LOADER_EXPORT void * VKAPI vkGetInstanceProcAddr(VkInstance instance, const char * pName)
+{
+ if (instance != VK_NULL_HANDLE) {
+
+ /* return entrypoint addresses that are global (in the loader)*/
+ return globalGetProcAddr(pName);
+ }
+
+ return NULL;
+}
+
LOADER_EXPORT void * VKAPI vkGetProcAddr(VkPhysicalDevice gpu, const char * pName)
{
if (gpu == VK_NULL_HANDLE) {
diff --git a/loader/table_ops.h b/loader/table_ops.h
new file mode 100644
index 00000000..1e2a99fb
--- /dev/null
+++ b/loader/table_ops.h
@@ -0,0 +1,431 @@
+/*
+ * Vulkan
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is 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 Software.
+ *
+ * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <vulkan.h>
+#include <vkLayer.h>
+#include <string.h>
+#include "loader_platform.h"
+
+static inline void loader_initialize_dispatch_table(VkLayerDispatchTable *table,
+ PFN_vkGetProcAddr gpa,
+ VkPhysicalDevice gpu)
+{
+ table->CreateInstance = (PFN_vkCreateInstance) gpa(gpu, "vkCreateInstance");
+ table->DestroyInstance = (PFN_vkDestroyInstance) gpa(gpu, "vkDestroyInstance");
+ table->EnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) gpa(gpu, "vkEnumeratePhysicalDevices");
+ table->GetPhysicalDeviceInfo = (PFN_vkGetPhysicalDeviceInfo) gpa(gpu, "vkGetPhysicalDeviceInfo");
+ table->GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) gpa(gpu, "vkGetInstanceProcAddr");
+ table->GetProcAddr = (PFN_vkGetProcAddr) gpa(gpu, "vkGetProcAddr");
+ table->CreateDevice = (PFN_vkCreateDevice) gpa(gpu, "vkCreateDevice");
+ table->DestroyDevice = (PFN_vkDestroyDevice) gpa(gpu, "vkDestroyDevice");
+ table->GetGlobalExtensionInfo = vkGetGlobalExtensionInfo; /* non-dispatchable */
+ table->GetPhysicalDeviceExtensionInfo = (PFN_vkGetPhysicalDeviceExtensionInfo) gpa(gpu, "vkGetPhysicalDeviceExtensionInfo");
+ table->EnumerateLayers = (PFN_vkEnumerateLayers) gpa(gpu, "vkEnumerateLayers");
+ table->GetDeviceQueue = (PFN_vkGetDeviceQueue) gpa(gpu, "vkGetDeviceQueue");
+ table->QueueSubmit = (PFN_vkQueueSubmit) gpa(gpu, "vkQueueSubmit");
+ table->QueueWaitIdle = (PFN_vkQueueWaitIdle) gpa(gpu, "vkQueueWaitIdle");
+ table->DeviceWaitIdle = (PFN_vkDeviceWaitIdle) gpa(gpu, "vkDeviceWaitIdle");
+ table->AllocMemory = (PFN_vkAllocMemory) gpa(gpu, "vkAllocMemory");
+ table->FreeMemory = (PFN_vkFreeMemory) gpa(gpu, "vkFreeMemory");
+ table->SetMemoryPriority = (PFN_vkSetMemoryPriority) gpa(gpu, "vkSetMemoryPriority");
+ table->MapMemory = (PFN_vkMapMemory) gpa(gpu, "vkMapMemory");
+ table->UnmapMemory = (PFN_vkUnmapMemory) gpa(gpu, "vkUnmapMemory");
+ table->FlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) gpa(gpu, "vkFlushMappedMemoryRanges");
+ table->InvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) gpa(gpu, "vkInvalidateMappedMemoryRanges");
+ table->PinSystemMemory = (PFN_vkPinSystemMemory) gpa(gpu, "vkPinSystemMemory");
+ table->GetMultiDeviceCompatibility = (PFN_vkGetMultiDeviceCompatibility) gpa(gpu, "vkGetMultiDeviceCompatibility");
+ table->OpenSharedMemory = (PFN_vkOpenSharedMemory) gpa(gpu, "vkOpenSharedMemory");
+ table->OpenSharedSemaphore = (PFN_vkOpenSharedSemaphore) gpa(gpu, "vkOpenSharedSemaphore");
+ table->OpenPeerMemory = (PFN_vkOpenPeerMemory) gpa(gpu, "vkOpenPeerMemory");
+ table->OpenPeerImage = (PFN_vkOpenPeerImage) gpa(gpu, "vkOpenPeerImage");
+ table->DestroyObject = (PFN_vkDestroyObject) gpa(gpu, "vkDestroyObject");
+ table->GetObjectInfo = (PFN_vkGetObjectInfo) gpa(gpu, "vkGetObjectInfo");
+ table->BindObjectMemory = (PFN_vkBindObjectMemory) gpa(gpu, "vkBindObjectMemory");
+ table->QueueBindSparseBufferMemory = (PFN_vkQueueBindSparseBufferMemory) gpa(gpu, "vkQueueBindSparseBufferMemory");
+ table->QueueBindSparseImageMemory = (PFN_vkQueueBindSparseImageMemory) gpa(gpu, "vkQueueBindSparseImageMemory");
+ table->CreateFence = (PFN_vkCreateFence) gpa(gpu, "vkCreateFence");
+ table->ResetFences = (PFN_vkResetFences) gpa(gpu, "vkResetFences");
+ table->GetFenceStatus = (PFN_vkGetFenceStatus) gpa(gpu, "vkGetFenceStatus");
+ table->WaitForFences = (PFN_vkWaitForFences) gpa(gpu, "vkWaitForFences");
+ table->CreateSemaphore = (PFN_vkCreateSemaphore) gpa(gpu, "vkCreateSemaphore");
+ table->QueueSignalSemaphore = (PFN_vkQueueSignalSemaphore) gpa(gpu, "vkQueueSignalSemaphore");
+ table->QueueWaitSemaphore = (PFN_vkQueueWaitSemaphore) gpa(gpu, "vkQueueWaitSemaphore");
+ table->CreateEvent = (PFN_vkCreateEvent) gpa(gpu, "vkCreateEvent");
+ table->GetEventStatus = (PFN_vkGetEventStatus) gpa(gpu, "vkGetEventStatus");
+ table->SetEvent = (PFN_vkSetEvent) gpa(gpu, "vkSetEvent");
+ table->ResetEvent = (PFN_vkResetEvent) gpa(gpu, "vkResetEvent");
+ table->CreateQueryPool = (PFN_vkCreateQueryPool) gpa(gpu, "vkCreateQueryPool");
+ table->GetQueryPoolResults = (PFN_vkGetQueryPoolResults) gpa(gpu, "vkGetQueryPoolResults");
+ table->GetFormatInfo = (PFN_vkGetFormatInfo) gpa(gpu, "vkGetFormatInfo");
+ table->CreateBuffer = (PFN_vkCreateBuffer) gpa(gpu, "vkCreateBuffer");
+ table->CreateBufferView = (PFN_vkCreateBufferView) gpa(gpu, "vkCreateBufferView");
+ table->CreateImage = (PFN_vkCreateImage) gpa(gpu, "vkCreateImage");
+ table->GetImageSubresourceInfo = (PFN_vkGetImageSubresourceInfo) gpa(gpu, "vkGetImageSubresourceInfo");
+ table->CreateImageView = (PFN_vkCreateImageView) gpa(gpu, "vkCreateImageView");
+ table->CreateColorAttachmentView = (PFN_vkCreateColorAttachmentView) gpa(gpu, "vkCreateColorAttachmentView");
+ table->CreateDepthStencilView = (PFN_vkCreateDepthStencilView) gpa(gpu, "vkCreateDepthStencilView");
+ table->CreateShader = (PFN_vkCreateShader) gpa(gpu, "vkCreateShader");
+ table->CreateGraphicsPipeline = (PFN_vkCreateGraphicsPipeline) gpa(gpu, "vkCreateGraphicsPipeline");
+ table->CreateGraphicsPipelineDerivative = (PFN_vkCreateGraphicsPipelineDerivative) gpa(gpu, "vkCreateGraphicsPipelineDerivative");
+ table->CreateComputePipeline = (PFN_vkCreateComputePipeline) gpa(gpu, "vkCreateComputePipeline");
+ table->StorePipeline = (PFN_vkStorePipeline) gpa(gpu, "vkStorePipeline");
+ table->LoadPipeline = (PFN_vkLoadPipeline) gpa(gpu, "vkLoadPipeline");
+ table->LoadPipelineDerivative = (PFN_vkLoadPipelineDerivative) gpa(gpu, "vkLoadPipelineDerivative");
+ table->CreatePipelineLayout = (PFN_vkCreatePipelineLayout) gpa(gpu, "vkCreatePipelineLayout");
+ table->CreateSampler = (PFN_vkCreateSampler) gpa(gpu, "vkCreateSampler");
+ table->CreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) gpa(gpu, "vkCreateDescriptorSetLayout");
+ table->BeginDescriptorPoolUpdate = (PFN_vkBeginDescriptorPoolUpdate) gpa(gpu, "vkBeginDescriptorPoolUpdate");
+ table->EndDescriptorPoolUpdate = (PFN_vkEndDescriptorPoolUpdate) gpa(gpu, "vkEndDescriptorPoolUpdate");
+ table->CreateDescriptorPool = (PFN_vkCreateDescriptorPool) gpa(gpu, "vkCreateDescriptorPool");
+ table->ResetDescriptorPool = (PFN_vkResetDescriptorPool) gpa(gpu, "vkResetDescriptorPool");
+ table->AllocDescriptorSets = (PFN_vkAllocDescriptorSets) gpa(gpu, "vkAllocDescriptorSets");
+ table->ClearDescriptorSets = (PFN_vkClearDescriptorSets) gpa(gpu, "vkClearDescriptorSets");
+ table->UpdateDescriptors = (PFN_vkUpdateDescriptors) gpa(gpu, "vkUpdateDescriptors");
+ table->CreateDynamicViewportState = (PFN_vkCreateDynamicViewportState) gpa(gpu, "vkCreateDynamicViewportState");
+ table->CreateDynamicRasterState = (PFN_vkCreateDynamicRasterState) gpa(gpu, "vkCreateDynamicRasterState");
+ table->CreateDynamicColorBlendState = (PFN_vkCreateDynamicColorBlendState) gpa(gpu, "vkCreateDynamicColorBlendState");
+ table->CreateDynamicDepthStencilState = (PFN_vkCreateDynamicDepthStencilState) gpa(gpu, "vkCreateDynamicDepthStencilState");
+ table->CreateCommandBuffer = (PFN_vkCreateCommandBuffer) gpa(gpu, "vkCreateCommandBuffer");
+ table->BeginCommandBuffer = (PFN_vkBeginCommandBuffer) gpa(gpu, "vkBeginCommandBuffer");
+ table->EndCommandBuffer = (PFN_vkEndCommandBuffer) gpa(gpu, "vkEndCommandBuffer");
+ table->ResetCommandBuffer = (PFN_vkResetCommandBuffer) gpa(gpu, "vkResetCommandBuffer");
+ table->CmdBindPipeline = (PFN_vkCmdBindPipeline) gpa(gpu, "vkCmdBindPipeline");
+ table->CmdBindDynamicStateObject = (PFN_vkCmdBindDynamicStateObject) gpa(gpu, "vkCmdBindDynamicStateObject");
+ table->CmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) gpa(gpu, "vkCmdBindDescriptorSets");
+ table->CmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) gpa(gpu, "vkCmdBindVertexBuffers");
+ table->CmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) gpa(gpu, "vkCmdBindIndexBuffer");
+ table->CmdDraw = (PFN_vkCmdDraw) gpa(gpu, "vkCmdDraw");
+ table->CmdDrawIndexed = (PFN_vkCmdDrawIndexed) gpa(gpu, "vkCmdDrawIndexed");
+ table->CmdDrawIndirect = (PFN_vkCmdDrawIndirect) gpa(gpu, "vkCmdDrawIndirect");
+ table->CmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) gpa(gpu, "vkCmdDrawIndexedIndirect");
+ table->CmdDispatch = (PFN_vkCmdDispatch) gpa(gpu, "vkCmdDispatch");
+ table->CmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) gpa(gpu, "vkCmdDispatchIndirect");
+ table->CmdCopyBuffer = (PFN_vkCmdCopyBuffer) gpa(gpu, "vkCmdCopyBuffer");
+ table->CmdCopyImage = (PFN_vkCmdCopyImage) gpa(gpu, "vkCmdCopyImage");
+ table->CmdBlitImage = (PFN_vkCmdBlitImage) gpa(gpu, "vkCmdBlitImage");
+ table->CmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) gpa(gpu, "vkCmdCopyBufferToImage");
+ table->CmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) gpa(gpu, "vkCmdCopyImageToBuffer");
+ table->CmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) gpa(gpu, "vkCmdUpdateBuffer");
+ table->CmdFillBuffer = (PFN_vkCmdFillBuffer) gpa(gpu, "vkCmdFillBuffer");
+ table->CmdClearColorImage = (PFN_vkCmdClearColorImage) gpa(gpu, "vkCmdClearColorImage");
+ table->CmdClearDepthStencil = (PFN_vkCmdClearDepthStencil) gpa(gpu, "vkCmdClearDepthStencil");
+ table->CmdResolveImage = (PFN_vkCmdResolveImage) gpa(gpu, "vkCmdResolveImage");
+ table->CmdSetEvent = (PFN_vkCmdSetEvent) gpa(gpu, "vkCmdSetEvent");
+ table->CmdResetEvent = (PFN_vkCmdResetEvent) gpa(gpu, "vkCmdResetEvent");
+ table->CmdWaitEvents = (PFN_vkCmdWaitEvents) gpa(gpu, "vkCmdWaitEvents");
+ table->CmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) gpa(gpu, "vkCmdPipelineBarrier");
+ table->CmdBeginQuery = (PFN_vkCmdBeginQuery) gpa(gpu, "vkCmdBeginQuery");
+ table->CmdEndQuery = (PFN_vkCmdEndQuery) gpa(gpu, "vkCmdEndQuery");
+ table->CmdResetQueryPool = (PFN_vkCmdResetQueryPool) gpa(gpu, "vkCmdResetQueryPool");
+ table->CmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) gpa(gpu, "vkCmdWriteTimestamp");
+ table->CmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) gpa(gpu, "vkCmdCopyQueryPoolResults");
+ table->CmdInitAtomicCounters = (PFN_vkCmdInitAtomicCounters) gpa(gpu, "vkCmdInitAtomicCounters");
+ table->CmdLoadAtomicCounters = (PFN_vkCmdLoadAtomicCounters) gpa(gpu, "vkCmdLoadAtomicCounters");
+ table->CmdSaveAtomicCounters = (PFN_vkCmdSaveAtomicCounters) gpa(gpu, "vkCmdSaveAtomicCounters");
+ table->CreateFramebuffer = (PFN_vkCreateFramebuffer) gpa(gpu, "vkCreateFramebuffer");
+ table->CreateRenderPass = (PFN_vkCreateRenderPass) gpa(gpu, "vkCreateRenderPass");
+ table->CmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) gpa(gpu, "vkCmdBeginRenderPass");
+ table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass) gpa(gpu, "vkCmdEndRenderPass");
+ table->DbgSetValidationLevel = (PFN_vkDbgSetValidationLevel) gpa(gpu, "vkDbgSetValidationLevel");
+ table->DbgRegisterMsgCallback = (PFN_vkDbgRegisterMsgCallback) gpa(gpu, "vkDbgRegisterMsgCallback");
+ table->DbgUnregisterMsgCallback = (PFN_vkDbgUnregisterMsgCallback) gpa(gpu, "vkDbgUnregisterMsgCallback");
+ table->DbgSetMessageFilter = (PFN_vkDbgSetMessageFilter) gpa(gpu, "vkDbgSetMessageFilter");
+ table->DbgSetObjectTag = (PFN_vkDbgSetObjectTag) gpa(gpu, "vkDbgSetObjectTag");
+ table->DbgSetGlobalOption = (PFN_vkDbgSetGlobalOption) gpa(gpu, "vkDbgSetGlobalOption");
+ table->DbgSetDeviceOption = (PFN_vkDbgSetDeviceOption) gpa(gpu, "vkDbgSetDeviceOption");
+ table->CmdDbgMarkerBegin = (PFN_vkCmdDbgMarkerBegin) gpa(gpu, "vkCmdDbgMarkerBegin");
+ table->CmdDbgMarkerEnd = (PFN_vkCmdDbgMarkerEnd) gpa(gpu, "vkCmdDbgMarkerEnd");
+ table->GetDisplayInfoWSI = (PFN_vkGetDisplayInfoWSI) gpa(gpu, "vkGetDisplayInfoWSI");
+ table->CreateSwapChainWSI = (PFN_vkCreateSwapChainWSI) gpa(gpu, "vkCreateSwapChainWSI");
+ table->DestroySwapChainWSI = (PFN_vkDestroySwapChainWSI) gpa(gpu, "vkDestroySwapChainWSI");
+ table->GetSwapChainInfoWSI = (PFN_vkGetSwapChainInfoWSI) gpa(gpu, "vkGetSwapChainInfoWSI");
+ table->QueuePresentWSI = (PFN_vkQueuePresentWSI) gpa(gpu, "vkQueuePresentWSI");
+}
+
+static inline void *loader_lookup_dispatch_table(const VkLayerDispatchTable *table,
+ const char *name)
+{
+ if (!name || name[0] != 'v' || name[1] != 'k')
+ return NULL;
+
+ name += 2;
+ if (!strcmp(name, "DestroyInstance"))
+ return (void *) table->DestroyInstance;
+ if (!strcmp(name, "EnumeratePhysicalDevices"))
+ return (void *) table->EnumeratePhysicalDevices;
+ if (!strcmp(name, "GetPhysicalDeviceInfo"))
+ return (void *) table->GetPhysicalDeviceInfo;
+ if (!strcmp(name, "GetInstanceProcAddr"))
+ return (void *) table->GetInstanceProcAddr;
+ if (!strcmp(name, "GetProcAddr"))
+ return (void *) table->GetProcAddr;
+ if (!strcmp(name, "CreateDevice"))
+ return (void *) table->CreateDevice;
+ if (!strcmp(name, "DestroyDevice"))
+ return (void *) table->DestroyDevice;
+ if (!strcmp(name, "GetPhysicalDeviceExtensionInfo"))
+ return (void *) table->GetPhysicalDeviceExtensionInfo;
+ if (!strcmp(name, "EnumerateLayers"))
+ return (void *) table->EnumerateLayers;
+ if (!strcmp(name, "GetDeviceQueue"))
+ return (void *) table->GetDeviceQueue;
+ if (!strcmp(name, "QueueSubmit"))
+ return (void *) table->QueueSubmit;
+ if (!strcmp(name, "QueueWaitIdle"))
+ return (void *) table->QueueWaitIdle;
+ if (!strcmp(name, "DeviceWaitIdle"))
+ return (void *) table->DeviceWaitIdle;
+ if (!strcmp(name, "AllocMemory"))
+ return (void *) table->AllocMemory;
+ if (!strcmp(name, "FreeMemory"))
+ return (void *) table->FreeMemory;
+ if (!strcmp(name, "SetMemoryPriority"))
+ return (void *) table->SetMemoryPriority;
+ if (!strcmp(name, "MapMemory"))
+ return (void *) table->MapMemory;
+ if (!strcmp(name, "UnmapMemory"))
+ return (void *) table->UnmapMemory;
+ if (!strcmp(name, "FlushMappedMemoryRanges"))
+ return (void *) table->FlushMappedMemoryRanges;
+ if (!strcmp(name, "InvalidateMappedMemoryRanges"))
+ return (void *) table->InvalidateMappedMemoryRanges;
+ if (!strcmp(name, "PinSystemMemory"))
+ return (void *) table->PinSystemMemory;
+ if (!strcmp(name, "GetMultiDeviceCompatibility"))
+ return (void *) table->GetMultiDeviceCompatibility;
+ if (!strcmp(name, "OpenSharedMemory"))
+ return (void *) table->OpenSharedMemory;
+ if (!strcmp(name, "OpenSharedSemaphore"))
+ return (void *) table->OpenSharedSemaphore;
+ if (!strcmp(name, "OpenPeerMemory"))
+ return (void *) table->OpenPeerMemory;
+ if (!strcmp(name, "OpenPeerImage"))
+ return (void *) table->OpenPeerImage;
+ if (!strcmp(name, "DestroyObject"))
+ return (void *) table->DestroyObject;
+ if (!strcmp(name, "GetObjectInfo"))
+ return (void *) table->GetObjectInfo;
+ if (!strcmp(name, "BindObjectMemory"))
+ return (void *) table->BindObjectMemory;
+ if (!strcmp(name, "QueueBindSparseBufferMemory"))
+ return (void *) table->QueueBindSparseBufferMemory;
+ if (!strcmp(name, "QueueBindSparseImageMemory"))
+ return (void *) table->QueueBindSparseImageMemory;
+ if (!strcmp(name, "CreateFence"))
+ return (void *) table->CreateFence;
+ if (!strcmp(name, "ResetFences"))
+ return (void *) table->ResetFences;
+ if (!strcmp(name, "GetFenceStatus"))
+ return (void *) table->GetFenceStatus;
+ if (!strcmp(name, "WaitForFences"))
+ return (void *) table->WaitForFences;
+ if (!strcmp(name, "CreateSemaphore"))
+ return (void *) table->CreateSemaphore;
+ if (!strcmp(name, "QueueSignalSemaphore"))
+ return (void *) table->QueueSignalSemaphore;
+ if (!strcmp(name, "QueueWaitSemaphore"))
+ return (void *) table->QueueWaitSemaphore;
+ if (!strcmp(name, "CreateEvent"))
+ return (void *) table->CreateEvent;
+ if (!strcmp(name, "GetEventStatus"))
+ return (void *) table->GetEventStatus;
+ if (!strcmp(name, "SetEvent"))
+ return (void *) table->SetEvent;
+ if (!strcmp(name, "ResetEvent"))
+ return (void *) table->ResetEvent;
+ if (!strcmp(name, "CreateQueryPool"))
+ return (void *) table->CreateQueryPool;
+ if (!strcmp(name, "GetQueryPoolResults"))
+ return (void *) table->GetQueryPoolResults;
+ if (!strcmp(name, "GetFormatInfo"))
+ return (void *) table->GetFormatInfo;
+ if (!strcmp(name, "CreateBuffer"))
+ return (void *) table->CreateBuffer;
+ if (!strcmp(name, "CreateBufferView"))
+ return (void *) table->CreateBufferView;
+ if (!strcmp(name, "CreateImage"))
+ return (void *) table->CreateImage;
+ if (!strcmp(name, "GetImageSubresourceInfo"))
+ return (void *) table->GetImageSubresourceInfo;
+ if (!strcmp(name, "CreateImageView"))
+ return (void *) table->CreateImageView;
+ if (!strcmp(name, "CreateColorAttachmentView"))
+ return (void *) table->CreateColorAttachmentView;
+ if (!strcmp(name, "CreateDepthStencilView"))
+ return (void *) table->CreateDepthStencilView;
+ if (!strcmp(name, "CreateShader"))
+ return (void *) table->CreateShader;
+ if (!strcmp(name, "CreateGraphicsPipeline"))
+ return (void *) table->CreateGraphicsPipeline;
+ if (!strcmp(name, "CreateGraphicsPipelineDerivative"))
+ return (void *) table->CreateGraphicsPipelineDerivative;
+ if (!strcmp(name, "CreateComputePipeline"))
+ return (void *) table->CreateComputePipeline;
+ if (!strcmp(name, "StorePipeline"))
+ return (void *) table->StorePipeline;
+ if (!strcmp(name, "LoadPipeline"))
+ return (void *) table->LoadPipeline;
+ if (!strcmp(name, "LoadPipelineDerivative"))
+ return (void *) table->LoadPipelineDerivative;
+ if (!strcmp(name, "CreatePipelineLayout"))
+ return (void *) table->CreatePipelineLayout;
+ if (!strcmp(name, "CreateSampler"))
+ return (void *) table->CreateSampler;
+ if (!strcmp(name, "CreateDescriptorSetLayout"))
+ return (void *) table->CreateDescriptorSetLayout;
+ if (!strcmp(name, "BeginDescriptorPoolUpdate"))
+ return (void *) table->BeginDescriptorPoolUpdate;
+ if (!strcmp(name, "EndDescriptorPoolUpdate"))
+ return (void *) table->EndDescriptorPoolUpdate;
+ if (!strcmp(name, "CreateDescriptorPool"))
+ return (void *) table->CreateDescriptorPool;
+ if (!strcmp(name, "ResetDescriptorPool"))
+ return (void *) table->ResetDescriptorPool;
+ if (!strcmp(name, "AllocDescriptorSets"))
+ return (void *) table->AllocDescriptorSets;
+ if (!strcmp(name, "ClearDescriptorSets"))
+ return (void *) table->ClearDescriptorSets;
+ if (!strcmp(name, "UpdateDescriptors"))
+ return (void *) table->UpdateDescriptors;
+ if (!strcmp(name, "CreateDynamicViewportState"))
+ return (void *) table->CreateDynamicViewportState;
+ if (!strcmp(name, "CreateDynamicRasterState"))
+ return (void *) table->CreateDynamicRasterState;
+ if (!strcmp(name, "CreateDynamicColorBlendState"))
+ return (void *) table->CreateDynamicColorBlendState;
+ if (!strcmp(name, "CreateDynamicDepthStencilState"))
+ return (void *) table->CreateDynamicDepthStencilState;
+ if (!strcmp(name, "CreateCommandBuffer"))
+ return (void *) table->CreateCommandBuffer;
+ if (!strcmp(name, "BeginCommandBuffer"))
+ return (void *) table->BeginCommandBuffer;
+ if (!strcmp(name, "EndCommandBuffer"))
+ return (void *) table->EndCommandBuffer;
+ if (!strcmp(name, "ResetCommandBuffer"))
+ return (void *) table->ResetCommandBuffer;
+ if (!strcmp(name, "CmdBindPipeline"))
+ return (void *) table->CmdBindPipeline;
+ if (!strcmp(name, "CmdBindDynamicStateObject"))
+ return (void *) table->CmdBindDynamicStateObject;
+ if (!strcmp(name, "CmdBindDescriptorSets"))
+ return (void *) table->CmdBindDescriptorSets;
+ if (!strcmp(name, "CmdBindVertexBuffers"))
+ return (void *) table->CmdBindVertexBuffers;
+ if (!strcmp(name, "CmdBindIndexBuffer"))
+ return (void *) table->CmdBindIndexBuffer;
+ if (!strcmp(name, "CmdDraw"))
+ return (void *) table->CmdDraw;
+ if (!strcmp(name, "CmdDrawIndexed"))
+ return (void *) table->CmdDrawIndexed;
+ if (!strcmp(name, "CmdDrawIndirect"))
+ return (void *) table->CmdDrawIndirect;
+ if (!strcmp(name, "CmdDrawIndexedIndirect"))
+ return (void *) table->CmdDrawIndexedIndirect;
+ if (!strcmp(name, "CmdDispatch"))
+ return (void *) table->CmdDispatch;
+ if (!strcmp(name, "CmdDispatchIndirect"))
+ return (void *) table->CmdDispatchIndirect;
+ if (!strcmp(name, "CmdCopyBuffer"))
+ return (void *) table->CmdCopyBuffer;
+ if (!strcmp(name, "CmdCopyImage"))
+ return (void *) table->CmdCopyImage;
+ if (!strcmp(name, "CmdBlitImage"))
+ return (void *) table->CmdBlitImage;
+ if (!strcmp(name, "CmdCopyBufferToImage"))
+ return (void *) table->CmdCopyBufferToImage;
+ if (!strcmp(name, "CmdCopyImageToBuffer"))
+ return (void *) table->CmdCopyImageToBuffer;
+ if (!strcmp(name, "CmdUpdateBuffer"))
+ return (void *) table->CmdUpdateBuffer;
+ if (!strcmp(name, "CmdFillBuffer"))
+ return (void *) table->CmdFillBuffer;
+ if (!strcmp(name, "CmdClearColorImage"))
+ return (void *) table->CmdClearColorImage;
+ if (!strcmp(name, "CmdClearDepthStencil"))
+ return (void *) table->CmdClearDepthStencil;
+ if (!strcmp(name, "CmdResolveImage"))
+ return (void *) table->CmdResolveImage;
+ if (!strcmp(name, "CmdSetEvent"))
+ return (void *) table->CmdSetEvent;
+ if (!strcmp(name, "CmdResetEvent"))
+ return (void *) table->CmdResetEvent;
+ if (!strcmp(name, "CmdWaitEvents"))
+ return (void *) table->CmdWaitEvents;
+ if (!strcmp(name, "CmdPipelineBarrier"))
+ return (void *) table->CmdPipelineBarrier;
+ if (!strcmp(name, "CmdBeginQuery"))
+ return (void *) table->CmdBeginQuery;
+ if (!strcmp(name, "CmdEndQuery"))
+ return (void *) table->CmdEndQuery;
+ if (!strcmp(name, "CmdResetQueryPool"))
+ return (void *) table->CmdResetQueryPool;
+ if (!strcmp(name, "CmdWriteTimestamp"))
+ return (void *) table->CmdWriteTimestamp;
+ if (!strcmp(name, "CmdCopyQueryPoolResults"))
+ return (void *) table->CmdCopyQueryPoolResults;
+ if (!strcmp(name, "CmdInitAtomicCounters"))
+ return (void *) table->CmdInitAtomicCounters;
+ if (!strcmp(name, "CmdLoadAtomicCounters"))
+ return (void *) table->CmdLoadAtomicCounters;
+ if (!strcmp(name, "CmdSaveAtomicCounters"))
+ return (void *) table->CmdSaveAtomicCounters;
+ if (!strcmp(name, "CreateFramebuffer"))
+ return (void *) table->CreateFramebuffer;
+ if (!strcmp(name, "CreateRenderPass"))
+ return (void *) table->CreateRenderPass;
+ if (!strcmp(name, "CmdBeginRenderPass"))
+ return (void *) table->CmdBeginRenderPass;
+ if (!strcmp(name, "CmdEndRenderPass"))
+ return (void *) table->CmdEndRenderPass;
+ if (!strcmp(name, "DbgSetValidationLevel"))
+ return (void *) table->DbgSetValidationLevel;
+ if (!strcmp(name, "DbgRegisterMsgCallback"))
+ return (void *) table->DbgRegisterMsgCallback;
+ if (!strcmp(name, "DbgUnregisterMsgCallback"))
+ return (void *) table->DbgUnregisterMsgCallback;
+ if (!strcmp(name, "DbgSetMessageFilter"))
+ return (void *) table->DbgSetMessageFilter;
+ if (!strcmp(name, "DbgSetObjectTag"))
+ return (void *) table->DbgSetObjectTag;
+ if (!strcmp(name, "DbgSetGlobalOption"))
+ return (void *) table->DbgSetGlobalOption;
+ if (!strcmp(name, "DbgSetDeviceOption"))
+ return (void *) table->DbgSetDeviceOption;
+ if (!strcmp(name, "CmdDbgMarkerBegin"))
+ return (void *) table->CmdDbgMarkerBegin;
+ if (!strcmp(name, "CmdDbgMarkerEnd"))
+ return (void *) table->CmdDbgMarkerEnd;
+ if (!strcmp(name, "GetDisplayInfoWSI"))
+ return (void *) table->GetDisplayInfoWSI;
+ if (!strcmp(name, "CreateSwapChainWSI"))
+ return (void *) table->CreateSwapChainWSI;
+ if (!strcmp(name, "DestroySwapChainWSI"))
+ return (void *) table->DestroySwapChainWSI;
+ if (!strcmp(name, "GetSwapChainInfoWSI"))
+ return (void *) table->GetSwapChainInfoWSI;
+ if (!strcmp(name, "QueuePresentWSI"))
+ return (void *) table->QueuePresentWSI;
+
+ return NULL;
+}
diff --git a/loader/trampoline.c b/loader/trampoline.c
new file mode 100644
index 00000000..2f255fbd
--- /dev/null
+++ b/loader/trampoline.c
@@ -0,0 +1,1150 @@
+/*
+ * Vulkan
+ *
+ * Copyright (C) 2014 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is 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 Software.
+ *
+ * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "loader.h"
+
+#if defined(WIN32)
+// On Windows need to disable global optimization for function entrypoints or
+// else mhook will not be able to hook all of them
+#pragma optimize( "g", off )
+#endif
+
+/* Trampoline entrypoints */
+LOADER_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(VkPhysicalDevice gpu, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData)
+{
+ const VkLayerDispatchTable *disp;
+ VkResult res;
+
+ disp = loader_get_dispatch(gpu);
+
+ res = disp->GetPhysicalDeviceInfo(gpu, infoType, pDataSize, pData);
+ if (infoType == VK_PHYSICAL_DEVICE_INFO_TYPE_DISPLAY_PROPERTIES_WSI && pData && res == VK_SUCCESS) {
+ VkDisplayPropertiesWSI *info = pData;
+ size_t count = *pDataSize / sizeof(*info), i;
+ for (i = 0; i < count; i++) {
+ loader_set_dispatch(info[i].display, disp);
+ }
+ }
+
+ return res;
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice)
+{
+ const VkLayerDispatchTable *disp;
+ VkResult res;
+
+ disp = loader_get_dispatch(gpu);
+
+ res = disp->CreateDevice(gpu, pCreateInfo, pDevice);
+ if (res == VK_SUCCESS) {
+ loader_init_dispatch(*pDevice, disp);
+ }
+
+ return res;
+}
+
+LOADER_EXPORT VkResult VKAPI vkDestroyDevice(VkDevice device)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->DestroyDevice(device);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetPhysicalDeviceExtensionInfo(VkPhysicalDevice gpu, VkExtensionInfoType infoType, uint32_t extensionIndex, size_t* pDataSize, void* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(gpu);
+
+ return disp->GetPhysicalDeviceExtensionInfo(gpu, infoType, extensionIndex, pDataSize, pData);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, VkQueue* pQueue)
+{
+ const VkLayerDispatchTable *disp;
+ VkResult res;
+
+ disp = loader_get_dispatch(device);
+
+ res = disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
+ if (res == VK_SUCCESS) {
+ loader_set_dispatch(*pQueue, disp);
+ }
+
+ return res;
+}
+
+LOADER_EXPORT VkResult VKAPI vkQueueSubmit(VkQueue queue, uint32_t cmdBufferCount, const VkCmdBuffer* pCmdBuffers, VkFence fence)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(queue);
+
+ return disp->QueueSubmit(queue, cmdBufferCount, pCmdBuffers, fence);
+}
+
+LOADER_EXPORT VkResult VKAPI vkQueueWaitIdle(VkQueue queue)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(queue);
+
+ return disp->QueueWaitIdle(queue);
+}
+
+LOADER_EXPORT VkResult VKAPI vkDeviceWaitIdle(VkDevice device)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->DeviceWaitIdle(device);
+}
+
+LOADER_EXPORT VkResult VKAPI vkAllocMemory(VkDevice device, const VkMemoryAllocInfo* pAllocInfo, VkDeviceMemory* pMem)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->AllocMemory(device, pAllocInfo, pMem);
+}
+
+LOADER_EXPORT VkResult VKAPI vkFreeMemory(VkDevice device, VkDeviceMemory mem)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->FreeMemory(device, mem);
+}
+
+LOADER_EXPORT VkResult VKAPI vkSetMemoryPriority(VkDevice device, VkDeviceMemory mem, VkMemoryPriority priority)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->SetMemoryPriority(device, mem, priority);
+}
+
+LOADER_EXPORT VkResult VKAPI vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, VkDeviceSize size, VkFlags flags, void** ppData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->MapMemory(device, mem, offset, size, flags, ppData);
+}
+
+LOADER_EXPORT VkResult VKAPI vkUnmapMemory(VkDevice device, VkDeviceMemory mem)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->UnmapMemory(device, mem);
+}
+
+LOADER_EXPORT VkResult VKAPI vkFlushMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->FlushMappedMemoryRanges(device, memRangeCount, pMemRanges);
+}
+
+LOADER_EXPORT VkResult VKAPI vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memRangeCount, const VkMappedMemoryRange* pMemRanges)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->InvalidateMappedMemoryRanges(device, memRangeCount, pMemRanges);
+}
+
+LOADER_EXPORT VkResult VKAPI vkPinSystemMemory(VkDevice device, const void* pSysMem, size_t memSize, VkDeviceMemory* pMem)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->PinSystemMemory(device, pSysMem, memSize, pMem);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetMultiDeviceCompatibility(VkPhysicalDevice gpu0, VkPhysicalDevice gpu1, VkPhysicalDeviceCompatibilityInfo* pInfo)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(gpu0);
+
+ return disp->GetMultiDeviceCompatibility(gpu0, gpu1, pInfo);
+}
+
+LOADER_EXPORT VkResult VKAPI vkOpenSharedMemory(VkDevice device, const VkMemoryOpenInfo* pOpenInfo, VkDeviceMemory* pMem)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->OpenSharedMemory(device, pOpenInfo, pMem);
+}
+
+LOADER_EXPORT VkResult VKAPI vkOpenSharedSemaphore(VkDevice device, const VkSemaphoreOpenInfo* pOpenInfo, VkSemaphore* pSemaphore)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->OpenSharedSemaphore(device, pOpenInfo, pSemaphore);
+}
+
+LOADER_EXPORT VkResult VKAPI vkOpenPeerMemory(VkDevice device, const VkPeerMemoryOpenInfo* pOpenInfo, VkDeviceMemory* pMem)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->OpenPeerMemory(device, pOpenInfo, pMem);
+}
+
+LOADER_EXPORT VkResult VKAPI vkOpenPeerImage(VkDevice device, const VkPeerImageOpenInfo* pOpenInfo, VkImage* pImage, VkDeviceMemory* pMem)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->OpenPeerImage(device, pOpenInfo, pImage, pMem);
+}
+
+LOADER_EXPORT VkResult VKAPI vkDestroyObject(VkDevice device, VkObjectType objType, VkObject object)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->DestroyObject(device, objType, object);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetObjectInfo(VkDevice device, VkObjectType objType, VkObject object, VkObjectInfoType infoType, size_t* pDataSize, void* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->GetObjectInfo(device, objType, object, infoType, pDataSize, pData);
+}
+
+LOADER_EXPORT VkResult VKAPI vkBindObjectMemory(VkDevice device, VkObjectType objType, VkObject object, uint32_t allocationIdx, VkDeviceMemory mem, VkDeviceSize offset)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->BindObjectMemory(device, objType, object, allocationIdx, mem, offset);
+}
+
+LOADER_EXPORT VkResult VKAPI vkQueueBindSparseBufferMemory(VkQueue queue, VkBuffer buffer, uint32_t allocationIdx, VkDeviceSize rangeOffset, VkDeviceSize rangeSize, VkDeviceMemory mem, VkDeviceSize memOffset)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(queue);
+
+ return disp->QueueBindSparseBufferMemory(queue, buffer, allocationIdx, rangeOffset, rangeSize, mem, memOffset);
+}
+
+LOADER_EXPORT VkResult VKAPI vkQueueBindSparseImageMemory(VkQueue queue, VkImage image, uint32_t allocationIdx, const VkImageMemoryBindInfo* pBindInfo, VkDeviceMemory mem, VkDeviceSize memOffset)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(queue);
+
+ return disp->QueueBindSparseImageMemory(queue, image, allocationIdx, pBindInfo, mem, memOffset);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, VkFence* pFence)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateFence(device, pCreateInfo, pFence);
+}
+
+LOADER_EXPORT VkResult VKAPI vkResetFences(VkDevice device, uint32_t fenceCount, VkFence* pFences)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->ResetFences(device, fenceCount, pFences);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetFenceStatus(VkDevice device, VkFence fence)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->GetFenceStatus(device, fence);
+}
+
+LOADER_EXPORT VkResult VKAPI vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, bool32_t waitAll, uint64_t timeout)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, VkSemaphore* pSemaphore)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateSemaphore(device, pCreateInfo, pSemaphore);
+}
+
+LOADER_EXPORT VkResult VKAPI vkQueueSignalSemaphore(VkQueue queue, VkSemaphore semaphore)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(queue);
+
+ return disp->QueueSignalSemaphore(queue, semaphore);
+}
+
+LOADER_EXPORT VkResult VKAPI vkQueueWaitSemaphore(VkQueue queue, VkSemaphore semaphore)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(queue);
+
+ return disp->QueueWaitSemaphore(queue, semaphore);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, VkEvent* pEvent)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateEvent(device, pCreateInfo, pEvent);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetEventStatus(VkDevice device, VkEvent event)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->GetEventStatus(device, event);
+}
+
+LOADER_EXPORT VkResult VKAPI vkSetEvent(VkDevice device, VkEvent event)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->SetEvent(device, event);
+}
+
+LOADER_EXPORT VkResult VKAPI vkResetEvent(VkDevice device, VkEvent event)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->ResetEvent(device, event);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, VkQueryPool* pQueryPool)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateQueryPool(device, pCreateInfo, pQueryPool);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData, VkQueryResultFlags flags)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->GetQueryPoolResults(device, queryPool, startQuery, queryCount, pDataSize, pData, flags);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetFormatInfo(VkDevice device, VkFormat format, VkFormatInfoType infoType, size_t* pDataSize, void* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->GetFormatInfo(device, format, infoType, pDataSize, pData);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo, VkBuffer* pBuffer)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateBuffer(device, pCreateInfo, pBuffer);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, VkBufferView* pView)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateBufferView(device, pCreateInfo, pView);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, VkImage* pImage)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateImage(device, pCreateInfo, pImage);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetImageSubresourceInfo(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceInfoType infoType, size_t* pDataSize, void* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->GetImageSubresourceInfo(device, image, pSubresource, infoType, pDataSize, pData);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, VkImageView* pView)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateImageView(device, pCreateInfo, pView);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateColorAttachmentView(VkDevice device, const VkColorAttachmentViewCreateInfo* pCreateInfo, VkColorAttachmentView* pView)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateColorAttachmentView(device, pCreateInfo, pView);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDepthStencilView(VkDevice device, const VkDepthStencilViewCreateInfo* pCreateInfo, VkDepthStencilView* pView)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateDepthStencilView(device, pCreateInfo, pView);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateShader(VkDevice device, const VkShaderCreateInfo* pCreateInfo, VkShader* pShader)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateShader(device, pCreateInfo, pShader);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateGraphicsPipeline(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateGraphicsPipeline(device, pCreateInfo, pPipeline);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateGraphicsPipelineDerivative(VkDevice device, const VkGraphicsPipelineCreateInfo* pCreateInfo, VkPipeline basePipeline, VkPipeline* pPipeline)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateGraphicsPipelineDerivative(device, pCreateInfo, basePipeline, pPipeline);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateComputePipeline(VkDevice device, const VkComputePipelineCreateInfo* pCreateInfo, VkPipeline* pPipeline)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateComputePipeline(device, pCreateInfo, pPipeline);
+}
+
+LOADER_EXPORT VkResult VKAPI vkStorePipeline(VkDevice device, VkPipeline pipeline, size_t* pDataSize, void* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->StorePipeline(device, pipeline, pDataSize, pData);
+}
+
+LOADER_EXPORT VkResult VKAPI vkLoadPipeline(VkDevice device, size_t dataSize, const void* pData, VkPipeline* pPipeline)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->LoadPipeline(device, dataSize, pData, pPipeline);
+}
+
+LOADER_EXPORT VkResult VKAPI vkLoadPipelineDerivative(VkDevice device, size_t dataSize, const void* pData, VkPipeline basePipeline, VkPipeline* pPipeline)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->LoadPipelineDerivative(device, dataSize, pData, basePipeline, pPipeline);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, VkPipelineLayout* pPipelineLayout)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreatePipelineLayout(device, pCreateInfo, pPipelineLayout);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, VkSampler* pSampler)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateSampler(device, pCreateInfo, pSampler);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayout* pSetLayout)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateDescriptorSetLayout(device, pCreateInfo, pSetLayout);
+}
+
+LOADER_EXPORT VkResult VKAPI vkBeginDescriptorPoolUpdate(VkDevice device, VkDescriptorUpdateMode updateMode)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->BeginDescriptorPoolUpdate(device, updateMode);
+}
+
+LOADER_EXPORT VkResult VKAPI vkEndDescriptorPoolUpdate(VkDevice device, VkCmdBuffer cmd)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->EndDescriptorPoolUpdate(device, cmd);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDescriptorPool(VkDevice device, VkDescriptorPoolUsage poolUsage, uint32_t maxSets, const VkDescriptorPoolCreateInfo* pCreateInfo, VkDescriptorPool* pDescriptorPool)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateDescriptorPool(device, poolUsage, maxSets, pCreateInfo, pDescriptorPool);
+}
+
+LOADER_EXPORT VkResult VKAPI vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->ResetDescriptorPool(device, descriptorPool);
+}
+
+LOADER_EXPORT VkResult VKAPI vkAllocDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorSetUsage setUsage, uint32_t count, const VkDescriptorSetLayout* pSetLayouts, VkDescriptorSet* pDescriptorSets, uint32_t* pCount)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->AllocDescriptorSets(device, descriptorPool, setUsage, count, pSetLayouts, pDescriptorSets, pCount);
+}
+
+LOADER_EXPORT void VKAPI vkClearDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t count, const VkDescriptorSet* pDescriptorSets)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ disp->ClearDescriptorSets(device, descriptorPool, count, pDescriptorSets);
+}
+
+LOADER_EXPORT void VKAPI vkUpdateDescriptors(VkDevice device, VkDescriptorSet descriptorSet, uint32_t updateCount, const void** ppUpdateArray)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ disp->UpdateDescriptors(device, descriptorSet, updateCount, ppUpdateArray);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDynamicViewportState(VkDevice device, const VkDynamicVpStateCreateInfo* pCreateInfo, VkDynamicVpState* pState)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateDynamicViewportState(device, pCreateInfo, pState);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDynamicRasterState(VkDevice device, const VkDynamicRsStateCreateInfo* pCreateInfo, VkDynamicRsState* pState)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateDynamicRasterState(device, pCreateInfo, pState);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDynamicColorBlendState(VkDevice device, const VkDynamicCbStateCreateInfo* pCreateInfo, VkDynamicCbState* pState)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateDynamicColorBlendState(device, pCreateInfo, pState);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateDynamicDepthStencilState(VkDevice device, const VkDynamicDsStateCreateInfo* pCreateInfo, VkDynamicDsState* pState)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateDynamicDepthStencilState(device, pCreateInfo, pState);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateCommandBuffer(VkDevice device, const VkCmdBufferCreateInfo* pCreateInfo, VkCmdBuffer* pCmdBuffer)
+{
+ const VkLayerDispatchTable *disp;
+ VkResult res;
+
+ disp = loader_get_dispatch(device);
+
+ res = disp->CreateCommandBuffer(device, pCreateInfo, pCmdBuffer);
+ if (res == VK_SUCCESS) {
+ loader_init_dispatch(*pCmdBuffer, disp);
+ }
+
+ return res;
+}
+
+LOADER_EXPORT VkResult VKAPI vkBeginCommandBuffer(VkCmdBuffer cmdBuffer, const VkCmdBufferBeginInfo* pBeginInfo)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ return disp->BeginCommandBuffer(cmdBuffer, pBeginInfo);
+}
+
+LOADER_EXPORT VkResult VKAPI vkEndCommandBuffer(VkCmdBuffer cmdBuffer)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ return disp->EndCommandBuffer(cmdBuffer);
+}
+
+LOADER_EXPORT VkResult VKAPI vkResetCommandBuffer(VkCmdBuffer cmdBuffer)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ return disp->ResetCommandBuffer(cmdBuffer);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBindPipeline(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBindDynamicStateObject(VkCmdBuffer cmdBuffer, VkStateBindPoint stateBindPoint, VkDynamicStateObject state)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdBindDynamicStateObject(cmdBuffer, stateBindPoint, state);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBindDescriptorSets(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t firstSet, uint32_t setCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdBindDescriptorSets(cmdBuffer, pipelineBindPoint, firstSet, setCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBindVertexBuffers(VkCmdBuffer cmdBuffer, uint32_t startBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdBindVertexBuffers(cmdBuffer, startBinding, bindingCount, pBuffers, pOffsets);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBindIndexBuffer(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdBindIndexBuffer(cmdBuffer, buffer, offset, indexType);
+}
+
+LOADER_EXPORT void VKAPI vkCmdDraw(VkCmdBuffer cmdBuffer, uint32_t firstVertex, uint32_t vertexCount, uint32_t firstInstance, uint32_t instanceCount)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount);
+}
+
+LOADER_EXPORT void VKAPI vkCmdDrawIndexed(VkCmdBuffer cmdBuffer, uint32_t firstIndex, uint32_t indexCount, int32_t vertexOffset, uint32_t firstInstance, uint32_t instanceCount)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount);
+}
+
+LOADER_EXPORT void VKAPI vkCmdDrawIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdDrawIndirect(cmdBuffer, buffer, offset, count, stride);
+}
+
+LOADER_EXPORT void VKAPI vkCmdDrawIndexedIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count, uint32_t stride)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdDrawIndexedIndirect(cmdBuffer, buffer, offset, count, stride);
+}
+
+LOADER_EXPORT void VKAPI vkCmdDispatch(VkCmdBuffer cmdBuffer, uint32_t x, uint32_t y, uint32_t z)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdDispatch(cmdBuffer, x, y, z);
+}
+
+LOADER_EXPORT void VKAPI vkCmdDispatchIndirect(VkCmdBuffer cmdBuffer, VkBuffer buffer, VkDeviceSize offset)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdDispatchIndirect(cmdBuffer, buffer, offset);
+}
+
+LOADER_EXPORT void VKAPI vkCmdCopyBuffer(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkBuffer destBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdCopyBuffer(cmdBuffer, srcBuffer, destBuffer, regionCount, pRegions);
+}
+
+LOADER_EXPORT void VKAPI vkCmdCopyImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageCopy* pRegions)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdCopyImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBlitImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageBlit* pRegions)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdBlitImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
+}
+
+LOADER_EXPORT void VKAPI vkCmdCopyBufferToImage(VkCmdBuffer cmdBuffer, VkBuffer srcBuffer, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdCopyBufferToImage(cmdBuffer, srcBuffer, destImage, destImageLayout, regionCount, pRegions);
+}
+
+LOADER_EXPORT void VKAPI vkCmdCopyImageToBuffer(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer destBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdCopyImageToBuffer(cmdBuffer, srcImage, srcImageLayout, destBuffer, regionCount, pRegions);
+}
+
+LOADER_EXPORT void VKAPI vkCmdUpdateBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize dataSize, const uint32_t* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdUpdateBuffer(cmdBuffer, destBuffer, destOffset, dataSize, pData);
+}
+
+LOADER_EXPORT void VKAPI vkCmdFillBuffer(VkCmdBuffer cmdBuffer, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize fillSize, uint32_t data)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdFillBuffer(cmdBuffer, destBuffer, destOffset, fillSize, data);
+}
+
+LOADER_EXPORT void VKAPI vkCmdClearColorImage(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColor* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdClearColorImage(cmdBuffer, image, imageLayout, pColor, rangeCount, pRanges);
+}
+
+LOADER_EXPORT void VKAPI vkCmdClearDepthStencil(VkCmdBuffer cmdBuffer, VkImage image, VkImageLayout imageLayout, float depth, uint32_t stencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdClearDepthStencil(cmdBuffer, image, imageLayout, depth, stencil, rangeCount, pRanges);
+}
+
+LOADER_EXPORT void VKAPI vkCmdResolveImage(VkCmdBuffer cmdBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage destImage, VkImageLayout destImageLayout, uint32_t regionCount, const VkImageResolve* pRegions)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdResolveImage(cmdBuffer, srcImage, srcImageLayout, destImage, destImageLayout, regionCount, pRegions);
+}
+
+LOADER_EXPORT void VKAPI vkCmdSetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdSetEvent(cmdBuffer, event, pipeEvent);
+}
+
+LOADER_EXPORT void VKAPI vkCmdResetEvent(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdResetEvent(cmdBuffer, event, pipeEvent);
+}
+
+LOADER_EXPORT void VKAPI vkCmdWaitEvents(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, uint32_t eventCount, const VkEvent* pEvents, uint32_t memBarrierCount, const void** ppMemBarriers)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdWaitEvents(cmdBuffer, waitEvent, eventCount, pEvents, memBarrierCount, ppMemBarriers);
+}
+
+LOADER_EXPORT void VKAPI vkCmdPipelineBarrier(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, uint32_t pipeEventCount, const VkPipeEvent* pPipeEvents, uint32_t memBarrierCount, const void** ppMemBarriers)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdPipelineBarrier(cmdBuffer, waitEvent, pipeEventCount, pPipeEvents, memBarrierCount, ppMemBarriers);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBeginQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkFlags flags)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdBeginQuery(cmdBuffer, queryPool, slot, flags);
+}
+
+LOADER_EXPORT void VKAPI vkCmdEndQuery(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdEndQuery(cmdBuffer, queryPool, slot);
+}
+
+LOADER_EXPORT void VKAPI vkCmdResetQueryPool(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount);
+}
+
+LOADER_EXPORT void VKAPI vkCmdWriteTimestamp(VkCmdBuffer cmdBuffer, VkTimestampType timestampType, VkBuffer destBuffer, VkDeviceSize destOffset)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdWriteTimestamp(cmdBuffer, timestampType, destBuffer, destOffset);
+}
+
+LOADER_EXPORT void VKAPI vkCmdCopyQueryPoolResults(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, VkBuffer destBuffer, VkDeviceSize destOffset, VkDeviceSize destStride, VkFlags flags)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdCopyQueryPoolResults(cmdBuffer, queryPool, startQuery, queryCount, destBuffer, destOffset, destStride, flags);
+}
+
+LOADER_EXPORT void VKAPI vkCmdInitAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, const uint32_t* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData);
+}
+
+LOADER_EXPORT void VKAPI vkCmdLoadAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, VkBuffer srcBuffer, VkDeviceSize srcOffset)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcBuffer, srcOffset);
+}
+
+LOADER_EXPORT void VKAPI vkCmdSaveAtomicCounters(VkCmdBuffer cmdBuffer, VkPipelineBindPoint pipelineBindPoint, uint32_t startCounter, uint32_t counterCount, VkBuffer destBuffer, VkDeviceSize destOffset)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destBuffer, destOffset);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, VkFramebuffer* pFramebuffer)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateFramebuffer(device, pCreateInfo, pFramebuffer);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->CreateRenderPass(device, pCreateInfo, pRenderPass);
+}
+
+LOADER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBegin* pRenderPassBegin)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
+}
+
+LOADER_EXPORT void VKAPI vkCmdEndRenderPass(VkCmdBuffer cmdBuffer, VkRenderPass renderPass)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdEndRenderPass(cmdBuffer, renderPass);
+}
+
+LOADER_EXPORT VkResult VKAPI vkDbgSetValidationLevel(VkDevice device, VkValidationLevel validationLevel)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->DbgSetValidationLevel(device, validationLevel);
+}
+
+LOADER_EXPORT VkResult VKAPI vkDbgSetMessageFilter(VkDevice device, int32_t msgCode, VK_DBG_MSG_FILTER filter)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->DbgSetMessageFilter(device, msgCode, filter);
+}
+
+LOADER_EXPORT VkResult VKAPI vkDbgSetObjectTag(VkDevice device, VkObject object, size_t tagSize, const void* pTag)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->DbgSetObjectTag(device, object, tagSize, pTag);
+}
+
+LOADER_EXPORT VkResult VKAPI vkDbgSetDeviceOption(VkDevice device, VK_DBG_DEVICE_OPTION dbgOption, size_t dataSize, const void* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(device);
+
+ return disp->DbgSetDeviceOption(device, dbgOption, dataSize, pData);
+}
+
+LOADER_EXPORT void VKAPI vkCmdDbgMarkerBegin(VkCmdBuffer cmdBuffer, const char* pMarker)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdDbgMarkerBegin(cmdBuffer, pMarker);
+}
+
+LOADER_EXPORT void VKAPI vkCmdDbgMarkerEnd(VkCmdBuffer cmdBuffer)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(cmdBuffer);
+
+ disp->CmdDbgMarkerEnd(cmdBuffer);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetDisplayInfoWSI(VkDisplayWSI display, VkDisplayInfoTypeWSI infoType, size_t* pDataSize, void* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(display);
+
+ return disp->GetDisplayInfoWSI(display, infoType, pDataSize, pData);
+}
+
+LOADER_EXPORT VkResult VKAPI vkCreateSwapChainWSI(VkDevice device, const VkSwapChainCreateInfoWSI* pCreateInfo, VkSwapChainWSI* pSwapChain)
+{
+ const VkLayerDispatchTable *disp;
+ VkResult res;
+
+ disp = loader_get_dispatch(device);
+
+ res = disp->CreateSwapChainWSI(device, pCreateInfo, pSwapChain);
+ if (res == VK_SUCCESS) {
+ loader_init_dispatch(*pSwapChain, disp);
+ }
+
+ return res;
+}
+
+LOADER_EXPORT VkResult VKAPI vkDestroySwapChainWSI(VkSwapChainWSI swapChain)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(swapChain);
+
+ return disp->DestroySwapChainWSI(swapChain);
+}
+
+LOADER_EXPORT VkResult VKAPI vkGetSwapChainInfoWSI(VkSwapChainWSI swapChain, VkSwapChainInfoTypeWSI infoType, size_t* pDataSize, void* pData)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(swapChain);
+
+ return disp->GetSwapChainInfoWSI(swapChain, infoType, pDataSize, pData);
+}
+
+LOADER_EXPORT VkResult VKAPI vkQueuePresentWSI(VkQueue queue, const VkPresentInfoWSI* pPresentInfo)
+{
+ const VkLayerDispatchTable *disp;
+
+ disp = loader_get_dispatch(queue);
+
+ return disp->QueuePresentWSI(queue, pPresentInfo);
+}
+
+#if defined(WIN32)
+#pragma optimize( "", on )
+#endif
diff --git a/loader/vulkan.def b/loader/vulkan.def
new file mode 100644
index 00000000..57499981
--- /dev/null
+++ b/loader/vulkan.def
@@ -0,0 +1,157 @@
+;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Vulkan
+;
+; Copyright (C) 2015 LunarG, Inc.
+;
+; Permission is hereby granted, free of charge, to any person obtaining a
+; copy of this software and associated documentation files (the "Software"),
+; to deal in the Software without restriction, including without limitation
+; the rights to use, copy, modify, merge, publish, distribute, sublicense,
+; and/or sell copies of the Software, and to permit persons to whom the
+; Software is 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 Software.
+;
+; THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER
+; DEALINGS IN THE SOFTWARE.
+;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+; The following is required on Windows, for exporting symbols from the DLL
+
+LIBRARY vulkan
+EXPORTS
+ vkCreateInstance
+ vkDestroyInstance
+ vkEnumeratePhysicalDevices
+ vkGetPhysicalDeviceInfo
+ vkGetProcAddr
+ vkCreateDevice
+ vkDestroyDevice
+ vkGetGlobalExtensionInfo
+ vkGetPhysicalDeviceExtensionInfo
+ vkEnumerateLayers
+ vkGetDeviceQueue
+ vkQueueSubmit
+ vkQueueWaitIdle
+ vkDeviceWaitIdle
+ vkAllocMemory
+ vkFreeMemory
+ vkSetMemoryPriority
+ vkMapMemory
+ vkUnmapMemory
+ vkFlushMappedMemoryRanges
+ vkInvalidateMappedMemoryRanges
+ vkPinSystemMemory
+ vkGetMultiDeviceCompatibility
+ vkOpenSharedMemory
+ vkOpenSharedSemaphore
+ vkOpenPeerMemory
+ vkOpenPeerImage
+ vkDestroyObject
+ vkGetObjectInfo
+ vkBindObjectMemory
+ vkQueueBindSparseBufferMemory
+ vkQueueBindSparseImageMemory
+ vkCreateFence
+ vkResetFences
+ vkGetFenceStatus
+ vkWaitForFences
+ vkCreateSemaphore
+ vkQueueSignalSemaphore
+ vkQueueWaitSemaphore
+ vkCreateEvent
+ vkGetEventStatus
+ vkSetEvent
+ vkResetEvent
+ vkCreateQueryPool
+ vkGetQueryPoolResults
+ vkGetFormatInfo
+ vkCreateBuffer
+ vkCreateBufferView
+ vkCreateImage
+ vkGetImageSubresourceInfo
+ vkCreateImageView
+ vkCreateColorAttachmentView
+ vkCreateDepthStencilView
+ vkCreateShader
+ vkCreateGraphicsPipeline
+ vkCreateGraphicsPipelineDerivative
+ vkCreateComputePipeline
+ vkStorePipeline
+ vkLoadPipeline
+ vkLoadPipelineDerivative
+ vkCreatePipelineLayout
+ vkCreateSampler
+ vkCreateDescriptorSetLayout
+ vkBeginDescriptorPoolUpdate
+ vkEndDescriptorPoolUpdate
+ vkCreateDescriptorPool
+ vkResetDescriptorPool
+ vkAllocDescriptorSets
+ vkClearDescriptorSets
+ vkUpdateDescriptors
+ vkCreateDynamicViewportState
+ vkCreateDynamicRasterState
+ vkCreateDynamicColorBlendState
+ vkCreateDynamicDepthStencilState
+ vkCreateCommandBuffer
+ vkBeginCommandBuffer
+ vkEndCommandBuffer
+ vkResetCommandBuffer
+ vkCmdBindPipeline
+ vkCmdBindDynamicStateObject
+ vkCmdBindDescriptorSets
+ vkCmdBindVertexBuffers
+ vkCmdBindIndexBuffer
+ vkCmdDraw
+ vkCmdDrawIndexed
+ vkCmdDrawIndirect
+ vkCmdDrawIndexedIndirect
+ vkCmdDispatch
+ vkCmdDispatchIndirect
+ vkCmdCopyBuffer
+ vkCmdCopyImage
+ vkCmdBlitImage
+ vkCmdCopyBufferToImage
+ vkCmdCopyImageToBuffer
+ vkCmdUpdateBuffer
+ vkCmdFillBuffer
+ vkCmdClearColorImage
+ vkCmdClearDepthStencil
+ vkCmdResolveImage
+ vkCmdSetEvent
+ vkCmdResetEvent
+ vkCmdWaitEvents
+ vkCmdPipelineBarrier
+ vkCmdBeginQuery
+ vkCmdEndQuery
+ vkCmdResetQueryPool
+ vkCmdWriteTimestamp
+ vkCmdCopyQueryPoolResults
+ vkCmdInitAtomicCounters
+ vkCmdLoadAtomicCounters
+ vkCmdSaveAtomicCounters
+ vkCreateFramebuffer
+ vkCreateRenderPass
+ vkCmdBeginRenderPass
+ vkCmdEndRenderPass
+ vkDbgSetValidationLevel
+ vkDbgRegisterMsgCallback
+ vkDbgUnregisterMsgCallback
+ vkDbgSetMessageFilter
+ vkDbgSetObjectTag
+ vkDbgSetGlobalOption
+ vkDbgSetDeviceOption
+ vkCmdDbgMarkerBegin
+ vkCmdDbgMarkerEnd
+ vkGetDisplayInfoWSI
+ vkCreateSwapChainWSI
+ vkDestroySwapChainWSI
+ vkGetSwapChainInfoWSI
+ vkQueuePresentWSI
diff --git a/vk-generate.py b/vk-generate.py
index 024fce89..00327b75 100755
--- a/vk-generate.py
+++ b/vk-generate.py
@@ -204,7 +204,10 @@ class IcdGetProcAddrSubcommand(IcdDummyEntrypointsSubcommand):
for proto in self.protos:
if proto.name == "GetProcAddr":
gpa_proto = proto
+ if proto.name == "GetInstanceProcAddr":
+ gpa_instance_proto = proto
+ gpa_instance_decl = self._generate_stub_decl(gpa_instance_proto)
gpa_decl = self._generate_stub_decl(gpa_proto)
gpa_pname = gpa_proto.params[-1].name
@@ -216,6 +219,12 @@ class IcdGetProcAddrSubcommand(IcdDummyEntrypointsSubcommand):
(gpa_proto.ret, self.prefix, proto.name))
body = []
+ body.append("%s %s" % (self.qual, gpa_instance_decl))
+ body.append("{")
+ body.append(" return NULL;")
+ body.append("}")
+ body.append("")
+
body.append("%s %s" % (self.qual, gpa_decl))
body.append("{")
body.append(generate_get_proc_addr_check(gpa_pname))
@@ -234,7 +243,7 @@ class LayerInterceptProcSubcommand(Subcommand):
# we could get the list from argv if wanted
self.intercepted = [proto.name for proto in self.protos
- if proto.name not in ["EnumeratePhysicalDevices"]]
+ if proto.name not in ["EnumeratePhysicalDevices", "GetInstanceProcAddr"]]
for proto in self.protos:
if proto.name == "GetProcAddr":
diff --git a/vk-layer-generate.py b/vk-layer-generate.py
index 5fa03d18..369d63b1 100755
--- a/vk-layer-generate.py
+++ b/vk-layer-generate.py
@@ -267,28 +267,6 @@ class Subcommand(object):
ggei_body.append('}')
return "\n".join(ggei_body)
- def _gen_layer_get_extension_support(self, layer="Generic"):
- ges_body = []
- ges_body.append('VK_LAYER_EXPORT VkResult VKAPI xglGetExtensionSupport(VkPhysicalDevice gpu, const char* pExtName)')
- ges_body.append('{')
- ges_body.append(' VkResult result;')
- ges_body.append(' VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;')
- ges_body.append('')
- ges_body.append(' /* This entrypoint is NOT going to init its own dispatch table since loader calls here early */')
- ges_body.append(' if (!strncmp(pExtName, "%s", strlen("%s")))' % (layer, layer))
- ges_body.append(' {')
- ges_body.append(' result = VK_SUCCESS;')
- ges_body.append(' } else if (nextTable.GetExtensionSupport != NULL)')
- ges_body.append(' {')
- ges_body.append(' result = nextTable.GetExtensionSupport((VkPhysicalDevice)gpuw->nextObject, pExtName);')
- ges_body.append(' } else')
- ges_body.append(' {')
- ges_body.append(' result = VK_ERROR_INVALID_EXTENSION;')
- ges_body.append(' }')
- ges_body.append(' return result;')
- ges_body.append('}')
- return "\n".join(ges_body)
-
def _generate_dispatch_entrypoints(self, qual=""):
if qual:
qual += " "
@@ -307,7 +285,7 @@ class Subcommand(object):
elif 'DbgUnregisterMsgCallback' == proto.name:
intercept = self._gen_layer_dbg_callback_unregister()
elif 'GetGlobalExtensionInfo' == proto.name:
- funcs.append(self._gen_layer_get_global_extension_info(self.layer_name))
+ intercept = self._gen_layer_get_global_extension_info(self.layer_name)
if intercept is not None:
funcs.append(intercept)
intercepted.append(proto)
@@ -319,13 +297,6 @@ class Subcommand(object):
lookups.append(" return (void*) %s%s;" %
(prefix, proto.name))
- prefix="vk"
- lookups = []
- for proto in intercepted:
- lookups.append("if (!strcmp(name, \"%s\"))" % proto.name)
- lookups.append(" return (void*) %s%s;" %
- (prefix, proto.name))
-
# add customized layer_intercept_proc
body = []
body.append("static inline void* layer_intercept_proc(const char *name)")
@@ -509,7 +480,7 @@ class GenericLayerSubcommand(Subcommand):
stmt = ''
funcs = []
if proto.ret != "void":
- ret_val = "VkResult result = "
+ ret_val = "%s result = " % proto.ret
stmt = " return result;\n"
if proto.name == "EnumerateLayers":
funcs.append('%s%s\n'
@@ -710,7 +681,7 @@ class APIDumpSubcommand(Subcommand):
elif 'Create' in proto.name or 'Alloc' in proto.name or 'MapMemory' in proto.name:
create_params = -1
if proto.ret != "void":
- ret_val = "VkResult result = "
+ ret_val = "%s result = " % proto.ret
stmt = " return result;\n"
f_open = 'loader_platform_thread_lock_mutex(&printLock);\n '
log_func = ' if (StreamControl::writeAddress == true) {'
@@ -747,9 +718,12 @@ class APIDumpSubcommand(Subcommand):
pindex += 1
log_func = log_func.strip(', ')
log_func_no_addr = log_func_no_addr.strip(', ')
- if proto.ret != "void":
+ if proto.ret == "VkResult":
log_func += ') = " << string_VkResult((VkResult)result) << endl'
log_func_no_addr += ') = " << string_VkResult((VkResult)result) << endl'
+ elif proto.ret == "void*":
+ log_func += ') = " << result << endl'
+ log_func_no_addr += ') = " << result << endl'
else:
log_func += ')\\n"'
log_func_no_addr += ')\\n"'
@@ -825,24 +799,6 @@ class APIDumpSubcommand(Subcommand):
' return VK_SUCCESS;\n'
' }\n'
'}' % (qual, decl, self.layer_name, ret_val, proto.c_call(),f_open, log_func, f_close, stmt, self.layer_name))
- elif 'GetExtensionSupport' == proto.name:
- funcs.append('%s%s\n'
- '{\n'
- ' VkResult result;\n'
- ' /* This entrypoint is NOT going to init its own dispatch table since loader calls here early */\n'
- ' if (!strncmp(pExtName, "%s", strlen("%s")))\n'
- ' {\n'
- ' result = VK_SUCCESS;\n'
- ' } else if (nextTable.GetExtensionSupport != NULL)\n'
- ' {\n'
- ' result = nextTable.%s;\n'
- ' %s %s %s\n'
- ' } else\n'
- ' {\n'
- ' result = VK_ERROR_INVALID_EXTENSION;\n'
- ' }\n'
- '%s'
- '}' % (qual, decl, self.layer_name, self.layer_name, proto.c_call(), f_open, log_func, f_close, stmt))
else:
funcs.append('%s%s\n'
'{\n'
@@ -904,13 +860,13 @@ class ObjectTrackerSubcommand(Subcommand):
header_txt.append('typedef struct _OT_QUEUE_INFO {')
header_txt.append(' OT_MEM_INFO *pMemRefList;')
header_txt.append(' struct _OT_QUEUE_INFO *pNextQI;')
- header_txt.append(' VkPhysicalDeviceQueueProperties *pQueueProps;')
+ header_txt.append(' uint32_t queueNodeIndex;')
header_txt.append(' VkQueue queue;')
header_txt.append(' uint32_t refCount;')
header_txt.append('} OT_QUEUE_INFO;')
header_txt.append('')
header_txt.append('// Global list of QueueInfo structures, one per queue')
- header_txt.append('static OT_QUEUE_INFO *g_pQueueInfo;')
+ header_txt.append('static OT_QUEUE_INFO *g_pQueueInfo = NULL;')
header_txt.append('')
header_txt.append('// Convert an object type enum to an object type array index')
header_txt.append('static uint32_t objTypeToIndex(uint32_t objType)')
@@ -948,11 +904,11 @@ class ObjectTrackerSubcommand(Subcommand):
header_txt.append('static void addQueueInfo(uint32_t queueNodeIndex, VkQueue queue)')
header_txt.append('{')
header_txt.append(' OT_QUEUE_INFO *pQueueInfo = malloc(sizeof(OT_QUEUE_INFO));')
- header_txt.append(' memset(pQueueInfo, 0, sizeof(OT_QUEUE_INFO));')
- header_txt.append(' pQueueInfo->queue = queue;')
- header_txt.append(' pQueueInfo->pQueueProps = &queueInfo[queueNodeIndex];')
header_txt.append('')
header_txt.append(' if (pQueueInfo != NULL) {')
+ header_txt.append(' memset(pQueueInfo, 0, sizeof(OT_QUEUE_INFO));')
+ header_txt.append(' pQueueInfo->queue = queue;')
+ header_txt.append(' pQueueInfo->queueNodeIndex = queueNodeIndex;')
header_txt.append(' pQueueInfo->pNextQI = g_pQueueInfo;')
header_txt.append(' g_pQueueInfo = pQueueInfo;')
header_txt.append(' }')
@@ -1009,7 +965,6 @@ class ObjectTrackerSubcommand(Subcommand):
header_txt.append(' pNewObjNode->obj.vkObj = vkObj;')
header_txt.append(' pNewObjNode->obj.objType = objType;')
header_txt.append(' pNewObjNode->obj.status = OBJSTATUS_NONE;')
- header_txt.append(' pNewObjNode->obj.numUses = 0;')
header_txt.append(' // insert at front of global list')
header_txt.append(' pNewObjNode->pNextGlobal = pGlobalHead;')
header_txt.append(' pGlobalHead = pNewObjNode;')
@@ -1023,26 +978,6 @@ class ObjectTrackerSubcommand(Subcommand):
header_txt.append(' //sprintf(str, "OBJ_STAT : %lu total objs & %lu %s objs.", numTotalObjs, numObjs[objIndex], string_from_vulkan_object_type(objType));')
header_txt.append(' if (0) ll_print_lists();')
header_txt.append('}')
- header_txt.append('static void ll_increment_use_count(VkObject vkObj, VkObjectType objType) {')
- header_txt.append(' objNode *pTrav = pObjectHead[objTypeToIndex(objType)];')
- header_txt.append(' while (pTrav) {')
- header_txt.append(' if (pTrav->obj.vkObj == vkObj) {')
- header_txt.append(' pTrav->obj.numUses++;')
- header_txt.append(' char str[1024];')
- header_txt.append(' sprintf(str, "OBJ[%llu] : USING %s object 0x%" PRId64 " (%lu total uses)", object_track_index++, string_from_vulkan_object_type(objType), vkObj, pTrav->obj.numUses);')
- header_txt.append(' layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, vkObj, 0, OBJTRACK_NONE, "OBJTRACK", str);')
- header_txt.append(' return;')
- header_txt.append(' }')
- header_txt.append(' pTrav = pTrav->pNextObj;')
- header_txt.append(' }')
- header_txt.append(' // If we do not find obj, insert it and then increment count')
- header_txt.append(' char str[1024];')
- header_txt.append(' sprintf(str, "Unable to increment count for obj 0x%" PRId64 ", will add to list as %s type and increment count", vkObj, string_from_vulkan_object_type(objType));')
- header_txt.append(' layerCbMsg(VK_DBG_MSG_WARNING, VK_VALIDATION_LEVEL_0, vkObj, 0, OBJTRACK_UNKNOWN_OBJECT, "OBJTRACK", str);')
- header_txt.append('')
- header_txt.append(' ll_insert_obj(vkObj, objType);')
- header_txt.append(' ll_increment_use_count(vkObj, objType);')
- header_txt.append('}')
header_txt.append('// We usually do not know Obj type when we destroy it so have to fetch')
header_txt.append('// Type from global list w/ ll_destroy_obj()')
header_txt.append('// and then do the full removal from both lists w/ ll_remove_obj_type()')
@@ -1085,7 +1020,7 @@ class ObjectTrackerSubcommand(Subcommand):
header_txt.append(' assert(numTotalObjs > 0);')
header_txt.append(' numTotalObjs--;')
header_txt.append(' char str[1024];')
- header_txt.append(' sprintf(str, "OBJ_STAT Removed %s obj 0x%" PRId64 " that was used %lu times (%lu total objs remain & %lu %s objs).", string_from_vulkan_object_type(pTrav->obj.objType), pTrav->obj.vkObj, pTrav->obj.numUses, numTotalObjs, numObjs[objTypeToIndex(pTrav->obj.objType)], string_from_vulkan_object_type(pTrav->obj.objType));')
+ header_txt.append(' sprintf(str, "OBJ_STAT Removed %s obj 0x%" PRId64 " (%lu total objs remain & %lu %s objs).", string_from_vulkan_object_type(pTrav->obj.objType), pTrav->obj.vkObj, numTotalObjs, numObjs[objTypeToIndex(pTrav->obj.objType)], string_from_vulkan_object_type(pTrav->obj.objType));')
header_txt.append(' layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, vkObj, 0, OBJTRACK_NONE, "OBJTRACK", str);')
header_txt.append(' free(pTrav);')
header_txt.append(' return;')
@@ -1158,23 +1093,28 @@ class ObjectTrackerSubcommand(Subcommand):
header_txt.append('')
header_txt.append('static void setGpuQueueInfoState(size_t* pDataSize, void *pData) {')
header_txt.append(' queueCount = ((uint32_t)*pDataSize / sizeof(VkPhysicalDeviceQueueProperties));')
- header_txt.append(' queueInfo = (VkPhysicalDeviceQueueProperties*)malloc(sizeof(pDataSize));')
- header_txt.append(' memcpy(queueInfo, pData, *pDataSize);')
+ header_txt.append(' queueInfo = (VkPhysicalDeviceQueueProperties*)realloc((void*)queueInfo, *pDataSize);')
+ header_txt.append(' if (queueInfo != NULL) {')
+ header_txt.append(' memcpy(queueInfo, pData, *pDataSize);')
+ header_txt.append(' }')
header_txt.append('}')
header_txt.append('')
header_txt.append('// Check object status for selected flag state')
- header_txt.append('static bool32_t validateQueueFlags(VkQueue queue) {')
- header_txt.append(' bool32_t result = VK_TRUE;')
+ header_txt.append('static void validateQueueFlags(VkQueue queue, const char *function) {')
header_txt.append(' OT_QUEUE_INFO *pQueueInfo = g_pQueueInfo;')
- header_txt.append(' while (pQueueInfo->queue != queue) {')
+ header_txt.append(' while ((pQueueInfo != NULL) && (pQueueInfo->queue != queue)) {')
header_txt.append(' pQueueInfo = pQueueInfo->pNextQI;')
header_txt.append(' }')
header_txt.append(' if (pQueueInfo != NULL) {')
- header_txt.append(' if ((pQueueInfo->pQueueProps->queueFlags & VK_QUEUE_MEMMGR_BIT) == 0) {')
- header_txt.append(' result = VK_FALSE;')
+ header_txt.append(' char str[1024];\n')
+ header_txt.append(' if ((queueInfo != NULL) && (queueInfo[pQueueInfo->queueNodeIndex].queueFlags & VK_QUEUE_SPARSE_MEMMGR_BIT) == 0) {')
+ header_txt.append(' sprintf(str, "Attempting %s on a non-memory-management capable queue -- VK_QUEUE_SPARSE_MEMMGR_BIT not set", function);')
+ header_txt.append(' layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, queue, 0, OBJTRACK_UNKNOWN_OBJECT, "OBJTRACK", str);')
+ header_txt.append(' } else {')
+ header_txt.append(' sprintf(str, "Attempting %s on a possibly non-memory-management capable queue -- VK_QUEUE_SPARSE_MEMMGR_BIT not known", function);')
+ header_txt.append(' layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, queue, 0, OBJTRACK_UNKNOWN_OBJECT, "OBJTRACK", str);')
header_txt.append(' }')
header_txt.append(' }')
- header_txt.append(' return result;')
header_txt.append('}')
header_txt.append('')
header_txt.append('// Check object status for selected flag state')
@@ -1224,122 +1164,122 @@ class ObjectTrackerSubcommand(Subcommand):
decl = proto.c_func(prefix="vk", attr="VKAPI")
param0_name = proto.params[0].name
p0_type = proto.params[0].ty.strip('*').replace('const ', '')
+ using_line = ''
create_line = ''
destroy_line = ''
funcs = []
- # Special cases for API funcs that don't use an object as first arg
- if True in [no_use_proto in proto.name for no_use_proto in ['GlobalOption', 'GetPhysicalDeviceInfo', 'CreateInstance', 'QueueSubmit', 'QueueWaitIdle', 'QueueBindObjectMemory', 'QueueBindObjectMemoryRange', 'QueueBindImageMemoryRange', 'QueuePresentWSI', 'GetGlobalExtensionInfo', 'CreateDevice', 'GetGpuInfo', 'QueueSignalSemaphore', 'QueueWaitSemaphore']]:
- using_line = ''
- else:
- using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
- using_line += ' ll_increment_use_count(%s, %s);\n' % (param0_name, obj_type_mapping[p0_type])
- # using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n' -- Add in after special case sections below.
+
if 'QueueSubmit' in proto.name:
- using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' set_status(fence, VK_OBJECT_TYPE_FENCE, OBJSTATUS_FENCE_IS_SUBMITTED);\n'
using_line += ' // TODO: Fix for updated memory reference mechanism\n'
using_line += ' // validate_memory_mapping_status(pMemRefs, memRefCount);\n'
using_line += ' // validate_mem_ref_count(memRefCount);\n'
using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
+ elif 'QueueBindSparse' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+ using_line += ' validateQueueFlags(queue, "%s");\n' % (proto.name)
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'QueueBindObject' in proto.name:
- using_line += ' loader_platform_thread_lock_mutex(&objLock);\n'
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' validateObjectType("vk%s", objType, object);\n' % (proto.name)
- using_line += ' if (validateQueueFlags(queue) == VK_FALSE) {\n'
- using_line += ' char str[1024];\n'
- using_line += ' sprintf(str, "Attempting %s on a non-memory-management capable queue -- VK_QUEUE_MEMMGR_BIT not set");\n' % (proto.name)
- using_line += ' layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, queue, 0, OBJTRACK_UNKNOWN_OBJECT, "OBJTRACK", str);\n'
- using_line += ' }\n'
- using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
- elif 'QueueBindImage' in proto.name:
- using_line += ' loader_platform_thread_lock_mutex(&objLock);\n'
- using_line += ' if (validateQueueFlags(queue) == VK_FALSE) {\n'
- using_line += ' char str[1024];\n'
- using_line += ' sprintf(str, "Attempting %s on a non-memory-management capable queue -- VK_QUEUE_MEMMGR_BIT not set");\n' % (proto.name)
- using_line += ' layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, queue, 0, OBJTRACK_UNKNOWN_OBJECT, "OBJTRACK", str);\n'
- using_line += ' }\n'
using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'GetObjectInfo' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' validateObjectType("vk%s", objType, object);\n' % (proto.name)
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'GetFenceStatus' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' // Warn if submitted_flag is not set\n'
using_line += ' validate_status(fence, VK_OBJECT_TYPE_FENCE, OBJSTATUS_FENCE_IS_SUBMITTED, OBJSTATUS_FENCE_IS_SUBMITTED, VK_DBG_MSG_ERROR, OBJTRACK_INVALID_FENCE, "Status Requested for Unsubmitted Fence");\n'
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'WaitForFences' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' // Warn if waiting on unsubmitted fence\n'
using_line += ' for (uint32_t i = 0; i < fenceCount; i++) {\n'
using_line += ' validate_status(pFences[i], VK_OBJECT_TYPE_FENCE, OBJSTATUS_FENCE_IS_SUBMITTED, OBJSTATUS_FENCE_IS_SUBMITTED, VK_DBG_MSG_ERROR, OBJTRACK_INVALID_FENCE, "Waiting for Unsubmitted Fence");\n'
using_line += ' }\n'
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'EndCommandBuffer' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' reset_status(cmdBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER, (OBJSTATUS_VIEWPORT_BOUND |\n'
using_line += ' OBJSTATUS_RASTER_BOUND |\n'
using_line += ' OBJSTATUS_COLOR_BLEND_BOUND |\n'
using_line += ' OBJSTATUS_DEPTH_STENCIL_BOUND));\n'
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'CmdBindDynamicStateObject' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' track_object_status(cmdBuffer, stateBindPoint);\n'
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'CmdDraw' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' validate_draw_state_flags(cmdBuffer);\n'
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'MapMemory' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' set_status(mem, VK_OBJECT_TYPE_DEVICE_MEMORY, OBJSTATUS_GPU_MEM_MAPPED);\n'
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'UnmapMemory' in proto.name:
+ using_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
using_line += ' reset_status(mem, VK_OBJECT_TYPE_DEVICE_MEMORY, OBJSTATUS_GPU_MEM_MAPPED);\n'
- if 'AllocDescriptor' in proto.name: # Allocates array of DSs
- create_line = ' for (uint32_t i = 0; i < *pCount; i++) {\n'
- create_line += ' loader_platform_thread_lock_mutex(&objLock);\n'
+ using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
+ elif 'AllocDescriptor' in proto.name: # Allocates array of DSs
+ create_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+ create_line += ' for (uint32_t i = 0; i < *pCount; i++) {\n'
create_line += ' ll_insert_obj(pDescriptorSets[i], VK_OBJECT_TYPE_DESCRIPTOR_SET);\n'
- create_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
create_line += ' }\n'
+ create_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
elif 'Create' in proto.name or 'Alloc' in proto.name:
- create_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+ create_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
create_line += ' ll_insert_obj(*%s, %s);\n' % (proto.params[-1].name, obj_type_mapping[proto.params[-1].ty.strip('*').replace('const ', '')])
create_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
- # Add thread unlock statement following objecttracker processing code.
- if True in [no_use_proto in proto.name for no_use_proto in ['GlobalOption', 'GetPhysicalDeviceInfo', 'CreateInstance', 'QueueSubmit', 'QueueAddMemReferences', 'QueueRemoveMemReferences', 'QueueWaitIdle', 'QueueBindObjectMemory', 'QueueBindObjectMemoryRange', 'QueueBindImageMemoryRange', 'QueuePresentWSI', 'GetGlobalExtensionInfo', 'CreateDevice', 'GetGpuInfo', 'QueueSignalSemaphore', 'QueueWaitSemaphore']]:
- using_line += ''
- else:
- using_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
- if 'DestroyObject' in proto.name:
- destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+
+ if 'GetDeviceQueue' in proto.name:
+ destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+ destroy_line += ' addQueueInfo(queueNodeIndex, *pQueue);\n'
+ destroy_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
+ elif 'DestroyObject' in proto.name:
+ destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
destroy_line += ' validateObjectType("vk%s", objType, object);\n' % (proto.name)
destroy_line += ' ll_destroy_obj(%s);\n' % (proto.params[2].name)
destroy_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
- using_line = ''
+ elif 'DestroyDevice' in proto.name:
+ destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+ destroy_line += ' ll_destroy_obj(device);\n'
+ destroy_line += ' // Report any remaining objects in LL\n'
+ destroy_line += ' objNode *pTrav = pGlobalHead;\n'
+ destroy_line += ' while (pTrav) {\n'
+ destroy_line += ' if ((pTrav->obj.objType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) || (pTrav->obj.objType == VK_OBJECT_TYPE_QUEUE)) {\n'
+ destroy_line += ' // Cannot destroy physical device so ignore\n'
+ destroy_line += ' pTrav = pTrav->pNextGlobal;\n'
+ destroy_line += ' } else {\n'
+ destroy_line += ' char str[1024];\n'
+ destroy_line += ' sprintf(str, "OBJ ERROR : %s object 0x%" PRId64 " has not been destroyed.", string_from_vulkan_object_type(pTrav->obj.objType), pTrav->obj.vkObj);\n'
+ destroy_line += ' layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, device, 0, OBJTRACK_OBJECT_LEAK, "OBJTRACK", str);\n'
+ destroy_line += ' pTrav = pTrav->pNextGlobal;\n'
+ destroy_line += ' }\n'
+ destroy_line += ' }\n'
+ destroy_line += ' // Clean up Queue\'s MemRef Linked Lists\n'
+ destroy_line += ' destroyQueueMemRefLists();\n'
+ destroy_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
+ elif 'Free' in proto.name:
+ destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+ destroy_line += ' ll_destroy_obj(%s);\n' % (proto.params[1].name)
+ destroy_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
else:
if 'Destroy' in proto.name:
- destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
+ destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
destroy_line += ' ll_destroy_obj(%s);\n' % (param0_name)
destroy_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
- using_line = ''
- else:
- if 'Free' in proto.name:
- destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n'
- destroy_line += ' ll_destroy_obj(%s);\n' % (proto.params[1].name)
- destroy_line += ' loader_platform_thread_unlock_mutex(&objLock);\n'
- using_line = ''
- if 'DestroyDevice' in proto.name:
- destroy_line += ' // Report any remaining objects in LL\n objNode *pTrav = pGlobalHead;\n while (pTrav) {\n'
- destroy_line += ' if ((pTrav->obj.objType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) || (pTrav->obj.objType == VK_OBJECT_TYPE_QUEUE)) {\n'
- destroy_line += ' // Cannot destroy physical device so ignore\n'
- destroy_line += ' pTrav = pTrav->pNextGlobal;\n'
- destroy_line += ' } else {\n'
- destroy_line += ' char str[1024];\n'
- destroy_line += ' sprintf(str, "OBJ ERROR : %s object 0x%" PRId64 " has not been destroyed (was used %lu times).", string_from_vulkan_object_type(pTrav->obj.objType), pTrav->obj.vkObj, pTrav->obj.numUses);\n'
- destroy_line += ' layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, device, 0, OBJTRACK_OBJECT_LEAK, "OBJTRACK", str);\n'
- destroy_line += ' pTrav = pTrav->pNextGlobal;\n'
- destroy_line += ' }\n'
- destroy_line += ' }\n'
- destroy_line += ' // Clean up Queue\'s MemRef Linked Lists\n'
- destroy_line += ' destroyQueueMemRefLists();\n'
- if 'GetDeviceQueue' in proto.name:
- destroy_line = ' addQueueInfo(queueNodeIndex, *pQueue);\n'
ret_val = ''
stmt = ''
if proto.ret != "void":
- ret_val = "VkResult result = "
+ ret_val = "%s result = " % proto.ret
stmt = " return result;\n"
if proto.name == "EnumerateLayers":
funcs.append('%s%s\n'
'{\n'
' if (gpu != VK_NULL_HANDLE) {\n'
- ' %s'
' pCurObj = (VkBaseLayerObject *) gpu;\n'
' loader_platform_thread_once(&tabOnce, init%s);\n'
' %snextTable.%s;\n'
@@ -1353,45 +1293,25 @@ class ObjectTrackerSubcommand(Subcommand):
' strncpy((char *) pOutLayers[0], "%s", maxStringSize);\n'
' return VK_SUCCESS;\n'
' }\n'
- '}' % (qual, decl, using_line, self.layer_name, ret_val, proto.c_call(), create_line, destroy_line, stmt, self.layer_name))
- elif 'GetExtensionSupport' == proto.name:
- funcs.append('%s%s\n'
- '{\n'
- ' VkResult result;\n'
- ' /* This entrypoint is NOT going to init its own dispatch table since loader calls this early */\n'
- ' if (!strncmp(pExtName, "%s", strlen("%s")) ||\n'
- ' !strncmp(pExtName, "objTrackGetObjectsCount", strlen("objTrackGetObjectsCount")) ||\n'
- ' !strncmp(pExtName, "objTrackGetObjects", strlen("objTrackGetObjects")))\n'
- ' !strncmp(pExtName, "objTrackGetObjectsOfTypeCount", strlen("objTrackGetObjectsOfTypeCount")) ||\n'
- ' !strncmp(pExtName, "objTrackGetObjectsOfType", strlen("objTrackGetObjectsOfType")))\n'
- ' {\n'
- ' result = VK_SUCCESS;\n'
- ' } else if (nextTable.GetExtensionSupport != NULL)\n'
- ' {\n'
- ' %s'
- ' result = nextTable.%s;\n'
- ' } else\n'
- ' {\n'
- ' result = VK_ERROR_INVALID_EXTENSION;\n'
- ' }\n'
- '%s'
- '}' % (qual, decl, self.layer_name, self.layer_name, using_line, proto.c_call(), stmt))
+ '}' % (qual, decl, self.layer_name, ret_val, proto.c_call(), create_line, destroy_line, stmt, self.layer_name))
elif 'GetPhysicalDeviceInfo' in proto.name:
- gpu_state = ' if (infoType == VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES) {\n'
+
+ gpu_state = ' if (infoType == VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES) {\n'
gpu_state += ' if (pData != NULL) {\n'
+ gpu_state += ' loader_platform_thread_lock_mutex(&objLock);\n'
gpu_state += ' setGpuQueueInfoState(pDataSize, pData);\n'
+ gpu_state += ' loader_platform_thread_unlock_mutex(&objLock);\n'
gpu_state += ' }\n'
gpu_state += ' }\n'
funcs.append('%s%s\n'
'{\n'
- '%s'
' pCurObj = (VkBaseLayerObject *) gpu;\n'
' loader_platform_thread_once(&tabOnce, init%s);\n'
' %snextTable.%s;\n'
'%s%s'
'%s'
'%s'
- '}' % (qual, decl, using_line, self.layer_name, ret_val, proto.c_call(), create_line, destroy_line, gpu_state, stmt))
+ '}' % (qual, decl, self.layer_name, ret_val, proto.c_call(), create_line, destroy_line, gpu_state, stmt))
else:
funcs.append('%s%s\n'
'{\n'
@@ -1444,7 +1364,7 @@ class ThreadingSubcommand(Subcommand):
header_txt.append(' if (objectsInUse.find(object) == objectsInUse.end()) {')
header_txt.append(' objectsInUse[object] = tid;')
header_txt.append(' } else {')
- header_txt.append(' if (objectsInUse[object] == tid) {')
+ header_txt.append(' if (objectsInUse[object] != tid) {')
header_txt.append(' char str[1024];')
header_txt.append(' sprintf(str, "THREADING ERROR : object of type %s is simultaneously used in thread %ld and thread %ld", type, objectsInUse[object], tid);')
header_txt.append(' layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, 0, 0, THREADING_CHECKER_MULTIPLE_THREADS, "THREADING", str);')
@@ -1470,11 +1390,22 @@ class ThreadingSubcommand(Subcommand):
# use default version
return None
decl = proto.c_func(prefix="vk", attr="VKAPI")
+ thread_check_objects = [
+ "VkQueue",
+ "VkDeviceMemory",
+ "VkObject",
+ "VkBuffer",
+ "VkImage",
+ "VkDescriptorSet",
+ "VkDescriptorPool",
+ "VkCmdBuffer",
+ "VkSemaphore"
+ ]
ret_val = ''
stmt = ''
funcs = []
if proto.ret != "void":
- ret_val = "VkResult result = "
+ ret_val = "%s result = " % proto.ret
stmt = " return result;\n"
if proto.name == "EnumerateLayers":
funcs.append('%s%s\n'
@@ -1494,35 +1425,68 @@ class ThreadingSubcommand(Subcommand):
' return VK_SUCCESS;\n'
' }\n'
'}' % (qual, decl, proto.params[0].name, self.layer_name, ret_val, proto.c_call(), stmt, self.layer_name))
+ return "\n".join(funcs)
+ # Memory range calls are special in needed thread checking within structs
+ if proto.name in ["FlushMappedMemoryRanges","InvalidateMappedMemoryRanges"]:
+ funcs.append('%s%s\n'
+ '{\n'
+ ' for (int i=0; i<memRangeCount; i++) {\n'
+ ' useObject((VkObject) pMemRanges[i].mem, "VkDeviceMemory");\n'
+ ' }\n'
+ ' %snextTable.%s;\n'
+ ' for (int i=0; i<memRangeCount; i++) {\n'
+ ' finishUsingObject((VkObject) pMemRanges[i].mem);\n'
+ ' }\n'
+ '%s'
+ '}' % (qual, decl, ret_val, proto.c_call(), stmt))
+ return "\n".join(funcs)
# All functions that do a Get are thread safe
- elif 'Get' in proto.name:
- return None
- # All Wsi functions are thread safe
- elif 'WsiX11' in proto.name:
- return None
- # All functions that start with a device parameter are thread safe
- elif proto.params[0].ty in { "VkDevice" }:
+ if 'Get' in proto.name:
return None
- # Only watch core objects passed as first parameter
- elif proto.params[0].ty not in vulkan.core.objects:
+ # All WSI functions are thread safe
+ if 'WSI' in proto.name:
return None
- elif proto.params[0].ty != "VkPhysicalDevice":
+ # Initialize in early calls
+ if proto.params[0].ty == "VkPhysicalDevice":
funcs.append('%s%s\n'
'{\n'
- ' useObject((VkObject) %s, "%s");\n'
+ ' pCurObj = (VkBaseLayerObject *) %s;\n'
+ ' loader_platform_thread_once(&tabOnce, init%s);\n'
' %snextTable.%s;\n'
- ' finishUsingObject((VkObject) %s);\n'
'%s'
- '}' % (qual, decl, proto.params[0].name, proto.params[0].ty, ret_val, proto.c_call(), proto.params[0].name, stmt))
- else:
+ '}' % (qual, decl, proto.params[0].name, self.layer_name, ret_val, proto.c_call(), stmt))
+ return "\n".join(funcs)
+ # Functions changing command buffers need thread safe use of first parameter
+ if proto.params[0].ty == "VkCmdBuffer":
funcs.append('%s%s\n'
'{\n'
- ' pCurObj = (VkBaseLayerObject *) %s;\n'
- ' loader_platform_thread_once(&tabOnce, init%s);\n'
+ ' useObject((VkObject) %s, "%s");\n'
' %snextTable.%s;\n'
+ ' finishUsingObject((VkObject) %s);\n'
'%s'
- '}' % (qual, decl, proto.params[0].name, self.layer_name, ret_val, proto.c_call(), stmt))
- return "\n\n".join(funcs)
+ '}' % (qual, decl, proto.params[0].name, proto.params[0].ty, ret_val, proto.c_call(), proto.params[0].name, stmt))
+ return "\n".join(funcs)
+ # Non-Cmd functions that do a Wait are thread safe
+ if 'Wait' in proto.name:
+ return None
+ # Watch use of certain types of objects passed as any parameter
+ checked_params = []
+ for param in proto.params:
+ if param.ty in thread_check_objects:
+ checked_params.append(param)
+ if len(checked_params) == 0:
+ return None
+ # Surround call with useObject and finishUsingObject for each checked_param
+ funcs.append('%s%s' % (qual, decl))
+ funcs.append('{')
+ for param in checked_params:
+ funcs.append(' useObject((VkObject) %s, "%s");' % (param.name, param.ty))
+ funcs.append(' %snextTable.%s;' % (ret_val, proto.c_call()))
+ for param in checked_params:
+ funcs.append(' finishUsingObject((VkObject) %s);' % param.name)
+ funcs.append('%s'
+ '}' % stmt)
+ return "\n".join(funcs)
def generate_body(self):
self.layer_name = "Threading"
diff --git a/vulkan.py b/vulkan.py
index cb0b04f9..e2a6905e 100755
--- a/vulkan.py
+++ b/vulkan.py
@@ -235,6 +235,10 @@ core = Extension(
Param("size_t*", "pDataSize"),
Param("void*", "pData")]),
+ Proto("void*", "GetInstanceProcAddr",
+ [Param("VkInstance", "instance"),
+ Param("const char*", "pName")]),
+
Proto("void*", "GetProcAddr",
[Param("VkPhysicalDevice", "gpu"),
Param("const char*", "pName")]),
@@ -366,25 +370,24 @@ core = Extension(
Param("size_t*", "pDataSize"),
Param("void*", "pData")]),
- Proto("VkResult", "QueueBindObjectMemory",
- [Param("VkQueue", "queue"),
+ Proto("VkResult", "BindObjectMemory",
+ [Param("VkDevice", "device"),
Param("VkObjectType", "objType"),
Param("VkObject", "object"),
Param("uint32_t", "allocationIdx"),
Param("VkDeviceMemory", "mem"),
Param("VkDeviceSize", "offset")]),
- Proto("VkResult", "QueueBindObjectMemoryRange",
+ Proto("VkResult", "QueueBindSparseBufferMemory",
[Param("VkQueue", "queue"),
- Param("VkObjectType", "objType"),
- Param("VkObject", "object"),
+ Param("VkBuffer", "buffer"),
Param("uint32_t", "allocationIdx"),
Param("VkDeviceSize", "rangeOffset"),
Param("VkDeviceSize", "rangeSize"),
Param("VkDeviceMemory", "mem"),
Param("VkDeviceSize", "memOffset")]),
- Proto("VkResult", "QueueBindImageMemoryRange",
+ Proto("VkResult", "QueueBindSparseImageMemory",
[Param("VkQueue", "queue"),
Param("VkImage", "image"),
Param("uint32_t", "allocationIdx"),
@@ -746,13 +749,6 @@ core = Extension(
Param("uint32_t", "regionCount"),
Param("const VkBufferImageCopy*", "pRegions")]),
- Proto("void", "CmdCloneImageData",
- [Param("VkCmdBuffer", "cmdBuffer"),
- Param("VkImage", "srcImage"),
- Param("VkImageLayout", "srcImageLayout"),
- Param("VkImage", "destImage"),
- Param("VkImageLayout", "destImageLayout")]),
-
Proto("void", "CmdUpdateBuffer",
[Param("VkCmdBuffer", "cmdBuffer"),
Param("VkBuffer", "destBuffer"),