blob: d6a7fbb21a1f3377881b682895466acac47e04d6 [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;
52 xglOpenSharedQueueSemaphoreType OpenSharedQueueSemaphore;
53 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;
63 xglCreateQueueSemaphoreType CreateQueueSemaphore;
64 xglSignalQueueSemaphoreType SignalQueueSemaphore;
65 xglWaitQueueSemaphoreType WaitQueueSemaphore;
66 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;
Mark Lobodzinski46658d92015-01-28 13:29:48 -060076 xglSetFastClearColorType SetFastClearColor;
77 xglSetFastClearDepthType SetFastClearDepth;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060078 xglGetImageSubresourceInfoType GetImageSubresourceInfo;
79 xglCreateImageViewType CreateImageView;
80 xglCreateColorAttachmentViewType CreateColorAttachmentView;
81 xglCreateDepthStencilViewType CreateDepthStencilView;
82 xglCreateShaderType CreateShader;
83 xglCreateGraphicsPipelineType CreateGraphicsPipeline;
84 xglCreateComputePipelineType CreateComputePipeline;
85 xglStorePipelineType StorePipeline;
86 xglLoadPipelineType LoadPipeline;
87 xglCreatePipelineDeltaType CreatePipelineDelta;
88 xglCreateSamplerType CreateSampler;
Chia-I Wuf8385062015-01-04 16:27:24 +080089 xglCreateDescriptorSetLayoutType CreateDescriptorSetLayout;
90 xglBeginDescriptorRegionUpdateType BeginDescriptorRegionUpdate;
91 xglEndDescriptorRegionUpdateType EndDescriptorRegionUpdate;
92 xglCreateDescriptorRegionType CreateDescriptorRegion;
93 xglClearDescriptorRegionType ClearDescriptorRegion;
94 xglAllocDescriptorSetsType AllocDescriptorSets;
95 xglClearDescriptorSetsType ClearDescriptorSets;
96 xglUpdateDescriptorsType UpdateDescriptors;
Tony Barbourfa6cac72015-01-16 14:27:35 -070097 xglCreateDynamicViewportStateType CreateDynamicViewportState;
98 xglCreateDynamicRasterStateType CreateDynamicRasterState;
99 xglCreateDynamicColorBlendStateType CreateDynamicColorBlendState;
100 xglCreateDynamicDepthStencilStateType CreateDynamicDepthStencilState;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600101 xglCreateCommandBufferType CreateCommandBuffer;
102 xglBeginCommandBufferType BeginCommandBuffer;
103 xglEndCommandBufferType EndCommandBuffer;
104 xglResetCommandBufferType ResetCommandBuffer;
105 xglCmdBindPipelineType CmdBindPipeline;
106 xglCmdBindPipelineDeltaType CmdBindPipelineDelta;
Tony Barbourfa6cac72015-01-16 14:27:35 -0700107 xglCmdBindDynamicStateObjectType CmdBindDynamicStateObject;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600108 xglCmdBindDescriptorSetType CmdBindDescriptorSet;
Chia-I Wu714df452015-01-01 07:55:04 +0800109 xglCmdBindVertexBufferType CmdBindVertexBuffer;
110 xglCmdBindIndexBufferType CmdBindIndexBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600111 xglCmdDrawType CmdDraw;
112 xglCmdDrawIndexedType CmdDrawIndexed;
113 xglCmdDrawIndirectType CmdDrawIndirect;
114 xglCmdDrawIndexedIndirectType CmdDrawIndexedIndirect;
115 xglCmdDispatchType CmdDispatch;
116 xglCmdDispatchIndirectType CmdDispatchIndirect;
Chia-I Wu714df452015-01-01 07:55:04 +0800117 xglCmdCopyBufferType CmdCopyBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600118 xglCmdCopyImageType CmdCopyImage;
Chia-I Wu714df452015-01-01 07:55:04 +0800119 xglCmdCopyBufferToImageType CmdCopyBufferToImage;
120 xglCmdCopyImageToBufferType CmdCopyImageToBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600121 xglCmdCloneImageDataType CmdCloneImageData;
Chia-I Wu714df452015-01-01 07:55:04 +0800122 xglCmdUpdateBufferType CmdUpdateBuffer;
123 xglCmdFillBufferType CmdFillBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600124 xglCmdClearColorImageType CmdClearColorImage;
125 xglCmdClearColorImageRawType CmdClearColorImageRaw;
126 xglCmdClearDepthStencilType CmdClearDepthStencil;
127 xglCmdResolveImageType CmdResolveImage;
128 xglCmdSetEventType CmdSetEvent;
129 xglCmdResetEventType CmdResetEvent;
Mike Stroyan55658c22014-12-04 11:08:39 +0000130 xglCmdWaitEventsType CmdWaitEvents;
131 xglCmdPipelineBarrierType CmdPipelineBarrier;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600132 xglCmdBeginQueryType CmdBeginQuery;
133 xglCmdEndQueryType CmdEndQuery;
134 xglCmdResetQueryPoolType CmdResetQueryPool;
135 xglCmdWriteTimestampType CmdWriteTimestamp;
136 xglCmdInitAtomicCountersType CmdInitAtomicCounters;
137 xglCmdLoadAtomicCountersType CmdLoadAtomicCounters;
138 xglCmdSaveAtomicCountersType CmdSaveAtomicCounters;
Jeremy Hayese0c3b222015-01-14 16:17:08 -0700139 xglCreateFramebufferType CreateFramebuffer;
140 xglCreateRenderPassType CreateRenderPass;
Jon Ashburnb1dbb372015-02-02 09:58:11 -0700141 xglCmdBeginRenderPassType CmdBeginRenderPass;
142 xglCmdEndRenderPassType CmdEndRenderPass;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600143 xglDbgSetValidationLevelType DbgSetValidationLevel;
144 xglDbgRegisterMsgCallbackType DbgRegisterMsgCallback;
145 xglDbgUnregisterMsgCallbackType DbgUnregisterMsgCallback;
146 xglDbgSetMessageFilterType DbgSetMessageFilter;
147 xglDbgSetObjectTagType DbgSetObjectTag;
148 xglDbgSetGlobalOptionType DbgSetGlobalOption;
149 xglDbgSetDeviceOptionType DbgSetDeviceOption;
150 xglCmdDbgMarkerBeginType CmdDbgMarkerBegin;
151 xglCmdDbgMarkerEndType CmdDbgMarkerEnd;
Ian Elliotte977a6c2015-02-26 14:34:52 -0700152#if defined(__linux__) || defined(XCB_NVIDIA)
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600153 xglWsiX11AssociateConnectionType WsiX11AssociateConnection;
154 xglWsiX11GetMSCType WsiX11GetMSC;
155 xglWsiX11CreatePresentableImageType WsiX11CreatePresentableImage;
156 xglWsiX11QueuePresentType WsiX11QueuePresent;
Ian Elliott81ac44c2015-01-13 17:52:38 -0700157#endif // WIN32
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600158} XGL_LAYER_DISPATCH_TABLE;
159
Tobin Ehlisacab8882014-11-14 13:01:02 -0700160// LL node for tree of dbg callback functions
161typedef struct _XGL_LAYER_DBG_FUNCTION_NODE
162{
163 XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
Mark Lobodzinskie2d07a52015-01-29 08:55:56 -0600164 void *pUserData;
Tobin Ehlisacab8882014-11-14 13:01:02 -0700165 struct _XGL_LAYER_DBG_FUNCTION_NODE *pNext;
166} XGL_LAYER_DBG_FUNCTION_NODE;
167
Jon Ashburn47e92892014-12-22 12:04:40 -0700168typedef enum _XGL_LAYER_DBG_ACTION
169{
170 XGL_DBG_LAYER_ACTION_IGNORE = 0x0,
171 XGL_DBG_LAYER_ACTION_CALLBACK = 0x1,
172 XGL_DBG_LAYER_ACTION_LOG_MSG = 0x2,
173 XGL_DBG_LAYER_ACTION_BREAK = 0x4
174} XGL_LAYER_DBG_ACTION;
175
176typedef enum _XGL_LAYER_DBG_REPORT_LEVEL
177{
178
179 XGL_DBG_LAYER_LEVEL_INFO = 0,
180 XGL_DBG_LAYER_LEVEL_WARN,
181 XGL_DBG_LAYER_LEVEL_PERF_WARN,
182 XGL_DBG_LAYER_LEVEL_ERROR,
183 XGL_DBG_LAYER_LEVEL_NONE,
184} XGL_LAYER_DBG_REPORT_LEVEL;
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600185// ------------------------------------------------------------------------------------------------
186// API functions