blob: 5a25ca0ea3d321ddfda0aee02afe226ab9bc6407 [file] [log] [blame]
Jon Ashburnd43f9b62014-10-14 19:15:22 -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 "xgl.h"
8#include "xglDbg.h"
Ian Elliotte977a6c2015-02-26 14:34:52 -07009#if defined(__linux__) || defined(XCB_NVIDIA)
Jon Ashburnd43f9b62014-10-14 19:15:22 -060010#include "xglWsiX11Ext.h"
Piers Danielle2bca482015-02-24 13:58:47 -070011#endif
Jon Ashburnd43f9b62014-10-14 19:15:22 -060012#if defined(__GNUC__) && __GNUC__ >= 4
13# define XGL_LAYER_EXPORT __attribute__((visibility("default")))
14#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
15# define XGL_LAYER_EXPORT __attribute__((visibility("default")))
16#else
17# define XGL_LAYER_EXPORT
18#endif
19
Jon Ashburnd43f9b62014-10-14 19:15:22 -060020
21typedef struct _XGL_BASE_LAYER_OBJECT
22{
Mark Lobodzinski953a1692015-01-09 15:12:03 -060023 xglGetProcAddrType pGPA;
Jon Ashburnd43f9b62014-10-14 19:15:22 -060024 XGL_BASE_OBJECT nextObject;
25 XGL_BASE_OBJECT baseObject;
26} XGL_BASE_LAYER_OBJECT;
27
28typedef struct _XGL_LAYER_DISPATCH_TABLE
29{
Mark Lobodzinski953a1692015-01-09 15:12:03 -060030 xglGetProcAddrType GetProcAddr;
Jon Ashburn349508d2015-01-26 14:51:40 -070031 xglCreateInstanceType CreateInstance;
32 xglDestroyInstanceType DestroyInstance;
33 xglEnumerateGpusType EnumerateGpus;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060034 xglGetGpuInfoType GetGpuInfo;
35 xglCreateDeviceType CreateDevice;
36 xglDestroyDeviceType DestroyDevice;
37 xglGetExtensionSupportType GetExtensionSupport;
38 xglEnumerateLayersType EnumerateLayers;
39 xglGetDeviceQueueType GetDeviceQueue;
40 xglQueueSubmitType QueueSubmit;
41 xglQueueSetGlobalMemReferencesType QueueSetGlobalMemReferences;
42 xglQueueWaitIdleType QueueWaitIdle;
43 xglDeviceWaitIdleType DeviceWaitIdle;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060044 xglAllocMemoryType AllocMemory;
45 xglFreeMemoryType FreeMemory;
46 xglSetMemoryPriorityType SetMemoryPriority;
47 xglMapMemoryType MapMemory;
48 xglUnmapMemoryType UnmapMemory;
49 xglPinSystemMemoryType PinSystemMemory;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060050 xglGetMultiGpuCompatibilityType GetMultiGpuCompatibility;
51 xglOpenSharedMemoryType OpenSharedMemory;
Courtney Goeltzenleuchter0d2efef2015-03-25 17:14:29 -060052 xglOpenSharedSemaphoreType OpenSharedSemaphore;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060053 xglOpenPeerMemoryType OpenPeerMemory;
54 xglOpenPeerImageType OpenPeerImage;
55 xglDestroyObjectType DestroyObject;
56 xglGetObjectInfoType GetObjectInfo;
57 xglBindObjectMemoryType BindObjectMemory;
Chia-I Wu714df452015-01-01 07:55:04 +080058 xglBindObjectMemoryRangeType BindObjectMemoryRange;
59 xglBindImageMemoryRangeType BindImageMemoryRange;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060060 xglCreateFenceType CreateFence;
61 xglGetFenceStatusType GetFenceStatus;
62 xglWaitForFencesType WaitForFences;
Courtney Goeltzenleuchter0d2efef2015-03-25 17:14:29 -060063 xglCreateSemaphoreType CreateSemaphore;
64 xglQueueSignalSemaphoreType QueueSignalSemaphore;
65 xglQueueWaitSemaphoreType QueueWaitSemaphore;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060066 xglCreateEventType CreateEvent;
67 xglGetEventStatusType GetEventStatus;
68 xglSetEventType SetEvent;
69 xglResetEventType ResetEvent;
70 xglCreateQueryPoolType CreateQueryPool;
71 xglGetQueryPoolResultsType GetQueryPoolResults;
72 xglGetFormatInfoType GetFormatInfo;
Chia-I Wu714df452015-01-01 07:55:04 +080073 xglCreateBufferType CreateBuffer;
74 xglCreateBufferViewType CreateBufferView;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060075 xglCreateImageType CreateImage;
76 xglGetImageSubresourceInfoType GetImageSubresourceInfo;
77 xglCreateImageViewType CreateImageView;
78 xglCreateColorAttachmentViewType CreateColorAttachmentView;
79 xglCreateDepthStencilViewType CreateDepthStencilView;
80 xglCreateShaderType CreateShader;
81 xglCreateGraphicsPipelineType CreateGraphicsPipeline;
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -060082 xglCreateGraphicsPipelineDerivativeType CreateGraphicsPipelineDerivative;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060083 xglCreateComputePipelineType CreateComputePipeline;
84 xglStorePipelineType StorePipeline;
85 xglLoadPipelineType LoadPipeline;
Courtney Goeltzenleuchter32876a12015-03-25 15:37:49 -060086 xglLoadPipelineDerivativeType LoadPipelineDerivative;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060087 xglCreateSamplerType CreateSampler;
Chia-I Wuf8385062015-01-04 16:27:24 +080088 xglCreateDescriptorSetLayoutType CreateDescriptorSetLayout;
89 xglBeginDescriptorRegionUpdateType BeginDescriptorRegionUpdate;
90 xglEndDescriptorRegionUpdateType EndDescriptorRegionUpdate;
91 xglCreateDescriptorRegionType CreateDescriptorRegion;
92 xglClearDescriptorRegionType ClearDescriptorRegion;
93 xglAllocDescriptorSetsType AllocDescriptorSets;
94 xglClearDescriptorSetsType ClearDescriptorSets;
95 xglUpdateDescriptorsType UpdateDescriptors;
Tony Barbourfa6cac72015-01-16 14:27:35 -070096 xglCreateDynamicViewportStateType CreateDynamicViewportState;
97 xglCreateDynamicRasterStateType CreateDynamicRasterState;
98 xglCreateDynamicColorBlendStateType CreateDynamicColorBlendState;
99 xglCreateDynamicDepthStencilStateType CreateDynamicDepthStencilState;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600100 xglCreateCommandBufferType CreateCommandBuffer;
101 xglBeginCommandBufferType BeginCommandBuffer;
102 xglEndCommandBufferType EndCommandBuffer;
103 xglResetCommandBufferType ResetCommandBuffer;
104 xglCmdBindPipelineType CmdBindPipeline;
Tony Barbourfa6cac72015-01-16 14:27:35 -0700105 xglCmdBindDynamicStateObjectType CmdBindDynamicStateObject;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600106 xglCmdBindDescriptorSetType CmdBindDescriptorSet;
Chia-I Wu714df452015-01-01 07:55:04 +0800107 xglCmdBindVertexBufferType CmdBindVertexBuffer;
108 xglCmdBindIndexBufferType CmdBindIndexBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600109 xglCmdDrawType CmdDraw;
110 xglCmdDrawIndexedType CmdDrawIndexed;
111 xglCmdDrawIndirectType CmdDrawIndirect;
112 xglCmdDrawIndexedIndirectType CmdDrawIndexedIndirect;
113 xglCmdDispatchType CmdDispatch;
114 xglCmdDispatchIndirectType CmdDispatchIndirect;
Chia-I Wu714df452015-01-01 07:55:04 +0800115 xglCmdCopyBufferType CmdCopyBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600116 xglCmdCopyImageType CmdCopyImage;
Courtney Goeltzenleuchterb787a1e2015-03-08 17:02:18 -0600117 xglCmdBlitImageType CmdBlitImage;
Chia-I Wu714df452015-01-01 07:55:04 +0800118 xglCmdCopyBufferToImageType CmdCopyBufferToImage;
119 xglCmdCopyImageToBufferType CmdCopyImageToBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600120 xglCmdCloneImageDataType CmdCloneImageData;
Chia-I Wu714df452015-01-01 07:55:04 +0800121 xglCmdUpdateBufferType CmdUpdateBuffer;
122 xglCmdFillBufferType CmdFillBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600123 xglCmdClearColorImageType CmdClearColorImage;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600124 xglCmdClearDepthStencilType CmdClearDepthStencil;
125 xglCmdResolveImageType CmdResolveImage;
126 xglCmdSetEventType CmdSetEvent;
127 xglCmdResetEventType CmdResetEvent;
Mike Stroyan55658c22014-12-04 11:08:39 +0000128 xglCmdWaitEventsType CmdWaitEvents;
129 xglCmdPipelineBarrierType CmdPipelineBarrier;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600130 xglCmdBeginQueryType CmdBeginQuery;
131 xglCmdEndQueryType CmdEndQuery;
132 xglCmdResetQueryPoolType CmdResetQueryPool;
133 xglCmdWriteTimestampType CmdWriteTimestamp;
134 xglCmdInitAtomicCountersType CmdInitAtomicCounters;
135 xglCmdLoadAtomicCountersType CmdLoadAtomicCounters;
136 xglCmdSaveAtomicCountersType CmdSaveAtomicCounters;
Jeremy Hayese0c3b222015-01-14 16:17:08 -0700137 xglCreateFramebufferType CreateFramebuffer;
138 xglCreateRenderPassType CreateRenderPass;
Jon Ashburnb1dbb372015-02-02 09:58:11 -0700139 xglCmdBeginRenderPassType CmdBeginRenderPass;
140 xglCmdEndRenderPassType CmdEndRenderPass;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600141 xglDbgSetValidationLevelType DbgSetValidationLevel;
142 xglDbgRegisterMsgCallbackType DbgRegisterMsgCallback;
143 xglDbgUnregisterMsgCallbackType DbgUnregisterMsgCallback;
144 xglDbgSetMessageFilterType DbgSetMessageFilter;
145 xglDbgSetObjectTagType DbgSetObjectTag;
146 xglDbgSetGlobalOptionType DbgSetGlobalOption;
147 xglDbgSetDeviceOptionType DbgSetDeviceOption;
148 xglCmdDbgMarkerBeginType CmdDbgMarkerBegin;
149 xglCmdDbgMarkerEndType CmdDbgMarkerEnd;
Ian Elliotte977a6c2015-02-26 14:34:52 -0700150#if defined(__linux__) || defined(XCB_NVIDIA)
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600151 xglWsiX11AssociateConnectionType WsiX11AssociateConnection;
152 xglWsiX11GetMSCType WsiX11GetMSC;
153 xglWsiX11CreatePresentableImageType WsiX11CreatePresentableImage;
154 xglWsiX11QueuePresentType WsiX11QueuePresent;
Ian Elliott81ac44c2015-01-13 17:52:38 -0700155#endif // WIN32
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600156} XGL_LAYER_DISPATCH_TABLE;
157
Tobin Ehlisacab8882014-11-14 13:01:02 -0700158// LL node for tree of dbg callback functions
159typedef struct _XGL_LAYER_DBG_FUNCTION_NODE
160{
161 XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600162 void *pUserData;
Tobin Ehlisacab8882014-11-14 13:01:02 -0700163 struct _XGL_LAYER_DBG_FUNCTION_NODE *pNext;
164} XGL_LAYER_DBG_FUNCTION_NODE;
165
Jon Ashburn47e92892014-12-22 12:04:40 -0700166typedef enum _XGL_LAYER_DBG_ACTION
167{
168 XGL_DBG_LAYER_ACTION_IGNORE = 0x0,
169 XGL_DBG_LAYER_ACTION_CALLBACK = 0x1,
170 XGL_DBG_LAYER_ACTION_LOG_MSG = 0x2,
171 XGL_DBG_LAYER_ACTION_BREAK = 0x4
172} XGL_LAYER_DBG_ACTION;
173
174typedef enum _XGL_LAYER_DBG_REPORT_LEVEL
175{
176
177 XGL_DBG_LAYER_LEVEL_INFO = 0,
178 XGL_DBG_LAYER_LEVEL_WARN,
179 XGL_DBG_LAYER_LEVEL_PERF_WARN,
180 XGL_DBG_LAYER_LEVEL_ERROR,
181 XGL_DBG_LAYER_LEVEL_NONE,
182} XGL_LAYER_DBG_REPORT_LEVEL;
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600183// ------------------------------------------------------------------------------------------------
184// API functions