blob: 468d4355561e6717f467e4100d7171289c623409 [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
7#include "vulkan.h"
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -06008#include "vk_debug_report_lunarg.h"
9#include "vk_debug_marker_lunarg.h"
10#include "vk_wsi_lunarg.h"
Chia-I Wuf8693382015-04-16 22:02:10 +080011#include "vk_wsi_lunarg.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
20
Jon Ashburnf6b33db2015-05-05 14:22:52 -060021typedef void * (*PFN_vkGPA)(VkObject obj, const char * pName);
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;
Mike Stroyanb050c682015-04-17 12:36:38 -060025 VkObject nextObject;
26 VkObject 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 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;
37 PFN_vkAllocMemory AllocMemory;
38 PFN_vkFreeMemory FreeMemory;
39 PFN_vkSetMemoryPriority SetMemoryPriority;
40 PFN_vkMapMemory MapMemory;
41 PFN_vkUnmapMemory UnmapMemory;
Courtney Goeltzenleuchterf69f8a22015-04-29 17:16:21 -060042 PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
43 PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060044 PFN_vkPinSystemMemory PinSystemMemory;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060045 PFN_vkOpenSharedMemory OpenSharedMemory;
46 PFN_vkOpenSharedSemaphore OpenSharedSemaphore;
47 PFN_vkOpenPeerMemory OpenPeerMemory;
48 PFN_vkOpenPeerImage OpenPeerImage;
49 PFN_vkDestroyObject DestroyObject;
50 PFN_vkGetObjectInfo GetObjectInfo;
Mark Lobodzinski942b1722015-05-11 17:21:15 -050051 PFN_vkBindObjectMemory BindObjectMemory;
52 PFN_vkQueueBindSparseBufferMemory QueueBindSparseBufferMemory;
53 PFN_vkQueueBindSparseImageMemory QueueBindSparseImageMemory;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060054 PFN_vkCreateFence CreateFence;
55 PFN_vkGetFenceStatus GetFenceStatus;
56 PFN_vkResetFences ResetFences;
57 PFN_vkWaitForFences WaitForFences;
58 PFN_vkCreateSemaphore CreateSemaphore;
59 PFN_vkQueueSignalSemaphore QueueSignalSemaphore;
60 PFN_vkQueueWaitSemaphore QueueWaitSemaphore;
61 PFN_vkCreateEvent CreateEvent;
62 PFN_vkGetEventStatus GetEventStatus;
63 PFN_vkSetEvent SetEvent;
64 PFN_vkResetEvent ResetEvent;
65 PFN_vkCreateQueryPool CreateQueryPool;
66 PFN_vkGetQueryPoolResults GetQueryPoolResults;
67 PFN_vkGetFormatInfo GetFormatInfo;
68 PFN_vkCreateBuffer CreateBuffer;
69 PFN_vkCreateBufferView CreateBufferView;
70 PFN_vkCreateImage CreateImage;
71 PFN_vkGetImageSubresourceInfo GetImageSubresourceInfo;
72 PFN_vkCreateImageView CreateImageView;
73 PFN_vkCreateColorAttachmentView CreateColorAttachmentView;
74 PFN_vkCreateDepthStencilView CreateDepthStencilView;
75 PFN_vkCreateShader CreateShader;
76 PFN_vkCreateGraphicsPipeline CreateGraphicsPipeline;
77 PFN_vkCreateGraphicsPipelineDerivative CreateGraphicsPipelineDerivative;
78 PFN_vkCreateComputePipeline CreateComputePipeline;
79 PFN_vkStorePipeline StorePipeline;
80 PFN_vkLoadPipeline LoadPipeline;
81 PFN_vkLoadPipelineDerivative LoadPipelineDerivative;
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -050082 PFN_vkCreatePipelineLayout CreatePipelineLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060083 PFN_vkCreateSampler CreateSampler;
84 PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060085 PFN_vkCreateDescriptorPool CreateDescriptorPool;
86 PFN_vkResetDescriptorPool ResetDescriptorPool;
87 PFN_vkAllocDescriptorSets AllocDescriptorSets;
88 PFN_vkClearDescriptorSets ClearDescriptorSets;
Chia-I Wu9d00ed72015-05-25 16:27:55 +080089 PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060090 PFN_vkCreateDynamicViewportState CreateDynamicViewportState;
91 PFN_vkCreateDynamicRasterState CreateDynamicRasterState;
92 PFN_vkCreateDynamicColorBlendState CreateDynamicColorBlendState;
93 PFN_vkCreateDynamicDepthStencilState CreateDynamicDepthStencilState;
94 PFN_vkCreateCommandBuffer CreateCommandBuffer;
95 PFN_vkBeginCommandBuffer BeginCommandBuffer;
96 PFN_vkEndCommandBuffer EndCommandBuffer;
97 PFN_vkResetCommandBuffer ResetCommandBuffer;
98 PFN_vkCmdBindPipeline CmdBindPipeline;
99 PFN_vkCmdBindDynamicStateObject CmdBindDynamicStateObject;
100 PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -0600101 PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600102 PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
103 PFN_vkCmdDraw CmdDraw;
104 PFN_vkCmdDrawIndexed CmdDrawIndexed;
105 PFN_vkCmdDrawIndirect CmdDrawIndirect;
106 PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
107 PFN_vkCmdDispatch CmdDispatch;
108 PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
109 PFN_vkCmdCopyBuffer CmdCopyBuffer;
110 PFN_vkCmdCopyImage CmdCopyImage;
111 PFN_vkCmdBlitImage CmdBlitImage;
112 PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
113 PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600114 PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
115 PFN_vkCmdFillBuffer CmdFillBuffer;
116 PFN_vkCmdClearColorImage CmdClearColorImage;
117 PFN_vkCmdClearDepthStencil CmdClearDepthStencil;
118 PFN_vkCmdResolveImage CmdResolveImage;
119 PFN_vkCmdSetEvent CmdSetEvent;
120 PFN_vkCmdResetEvent CmdResetEvent;
121 PFN_vkCmdWaitEvents CmdWaitEvents;
122 PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
123 PFN_vkCmdBeginQuery CmdBeginQuery;
124 PFN_vkCmdEndQuery CmdEndQuery;
125 PFN_vkCmdResetQueryPool CmdResetQueryPool;
126 PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
Courtney Goeltzenleuchter1dbc8e22015-04-15 18:21:13 -0600127 PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600128 PFN_vkCmdInitAtomicCounters CmdInitAtomicCounters;
129 PFN_vkCmdLoadAtomicCounters CmdLoadAtomicCounters;
130 PFN_vkCmdSaveAtomicCounters CmdSaveAtomicCounters;
131 PFN_vkCreateFramebuffer CreateFramebuffer;
132 PFN_vkCreateRenderPass CreateRenderPass;
133 PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
134 PFN_vkCmdEndRenderPass CmdEndRenderPass;
Chia-I Wuf8693382015-04-16 22:02:10 +0800135 PFN_vkCreateSwapChainWSI CreateSwapChainWSI;
136 PFN_vkDestroySwapChainWSI DestroySwapChainWSI;
137 PFN_vkGetSwapChainInfoWSI GetSwapChainInfoWSI;
138 PFN_vkQueuePresentWSI QueuePresentWSI;
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600139 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
140 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
141 PFN_vkDbgStringCallback DbgStringCallback;
142 PFN_vkDbgStdioCallback DbgStdioCallback;
143 PFN_vkDbgBreakCallback DbgBreakCallback;
Jon Ashburnbacb0f52015-04-06 10:58:22 -0600144} VkLayerDispatchTable;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600145
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600146typedef struct VkLayerInstanceDispatchTable_
147{
148 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jon Ashburn71836d92015-05-12 17:23:55 -0600149 PFN_vkCreateInstance CreateInstance;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600150 PFN_vkDestroyInstance DestroyInstance;
151 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
152 PFN_vkGetPhysicalDeviceInfo GetPhysicalDeviceInfo;
153 PFN_vkCreateDevice CreateDevice;
Jon Ashburn71836d92015-05-12 17:23:55 -0600154 PFN_vkGetGlobalExtensionInfo GetGlobalExtensionInfo;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600155 PFN_vkGetPhysicalDeviceExtensionInfo GetPhysicalDeviceExtensionInfo;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600156 PFN_vkGetMultiDeviceCompatibility GetMultiDeviceCompatibility;
Jon Ashburn95a77ba2015-05-15 15:09:35 -0600157 PFN_vkGetDisplayInfoWSI GetDisplayInfoWSI;
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600158 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
159 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
160 PFN_vkDbgStringCallback DbgStringCallback;
161 PFN_vkDbgStdioCallback DbgStdioCallback;
162 PFN_vkDbgBreakCallback DbgBreakCallback;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600163} VkLayerInstanceDispatchTable;
164
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600165// LL node for tree of dbg callback functions
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600166typedef struct VkLayerDbgFunctionNode_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600167{
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600168 VkDbgMsgCallback msgCallback;
169 PFN_vkDbgMsgCallback pfnMsgCallback;
170 VkFlags msgFlags;
171 const void *pUserData;
172 struct VkLayerDbgFunctionNode_ *pNext;
173} VkLayerDbgFunctionNode;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600174
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600175typedef enum VkLayerDbgAction_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600176{
177 VK_DBG_LAYER_ACTION_IGNORE = 0x0,
178 VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
179 VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
180 VK_DBG_LAYER_ACTION_BREAK = 0x4
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600181} VkLayerDbgAction;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600182
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600183// ------------------------------------------------------------------------------------------------
184// API functions