blob: ea1371523bbba2b48594ebd831d197a5ba258126 [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"
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
Jon Ashburnfc1031e2015-11-17 15:31:02 -070020typedef void * (VKAPI_PTR *PFN_vkGPA)(void* obj, const char * pName);
Jon Ashburnbacb0f52015-04-06 10:58:22 -060021typedef struct VkBaseLayerObject_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060022{
Jon Ashburnf6b33db2015-05-05 14:22:52 -060023 PFN_vkGPA pGPA;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060024 void* nextObject;
25 void* baseObject;
Jon Ashburnbacb0f52015-04-06 10:58:22 -060026} VkBaseLayerObject;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060027
Jon Ashburnbacb0f52015-04-06 10:58:22 -060028typedef struct VkLayerDispatchTable_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -060029{
Jon Ashburn8d1b0b52015-05-18 13:20:15 -060030 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
Courtney Goeltzenleuchterca173b82015-06-25 18:01:43 -060031 PFN_vkCreateDevice CreateDevice;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060032 PFN_vkDestroyDevice DestroyDevice;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060033 PFN_vkGetDeviceQueue GetDeviceQueue;
34 PFN_vkQueueSubmit QueueSubmit;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060035 PFN_vkQueueWaitIdle QueueWaitIdle;
36 PFN_vkDeviceWaitIdle DeviceWaitIdle;
Chia-I Wu3432a0c2015-10-27 18:04:07 +080037 PFN_vkAllocateMemory AllocateMemory;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060038 PFN_vkFreeMemory FreeMemory;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060039 PFN_vkMapMemory MapMemory;
40 PFN_vkUnmapMemory UnmapMemory;
Courtney Goeltzenleuchterf69f8a22015-04-29 17:16:21 -060041 PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
42 PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
Courtney Goeltzenleuchterfb71f222015-07-09 21:57:28 -060043 PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -060044 PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060045 PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
46 PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
47 PFN_vkBindImageMemory BindImageMemory;
48 PFN_vkBindBufferMemory BindBufferMemory;
Chia-I Wu1ff4c3d2015-10-26 16:55:27 +080049 PFN_vkQueueBindSparse QueueBindSparse;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060050 PFN_vkCreateFence CreateFence;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060051 PFN_vkDestroyFence DestroyFence;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060052 PFN_vkGetFenceStatus GetFenceStatus;
53 PFN_vkResetFences ResetFences;
54 PFN_vkWaitForFences WaitForFences;
55 PFN_vkCreateSemaphore CreateSemaphore;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060056 PFN_vkDestroySemaphore DestroySemaphore;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060057 PFN_vkCreateEvent CreateEvent;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060058 PFN_vkDestroyEvent DestroyEvent;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060059 PFN_vkGetEventStatus GetEventStatus;
60 PFN_vkSetEvent SetEvent;
61 PFN_vkResetEvent ResetEvent;
62 PFN_vkCreateQueryPool CreateQueryPool;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060063 PFN_vkDestroyQueryPool DestroyQueryPool;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060064 PFN_vkGetQueryPoolResults GetQueryPoolResults;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060065 PFN_vkCreateBuffer CreateBuffer;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060066 PFN_vkDestroyBuffer DestroyBuffer;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060067 PFN_vkCreateBufferView CreateBufferView;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060068 PFN_vkDestroyBufferView DestroyBufferView;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060069 PFN_vkCreateImage CreateImage;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060070 PFN_vkDestroyImage DestroyImage;
Tony Barbour59a47322015-06-24 16:06:58 -060071 PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060072 PFN_vkCreateImageView CreateImageView;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060073 PFN_vkDestroyImageView DestroyImageView;
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -060074 PFN_vkCreateShaderModule CreateShaderModule;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060075 PFN_vkDestroyShaderModule DestroyShaderModule;
Jon Ashburnc669cc62015-07-09 15:02:25 -060076 PFN_vkCreatePipelineCache CreatePipelineCache;
77 PFN_vkDestroyPipelineCache DestroyPipelineCache;
Jon Ashburnc669cc62015-07-09 15:02:25 -060078 PFN_vkGetPipelineCacheData GetPipelineCacheData;
79 PFN_vkMergePipelineCaches MergePipelineCaches;
80 PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
81 PFN_vkCreateComputePipelines CreateComputePipelines;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060082 PFN_vkDestroyPipeline DestroyPipeline;
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -050083 PFN_vkCreatePipelineLayout CreatePipelineLayout;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060084 PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060085 PFN_vkCreateSampler CreateSampler;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060086 PFN_vkDestroySampler DestroySampler;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060087 PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060088 PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060089 PFN_vkCreateDescriptorPool CreateDescriptorPool;
Tony Barbour1d2cd3f2015-07-03 10:33:54 -060090 PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060091 PFN_vkResetDescriptorPool ResetDescriptorPool;
Chia-I Wu3432a0c2015-10-27 18:04:07 +080092 PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
Tony Barbour34ec6922015-07-10 10:50:45 -060093 PFN_vkFreeDescriptorSets FreeDescriptorSets;
Chia-I Wu9d00ed72015-05-25 16:27:55 +080094 PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
Jon Ashburn42540ef2015-07-23 18:48:20 -060095 PFN_vkCreateFramebuffer CreateFramebuffer;
96 PFN_vkDestroyFramebuffer DestroyFramebuffer;
97 PFN_vkCreateRenderPass CreateRenderPass;
98 PFN_vkDestroyRenderPass DestroyRenderPass;
99 PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
Cody Northrope62183e2015-07-09 18:08:05 -0600100 PFN_vkCreateCommandPool CreateCommandPool;
101 PFN_vkDestroyCommandPool DestroyCommandPool;
102 PFN_vkResetCommandPool ResetCommandPool;
Chia-I Wu3432a0c2015-10-27 18:04:07 +0800103 PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
Courtney Goeltzenleuchterbee18a92015-10-23 14:21:05 -0600104 PFN_vkFreeCommandBuffers FreeCommandBuffers;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600105 PFN_vkBeginCommandBuffer BeginCommandBuffer;
106 PFN_vkEndCommandBuffer EndCommandBuffer;
107 PFN_vkResetCommandBuffer ResetCommandBuffer;
108 PFN_vkCmdBindPipeline CmdBindPipeline;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600109 PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -0600110 PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600111 PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -0600112 PFN_vkCmdSetViewport CmdSetViewport;
Courtney Goeltzenleuchter078f8172015-09-21 11:44:06 -0600113 PFN_vkCmdSetScissor CmdSetScissor;
Courtney Goeltzenleuchter49c73082015-09-17 15:06:17 -0600114 PFN_vkCmdSetLineWidth CmdSetLineWidth;
115 PFN_vkCmdSetDepthBias CmdSetDepthBias;
116 PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
117 PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
118 PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
119 PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
120 PFN_vkCmdSetStencilReference CmdSetStencilReference;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600121 PFN_vkCmdDraw CmdDraw;
122 PFN_vkCmdDrawIndexed CmdDrawIndexed;
123 PFN_vkCmdDrawIndirect CmdDrawIndirect;
124 PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
125 PFN_vkCmdDispatch CmdDispatch;
126 PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
127 PFN_vkCmdCopyBuffer CmdCopyBuffer;
128 PFN_vkCmdCopyImage CmdCopyImage;
129 PFN_vkCmdBlitImage CmdBlitImage;
130 PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
131 PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600132 PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
133 PFN_vkCmdFillBuffer CmdFillBuffer;
134 PFN_vkCmdClearColorImage CmdClearColorImage;
Chris Forbesd9be82b2015-06-22 17:21:59 +1200135 PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
Courtney Goeltzenleuchterc9323e02015-10-15 16:51:05 -0600136 PFN_vkCmdClearAttachments CmdClearAttachments;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600137 PFN_vkCmdResolveImage CmdResolveImage;
138 PFN_vkCmdSetEvent CmdSetEvent;
139 PFN_vkCmdResetEvent CmdResetEvent;
140 PFN_vkCmdWaitEvents CmdWaitEvents;
141 PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
142 PFN_vkCmdBeginQuery CmdBeginQuery;
143 PFN_vkCmdEndQuery CmdEndQuery;
144 PFN_vkCmdResetQueryPool CmdResetQueryPool;
145 PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
Courtney Goeltzenleuchter1dbc8e22015-04-15 18:21:13 -0600146 PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
Jon Ashburn42540ef2015-07-23 18:48:20 -0600147 PFN_vkCmdPushConstants CmdPushConstants;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600148 PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
Chia-I Wu08accc62015-07-07 11:50:03 +0800149 PFN_vkCmdNextSubpass CmdNextSubpass;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600150 PFN_vkCmdEndRenderPass CmdEndRenderPass;
Chia-I Wu0b50a1c2015-06-26 15:34:39 +0800151 PFN_vkCmdExecuteCommands CmdExecuteCommands;
Ian Elliott7e40db92015-08-21 15:09:33 -0600152 PFN_vkGetSurfacePropertiesKHR GetSurfacePropertiesKHR;
153 PFN_vkGetSurfaceFormatsKHR GetSurfaceFormatsKHR;
154 PFN_vkGetSurfacePresentModesKHR GetSurfacePresentModesKHR;
155 PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
156 PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
157 PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
158 PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
159 PFN_vkQueuePresentKHR QueuePresentKHR;
Jon Ashburnbacb0f52015-04-06 10:58:22 -0600160} VkLayerDispatchTable;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600161
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600162typedef struct VkLayerInstanceDispatchTable_
163{
164 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jon Ashburn71836d92015-05-12 17:23:55 -0600165 PFN_vkCreateInstance CreateInstance;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600166 PFN_vkDestroyInstance DestroyInstance;
167 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
Chris Forbesbc0bb772015-06-21 22:55:02 +1200168 PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
Jon Ashburn42540ef2015-07-23 18:48:20 -0600169 PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
Courtney Goeltzenleuchter2caec862015-07-12 12:52:09 -0600170 PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
Mark Lobodzinski16e8bef2015-07-03 15:58:09 -0600171 PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
Tony Barbour59a47322015-06-24 16:06:58 -0600172 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
Cody Northropd0802882015-08-03 17:04:53 -0600173 PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
Tony Barbour59a47322015-06-24 16:06:58 -0600174 PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
Courtney Goeltzenleuchter35985f62015-09-14 17:22:16 -0600175 PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
176 PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
Ian Elliott7e40db92015-08-21 15:09:33 -0600177 PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600178 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
179 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600180} VkLayerInstanceDispatchTable;
181
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600182// LL node for tree of dbg callback functions
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600183typedef struct VkLayerDbgFunctionNode_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600184{
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600185 VkDbgMsgCallback msgCallback;
186 PFN_vkDbgMsgCallback pfnMsgCallback;
187 VkFlags msgFlags;
188 const void *pUserData;
189 struct VkLayerDbgFunctionNode_ *pNext;
190} VkLayerDbgFunctionNode;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600191
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600192typedef enum VkLayerDbgAction_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600193{
194 VK_DBG_LAYER_ACTION_IGNORE = 0x0,
195 VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
196 VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
Courtney Goeltzenleuchter5907ac42015-10-05 14:41:34 -0600197 VK_DBG_LAYER_ACTION_BREAK = 0x4,
198 VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x8,
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600199} VkLayerDbgAction;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600200
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600201// ------------------------------------------------------------------------------------------------
202// API functions