blob: 4777cbb5c1bb08f0cb53f49781ac8bd124754d7c [file] [log] [blame]
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -06001/* Need to define dispatch table
2 * Core struct can then have ptr to dispatch table at the top
3 * Along with object ptrs for current and next OBJ
4 */
5#pragma once
6
David Pinedo9316d3b2015-11-06 12:54:48 -07007#include "vulkan/vulkan.h"
8#include "vulkan/vk_debug_report_lunarg.h"
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -06009#include "vk_debug_marker_lunarg.h"
David Pinedo9316d3b2015-11-06 12:54:48 -070010#include "vulkan/vk_ext_khr_swapchain.h"
11#include "vulkan/vk_ext_khr_device_swapchain.h"
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060012#if defined(__GNUC__) && __GNUC__ >= 4
13# define VK_LAYER_EXPORT __attribute__((visibility("default")))
14#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
15# define VK_LAYER_EXPORT __attribute__((visibility("default")))
16#else
17# define VK_LAYER_EXPORT
18#endif
19
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060020typedef void * (*PFN_vkGPA)(void* obj, const char * pName);
21
Jon Ashburnbacb0f52015-04-06 10:58:22 -060022typedef struct VkBaseLayerObject_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060023{
Jon Ashburnf6b33db2015-05-05 14:22:52 -060024 PFN_vkGPA pGPA;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060025 void* nextObject;
26 void* baseObject;
Jon Ashburnbacb0f52015-04-06 10:58:22 -060027} VkBaseLayerObject;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060028
Jon Ashburnbacb0f52015-04-06 10:58:22 -060029typedef struct VkLayerDispatchTable_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060030{
Jon Ashburn8d1b0b52015-05-18 13:20:15 -060031 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -060032 PFN_vkCreateDevice CreateDevice;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060033 PFN_vkDestroyDevice DestroyDevice;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060034 PFN_vkGetDeviceQueue GetDeviceQueue;
35 PFN_vkQueueSubmit QueueSubmit;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060036 PFN_vkQueueWaitIdle QueueWaitIdle;
37 PFN_vkDeviceWaitIdle DeviceWaitIdle;
Chia-I Wu3432a0c2015-10-27 18:04:07 +080038 PFN_vkAllocateMemory AllocateMemory;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060039 PFN_vkFreeMemory FreeMemory;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060040 PFN_vkMapMemory MapMemory;
41 PFN_vkUnmapMemory UnmapMemory;
Courtney Goeltzenleuchterf69f8a22015-04-29 17:16:21 -060042 PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
43 PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -060044 PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -060045 PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060046 PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
47 PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
48 PFN_vkBindImageMemory BindImageMemory;
49 PFN_vkBindBufferMemory BindBufferMemory;
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +080050 PFN_vkQueueBindSparse QueueBindSparse;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060051 PFN_vkCreateFence CreateFence;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060052 PFN_vkDestroyFence DestroyFence;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060053 PFN_vkGetFenceStatus GetFenceStatus;
54 PFN_vkResetFences ResetFences;
55 PFN_vkWaitForFences WaitForFences;
56 PFN_vkCreateSemaphore CreateSemaphore;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060057 PFN_vkDestroySemaphore DestroySemaphore;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060058 PFN_vkCreateEvent CreateEvent;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060059 PFN_vkDestroyEvent DestroyEvent;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060060 PFN_vkGetEventStatus GetEventStatus;
61 PFN_vkSetEvent SetEvent;
62 PFN_vkResetEvent ResetEvent;
63 PFN_vkCreateQueryPool CreateQueryPool;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060064 PFN_vkDestroyQueryPool DestroyQueryPool;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060065 PFN_vkGetQueryPoolResults GetQueryPoolResults;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060066 PFN_vkCreateBuffer CreateBuffer;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060067 PFN_vkDestroyBuffer DestroyBuffer;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060068 PFN_vkCreateBufferView CreateBufferView;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060069 PFN_vkDestroyBufferView DestroyBufferView;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060070 PFN_vkCreateImage CreateImage;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060071 PFN_vkDestroyImage DestroyImage;
Tony Barbour59a47322015-06-24 16:06:58 -060072 PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060073 PFN_vkCreateImageView CreateImageView;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060074 PFN_vkDestroyImageView DestroyImageView;
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -060075 PFN_vkCreateShaderModule CreateShaderModule;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060076 PFN_vkDestroyShaderModule DestroyShaderModule;
Jon Ashburnc669cc62015-07-09 15:02:25 -060077 PFN_vkCreatePipelineCache CreatePipelineCache;
78 PFN_vkDestroyPipelineCache DestroyPipelineCache;
Jon Ashburnc669cc62015-07-09 15:02:25 -060079 PFN_vkGetPipelineCacheData GetPipelineCacheData;
80 PFN_vkMergePipelineCaches MergePipelineCaches;
81 PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
82 PFN_vkCreateComputePipelines CreateComputePipelines;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060083 PFN_vkDestroyPipeline DestroyPipeline;
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -050084 PFN_vkCreatePipelineLayout CreatePipelineLayout;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060085 PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060086 PFN_vkCreateSampler CreateSampler;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060087 PFN_vkDestroySampler DestroySampler;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060088 PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060089 PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060090 PFN_vkCreateDescriptorPool CreateDescriptorPool;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060091 PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060092 PFN_vkResetDescriptorPool ResetDescriptorPool;
Chia-I Wu3432a0c2015-10-27 18:04:07 +080093 PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
Tony Barbour34ec6922015-07-10 10:50:45 -060094 PFN_vkFreeDescriptorSets FreeDescriptorSets;
Chia-I Wu9d00ed72015-05-25 16:27:55 +080095 PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
Jon Ashburn42540ef2015-07-23 18:48:20 -060096 PFN_vkCreateFramebuffer CreateFramebuffer;
97 PFN_vkDestroyFramebuffer DestroyFramebuffer;
98 PFN_vkCreateRenderPass CreateRenderPass;
99 PFN_vkDestroyRenderPass DestroyRenderPass;
100 PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
Cody Northrope62183e2015-07-09 18:08:05 -0600101 PFN_vkCreateCommandPool CreateCommandPool;
102 PFN_vkDestroyCommandPool DestroyCommandPool;
103 PFN_vkResetCommandPool ResetCommandPool;
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800104 PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600105 PFN_vkFreeCommandBuffers FreeCommandBuffers;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600106 PFN_vkBeginCommandBuffer BeginCommandBuffer;
107 PFN_vkEndCommandBuffer EndCommandBuffer;
108 PFN_vkResetCommandBuffer ResetCommandBuffer;
109 PFN_vkCmdBindPipeline CmdBindPipeline;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600110 PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -0600111 PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600112 PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -0600113 PFN_vkCmdSetViewport CmdSetViewport;
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -0600114 PFN_vkCmdSetScissor CmdSetScissor;
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -0600115 PFN_vkCmdSetLineWidth CmdSetLineWidth;
116 PFN_vkCmdSetDepthBias CmdSetDepthBias;
117 PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
118 PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
119 PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
120 PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
121 PFN_vkCmdSetStencilReference CmdSetStencilReference;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600122 PFN_vkCmdDraw CmdDraw;
123 PFN_vkCmdDrawIndexed CmdDrawIndexed;
124 PFN_vkCmdDrawIndirect CmdDrawIndirect;
125 PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
126 PFN_vkCmdDispatch CmdDispatch;
127 PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
128 PFN_vkCmdCopyBuffer CmdCopyBuffer;
129 PFN_vkCmdCopyImage CmdCopyImage;
130 PFN_vkCmdBlitImage CmdBlitImage;
131 PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
132 PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600133 PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
134 PFN_vkCmdFillBuffer CmdFillBuffer;
135 PFN_vkCmdClearColorImage CmdClearColorImage;
Chris Forbesd9be82b2015-06-22 17:21:59 +1200136 PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
Courtney Goeltzenleuchterc9323e02015-10-15 16:51:05 -0600137 PFN_vkCmdClearAttachments CmdClearAttachments;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600138 PFN_vkCmdResolveImage CmdResolveImage;
139 PFN_vkCmdSetEvent CmdSetEvent;
140 PFN_vkCmdResetEvent CmdResetEvent;
141 PFN_vkCmdWaitEvents CmdWaitEvents;
142 PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
143 PFN_vkCmdBeginQuery CmdBeginQuery;
144 PFN_vkCmdEndQuery CmdEndQuery;
145 PFN_vkCmdResetQueryPool CmdResetQueryPool;
146 PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
Courtney Goeltzenleuchter1dbc8e22015-04-15 18:21:13 -0600147 PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
Jon Ashburn42540ef2015-07-23 18:48:20 -0600148 PFN_vkCmdPushConstants CmdPushConstants;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600149 PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
Chia-I Wu08accc62015-07-07 11:50:03 +0800150 PFN_vkCmdNextSubpass CmdNextSubpass;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600151 PFN_vkCmdEndRenderPass CmdEndRenderPass;
Chia-I Wu0b50a1c2015-06-26 15:34:39 +0800152 PFN_vkCmdExecuteCommands CmdExecuteCommands;
Ian Elliott7e40db92015-08-21 15:09:33 -0600153 PFN_vkGetSurfacePropertiesKHR GetSurfacePropertiesKHR;
154 PFN_vkGetSurfaceFormatsKHR GetSurfaceFormatsKHR;
155 PFN_vkGetSurfacePresentModesKHR GetSurfacePresentModesKHR;
156 PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
157 PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
158 PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
159 PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
160 PFN_vkQueuePresentKHR QueuePresentKHR;
Jon Ashburnbacb0f52015-04-06 10:58:22 -0600161} VkLayerDispatchTable;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600162
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600163typedef struct VkLayerInstanceDispatchTable_
164{
165 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jon Ashburn71836d92015-05-12 17:23:55 -0600166 PFN_vkCreateInstance CreateInstance;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600167 PFN_vkDestroyInstance DestroyInstance;
168 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
Chris Forbesbc0bb772015-06-21 22:55:02 +1200169 PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
Jon Ashburn42540ef2015-07-23 18:48:20 -0600170 PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
Courtney Goeltzenleuchter2caec862015-07-12 12:52:09 -0600171 PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600172 PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
Tony Barbour59a47322015-06-24 16:06:58 -0600173 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
Cody Northropd0802882015-08-03 17:04:53 -0600174 PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
Tony Barbour59a47322015-06-24 16:06:58 -0600175 PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
Courtney Goeltzenleuchter35985f62015-09-14 17:22:16 -0600176 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
177 PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
Ian Elliott7e40db92015-08-21 15:09:33 -0600178 PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600179 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
180 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600181} VkLayerInstanceDispatchTable;
182
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600183// LL node for tree of dbg callback functions
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600184typedef struct VkLayerDbgFunctionNode_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600185{
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600186 VkDbgMsgCallback msgCallback;
187 PFN_vkDbgMsgCallback pfnMsgCallback;
188 VkFlags msgFlags;
189 const void *pUserData;
190 struct VkLayerDbgFunctionNode_ *pNext;
191} VkLayerDbgFunctionNode;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600192
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600193typedef enum VkLayerDbgAction_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600194{
195 VK_DBG_LAYER_ACTION_IGNORE = 0x0,
196 VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
197 VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
Courtney Goeltzenleuchter5907ac42015-10-05 14:41:34 -0600198 VK_DBG_LAYER_ACTION_BREAK = 0x4,
199 VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x8,
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600200} VkLayerDbgAction;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600201
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600202// ------------------------------------------------------------------------------------------------
203// API functions