blob: fc192571e459fc6e988e62dea782e2a1bd71b4f1 [file] [log] [blame]
Jon Ashburnd38bfb12014-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 Elliott2d4ab1e2015-01-13 17:52:38 -07009#if defined(_WIN32)
10#else // WIN32
11// FIXME: NEED WINDOWS EQUIVALENT
Jon Ashburnd38bfb12014-10-14 19:15:22 -060012#include "xglWsiX11Ext.h"
Ian Elliott2d4ab1e2015-01-13 17:52:38 -070013#endif // WIN32
Jon Ashburnd38bfb12014-10-14 19:15:22 -060014#if defined(__GNUC__) && __GNUC__ >= 4
15# define XGL_LAYER_EXPORT __attribute__((visibility("default")))
16#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
17# define XGL_LAYER_EXPORT __attribute__((visibility("default")))
18#else
19# define XGL_LAYER_EXPORT
20#endif
21
Jon Ashburnd38bfb12014-10-14 19:15:22 -060022
23typedef struct _XGL_BASE_LAYER_OBJECT
24{
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060025 xglGetProcAddrType pGPA;
Jon Ashburnd38bfb12014-10-14 19:15:22 -060026 XGL_BASE_OBJECT nextObject;
27 XGL_BASE_OBJECT baseObject;
28} XGL_BASE_LAYER_OBJECT;
29
30typedef struct _XGL_LAYER_DISPATCH_TABLE
31{
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060032 xglGetProcAddrType GetProcAddr;
Jon Ashburn1beab2d2015-01-26 14:51:40 -070033 xglCreateInstanceType CreateInstance;
34 xglDestroyInstanceType DestroyInstance;
35 xglEnumerateGpusType EnumerateGpus;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060036 xglGetGpuInfoType GetGpuInfo;
37 xglCreateDeviceType CreateDevice;
38 xglDestroyDeviceType DestroyDevice;
39 xglGetExtensionSupportType GetExtensionSupport;
40 xglEnumerateLayersType EnumerateLayers;
41 xglGetDeviceQueueType GetDeviceQueue;
42 xglQueueSubmitType QueueSubmit;
43 xglQueueSetGlobalMemReferencesType QueueSetGlobalMemReferences;
44 xglQueueWaitIdleType QueueWaitIdle;
45 xglDeviceWaitIdleType DeviceWaitIdle;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060046 xglAllocMemoryType AllocMemory;
47 xglFreeMemoryType FreeMemory;
48 xglSetMemoryPriorityType SetMemoryPriority;
49 xglMapMemoryType MapMemory;
50 xglUnmapMemoryType UnmapMemory;
51 xglPinSystemMemoryType PinSystemMemory;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060052 xglGetMultiGpuCompatibilityType GetMultiGpuCompatibility;
53 xglOpenSharedMemoryType OpenSharedMemory;
54 xglOpenSharedQueueSemaphoreType OpenSharedQueueSemaphore;
55 xglOpenPeerMemoryType OpenPeerMemory;
56 xglOpenPeerImageType OpenPeerImage;
57 xglDestroyObjectType DestroyObject;
58 xglGetObjectInfoType GetObjectInfo;
59 xglBindObjectMemoryType BindObjectMemory;
Chia-I Wu1a28fe02015-01-01 07:55:04 +080060 xglBindObjectMemoryRangeType BindObjectMemoryRange;
61 xglBindImageMemoryRangeType BindImageMemoryRange;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060062 xglCreateFenceType CreateFence;
63 xglGetFenceStatusType GetFenceStatus;
64 xglWaitForFencesType WaitForFences;
65 xglCreateQueueSemaphoreType CreateQueueSemaphore;
66 xglSignalQueueSemaphoreType SignalQueueSemaphore;
67 xglWaitQueueSemaphoreType WaitQueueSemaphore;
68 xglCreateEventType CreateEvent;
69 xglGetEventStatusType GetEventStatus;
70 xglSetEventType SetEvent;
71 xglResetEventType ResetEvent;
72 xglCreateQueryPoolType CreateQueryPool;
73 xglGetQueryPoolResultsType GetQueryPoolResults;
74 xglGetFormatInfoType GetFormatInfo;
Chia-I Wu1a28fe02015-01-01 07:55:04 +080075 xglCreateBufferType CreateBuffer;
76 xglCreateBufferViewType CreateBufferView;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060077 xglCreateImageType CreateImage;
Mark Lobodzinski58c20182015-01-28 13:29:48 -060078 xglSetFastClearColorType SetFastClearColor;
79 xglSetFastClearDepthType SetFastClearDepth;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -060080 xglGetImageSubresourceInfoType GetImageSubresourceInfo;
81 xglCreateImageViewType CreateImageView;
82 xglCreateColorAttachmentViewType CreateColorAttachmentView;
83 xglCreateDepthStencilViewType CreateDepthStencilView;
84 xglCreateShaderType CreateShader;
85 xglCreateGraphicsPipelineType CreateGraphicsPipeline;
86 xglCreateComputePipelineType CreateComputePipeline;
87 xglStorePipelineType StorePipeline;
88 xglLoadPipelineType LoadPipeline;
89 xglCreatePipelineDeltaType CreatePipelineDelta;
90 xglCreateSamplerType CreateSampler;
Chia-I Wu11078b02015-01-04 16:27:24 +080091 xglCreateDescriptorSetLayoutType CreateDescriptorSetLayout;
92 xglBeginDescriptorRegionUpdateType BeginDescriptorRegionUpdate;
93 xglEndDescriptorRegionUpdateType EndDescriptorRegionUpdate;
94 xglCreateDescriptorRegionType CreateDescriptorRegion;
95 xglClearDescriptorRegionType ClearDescriptorRegion;
96 xglAllocDescriptorSetsType AllocDescriptorSets;
97 xglClearDescriptorSetsType ClearDescriptorSets;
98 xglUpdateDescriptorsType UpdateDescriptors;
Tony Barbourf52346d2015-01-16 14:27:35 -070099 xglCreateDynamicViewportStateType CreateDynamicViewportState;
100 xglCreateDynamicRasterStateType CreateDynamicRasterState;
101 xglCreateDynamicColorBlendStateType CreateDynamicColorBlendState;
102 xglCreateDynamicDepthStencilStateType CreateDynamicDepthStencilState;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600103 xglCreateCommandBufferType CreateCommandBuffer;
104 xglBeginCommandBufferType BeginCommandBuffer;
105 xglEndCommandBufferType EndCommandBuffer;
106 xglResetCommandBufferType ResetCommandBuffer;
107 xglCmdBindPipelineType CmdBindPipeline;
108 xglCmdBindPipelineDeltaType CmdBindPipelineDelta;
Tony Barbourf52346d2015-01-16 14:27:35 -0700109 xglCmdBindDynamicStateObjectType CmdBindDynamicStateObject;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600110 xglCmdBindDescriptorSetType CmdBindDescriptorSet;
Chia-I Wu1a28fe02015-01-01 07:55:04 +0800111 xglCmdBindVertexBufferType CmdBindVertexBuffer;
112 xglCmdBindIndexBufferType CmdBindIndexBuffer;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600113 xglCmdDrawType CmdDraw;
114 xglCmdDrawIndexedType CmdDrawIndexed;
115 xglCmdDrawIndirectType CmdDrawIndirect;
116 xglCmdDrawIndexedIndirectType CmdDrawIndexedIndirect;
117 xglCmdDispatchType CmdDispatch;
118 xglCmdDispatchIndirectType CmdDispatchIndirect;
Chia-I Wu1a28fe02015-01-01 07:55:04 +0800119 xglCmdCopyBufferType CmdCopyBuffer;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600120 xglCmdCopyImageType CmdCopyImage;
Chia-I Wu1a28fe02015-01-01 07:55:04 +0800121 xglCmdCopyBufferToImageType CmdCopyBufferToImage;
122 xglCmdCopyImageToBufferType CmdCopyImageToBuffer;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600123 xglCmdCloneImageDataType CmdCloneImageData;
Chia-I Wu1a28fe02015-01-01 07:55:04 +0800124 xglCmdUpdateBufferType CmdUpdateBuffer;
125 xglCmdFillBufferType CmdFillBuffer;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600126 xglCmdClearColorImageType CmdClearColorImage;
127 xglCmdClearColorImageRawType CmdClearColorImageRaw;
128 xglCmdClearDepthStencilType CmdClearDepthStencil;
129 xglCmdResolveImageType CmdResolveImage;
130 xglCmdSetEventType CmdSetEvent;
131 xglCmdResetEventType CmdResetEvent;
Mike Stroyanfb80d5f2014-12-04 11:08:39 +0000132 xglCmdWaitEventsType CmdWaitEvents;
133 xglCmdPipelineBarrierType CmdPipelineBarrier;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600134 xglCmdBeginQueryType CmdBeginQuery;
135 xglCmdEndQueryType CmdEndQuery;
136 xglCmdResetQueryPoolType CmdResetQueryPool;
137 xglCmdWriteTimestampType CmdWriteTimestamp;
138 xglCmdInitAtomicCountersType CmdInitAtomicCounters;
139 xglCmdLoadAtomicCountersType CmdLoadAtomicCounters;
140 xglCmdSaveAtomicCountersType CmdSaveAtomicCounters;
Jeremy Hayesd65ae082015-01-14 16:17:08 -0700141 xglCreateFramebufferType CreateFramebuffer;
142 xglCreateRenderPassType CreateRenderPass;
Jon Ashburne13f1982015-02-02 09:58:11 -0700143 xglCmdBeginRenderPassType CmdBeginRenderPass;
144 xglCmdEndRenderPassType CmdEndRenderPass;
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600145 xglDbgSetValidationLevelType DbgSetValidationLevel;
146 xglDbgRegisterMsgCallbackType DbgRegisterMsgCallback;
147 xglDbgUnregisterMsgCallbackType DbgUnregisterMsgCallback;
148 xglDbgSetMessageFilterType DbgSetMessageFilter;
149 xglDbgSetObjectTagType DbgSetObjectTag;
150 xglDbgSetGlobalOptionType DbgSetGlobalOption;
151 xglDbgSetDeviceOptionType DbgSetDeviceOption;
152 xglCmdDbgMarkerBeginType CmdDbgMarkerBegin;
153 xglCmdDbgMarkerEndType CmdDbgMarkerEnd;
Ian Elliott2d4ab1e2015-01-13 17:52:38 -0700154#if defined(_WIN32)
155// FIXME: NEED WINDOWS EQUIVALENT
156#else // WIN32
Mark Lobodzinski391bb6d2015-01-09 15:12:03 -0600157 xglWsiX11AssociateConnectionType WsiX11AssociateConnection;
158 xglWsiX11GetMSCType WsiX11GetMSC;
159 xglWsiX11CreatePresentableImageType WsiX11CreatePresentableImage;
160 xglWsiX11QueuePresentType WsiX11QueuePresent;
Ian Elliott2d4ab1e2015-01-13 17:52:38 -0700161#endif // WIN32
Jon Ashburnd38bfb12014-10-14 19:15:22 -0600162} XGL_LAYER_DISPATCH_TABLE;
163
Tobin Ehlis42586532014-11-14 13:01:02 -0700164// LL node for tree of dbg callback functions
165typedef struct _XGL_LAYER_DBG_FUNCTION_NODE
166{
167 XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
Mark Lobodzinski17caf572015-01-29 08:55:56 -0600168 void *pUserData;
Tobin Ehlis42586532014-11-14 13:01:02 -0700169 struct _XGL_LAYER_DBG_FUNCTION_NODE *pNext;
170} XGL_LAYER_DBG_FUNCTION_NODE;
171
Jon Ashburnbe582642014-12-22 12:04:40 -0700172typedef enum _XGL_LAYER_DBG_ACTION
173{
174 XGL_DBG_LAYER_ACTION_IGNORE = 0x0,
175 XGL_DBG_LAYER_ACTION_CALLBACK = 0x1,
176 XGL_DBG_LAYER_ACTION_LOG_MSG = 0x2,
177 XGL_DBG_LAYER_ACTION_BREAK = 0x4
178} XGL_LAYER_DBG_ACTION;
179
180typedef enum _XGL_LAYER_DBG_REPORT_LEVEL
181{
182
183 XGL_DBG_LAYER_LEVEL_INFO = 0,
184 XGL_DBG_LAYER_LEVEL_WARN,
185 XGL_DBG_LAYER_LEVEL_PERF_WARN,
186 XGL_DBG_LAYER_LEVEL_ERROR,
187 XGL_DBG_LAYER_LEVEL_NONE,
188} XGL_LAYER_DBG_REPORT_LEVEL;
Jon Ashburnd38bfb12014-10-14 19:15:22 -0600189// ------------------------------------------------------------------------------------------------
190// API functions