Chia-I Wu | 30c7829 | 2014-08-04 10:08:08 +0800 | [diff] [blame] | 1 | /* |
| 2 | * XGL |
| 3 | * |
| 4 | * Copyright (C) 2014 LunarG, Inc. |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included |
| 14 | * in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
Chia-I Wu | 44e4236 | 2014-09-02 08:32:09 +0800 | [diff] [blame] | 23 | * |
| 24 | * Authors: |
| 25 | * Chia-I Wu <olv@lunarg.com> |
Chia-I Wu | 30c7829 | 2014-08-04 10:08:08 +0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #include "icd.h" |
Chia-I Wu | 0914213 | 2014-08-11 15:42:55 +0800 | [diff] [blame] | 29 | #include "cmd.h" |
Chia-I Wu | a207aba | 2014-08-05 15:13:37 +0800 | [diff] [blame] | 30 | #include "dev.h" |
Chia-I Wu | 75577d9 | 2014-08-11 10:54:33 +0800 | [diff] [blame] | 31 | #include "dset.h" |
Chia-I Wu | 9737a10 | 2014-08-07 07:59:51 +0800 | [diff] [blame] | 32 | #include "event.h" |
Chia-I Wu | bdf4c56 | 2014-08-07 06:36:33 +0800 | [diff] [blame] | 33 | #include "fence.h" |
Chia-I Wu | ac6ba13 | 2014-08-07 14:21:43 +0800 | [diff] [blame] | 34 | #include "format.h" |
Chia-I Wu | feb441f | 2014-08-08 21:27:38 +0800 | [diff] [blame] | 35 | #include "img.h" |
Chia-I Wu | bec90a0 | 2014-08-06 12:33:03 +0800 | [diff] [blame] | 36 | #include "gpu.h" |
Chia-I Wu | f9911eb | 2014-08-06 13:50:31 +0800 | [diff] [blame] | 37 | #include "mem.h" |
Chia-I Wu | 53fc6aa | 2014-08-06 14:22:51 +0800 | [diff] [blame] | 38 | #include "obj.h" |
Courtney Goeltzenleuchter | 06393c7 | 2014-08-20 15:39:51 -0600 | [diff] [blame] | 39 | #include "pipeline.h" |
Chia-I Wu | f667a6a | 2014-08-07 14:15:01 +0800 | [diff] [blame] | 40 | #include "query.h" |
Chia-I Wu | e09b536 | 2014-08-07 09:25:14 +0800 | [diff] [blame] | 41 | #include "queue.h" |
Chia-I Wu | 28b8996 | 2014-08-18 14:40:49 +0800 | [diff] [blame] | 42 | #include "sampler.h" |
Courtney Goeltzenleuchter | 52ec336 | 2014-08-19 11:52:02 -0600 | [diff] [blame] | 43 | #include "shader.h" |
Chia-I Wu | a5714e8 | 2014-08-11 15:33:42 +0800 | [diff] [blame] | 44 | #include "state.h" |
Chia-I Wu | 5a32326 | 2014-08-11 10:31:53 +0800 | [diff] [blame] | 45 | #include "view.h" |
Chia-I Wu | de2bb86 | 2014-08-19 14:32:47 +0800 | [diff] [blame] | 46 | #include "dispatch.h" |
Chia-I Wu | 30c7829 | 2014-08-04 10:08:08 +0800 | [diff] [blame] | 47 | |
Chia-I Wu | 30c7829 | 2014-08-04 10:08:08 +0800 | [diff] [blame] | 48 | |
Chia-I Wu | 6a42c2a | 2014-08-19 14:36:47 +0800 | [diff] [blame] | 49 | static const struct icd_dispatch_table intel_normal_dispatch_table = { |
Chia-I Wu | 30c7829 | 2014-08-04 10:08:08 +0800 | [diff] [blame] | 50 | .InitAndEnumerateGpus = xglInitAndEnumerateGpus, |
| 51 | .GetGpuInfo = intelGetGpuInfo, |
| 52 | .CreateDevice = intelCreateDevice, |
| 53 | .DestroyDevice = intelDestroyDevice, |
| 54 | .GetExtensionSupport = intelGetExtensionSupport, |
| 55 | .GetDeviceQueue = intelGetDeviceQueue, |
| 56 | .QueueSubmit = intelQueueSubmit, |
| 57 | .QueueSetGlobalMemReferences = intelQueueSetGlobalMemReferences, |
| 58 | .QueueWaitIdle = intelQueueWaitIdle, |
| 59 | .DeviceWaitIdle = intelDeviceWaitIdle, |
| 60 | .GetMemoryHeapCount = intelGetMemoryHeapCount, |
| 61 | .GetMemoryHeapInfo = intelGetMemoryHeapInfo, |
| 62 | .AllocMemory = intelAllocMemory, |
| 63 | .FreeMemory = intelFreeMemory, |
| 64 | .SetMemoryPriority = intelSetMemoryPriority, |
| 65 | .MapMemory = intelMapMemory, |
| 66 | .UnmapMemory = intelUnmapMemory, |
| 67 | .PinSystemMemory = intelPinSystemMemory, |
| 68 | .RemapVirtualMemoryPages = intelRemapVirtualMemoryPages, |
| 69 | .GetMultiGpuCompatibility = intelGetMultiGpuCompatibility, |
| 70 | .OpenSharedMemory = intelOpenSharedMemory, |
| 71 | .OpenSharedQueueSemaphore = intelOpenSharedQueueSemaphore, |
| 72 | .OpenPeerMemory = intelOpenPeerMemory, |
| 73 | .OpenPeerImage = intelOpenPeerImage, |
| 74 | .DestroyObject = intelDestroyObject, |
| 75 | .GetObjectInfo = intelGetObjectInfo, |
| 76 | .BindObjectMemory = intelBindObjectMemory, |
| 77 | .CreateFence = intelCreateFence, |
| 78 | .GetFenceStatus = intelGetFenceStatus, |
| 79 | .WaitForFences = intelWaitForFences, |
| 80 | .CreateQueueSemaphore = intelCreateQueueSemaphore, |
| 81 | .SignalQueueSemaphore = intelSignalQueueSemaphore, |
| 82 | .WaitQueueSemaphore = intelWaitQueueSemaphore, |
| 83 | .CreateEvent = intelCreateEvent, |
| 84 | .GetEventStatus = intelGetEventStatus, |
| 85 | .SetEvent = intelSetEvent, |
| 86 | .ResetEvent = intelResetEvent, |
| 87 | .CreateQueryPool = intelCreateQueryPool, |
| 88 | .GetQueryPoolResults = intelGetQueryPoolResults, |
| 89 | .GetFormatInfo = intelGetFormatInfo, |
| 90 | .CreateImage = intelCreateImage, |
| 91 | .GetImageSubresourceInfo = intelGetImageSubresourceInfo, |
| 92 | .CreateImageView = intelCreateImageView, |
| 93 | .CreateColorAttachmentView = intelCreateColorAttachmentView, |
| 94 | .CreateDepthStencilView = intelCreateDepthStencilView, |
| 95 | .CreateShader = intelCreateShader, |
| 96 | .CreateGraphicsPipeline = intelCreateGraphicsPipeline, |
| 97 | .CreateComputePipeline = intelCreateComputePipeline, |
| 98 | .StorePipeline = intelStorePipeline, |
| 99 | .LoadPipeline = intelLoadPipeline, |
| 100 | .CreatePipelineDelta = intelCreatePipelineDelta, |
| 101 | .CreateSampler = intelCreateSampler, |
| 102 | .CreateDescriptorSet = intelCreateDescriptorSet, |
| 103 | .BeginDescriptorSetUpdate = intelBeginDescriptorSetUpdate, |
| 104 | .EndDescriptorSetUpdate = intelEndDescriptorSetUpdate, |
| 105 | .AttachSamplerDescriptors = intelAttachSamplerDescriptors, |
| 106 | .AttachImageViewDescriptors = intelAttachImageViewDescriptors, |
| 107 | .AttachMemoryViewDescriptors = intelAttachMemoryViewDescriptors, |
| 108 | .AttachNestedDescriptors = intelAttachNestedDescriptors, |
| 109 | .ClearDescriptorSetSlots = intelClearDescriptorSetSlots, |
| 110 | .CreateViewportState = intelCreateViewportState, |
| 111 | .CreateRasterState = intelCreateRasterState, |
| 112 | .CreateMsaaState = intelCreateMsaaState, |
| 113 | .CreateColorBlendState = intelCreateColorBlendState, |
| 114 | .CreateDepthStencilState = intelCreateDepthStencilState, |
| 115 | .CreateCommandBuffer = intelCreateCommandBuffer, |
| 116 | .BeginCommandBuffer = intelBeginCommandBuffer, |
| 117 | .EndCommandBuffer = intelEndCommandBuffer, |
| 118 | .ResetCommandBuffer = intelResetCommandBuffer, |
| 119 | .CmdBindPipeline = intelCmdBindPipeline, |
| 120 | .CmdBindPipelineDelta = intelCmdBindPipelineDelta, |
| 121 | .CmdBindStateObject = intelCmdBindStateObject, |
| 122 | .CmdBindDescriptorSet = intelCmdBindDescriptorSet, |
| 123 | .CmdBindDynamicMemoryView = intelCmdBindDynamicMemoryView, |
| 124 | .CmdBindIndexData = intelCmdBindIndexData, |
| 125 | .CmdBindAttachments = intelCmdBindAttachments, |
| 126 | .CmdPrepareMemoryRegions = intelCmdPrepareMemoryRegions, |
| 127 | .CmdPrepareImages = intelCmdPrepareImages, |
| 128 | .CmdDraw = intelCmdDraw, |
| 129 | .CmdDrawIndexed = intelCmdDrawIndexed, |
| 130 | .CmdDrawIndirect = intelCmdDrawIndirect, |
| 131 | .CmdDrawIndexedIndirect = intelCmdDrawIndexedIndirect, |
| 132 | .CmdDispatch = intelCmdDispatch, |
| 133 | .CmdDispatchIndirect = intelCmdDispatchIndirect, |
| 134 | .CmdCopyMemory = intelCmdCopyMemory, |
| 135 | .CmdCopyImage = intelCmdCopyImage, |
| 136 | .CmdCopyMemoryToImage = intelCmdCopyMemoryToImage, |
| 137 | .CmdCopyImageToMemory = intelCmdCopyImageToMemory, |
| 138 | .CmdCloneImageData = intelCmdCloneImageData, |
| 139 | .CmdUpdateMemory = intelCmdUpdateMemory, |
| 140 | .CmdFillMemory = intelCmdFillMemory, |
| 141 | .CmdClearColorImage = intelCmdClearColorImage, |
| 142 | .CmdClearColorImageRaw = intelCmdClearColorImageRaw, |
| 143 | .CmdClearDepthStencil = intelCmdClearDepthStencil, |
| 144 | .CmdResolveImage = intelCmdResolveImage, |
| 145 | .CmdSetEvent = intelCmdSetEvent, |
| 146 | .CmdResetEvent = intelCmdResetEvent, |
| 147 | .CmdMemoryAtomic = intelCmdMemoryAtomic, |
| 148 | .CmdBeginQuery = intelCmdBeginQuery, |
| 149 | .CmdEndQuery = intelCmdEndQuery, |
| 150 | .CmdResetQueryPool = intelCmdResetQueryPool, |
| 151 | .CmdWriteTimestamp = intelCmdWriteTimestamp, |
| 152 | .CmdInitAtomicCounters = intelCmdInitAtomicCounters, |
| 153 | .CmdLoadAtomicCounters = intelCmdLoadAtomicCounters, |
| 154 | .CmdSaveAtomicCounters = intelCmdSaveAtomicCounters, |
| 155 | .DbgSetValidationLevel = intelDbgSetValidationLevel, |
| 156 | .DbgRegisterMsgCallback = xglDbgRegisterMsgCallback, |
| 157 | .DbgUnregisterMsgCallback = xglDbgUnregisterMsgCallback, |
| 158 | .DbgSetMessageFilter = intelDbgSetMessageFilter, |
| 159 | .DbgSetObjectTag = intelDbgSetObjectTag, |
| 160 | .DbgSetGlobalOption = xglDbgSetGlobalOption, |
| 161 | .DbgSetDeviceOption = intelDbgSetDeviceOption, |
| 162 | .CmdDbgMarkerBegin = intelCmdDbgMarkerBegin, |
| 163 | .CmdDbgMarkerEnd = intelCmdDbgMarkerEnd, |
| 164 | }; |
| 165 | |
Chia-I Wu | 6a42c2a | 2014-08-19 14:36:47 +0800 | [diff] [blame] | 166 | static const struct icd_dispatch_table intel_debug_dispatch_table = { |
Chia-I Wu | 30c7829 | 2014-08-04 10:08:08 +0800 | [diff] [blame] | 167 | .InitAndEnumerateGpus = xglInitAndEnumerateGpus, |
| 168 | .GetGpuInfo = intelGetGpuInfo, |
| 169 | .CreateDevice = intelCreateDevice, |
| 170 | .DestroyDevice = intelDestroyDevice, |
| 171 | .GetExtensionSupport = intelGetExtensionSupport, |
| 172 | .GetDeviceQueue = intelGetDeviceQueue, |
| 173 | .QueueSubmit = intelQueueSubmit, |
| 174 | .QueueSetGlobalMemReferences = intelQueueSetGlobalMemReferences, |
| 175 | .QueueWaitIdle = intelQueueWaitIdle, |
| 176 | .DeviceWaitIdle = intelDeviceWaitIdle, |
| 177 | .GetMemoryHeapCount = intelGetMemoryHeapCount, |
| 178 | .GetMemoryHeapInfo = intelGetMemoryHeapInfo, |
| 179 | .AllocMemory = intelAllocMemory, |
| 180 | .FreeMemory = intelFreeMemory, |
| 181 | .SetMemoryPriority = intelSetMemoryPriority, |
| 182 | .MapMemory = intelMapMemory, |
| 183 | .UnmapMemory = intelUnmapMemory, |
| 184 | .PinSystemMemory = intelPinSystemMemory, |
| 185 | .RemapVirtualMemoryPages = intelRemapVirtualMemoryPages, |
| 186 | .GetMultiGpuCompatibility = intelGetMultiGpuCompatibility, |
| 187 | .OpenSharedMemory = intelOpenSharedMemory, |
| 188 | .OpenSharedQueueSemaphore = intelOpenSharedQueueSemaphore, |
| 189 | .OpenPeerMemory = intelOpenPeerMemory, |
| 190 | .OpenPeerImage = intelOpenPeerImage, |
| 191 | .DestroyObject = intelDestroyObject, |
| 192 | .GetObjectInfo = intelGetObjectInfo, |
| 193 | .BindObjectMemory = intelBindObjectMemory, |
| 194 | .CreateFence = intelCreateFence, |
| 195 | .GetFenceStatus = intelGetFenceStatus, |
| 196 | .WaitForFences = intelWaitForFences, |
| 197 | .CreateQueueSemaphore = intelCreateQueueSemaphore, |
| 198 | .SignalQueueSemaphore = intelSignalQueueSemaphore, |
| 199 | .WaitQueueSemaphore = intelWaitQueueSemaphore, |
| 200 | .CreateEvent = intelCreateEvent, |
| 201 | .GetEventStatus = intelGetEventStatus, |
| 202 | .SetEvent = intelSetEvent, |
| 203 | .ResetEvent = intelResetEvent, |
| 204 | .CreateQueryPool = intelCreateQueryPool, |
| 205 | .GetQueryPoolResults = intelGetQueryPoolResults, |
| 206 | .GetFormatInfo = intelGetFormatInfo, |
| 207 | .CreateImage = intelCreateImage, |
| 208 | .GetImageSubresourceInfo = intelGetImageSubresourceInfo, |
| 209 | .CreateImageView = intelCreateImageView, |
| 210 | .CreateColorAttachmentView = intelCreateColorAttachmentView, |
| 211 | .CreateDepthStencilView = intelCreateDepthStencilView, |
| 212 | .CreateShader = intelCreateShader, |
| 213 | .CreateGraphicsPipeline = intelCreateGraphicsPipeline, |
| 214 | .CreateComputePipeline = intelCreateComputePipeline, |
| 215 | .StorePipeline = intelStorePipeline, |
| 216 | .LoadPipeline = intelLoadPipeline, |
| 217 | .CreatePipelineDelta = intelCreatePipelineDelta, |
| 218 | .CreateSampler = intelCreateSampler, |
| 219 | .CreateDescriptorSet = intelCreateDescriptorSet, |
| 220 | .BeginDescriptorSetUpdate = intelBeginDescriptorSetUpdate, |
| 221 | .EndDescriptorSetUpdate = intelEndDescriptorSetUpdate, |
| 222 | .AttachSamplerDescriptors = intelAttachSamplerDescriptors, |
| 223 | .AttachImageViewDescriptors = intelAttachImageViewDescriptors, |
| 224 | .AttachMemoryViewDescriptors = intelAttachMemoryViewDescriptors, |
| 225 | .AttachNestedDescriptors = intelAttachNestedDescriptors, |
| 226 | .ClearDescriptorSetSlots = intelClearDescriptorSetSlots, |
| 227 | .CreateViewportState = intelCreateViewportState, |
| 228 | .CreateRasterState = intelCreateRasterState, |
| 229 | .CreateMsaaState = intelCreateMsaaState, |
| 230 | .CreateColorBlendState = intelCreateColorBlendState, |
| 231 | .CreateDepthStencilState = intelCreateDepthStencilState, |
| 232 | .CreateCommandBuffer = intelCreateCommandBuffer, |
| 233 | .BeginCommandBuffer = intelBeginCommandBuffer, |
| 234 | .EndCommandBuffer = intelEndCommandBuffer, |
| 235 | .ResetCommandBuffer = intelResetCommandBuffer, |
| 236 | .CmdBindPipeline = intelCmdBindPipeline, |
| 237 | .CmdBindPipelineDelta = intelCmdBindPipelineDelta, |
| 238 | .CmdBindStateObject = intelCmdBindStateObject, |
| 239 | .CmdBindDescriptorSet = intelCmdBindDescriptorSet, |
| 240 | .CmdBindDynamicMemoryView = intelCmdBindDynamicMemoryView, |
| 241 | .CmdBindIndexData = intelCmdBindIndexData, |
| 242 | .CmdBindAttachments = intelCmdBindAttachments, |
| 243 | .CmdPrepareMemoryRegions = intelCmdPrepareMemoryRegions, |
| 244 | .CmdPrepareImages = intelCmdPrepareImages, |
| 245 | .CmdDraw = intelCmdDraw, |
| 246 | .CmdDrawIndexed = intelCmdDrawIndexed, |
| 247 | .CmdDrawIndirect = intelCmdDrawIndirect, |
| 248 | .CmdDrawIndexedIndirect = intelCmdDrawIndexedIndirect, |
| 249 | .CmdDispatch = intelCmdDispatch, |
| 250 | .CmdDispatchIndirect = intelCmdDispatchIndirect, |
| 251 | .CmdCopyMemory = intelCmdCopyMemory, |
| 252 | .CmdCopyImage = intelCmdCopyImage, |
| 253 | .CmdCopyMemoryToImage = intelCmdCopyMemoryToImage, |
| 254 | .CmdCopyImageToMemory = intelCmdCopyImageToMemory, |
| 255 | .CmdCloneImageData = intelCmdCloneImageData, |
| 256 | .CmdUpdateMemory = intelCmdUpdateMemory, |
| 257 | .CmdFillMemory = intelCmdFillMemory, |
| 258 | .CmdClearColorImage = intelCmdClearColorImage, |
| 259 | .CmdClearColorImageRaw = intelCmdClearColorImageRaw, |
| 260 | .CmdClearDepthStencil = intelCmdClearDepthStencil, |
| 261 | .CmdResolveImage = intelCmdResolveImage, |
| 262 | .CmdSetEvent = intelCmdSetEvent, |
| 263 | .CmdResetEvent = intelCmdResetEvent, |
| 264 | .CmdMemoryAtomic = intelCmdMemoryAtomic, |
| 265 | .CmdBeginQuery = intelCmdBeginQuery, |
| 266 | .CmdEndQuery = intelCmdEndQuery, |
| 267 | .CmdResetQueryPool = intelCmdResetQueryPool, |
| 268 | .CmdWriteTimestamp = intelCmdWriteTimestamp, |
| 269 | .CmdInitAtomicCounters = intelCmdInitAtomicCounters, |
| 270 | .CmdLoadAtomicCounters = intelCmdLoadAtomicCounters, |
| 271 | .CmdSaveAtomicCounters = intelCmdSaveAtomicCounters, |
| 272 | .DbgSetValidationLevel = intelDbgSetValidationLevel, |
| 273 | .DbgRegisterMsgCallback = xglDbgRegisterMsgCallback, |
| 274 | .DbgUnregisterMsgCallback = xglDbgUnregisterMsgCallback, |
| 275 | .DbgSetMessageFilter = intelDbgSetMessageFilter, |
| 276 | .DbgSetObjectTag = intelDbgSetObjectTag, |
| 277 | .DbgSetGlobalOption = xglDbgSetGlobalOption, |
| 278 | .DbgSetDeviceOption = intelDbgSetDeviceOption, |
| 279 | .CmdDbgMarkerBegin = intelCmdDbgMarkerBegin, |
| 280 | .CmdDbgMarkerEnd = intelCmdDbgMarkerEnd, |
| 281 | }; |
Chia-I Wu | 6a42c2a | 2014-08-19 14:36:47 +0800 | [diff] [blame] | 282 | |
| 283 | const struct icd_dispatch_table *intel_dispatch_get(bool debug) |
| 284 | { |
| 285 | return (debug) ? &intel_debug_dispatch_table : |
| 286 | &intel_normal_dispatch_table; |
| 287 | } |