blob: 883cca13d694367cf009ef4bbc5be5485b9cfcd1 [file] [log] [blame]
Courtney Goeltzenleuchter89e99e62015-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 Goeltzenleuchter1c7c65d2015-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 Wu5b66aa52015-04-16 22:02:10 +080011#include "vk_wsi_lunarg.h"
Courtney Goeltzenleuchter89e99e62015-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 Ashburn79b78ac2015-05-05 14:22:52 -060021typedef void * (*PFN_vkGPA)(VkObject obj, const char * pName);
Jon Ashburn301c5f02015-04-06 10:58:22 -060022typedef struct VkBaseLayerObject_
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -060023{
Jon Ashburn79b78ac2015-05-05 14:22:52 -060024 PFN_vkGPA pGPA;
Mike Stroyan230e6252015-04-17 12:36:38 -060025 VkObject nextObject;
26 VkObject baseObject;
Jon Ashburn301c5f02015-04-06 10:58:22 -060027} VkBaseLayerObject;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -060028
Jon Ashburn301c5f02015-04-06 10:58:22 -060029typedef struct VkLayerDispatchTable_
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -060030{
Jon Ashburn1245cec2015-05-18 13:20:15 -060031 PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060032 PFN_vkDestroyDevice DestroyDevice;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060033 PFN_vkGetDeviceQueue GetDeviceQueue;
34 PFN_vkQueueSubmit QueueSubmit;
Courtney Goeltzenleuchter382489d2015-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 Goeltzenleuchtera569a502015-04-29 17:16:21 -060042 PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
43 PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060044 PFN_vkPinSystemMemory PinSystemMemory;
Courtney Goeltzenleuchter382489d2015-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 Lobodzinskifb9f5642015-05-11 17:21:15 -050051 PFN_vkBindObjectMemory BindObjectMemory;
52 PFN_vkQueueBindSparseBufferMemory QueueBindSparseBufferMemory;
53 PFN_vkQueueBindSparseImageMemory QueueBindSparseImageMemory;
Courtney Goeltzenleuchter382489d2015-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 Lobodzinski556f7212015-04-17 14:11:39 -050082 PFN_vkCreatePipelineLayout CreatePipelineLayout;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060083 PFN_vkCreateSampler CreateSampler;
84 PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060085 PFN_vkCreateDescriptorPool CreateDescriptorPool;
86 PFN_vkResetDescriptorPool ResetDescriptorPool;
87 PFN_vkAllocDescriptorSets AllocDescriptorSets;
88 PFN_vkClearDescriptorSets ClearDescriptorSets;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +080089 PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
Courtney Goeltzenleuchter382489d2015-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 Goeltzenleuchter46962942015-04-16 13:38:46 -0600101 PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
Courtney Goeltzenleuchter382489d2015-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 Goeltzenleuchter382489d2015-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 Goeltzenleuchter98049062015-04-15 18:21:13 -0600127 PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
Courtney Goeltzenleuchter382489d2015-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;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600135 PFN_vkDbgSetObjectTag DbgSetObjectTag;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600136 PFN_vkCmdDbgMarkerBegin CmdDbgMarkerBegin;
137 PFN_vkCmdDbgMarkerEnd CmdDbgMarkerEnd;
Chia-I Wu5b66aa52015-04-16 22:02:10 +0800138 PFN_vkCreateSwapChainWSI CreateSwapChainWSI;
139 PFN_vkDestroySwapChainWSI DestroySwapChainWSI;
140 PFN_vkGetSwapChainInfoWSI GetSwapChainInfoWSI;
141 PFN_vkQueuePresentWSI QueuePresentWSI;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600142 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
143 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
144 PFN_vkDbgStringCallback DbgStringCallback;
145 PFN_vkDbgStdioCallback DbgStdioCallback;
146 PFN_vkDbgBreakCallback DbgBreakCallback;
147 PFN_vkDbgSetObjectName DbgSetObjectName;
Jon Ashburn301c5f02015-04-06 10:58:22 -0600148} VkLayerDispatchTable;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600149
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600150typedef struct VkLayerInstanceDispatchTable_
151{
152 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jon Ashburn52c1d732015-05-12 17:23:55 -0600153 PFN_vkCreateInstance CreateInstance;
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600154 PFN_vkDestroyInstance DestroyInstance;
155 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
156 PFN_vkGetPhysicalDeviceInfo GetPhysicalDeviceInfo;
157 PFN_vkCreateDevice CreateDevice;
Jon Ashburn52c1d732015-05-12 17:23:55 -0600158 PFN_vkGetGlobalExtensionInfo GetGlobalExtensionInfo;
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600159 PFN_vkGetPhysicalDeviceExtensionInfo GetPhysicalDeviceExtensionInfo;
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600160 PFN_vkGetMultiDeviceCompatibility GetMultiDeviceCompatibility;
Jon Ashburn2666e2f2015-05-15 15:09:35 -0600161 PFN_vkGetDisplayInfoWSI GetDisplayInfoWSI;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600162 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
163 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
164 PFN_vkDbgStringCallback DbgStringCallback;
165 PFN_vkDbgStdioCallback DbgStdioCallback;
166 PFN_vkDbgBreakCallback DbgBreakCallback;
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600167} VkLayerInstanceDispatchTable;
168
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600169// LL node for tree of dbg callback functions
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600170typedef struct VkLayerDbgFunctionNode_
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600171{
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600172 VkDbgMsgCallback msgCallback;
173 PFN_vkDbgMsgCallback pfnMsgCallback;
174 VkFlags msgFlags;
175 const void *pUserData;
176 struct VkLayerDbgFunctionNode_ *pNext;
177} VkLayerDbgFunctionNode;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600178
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600179typedef enum VkLayerDbgAction_
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600180{
181 VK_DBG_LAYER_ACTION_IGNORE = 0x0,
182 VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
183 VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
184 VK_DBG_LAYER_ACTION_BREAK = 0x4
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600185} VkLayerDbgAction;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600186
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600187// ------------------------------------------------------------------------------------------------
188// API functions