Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 1 | /* 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 Elliott | d1597d2 | 2015-02-26 14:34:52 -0700 | [diff] [blame^] | 9 | #if defined(__linux__) || defined(XCB_NVIDIA) |
Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 10 | #include "xglWsiX11Ext.h" |
Piers Daniell | 188f820 | 2015-02-24 13:58:47 -0700 | [diff] [blame] | 11 | #endif |
Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 12 | #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 Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 20 | |
| 21 | typedef struct _XGL_BASE_LAYER_OBJECT |
| 22 | { |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 23 | xglGetProcAddrType pGPA; |
Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 24 | XGL_BASE_OBJECT nextObject; |
| 25 | XGL_BASE_OBJECT baseObject; |
| 26 | } XGL_BASE_LAYER_OBJECT; |
| 27 | |
| 28 | typedef struct _XGL_LAYER_DISPATCH_TABLE |
| 29 | { |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 30 | xglGetProcAddrType GetProcAddr; |
Jon Ashburn | 1beab2d | 2015-01-26 14:51:40 -0700 | [diff] [blame] | 31 | xglCreateInstanceType CreateInstance; |
| 32 | xglDestroyInstanceType DestroyInstance; |
| 33 | xglEnumerateGpusType EnumerateGpus; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 34 | 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 Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 44 | xglAllocMemoryType AllocMemory; |
| 45 | xglFreeMemoryType FreeMemory; |
| 46 | xglSetMemoryPriorityType SetMemoryPriority; |
| 47 | xglMapMemoryType MapMemory; |
| 48 | xglUnmapMemoryType UnmapMemory; |
| 49 | xglPinSystemMemoryType PinSystemMemory; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 50 | 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 Wu | 1a28fe0 | 2015-01-01 07:55:04 +0800 | [diff] [blame] | 58 | xglBindObjectMemoryRangeType BindObjectMemoryRange; |
| 59 | xglBindImageMemoryRangeType BindImageMemoryRange; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 60 | 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 Wu | 1a28fe0 | 2015-01-01 07:55:04 +0800 | [diff] [blame] | 73 | xglCreateBufferType CreateBuffer; |
| 74 | xglCreateBufferViewType CreateBufferView; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 75 | xglCreateImageType CreateImage; |
Mark Lobodzinski | 58c2018 | 2015-01-28 13:29:48 -0600 | [diff] [blame] | 76 | xglSetFastClearColorType SetFastClearColor; |
| 77 | xglSetFastClearDepthType SetFastClearDepth; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 78 | 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 Wu | 11078b0 | 2015-01-04 16:27:24 +0800 | [diff] [blame] | 89 | xglCreateDescriptorSetLayoutType CreateDescriptorSetLayout; |
| 90 | xglBeginDescriptorRegionUpdateType BeginDescriptorRegionUpdate; |
| 91 | xglEndDescriptorRegionUpdateType EndDescriptorRegionUpdate; |
| 92 | xglCreateDescriptorRegionType CreateDescriptorRegion; |
| 93 | xglClearDescriptorRegionType ClearDescriptorRegion; |
| 94 | xglAllocDescriptorSetsType AllocDescriptorSets; |
| 95 | xglClearDescriptorSetsType ClearDescriptorSets; |
| 96 | xglUpdateDescriptorsType UpdateDescriptors; |
Tony Barbour | f52346d | 2015-01-16 14:27:35 -0700 | [diff] [blame] | 97 | xglCreateDynamicViewportStateType CreateDynamicViewportState; |
| 98 | xglCreateDynamicRasterStateType CreateDynamicRasterState; |
| 99 | xglCreateDynamicColorBlendStateType CreateDynamicColorBlendState; |
| 100 | xglCreateDynamicDepthStencilStateType CreateDynamicDepthStencilState; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 101 | xglCreateCommandBufferType CreateCommandBuffer; |
| 102 | xglBeginCommandBufferType BeginCommandBuffer; |
| 103 | xglEndCommandBufferType EndCommandBuffer; |
| 104 | xglResetCommandBufferType ResetCommandBuffer; |
| 105 | xglCmdBindPipelineType CmdBindPipeline; |
| 106 | xglCmdBindPipelineDeltaType CmdBindPipelineDelta; |
Tony Barbour | f52346d | 2015-01-16 14:27:35 -0700 | [diff] [blame] | 107 | xglCmdBindDynamicStateObjectType CmdBindDynamicStateObject; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 108 | xglCmdBindDescriptorSetType CmdBindDescriptorSet; |
Chia-I Wu | 1a28fe0 | 2015-01-01 07:55:04 +0800 | [diff] [blame] | 109 | xglCmdBindVertexBufferType CmdBindVertexBuffer; |
| 110 | xglCmdBindIndexBufferType CmdBindIndexBuffer; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 111 | xglCmdDrawType CmdDraw; |
| 112 | xglCmdDrawIndexedType CmdDrawIndexed; |
| 113 | xglCmdDrawIndirectType CmdDrawIndirect; |
| 114 | xglCmdDrawIndexedIndirectType CmdDrawIndexedIndirect; |
| 115 | xglCmdDispatchType CmdDispatch; |
| 116 | xglCmdDispatchIndirectType CmdDispatchIndirect; |
Chia-I Wu | 1a28fe0 | 2015-01-01 07:55:04 +0800 | [diff] [blame] | 117 | xglCmdCopyBufferType CmdCopyBuffer; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 118 | xglCmdCopyImageType CmdCopyImage; |
Chia-I Wu | 1a28fe0 | 2015-01-01 07:55:04 +0800 | [diff] [blame] | 119 | xglCmdCopyBufferToImageType CmdCopyBufferToImage; |
| 120 | xglCmdCopyImageToBufferType CmdCopyImageToBuffer; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 121 | xglCmdCloneImageDataType CmdCloneImageData; |
Chia-I Wu | 1a28fe0 | 2015-01-01 07:55:04 +0800 | [diff] [blame] | 122 | xglCmdUpdateBufferType CmdUpdateBuffer; |
| 123 | xglCmdFillBufferType CmdFillBuffer; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 124 | xglCmdClearColorImageType CmdClearColorImage; |
| 125 | xglCmdClearColorImageRawType CmdClearColorImageRaw; |
| 126 | xglCmdClearDepthStencilType CmdClearDepthStencil; |
| 127 | xglCmdResolveImageType CmdResolveImage; |
| 128 | xglCmdSetEventType CmdSetEvent; |
| 129 | xglCmdResetEventType CmdResetEvent; |
Mike Stroyan | fb80d5f | 2014-12-04 11:08:39 +0000 | [diff] [blame] | 130 | xglCmdWaitEventsType CmdWaitEvents; |
| 131 | xglCmdPipelineBarrierType CmdPipelineBarrier; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 132 | xglCmdBeginQueryType CmdBeginQuery; |
| 133 | xglCmdEndQueryType CmdEndQuery; |
| 134 | xglCmdResetQueryPoolType CmdResetQueryPool; |
| 135 | xglCmdWriteTimestampType CmdWriteTimestamp; |
| 136 | xglCmdInitAtomicCountersType CmdInitAtomicCounters; |
| 137 | xglCmdLoadAtomicCountersType CmdLoadAtomicCounters; |
| 138 | xglCmdSaveAtomicCountersType CmdSaveAtomicCounters; |
Jeremy Hayes | d65ae08 | 2015-01-14 16:17:08 -0700 | [diff] [blame] | 139 | xglCreateFramebufferType CreateFramebuffer; |
| 140 | xglCreateRenderPassType CreateRenderPass; |
Jon Ashburn | e13f198 | 2015-02-02 09:58:11 -0700 | [diff] [blame] | 141 | xglCmdBeginRenderPassType CmdBeginRenderPass; |
| 142 | xglCmdEndRenderPassType CmdEndRenderPass; |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 143 | 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 Elliott | d1597d2 | 2015-02-26 14:34:52 -0700 | [diff] [blame^] | 152 | #if defined(__linux__) || defined(XCB_NVIDIA) |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 153 | xglWsiX11AssociateConnectionType WsiX11AssociateConnection; |
| 154 | xglWsiX11GetMSCType WsiX11GetMSC; |
| 155 | xglWsiX11CreatePresentableImageType WsiX11CreatePresentableImage; |
| 156 | xglWsiX11QueuePresentType WsiX11QueuePresent; |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 157 | #endif // WIN32 |
Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 158 | } XGL_LAYER_DISPATCH_TABLE; |
| 159 | |
Tobin Ehlis | 4258653 | 2014-11-14 13:01:02 -0700 | [diff] [blame] | 160 | // LL node for tree of dbg callback functions |
| 161 | typedef struct _XGL_LAYER_DBG_FUNCTION_NODE |
| 162 | { |
| 163 | XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback; |
Mark Lobodzinski | 17caf57 | 2015-01-29 08:55:56 -0600 | [diff] [blame] | 164 | void *pUserData; |
Tobin Ehlis | 4258653 | 2014-11-14 13:01:02 -0700 | [diff] [blame] | 165 | struct _XGL_LAYER_DBG_FUNCTION_NODE *pNext; |
| 166 | } XGL_LAYER_DBG_FUNCTION_NODE; |
| 167 | |
Jon Ashburn | be58264 | 2014-12-22 12:04:40 -0700 | [diff] [blame] | 168 | typedef 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 | |
| 176 | typedef 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 Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 185 | // ------------------------------------------------------------------------------------------------ |
| 186 | // API functions |