blob: 98a636bc98a50d404062929c592d7862a49a14b7 [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
Jon Ashburnf6b33db2015-05-05 14:22:52 -060020typedef void * (*PFN_vkGPA)(VkObject 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;
Mike Stroyanb050c682015-04-17 12:36:38 -060024 VkObject nextObject;
25 VkObject 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;
37 PFN_vkAllocMemory AllocMemory;
38 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 Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060043 PFN_vkDestroyObject DestroyObject;
Tony Barbour59a47322015-06-24 16:06:58 -060044 PFN_vkGetObjectMemoryRequirements GetObjectMemoryRequirements;
Mark Lobodzinski942b1722015-05-11 17:21:15 -050045 PFN_vkBindObjectMemory BindObjectMemory;
46 PFN_vkQueueBindSparseBufferMemory QueueBindSparseBufferMemory;
47 PFN_vkQueueBindSparseImageMemory QueueBindSparseImageMemory;
Courtney Goeltzenleuchterfb4efc62015-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 Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060061 PFN_vkCreateBuffer CreateBuffer;
62 PFN_vkCreateBufferView CreateBufferView;
63 PFN_vkCreateImage CreateImage;
Tony Barbour59a47322015-06-24 16:06:58 -060064 PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060065 PFN_vkCreateImageView CreateImageView;
66 PFN_vkCreateColorAttachmentView CreateColorAttachmentView;
67 PFN_vkCreateDepthStencilView CreateDepthStencilView;
Courtney Goeltzenleuchter2d2cb682015-06-24 18:24:19 -060068 PFN_vkCreateShaderModule CreateShaderModule;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060069 PFN_vkCreateShader CreateShader;
70 PFN_vkCreateGraphicsPipeline CreateGraphicsPipeline;
71 PFN_vkCreateGraphicsPipelineDerivative CreateGraphicsPipelineDerivative;
72 PFN_vkCreateComputePipeline CreateComputePipeline;
73 PFN_vkStorePipeline StorePipeline;
74 PFN_vkLoadPipeline LoadPipeline;
75 PFN_vkLoadPipelineDerivative LoadPipelineDerivative;
Mark Lobodzinski0fadf5f2015-04-17 14:11:39 -050076 PFN_vkCreatePipelineLayout CreatePipelineLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060077 PFN_vkCreateSampler CreateSampler;
78 PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060079 PFN_vkCreateDescriptorPool CreateDescriptorPool;
80 PFN_vkResetDescriptorPool ResetDescriptorPool;
81 PFN_vkAllocDescriptorSets AllocDescriptorSets;
Chia-I Wu9d00ed72015-05-25 16:27:55 +080082 PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060083 PFN_vkCreateDynamicViewportState CreateDynamicViewportState;
84 PFN_vkCreateDynamicRasterState CreateDynamicRasterState;
85 PFN_vkCreateDynamicColorBlendState CreateDynamicColorBlendState;
86 PFN_vkCreateDynamicDepthStencilState CreateDynamicDepthStencilState;
87 PFN_vkCreateCommandBuffer CreateCommandBuffer;
88 PFN_vkBeginCommandBuffer BeginCommandBuffer;
89 PFN_vkEndCommandBuffer EndCommandBuffer;
90 PFN_vkResetCommandBuffer ResetCommandBuffer;
91 PFN_vkCmdBindPipeline CmdBindPipeline;
92 PFN_vkCmdBindDynamicStateObject CmdBindDynamicStateObject;
93 PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
Courtney Goeltzenleuchterf68ad722015-04-16 13:38:46 -060094 PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -060095 PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
96 PFN_vkCmdDraw CmdDraw;
97 PFN_vkCmdDrawIndexed CmdDrawIndexed;
98 PFN_vkCmdDrawIndirect CmdDrawIndirect;
99 PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
100 PFN_vkCmdDispatch CmdDispatch;
101 PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
102 PFN_vkCmdCopyBuffer CmdCopyBuffer;
103 PFN_vkCmdCopyImage CmdCopyImage;
104 PFN_vkCmdBlitImage CmdBlitImage;
105 PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
106 PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600107 PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
108 PFN_vkCmdFillBuffer CmdFillBuffer;
109 PFN_vkCmdClearColorImage CmdClearColorImage;
Chris Forbesd9be82b2015-06-22 17:21:59 +1200110 PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
111 PFN_vkCmdClearColorAttachment CmdClearColorAttachment;
112 PFN_vkCmdClearDepthStencilAttachment CmdClearDepthStencilAttachment;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600113 PFN_vkCmdResolveImage CmdResolveImage;
114 PFN_vkCmdSetEvent CmdSetEvent;
115 PFN_vkCmdResetEvent CmdResetEvent;
116 PFN_vkCmdWaitEvents CmdWaitEvents;
117 PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
118 PFN_vkCmdBeginQuery CmdBeginQuery;
119 PFN_vkCmdEndQuery CmdEndQuery;
120 PFN_vkCmdResetQueryPool CmdResetQueryPool;
121 PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
Courtney Goeltzenleuchter1dbc8e22015-04-15 18:21:13 -0600122 PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600123 PFN_vkCreateFramebuffer CreateFramebuffer;
124 PFN_vkCreateRenderPass CreateRenderPass;
125 PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
126 PFN_vkCmdEndRenderPass CmdEndRenderPass;
Chia-I Wu0b50a1c2015-06-26 15:34:39 +0800127 PFN_vkCmdExecuteCommands CmdExecuteCommands;
Chia-I Wuf8693382015-04-16 22:02:10 +0800128 PFN_vkCreateSwapChainWSI CreateSwapChainWSI;
129 PFN_vkDestroySwapChainWSI DestroySwapChainWSI;
130 PFN_vkGetSwapChainInfoWSI GetSwapChainInfoWSI;
131 PFN_vkQueuePresentWSI QueuePresentWSI;
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600132 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
133 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
134 PFN_vkDbgStringCallback DbgStringCallback;
135 PFN_vkDbgStdioCallback DbgStdioCallback;
136 PFN_vkDbgBreakCallback DbgBreakCallback;
Jon Ashburnbacb0f52015-04-06 10:58:22 -0600137} VkLayerDispatchTable;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600138
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600139typedef struct VkLayerInstanceDispatchTable_
140{
141 PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
Jon Ashburn71836d92015-05-12 17:23:55 -0600142 PFN_vkCreateInstance CreateInstance;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600143 PFN_vkDestroyInstance DestroyInstance;
144 PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
Chris Forbesbc0bb772015-06-21 22:55:02 +1200145 PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
146 PFN_vkGetPhysicalDeviceFormatInfo GetPhysicalDeviceFormatInfo;
147 PFN_vkGetPhysicalDeviceLimits GetPhysicalDeviceLimits;
Tony Barbour59a47322015-06-24 16:06:58 -0600148 PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
149 PFN_vkGetPhysicalDevicePerformance GetPhysicalDevicePerformance;
150 PFN_vkGetPhysicalDeviceQueueCount GetPhysicalDeviceQueueCount;
151 PFN_vkGetPhysicalDeviceQueueProperties GetPhysicalDeviceQueueProperties;
152 PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
Tony Barbour59a47322015-06-24 16:06:58 -0600153 PFN_vkGetPhysicalDeviceExtensionProperties GetPhysicalDeviceExtensionProperties;
Courtney Goeltzenleuchter110fdf92015-06-29 15:39:26 -0600154 PFN_vkGetPhysicalDeviceLayerProperties GetPhysicalDeviceLayerProperties;
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600155 PFN_vkDbgCreateMsgCallback DbgCreateMsgCallback;
156 PFN_vkDbgDestroyMsgCallback DbgDestroyMsgCallback;
157 PFN_vkDbgStringCallback DbgStringCallback;
158 PFN_vkDbgStdioCallback DbgStdioCallback;
159 PFN_vkDbgBreakCallback DbgBreakCallback;
Jon Ashburnfbb4e252015-05-04 16:27:53 -0600160} VkLayerInstanceDispatchTable;
161
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600162// LL node for tree of dbg callback functions
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600163typedef struct VkLayerDbgFunctionNode_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600164{
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600165 VkDbgMsgCallback msgCallback;
166 PFN_vkDbgMsgCallback pfnMsgCallback;
167 VkFlags msgFlags;
168 const void *pUserData;
169 struct VkLayerDbgFunctionNode_ *pNext;
170} VkLayerDbgFunctionNode;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600171
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600172typedef enum VkLayerDbgAction_
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600173{
174 VK_DBG_LAYER_ACTION_IGNORE = 0x0,
175 VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
176 VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
177 VK_DBG_LAYER_ACTION_BREAK = 0x4
Courtney Goeltzenleuchterf579fa62015-06-10 17:39:03 -0600178} VkLayerDbgAction;
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600179
Courtney Goeltzenleuchter64d1a712015-04-08 18:04:29 -0600180// ------------------------------------------------------------------------------------------------
181// API functions