blob: 756b954f7944a746b1a4cfd5271d8d019964d994 [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"
9#include "xglWsiX11Ext.h"
10#if defined(__GNUC__) && __GNUC__ >= 4
11# define XGL_LAYER_EXPORT __attribute__((visibility("default")))
12#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
13# define XGL_LAYER_EXPORT __attribute__((visibility("default")))
14#else
15# define XGL_LAYER_EXPORT
16#endif
17
Jon Ashburnd43f9b62014-10-14 19:15:22 -060018
19typedef struct _XGL_BASE_LAYER_OBJECT
20{
Mark Lobodzinski953a1692015-01-09 15:12:03 -060021 xglGetProcAddrType pGPA;
Jon Ashburnd43f9b62014-10-14 19:15:22 -060022 XGL_BASE_OBJECT nextObject;
23 XGL_BASE_OBJECT baseObject;
24} XGL_BASE_LAYER_OBJECT;
25
26typedef struct _XGL_LAYER_DISPATCH_TABLE
27{
Mark Lobodzinski953a1692015-01-09 15:12:03 -060028 xglGetProcAddrType GetProcAddr;
29 xglInitAndEnumerateGpusType InitAndEnumerateGpus;
30 xglGetGpuInfoType GetGpuInfo;
31 xglCreateDeviceType CreateDevice;
32 xglDestroyDeviceType DestroyDevice;
33 xglGetExtensionSupportType GetExtensionSupport;
34 xglEnumerateLayersType EnumerateLayers;
35 xglGetDeviceQueueType GetDeviceQueue;
36 xglQueueSubmitType QueueSubmit;
37 xglQueueSetGlobalMemReferencesType QueueSetGlobalMemReferences;
38 xglQueueWaitIdleType QueueWaitIdle;
39 xglDeviceWaitIdleType DeviceWaitIdle;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060040 xglAllocMemoryType AllocMemory;
41 xglFreeMemoryType FreeMemory;
42 xglSetMemoryPriorityType SetMemoryPriority;
43 xglMapMemoryType MapMemory;
44 xglUnmapMemoryType UnmapMemory;
45 xglPinSystemMemoryType PinSystemMemory;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060046 xglGetMultiGpuCompatibilityType GetMultiGpuCompatibility;
47 xglOpenSharedMemoryType OpenSharedMemory;
48 xglOpenSharedQueueSemaphoreType OpenSharedQueueSemaphore;
49 xglOpenPeerMemoryType OpenPeerMemory;
50 xglOpenPeerImageType OpenPeerImage;
51 xglDestroyObjectType DestroyObject;
52 xglGetObjectInfoType GetObjectInfo;
53 xglBindObjectMemoryType BindObjectMemory;
Chia-I Wu714df452015-01-01 07:55:04 +080054 xglBindObjectMemoryRangeType BindObjectMemoryRange;
55 xglBindImageMemoryRangeType BindImageMemoryRange;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060056 xglCreateFenceType CreateFence;
57 xglGetFenceStatusType GetFenceStatus;
58 xglWaitForFencesType WaitForFences;
59 xglCreateQueueSemaphoreType CreateQueueSemaphore;
60 xglSignalQueueSemaphoreType SignalQueueSemaphore;
61 xglWaitQueueSemaphoreType WaitQueueSemaphore;
62 xglCreateEventType CreateEvent;
63 xglGetEventStatusType GetEventStatus;
64 xglSetEventType SetEvent;
65 xglResetEventType ResetEvent;
66 xglCreateQueryPoolType CreateQueryPool;
67 xglGetQueryPoolResultsType GetQueryPoolResults;
68 xglGetFormatInfoType GetFormatInfo;
Chia-I Wu714df452015-01-01 07:55:04 +080069 xglCreateBufferType CreateBuffer;
70 xglCreateBufferViewType CreateBufferView;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060071 xglCreateImageType CreateImage;
72 xglGetImageSubresourceInfoType GetImageSubresourceInfo;
73 xglCreateImageViewType CreateImageView;
74 xglCreateColorAttachmentViewType CreateColorAttachmentView;
75 xglCreateDepthStencilViewType CreateDepthStencilView;
76 xglCreateShaderType CreateShader;
77 xglCreateGraphicsPipelineType CreateGraphicsPipeline;
78 xglCreateComputePipelineType CreateComputePipeline;
79 xglStorePipelineType StorePipeline;
80 xglLoadPipelineType LoadPipeline;
81 xglCreatePipelineDeltaType CreatePipelineDelta;
82 xglCreateSamplerType CreateSampler;
Chia-I Wuf8385062015-01-04 16:27:24 +080083 xglCreateDescriptorSetLayoutType CreateDescriptorSetLayout;
84 xglBeginDescriptorRegionUpdateType BeginDescriptorRegionUpdate;
85 xglEndDescriptorRegionUpdateType EndDescriptorRegionUpdate;
86 xglCreateDescriptorRegionType CreateDescriptorRegion;
87 xglClearDescriptorRegionType ClearDescriptorRegion;
88 xglAllocDescriptorSetsType AllocDescriptorSets;
89 xglClearDescriptorSetsType ClearDescriptorSets;
90 xglUpdateDescriptorsType UpdateDescriptors;
Tony Barbourfa6cac72015-01-16 14:27:35 -070091 xglCreateDynamicViewportStateType CreateDynamicViewportState;
92 xglCreateDynamicRasterStateType CreateDynamicRasterState;
93 xglCreateDynamicColorBlendStateType CreateDynamicColorBlendState;
94 xglCreateDynamicDepthStencilStateType CreateDynamicDepthStencilState;
Mark Lobodzinski953a1692015-01-09 15:12:03 -060095 xglCreateCommandBufferType CreateCommandBuffer;
96 xglBeginCommandBufferType BeginCommandBuffer;
97 xglEndCommandBufferType EndCommandBuffer;
98 xglResetCommandBufferType ResetCommandBuffer;
99 xglCmdBindPipelineType CmdBindPipeline;
100 xglCmdBindPipelineDeltaType CmdBindPipelineDelta;
Tony Barbourfa6cac72015-01-16 14:27:35 -0700101 xglCmdBindDynamicStateObjectType CmdBindDynamicStateObject;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600102 xglCmdBindDescriptorSetType CmdBindDescriptorSet;
Chia-I Wu714df452015-01-01 07:55:04 +0800103 xglCmdBindVertexBufferType CmdBindVertexBuffer;
104 xglCmdBindIndexBufferType CmdBindIndexBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600105 xglCmdDrawType CmdDraw;
106 xglCmdDrawIndexedType CmdDrawIndexed;
107 xglCmdDrawIndirectType CmdDrawIndirect;
108 xglCmdDrawIndexedIndirectType CmdDrawIndexedIndirect;
109 xglCmdDispatchType CmdDispatch;
110 xglCmdDispatchIndirectType CmdDispatchIndirect;
Chia-I Wu714df452015-01-01 07:55:04 +0800111 xglCmdCopyBufferType CmdCopyBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600112 xglCmdCopyImageType CmdCopyImage;
Chia-I Wu714df452015-01-01 07:55:04 +0800113 xglCmdCopyBufferToImageType CmdCopyBufferToImage;
114 xglCmdCopyImageToBufferType CmdCopyImageToBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600115 xglCmdCloneImageDataType CmdCloneImageData;
Chia-I Wu714df452015-01-01 07:55:04 +0800116 xglCmdUpdateBufferType CmdUpdateBuffer;
117 xglCmdFillBufferType CmdFillBuffer;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600118 xglCmdClearColorImageType CmdClearColorImage;
119 xglCmdClearColorImageRawType CmdClearColorImageRaw;
120 xglCmdClearDepthStencilType CmdClearDepthStencil;
121 xglCmdResolveImageType CmdResolveImage;
122 xglCmdSetEventType CmdSetEvent;
123 xglCmdResetEventType CmdResetEvent;
Mike Stroyan55658c22014-12-04 11:08:39 +0000124 xglCmdWaitEventsType CmdWaitEvents;
125 xglCmdPipelineBarrierType CmdPipelineBarrier;
Chia-I Wu714df452015-01-01 07:55:04 +0800126 xglCmdBufferAtomicType CmdBufferAtomic;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600127 xglCmdBeginQueryType CmdBeginQuery;
128 xglCmdEndQueryType CmdEndQuery;
129 xglCmdResetQueryPoolType CmdResetQueryPool;
130 xglCmdWriteTimestampType CmdWriteTimestamp;
131 xglCmdInitAtomicCountersType CmdInitAtomicCounters;
132 xglCmdLoadAtomicCountersType CmdLoadAtomicCounters;
133 xglCmdSaveAtomicCountersType CmdSaveAtomicCounters;
Jeremy Hayese0c3b222015-01-14 16:17:08 -0700134 xglCreateFramebufferType CreateFramebuffer;
135 xglCreateRenderPassType CreateRenderPass;
Mark Lobodzinski953a1692015-01-09 15:12:03 -0600136 xglDbgSetValidationLevelType DbgSetValidationLevel;
137 xglDbgRegisterMsgCallbackType DbgRegisterMsgCallback;
138 xglDbgUnregisterMsgCallbackType DbgUnregisterMsgCallback;
139 xglDbgSetMessageFilterType DbgSetMessageFilter;
140 xglDbgSetObjectTagType DbgSetObjectTag;
141 xglDbgSetGlobalOptionType DbgSetGlobalOption;
142 xglDbgSetDeviceOptionType DbgSetDeviceOption;
143 xglCmdDbgMarkerBeginType CmdDbgMarkerBegin;
144 xglCmdDbgMarkerEndType CmdDbgMarkerEnd;
145 xglWsiX11AssociateConnectionType WsiX11AssociateConnection;
146 xglWsiX11GetMSCType WsiX11GetMSC;
147 xglWsiX11CreatePresentableImageType WsiX11CreatePresentableImage;
148 xglWsiX11QueuePresentType WsiX11QueuePresent;
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600149} XGL_LAYER_DISPATCH_TABLE;
150
Tobin Ehlisacab8882014-11-14 13:01:02 -0700151// LL node for tree of dbg callback functions
152typedef struct _XGL_LAYER_DBG_FUNCTION_NODE
153{
154 XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback;
155 XGL_VOID *pUserData;
156 struct _XGL_LAYER_DBG_FUNCTION_NODE *pNext;
157} XGL_LAYER_DBG_FUNCTION_NODE;
158
Jon Ashburn47e92892014-12-22 12:04:40 -0700159typedef enum _XGL_LAYER_DBG_ACTION
160{
161 XGL_DBG_LAYER_ACTION_IGNORE = 0x0,
162 XGL_DBG_LAYER_ACTION_CALLBACK = 0x1,
163 XGL_DBG_LAYER_ACTION_LOG_MSG = 0x2,
164 XGL_DBG_LAYER_ACTION_BREAK = 0x4
165} XGL_LAYER_DBG_ACTION;
166
167typedef enum _XGL_LAYER_DBG_REPORT_LEVEL
168{
169
170 XGL_DBG_LAYER_LEVEL_INFO = 0,
171 XGL_DBG_LAYER_LEVEL_WARN,
172 XGL_DBG_LAYER_LEVEL_PERF_WARN,
173 XGL_DBG_LAYER_LEVEL_ERROR,
174 XGL_DBG_LAYER_LEVEL_NONE,
175} XGL_LAYER_DBG_REPORT_LEVEL;
Jon Ashburnd43f9b62014-10-14 19:15:22 -0600176// ------------------------------------------------------------------------------------------------
177// API functions