blob: 1e1c252e98a3363b612cde29d8deeeeaa3a04023 [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"
David Pinedoabd07722015-11-24 09:00:24 -07008#include "vulkan/vk_lunarg_debug_report.h"
9#include "vulkan/vk_lunarg_debug_marker.h"
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060010#if defined(__GNUC__) && __GNUC__ >= 4
11# define VK_LAYER_EXPORT __attribute__((visibility("default")))
12#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
13# define VK_LAYER_EXPORT __attribute__((visibility("default")))
14#else
15# define VK_LAYER_EXPORT
16#endif
17
Jon Ashburnfc1031e2015-11-17 15:31:02 -070018typedef void * (VKAPI_PTR *PFN_vkGPA)(void* obj, const char * pName);
Jon Ashburnbacb0f52015-04-06 10:58:22 -060019typedef struct VkBaseLayerObject_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060020{
Jon Ashburnf6b33db2015-05-05 14:22:52 -060021 PFN_vkGPA pGPA;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060022 void* nextObject;
23 void* baseObject;
Jon Ashburnbacb0f52015-04-06 10:58:22 -060024} VkBaseLayerObject;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060025
Jon Ashburnbacb0f52015-04-06 10:58:22 -060026typedef struct VkLayerDispatchTable_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060027{
Jon Ashburn8d1b0b52015-05-18 13:20:15 -060028 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -060029 PFN_vkCreateDevice CreateDevice;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060030 PFN_vkDestroyDevice DestroyDevice;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060031 PFN_vkGetDeviceQueue GetDeviceQueue;
32 PFN_vkQueueSubmit QueueSubmit;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060033 PFN_vkQueueWaitIdle QueueWaitIdle;
34 PFN_vkDeviceWaitIdle DeviceWaitIdle;
Chia-I Wu3432a0c2015-10-27 18:04:07 +080035 PFN_vkAllocateMemory AllocateMemory;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060036 PFN_vkFreeMemory FreeMemory;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060037 PFN_vkMapMemory MapMemory;
38 PFN_vkUnmapMemory UnmapMemory;
Courtney Goeltzenleuchterf69f8a22015-04-29 17:16:21 -060039 PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
40 PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -060041 PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -060042 PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060043 PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
44 PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
45 PFN_vkBindImageMemory BindImageMemory;
46 PFN_vkBindBufferMemory BindBufferMemory;
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +080047 PFN_vkQueueBindSparse QueueBindSparse;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060048 PFN_vkCreateFence CreateFence;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060049 PFN_vkDestroyFence DestroyFence;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060050 PFN_vkGetFenceStatus GetFenceStatus;
51 PFN_vkResetFences ResetFences;
52 PFN_vkWaitForFences WaitForFences;
53 PFN_vkCreateSemaphore CreateSemaphore;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060054 PFN_vkDestroySemaphore DestroySemaphore;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060055 PFN_vkCreateEvent CreateEvent;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060056 PFN_vkDestroyEvent DestroyEvent;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060057 PFN_vkGetEventStatus GetEventStatus;
58 PFN_vkSetEvent SetEvent;
59 PFN_vkResetEvent ResetEvent;
60 PFN_vkCreateQueryPool CreateQueryPool;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060061 PFN_vkDestroyQueryPool DestroyQueryPool;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060062 PFN_vkGetQueryPoolResults GetQueryPoolResults;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060063 PFN_vkCreateBuffer CreateBuffer;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060064 PFN_vkDestroyBuffer DestroyBuffer;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060065 PFN_vkCreateBufferView CreateBufferView;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060066 PFN_vkDestroyBufferView DestroyBufferView;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060067 PFN_vkCreateImage CreateImage;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060068 PFN_vkDestroyImage DestroyImage;
Tony Barbour59a47322015-06-24 16:06:58 -060069 PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060070 PFN_vkCreateImageView CreateImageView;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060071 PFN_vkDestroyImageView DestroyImageView;
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -060072 PFN_vkCreateShaderModule CreateShaderModule;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060073 PFN_vkDestroyShaderModule DestroyShaderModule;
Jon Ashburnc669cc62015-07-09 15:02:25 -060074 PFN_vkCreatePipelineCache CreatePipelineCache;
75 PFN_vkDestroyPipelineCache DestroyPipelineCache;
Jon Ashburnc669cc62015-07-09 15:02:25 -060076 PFN_vkGetPipelineCacheData GetPipelineCacheData;
77 PFN_vkMergePipelineCaches MergePipelineCaches;
78 PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
79 PFN_vkCreateComputePipelines CreateComputePipelines;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060080 PFN_vkDestroyPipeline DestroyPipeline;
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -050081 PFN_vkCreatePipelineLayout CreatePipelineLayout;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060082 PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060083 PFN_vkCreateSampler CreateSampler;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060084 PFN_vkDestroySampler DestroySampler;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060085 PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060086 PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060087 PFN_vkCreateDescriptorPool CreateDescriptorPool;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060088 PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060089 PFN_vkResetDescriptorPool ResetDescriptorPool;
Chia-I Wu3432a0c2015-10-27 18:04:07 +080090 PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
Tony Barbour34ec6922015-07-10 10:50:45 -060091 PFN_vkFreeDescriptorSets FreeDescriptorSets;
Chia-I Wu9d00ed72015-05-25 16:27:55 +080092 PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
Jon Ashburn42540ef2015-07-23 18:48:20 -060093 PFN_vkCreateFramebuffer CreateFramebuffer;
94 PFN_vkDestroyFramebuffer DestroyFramebuffer;
95 PFN_vkCreateRenderPass CreateRenderPass;
96 PFN_vkDestroyRenderPass DestroyRenderPass;
97 PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
Cody Northrope62183e2015-07-09 18:08:05 -060098 PFN_vkCreateCommandPool CreateCommandPool;
99 PFN_vkDestroyCommandPool DestroyCommandPool;
100 PFN_vkResetCommandPool ResetCommandPool;
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800101 PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600102 PFN_vkFreeCommandBuffers FreeCommandBuffers;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600103 PFN_vkBeginCommandBuffer BeginCommandBuffer;
104 PFN_vkEndCommandBuffer EndCommandBuffer;
105 PFN_vkResetCommandBuffer ResetCommandBuffer;
106 PFN_vkCmdBindPipeline CmdBindPipeline;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600107 PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -0600108 PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600109 PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -0600110 PFN_vkCmdSetViewport CmdSetViewport;
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -0600111 PFN_vkCmdSetScissor CmdSetScissor;
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -0600112 PFN_vkCmdSetLineWidth CmdSetLineWidth;
113 PFN_vkCmdSetDepthBias CmdSetDepthBias;
114 PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
115 PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
116 PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
117 PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
118 PFN_vkCmdSetStencilReference CmdSetStencilReference;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600119 PFN_vkCmdDraw CmdDraw;
120 PFN_vkCmdDrawIndexed CmdDrawIndexed;
121 PFN_vkCmdDrawIndirect CmdDrawIndirect;
122 PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
123 PFN_vkCmdDispatch CmdDispatch;
124 PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
125 PFN_vkCmdCopyBuffer CmdCopyBuffer;
126 PFN_vkCmdCopyImage CmdCopyImage;
127 PFN_vkCmdBlitImage CmdBlitImage;
128 PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
129 PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600130 PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
131 PFN_vkCmdFillBuffer CmdFillBuffer;
132 PFN_vkCmdClearColorImage CmdClearColorImage;
Chris Forbesd9be82b2015-06-22 17:21:59 +1200133 PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
Courtney Goeltzenleuchterc9323e02015-10-15 16:51:05 -0600134 PFN_vkCmdClearAttachments CmdClearAttachments;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600135 PFN_vkCmdResolveImage CmdResolveImage;
136 PFN_vkCmdSetEvent CmdSetEvent;
137 PFN_vkCmdResetEvent CmdResetEvent;
138 PFN_vkCmdWaitEvents CmdWaitEvents;
139 PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
140 PFN_vkCmdBeginQuery CmdBeginQuery;
141 PFN_vkCmdEndQuery CmdEndQuery;
142 PFN_vkCmdResetQueryPool CmdResetQueryPool;
143 PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
Courtney Goeltzenleuchter1dbc8e22015-04-15 18:21:13 -0600144 PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
Jon Ashburn42540ef2015-07-23 18:48:20 -0600145 PFN_vkCmdPushConstants CmdPushConstants;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600146 PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
Chia-I Wu08accc62015-07-07 11:50:03 +0800147 PFN_vkCmdNextSubpass CmdNextSubpass;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600148 PFN_vkCmdEndRenderPass CmdEndRenderPass;
Chia-I Wu0b50a1c2015-06-26 15:34:39 +0800149 PFN_vkCmdExecuteCommands CmdExecuteCommands;
Ian Elliott7e40db92015-08-21 15:09:33 -0600150 PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
151 PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
152 PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
153 PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
154 PFN_vkQueuePresentKHR QueuePresentKHR;
Jon Ashburnbacb0f52015-04-06 10:58:22 -0600155} VkLayerDispatchTable;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600156
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600157typedef struct VkLayerInstanceDispatchTable_
158{
159 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jon Ashburn71836d92015-05-12 17:23:55 -0600160 PFN_vkCreateInstance CreateInstance;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600161 PFN_vkDestroyInstance DestroyInstance;
162 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
Chris Forbesbc0bb772015-06-21 22:55:02 +1200163 PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
Jon Ashburn42540ef2015-07-23 18:48:20 -0600164 PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
Courtney Goeltzenleuchter2caec862015-07-12 12:52:09 -0600165 PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600166 PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
Tony Barbour59a47322015-06-24 16:06:58 -0600167 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
Cody Northropd0802882015-08-03 17:04:53 -0600168 PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
Tony Barbour59a47322015-06-24 16:06:58 -0600169 PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
Courtney Goeltzenleuchter35985f62015-09-14 17:22:16 -0600170 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
171 PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
Jon Ashburn2a1ec502015-11-23 18:55:15 -0700172 PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
Ian Elliott7e40db92015-08-21 15:09:33 -0600173 PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
Ian Elliott33ed8482015-11-18 15:20:45 -0700174 PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
175 PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
176 PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
Ian Elliottdb4300a2015-11-23 10:17:23 -0700177#ifdef VK_USE_PLATFORM_MIR_KHR
178 PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
Ian Elliott919fa302015-11-24 15:39:10 -0700179 PFN_vkGetPhysicalDeviceMirPresentationSupportKHR GetPhysicalDeviceMirPresentationSupportKHR;
Ian Elliottdb4300a2015-11-23 10:17:23 -0700180#endif
181#ifdef VK_USE_PLATFORM_WAYLAND_KHR
182 PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
Ian Elliott919fa302015-11-24 15:39:10 -0700183 PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR GetPhysicalDeviceWaylandPresentationSupportKHR;
Ian Elliottdb4300a2015-11-23 10:17:23 -0700184#endif
185#ifdef VK_USE_PLATFORM_WIN32_KHR
186 PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
Ian Elliott919fa302015-11-24 15:39:10 -0700187 PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR GetPhysicalDeviceWin32PresentationSupportKHR;
Ian Elliottdb4300a2015-11-23 10:17:23 -0700188#endif
189#ifdef VK_USE_PLATFORM_XCB_KHR
190 PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
Ian Elliott919fa302015-11-24 15:39:10 -0700191 PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR;
Ian Elliottdb4300a2015-11-23 10:17:23 -0700192#endif
193#ifdef VK_USE_PLATFORM_XLIB_KHR
194 PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
Ian Elliott919fa302015-11-24 15:39:10 -0700195 PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR;
Ian Elliottdb4300a2015-11-23 10:17:23 -0700196#endif
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600197 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
198 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600199} VkLayerInstanceDispatchTable;
200
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600201// LL node for tree of dbg callback functions
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600202typedef struct VkLayerDbgFunctionNode_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600203{
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600204 VkDbgMsgCallback msgCallback;
205 PFN_vkDbgMsgCallback pfnMsgCallback;
206 VkFlags msgFlags;
207 const void *pUserData;
208 struct VkLayerDbgFunctionNode_ *pNext;
209} VkLayerDbgFunctionNode;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600210
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600211typedef enum VkLayerDbgAction_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600212{
213 VK_DBG_LAYER_ACTION_IGNORE = 0x0,
214 VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
215 VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
Courtney Goeltzenleuchter5907ac42015-10-05 14:41:34 -0600216 VK_DBG_LAYER_ACTION_BREAK = 0x4,
217 VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x8,
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600218} VkLayerDbgAction;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600219
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600220// ------------------------------------------------------------------------------------------------
221// API functions