blob: 43e44783e2c41c68d9f2be454f0c546b1c016111 [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;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060039 PFN_vkMapMemory MapMemory;
40 PFN_vkUnmapMemory UnmapMemory;
Courtney Goeltzenleuchtera569a502015-04-29 17:16:21 -060041 PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
42 PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060043 PFN_vkDestroyObject DestroyObject;
44 PFN_vkGetObjectInfo GetObjectInfo;
Mark Lobodzinskifb9f5642015-05-11 17:21:15 -050045 PFN_vkBindObjectMemory BindObjectMemory;
46 PFN_vkQueueBindSparseBufferMemory QueueBindSparseBufferMemory;
47 PFN_vkQueueBindSparseImageMemory QueueBindSparseImageMemory;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060048 PFN_vkCreateFence CreateFence;
49 PFN_vkGetFenceStatus GetFenceStatus;
50 PFN_vkResetFences ResetFences;
51 PFN_vkWaitForFences WaitForFences;
52 PFN_vkCreateSemaphore CreateSemaphore;
53 PFN_vkQueueSignalSemaphore QueueSignalSemaphore;
54 PFN_vkQueueWaitSemaphore QueueWaitSemaphore;
55 PFN_vkCreateEvent CreateEvent;
56 PFN_vkGetEventStatus GetEventStatus;
57 PFN_vkSetEvent SetEvent;
58 PFN_vkResetEvent ResetEvent;
59 PFN_vkCreateQueryPool CreateQueryPool;
60 PFN_vkGetQueryPoolResults GetQueryPoolResults;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060061 PFN_vkCreateBuffer CreateBuffer;
62 PFN_vkCreateBufferView CreateBufferView;
63 PFN_vkCreateImage CreateImage;
64 PFN_vkGetImageSubresourceInfo GetImageSubresourceInfo;
65 PFN_vkCreateImageView CreateImageView;
66 PFN_vkCreateColorAttachmentView CreateColorAttachmentView;
67 PFN_vkCreateDepthStencilView CreateDepthStencilView;
68 PFN_vkCreateShader CreateShader;
69 PFN_vkCreateGraphicsPipeline CreateGraphicsPipeline;
70 PFN_vkCreateGraphicsPipelineDerivative CreateGraphicsPipelineDerivative;
71 PFN_vkCreateComputePipeline CreateComputePipeline;
72 PFN_vkStorePipeline StorePipeline;
73 PFN_vkLoadPipeline LoadPipeline;
74 PFN_vkLoadPipelineDerivative LoadPipelineDerivative;
Mark Lobodzinski556f7212015-04-17 14:11:39 -050075 PFN_vkCreatePipelineLayout CreatePipelineLayout;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060076 PFN_vkCreateSampler CreateSampler;
77 PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060078 PFN_vkCreateDescriptorPool CreateDescriptorPool;
79 PFN_vkResetDescriptorPool ResetDescriptorPool;
80 PFN_vkAllocDescriptorSets AllocDescriptorSets;
Chia-I Wu8cd8ecd2015-05-25 16:27:55 +080081 PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060082 PFN_vkCreateDynamicViewportState CreateDynamicViewportState;
83 PFN_vkCreateDynamicRasterState CreateDynamicRasterState;
84 PFN_vkCreateDynamicColorBlendState CreateDynamicColorBlendState;
85 PFN_vkCreateDynamicDepthStencilState CreateDynamicDepthStencilState;
86 PFN_vkCreateCommandBuffer CreateCommandBuffer;
87 PFN_vkBeginCommandBuffer BeginCommandBuffer;
88 PFN_vkEndCommandBuffer EndCommandBuffer;
89 PFN_vkResetCommandBuffer ResetCommandBuffer;
90 PFN_vkCmdBindPipeline CmdBindPipeline;
91 PFN_vkCmdBindDynamicStateObject CmdBindDynamicStateObject;
92 PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
Courtney Goeltzenleuchter46962942015-04-16 13:38:46 -060093 PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -060094 PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
95 PFN_vkCmdDraw CmdDraw;
96 PFN_vkCmdDrawIndexed CmdDrawIndexed;
97 PFN_vkCmdDrawIndirect CmdDrawIndirect;
98 PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
99 PFN_vkCmdDispatch CmdDispatch;
100 PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
101 PFN_vkCmdCopyBuffer CmdCopyBuffer;
102 PFN_vkCmdCopyImage CmdCopyImage;
103 PFN_vkCmdBlitImage CmdBlitImage;
104 PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
105 PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600106 PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
107 PFN_vkCmdFillBuffer CmdFillBuffer;
108 PFN_vkCmdClearColorImage CmdClearColorImage;
109 PFN_vkCmdClearDepthStencil CmdClearDepthStencil;
110 PFN_vkCmdResolveImage CmdResolveImage;
111 PFN_vkCmdSetEvent CmdSetEvent;
112 PFN_vkCmdResetEvent CmdResetEvent;
113 PFN_vkCmdWaitEvents CmdWaitEvents;
114 PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
115 PFN_vkCmdBeginQuery CmdBeginQuery;
116 PFN_vkCmdEndQuery CmdEndQuery;
117 PFN_vkCmdResetQueryPool CmdResetQueryPool;
118 PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
Courtney Goeltzenleuchter98049062015-04-15 18:21:13 -0600119 PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
Courtney Goeltzenleuchter382489d2015-04-10 08:34:15 -0600120 PFN_vkCmdInitAtomicCounters CmdInitAtomicCounters;
121 PFN_vkCmdLoadAtomicCounters CmdLoadAtomicCounters;
122 PFN_vkCmdSaveAtomicCounters CmdSaveAtomicCounters;
123 PFN_vkCreateFramebuffer CreateFramebuffer;
124 PFN_vkCreateRenderPass CreateRenderPass;
125 PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
126 PFN_vkCmdEndRenderPass CmdEndRenderPass;
Chia-I Wu5b66aa52015-04-16 22:02:10 +0800127 PFN_vkCreateSwapChainWSI CreateSwapChainWSI;
128 PFN_vkDestroySwapChainWSI DestroySwapChainWSI;
129 PFN_vkGetSwapChainInfoWSI GetSwapChainInfoWSI;
130 PFN_vkQueuePresentWSI QueuePresentWSI;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600131 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
132 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
133 PFN_vkDbgStringCallback DbgStringCallback;
134 PFN_vkDbgStdioCallback DbgStdioCallback;
135 PFN_vkDbgBreakCallback DbgBreakCallback;
Jon Ashburn301c5f02015-04-06 10:58:22 -0600136} VkLayerDispatchTable;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600137
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600138typedef struct VkLayerInstanceDispatchTable_
139{
140 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jon Ashburn52c1d732015-05-12 17:23:55 -0600141 PFN_vkCreateInstance CreateInstance;
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600142 PFN_vkDestroyInstance DestroyInstance;
143 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
144 PFN_vkGetPhysicalDeviceInfo GetPhysicalDeviceInfo;
Chris Forbesd7576302015-06-21 22:55:02 +1200145 PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
146 PFN_vkGetPhysicalDeviceFormatInfo GetPhysicalDeviceFormatInfo;
147 PFN_vkGetPhysicalDeviceLimits GetPhysicalDeviceLimits;
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600148 PFN_vkCreateDevice CreateDevice;
Jon Ashburncc4dfcf2015-06-08 14:38:28 -0600149 /* PFN_vkGetGlobalExtensionInfo GetGlobalExtensionInfo; non-dispatchable */
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600150 PFN_vkGetPhysicalDeviceExtensionInfo GetPhysicalDeviceExtensionInfo;
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600151 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
152 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
153 PFN_vkDbgStringCallback DbgStringCallback;
154 PFN_vkDbgStdioCallback DbgStdioCallback;
155 PFN_vkDbgBreakCallback DbgBreakCallback;
Jon Ashburn9a9bb642015-05-04 16:27:53 -0600156} VkLayerInstanceDispatchTable;
157
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600158// LL node for tree of dbg callback functions
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600159typedef struct VkLayerDbgFunctionNode_
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600160{
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600161 VkDbgMsgCallback msgCallback;
162 PFN_vkDbgMsgCallback pfnMsgCallback;
163 VkFlags msgFlags;
164 const void *pUserData;
165 struct VkLayerDbgFunctionNode_ *pNext;
166} VkLayerDbgFunctionNode;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600167
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600168typedef enum VkLayerDbgAction_
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600169{
170 VK_DBG_LAYER_ACTION_IGNORE = 0x0,
171 VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
172 VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
173 VK_DBG_LAYER_ACTION_BREAK = 0x4
Courtney Goeltzenleuchter1c7c65d2015-06-10 17:39:03 -0600174} VkLayerDbgAction;
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600175
Courtney Goeltzenleuchter89e99e62015-04-08 18:04:29 -0600176// ------------------------------------------------------------------------------------------------
177// API functions