diff options
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/api_file_dump.c | 1933 | ||||
| -rw-r--r-- | layers/draw_state.c | 28 | ||||
| -rw-r--r-- | layers/mem_tracker.c | 2009 | ||||
| -rw-r--r-- | layers/xgl_struct_string_helper.h | 2 |
4 files changed, 3966 insertions, 6 deletions
diff --git a/layers/api_file_dump.c b/layers/api_file_dump.c new file mode 100644 index 00000000..721d12b6 --- /dev/null +++ b/layers/api_file_dump.c @@ -0,0 +1,1933 @@ +/* THIS FILE IS GENERATED. DO NOT EDIT. */ + +/* + * XGL + * + * Copyright (C) 2014 LunarG, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <pthread.h> +#include "xglLayer.h" +#include "xgl_string_helper.h" +#include "xgl_struct_string_helper.h" + +static XGL_LAYER_DISPATCH_TABLE nextTable; +static XGL_BASE_LAYER_OBJECT *pCurObj; +static pthread_once_t tabOnce = PTHREAD_ONCE_INIT; + +static FILE* pOutFile; +static char* outFileName = "xgl_apidump.txt"; + +static void initLayerTable() +{ + GetProcAddrType fpNextGPA; + fpNextGPA = pCurObj->pGPA; + assert(fpNextGPA); + + GetProcAddrType fpGetProcAddr = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetProcAddr"); + nextTable.GetProcAddr = fpGetProcAddr; + InitAndEnumerateGpusType fpInitAndEnumerateGpus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglInitAndEnumerateGpus"); + nextTable.InitAndEnumerateGpus = fpInitAndEnumerateGpus; + GetGpuInfoType fpGetGpuInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetGpuInfo"); + nextTable.GetGpuInfo = fpGetGpuInfo; + CreateDeviceType fpCreateDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDevice"); + nextTable.CreateDevice = fpCreateDevice; + DestroyDeviceType fpDestroyDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyDevice"); + nextTable.DestroyDevice = fpDestroyDevice; + GetExtensionSupportType fpGetExtensionSupport = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetExtensionSupport"); + nextTable.GetExtensionSupport = fpGetExtensionSupport; + EnumerateLayersType fpEnumerateLayers = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEnumerateLayers"); + nextTable.EnumerateLayers = fpEnumerateLayers; + GetDeviceQueueType fpGetDeviceQueue = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetDeviceQueue"); + nextTable.GetDeviceQueue = fpGetDeviceQueue; + QueueSubmitType fpQueueSubmit = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSubmit"); + nextTable.QueueSubmit = fpQueueSubmit; + QueueSetGlobalMemReferencesType fpQueueSetGlobalMemReferences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSetGlobalMemReferences"); + nextTable.QueueSetGlobalMemReferences = fpQueueSetGlobalMemReferences; + QueueWaitIdleType fpQueueWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueWaitIdle"); + nextTable.QueueWaitIdle = fpQueueWaitIdle; + DeviceWaitIdleType fpDeviceWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDeviceWaitIdle"); + nextTable.DeviceWaitIdle = fpDeviceWaitIdle; + GetMemoryHeapCountType fpGetMemoryHeapCount = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapCount"); + nextTable.GetMemoryHeapCount = fpGetMemoryHeapCount; + GetMemoryHeapInfoType fpGetMemoryHeapInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapInfo"); + nextTable.GetMemoryHeapInfo = fpGetMemoryHeapInfo; + AllocMemoryType fpAllocMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAllocMemory"); + nextTable.AllocMemory = fpAllocMemory; + FreeMemoryType fpFreeMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglFreeMemory"); + nextTable.FreeMemory = fpFreeMemory; + SetMemoryPriorityType fpSetMemoryPriority = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetMemoryPriority"); + nextTable.SetMemoryPriority = fpSetMemoryPriority; + MapMemoryType fpMapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglMapMemory"); + nextTable.MapMemory = fpMapMemory; + UnmapMemoryType fpUnmapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglUnmapMemory"); + nextTable.UnmapMemory = fpUnmapMemory; + PinSystemMemoryType fpPinSystemMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglPinSystemMemory"); + nextTable.PinSystemMemory = fpPinSystemMemory; + RemapVirtualMemoryPagesType fpRemapVirtualMemoryPages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglRemapVirtualMemoryPages"); + nextTable.RemapVirtualMemoryPages = fpRemapVirtualMemoryPages; + GetMultiGpuCompatibilityType fpGetMultiGpuCompatibility = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMultiGpuCompatibility"); + nextTable.GetMultiGpuCompatibility = fpGetMultiGpuCompatibility; + OpenSharedMemoryType fpOpenSharedMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedMemory"); + nextTable.OpenSharedMemory = fpOpenSharedMemory; + OpenSharedQueueSemaphoreType fpOpenSharedQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedQueueSemaphore"); + nextTable.OpenSharedQueueSemaphore = fpOpenSharedQueueSemaphore; + OpenPeerMemoryType fpOpenPeerMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerMemory"); + nextTable.OpenPeerMemory = fpOpenPeerMemory; + OpenPeerImageType fpOpenPeerImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerImage"); + nextTable.OpenPeerImage = fpOpenPeerImage; + DestroyObjectType fpDestroyObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyObject"); + nextTable.DestroyObject = fpDestroyObject; + GetObjectInfoType fpGetObjectInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetObjectInfo"); + nextTable.GetObjectInfo = fpGetObjectInfo; + BindObjectMemoryType fpBindObjectMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBindObjectMemory"); + nextTable.BindObjectMemory = fpBindObjectMemory; + CreateFenceType fpCreateFence = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateFence"); + nextTable.CreateFence = fpCreateFence; + GetFenceStatusType fpGetFenceStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFenceStatus"); + nextTable.GetFenceStatus = fpGetFenceStatus; + WaitForFencesType fpWaitForFences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitForFences"); + nextTable.WaitForFences = fpWaitForFences; + CreateQueueSemaphoreType fpCreateQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueueSemaphore"); + nextTable.CreateQueueSemaphore = fpCreateQueueSemaphore; + SignalQueueSemaphoreType fpSignalQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSignalQueueSemaphore"); + nextTable.SignalQueueSemaphore = fpSignalQueueSemaphore; + WaitQueueSemaphoreType fpWaitQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitQueueSemaphore"); + nextTable.WaitQueueSemaphore = fpWaitQueueSemaphore; + CreateEventType fpCreateEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateEvent"); + nextTable.CreateEvent = fpCreateEvent; + GetEventStatusType fpGetEventStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetEventStatus"); + nextTable.GetEventStatus = fpGetEventStatus; + SetEventType fpSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetEvent"); + nextTable.SetEvent = fpSetEvent; + ResetEventType fpResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetEvent"); + nextTable.ResetEvent = fpResetEvent; + CreateQueryPoolType fpCreateQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueryPool"); + nextTable.CreateQueryPool = fpCreateQueryPool; + GetQueryPoolResultsType fpGetQueryPoolResults = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetQueryPoolResults"); + nextTable.GetQueryPoolResults = fpGetQueryPoolResults; + GetFormatInfoType fpGetFormatInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFormatInfo"); + nextTable.GetFormatInfo = fpGetFormatInfo; + CreateImageType fpCreateImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImage"); + nextTable.CreateImage = fpCreateImage; + GetImageSubresourceInfoType fpGetImageSubresourceInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetImageSubresourceInfo"); + nextTable.GetImageSubresourceInfo = fpGetImageSubresourceInfo; + CreateImageViewType fpCreateImageView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImageView"); + nextTable.CreateImageView = fpCreateImageView; + CreateColorAttachmentViewType fpCreateColorAttachmentView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorAttachmentView"); + nextTable.CreateColorAttachmentView = fpCreateColorAttachmentView; + CreateDepthStencilViewType fpCreateDepthStencilView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilView"); + nextTable.CreateDepthStencilView = fpCreateDepthStencilView; + CreateShaderType fpCreateShader = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateShader"); + nextTable.CreateShader = fpCreateShader; + CreateGraphicsPipelineType fpCreateGraphicsPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateGraphicsPipeline"); + nextTable.CreateGraphicsPipeline = fpCreateGraphicsPipeline; + CreateComputePipelineType fpCreateComputePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateComputePipeline"); + nextTable.CreateComputePipeline = fpCreateComputePipeline; + StorePipelineType fpStorePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglStorePipeline"); + nextTable.StorePipeline = fpStorePipeline; + LoadPipelineType fpLoadPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglLoadPipeline"); + nextTable.LoadPipeline = fpLoadPipeline; + CreatePipelineDeltaType fpCreatePipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreatePipelineDelta"); + nextTable.CreatePipelineDelta = fpCreatePipelineDelta; + CreateSamplerType fpCreateSampler = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateSampler"); + nextTable.CreateSampler = fpCreateSampler; + CreateDescriptorSetType fpCreateDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDescriptorSet"); + nextTable.CreateDescriptorSet = fpCreateDescriptorSet; + BeginDescriptorSetUpdateType fpBeginDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginDescriptorSetUpdate"); + nextTable.BeginDescriptorSetUpdate = fpBeginDescriptorSetUpdate; + EndDescriptorSetUpdateType fpEndDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndDescriptorSetUpdate"); + nextTable.EndDescriptorSetUpdate = fpEndDescriptorSetUpdate; + AttachSamplerDescriptorsType fpAttachSamplerDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachSamplerDescriptors"); + nextTable.AttachSamplerDescriptors = fpAttachSamplerDescriptors; + AttachImageViewDescriptorsType fpAttachImageViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachImageViewDescriptors"); + nextTable.AttachImageViewDescriptors = fpAttachImageViewDescriptors; + AttachMemoryViewDescriptorsType fpAttachMemoryViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachMemoryViewDescriptors"); + nextTable.AttachMemoryViewDescriptors = fpAttachMemoryViewDescriptors; + AttachNestedDescriptorsType fpAttachNestedDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachNestedDescriptors"); + nextTable.AttachNestedDescriptors = fpAttachNestedDescriptors; + ClearDescriptorSetSlotsType fpClearDescriptorSetSlots = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglClearDescriptorSetSlots"); + nextTable.ClearDescriptorSetSlots = fpClearDescriptorSetSlots; + CreateViewportStateType fpCreateViewportState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateViewportState"); + nextTable.CreateViewportState = fpCreateViewportState; + CreateRasterStateType fpCreateRasterState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateRasterState"); + nextTable.CreateRasterState = fpCreateRasterState; + CreateMsaaStateType fpCreateMsaaState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateMsaaState"); + nextTable.CreateMsaaState = fpCreateMsaaState; + CreateColorBlendStateType fpCreateColorBlendState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorBlendState"); + nextTable.CreateColorBlendState = fpCreateColorBlendState; + CreateDepthStencilStateType fpCreateDepthStencilState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilState"); + nextTable.CreateDepthStencilState = fpCreateDepthStencilState; + CreateCommandBufferType fpCreateCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateCommandBuffer"); + nextTable.CreateCommandBuffer = fpCreateCommandBuffer; + BeginCommandBufferType fpBeginCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginCommandBuffer"); + nextTable.BeginCommandBuffer = fpBeginCommandBuffer; + EndCommandBufferType fpEndCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndCommandBuffer"); + nextTable.EndCommandBuffer = fpEndCommandBuffer; + ResetCommandBufferType fpResetCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetCommandBuffer"); + nextTable.ResetCommandBuffer = fpResetCommandBuffer; + CmdBindPipelineType fpCmdBindPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipeline"); + nextTable.CmdBindPipeline = fpCmdBindPipeline; + CmdBindPipelineDeltaType fpCmdBindPipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipelineDelta"); + nextTable.CmdBindPipelineDelta = fpCmdBindPipelineDelta; + CmdBindStateObjectType fpCmdBindStateObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindStateObject"); + nextTable.CmdBindStateObject = fpCmdBindStateObject; + CmdBindDescriptorSetType fpCmdBindDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDescriptorSet"); + nextTable.CmdBindDescriptorSet = fpCmdBindDescriptorSet; + CmdBindDynamicMemoryViewType fpCmdBindDynamicMemoryView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDynamicMemoryView"); + nextTable.CmdBindDynamicMemoryView = fpCmdBindDynamicMemoryView; + CmdBindIndexDataType fpCmdBindIndexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindIndexData"); + nextTable.CmdBindIndexData = fpCmdBindIndexData; + CmdBindAttachmentsType fpCmdBindAttachments = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindAttachments"); + nextTable.CmdBindAttachments = fpCmdBindAttachments; + CmdPrepareMemoryRegionsType fpCmdPrepareMemoryRegions = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareMemoryRegions"); + nextTable.CmdPrepareMemoryRegions = fpCmdPrepareMemoryRegions; + CmdPrepareImagesType fpCmdPrepareImages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareImages"); + nextTable.CmdPrepareImages = fpCmdPrepareImages; + CmdDrawType fpCmdDraw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDraw"); + nextTable.CmdDraw = fpCmdDraw; + CmdDrawIndexedType fpCmdDrawIndexed = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexed"); + nextTable.CmdDrawIndexed = fpCmdDrawIndexed; + CmdDrawIndirectType fpCmdDrawIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndirect"); + nextTable.CmdDrawIndirect = fpCmdDrawIndirect; + CmdDrawIndexedIndirectType fpCmdDrawIndexedIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexedIndirect"); + nextTable.CmdDrawIndexedIndirect = fpCmdDrawIndexedIndirect; + CmdDispatchType fpCmdDispatch = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatch"); + nextTable.CmdDispatch = fpCmdDispatch; + CmdDispatchIndirectType fpCmdDispatchIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatchIndirect"); + nextTable.CmdDispatchIndirect = fpCmdDispatchIndirect; + CmdCopyMemoryType fpCmdCopyMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemory"); + nextTable.CmdCopyMemory = fpCmdCopyMemory; + CmdCopyImageType fpCmdCopyImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImage"); + nextTable.CmdCopyImage = fpCmdCopyImage; + CmdCopyMemoryToImageType fpCmdCopyMemoryToImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemoryToImage"); + nextTable.CmdCopyMemoryToImage = fpCmdCopyMemoryToImage; + CmdCopyImageToMemoryType fpCmdCopyImageToMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImageToMemory"); + nextTable.CmdCopyImageToMemory = fpCmdCopyImageToMemory; + CmdCloneImageDataType fpCmdCloneImageData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCloneImageData"); + nextTable.CmdCloneImageData = fpCmdCloneImageData; + CmdUpdateMemoryType fpCmdUpdateMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdUpdateMemory"); + nextTable.CmdUpdateMemory = fpCmdUpdateMemory; + CmdFillMemoryType fpCmdFillMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdFillMemory"); + nextTable.CmdFillMemory = fpCmdFillMemory; + CmdClearColorImageType fpCmdClearColorImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImage"); + nextTable.CmdClearColorImage = fpCmdClearColorImage; + CmdClearColorImageRawType fpCmdClearColorImageRaw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImageRaw"); + nextTable.CmdClearColorImageRaw = fpCmdClearColorImageRaw; + CmdClearDepthStencilType fpCmdClearDepthStencil = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearDepthStencil"); + nextTable.CmdClearDepthStencil = fpCmdClearDepthStencil; + CmdResolveImageType fpCmdResolveImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResolveImage"); + nextTable.CmdResolveImage = fpCmdResolveImage; + CmdSetEventType fpCmdSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSetEvent"); + nextTable.CmdSetEvent = fpCmdSetEvent; + CmdResetEventType fpCmdResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetEvent"); + nextTable.CmdResetEvent = fpCmdResetEvent; + CmdMemoryAtomicType fpCmdMemoryAtomic = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdMemoryAtomic"); + nextTable.CmdMemoryAtomic = fpCmdMemoryAtomic; + CmdBeginQueryType fpCmdBeginQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBeginQuery"); + nextTable.CmdBeginQuery = fpCmdBeginQuery; + CmdEndQueryType fpCmdEndQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdEndQuery"); + nextTable.CmdEndQuery = fpCmdEndQuery; + CmdResetQueryPoolType fpCmdResetQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetQueryPool"); + nextTable.CmdResetQueryPool = fpCmdResetQueryPool; + CmdWriteTimestampType fpCmdWriteTimestamp = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdWriteTimestamp"); + nextTable.CmdWriteTimestamp = fpCmdWriteTimestamp; + CmdInitAtomicCountersType fpCmdInitAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdInitAtomicCounters"); + nextTable.CmdInitAtomicCounters = fpCmdInitAtomicCounters; + CmdLoadAtomicCountersType fpCmdLoadAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdLoadAtomicCounters"); + nextTable.CmdLoadAtomicCounters = fpCmdLoadAtomicCounters; + CmdSaveAtomicCountersType fpCmdSaveAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSaveAtomicCounters"); + nextTable.CmdSaveAtomicCounters = fpCmdSaveAtomicCounters; + DbgSetValidationLevelType fpDbgSetValidationLevel = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetValidationLevel"); + nextTable.DbgSetValidationLevel = fpDbgSetValidationLevel; + DbgRegisterMsgCallbackType fpDbgRegisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgRegisterMsgCallback"); + nextTable.DbgRegisterMsgCallback = fpDbgRegisterMsgCallback; + DbgUnregisterMsgCallbackType fpDbgUnregisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgUnregisterMsgCallback"); + nextTable.DbgUnregisterMsgCallback = fpDbgUnregisterMsgCallback; + DbgSetMessageFilterType fpDbgSetMessageFilter = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetMessageFilter"); + nextTable.DbgSetMessageFilter = fpDbgSetMessageFilter; + DbgSetObjectTagType fpDbgSetObjectTag = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetObjectTag"); + nextTable.DbgSetObjectTag = fpDbgSetObjectTag; + DbgSetGlobalOptionType fpDbgSetGlobalOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetGlobalOption"); + nextTable.DbgSetGlobalOption = fpDbgSetGlobalOption; + DbgSetDeviceOptionType fpDbgSetDeviceOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetDeviceOption"); + nextTable.DbgSetDeviceOption = fpDbgSetDeviceOption; + CmdDbgMarkerBeginType fpCmdDbgMarkerBegin = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerBegin"); + nextTable.CmdDbgMarkerBegin = fpCmdDbgMarkerBegin; + CmdDbgMarkerEndType fpCmdDbgMarkerEnd = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerEnd"); + nextTable.CmdDbgMarkerEnd = fpCmdDbgMarkerEnd; + WsiX11AssociateConnectionType fpWsiX11AssociateConnection = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11AssociateConnection"); + nextTable.WsiX11AssociateConnection = fpWsiX11AssociateConnection; + WsiX11GetMSCType fpWsiX11GetMSC = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11GetMSC"); + nextTable.WsiX11GetMSC = fpWsiX11GetMSC; + WsiX11CreatePresentableImageType fpWsiX11CreatePresentableImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11CreatePresentableImage"); + nextTable.WsiX11CreatePresentableImage = fpWsiX11CreatePresentableImage; + WsiX11QueuePresentType fpWsiX11QueuePresent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11QueuePresent"); + nextTable.WsiX11QueuePresent = fpWsiX11QueuePresent; +} + + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.GetGpuInfo((XGL_PHYSICAL_GPU)gpuw->nextObject, infoType, pDataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetGpuInfo(gpu = %p, infoType = %s, pDataSize = %i, pData = %p) = %s\n", (void*)gpu, string_XGL_PHYSICAL_GPU_INFO_TYPE(infoType), *pDataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateDevice(gpu = %p, pCreateInfo = %p, pDevice = %p) = %s\n", (void*)gpu, (void*)pCreateInfo, (void*)*pDevice, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_device_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyDevice(XGL_DEVICE device) +{ + XGL_RESULT result = nextTable.DestroyDevice(device); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDestroyDevice(device = %p) = %s\n", (void*)device, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pExtName) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetExtensionSupport(gpu = %p, pExtName = %p) = %s\n", (void*)gpu, (void*)pExtName, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, XGL_SIZE maxLayerCount, XGL_SIZE maxStringSize, XGL_CHAR* const* pOutLayers, XGL_SIZE * pOutLayerCount) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglEnumerateLayers(gpu = %p, maxLayerCount = %i, maxStringSize = %i, pOutLayers = %p, pOutLayerCount = %i) = %s\n", (void*)gpu, maxLayerCount, maxStringSize, (void*)pOutLayers, *pOutLayerCount, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetDeviceQueue(XGL_DEVICE device, XGL_QUEUE_TYPE queueType, XGL_UINT queueIndex, XGL_QUEUE* pQueue) +{ + XGL_RESULT result = nextTable.GetDeviceQueue(device, queueType, queueIndex, pQueue); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetDeviceQueue(device = %p, queueType = %s, queueIndex = %i, pQueue = %p) = %s\n", (void*)device, string_XGL_QUEUE_TYPE(queueType), queueIndex, (void*)pQueue, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSubmit(XGL_QUEUE queue, XGL_UINT cmdBufferCount, const XGL_CMD_BUFFER* pCmdBuffers, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs, XGL_FENCE fence) +{ + XGL_RESULT result = nextTable.QueueSubmit(queue, cmdBufferCount, pCmdBuffers, memRefCount, pMemRefs, fence); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglQueueSubmit(queue = %p, cmdBufferCount = %i, pCmdBuffers = %p, memRefCount = %i, pMemRefs = %p, fence = %p) = %s\n", (void*)queue, cmdBufferCount, (void*)pCmdBuffers, memRefCount, (void*)pMemRefs, (void*)fence, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pMemRefs) { + pTmpStr = xgl_print_xgl_memory_ref(pMemRefs, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pMemRefs (%p)\n%s\n", (void*)pMemRefs, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSetGlobalMemReferences(XGL_QUEUE queue, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs) +{ + XGL_RESULT result = nextTable.QueueSetGlobalMemReferences(queue, memRefCount, pMemRefs); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglQueueSetGlobalMemReferences(queue = %p, memRefCount = %i, pMemRefs = %p) = %s\n", (void*)queue, memRefCount, (void*)pMemRefs, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pMemRefs) { + pTmpStr = xgl_print_xgl_memory_ref(pMemRefs, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pMemRefs (%p)\n%s\n", (void*)pMemRefs, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueWaitIdle(XGL_QUEUE queue) +{ + XGL_RESULT result = nextTable.QueueWaitIdle(queue); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglQueueWaitIdle(queue = %p) = %s\n", (void*)queue, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDeviceWaitIdle(XGL_DEVICE device) +{ + XGL_RESULT result = nextTable.DeviceWaitIdle(device); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDeviceWaitIdle(device = %p) = %s\n", (void*)device, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(XGL_DEVICE device, XGL_UINT* pCount) +{ + XGL_RESULT result = nextTable.GetMemoryHeapCount(device, pCount); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetMemoryHeapCount(device = %p, pCount = %i) = %s\n", (void*)device, *pCount, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapInfo(XGL_DEVICE device, XGL_UINT heapId, XGL_MEMORY_HEAP_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.GetMemoryHeapInfo(device, heapId, infoType, pDataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetMemoryHeapInfo(device = %p, heapId = %i, infoType = %s, pDataSize = %i, pData = %p) = %s\n", (void*)device, heapId, string_XGL_MEMORY_HEAP_INFO_TYPE(infoType), *pDataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem) +{ + XGL_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglAllocMemory(device = %p, pAllocInfo = %p, pMem = %p) = %s\n", (void*)device, (void*)pAllocInfo, (void*)*pMem, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pAllocInfo) { + pTmpStr = xgl_print_xgl_memory_alloc_info(pAllocInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pAllocInfo (%p)\n%s\n", (void*)pAllocInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglFreeMemory(XGL_GPU_MEMORY mem) +{ + XGL_RESULT result = nextTable.FreeMemory(mem); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglFreeMemory(mem = %p) = %s\n", (void*)mem, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetMemoryPriority(XGL_GPU_MEMORY mem, XGL_MEMORY_PRIORITY priority) +{ + XGL_RESULT result = nextTable.SetMemoryPriority(mem, priority); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglSetMemoryPriority(mem = %p, priority = %p) = %s\n", (void*)mem, (void*)priority, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglMapMemory(XGL_GPU_MEMORY mem, XGL_FLAGS flags, XGL_VOID** ppData) +{ + XGL_RESULT result = nextTable.MapMemory(mem, flags, ppData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglMapMemory(mem = %p, flags = %i, ppData = %p) = %s\n", (void*)mem, flags, (void*)ppData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglUnmapMemory(XGL_GPU_MEMORY mem) +{ + XGL_RESULT result = nextTable.UnmapMemory(mem); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglUnmapMemory(mem = %p) = %s\n", (void*)mem, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglPinSystemMemory(XGL_DEVICE device, const XGL_VOID* pSysMem, XGL_SIZE memSize, XGL_GPU_MEMORY* pMem) +{ + XGL_RESULT result = nextTable.PinSystemMemory(device, pSysMem, memSize, pMem); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglPinSystemMemory(device = %p, pSysMem = %p, memSize = %i, pMem = %p) = %s\n", (void*)device, (void*)pSysMem, memSize, (void*)pMem, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglRemapVirtualMemoryPages(XGL_DEVICE device, XGL_UINT rangeCount, const XGL_VIRTUAL_MEMORY_REMAP_RANGE* pRanges, XGL_UINT preWaitSemaphoreCount, const XGL_QUEUE_SEMAPHORE* pPreWaitSemaphores, XGL_UINT postSignalSemaphoreCount, const XGL_QUEUE_SEMAPHORE* pPostSignalSemaphores) +{ + XGL_RESULT result = nextTable.RemapVirtualMemoryPages(device, rangeCount, pRanges, preWaitSemaphoreCount, pPreWaitSemaphores, postSignalSemaphoreCount, pPostSignalSemaphores); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglRemapVirtualMemoryPages(device = %p, rangeCount = %i, pRanges = %p, preWaitSemaphoreCount = %i, pPreWaitSemaphores = %p, postSignalSemaphoreCount = %i, pPostSignalSemaphores = %p) = %s\n", (void*)device, rangeCount, (void*)pRanges, preWaitSemaphoreCount, (void*)pPreWaitSemaphores, postSignalSemaphoreCount, (void*)pPostSignalSemaphores, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pRanges) { + pTmpStr = xgl_print_xgl_virtual_memory_remap_range(pRanges, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRanges (%p)\n%s\n", (void*)pRanges, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMultiGpuCompatibility(XGL_PHYSICAL_GPU gpu0, XGL_PHYSICAL_GPU gpu1, XGL_GPU_COMPATIBILITY_INFO* pInfo) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu0; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.GetMultiGpuCompatibility((XGL_PHYSICAL_GPU)gpuw->nextObject, gpu1, pInfo); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetMultiGpuCompatibility(gpu0 = %p, gpu1 = %p, pInfo = %p) = %s\n", (void*)gpu0, (void*)gpu1, (void*)pInfo, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedMemory(XGL_DEVICE device, const XGL_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) +{ + XGL_RESULT result = nextTable.OpenSharedMemory(device, pOpenInfo, pMem); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglOpenSharedMemory(device = %p, pOpenInfo = %p, pMem = %p) = %s\n", (void*)device, (void*)pOpenInfo, (void*)pMem, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pOpenInfo) { + pTmpStr = xgl_print_xgl_memory_open_info(pOpenInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pOpenInfo (%p)\n%s\n", (void*)pOpenInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) +{ + XGL_RESULT result = nextTable.OpenSharedQueueSemaphore(device, pOpenInfo, pSemaphore); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglOpenSharedQueueSemaphore(device = %p, pOpenInfo = %p, pSemaphore = %p) = %s\n", (void*)device, (void*)pOpenInfo, (void*)pSemaphore, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerMemory(XGL_DEVICE device, const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) +{ + XGL_RESULT result = nextTable.OpenPeerMemory(device, pOpenInfo, pMem); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglOpenPeerMemory(device = %p, pOpenInfo = %p, pMem = %p) = %s\n", (void*)device, (void*)pOpenInfo, (void*)pMem, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pOpenInfo) { + pTmpStr = xgl_print_xgl_peer_memory_open_info(pOpenInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pOpenInfo (%p)\n%s\n", (void*)pOpenInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerImage(XGL_DEVICE device, const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem) +{ + XGL_RESULT result = nextTable.OpenPeerImage(device, pOpenInfo, pImage, pMem); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglOpenPeerImage(device = %p, pOpenInfo = %p, pImage = %p, pMem = %p) = %s\n", (void*)device, (void*)pOpenInfo, (void*)pImage, (void*)pMem, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pOpenInfo) { + pTmpStr = xgl_print_xgl_peer_image_open_info(pOpenInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pOpenInfo (%p)\n%s\n", (void*)pOpenInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyObject(XGL_OBJECT object) +{ + XGL_RESULT result = nextTable.DestroyObject(object); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDestroyObject(object = %p) = %s\n", (void*)object, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetObjectInfo(XGL_BASE_OBJECT object, XGL_OBJECT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetObjectInfo(object = %p, infoType = %s, pDataSize = %i, pData = %p) = %s\n", (void*)object, string_XGL_OBJECT_INFO_TYPE(infoType), *pDataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBindObjectMemory(XGL_OBJECT object, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) +{ + XGL_RESULT result = nextTable.BindObjectMemory(object, mem, offset); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglBindObjectMemory(object = %p, mem = %p, offset = %i) = %s\n", (void*)object, (void*)mem, offset, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateFence(XGL_DEVICE device, const XGL_FENCE_CREATE_INFO* pCreateInfo, XGL_FENCE* pFence) +{ + XGL_RESULT result = nextTable.CreateFence(device, pCreateInfo, pFence); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateFence(device = %p, pCreateInfo = %p, pFence = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pFence, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_fence_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFenceStatus(XGL_FENCE fence) +{ + XGL_RESULT result = nextTable.GetFenceStatus(fence); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetFenceStatus(fence = %p) = %s\n", (void*)fence, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitForFences(XGL_DEVICE device, XGL_UINT fenceCount, const XGL_FENCE* pFences, XGL_BOOL waitAll, XGL_UINT64 timeout) +{ + XGL_RESULT result = nextTable.WaitForFences(device, fenceCount, pFences, waitAll, timeout); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglWaitForFences(device = %p, fenceCount = %i, pFences = %p, waitAll = %u, timeout = %lu) = %s\n", (void*)device, fenceCount, (void*)pFences, waitAll, timeout, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) +{ + XGL_RESULT result = nextTable.CreateQueueSemaphore(device, pCreateInfo, pSemaphore); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateQueueSemaphore(device = %p, pCreateInfo = %p, pSemaphore = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pSemaphore, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_queue_semaphore_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSignalQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) +{ + XGL_RESULT result = nextTable.SignalQueueSemaphore(queue, semaphore); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglSignalQueueSemaphore(queue = %p, semaphore = %p) = %s\n", (void*)queue, (void*)semaphore, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) +{ + XGL_RESULT result = nextTable.WaitQueueSemaphore(queue, semaphore); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglWaitQueueSemaphore(queue = %p, semaphore = %p) = %s\n", (void*)queue, (void*)semaphore, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateEvent(XGL_DEVICE device, const XGL_EVENT_CREATE_INFO* pCreateInfo, XGL_EVENT* pEvent) +{ + XGL_RESULT result = nextTable.CreateEvent(device, pCreateInfo, pEvent); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateEvent(device = %p, pCreateInfo = %p, pEvent = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pEvent, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_event_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetEventStatus(XGL_EVENT event) +{ + XGL_RESULT result = nextTable.GetEventStatus(event); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetEventStatus(event = %p) = %s\n", (void*)event, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetEvent(XGL_EVENT event) +{ + XGL_RESULT result = nextTable.SetEvent(event); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglSetEvent(event = %p) = %s\n", (void*)event, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetEvent(XGL_EVENT event) +{ + XGL_RESULT result = nextTable.ResetEvent(event); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglResetEvent(event = %p) = %s\n", (void*)event, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueryPool(XGL_DEVICE device, const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo, XGL_QUERY_POOL* pQueryPool) +{ + XGL_RESULT result = nextTable.CreateQueryPool(device, pCreateInfo, pQueryPool); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateQueryPool(device = %p, pCreateInfo = %p, pQueryPool = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pQueryPool, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_query_pool_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetQueryPoolResults(XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.GetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetQueryPoolResults(queryPool = %p, startQuery = %i, queryCount = %i, pDataSize = %i, pData = %p) = %s\n", (void*)queryPool, startQuery, queryCount, *pDataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFormatInfo(XGL_DEVICE device, XGL_FORMAT format, XGL_FORMAT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.GetFormatInfo(device, format, infoType, pDataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetFormatInfo(device = %p, format.channelFormat = %s, format.numericFormat = %s, infoType = %i, pDataSize = %i, pData = %p) = %s\n", (void*)device, string_XGL_CHANNEL_FORMAT(format.channelFormat), string_XGL_NUM_FORMAT(format.numericFormat), infoType, *pDataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImage(XGL_DEVICE device, const XGL_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage) +{ + XGL_RESULT result = nextTable.CreateImage(device, pCreateInfo, pImage); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateImage(device = %p, pCreateInfo = %p, pImage = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pImage, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_image_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetImageSubresourceInfo(XGL_IMAGE image, const XGL_IMAGE_SUBRESOURCE* pSubresource, XGL_SUBRESOURCE_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.GetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglGetImageSubresourceInfo(image = %p, pSubresource = %p, infoType = %s, pDataSize = %i, pData = %p) = %s\n", (void*)image, (void*)pSubresource, string_XGL_SUBRESOURCE_INFO_TYPE(infoType), *pDataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pSubresource) { + pTmpStr = xgl_print_xgl_image_subresource(pSubresource, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pSubresource (%p)\n%s\n", (void*)pSubresource, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImageView(XGL_DEVICE device, const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo, XGL_IMAGE_VIEW* pView) +{ + XGL_RESULT result = nextTable.CreateImageView(device, pCreateInfo, pView); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateImageView(device = %p, pCreateInfo = %p, pView = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pView, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_image_view_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorAttachmentView(XGL_DEVICE device, const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo, XGL_COLOR_ATTACHMENT_VIEW* pView) +{ + XGL_RESULT result = nextTable.CreateColorAttachmentView(device, pCreateInfo, pView); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateColorAttachmentView(device = %p, pCreateInfo = %p, pView = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pView, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_color_attachment_view_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilView(XGL_DEVICE device, const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_VIEW* pView) +{ + XGL_RESULT result = nextTable.CreateDepthStencilView(device, pCreateInfo, pView); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateDepthStencilView(device = %p, pCreateInfo = %p, pView = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pView, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_depth_stencil_view_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateShader(XGL_DEVICE device, const XGL_SHADER_CREATE_INFO* pCreateInfo, XGL_SHADER* pShader) +{ + XGL_RESULT result = nextTable.CreateShader(device, pCreateInfo, pShader); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateShader(device = %p, pCreateInfo = %p, pShader = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pShader, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_shader_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateGraphicsPipeline(XGL_DEVICE device, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) +{ + XGL_RESULT result = nextTable.CreateGraphicsPipeline(device, pCreateInfo, pPipeline); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateGraphicsPipeline(device = %p, pCreateInfo = %p, pPipeline = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pPipeline, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_graphics_pipeline_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateComputePipeline(XGL_DEVICE device, const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) +{ + XGL_RESULT result = nextTable.CreateComputePipeline(device, pCreateInfo, pPipeline); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateComputePipeline(device = %p, pCreateInfo = %p, pPipeline = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pPipeline, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_compute_pipeline_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglStorePipeline(XGL_PIPELINE pipeline, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.StorePipeline(pipeline, pDataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglStorePipeline(pipeline = %p, pDataSize = %i, pData = %p) = %s\n", (void*)pipeline, *pDataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglLoadPipeline(XGL_DEVICE device, XGL_SIZE dataSize, const XGL_VOID* pData, XGL_PIPELINE* pPipeline) +{ + XGL_RESULT result = nextTable.LoadPipeline(device, dataSize, pData, pPipeline); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglLoadPipeline(device = %p, dataSize = %i, pData = %p, pPipeline = %p) = %s\n", (void*)device, dataSize, (void*)pData, (void*)pPipeline, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreatePipelineDelta(XGL_DEVICE device, XGL_PIPELINE p1, XGL_PIPELINE p2, XGL_PIPELINE_DELTA* delta) +{ + XGL_RESULT result = nextTable.CreatePipelineDelta(device, p1, p2, delta); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreatePipelineDelta(device = %p, p1 = %p, p2 = %p, delta = %p) = %s\n", (void*)device, (void*)p1, (void*)p2, (void*)*delta, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateSampler(XGL_DEVICE device, const XGL_SAMPLER_CREATE_INFO* pCreateInfo, XGL_SAMPLER* pSampler) +{ + XGL_RESULT result = nextTable.CreateSampler(device, pCreateInfo, pSampler); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateSampler(device = %p, pCreateInfo = %p, pSampler = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pSampler, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_sampler_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorSet(XGL_DEVICE device, const XGL_DESCRIPTOR_SET_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_SET* pDescriptorSet) +{ + XGL_RESULT result = nextTable.CreateDescriptorSet(device, pCreateInfo, pDescriptorSet); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateDescriptorSet(device = %p, pCreateInfo = %p, pDescriptorSet = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pDescriptorSet, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_descriptor_set_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglBeginDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) +{ + nextTable.BeginDescriptorSetUpdate(descriptorSet); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglBeginDescriptorSetUpdate(descriptorSet = %p)\n", (void*)descriptorSet); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglEndDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) +{ + nextTable.EndDescriptorSetUpdate(descriptorSet); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglEndDescriptorSetUpdate(descriptorSet = %p)\n", (void*)descriptorSet); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachSamplerDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_SAMPLER* pSamplers) +{ + nextTable.AttachSamplerDescriptors(descriptorSet, startSlot, slotCount, pSamplers); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglAttachSamplerDescriptors(descriptorSet = %p, startSlot = %i, slotCount = %i, pSamplers = %p)\n", (void*)descriptorSet, startSlot, slotCount, (void*)pSamplers); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachImageViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews) +{ + nextTable.AttachImageViewDescriptors(descriptorSet, startSlot, slotCount, pImageViews); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglAttachImageViewDescriptors(descriptorSet = %p, startSlot = %i, slotCount = %i, pImageViews = %p)\n", (void*)descriptorSet, startSlot, slotCount, (void*)pImageViews); + fclose(pOutFile); + char *pTmpStr; + if (pImageViews) { + pTmpStr = xgl_print_xgl_image_view_attach_info(pImageViews, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pImageViews (%p)\n%s\n", (void*)pImageViews, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachMemoryViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews) +{ + nextTable.AttachMemoryViewDescriptors(descriptorSet, startSlot, slotCount, pMemViews); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglAttachMemoryViewDescriptors(descriptorSet = %p, startSlot = %i, slotCount = %i, pMemViews = %p)\n", (void*)descriptorSet, startSlot, slotCount, (void*)pMemViews); + fclose(pOutFile); + char *pTmpStr; + if (pMemViews) { + pTmpStr = xgl_print_xgl_memory_view_attach_info(pMemViews, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pMemViews (%p)\n%s\n", (void*)pMemViews, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachNestedDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_DESCRIPTOR_SET_ATTACH_INFO* pNestedDescriptorSets) +{ + nextTable.AttachNestedDescriptors(descriptorSet, startSlot, slotCount, pNestedDescriptorSets); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglAttachNestedDescriptors(descriptorSet = %p, startSlot = %i, slotCount = %i, pNestedDescriptorSets = %p)\n", (void*)descriptorSet, startSlot, slotCount, (void*)pNestedDescriptorSets); + fclose(pOutFile); + char *pTmpStr; + if (pNestedDescriptorSets) { + pTmpStr = xgl_print_xgl_descriptor_set_attach_info(pNestedDescriptorSets, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pNestedDescriptorSets (%p)\n%s\n", (void*)pNestedDescriptorSets, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglClearDescriptorSetSlots(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount) +{ + nextTable.ClearDescriptorSetSlots(descriptorSet, startSlot, slotCount); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglClearDescriptorSetSlots(descriptorSet = %p, startSlot = %i, slotCount = %i)\n", (void*)descriptorSet, startSlot, slotCount); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateViewportState(XGL_DEVICE device, const XGL_VIEWPORT_STATE_CREATE_INFO* pCreateInfo, XGL_VIEWPORT_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateViewportState(device, pCreateInfo, pState); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateViewportState(device = %p, pCreateInfo = %p, pState = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pState, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_viewport_state_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateRasterState(XGL_DEVICE device, const XGL_RASTER_STATE_CREATE_INFO* pCreateInfo, XGL_RASTER_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateRasterState(device, pCreateInfo, pState); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateRasterState(device = %p, pCreateInfo = %p, pState = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pState, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_raster_state_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateMsaaState(XGL_DEVICE device, const XGL_MSAA_STATE_CREATE_INFO* pCreateInfo, XGL_MSAA_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateMsaaState(device, pCreateInfo, pState); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateMsaaState(device = %p, pCreateInfo = %p, pState = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pState, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_msaa_state_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorBlendState(XGL_DEVICE device, const XGL_COLOR_BLEND_STATE_CREATE_INFO* pCreateInfo, XGL_COLOR_BLEND_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateColorBlendState(device, pCreateInfo, pState); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateColorBlendState(device = %p, pCreateInfo = %p, pState = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pState, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_color_blend_state_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilState(XGL_DEVICE device, const XGL_DEPTH_STENCIL_STATE_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateDepthStencilState(device, pCreateInfo, pState); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateDepthStencilState(device = %p, pCreateInfo = %p, pState = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pState, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_depth_stencil_state_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateCommandBuffer(XGL_DEVICE device, const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo, XGL_CMD_BUFFER* pCmdBuffer) +{ + XGL_RESULT result = nextTable.CreateCommandBuffer(device, pCreateInfo, pCmdBuffer); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCreateCommandBuffer(device = %p, pCreateInfo = %p, pCmdBuffer = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)*pCmdBuffer, string_XGL_RESULT(result)); + fclose(pOutFile); + char *pTmpStr; + if (pCreateInfo) { + pTmpStr = xgl_print_xgl_cmd_buffer_create_info(pCreateInfo, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pCreateInfo (%p)\n%s\n", (void*)pCreateInfo, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBeginCommandBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_FLAGS flags) +{ + XGL_RESULT result = nextTable.BeginCommandBuffer(cmdBuffer, flags); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglBeginCommandBuffer(cmdBuffer = %p, flags = %i) = %s\n", (void*)cmdBuffer, flags, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEndCommandBuffer(XGL_CMD_BUFFER cmdBuffer) +{ + XGL_RESULT result = nextTable.EndCommandBuffer(cmdBuffer); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglEndCommandBuffer(cmdBuffer = %p) = %s\n", (void*)cmdBuffer, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetCommandBuffer(XGL_CMD_BUFFER cmdBuffer) +{ + XGL_RESULT result = nextTable.ResetCommandBuffer(cmdBuffer); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglResetCommandBuffer(cmdBuffer = %p) = %s\n", (void*)cmdBuffer, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipeline(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE pipeline) +{ + nextTable.CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdBindPipeline(cmdBuffer = %p, pipelineBindPoint = %i, pipeline = %p)\n", (void*)cmdBuffer, pipelineBindPoint, (void*)pipeline); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipelineDelta(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE_DELTA delta) +{ + nextTable.CmdBindPipelineDelta(cmdBuffer, pipelineBindPoint, delta); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdBindPipelineDelta(cmdBuffer = %p, pipelineBindPoint = %i, delta = %p)\n", (void*)cmdBuffer, pipelineBindPoint, (void*)delta); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindStateObject(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_STATE_OBJECT state) +{ + nextTable.CmdBindStateObject(cmdBuffer, stateBindPoint, state); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdBindStateObject(cmdBuffer = %p, stateBindPoint = %i, state = %p)\n", (void*)cmdBuffer, stateBindPoint, (void*)state); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDescriptorSet(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT index, XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT slotOffset) +{ + nextTable.CmdBindDescriptorSet(cmdBuffer, pipelineBindPoint, index, descriptorSet, slotOffset); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdBindDescriptorSet(cmdBuffer = %p, pipelineBindPoint = %i, index = %i, descriptorSet = %p, slotOffset = %i)\n", (void*)cmdBuffer, pipelineBindPoint, index, (void*)descriptorSet, slotOffset); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDynamicMemoryView(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView) +{ + nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdBindDynamicMemoryView(cmdBuffer = %p, pipelineBindPoint = %i, pMemView = %p)\n", (void*)cmdBuffer, pipelineBindPoint, (void*)pMemView); + fclose(pOutFile); + char *pTmpStr; + if (pMemView) { + pTmpStr = xgl_print_xgl_memory_view_attach_info(pMemView, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pMemView (%p)\n%s\n", (void*)pMemView, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType) +{ + nextTable.CmdBindIndexData(cmdBuffer, mem, offset, indexType); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdBindIndexData(cmdBuffer = %p, mem = %p, offset = %i, indexType = %s)\n", (void*)cmdBuffer, (void*)mem, offset, string_XGL_INDEX_TYPE(indexType)); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindAttachments(XGL_CMD_BUFFER cmdBuffer, XGL_UINT colorAttachmentCount, const XGL_COLOR_ATTACHMENT_BIND_INFO* pColorAttachments, const XGL_DEPTH_STENCIL_BIND_INFO* pDepthStencilAttachment) +{ + nextTable.CmdBindAttachments(cmdBuffer, colorAttachmentCount, pColorAttachments, pDepthStencilAttachment); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdBindAttachments(cmdBuffer = %p, colorAttachmentCount = %i, pColorAttachments = %p, pDepthStencilAttachment = %p)\n", (void*)cmdBuffer, colorAttachmentCount, (void*)pColorAttachments, (void*)pDepthStencilAttachment); + fclose(pOutFile); + char *pTmpStr; + if (pColorAttachments) { + pTmpStr = xgl_print_xgl_color_attachment_bind_info(pColorAttachments, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pColorAttachments (%p)\n%s\n", (void*)pColorAttachments, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } + if (pDepthStencilAttachment) { + pTmpStr = xgl_print_xgl_depth_stencil_bind_info(pDepthStencilAttachment, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pDepthStencilAttachment (%p)\n%s\n", (void*)pDepthStencilAttachment, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareMemoryRegions(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_MEMORY_STATE_TRANSITION* pStateTransitions) +{ + nextTable.CmdPrepareMemoryRegions(cmdBuffer, transitionCount, pStateTransitions); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdPrepareMemoryRegions(cmdBuffer = %p, transitionCount = %i, pStateTransitions = %p)\n", (void*)cmdBuffer, transitionCount, (void*)pStateTransitions); + fclose(pOutFile); + char *pTmpStr; + if (pStateTransitions) { + pTmpStr = xgl_print_xgl_memory_state_transition(pStateTransitions, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pStateTransitions (%p)\n%s\n", (void*)pStateTransitions, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareImages(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_IMAGE_STATE_TRANSITION* pStateTransitions) +{ + nextTable.CmdPrepareImages(cmdBuffer, transitionCount, pStateTransitions); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdPrepareImages(cmdBuffer = %p, transitionCount = %i, pStateTransitions = %p)\n", (void*)cmdBuffer, transitionCount, (void*)pStateTransitions); + fclose(pOutFile); + char *pTmpStr; + if (pStateTransitions) { + pTmpStr = xgl_print_xgl_image_state_transition(pStateTransitions, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pStateTransitions (%p)\n%s\n", (void*)pStateTransitions, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDraw(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstVertex, XGL_UINT vertexCount, XGL_UINT firstInstance, XGL_UINT instanceCount) +{ + nextTable.CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdDraw(cmdBuffer = %p, firstVertex = %i, vertexCount = %i, firstInstance = %i, instanceCount = %i)\n", (void*)cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndexed(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstIndex, XGL_UINT indexCount, XGL_INT vertexOffset, XGL_UINT firstInstance, XGL_UINT instanceCount) +{ + nextTable.CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdDrawIndexed(cmdBuffer = %p, firstIndex = %i, indexCount = %i, vertexOffset = %i, firstInstance = %i, instanceCount = %i)\n", (void*)cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT32 count, XGL_UINT32 stride) +{ + nextTable.CmdDrawIndirect(cmdBuffer, mem, offset, count, stride); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdDrawIndirect(cmdBuffer = %p, mem = %p, offset = %i, count = %i, stride = %i)\n", (void*)cmdBuffer, (void*)mem, offset, count, stride); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndexedIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT32 count, XGL_UINT32 stride) +{ + nextTable.CmdDrawIndexedIndirect(cmdBuffer, mem, offset, count, stride); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdDrawIndexedIndirect(cmdBuffer = %p, mem = %p, offset = %i, count = %i, stride = %i)\n", (void*)cmdBuffer, (void*)mem, offset, count, stride); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatch(XGL_CMD_BUFFER cmdBuffer, XGL_UINT x, XGL_UINT y, XGL_UINT z) +{ + nextTable.CmdDispatch(cmdBuffer, x, y, z); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdDispatch(cmdBuffer = %p, x = %i, y = %i, z = %i)\n", (void*)cmdBuffer, x, y, z); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatchIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) +{ + nextTable.CmdDispatchIndirect(cmdBuffer, mem, offset); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdDispatchIndirect(cmdBuffer = %p, mem = %p, offset = %i)\n", (void*)cmdBuffer, (void*)mem, offset); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY srcMem, XGL_GPU_MEMORY destMem, XGL_UINT regionCount, const XGL_MEMORY_COPY* pRegions) +{ + nextTable.CmdCopyMemory(cmdBuffer, srcMem, destMem, regionCount, pRegions); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdCopyMemory(cmdBuffer = %p, srcMem = %p, destMem = %p, regionCount = %i, pRegions = %p)\n", (void*)cmdBuffer, (void*)srcMem, (void*)destMem, regionCount, (void*)pRegions); + fclose(pOutFile); + char *pTmpStr; + if (pRegions) { + pTmpStr = xgl_print_xgl_memory_copy(pRegions, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRegions (%p)\n%s\n", (void*)pRegions, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, XGL_UINT regionCount, const XGL_IMAGE_COPY* pRegions) +{ + nextTable.CmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdCopyImage(cmdBuffer = %p, srcImage = %p, destImage = %p, regionCount = %i, pRegions = %p)\n", (void*)cmdBuffer, (void*)srcImage, (void*)destImage, regionCount, (void*)pRegions); + fclose(pOutFile); + char *pTmpStr; + if (pRegions) { + pTmpStr = xgl_print_xgl_image_copy(pRegions, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRegions (%p)\n%s\n", (void*)pRegions, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyMemoryToImage(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY srcMem, XGL_IMAGE destImage, XGL_UINT regionCount, const XGL_MEMORY_IMAGE_COPY* pRegions) +{ + nextTable.CmdCopyMemoryToImage(cmdBuffer, srcMem, destImage, regionCount, pRegions); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdCopyMemoryToImage(cmdBuffer = %p, srcMem = %p, destImage = %p, regionCount = %i, pRegions = %p)\n", (void*)cmdBuffer, (void*)srcMem, (void*)destImage, regionCount, (void*)pRegions); + fclose(pOutFile); + char *pTmpStr; + if (pRegions) { + pTmpStr = xgl_print_xgl_memory_image_copy(pRegions, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRegions (%p)\n%s\n", (void*)pRegions, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyImageToMemory(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_GPU_MEMORY destMem, XGL_UINT regionCount, const XGL_MEMORY_IMAGE_COPY* pRegions) +{ + nextTable.CmdCopyImageToMemory(cmdBuffer, srcImage, destMem, regionCount, pRegions); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdCopyImageToMemory(cmdBuffer = %p, srcImage = %p, destMem = %p, regionCount = %i, pRegions = %p)\n", (void*)cmdBuffer, (void*)srcImage, (void*)destMem, regionCount, (void*)pRegions); + fclose(pOutFile); + char *pTmpStr; + if (pRegions) { + pTmpStr = xgl_print_xgl_memory_image_copy(pRegions, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRegions (%p)\n%s\n", (void*)pRegions, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCloneImageData(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_STATE srcImageState, XGL_IMAGE destImage, XGL_IMAGE_STATE destImageState) +{ + nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageState, destImage, destImageState); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdCloneImageData(cmdBuffer = %p, srcImage = %p, srcImageState = %p, destImage = %p, destImageState = %p)\n", (void*)cmdBuffer, (void*)srcImage, (void*)srcImageState, (void*)destImage, (void*)destImageState); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdUpdateMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_GPU_SIZE dataSize, const XGL_UINT32* pData) +{ + nextTable.CmdUpdateMemory(cmdBuffer, destMem, destOffset, dataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdUpdateMemory(cmdBuffer = %p, destMem = %p, destOffset = %i, dataSize = %i, pData = %i)\n", (void*)cmdBuffer, (void*)destMem, destOffset, dataSize, *pData); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdFillMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_GPU_SIZE fillSize, XGL_UINT32 data) +{ + nextTable.CmdFillMemory(cmdBuffer, destMem, destOffset, fillSize, data); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdFillMemory(cmdBuffer = %p, destMem = %p, destOffset = %i, fillSize = %i, data = %i)\n", (void*)cmdBuffer, (void*)destMem, destOffset, fillSize, data); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearColorImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, const XGL_FLOAT color[4], XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) +{ + nextTable.CmdClearColorImage(cmdBuffer, image, color, rangeCount, pRanges); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdClearColorImage(cmdBuffer = %p, image = %p, color = [%f, %f, %f, %f], rangeCount = %i, pRanges = %p)\n", (void*)cmdBuffer, (void*)image, color[0], color[1], color[2], color[3], rangeCount, (void*)pRanges); + fclose(pOutFile); + char *pTmpStr; + if (pRanges) { + pTmpStr = xgl_print_xgl_image_subresource_range(pRanges, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRanges (%p)\n%s\n", (void*)pRanges, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearColorImageRaw(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, const XGL_UINT32 color[4], XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) +{ + nextTable.CmdClearColorImageRaw(cmdBuffer, image, color, rangeCount, pRanges); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdClearColorImageRaw(cmdBuffer = %p, image = %p, color = [%i, %i, %i, %i], rangeCount = %i, pRanges = %p)\n", (void*)cmdBuffer, (void*)image, color[0], color[1], color[2], color[3], rangeCount, (void*)pRanges); + fclose(pOutFile); + char *pTmpStr; + if (pRanges) { + pTmpStr = xgl_print_xgl_image_subresource_range(pRanges, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRanges (%p)\n%s\n", (void*)pRanges, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearDepthStencil(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, XGL_FLOAT depth, XGL_UINT32 stencil, XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) +{ + nextTable.CmdClearDepthStencil(cmdBuffer, image, depth, stencil, rangeCount, pRanges); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdClearDepthStencil(cmdBuffer = %p, image = %p, depth = %f, stencil = %i, rangeCount = %i, pRanges = %p)\n", (void*)cmdBuffer, (void*)image, depth, stencil, rangeCount, (void*)pRanges); + fclose(pOutFile); + char *pTmpStr; + if (pRanges) { + pTmpStr = xgl_print_xgl_image_subresource_range(pRanges, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRanges (%p)\n%s\n", (void*)pRanges, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResolveImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, XGL_UINT rectCount, const XGL_IMAGE_RESOLVE* pRects) +{ + nextTable.CmdResolveImage(cmdBuffer, srcImage, destImage, rectCount, pRects); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdResolveImage(cmdBuffer = %p, srcImage = %p, destImage = %p, rectCount = %i, pRects = %p)\n", (void*)cmdBuffer, (void*)srcImage, (void*)destImage, rectCount, (void*)pRects); + fclose(pOutFile); + char *pTmpStr; + if (pRects) { + pTmpStr = xgl_print_xgl_image_resolve(pRects, " "); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, " pRects (%p)\n%s\n", (void*)pRects, pTmpStr); + fclose(pOutFile); + free(pTmpStr); + } +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) +{ + nextTable.CmdSetEvent(cmdBuffer, event); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdSetEvent(cmdBuffer = %p, event = %p)\n", (void*)cmdBuffer, (void*)event); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) +{ + nextTable.CmdResetEvent(cmdBuffer, event); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdResetEvent(cmdBuffer = %p, event = %p)\n", (void*)cmdBuffer, (void*)event); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdMemoryAtomic(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_UINT64 srcData, XGL_ATOMIC_OP atomicOp) +{ + nextTable.CmdMemoryAtomic(cmdBuffer, destMem, destOffset, srcData, atomicOp); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdMemoryAtomic(cmdBuffer = %p, destMem = %p, destOffset = %i, srcData = %lu, atomicOp = %p)\n", (void*)cmdBuffer, (void*)destMem, destOffset, srcData, (void*)atomicOp); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBeginQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot, XGL_FLAGS flags) +{ + nextTable.CmdBeginQuery(cmdBuffer, queryPool, slot, flags); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdBeginQuery(cmdBuffer = %p, queryPool = %p, slot = %i, flags = %i)\n", (void*)cmdBuffer, (void*)queryPool, slot, flags); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdEndQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot) +{ + nextTable.CmdEndQuery(cmdBuffer, queryPool, slot); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdEndQuery(cmdBuffer = %p, queryPool = %p, slot = %i)\n", (void*)cmdBuffer, (void*)queryPool, slot); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetQueryPool(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount) +{ + nextTable.CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdResetQueryPool(cmdBuffer = %p, queryPool = %p, startQuery = %i, queryCount = %i)\n", (void*)cmdBuffer, (void*)queryPool, startQuery, queryCount); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdWriteTimestamp(XGL_CMD_BUFFER cmdBuffer, XGL_TIMESTAMP_TYPE timestampType, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset) +{ + nextTable.CmdWriteTimestamp(cmdBuffer, timestampType, destMem, destOffset); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdWriteTimestamp(cmdBuffer = %p, timestampType = %s, destMem = %p, destOffset = %i)\n", (void*)cmdBuffer, string_XGL_TIMESTAMP_TYPE(timestampType), (void*)destMem, destOffset); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdInitAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, const XGL_UINT32* pData) +{ + nextTable.CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdInitAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %i, startCounter = %i, counterCount = %i, pData = %i)\n", (void*)cmdBuffer, pipelineBindPoint, startCounter, counterCount, *pData); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdLoadAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, XGL_GPU_MEMORY srcMem, XGL_GPU_SIZE srcOffset) +{ + nextTable.CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcMem, srcOffset); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdLoadAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %i, startCounter = %i, counterCount = %i, srcMem = %p, srcOffset = %i)\n", (void*)cmdBuffer, pipelineBindPoint, startCounter, counterCount, (void*)srcMem, srcOffset); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSaveAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset) +{ + nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destMem, destOffset); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdSaveAtomicCounters(cmdBuffer = %p, pipelineBindPoint = %i, startCounter = %i, counterCount = %i, destMem = %p, destOffset = %i)\n", (void*)cmdBuffer, pipelineBindPoint, startCounter, counterCount, (void*)destMem, destOffset); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetValidationLevel(XGL_DEVICE device, XGL_VALIDATION_LEVEL validationLevel) +{ + XGL_RESULT result = nextTable.DbgSetValidationLevel(device, validationLevel); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDbgSetValidationLevel(device = %p, validationLevel = %p) = %s\n", (void*)device, (void*)validationLevel, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgRegisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, XGL_VOID* pUserData) +{ + XGL_RESULT result = nextTable.DbgRegisterMsgCallback(pfnMsgCallback, pUserData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDbgRegisterMsgCallback(pfnMsgCallback = %p, pUserData = %p) = %s\n", (void*)pfnMsgCallback, (void*)pUserData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgUnregisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback) +{ + XGL_RESULT result = nextTable.DbgUnregisterMsgCallback(pfnMsgCallback); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDbgUnregisterMsgCallback(pfnMsgCallback = %p) = %s\n", (void*)pfnMsgCallback, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetMessageFilter(XGL_DEVICE device, XGL_INT msgCode, XGL_DBG_MSG_FILTER filter) +{ + XGL_RESULT result = nextTable.DbgSetMessageFilter(device, msgCode, filter); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDbgSetMessageFilter(device = %p, msgCode = %i, filter = %p) = %s\n", (void*)device, msgCode, (void*)filter, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetObjectTag(XGL_BASE_OBJECT object, XGL_SIZE tagSize, const XGL_VOID* pTag) +{ + XGL_RESULT result = nextTable.DbgSetObjectTag(object, tagSize, pTag); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDbgSetObjectTag(object = %p, tagSize = %i, pTag = %p) = %s\n", (void*)object, tagSize, (void*)pTag, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetGlobalOption(XGL_DBG_GLOBAL_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.DbgSetGlobalOption(dbgOption, dataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDbgSetGlobalOption(dbgOption = %p, dataSize = %i, pData = %p) = %s\n", (void*)dbgOption, dataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetDeviceOption(XGL_DEVICE device, XGL_DBG_DEVICE_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.DbgSetDeviceOption(device, dbgOption, dataSize, pData); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglDbgSetDeviceOption(device = %p, dbgOption = %p, dataSize = %i, pData = %p) = %s\n", (void*)device, (void*)dbgOption, dataSize, (void*)pData, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerBegin(XGL_CMD_BUFFER cmdBuffer, const XGL_CHAR* pMarker) +{ + nextTable.CmdDbgMarkerBegin(cmdBuffer, pMarker); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdDbgMarkerBegin(cmdBuffer = %p, pMarker = %p)\n", (void*)cmdBuffer, (void*)pMarker); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerEnd(XGL_CMD_BUFFER cmdBuffer) +{ + nextTable.CmdDbgMarkerEnd(cmdBuffer); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglCmdDbgMarkerEnd(cmdBuffer = %p)\n", (void*)cmdBuffer); + fclose(pOutFile); +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11AssociateConnection(XGL_PHYSICAL_GPU gpu, const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.WsiX11AssociateConnection((XGL_PHYSICAL_GPU)gpuw->nextObject, pConnectionInfo); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglWsiX11AssociateConnection(gpu = %p, pConnectionInfo = %p) = %s\n", (void*)gpu, (void*)pConnectionInfo, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11GetMSC(XGL_DEVICE device, xcb_randr_crtc_t crtc, XGL_UINT64* pMsc) +{ + XGL_RESULT result = nextTable.WsiX11GetMSC(device, crtc, pMsc); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglWsiX11GetMSC(device = %p, crtc = %u, pMsc = %lu) = %s\n", (void*)device, crtc, *pMsc, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11CreatePresentableImage(XGL_DEVICE device, const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem) +{ + XGL_RESULT result = nextTable.WsiX11CreatePresentableImage(device, pCreateInfo, pImage, pMem); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglWsiX11CreatePresentableImage(device = %p, pCreateInfo = %p, pImage = %p, pMem = %p) = %s\n", (void*)device, (void*)pCreateInfo, (void*)pImage, (void*)pMem, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11QueuePresent(XGL_QUEUE queue, const XGL_WSI_X11_PRESENT_INFO* pPresentInfo, XGL_FENCE fence) +{ + XGL_RESULT result = nextTable.WsiX11QueuePresent(queue, pPresentInfo, fence); + pOutFile = fopen(outFileName, "a"); + fprintf(pOutFile, "xglWsiX11QueuePresent(queue = %p, pPresentInfo = %p, fence = %p) = %s\n", (void*)queue, (void*)pPresentInfo, (void*)fence, string_XGL_RESULT(result)); + fclose(pOutFile); + return result; +} + +XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* funcName) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + if (gpu == NULL) + return NULL; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + + if (!strncmp("xglGetProcAddr", (const char *) funcName, sizeof("xglGetProcAddr"))) + return xglGetProcAddr; + else if (!strncmp("xglInitAndEnumerateGpus", (const char *) funcName, sizeof("xglInitAndEnumerateGpus"))) + return nextTable.InitAndEnumerateGpus; + else if (!strncmp("xglGetGpuInfo", (const char *) funcName, sizeof("xglGetGpuInfo"))) + return xglGetGpuInfo; + else if (!strncmp("xglCreateDevice", (const char *) funcName, sizeof("xglCreateDevice"))) + return xglCreateDevice; + else if (!strncmp("xglDestroyDevice", (const char *) funcName, sizeof("xglDestroyDevice"))) + return xglDestroyDevice; + else if (!strncmp("xglGetExtensionSupport", (const char *) funcName, sizeof("xglGetExtensionSupport"))) + return xglGetExtensionSupport; + else if (!strncmp("xglEnumerateLayers", (const char *) funcName, sizeof("xglEnumerateLayers"))) + return xglEnumerateLayers; + else if (!strncmp("xglGetDeviceQueue", (const char *) funcName, sizeof("xglGetDeviceQueue"))) + return xglGetDeviceQueue; + else if (!strncmp("xglQueueSubmit", (const char *) funcName, sizeof("xglQueueSubmit"))) + return xglQueueSubmit; + else if (!strncmp("xglQueueSetGlobalMemReferences", (const char *) funcName, sizeof("xglQueueSetGlobalMemReferences"))) + return xglQueueSetGlobalMemReferences; + else if (!strncmp("xglQueueWaitIdle", (const char *) funcName, sizeof("xglQueueWaitIdle"))) + return xglQueueWaitIdle; + else if (!strncmp("xglDeviceWaitIdle", (const char *) funcName, sizeof("xglDeviceWaitIdle"))) + return xglDeviceWaitIdle; + else if (!strncmp("xglGetMemoryHeapCount", (const char *) funcName, sizeof("xglGetMemoryHeapCount"))) + return xglGetMemoryHeapCount; + else if (!strncmp("xglGetMemoryHeapInfo", (const char *) funcName, sizeof("xglGetMemoryHeapInfo"))) + return xglGetMemoryHeapInfo; + else if (!strncmp("xglAllocMemory", (const char *) funcName, sizeof("xglAllocMemory"))) + return xglAllocMemory; + else if (!strncmp("xglFreeMemory", (const char *) funcName, sizeof("xglFreeMemory"))) + return xglFreeMemory; + else if (!strncmp("xglSetMemoryPriority", (const char *) funcName, sizeof("xglSetMemoryPriority"))) + return xglSetMemoryPriority; + else if (!strncmp("xglMapMemory", (const char *) funcName, sizeof("xglMapMemory"))) + return xglMapMemory; + else if (!strncmp("xglUnmapMemory", (const char *) funcName, sizeof("xglUnmapMemory"))) + return xglUnmapMemory; + else if (!strncmp("xglPinSystemMemory", (const char *) funcName, sizeof("xglPinSystemMemory"))) + return xglPinSystemMemory; + else if (!strncmp("xglRemapVirtualMemoryPages", (const char *) funcName, sizeof("xglRemapVirtualMemoryPages"))) + return xglRemapVirtualMemoryPages; + else if (!strncmp("xglGetMultiGpuCompatibility", (const char *) funcName, sizeof("xglGetMultiGpuCompatibility"))) + return xglGetMultiGpuCompatibility; + else if (!strncmp("xglOpenSharedMemory", (const char *) funcName, sizeof("xglOpenSharedMemory"))) + return xglOpenSharedMemory; + else if (!strncmp("xglOpenSharedQueueSemaphore", (const char *) funcName, sizeof("xglOpenSharedQueueSemaphore"))) + return xglOpenSharedQueueSemaphore; + else if (!strncmp("xglOpenPeerMemory", (const char *) funcName, sizeof("xglOpenPeerMemory"))) + return xglOpenPeerMemory; + else if (!strncmp("xglOpenPeerImage", (const char *) funcName, sizeof("xglOpenPeerImage"))) + return xglOpenPeerImage; + else if (!strncmp("xglDestroyObject", (const char *) funcName, sizeof("xglDestroyObject"))) + return xglDestroyObject; + else if (!strncmp("xglGetObjectInfo", (const char *) funcName, sizeof("xglGetObjectInfo"))) + return xglGetObjectInfo; + else if (!strncmp("xglBindObjectMemory", (const char *) funcName, sizeof("xglBindObjectMemory"))) + return xglBindObjectMemory; + else if (!strncmp("xglCreateFence", (const char *) funcName, sizeof("xglCreateFence"))) + return xglCreateFence; + else if (!strncmp("xglGetFenceStatus", (const char *) funcName, sizeof("xglGetFenceStatus"))) + return xglGetFenceStatus; + else if (!strncmp("xglWaitForFences", (const char *) funcName, sizeof("xglWaitForFences"))) + return xglWaitForFences; + else if (!strncmp("xglCreateQueueSemaphore", (const char *) funcName, sizeof("xglCreateQueueSemaphore"))) + return xglCreateQueueSemaphore; + else if (!strncmp("xglSignalQueueSemaphore", (const char *) funcName, sizeof("xglSignalQueueSemaphore"))) + return xglSignalQueueSemaphore; + else if (!strncmp("xglWaitQueueSemaphore", (const char *) funcName, sizeof("xglWaitQueueSemaphore"))) + return xglWaitQueueSemaphore; + else if (!strncmp("xglCreateEvent", (const char *) funcName, sizeof("xglCreateEvent"))) + return xglCreateEvent; + else if (!strncmp("xglGetEventStatus", (const char *) funcName, sizeof("xglGetEventStatus"))) + return xglGetEventStatus; + else if (!strncmp("xglSetEvent", (const char *) funcName, sizeof("xglSetEvent"))) + return xglSetEvent; + else if (!strncmp("xglResetEvent", (const char *) funcName, sizeof("xglResetEvent"))) + return xglResetEvent; + else if (!strncmp("xglCreateQueryPool", (const char *) funcName, sizeof("xglCreateQueryPool"))) + return xglCreateQueryPool; + else if (!strncmp("xglGetQueryPoolResults", (const char *) funcName, sizeof("xglGetQueryPoolResults"))) + return xglGetQueryPoolResults; + else if (!strncmp("xglGetFormatInfo", (const char *) funcName, sizeof("xglGetFormatInfo"))) + return xglGetFormatInfo; + else if (!strncmp("xglCreateImage", (const char *) funcName, sizeof("xglCreateImage"))) + return xglCreateImage; + else if (!strncmp("xglGetImageSubresourceInfo", (const char *) funcName, sizeof("xglGetImageSubresourceInfo"))) + return xglGetImageSubresourceInfo; + else if (!strncmp("xglCreateImageView", (const char *) funcName, sizeof("xglCreateImageView"))) + return xglCreateImageView; + else if (!strncmp("xglCreateColorAttachmentView", (const char *) funcName, sizeof("xglCreateColorAttachmentView"))) + return xglCreateColorAttachmentView; + else if (!strncmp("xglCreateDepthStencilView", (const char *) funcName, sizeof("xglCreateDepthStencilView"))) + return xglCreateDepthStencilView; + else if (!strncmp("xglCreateShader", (const char *) funcName, sizeof("xglCreateShader"))) + return xglCreateShader; + else if (!strncmp("xglCreateGraphicsPipeline", (const char *) funcName, sizeof("xglCreateGraphicsPipeline"))) + return xglCreateGraphicsPipeline; + else if (!strncmp("xglCreateComputePipeline", (const char *) funcName, sizeof("xglCreateComputePipeline"))) + return xglCreateComputePipeline; + else if (!strncmp("xglStorePipeline", (const char *) funcName, sizeof("xglStorePipeline"))) + return xglStorePipeline; + else if (!strncmp("xglLoadPipeline", (const char *) funcName, sizeof("xglLoadPipeline"))) + return xglLoadPipeline; + else if (!strncmp("xglCreatePipelineDelta", (const char *) funcName, sizeof("xglCreatePipelineDelta"))) + return xglCreatePipelineDelta; + else if (!strncmp("xglCreateSampler", (const char *) funcName, sizeof("xglCreateSampler"))) + return xglCreateSampler; + else if (!strncmp("xglCreateDescriptorSet", (const char *) funcName, sizeof("xglCreateDescriptorSet"))) + return xglCreateDescriptorSet; + else if (!strncmp("xglBeginDescriptorSetUpdate", (const char *) funcName, sizeof("xglBeginDescriptorSetUpdate"))) + return xglBeginDescriptorSetUpdate; + else if (!strncmp("xglEndDescriptorSetUpdate", (const char *) funcName, sizeof("xglEndDescriptorSetUpdate"))) + return xglEndDescriptorSetUpdate; + else if (!strncmp("xglAttachSamplerDescriptors", (const char *) funcName, sizeof("xglAttachSamplerDescriptors"))) + return xglAttachSamplerDescriptors; + else if (!strncmp("xglAttachImageViewDescriptors", (const char *) funcName, sizeof("xglAttachImageViewDescriptors"))) + return xglAttachImageViewDescriptors; + else if (!strncmp("xglAttachMemoryViewDescriptors", (const char *) funcName, sizeof("xglAttachMemoryViewDescriptors"))) + return xglAttachMemoryViewDescriptors; + else if (!strncmp("xglAttachNestedDescriptors", (const char *) funcName, sizeof("xglAttachNestedDescriptors"))) + return xglAttachNestedDescriptors; + else if (!strncmp("xglClearDescriptorSetSlots", (const char *) funcName, sizeof("xglClearDescriptorSetSlots"))) + return xglClearDescriptorSetSlots; + else if (!strncmp("xglCreateViewportState", (const char *) funcName, sizeof("xglCreateViewportState"))) + return xglCreateViewportState; + else if (!strncmp("xglCreateRasterState", (const char *) funcName, sizeof("xglCreateRasterState"))) + return xglCreateRasterState; + else if (!strncmp("xglCreateMsaaState", (const char *) funcName, sizeof("xglCreateMsaaState"))) + return xglCreateMsaaState; + else if (!strncmp("xglCreateColorBlendState", (const char *) funcName, sizeof("xglCreateColorBlendState"))) + return xglCreateColorBlendState; + else if (!strncmp("xglCreateDepthStencilState", (const char *) funcName, sizeof("xglCreateDepthStencilState"))) + return xglCreateDepthStencilState; + else if (!strncmp("xglCreateCommandBuffer", (const char *) funcName, sizeof("xglCreateCommandBuffer"))) + return xglCreateCommandBuffer; + else if (!strncmp("xglBeginCommandBuffer", (const char *) funcName, sizeof("xglBeginCommandBuffer"))) + return xglBeginCommandBuffer; + else if (!strncmp("xglEndCommandBuffer", (const char *) funcName, sizeof("xglEndCommandBuffer"))) + return xglEndCommandBuffer; + else if (!strncmp("xglResetCommandBuffer", (const char *) funcName, sizeof("xglResetCommandBuffer"))) + return xglResetCommandBuffer; + else if (!strncmp("xglCmdBindPipeline", (const char *) funcName, sizeof("xglCmdBindPipeline"))) + return xglCmdBindPipeline; + else if (!strncmp("xglCmdBindPipelineDelta", (const char *) funcName, sizeof("xglCmdBindPipelineDelta"))) + return xglCmdBindPipelineDelta; + else if (!strncmp("xglCmdBindStateObject", (const char *) funcName, sizeof("xglCmdBindStateObject"))) + return xglCmdBindStateObject; + else if (!strncmp("xglCmdBindDescriptorSet", (const char *) funcName, sizeof("xglCmdBindDescriptorSet"))) + return xglCmdBindDescriptorSet; + else if (!strncmp("xglCmdBindDynamicMemoryView", (const char *) funcName, sizeof("xglCmdBindDynamicMemoryView"))) + return xglCmdBindDynamicMemoryView; + else if (!strncmp("xglCmdBindIndexData", (const char *) funcName, sizeof("xglCmdBindIndexData"))) + return xglCmdBindIndexData; + else if (!strncmp("xglCmdBindAttachments", (const char *) funcName, sizeof("xglCmdBindAttachments"))) + return xglCmdBindAttachments; + else if (!strncmp("xglCmdPrepareMemoryRegions", (const char *) funcName, sizeof("xglCmdPrepareMemoryRegions"))) + return xglCmdPrepareMemoryRegions; + else if (!strncmp("xglCmdPrepareImages", (const char *) funcName, sizeof("xglCmdPrepareImages"))) + return xglCmdPrepareImages; + else if (!strncmp("xglCmdDraw", (const char *) funcName, sizeof("xglCmdDraw"))) + return xglCmdDraw; + else if (!strncmp("xglCmdDrawIndexed", (const char *) funcName, sizeof("xglCmdDrawIndexed"))) + return xglCmdDrawIndexed; + else if (!strncmp("xglCmdDrawIndirect", (const char *) funcName, sizeof("xglCmdDrawIndirect"))) + return xglCmdDrawIndirect; + else if (!strncmp("xglCmdDrawIndexedIndirect", (const char *) funcName, sizeof("xglCmdDrawIndexedIndirect"))) + return xglCmdDrawIndexedIndirect; + else if (!strncmp("xglCmdDispatch", (const char *) funcName, sizeof("xglCmdDispatch"))) + return xglCmdDispatch; + else if (!strncmp("xglCmdDispatchIndirect", (const char *) funcName, sizeof("xglCmdDispatchIndirect"))) + return xglCmdDispatchIndirect; + else if (!strncmp("xglCmdCopyMemory", (const char *) funcName, sizeof("xglCmdCopyMemory"))) + return xglCmdCopyMemory; + else if (!strncmp("xglCmdCopyImage", (const char *) funcName, sizeof("xglCmdCopyImage"))) + return xglCmdCopyImage; + else if (!strncmp("xglCmdCopyMemoryToImage", (const char *) funcName, sizeof("xglCmdCopyMemoryToImage"))) + return xglCmdCopyMemoryToImage; + else if (!strncmp("xglCmdCopyImageToMemory", (const char *) funcName, sizeof("xglCmdCopyImageToMemory"))) + return xglCmdCopyImageToMemory; + else if (!strncmp("xglCmdCloneImageData", (const char *) funcName, sizeof("xglCmdCloneImageData"))) + return xglCmdCloneImageData; + else if (!strncmp("xglCmdUpdateMemory", (const char *) funcName, sizeof("xglCmdUpdateMemory"))) + return xglCmdUpdateMemory; + else if (!strncmp("xglCmdFillMemory", (const char *) funcName, sizeof("xglCmdFillMemory"))) + return xglCmdFillMemory; + else if (!strncmp("xglCmdClearColorImage", (const char *) funcName, sizeof("xglCmdClearColorImage"))) + return xglCmdClearColorImage; + else if (!strncmp("xglCmdClearColorImageRaw", (const char *) funcName, sizeof("xglCmdClearColorImageRaw"))) + return xglCmdClearColorImageRaw; + else if (!strncmp("xglCmdClearDepthStencil", (const char *) funcName, sizeof("xglCmdClearDepthStencil"))) + return xglCmdClearDepthStencil; + else if (!strncmp("xglCmdResolveImage", (const char *) funcName, sizeof("xglCmdResolveImage"))) + return xglCmdResolveImage; + else if (!strncmp("xglCmdSetEvent", (const char *) funcName, sizeof("xglCmdSetEvent"))) + return xglCmdSetEvent; + else if (!strncmp("xglCmdResetEvent", (const char *) funcName, sizeof("xglCmdResetEvent"))) + return xglCmdResetEvent; + else if (!strncmp("xglCmdMemoryAtomic", (const char *) funcName, sizeof("xglCmdMemoryAtomic"))) + return xglCmdMemoryAtomic; + else if (!strncmp("xglCmdBeginQuery", (const char *) funcName, sizeof("xglCmdBeginQuery"))) + return xglCmdBeginQuery; + else if (!strncmp("xglCmdEndQuery", (const char *) funcName, sizeof("xglCmdEndQuery"))) + return xglCmdEndQuery; + else if (!strncmp("xglCmdResetQueryPool", (const char *) funcName, sizeof("xglCmdResetQueryPool"))) + return xglCmdResetQueryPool; + else if (!strncmp("xglCmdWriteTimestamp", (const char *) funcName, sizeof("xglCmdWriteTimestamp"))) + return xglCmdWriteTimestamp; + else if (!strncmp("xglCmdInitAtomicCounters", (const char *) funcName, sizeof("xglCmdInitAtomicCounters"))) + return xglCmdInitAtomicCounters; + else if (!strncmp("xglCmdLoadAtomicCounters", (const char *) funcName, sizeof("xglCmdLoadAtomicCounters"))) + return xglCmdLoadAtomicCounters; + else if (!strncmp("xglCmdSaveAtomicCounters", (const char *) funcName, sizeof("xglCmdSaveAtomicCounters"))) + return xglCmdSaveAtomicCounters; + else if (!strncmp("xglDbgSetValidationLevel", (const char *) funcName, sizeof("xglDbgSetValidationLevel"))) + return xglDbgSetValidationLevel; + else if (!strncmp("xglDbgRegisterMsgCallback", (const char *) funcName, sizeof("xglDbgRegisterMsgCallback"))) + return xglDbgRegisterMsgCallback; + else if (!strncmp("xglDbgUnregisterMsgCallback", (const char *) funcName, sizeof("xglDbgUnregisterMsgCallback"))) + return xglDbgUnregisterMsgCallback; + else if (!strncmp("xglDbgSetMessageFilter", (const char *) funcName, sizeof("xglDbgSetMessageFilter"))) + return xglDbgSetMessageFilter; + else if (!strncmp("xglDbgSetObjectTag", (const char *) funcName, sizeof("xglDbgSetObjectTag"))) + return xglDbgSetObjectTag; + else if (!strncmp("xglDbgSetGlobalOption", (const char *) funcName, sizeof("xglDbgSetGlobalOption"))) + return xglDbgSetGlobalOption; + else if (!strncmp("xglDbgSetDeviceOption", (const char *) funcName, sizeof("xglDbgSetDeviceOption"))) + return xglDbgSetDeviceOption; + else if (!strncmp("xglCmdDbgMarkerBegin", (const char *) funcName, sizeof("xglCmdDbgMarkerBegin"))) + return xglCmdDbgMarkerBegin; + else if (!strncmp("xglCmdDbgMarkerEnd", (const char *) funcName, sizeof("xglCmdDbgMarkerEnd"))) + return xglCmdDbgMarkerEnd; + else if (!strncmp("xglWsiX11AssociateConnection", (const char *) funcName, sizeof("xglWsiX11AssociateConnection"))) + return xglWsiX11AssociateConnection; + else if (!strncmp("xglWsiX11GetMSC", (const char *) funcName, sizeof("xglWsiX11GetMSC"))) + return xglWsiX11GetMSC; + else if (!strncmp("xglWsiX11CreatePresentableImage", (const char *) funcName, sizeof("xglWsiX11CreatePresentableImage"))) + return xglWsiX11CreatePresentableImage; + else if (!strncmp("xglWsiX11QueuePresent", (const char *) funcName, sizeof("xglWsiX11QueuePresent"))) + return xglWsiX11QueuePresent; + else { + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + if (gpuw->pGPA == NULL) + return NULL; + return gpuw->pGPA(gpuw->nextObject, funcName); + } +} + diff --git a/layers/draw_state.c b/layers/draw_state.c index a1e23484..773d5d5f 100644 --- a/layers/draw_state.c +++ b/layers/draw_state.c @@ -382,26 +382,40 @@ static XGL_BOOL verifyShaderSlotMapping(const XGL_UINT slot, const XGL_UINT slot // Print details of DS config to stdout static void printDSConfig() { + uint32_t skipUnusedCount = 0; // track consecutive unused slots for minimal reporting for (uint32_t i = 0; i < XGL_MAX_DESCRIPTOR_SETS; i++) { if (lastBoundDS[i]) { DS_LL_HEAD *pDS = getDS(lastBoundDS[i]); if (pDS) { printf("DS INFO : Slot bindings for DS w/ %u slots at index %u (%p):\n", pDS->numSlots, i, (void*)pDS->dsID); for (uint32_t j = 0; j < pDS->numSlots; j++) { - printf("----Slot %u\n", j); switch (pDS->dsSlot[j].activeMapping) { case MAPPING_MEMORY: - printf(" Mapped to Memory View %p:\n%s", (void*)&pDS->dsSlot[j].memView, xgl_print_xgl_memory_view_attach_info(&pDS->dsSlot[j].memView, " ")); + if (0 != skipUnusedCount) {// finish sequence of unused slots + printf("----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : ""); + skipUnusedCount = 0; + } + printf("----Slot %u\n Mapped to Memory View %p:\n%s", j, (void*)&pDS->dsSlot[j].memView, xgl_print_xgl_memory_view_attach_info(&pDS->dsSlot[j].memView, " ")); break; case MAPPING_IMAGE: - printf(" Mapped to Image View %p:\n%s", (void*)&pDS->dsSlot[j].imageView, xgl_print_xgl_image_view_attach_info(&pDS->dsSlot[j].imageView, " ")); + if (0 != skipUnusedCount) {// finish sequence of unused slots + printf("----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : ""); + skipUnusedCount = 0; + } + printf("----Slot %u\n Mapped to Image View %p:\n%s", j, (void*)&pDS->dsSlot[j].imageView, xgl_print_xgl_image_view_attach_info(&pDS->dsSlot[j].imageView, " ")); break; case MAPPING_SAMPLER: - printf(" Mapped to Sampler Object %p (CAN PRINT DETAILS HERE)\n", (void*)pDS->dsSlot[j].sampler); + if (0 != skipUnusedCount) {// finish sequence of unused slots + printf("----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : ""); + skipUnusedCount = 0; + } + printf("----Slot %u\n Mapped to Sampler Object %p (CAN PRINT DETAILS HERE)\n", j, (void*)pDS->dsSlot[j].sampler); break; default: - printf(" NO VIEW MAPPED TO THIS DS SLOT\n"); + if (!skipUnusedCount) // only report start of unused sequences + printf("----Skipping slot(s) w/o a view attached...\n"); + skipUnusedCount++; break; } // For each shader type, check its mapping @@ -412,6 +426,10 @@ static void printDSConfig() } } } + if (0 != skipUnusedCount) {// finish sequence of unused slots + printf("----Skipped %u slot%s w/o a view attached...\n", skipUnusedCount, (1 != skipUnusedCount) ? "s" : ""); + skipUnusedCount = 0; + } } else { printf("DS ERROR : Can't find last bound DS %p. Did you need to bind DS to index %u?\n", (void*)lastBoundDS[i], i); diff --git a/layers/mem_tracker.c b/layers/mem_tracker.c new file mode 100644 index 00000000..1a0b8af7 --- /dev/null +++ b/layers/mem_tracker.c @@ -0,0 +1,2009 @@ +/* THIS FILE IS GENERATED. DO NOT EDIT. */ + +/* + * XGL + * + * Copyright (C) 2014 LunarG, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> +#include <pthread.h> +#include "xglLayer.h" +#include "xgl_struct_string_helper.h" + +static XGL_LAYER_DISPATCH_TABLE nextTable; +static XGL_BASE_LAYER_OBJECT *pCurObj; +static pthread_once_t tabOnce = PTHREAD_ONCE_INIT; + +/* + * Data Structure overview + * There are 3 global Linked-Lists (LLs) + * pGlobalCBHead points to head of Command Buffer (CB) LL + * Off of each node in this LL there is a separate LL of + * memory objects that are referenced by this CB + * pGlobalMemObjHead points to head of Memory Object LL + * Off of each node in this LL there are 2 separate LL + * One is a list of all CBs referencing this mem obj + * Two is a list of all XGL Objects that are bound to this memory + * pGlobalObjHead point to head of XGL Objects w/ bound mem LL + * Each node of this LL contains a ptr to global Mem Obj node for bound mem + * + * The "Global" nodes are for the main LLs + * The "mini" nodes are for ancillary LLs that are pointed to from global nodes + * + * Algorithm overview + * These are the primary events that should happen related to different objects + * 1. Command buffers + * CREATION - Add node to global LL + * CMD BIND - If mem associated, add mem reference to mini LL + * DESTROY - Remove from global LL, decrement (and report) mem references + * 2. Mem Objects + * CREATION - Add node to global LL + * OBJ BIND - Add obj node to mini LL for that mem node + * CMB BIND - If mem-related add CB node to mini LL for that mem node + * DESTROY - Flag as errors any remaining refs and Remove from global LL + * 3. Generic Objects + * MEM BIND - DESTROY any previous binding, Add global obj node w/ ref to global mem obj node, Add obj node to mini LL for that mem node + * DESTROY - If mem bound, remove reference from mini LL for that mem Node, remove global obj node + */ +// TODO : Is there a way to track when Cmd Buffer finishes & remove mem references at that point? +// TODO : Could potentially store a list of freed mem allocs to flag when they're incorrectly used + +// Generic data struct for various "mini" Linked-Lists +// This just wraps some type of XGL OBJ and a pNext ptr +// Used for xgl obj, cmd buffer, and mem obj wrapping +typedef struct _MINI_NODE { + struct _MINI_NODE* pNext; + union { // different objects that can be wrapped + XGL_OBJECT object; + XGL_GPU_MEMORY mem; + XGL_CMD_BUFFER cmdBuffer; + XGL_BASE_OBJECT data; // for generic handling of data + }; +} MINI_NODE; + +struct GLOBAL_MEM_OBJ_NODE; + +// Store a single LL of command buffers +typedef struct _GLOBAL_CB_NODE { + struct _GLOBAL_CB_NODE* pNextGlobalCBNode; + MINI_NODE* pMemObjList; // LL of Mem objs referenced by this CB + XGL_CMD_BUFFER cmdBuffer; + XGL_FENCE fence; // fence tracking this cmd buffer +} GLOBAL_CB_NODE; + +// Data struct for tracking memory object +typedef struct _GLOBAL_MEM_OBJ_NODE { + struct _GLOBAL_MEM_OBJ_NODE* pNextGlobalNode; // Ptr to next mem obj in global list of all objs + MINI_NODE* pObjBindings; // Ptr to list of objects bound to this memory + MINI_NODE* pCmdBufferBindings; // Ptr to list of cmd buffers that this mem object references + XGL_UINT refCount; // Count of references (obj bindings or CB use) + XGL_GPU_MEMORY mem; + XGL_MEMORY_ALLOC_INFO allocInfo; +} GLOBAL_MEM_OBJ_NODE; + +typedef struct _GLOBAL_OBJECT_NODE { + struct _GLOBAL_OBJECT_NODE* pNext; + GLOBAL_MEM_OBJ_NODE* pMemNode; + XGL_OBJECT object; +} GLOBAL_OBJECT_NODE; + +static GLOBAL_CB_NODE* pGlobalCBHead = NULL; +static GLOBAL_MEM_OBJ_NODE* pGlobalMemObjHead = NULL; +static GLOBAL_OBJECT_NODE* pGlobalObjectHead = NULL; +static XGL_DEVICE globalDevice = NULL; + +// Check list for data and if it's not included insert new node +// into HEAD of list pointed to by pHEAD & update pHEAD +// Set 'insert' to XGL_TRUE if new node was inserted +// return XGL_SUCCESS if no errors occur +static XGL_RESULT insertMiniNode(MINI_NODE** pHEAD, const XGL_BASE_OBJECT data, XGL_UINT* insert) +{ + MINI_NODE* pTrav = *pHEAD; + while (pTrav && (pTrav->data != data)) { + pTrav = pTrav->pNext; + } + if (!pTrav) { // Add node to front of LL + pTrav = (MINI_NODE*)malloc(sizeof(MINI_NODE)); + if (!pTrav) + return XGL_ERROR_OUT_OF_MEMORY; + memset(pTrav, 0, sizeof(MINI_NODE)); + if (*pHEAD) + pTrav->pNext = *pHEAD; + *pHEAD = pTrav; + *insert += 1; + //pMemTrav->refCount++; + //printf("MEM INFO : Incremented refCount for mem obj %p to %u\n", (void*)mem, pMemTrav->refCount); + } + if (pTrav->data) { // This is just FYI + assert(data == pTrav->data); + printf("MEM INFO : Data %p is already in data LL w/ HEAD at %p\n", data, *pHEAD); + } + pTrav->data = data; + return XGL_SUCCESS; +} + +// Add new CB node for this cb at end of global CB LL +static void insertGlobalCB(const XGL_CMD_BUFFER cb) +{ + GLOBAL_CB_NODE* pTrav = pGlobalCBHead; + if (!pTrav) { + pTrav = (GLOBAL_CB_NODE*)malloc(sizeof(GLOBAL_CB_NODE)); + pGlobalCBHead = pTrav; + } + else { + while (NULL != pTrav->pNextGlobalCBNode) + pTrav = pTrav->pNextGlobalCBNode; + pTrav->pNextGlobalCBNode = (GLOBAL_CB_NODE*)malloc(sizeof(GLOBAL_CB_NODE)); + pTrav = pTrav->pNextGlobalCBNode; + } + memset(pTrav, 0, sizeof(GLOBAL_CB_NODE)); + pTrav->cmdBuffer = cb; +} + +// Return ptr to node in global LL containing cb, or NULL if not found +static GLOBAL_CB_NODE* getGlobalCBNode(const XGL_CMD_BUFFER cb) +{ + GLOBAL_CB_NODE* pTrav = pGlobalCBHead; + while (pTrav && (pTrav->cmdBuffer != cb)) + pTrav = pTrav->pNextGlobalCBNode; + return pTrav; +} +// Set fence for given cb in global cb node +static XGL_BOOL setCBFence(const XGL_CMD_BUFFER cb, const XGL_FENCE fence) +{ + GLOBAL_CB_NODE* pTrav = getGlobalCBNode(cb); + if (!pTrav) { + printf("MEM ERROR : Unable to find node for CB %p in order to set fence to %p\n", (void*)cb, (void*)fence); + return XGL_FALSE; + } + pTrav->fence = fence; + return XGL_TRUE; +} + +static XGL_BOOL validateCBMemRef(const XGL_CMD_BUFFER cb, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs) +{ + GLOBAL_CB_NODE* pTrav = getGlobalCBNode(cb); + if (!pTrav) { + printf("MEM ERROR : Unable to find node for CB %p in order to check memory references\n", (void*)cb); + return XGL_FALSE; + } + // Validate that all actual references are accounted for in pMemRefs + MINI_NODE* pMemNode = pTrav->pMemObjList; + uint32_t i; + uint8_t found = 0; + uint64_t foundCount = 0; + while (pMemNode) { + // TODO : Improve this algorithm + for (i = 0; i < memRefCount; i++) { + if (pMemNode->mem == pMemRefs[i].mem) { + printf("MEM INFO : Found Mem Obj %p binding to CB %p\n", pMemNode->mem, cb); + found = 1; + foundCount++; + } + } + if (!found) { + printf("MEM ERROR : Memory reference list for Command Buffer %p is missing ref to mem obj %p\n", cb, pMemNode->mem); + return XGL_FALSE; + } + found = 0; + pMemNode = pMemNode->pNext; + } + printf("MEM INFO : Verified all %lu memory dependencies for CB %p are included in pMemRefs list\n", foundCount, cb); + // TODO : Could report mem refs in pMemRefs that AREN'T in mem LL, that would be primarily informational + // Currently just noting that there is a difference + if (foundCount != memRefCount) + printf("MEM INFO : Note that %u mem refs included in pMemRefs list, but only %lu appear to be required\n", memRefCount, foundCount); + return XGL_TRUE; +} + +static void insertGlobalMemObj(const XGL_GPU_MEMORY mem, const XGL_MEMORY_ALLOC_INFO* pAllocInfo) +{ + GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; + if (!pTrav) { + pTrav = (GLOBAL_MEM_OBJ_NODE*)malloc(sizeof(GLOBAL_MEM_OBJ_NODE)); + pGlobalMemObjHead = pTrav; + } + else { + while (NULL != pTrav->pNextGlobalNode) + pTrav = pTrav->pNextGlobalNode; + pTrav->pNextGlobalNode = (GLOBAL_MEM_OBJ_NODE*)malloc(sizeof(GLOBAL_MEM_OBJ_NODE)); + pTrav = pTrav->pNextGlobalNode; + } + memset(pTrav, 0, sizeof(GLOBAL_MEM_OBJ_NODE)); + memcpy(&pTrav->allocInfo, pAllocInfo, sizeof(XGL_MEMORY_ALLOC_INFO)); + pTrav->mem = mem; +} + +// Return ptr to node in global LL containing mem, or NULL if not found +static GLOBAL_MEM_OBJ_NODE* getGlobalMemNode(const XGL_GPU_MEMORY mem) +{ + GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; + while (pTrav && (pTrav->mem != mem)) + pTrav = pTrav->pNextGlobalNode; + return pTrav; +} + +// Find Global CB Node and add mem binding to mini LL +// Find Global Mem Obj Node and add CB binding to mini LL +static XGL_BOOL updateCBBinding(const XGL_CMD_BUFFER cb, const XGL_GPU_MEMORY mem) +{ + // First update CB binding in MemObj mini CB list + GLOBAL_MEM_OBJ_NODE* pMemTrav = getGlobalMemNode(mem); + if (!pMemTrav) { + printf("MEM ERROR : Trying to bind mem obj %p to CB %p but no Node for that mem obj.\n", mem, cb); + printf(" Was it correctly allocated? Did it already get freed?\n"); + return XGL_FALSE; + } + + XGL_RESULT result = insertMiniNode(&pMemTrav->pCmdBufferBindings, cb, &pMemTrav->refCount); + if (XGL_SUCCESS != result) + return result; + + // Now update Global CB's Mini Mem binding list + GLOBAL_CB_NODE* pCBTrav = getGlobalCBNode(cb); + if (!pCBTrav) { + printf("MEM ERROR : Trying to bind mem obj %p to CB %p but no Node for that CB.\n", mem, cb); + printf(" Was it CB incorrectly destroyed?\n"); + return XGL_FALSE; + } + XGL_UINT dontCare; + result = insertMiniNode(&pCBTrav->pMemObjList, mem, &dontCare); + if (XGL_SUCCESS != result) + return result; + + return XGL_TRUE; +} +// Clear the CB Binding for mem +static void clearCBBinding(const XGL_CMD_BUFFER cb, const XGL_GPU_MEMORY mem) +{ + GLOBAL_MEM_OBJ_NODE* pTrav = getGlobalMemNode(mem); + MINI_NODE* pMiniCB = pTrav->pCmdBufferBindings; + MINI_NODE* pPrev = pMiniCB; + while (pMiniCB && (cb != pMiniCB->cmdBuffer)) { + pPrev = pMiniCB; + pMiniCB = pMiniCB->pNext; + } + if (!pMiniCB) { + printf("MEM ERROR : Trying to clear CB binding but CB %p not in binding list for mem obj %p\n", cb, mem); + } + else { // remove node from list & decrement refCount + pPrev->pNext = pMiniCB->pNext; + if (pMiniCB == pTrav->pCmdBufferBindings) + pTrav->pCmdBufferBindings = NULL; + free(pMiniCB); + pTrav->refCount--; + } +} +// Free bindings related to CB +static XGL_BOOL freeCBBindings(const XGL_CMD_BUFFER cb) +{ + GLOBAL_CB_NODE* pCBTrav = getGlobalCBNode(cb); + if (!pCBTrav) { + printf("MEM ERROR : Unable to find global CB node %p for deletion\n", cb); + return XGL_FALSE; + } + MINI_NODE* pMemTrav = pCBTrav->pMemObjList; + MINI_NODE* pDeleteMe = NULL; + // We traverse LL in order and free nodes as they're cleared + while (pMemTrav) { + pDeleteMe = pMemTrav; + if (pMemTrav->mem) + clearCBBinding(cb, pMemTrav->mem); + pMemTrav = pMemTrav->pNext; + free(pDeleteMe); + } + pCBTrav->pMemObjList = NULL; + return XGL_TRUE; +} +// Delete Global CB Node from list along with all of it's mini mem obj node +// and also clear Global mem references to CB +// TODO : When should this be called? There's no Destroy of CBs that I see +static XGL_BOOL deleteGlobalCBNode(const XGL_CMD_BUFFER cb) +{ + if (XGL_FALSE == freeCBBindings(cb)) + return XGL_FALSE; + // Delete the Global CB node + GLOBAL_CB_NODE* pCBTrav = getGlobalCBNode(cb); + pCBTrav = pGlobalCBHead; + GLOBAL_CB_NODE* pPrev = pCBTrav; + while (pCBTrav && (cb != pCBTrav->cmdBuffer)) { + pPrev = pCBTrav; + pCBTrav = pCBTrav->pNextGlobalCBNode; + } + assert(cb); // We found node at start of function so it should still be here + pPrev->pNextGlobalCBNode = pCBTrav->pNextGlobalCBNode; + if (pCBTrav == pGlobalCBHead) + pGlobalCBHead = pCBTrav->pNextGlobalCBNode; + free(pCBTrav); + return XGL_TRUE; +} +// Delete the entire CB list +static XGL_BOOL deleteGlobalCBList() +{ + XGL_BOOL result = XGL_TRUE; + GLOBAL_CB_NODE* pCBTrav = pGlobalCBHead; + while (pCBTrav) { + XGL_BOOL tmpResult = deleteGlobalCBNode(pCBTrav->cmdBuffer); + // If any result is FALSE, final result should be FALSE + if ((XGL_FALSE == tmpResult) || (XGL_FALSE == result)) + result = XGL_FALSE; + pCBTrav = pCBTrav->pNextGlobalCBNode; + } + return result; +} + +// For given MemObj node, report Obj & CB bindings +static void reportMemReferences(const GLOBAL_MEM_OBJ_NODE* pMemObjTrav) +{ + XGL_UINT refCount = 0; // Count found references + MINI_NODE* pObjTrav = pMemObjTrav->pObjBindings; + MINI_NODE* pCBTrav = pMemObjTrav->pCmdBufferBindings; + while (pCBTrav) { + refCount++; + printf("MEM INFO : Command Buffer %p has reference to mem obj %p\n", pCBTrav->cmdBuffer, pMemObjTrav->mem); + pCBTrav = pCBTrav->pNext; + } + while (pObjTrav) { + refCount++; + printf("MEM INFO : XGL Object %p has reference to mem obj %p\n", pObjTrav->object, pMemObjTrav->mem); + pObjTrav = pObjTrav->pNext; + } + if (refCount != pMemObjTrav->refCount) { + printf("MEM INFO INTERNAL ERROR : Refcount of %u for Mem Obj %p does't match reported refs of %u\n", pMemObjTrav->refCount, pMemObjTrav->mem, refCount); + } +} + +static void deleteGlobalMemNode(XGL_GPU_MEMORY mem) +{ + GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; + GLOBAL_MEM_OBJ_NODE* pPrev = pTrav; + while (pTrav && (pTrav->mem != mem)) { + pPrev = pTrav; + pTrav = pTrav->pNextGlobalNode; + } + if (pTrav) { + pPrev->pNextGlobalNode = pTrav->pNextGlobalNode; + if (pGlobalMemObjHead == pTrav) + pGlobalMemObjHead = pTrav->pNextGlobalNode; + free(pTrav); + } + else { + printf("MEM ERROR : Could not find global mem obj node for %p to delete!\n", mem); + } +} +// Check if fence for given CB is completed +static XGL_BOOL checkCBCompleted(const XGL_CMD_BUFFER cb) +{ + GLOBAL_CB_NODE* pCBTrav = getGlobalCBNode(cb); + if (!pCBTrav) { + printf("MEM ERROR : Unable to find global CB node %p to check for completion\n", cb); + return XGL_FALSE; + } + if (!pCBTrav->fence) { + printf("MEM ERROR : No fence found for CB %p to check for completion\n", cb); + return XGL_FALSE; + } + if (XGL_SUCCESS != nextTable.GetFenceStatus(pCBTrav->fence)) { + printf("MEM INFO : Fence %p for CB %p has not completed\n", pCBTrav->fence, cb); + return XGL_FALSE; + } + return XGL_TRUE; +} + +static XGL_BOOL freeMemNode(XGL_GPU_MEMORY mem) +{ + XGL_BOOL result = XGL_TRUE; + // Parse global list to find node w/ mem + GLOBAL_MEM_OBJ_NODE* pTrav = getGlobalMemNode(mem); + if (!pTrav) { + printf("MEM ERROR : Couldn't find mem node object for %p\n", (void*)mem); + printf("MEM ERROR : Was %p never allocated or previously freed?\n", (void*)mem); + return XGL_FALSE; + } + else { + // First clear any CB bindings for completed CBs + // TODO : Is there a better place to do this? + MINI_NODE* pMiniCB = pTrav->pCmdBufferBindings; + while (pMiniCB) { + XGL_CMD_BUFFER curCB = pMiniCB->cmdBuffer; + pMiniCB = pMiniCB->pNext; + if (XGL_TRUE == checkCBCompleted(curCB)) { + freeCBBindings(curCB); + } + } + // Now verify that no references to this mem obj remain + if (0 != pTrav->refCount) { + // If references remain, report the error and can search down CB LL to find references + result = XGL_FALSE; + printf("MEM ERROR : Freeing mem obj %p while it still has references\n", (void*)mem); + reportMemReferences(pTrav); + } + // Delete global node + deleteGlobalMemNode(mem); + } + return result; +} + +// Return object node for 'object' or return NULL if no node exists +static GLOBAL_OBJECT_NODE* getGlobalObjectNode(const XGL_OBJECT object) +{ + GLOBAL_OBJECT_NODE* pTrav = pGlobalObjectHead; + while (pTrav && (object != pTrav->object)) { + pTrav = pTrav->pNext; + } + return pTrav; +} + +static GLOBAL_OBJECT_NODE* insertGlobalObjectNode(XGL_OBJECT object) +{ + GLOBAL_OBJECT_NODE* pTrav = pGlobalObjectHead; + if (!pTrav) { + pTrav = (GLOBAL_OBJECT_NODE*)malloc(sizeof(GLOBAL_OBJECT_NODE)); + if (!pTrav) + return NULL; + memset(pTrav, 0, sizeof(GLOBAL_OBJECT_NODE)); + pGlobalObjectHead = pTrav; + } + else { + GLOBAL_OBJECT_NODE* pPrev = pTrav; + while (pTrav) { + pPrev = pTrav; + pTrav = pTrav->pNext; + } + pTrav = (GLOBAL_OBJECT_NODE*)malloc(sizeof(GLOBAL_OBJECT_NODE)); + if (!pTrav) + return NULL; + memset(pTrav, 0, sizeof(GLOBAL_OBJECT_NODE)); + pPrev->pNext = pTrav; + } + pTrav->object = object; + return pTrav; +} + +// Remove object binding performs 3 tasks: +// 1. Remove object node from Global Mem Obj mini LL of obj bindings & free it +// 2. Decrement refCount for Global Mem Obj +// 3. Clear Global Mem Obj ptr from Global Object Node +static XGL_BOOL clearObjectBinding(XGL_OBJECT object) +{ + GLOBAL_OBJECT_NODE* pGlobalObjTrav = getGlobalObjectNode(object); + if (!pGlobalObjTrav) { + printf("MEM ERROR : Attempting to clear mem binding for object %p\n", object); + return XGL_FALSE; + } + if (!pGlobalObjTrav->pMemNode) { + printf("MEM WARN : Attempting to clear mem binding on obj %p but it has no binding.\n", (void*)object); + return XGL_FALSE; + } + MINI_NODE* pObjTrav = pGlobalObjTrav->pMemNode->pObjBindings; + MINI_NODE* pPrevObj = pObjTrav; + while (pObjTrav) { + if (object == pObjTrav->object) { + pPrevObj->pNext = pObjTrav->pNext; + // check if HEAD needs to be updated + if (pGlobalObjTrav->pMemNode->pObjBindings == pObjTrav) + pGlobalObjTrav->pMemNode->pObjBindings = pObjTrav->pNext; + free(pObjTrav); + pGlobalObjTrav->pMemNode->refCount--; + pGlobalObjTrav->pMemNode = NULL; + return XGL_TRUE; + } + pPrevObj = pObjTrav; + pObjTrav = pObjTrav->pNext; + } + printf("MEM ERROR : While trying to clear mem binding for object %p, unable to find mem ref %p\n", object, pGlobalObjTrav->pMemNode->mem); + return XGL_FALSE; +} + +// For NULL mem case, clear any previous binding Else... +// Make sure given object is in global object LL +// Add link from global object node to global memory node +// Add mini-object node & reference off of global obj node +// Return XGL_TRUE if addition is successful, XGL_FALSE otherwise +static XGL_BOOL updateObjectBinding(XGL_OBJECT object, XGL_GPU_MEMORY mem) +{ + // Handle NULL case separately, just clear previous binding & decrement reference + if (mem == XGL_NULL_HANDLE) { + clearObjectBinding(object); + return XGL_TRUE; + } + // Find obj node or add it if we don't have one + GLOBAL_OBJECT_NODE* pGlobalObjTrav = getGlobalObjectNode(object); + if (!pGlobalObjTrav) + pGlobalObjTrav = insertGlobalObjectNode(object); + + // non-null case so should have real mem obj + GLOBAL_MEM_OBJ_NODE* pTrav = getGlobalMemNode(mem); + if (!pTrav) { + printf("MEM ERROR : While trying to bind mem for obj %p, couldn't find node for mem obj %p\n", (void*)object, (void*)mem); + return XGL_FALSE; + } + XGL_RESULT result = insertMiniNode(&pTrav->pObjBindings, object, &pTrav->refCount); + if (XGL_SUCCESS != result) + return result; + + if (pGlobalObjTrav->pMemNode) + printf("MEM INFO : Updating memory binding for object %p from mem obj %p to %p\n", object, pGlobalObjTrav->pMemNode->mem, mem); + pGlobalObjTrav->pMemNode = pTrav; + return XGL_TRUE; +} +// Print details of global Obj tracking list +static void printObjList() +{ + GLOBAL_OBJECT_NODE* pGlobalObjTrav = pGlobalObjectHead; + if (!pGlobalObjTrav) { + printf("MEM INFO : Global Object list is empty :(\n"); + } + else { + printf("MEM INFO : Details of Global Object list w/ HEAD at %p\n", (void*)pGlobalObjTrav); + while (pGlobalObjTrav) { + printf(" GlobObjNode %p has object %p, pNext %p, pMemNode %p\n", pGlobalObjTrav, pGlobalObjTrav->object, pGlobalObjTrav->pNext, pGlobalObjTrav->pMemNode); + pGlobalObjTrav = pGlobalObjTrav->pNext; + } + } +} +// For given Object, get 'mem' obj that it's bound to or NULL if no binding +static XGL_GPU_MEMORY getMemBindingFromObject(const XGL_OBJECT object) +{ + XGL_GPU_MEMORY mem = NULL; + GLOBAL_OBJECT_NODE* pObjNode = getGlobalObjectNode(object); + if (pObjNode) { + if (pObjNode->pMemNode) { + mem = pObjNode->pMemNode->mem; + } + else { + printf("MEM ERROR : Trying to get mem binding for object %p but object has no mem binding\n", (void*)object); + printObjList(); + } + } + else { + printf("MEM ERROR : Trying to get mem binding for object %p but no such object in global list\n", (void*)object); + printObjList(); + } + return mem; +} +// Print details of global Mem Obj list +static void printMemList() +{ + GLOBAL_MEM_OBJ_NODE* pTrav = pGlobalMemObjHead; + if (!pTrav) { + printf("MEM INFO : Global Memory Object list is empty :(\n"); + } + else { + printf("MEM INFO : Details of Global Memory Object list w/ HEAD at %p\n", (void*)pTrav); + while (pTrav) { + printf(" ===MemObj Node at %p===\n", (void*)pTrav); + printf(" Mem object: %p\n", (void*)pTrav->mem); + printf(" Ref Count: %u\n", pTrav->refCount); + printf(" pNext Mem Obj Node: %p\n", (void*)pTrav->pNextGlobalNode); + printf(" Mem Alloc info:\n%s", xgl_print_xgl_memory_alloc_info(&pTrav->allocInfo, " ")); + MINI_NODE* pObjTrav = pTrav->pObjBindings; + if (!pObjTrav) + printf(" No XGL Object bindings\n"); + else { + printf(" XGL OBJECT Binding list w/ HEAD at %p:\n", pObjTrav); + while (pObjTrav) { + printf(" OBJ_NODE(%p): XGL OBJECT %p, pNext %p\n", pObjTrav, pObjTrav->object, pObjTrav->pNext); + pObjTrav = pObjTrav->pNext; + } + } + MINI_NODE* pCBTrav = pTrav->pCmdBufferBindings; + if (!pCBTrav) + printf(" No Command Buffer bindings\n"); + else { + printf(" XGL Command Buffer (CB) binding list w/ HEAD at %p:\n", pCBTrav); + while (pCBTrav) { + printf(" CB_NODE(%p): XGL CB %p, pNext %p\n", pCBTrav, pCBTrav->cmdBuffer, pCBTrav->pNext); + pCBTrav = pCBTrav->pNext; + } + } + pTrav = pTrav->pNextGlobalNode; + } + } +} + +static void printGlobalCB() +{ + GLOBAL_CB_NODE* pTrav = pGlobalCBHead; + if (!pTrav) { + printf("MEM INFO : Global Command Buffer (CB) list is empty :(\n"); + } + else { + printf("MEM INFO : Details of Global CB list w/ HEAD at %p:\n", (void*)pTrav); + while (pTrav) { + printf(" Global CB Node (%p) has CB %p, fence %p, and pMemObjList %p\n", (void*)pTrav, (void*)pTrav->cmdBuffer, (void*)pTrav->fence, (void*)pTrav->pMemObjList); + MINI_NODE* pMemObjTrav = pTrav->pMemObjList; + while (pMemObjTrav) { + printf(" MEM_NODE(%p): Mem obj %p, pNext %p\n", (void*)pMemObjTrav, (void*)pMemObjTrav->mem, (void*)pMemObjTrav->pNext); + pMemObjTrav = pMemObjTrav->pNext; + } + pTrav = pTrav->pNextGlobalCBNode; + } + } +} + +static XGL_FENCE createLocalFence() +{ + XGL_FENCE_CREATE_INFO fci; + fci.sType = XGL_STRUCTURE_TYPE_FENCE_CREATE_INFO; + fci.pNext = NULL; + fci.flags = 0; + XGL_FENCE fence; + nextTable.CreateFence(globalDevice, &fci, &fence); + return fence; +} + +static void initLayerTable() +{ + GetProcAddrType fpNextGPA; + fpNextGPA = pCurObj->pGPA; + assert(fpNextGPA); + + GetProcAddrType fpGetProcAddr = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetProcAddr"); + nextTable.GetProcAddr = fpGetProcAddr; + InitAndEnumerateGpusType fpInitAndEnumerateGpus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglInitAndEnumerateGpus"); + nextTable.InitAndEnumerateGpus = fpInitAndEnumerateGpus; + GetGpuInfoType fpGetGpuInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetGpuInfo"); + nextTable.GetGpuInfo = fpGetGpuInfo; + CreateDeviceType fpCreateDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDevice"); + nextTable.CreateDevice = fpCreateDevice; + DestroyDeviceType fpDestroyDevice = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyDevice"); + nextTable.DestroyDevice = fpDestroyDevice; + GetExtensionSupportType fpGetExtensionSupport = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetExtensionSupport"); + nextTable.GetExtensionSupport = fpGetExtensionSupport; + EnumerateLayersType fpEnumerateLayers = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEnumerateLayers"); + nextTable.EnumerateLayers = fpEnumerateLayers; + GetDeviceQueueType fpGetDeviceQueue = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetDeviceQueue"); + nextTable.GetDeviceQueue = fpGetDeviceQueue; + QueueSubmitType fpQueueSubmit = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSubmit"); + nextTable.QueueSubmit = fpQueueSubmit; + QueueSetGlobalMemReferencesType fpQueueSetGlobalMemReferences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueSetGlobalMemReferences"); + nextTable.QueueSetGlobalMemReferences = fpQueueSetGlobalMemReferences; + QueueWaitIdleType fpQueueWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglQueueWaitIdle"); + nextTable.QueueWaitIdle = fpQueueWaitIdle; + DeviceWaitIdleType fpDeviceWaitIdle = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDeviceWaitIdle"); + nextTable.DeviceWaitIdle = fpDeviceWaitIdle; + GetMemoryHeapCountType fpGetMemoryHeapCount = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapCount"); + nextTable.GetMemoryHeapCount = fpGetMemoryHeapCount; + GetMemoryHeapInfoType fpGetMemoryHeapInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMemoryHeapInfo"); + nextTable.GetMemoryHeapInfo = fpGetMemoryHeapInfo; + AllocMemoryType fpAllocMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAllocMemory"); + nextTable.AllocMemory = fpAllocMemory; + FreeMemoryType fpFreeMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglFreeMemory"); + nextTable.FreeMemory = fpFreeMemory; + SetMemoryPriorityType fpSetMemoryPriority = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetMemoryPriority"); + nextTable.SetMemoryPriority = fpSetMemoryPriority; + MapMemoryType fpMapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglMapMemory"); + nextTable.MapMemory = fpMapMemory; + UnmapMemoryType fpUnmapMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglUnmapMemory"); + nextTable.UnmapMemory = fpUnmapMemory; + PinSystemMemoryType fpPinSystemMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglPinSystemMemory"); + nextTable.PinSystemMemory = fpPinSystemMemory; + RemapVirtualMemoryPagesType fpRemapVirtualMemoryPages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglRemapVirtualMemoryPages"); + nextTable.RemapVirtualMemoryPages = fpRemapVirtualMemoryPages; + GetMultiGpuCompatibilityType fpGetMultiGpuCompatibility = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetMultiGpuCompatibility"); + nextTable.GetMultiGpuCompatibility = fpGetMultiGpuCompatibility; + OpenSharedMemoryType fpOpenSharedMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedMemory"); + nextTable.OpenSharedMemory = fpOpenSharedMemory; + OpenSharedQueueSemaphoreType fpOpenSharedQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenSharedQueueSemaphore"); + nextTable.OpenSharedQueueSemaphore = fpOpenSharedQueueSemaphore; + OpenPeerMemoryType fpOpenPeerMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerMemory"); + nextTable.OpenPeerMemory = fpOpenPeerMemory; + OpenPeerImageType fpOpenPeerImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglOpenPeerImage"); + nextTable.OpenPeerImage = fpOpenPeerImage; + DestroyObjectType fpDestroyObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDestroyObject"); + nextTable.DestroyObject = fpDestroyObject; + GetObjectInfoType fpGetObjectInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetObjectInfo"); + nextTable.GetObjectInfo = fpGetObjectInfo; + BindObjectMemoryType fpBindObjectMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBindObjectMemory"); + nextTable.BindObjectMemory = fpBindObjectMemory; + CreateFenceType fpCreateFence = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateFence"); + nextTable.CreateFence = fpCreateFence; + GetFenceStatusType fpGetFenceStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFenceStatus"); + nextTable.GetFenceStatus = fpGetFenceStatus; + WaitForFencesType fpWaitForFences = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitForFences"); + nextTable.WaitForFences = fpWaitForFences; + CreateQueueSemaphoreType fpCreateQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueueSemaphore"); + nextTable.CreateQueueSemaphore = fpCreateQueueSemaphore; + SignalQueueSemaphoreType fpSignalQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSignalQueueSemaphore"); + nextTable.SignalQueueSemaphore = fpSignalQueueSemaphore; + WaitQueueSemaphoreType fpWaitQueueSemaphore = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWaitQueueSemaphore"); + nextTable.WaitQueueSemaphore = fpWaitQueueSemaphore; + CreateEventType fpCreateEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateEvent"); + nextTable.CreateEvent = fpCreateEvent; + GetEventStatusType fpGetEventStatus = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetEventStatus"); + nextTable.GetEventStatus = fpGetEventStatus; + SetEventType fpSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglSetEvent"); + nextTable.SetEvent = fpSetEvent; + ResetEventType fpResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetEvent"); + nextTable.ResetEvent = fpResetEvent; + CreateQueryPoolType fpCreateQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateQueryPool"); + nextTable.CreateQueryPool = fpCreateQueryPool; + GetQueryPoolResultsType fpGetQueryPoolResults = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetQueryPoolResults"); + nextTable.GetQueryPoolResults = fpGetQueryPoolResults; + GetFormatInfoType fpGetFormatInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFormatInfo"); + nextTable.GetFormatInfo = fpGetFormatInfo; + CreateImageType fpCreateImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImage"); + nextTable.CreateImage = fpCreateImage; + GetImageSubresourceInfoType fpGetImageSubresourceInfo = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetImageSubresourceInfo"); + nextTable.GetImageSubresourceInfo = fpGetImageSubresourceInfo; + CreateImageViewType fpCreateImageView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateImageView"); + nextTable.CreateImageView = fpCreateImageView; + CreateColorAttachmentViewType fpCreateColorAttachmentView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorAttachmentView"); + nextTable.CreateColorAttachmentView = fpCreateColorAttachmentView; + CreateDepthStencilViewType fpCreateDepthStencilView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilView"); + nextTable.CreateDepthStencilView = fpCreateDepthStencilView; + CreateShaderType fpCreateShader = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateShader"); + nextTable.CreateShader = fpCreateShader; + CreateGraphicsPipelineType fpCreateGraphicsPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateGraphicsPipeline"); + nextTable.CreateGraphicsPipeline = fpCreateGraphicsPipeline; + CreateComputePipelineType fpCreateComputePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateComputePipeline"); + nextTable.CreateComputePipeline = fpCreateComputePipeline; + StorePipelineType fpStorePipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglStorePipeline"); + nextTable.StorePipeline = fpStorePipeline; + LoadPipelineType fpLoadPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglLoadPipeline"); + nextTable.LoadPipeline = fpLoadPipeline; + CreatePipelineDeltaType fpCreatePipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreatePipelineDelta"); + nextTable.CreatePipelineDelta = fpCreatePipelineDelta; + CreateSamplerType fpCreateSampler = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateSampler"); + nextTable.CreateSampler = fpCreateSampler; + CreateDescriptorSetType fpCreateDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDescriptorSet"); + nextTable.CreateDescriptorSet = fpCreateDescriptorSet; + BeginDescriptorSetUpdateType fpBeginDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginDescriptorSetUpdate"); + nextTable.BeginDescriptorSetUpdate = fpBeginDescriptorSetUpdate; + EndDescriptorSetUpdateType fpEndDescriptorSetUpdate = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndDescriptorSetUpdate"); + nextTable.EndDescriptorSetUpdate = fpEndDescriptorSetUpdate; + AttachSamplerDescriptorsType fpAttachSamplerDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachSamplerDescriptors"); + nextTable.AttachSamplerDescriptors = fpAttachSamplerDescriptors; + AttachImageViewDescriptorsType fpAttachImageViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachImageViewDescriptors"); + nextTable.AttachImageViewDescriptors = fpAttachImageViewDescriptors; + AttachMemoryViewDescriptorsType fpAttachMemoryViewDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachMemoryViewDescriptors"); + nextTable.AttachMemoryViewDescriptors = fpAttachMemoryViewDescriptors; + AttachNestedDescriptorsType fpAttachNestedDescriptors = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglAttachNestedDescriptors"); + nextTable.AttachNestedDescriptors = fpAttachNestedDescriptors; + ClearDescriptorSetSlotsType fpClearDescriptorSetSlots = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglClearDescriptorSetSlots"); + nextTable.ClearDescriptorSetSlots = fpClearDescriptorSetSlots; + CreateViewportStateType fpCreateViewportState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateViewportState"); + nextTable.CreateViewportState = fpCreateViewportState; + CreateRasterStateType fpCreateRasterState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateRasterState"); + nextTable.CreateRasterState = fpCreateRasterState; + CreateMsaaStateType fpCreateMsaaState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateMsaaState"); + nextTable.CreateMsaaState = fpCreateMsaaState; + CreateColorBlendStateType fpCreateColorBlendState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateColorBlendState"); + nextTable.CreateColorBlendState = fpCreateColorBlendState; + CreateDepthStencilStateType fpCreateDepthStencilState = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDepthStencilState"); + nextTable.CreateDepthStencilState = fpCreateDepthStencilState; + CreateCommandBufferType fpCreateCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateCommandBuffer"); + nextTable.CreateCommandBuffer = fpCreateCommandBuffer; + BeginCommandBufferType fpBeginCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglBeginCommandBuffer"); + nextTable.BeginCommandBuffer = fpBeginCommandBuffer; + EndCommandBufferType fpEndCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglEndCommandBuffer"); + nextTable.EndCommandBuffer = fpEndCommandBuffer; + ResetCommandBufferType fpResetCommandBuffer = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglResetCommandBuffer"); + nextTable.ResetCommandBuffer = fpResetCommandBuffer; + CmdBindPipelineType fpCmdBindPipeline = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipeline"); + nextTable.CmdBindPipeline = fpCmdBindPipeline; + CmdBindPipelineDeltaType fpCmdBindPipelineDelta = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindPipelineDelta"); + nextTable.CmdBindPipelineDelta = fpCmdBindPipelineDelta; + CmdBindStateObjectType fpCmdBindStateObject = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindStateObject"); + nextTable.CmdBindStateObject = fpCmdBindStateObject; + CmdBindDescriptorSetType fpCmdBindDescriptorSet = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDescriptorSet"); + nextTable.CmdBindDescriptorSet = fpCmdBindDescriptorSet; + CmdBindDynamicMemoryViewType fpCmdBindDynamicMemoryView = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindDynamicMemoryView"); + nextTable.CmdBindDynamicMemoryView = fpCmdBindDynamicMemoryView; + CmdBindIndexDataType fpCmdBindIndexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindIndexData"); + nextTable.CmdBindIndexData = fpCmdBindIndexData; + CmdBindAttachmentsType fpCmdBindAttachments = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindAttachments"); + nextTable.CmdBindAttachments = fpCmdBindAttachments; + CmdPrepareMemoryRegionsType fpCmdPrepareMemoryRegions = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareMemoryRegions"); + nextTable.CmdPrepareMemoryRegions = fpCmdPrepareMemoryRegions; + CmdPrepareImagesType fpCmdPrepareImages = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdPrepareImages"); + nextTable.CmdPrepareImages = fpCmdPrepareImages; + CmdDrawType fpCmdDraw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDraw"); + nextTable.CmdDraw = fpCmdDraw; + CmdDrawIndexedType fpCmdDrawIndexed = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexed"); + nextTable.CmdDrawIndexed = fpCmdDrawIndexed; + CmdDrawIndirectType fpCmdDrawIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndirect"); + nextTable.CmdDrawIndirect = fpCmdDrawIndirect; + CmdDrawIndexedIndirectType fpCmdDrawIndexedIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDrawIndexedIndirect"); + nextTable.CmdDrawIndexedIndirect = fpCmdDrawIndexedIndirect; + CmdDispatchType fpCmdDispatch = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatch"); + nextTable.CmdDispatch = fpCmdDispatch; + CmdDispatchIndirectType fpCmdDispatchIndirect = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDispatchIndirect"); + nextTable.CmdDispatchIndirect = fpCmdDispatchIndirect; + CmdCopyMemoryType fpCmdCopyMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemory"); + nextTable.CmdCopyMemory = fpCmdCopyMemory; + CmdCopyImageType fpCmdCopyImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImage"); + nextTable.CmdCopyImage = fpCmdCopyImage; + CmdCopyMemoryToImageType fpCmdCopyMemoryToImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyMemoryToImage"); + nextTable.CmdCopyMemoryToImage = fpCmdCopyMemoryToImage; + CmdCopyImageToMemoryType fpCmdCopyImageToMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCopyImageToMemory"); + nextTable.CmdCopyImageToMemory = fpCmdCopyImageToMemory; + CmdCloneImageDataType fpCmdCloneImageData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdCloneImageData"); + nextTable.CmdCloneImageData = fpCmdCloneImageData; + CmdUpdateMemoryType fpCmdUpdateMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdUpdateMemory"); + nextTable.CmdUpdateMemory = fpCmdUpdateMemory; + CmdFillMemoryType fpCmdFillMemory = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdFillMemory"); + nextTable.CmdFillMemory = fpCmdFillMemory; + CmdClearColorImageType fpCmdClearColorImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImage"); + nextTable.CmdClearColorImage = fpCmdClearColorImage; + CmdClearColorImageRawType fpCmdClearColorImageRaw = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearColorImageRaw"); + nextTable.CmdClearColorImageRaw = fpCmdClearColorImageRaw; + CmdClearDepthStencilType fpCmdClearDepthStencil = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdClearDepthStencil"); + nextTable.CmdClearDepthStencil = fpCmdClearDepthStencil; + CmdResolveImageType fpCmdResolveImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResolveImage"); + nextTable.CmdResolveImage = fpCmdResolveImage; + CmdSetEventType fpCmdSetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSetEvent"); + nextTable.CmdSetEvent = fpCmdSetEvent; + CmdResetEventType fpCmdResetEvent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetEvent"); + nextTable.CmdResetEvent = fpCmdResetEvent; + CmdMemoryAtomicType fpCmdMemoryAtomic = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdMemoryAtomic"); + nextTable.CmdMemoryAtomic = fpCmdMemoryAtomic; + CmdBeginQueryType fpCmdBeginQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBeginQuery"); + nextTable.CmdBeginQuery = fpCmdBeginQuery; + CmdEndQueryType fpCmdEndQuery = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdEndQuery"); + nextTable.CmdEndQuery = fpCmdEndQuery; + CmdResetQueryPoolType fpCmdResetQueryPool = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdResetQueryPool"); + nextTable.CmdResetQueryPool = fpCmdResetQueryPool; + CmdWriteTimestampType fpCmdWriteTimestamp = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdWriteTimestamp"); + nextTable.CmdWriteTimestamp = fpCmdWriteTimestamp; + CmdInitAtomicCountersType fpCmdInitAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdInitAtomicCounters"); + nextTable.CmdInitAtomicCounters = fpCmdInitAtomicCounters; + CmdLoadAtomicCountersType fpCmdLoadAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdLoadAtomicCounters"); + nextTable.CmdLoadAtomicCounters = fpCmdLoadAtomicCounters; + CmdSaveAtomicCountersType fpCmdSaveAtomicCounters = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdSaveAtomicCounters"); + nextTable.CmdSaveAtomicCounters = fpCmdSaveAtomicCounters; + DbgSetValidationLevelType fpDbgSetValidationLevel = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetValidationLevel"); + nextTable.DbgSetValidationLevel = fpDbgSetValidationLevel; + DbgRegisterMsgCallbackType fpDbgRegisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgRegisterMsgCallback"); + nextTable.DbgRegisterMsgCallback = fpDbgRegisterMsgCallback; + DbgUnregisterMsgCallbackType fpDbgUnregisterMsgCallback = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgUnregisterMsgCallback"); + nextTable.DbgUnregisterMsgCallback = fpDbgUnregisterMsgCallback; + DbgSetMessageFilterType fpDbgSetMessageFilter = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetMessageFilter"); + nextTable.DbgSetMessageFilter = fpDbgSetMessageFilter; + DbgSetObjectTagType fpDbgSetObjectTag = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetObjectTag"); + nextTable.DbgSetObjectTag = fpDbgSetObjectTag; + DbgSetGlobalOptionType fpDbgSetGlobalOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetGlobalOption"); + nextTable.DbgSetGlobalOption = fpDbgSetGlobalOption; + DbgSetDeviceOptionType fpDbgSetDeviceOption = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglDbgSetDeviceOption"); + nextTable.DbgSetDeviceOption = fpDbgSetDeviceOption; + CmdDbgMarkerBeginType fpCmdDbgMarkerBegin = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerBegin"); + nextTable.CmdDbgMarkerBegin = fpCmdDbgMarkerBegin; + CmdDbgMarkerEndType fpCmdDbgMarkerEnd = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdDbgMarkerEnd"); + nextTable.CmdDbgMarkerEnd = fpCmdDbgMarkerEnd; + WsiX11AssociateConnectionType fpWsiX11AssociateConnection = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11AssociateConnection"); + nextTable.WsiX11AssociateConnection = fpWsiX11AssociateConnection; + WsiX11GetMSCType fpWsiX11GetMSC = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11GetMSC"); + nextTable.WsiX11GetMSC = fpWsiX11GetMSC; + WsiX11CreatePresentableImageType fpWsiX11CreatePresentableImage = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11CreatePresentableImage"); + nextTable.WsiX11CreatePresentableImage = fpWsiX11CreatePresentableImage; + WsiX11QueuePresentType fpWsiX11QueuePresent = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglWsiX11QueuePresent"); + nextTable.WsiX11QueuePresent = fpWsiX11QueuePresent; +} + + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.GetGpuInfo((XGL_PHYSICAL_GPU)gpuw->nextObject, infoType, pDataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo, XGL_DEVICE* pDevice) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice); + // Save off device in case we need it to create Fences + globalDevice = *pDevice; + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyDevice(XGL_DEVICE device) +{ + printf("MEM INFO : Printing List details prior to xglDestroyDevice()\n"); + printMemList(); + printGlobalCB(); + printObjList(); + if (XGL_FALSE == deleteGlobalCBList()) + printf("MEM ERROR : Issue deleting global CB list in xglDestroyDevice()\n"); + XGL_RESULT result = nextTable.DestroyDevice(device); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* pExtName) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, XGL_SIZE maxLayerCount, XGL_SIZE maxStringSize, XGL_CHAR* const* pOutLayers, XGL_SIZE * pOutLayerCount) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.EnumerateLayers((XGL_PHYSICAL_GPU)gpuw->nextObject, maxLayerCount, maxStringSize, pOutLayers, pOutLayerCount); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetDeviceQueue(XGL_DEVICE device, XGL_QUEUE_TYPE queueType, XGL_UINT queueIndex, XGL_QUEUE* pQueue) +{ + XGL_RESULT result = nextTable.GetDeviceQueue(device, queueType, queueIndex, pQueue); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSubmit(XGL_QUEUE queue, XGL_UINT cmdBufferCount, const XGL_CMD_BUFFER* pCmdBuffers, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs, XGL_FENCE fence) +{ + // TODO : Need to track fence and clear mem references when fence clears + XGL_FENCE localFence = fence; + if (XGL_NULL_HANDLE == fence) { // allocate our own fence to track cmd buffer + localFence = createLocalFence(); + } + // TODO : Verify that the list of memory references here matches what the cmd buffers require + printf("MEM INFO : In xglQueueSubmit(), checking %u cmdBuffers with %u memRefs\n", cmdBufferCount, memRefCount); + printMemList(); + printGlobalCB(); + for (uint32_t i = 0; i < cmdBufferCount; i++) { + setCBFence(pCmdBuffers[i], localFence); + printf("MEM INFO : Verifying mem refs for CB %p\n", pCmdBuffers[i]); + if (XGL_FALSE == validateCBMemRef(pCmdBuffers[i], memRefCount, pMemRefs)) { + printf("MEM ERROR : Unable to verify memory references for CB %p\n", (void*)pCmdBuffers[i]); + } + } + printGlobalCB(); + XGL_RESULT result = nextTable.QueueSubmit(queue, cmdBufferCount, pCmdBuffers, memRefCount, pMemRefs, localFence); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueSetGlobalMemReferences(XGL_QUEUE queue, XGL_UINT memRefCount, const XGL_MEMORY_REF* pMemRefs) +{ + // TODO : Use global mem references as part of list checked on QueueSubmit above + XGL_RESULT result = nextTable.QueueSetGlobalMemReferences(queue, memRefCount, pMemRefs); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglQueueWaitIdle(XGL_QUEUE queue) +{ + XGL_RESULT result = nextTable.QueueWaitIdle(queue); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDeviceWaitIdle(XGL_DEVICE device) +{ + XGL_RESULT result = nextTable.DeviceWaitIdle(device); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapCount(XGL_DEVICE device, XGL_UINT* pCount) +{ + // TODO : Track memory stats here + XGL_RESULT result = nextTable.GetMemoryHeapCount(device, pCount); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMemoryHeapInfo(XGL_DEVICE device, XGL_UINT heapId, XGL_MEMORY_HEAP_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + // TODO : Track memory stats here + XGL_RESULT result = nextTable.GetMemoryHeapInfo(device, heapId, infoType, pDataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglAllocMemory(XGL_DEVICE device, const XGL_MEMORY_ALLOC_INFO* pAllocInfo, XGL_GPU_MEMORY* pMem) +{ + XGL_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem); + // TODO : Track allocations and overall size here + insertGlobalMemObj(*pMem, pAllocInfo); + printMemList(); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglFreeMemory(XGL_GPU_MEMORY mem) +{ + // TODO : Pick up frees here + // Make sure mem object is unbound from any other objects + // Make sure mem object not referenced by any queued command buffers + if (XGL_FALSE == freeMemNode(mem)) + printf("MEM ERROR : Issue while freeing mem obj %p\n", (void*)mem); + + printMemList(); + printObjList(); + printGlobalCB(); + XGL_RESULT result = nextTable.FreeMemory(mem); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetMemoryPriority(XGL_GPU_MEMORY mem, XGL_MEMORY_PRIORITY priority) +{ + // TODO : Update tracking for this alloc + // Make sure memory is not pinned, which can't have priority set + XGL_RESULT result = nextTable.SetMemoryPriority(mem, priority); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglMapMemory(XGL_GPU_MEMORY mem, XGL_FLAGS flags, XGL_VOID** ppData) +{ + // TODO : Track when memory is mapped + XGL_RESULT result = nextTable.MapMemory(mem, flags, ppData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglUnmapMemory(XGL_GPU_MEMORY mem) +{ + // TODO : Track as memory gets unmapped, do we want to check what changed following map? + // Make sure that memory was ever mapped to begin with + XGL_RESULT result = nextTable.UnmapMemory(mem); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglPinSystemMemory(XGL_DEVICE device, const XGL_VOID* pSysMem, XGL_SIZE memSize, XGL_GPU_MEMORY* pMem) +{ + // TODO : Track this + // Verify that memory is actually pinnable + XGL_RESULT result = nextTable.PinSystemMemory(device, pSysMem, memSize, pMem); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglRemapVirtualMemoryPages(XGL_DEVICE device, XGL_UINT rangeCount, const XGL_VIRTUAL_MEMORY_REMAP_RANGE* pRanges, XGL_UINT preWaitSemaphoreCount, const XGL_QUEUE_SEMAPHORE* pPreWaitSemaphores, XGL_UINT postSignalSemaphoreCount, const XGL_QUEUE_SEMAPHORE* pPostSignalSemaphores) +{ + // TODO : Track this + XGL_RESULT result = nextTable.RemapVirtualMemoryPages(device, rangeCount, pRanges, preWaitSemaphoreCount, pPreWaitSemaphores, postSignalSemaphoreCount, pPostSignalSemaphores); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetMultiGpuCompatibility(XGL_PHYSICAL_GPU gpu0, XGL_PHYSICAL_GPU gpu1, XGL_GPU_COMPATIBILITY_INFO* pInfo) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu0; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.GetMultiGpuCompatibility((XGL_PHYSICAL_GPU)gpuw->nextObject, gpu1, pInfo); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedMemory(XGL_DEVICE device, const XGL_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) +{ + // TODO : Track this + XGL_RESULT result = nextTable.OpenSharedMemory(device, pOpenInfo, pMem); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenSharedQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_OPEN_INFO* pOpenInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) +{ + XGL_RESULT result = nextTable.OpenSharedQueueSemaphore(device, pOpenInfo, pSemaphore); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerMemory(XGL_DEVICE device, const XGL_PEER_MEMORY_OPEN_INFO* pOpenInfo, XGL_GPU_MEMORY* pMem) +{ + // TODO : Track this + XGL_RESULT result = nextTable.OpenPeerMemory(device, pOpenInfo, pMem); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglOpenPeerImage(XGL_DEVICE device, const XGL_PEER_IMAGE_OPEN_INFO* pOpenInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem) +{ + // TODO : Track this + XGL_RESULT result = nextTable.OpenPeerImage(device, pOpenInfo, pImage, pMem); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDestroyObject(XGL_OBJECT object) +{ + // TODO : Verify that no memory is bound to this object at time of destruction + GLOBAL_OBJECT_NODE* pTrav = getGlobalObjectNode(object); + if (pTrav) { + if (pTrav->pMemNode) { + printf("MEM ERROR : Destroying obj %p that is still bound to memory object %p\n", object, (void*)pTrav->pMemNode->mem); + printf("MEM ERROR : You should first clear binding by calling xglBindObjectMemory(%p, 0, XGL_NULL_HANDLE)\n", object); + clearObjectBinding(object); + } + if (pGlobalObjectHead == pTrav) // update HEAD if needed + pGlobalObjectHead = pTrav->pNext; + // Delete the obj node + free(pTrav); + } + XGL_RESULT result = nextTable.DestroyObject(object); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetObjectInfo(XGL_BASE_OBJECT object, XGL_OBJECT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + // TODO : What to track here? + // Could potentially save returned mem requirements and validate values passed into BindObjectMemory for this object + XGL_RESULT result = nextTable.GetObjectInfo(object, infoType, pDataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBindObjectMemory(XGL_OBJECT object, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) +{ + XGL_RESULT result = nextTable.BindObjectMemory(object, mem, offset); + // Track objects tied to memory + if (XGL_FALSE == updateObjectBinding(object, mem)) + printf("MEM ERROR : Unable to set object %p binding to mem obj %p\n", (void*)object, (void*)mem); + printObjList(); + printMemList(); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateFence(XGL_DEVICE device, const XGL_FENCE_CREATE_INFO* pCreateInfo, XGL_FENCE* pFence) +{ + XGL_RESULT result = nextTable.CreateFence(device, pCreateInfo, pFence); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFenceStatus(XGL_FENCE fence) +{ + XGL_RESULT result = nextTable.GetFenceStatus(fence); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitForFences(XGL_DEVICE device, XGL_UINT fenceCount, const XGL_FENCE* pFences, XGL_BOOL waitAll, XGL_UINT64 timeout) +{ + XGL_RESULT result = nextTable.WaitForFences(device, fenceCount, pFences, waitAll, timeout); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueueSemaphore(XGL_DEVICE device, const XGL_QUEUE_SEMAPHORE_CREATE_INFO* pCreateInfo, XGL_QUEUE_SEMAPHORE* pSemaphore) +{ + XGL_RESULT result = nextTable.CreateQueueSemaphore(device, pCreateInfo, pSemaphore); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSignalQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) +{ + XGL_RESULT result = nextTable.SignalQueueSemaphore(queue, semaphore); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWaitQueueSemaphore(XGL_QUEUE queue, XGL_QUEUE_SEMAPHORE semaphore) +{ + XGL_RESULT result = nextTable.WaitQueueSemaphore(queue, semaphore); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateEvent(XGL_DEVICE device, const XGL_EVENT_CREATE_INFO* pCreateInfo, XGL_EVENT* pEvent) +{ + XGL_RESULT result = nextTable.CreateEvent(device, pCreateInfo, pEvent); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetEventStatus(XGL_EVENT event) +{ + XGL_RESULT result = nextTable.GetEventStatus(event); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglSetEvent(XGL_EVENT event) +{ + XGL_RESULT result = nextTable.SetEvent(event); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetEvent(XGL_EVENT event) +{ + XGL_RESULT result = nextTable.ResetEvent(event); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateQueryPool(XGL_DEVICE device, const XGL_QUERY_POOL_CREATE_INFO* pCreateInfo, XGL_QUERY_POOL* pQueryPool) +{ + XGL_RESULT result = nextTable.CreateQueryPool(device, pCreateInfo, pQueryPool); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetQueryPoolResults(XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.GetQueryPoolResults(queryPool, startQuery, queryCount, pDataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetFormatInfo(XGL_DEVICE device, XGL_FORMAT format, XGL_FORMAT_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.GetFormatInfo(device, format, infoType, pDataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImage(XGL_DEVICE device, const XGL_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage) +{ + XGL_RESULT result = nextTable.CreateImage(device, pCreateInfo, pImage); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetImageSubresourceInfo(XGL_IMAGE image, const XGL_IMAGE_SUBRESOURCE* pSubresource, XGL_SUBRESOURCE_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.GetImageSubresourceInfo(image, pSubresource, infoType, pDataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImageView(XGL_DEVICE device, const XGL_IMAGE_VIEW_CREATE_INFO* pCreateInfo, XGL_IMAGE_VIEW* pView) +{ + XGL_RESULT result = nextTable.CreateImageView(device, pCreateInfo, pView); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorAttachmentView(XGL_DEVICE device, const XGL_COLOR_ATTACHMENT_VIEW_CREATE_INFO* pCreateInfo, XGL_COLOR_ATTACHMENT_VIEW* pView) +{ + XGL_RESULT result = nextTable.CreateColorAttachmentView(device, pCreateInfo, pView); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilView(XGL_DEVICE device, const XGL_DEPTH_STENCIL_VIEW_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_VIEW* pView) +{ + XGL_RESULT result = nextTable.CreateDepthStencilView(device, pCreateInfo, pView); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateShader(XGL_DEVICE device, const XGL_SHADER_CREATE_INFO* pCreateInfo, XGL_SHADER* pShader) +{ + XGL_RESULT result = nextTable.CreateShader(device, pCreateInfo, pShader); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateGraphicsPipeline(XGL_DEVICE device, const XGL_GRAPHICS_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) +{ + XGL_RESULT result = nextTable.CreateGraphicsPipeline(device, pCreateInfo, pPipeline); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateComputePipeline(XGL_DEVICE device, const XGL_COMPUTE_PIPELINE_CREATE_INFO* pCreateInfo, XGL_PIPELINE* pPipeline) +{ + XGL_RESULT result = nextTable.CreateComputePipeline(device, pCreateInfo, pPipeline); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglStorePipeline(XGL_PIPELINE pipeline, XGL_SIZE* pDataSize, XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.StorePipeline(pipeline, pDataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglLoadPipeline(XGL_DEVICE device, XGL_SIZE dataSize, const XGL_VOID* pData, XGL_PIPELINE* pPipeline) +{ + XGL_RESULT result = nextTable.LoadPipeline(device, dataSize, pData, pPipeline); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreatePipelineDelta(XGL_DEVICE device, XGL_PIPELINE p1, XGL_PIPELINE p2, XGL_PIPELINE_DELTA* delta) +{ + XGL_RESULT result = nextTable.CreatePipelineDelta(device, p1, p2, delta); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateSampler(XGL_DEVICE device, const XGL_SAMPLER_CREATE_INFO* pCreateInfo, XGL_SAMPLER* pSampler) +{ + XGL_RESULT result = nextTable.CreateSampler(device, pCreateInfo, pSampler); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorSet(XGL_DEVICE device, const XGL_DESCRIPTOR_SET_CREATE_INFO* pCreateInfo, XGL_DESCRIPTOR_SET* pDescriptorSet) +{ + XGL_RESULT result = nextTable.CreateDescriptorSet(device, pCreateInfo, pDescriptorSet); + return result; +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglBeginDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) +{ + nextTable.BeginDescriptorSetUpdate(descriptorSet); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglEndDescriptorSetUpdate(XGL_DESCRIPTOR_SET descriptorSet) +{ + nextTable.EndDescriptorSetUpdate(descriptorSet); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachSamplerDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_SAMPLER* pSamplers) +{ + nextTable.AttachSamplerDescriptors(descriptorSet, startSlot, slotCount, pSamplers); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachImageViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_IMAGE_VIEW_ATTACH_INFO* pImageViews) +{ + nextTable.AttachImageViewDescriptors(descriptorSet, startSlot, slotCount, pImageViews); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachMemoryViewDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemViews) +{ + nextTable.AttachMemoryViewDescriptors(descriptorSet, startSlot, slotCount, pMemViews); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglAttachNestedDescriptors(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount, const XGL_DESCRIPTOR_SET_ATTACH_INFO* pNestedDescriptorSets) +{ + nextTable.AttachNestedDescriptors(descriptorSet, startSlot, slotCount, pNestedDescriptorSets); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglClearDescriptorSetSlots(XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT startSlot, XGL_UINT slotCount) +{ + nextTable.ClearDescriptorSetSlots(descriptorSet, startSlot, slotCount); +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateViewportState(XGL_DEVICE device, const XGL_VIEWPORT_STATE_CREATE_INFO* pCreateInfo, XGL_VIEWPORT_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateViewportState(device, pCreateInfo, pState); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateRasterState(XGL_DEVICE device, const XGL_RASTER_STATE_CREATE_INFO* pCreateInfo, XGL_RASTER_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateRasterState(device, pCreateInfo, pState); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateMsaaState(XGL_DEVICE device, const XGL_MSAA_STATE_CREATE_INFO* pCreateInfo, XGL_MSAA_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateMsaaState(device, pCreateInfo, pState); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateColorBlendState(XGL_DEVICE device, const XGL_COLOR_BLEND_STATE_CREATE_INFO* pCreateInfo, XGL_COLOR_BLEND_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateColorBlendState(device, pCreateInfo, pState); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDepthStencilState(XGL_DEVICE device, const XGL_DEPTH_STENCIL_STATE_CREATE_INFO* pCreateInfo, XGL_DEPTH_STENCIL_STATE_OBJECT* pState) +{ + XGL_RESULT result = nextTable.CreateDepthStencilState(device, pCreateInfo, pState); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateCommandBuffer(XGL_DEVICE device, const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo, XGL_CMD_BUFFER* pCmdBuffer) +{ + XGL_RESULT result = nextTable.CreateCommandBuffer(device, pCreateInfo, pCmdBuffer); + // At time of cmd buffer creation, create global cmd buffer node for the returned cmd buffer + if (*pCmdBuffer) + insertGlobalCB(*pCmdBuffer); + printGlobalCB(); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglBeginCommandBuffer(XGL_CMD_BUFFER cmdBuffer, XGL_FLAGS flags) +{ + // This implicitly resets the Cmd Buffer so clear memory references + freeCBBindings(cmdBuffer); + XGL_RESULT result = nextTable.BeginCommandBuffer(cmdBuffer, flags); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEndCommandBuffer(XGL_CMD_BUFFER cmdBuffer) +{ + // TODO : Anything to do here? + XGL_RESULT result = nextTable.EndCommandBuffer(cmdBuffer); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglResetCommandBuffer(XGL_CMD_BUFFER cmdBuffer) +{ + // Clear memory references as this point. Anything else to do here? + freeCBBindings(cmdBuffer); + XGL_RESULT result = nextTable.ResetCommandBuffer(cmdBuffer); + return result; +} +// TODO : For any xglCmdBind* calls that include an object which has mem bound to it, +// need to account for that mem now having binding to given cmdBuffer +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipeline(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE pipeline) +{ + nextTable.CmdBindPipeline(cmdBuffer, pipelineBindPoint, pipeline); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindPipelineDelta(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_PIPELINE_DELTA delta) +{ + nextTable.CmdBindPipelineDelta(cmdBuffer, pipelineBindPoint, delta); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindStateObject(XGL_CMD_BUFFER cmdBuffer, XGL_STATE_BIND_POINT stateBindPoint, XGL_STATE_OBJECT state) +{ + nextTable.CmdBindStateObject(cmdBuffer, stateBindPoint, state); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDescriptorSet(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT index, XGL_DESCRIPTOR_SET descriptorSet, XGL_UINT slotOffset) +{ + nextTable.CmdBindDescriptorSet(cmdBuffer, pipelineBindPoint, index, descriptorSet, slotOffset); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindDynamicMemoryView(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView) +{ + nextTable.CmdBindDynamicMemoryView(cmdBuffer, pipelineBindPoint, pMemView); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindIndexData(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_INDEX_TYPE indexType) +{ + // Track this memory. What exactly is this call doing? + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdBindIndexData() call unable to update binding of mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdBindIndexData(cmdBuffer, mem, offset, indexType); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBindAttachments(XGL_CMD_BUFFER cmdBuffer, XGL_UINT colorAttachmentCount, const XGL_COLOR_ATTACHMENT_BIND_INFO* pColorAttachments, const XGL_DEPTH_STENCIL_BIND_INFO* pDepthStencilAttachment) +{ + nextTable.CmdBindAttachments(cmdBuffer, colorAttachmentCount, pColorAttachments, pDepthStencilAttachment); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareMemoryRegions(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_MEMORY_STATE_TRANSITION* pStateTransitions) +{ + // TODO : Track memory state transitions + // Flag incorrect transitions when states don't match + XGL_GPU_MEMORY mem = pStateTransitions->mem; + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdPrepareMemoryRegions() call unable to update binding of mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdPrepareMemoryRegions(cmdBuffer, transitionCount, pStateTransitions); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdPrepareImages(XGL_CMD_BUFFER cmdBuffer, XGL_UINT transitionCount, const XGL_IMAGE_STATE_TRANSITION* pStateTransitions) +{ + // TODO : This will have an image object that's bound to memory in the pStateTransitions struct + // Need to pull object based on image and then pull mem mapping from that object + XGL_GPU_MEMORY mem = getMemBindingFromObject((XGL_OBJECT)pStateTransitions->image); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdPrepareImages() call unable to update binding of mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdPrepareImages(cmdBuffer, transitionCount, pStateTransitions); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDraw(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstVertex, XGL_UINT vertexCount, XGL_UINT firstInstance, XGL_UINT instanceCount) +{ + nextTable.CmdDraw(cmdBuffer, firstVertex, vertexCount, firstInstance, instanceCount); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndexed(XGL_CMD_BUFFER cmdBuffer, XGL_UINT firstIndex, XGL_UINT indexCount, XGL_INT vertexOffset, XGL_UINT firstInstance, XGL_UINT instanceCount) +{ + nextTable.CmdDrawIndexed(cmdBuffer, firstIndex, indexCount, vertexOffset, firstInstance, instanceCount); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT32 count, XGL_UINT32 stride) +{ + // TODO : Track this + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdDrawIndirect() call unable to update binding of mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdDrawIndirect(cmdBuffer, mem, offset, count, stride); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDrawIndexedIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset, XGL_UINT32 count, XGL_UINT32 stride) +{ + // TODO : Track this + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdDrawIndexedIndirect() call unable to update binding of mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdDrawIndexedIndirect(cmdBuffer, mem, offset, count, stride); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatch(XGL_CMD_BUFFER cmdBuffer, XGL_UINT x, XGL_UINT y, XGL_UINT z) +{ + nextTable.CmdDispatch(cmdBuffer, x, y, z); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDispatchIndirect(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY mem, XGL_GPU_SIZE offset) +{ + // TODO : Track this + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdDispatchIndirect() call unable to update binding of mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdDispatchIndirect(cmdBuffer, mem, offset); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY srcMem, XGL_GPU_MEMORY destMem, XGL_UINT regionCount, const XGL_MEMORY_COPY* pRegions) +{ + // TODO : Track this + if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) + printf("MEM ERROR : In xglCmdCopyMemory() call unable to update binding of srcMem %p to cmdBuffer %p\n", srcMem, cmdBuffer); + if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) + printf("MEM ERROR : In xglCmdCopyMemory() call unable to update binding of destMem %p to cmdBuffer %p\n", destMem, cmdBuffer); + nextTable.CmdCopyMemory(cmdBuffer, srcMem, destMem, regionCount, pRegions); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, XGL_UINT regionCount, const XGL_IMAGE_COPY* pRegions) +{ + // TODO : Each image will have mem mapping so track them + nextTable.CmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyMemoryToImage(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY srcMem, XGL_IMAGE destImage, XGL_UINT regionCount, const XGL_MEMORY_IMAGE_COPY* pRegions) +{ + // TODO : Track this + XGL_GPU_MEMORY mem = getMemBindingFromObject(destImage); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdCopyMemoryToImage() call unable to update binding of destImage mem %p to cmdBuffer %p\n", mem, cmdBuffer); + if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) + printf("MEM ERROR : In xglCmdCopyMemoryToImage() call unable to update binding of srcMem %p to cmdBuffer %p\n", srcMem, cmdBuffer); + nextTable.CmdCopyMemoryToImage(cmdBuffer, srcMem, destImage, regionCount, pRegions); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCopyImageToMemory(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_GPU_MEMORY destMem, XGL_UINT regionCount, const XGL_MEMORY_IMAGE_COPY* pRegions) +{ + // TODO : Track this + XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdCopyImageToMemory() call unable to update binding of srcImage mem %p to cmdBuffer %p\n", mem, cmdBuffer); + if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) + printf("MEM ERROR : In xglCmdCopyImageToMemory() call unable to update binding of destMem %p to cmdBuffer %p\n", destMem, cmdBuffer); + nextTable.CmdCopyImageToMemory(cmdBuffer, srcImage, destMem, regionCount, pRegions); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdCloneImageData(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_STATE srcImageState, XGL_IMAGE destImage, XGL_IMAGE_STATE destImageState) +{ + // TODO : Each image will have mem mapping so track them + XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdCloneImageData() call unable to update binding of srcImage mem %p to cmdBuffer %p\n", mem, cmdBuffer); + mem = getMemBindingFromObject(destImage); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdCloneImageData() call unable to update binding of destImage mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdCloneImageData(cmdBuffer, srcImage, srcImageState, destImage, destImageState); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdUpdateMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_GPU_SIZE dataSize, const XGL_UINT32* pData) +{ + if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) + printf("MEM ERROR : In xglCmdUpdateMemory() call unable to update binding of destMem %p to cmdBuffer %p\n", destMem, cmdBuffer); + nextTable.CmdUpdateMemory(cmdBuffer, destMem, destOffset, dataSize, pData); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdFillMemory(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_GPU_SIZE fillSize, XGL_UINT32 data) +{ + if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) + printf("MEM ERROR : In xglCmdFillMemory() call unable to update binding of destMem %p to cmdBuffer %p\n", destMem, cmdBuffer); + nextTable.CmdFillMemory(cmdBuffer, destMem, destOffset, fillSize, data); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearColorImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, const XGL_FLOAT color[4], XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) +{ + XGL_GPU_MEMORY mem = getMemBindingFromObject(image); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdClearColorImage() call unable to update binding of image mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdClearColorImage(cmdBuffer, image, color, rangeCount, pRanges); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearColorImageRaw(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, const XGL_UINT32 color[4], XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) +{ + XGL_GPU_MEMORY mem = getMemBindingFromObject(image); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdClearColorImageRaw() call unable to update binding of image mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdClearColorImageRaw(cmdBuffer, image, color, rangeCount, pRanges); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdClearDepthStencil(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE image, XGL_FLOAT depth, XGL_UINT32 stencil, XGL_UINT rangeCount, const XGL_IMAGE_SUBRESOURCE_RANGE* pRanges) +{ + XGL_GPU_MEMORY mem = getMemBindingFromObject(image); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdClearDepthStencil() call unable to update binding of image mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdClearDepthStencil(cmdBuffer, image, depth, stencil, rangeCount, pRanges); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResolveImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, XGL_UINT rectCount, const XGL_IMAGE_RESOLVE* pRects) +{ + XGL_GPU_MEMORY mem = getMemBindingFromObject(srcImage); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdResolveImage() call unable to update binding of srcImage mem %p to cmdBuffer %p\n", mem, cmdBuffer); + mem = getMemBindingFromObject(destImage); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdResolveImage() call unable to update binding of destImage mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdResolveImage(cmdBuffer, srcImage, destImage, rectCount, pRects); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) +{ + nextTable.CmdSetEvent(cmdBuffer, event); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetEvent(XGL_CMD_BUFFER cmdBuffer, XGL_EVENT event) +{ + nextTable.CmdResetEvent(cmdBuffer, event); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdMemoryAtomic(XGL_CMD_BUFFER cmdBuffer, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset, XGL_UINT64 srcData, XGL_ATOMIC_OP atomicOp) +{ + if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) + printf("MEM ERROR : In xglCmdMemoryAtomic() call unable to update binding of destMem %p to cmdBuffer %p\n", destMem, cmdBuffer); + nextTable.CmdMemoryAtomic(cmdBuffer, destMem, destOffset, srcData, atomicOp); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdBeginQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot, XGL_FLAGS flags) +{ + XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdBeginQuery() call unable to update binding of queryPool mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdBeginQuery(cmdBuffer, queryPool, slot, flags); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdEndQuery(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT slot) +{ + XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdEndQuery() call unable to update binding of queryPool mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdEndQuery(cmdBuffer, queryPool, slot); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdResetQueryPool(XGL_CMD_BUFFER cmdBuffer, XGL_QUERY_POOL queryPool, XGL_UINT startQuery, XGL_UINT queryCount) +{ + XGL_GPU_MEMORY mem = getMemBindingFromObject(queryPool); + if (XGL_FALSE == updateCBBinding(cmdBuffer, mem)) + printf("MEM ERROR : In xglCmdResetQueryPool() call unable to update binding of queryPool mem %p to cmdBuffer %p\n", mem, cmdBuffer); + nextTable.CmdResetQueryPool(cmdBuffer, queryPool, startQuery, queryCount); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdWriteTimestamp(XGL_CMD_BUFFER cmdBuffer, XGL_TIMESTAMP_TYPE timestampType, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset) +{ + if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) + printf("MEM ERROR : In xglCmdWriteTimestamp() call unable to update binding of destMem %p to cmdBuffer %p\n", destMem, cmdBuffer); + nextTable.CmdWriteTimestamp(cmdBuffer, timestampType, destMem, destOffset); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdInitAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, const XGL_UINT32* pData) +{ + nextTable.CmdInitAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, pData); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdLoadAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, XGL_GPU_MEMORY srcMem, XGL_GPU_SIZE srcOffset) +{ + if (XGL_FALSE == updateCBBinding(cmdBuffer, srcMem)) + printf("MEM ERROR : In xglCmdLoadAtomicCounters() call unable to update binding of srcMem %p to cmdBuffer %p\n", srcMem, cmdBuffer); + nextTable.CmdLoadAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, srcMem, srcOffset); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdSaveAtomicCounters(XGL_CMD_BUFFER cmdBuffer, XGL_PIPELINE_BIND_POINT pipelineBindPoint, XGL_UINT startCounter, XGL_UINT counterCount, XGL_GPU_MEMORY destMem, XGL_GPU_SIZE destOffset) +{ + if (XGL_FALSE == updateCBBinding(cmdBuffer, destMem)) + printf("MEM ERROR : In xglCmdSaveAtomicCounters() call unable to update binding of destMem %p to cmdBuffer %p\n", destMem, cmdBuffer); + nextTable.CmdSaveAtomicCounters(cmdBuffer, pipelineBindPoint, startCounter, counterCount, destMem, destOffset); +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetValidationLevel(XGL_DEVICE device, XGL_VALIDATION_LEVEL validationLevel) +{ + XGL_RESULT result = nextTable.DbgSetValidationLevel(device, validationLevel); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgRegisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback, XGL_VOID* pUserData) +{ + XGL_RESULT result = nextTable.DbgRegisterMsgCallback(pfnMsgCallback, pUserData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgUnregisterMsgCallback(XGL_DBG_MSG_CALLBACK_FUNCTION pfnMsgCallback) +{ + XGL_RESULT result = nextTable.DbgUnregisterMsgCallback(pfnMsgCallback); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetMessageFilter(XGL_DEVICE device, XGL_INT msgCode, XGL_DBG_MSG_FILTER filter) +{ + XGL_RESULT result = nextTable.DbgSetMessageFilter(device, msgCode, filter); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetObjectTag(XGL_BASE_OBJECT object, XGL_SIZE tagSize, const XGL_VOID* pTag) +{ + XGL_RESULT result = nextTable.DbgSetObjectTag(object, tagSize, pTag); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetGlobalOption(XGL_DBG_GLOBAL_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.DbgSetGlobalOption(dbgOption, dataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglDbgSetDeviceOption(XGL_DEVICE device, XGL_DBG_DEVICE_OPTION dbgOption, XGL_SIZE dataSize, const XGL_VOID* pData) +{ + XGL_RESULT result = nextTable.DbgSetDeviceOption(device, dbgOption, dataSize, pData); + return result; +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerBegin(XGL_CMD_BUFFER cmdBuffer, const XGL_CHAR* pMarker) +{ + nextTable.CmdDbgMarkerBegin(cmdBuffer, pMarker); +} + +XGL_LAYER_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerEnd(XGL_CMD_BUFFER cmdBuffer) +{ + nextTable.CmdDbgMarkerEnd(cmdBuffer); +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11AssociateConnection(XGL_PHYSICAL_GPU gpu, const XGL_WSI_X11_CONNECTION_INFO* pConnectionInfo) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + printf("At start of layered WsiX11AssociateConnection\n"); + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + XGL_RESULT result = nextTable.WsiX11AssociateConnection((XGL_PHYSICAL_GPU)gpuw->nextObject, pConnectionInfo); + printf("Completed layered WsiX11AssociateConnection\n"); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11GetMSC(XGL_DEVICE device, xcb_randr_crtc_t crtc, XGL_UINT64* pMsc) +{ + XGL_RESULT result = nextTable.WsiX11GetMSC(device, crtc, pMsc); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11CreatePresentableImage(XGL_DEVICE device, const XGL_WSI_X11_PRESENTABLE_IMAGE_CREATE_INFO* pCreateInfo, XGL_IMAGE* pImage, XGL_GPU_MEMORY* pMem) +{ + XGL_RESULT result = nextTable.WsiX11CreatePresentableImage(device, pCreateInfo, pImage, pMem); + return result; +} + +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglWsiX11QueuePresent(XGL_QUEUE queue, const XGL_WSI_X11_PRESENT_INFO* pPresentInfo, XGL_FENCE fence) +{ + XGL_RESULT result = nextTable.WsiX11QueuePresent(queue, pPresentInfo, fence); + return result; +} + +XGL_LAYER_EXPORT XGL_VOID* XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_CHAR* funcName) +{ + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + if (gpu == NULL) + return NULL; + pCurObj = gpuw; + pthread_once(&tabOnce, initLayerTable); + + if (!strncmp("xglGetProcAddr", (const char *) funcName, sizeof("xglGetProcAddr"))) + return xglGetProcAddr; + else if (!strncmp("xglInitAndEnumerateGpus", (const char *) funcName, sizeof("xglInitAndEnumerateGpus"))) + return nextTable.InitAndEnumerateGpus; + else if (!strncmp("xglGetGpuInfo", (const char *) funcName, sizeof("xglGetGpuInfo"))) + return xglGetGpuInfo; + else if (!strncmp("xglCreateDevice", (const char *) funcName, sizeof("xglCreateDevice"))) + return xglCreateDevice; + else if (!strncmp("xglDestroyDevice", (const char *) funcName, sizeof("xglDestroyDevice"))) + return xglDestroyDevice; + else if (!strncmp("xglGetExtensionSupport", (const char *) funcName, sizeof("xglGetExtensionSupport"))) + return xglGetExtensionSupport; + else if (!strncmp("xglEnumerateLayers", (const char *) funcName, sizeof("xglEnumerateLayers"))) + return xglEnumerateLayers; + else if (!strncmp("xglGetDeviceQueue", (const char *) funcName, sizeof("xglGetDeviceQueue"))) + return xglGetDeviceQueue; + else if (!strncmp("xglQueueSubmit", (const char *) funcName, sizeof("xglQueueSubmit"))) + return xglQueueSubmit; + else if (!strncmp("xglQueueSetGlobalMemReferences", (const char *) funcName, sizeof("xglQueueSetGlobalMemReferences"))) + return xglQueueSetGlobalMemReferences; + else if (!strncmp("xglQueueWaitIdle", (const char *) funcName, sizeof("xglQueueWaitIdle"))) + return xglQueueWaitIdle; + else if (!strncmp("xglDeviceWaitIdle", (const char *) funcName, sizeof("xglDeviceWaitIdle"))) + return xglDeviceWaitIdle; + else if (!strncmp("xglGetMemoryHeapCount", (const char *) funcName, sizeof("xglGetMemoryHeapCount"))) + return xglGetMemoryHeapCount; + else if (!strncmp("xglGetMemoryHeapInfo", (const char *) funcName, sizeof("xglGetMemoryHeapInfo"))) + return xglGetMemoryHeapInfo; + else if (!strncmp("xglAllocMemory", (const char *) funcName, sizeof("xglAllocMemory"))) + return xglAllocMemory; + else if (!strncmp("xglFreeMemory", (const char *) funcName, sizeof("xglFreeMemory"))) + return xglFreeMemory; + else if (!strncmp("xglSetMemoryPriority", (const char *) funcName, sizeof("xglSetMemoryPriority"))) + return xglSetMemoryPriority; + else if (!strncmp("xglMapMemory", (const char *) funcName, sizeof("xglMapMemory"))) + return xglMapMemory; + else if (!strncmp("xglUnmapMemory", (const char *) funcName, sizeof("xglUnmapMemory"))) + return xglUnmapMemory; + else if (!strncmp("xglPinSystemMemory", (const char *) funcName, sizeof("xglPinSystemMemory"))) + return xglPinSystemMemory; + else if (!strncmp("xglRemapVirtualMemoryPages", (const char *) funcName, sizeof("xglRemapVirtualMemoryPages"))) + return xglRemapVirtualMemoryPages; + else if (!strncmp("xglGetMultiGpuCompatibility", (const char *) funcName, sizeof("xglGetMultiGpuCompatibility"))) + return xglGetMultiGpuCompatibility; + else if (!strncmp("xglOpenSharedMemory", (const char *) funcName, sizeof("xglOpenSharedMemory"))) + return xglOpenSharedMemory; + else if (!strncmp("xglOpenSharedQueueSemaphore", (const char *) funcName, sizeof("xglOpenSharedQueueSemaphore"))) + return xglOpenSharedQueueSemaphore; + else if (!strncmp("xglOpenPeerMemory", (const char *) funcName, sizeof("xglOpenPeerMemory"))) + return xglOpenPeerMemory; + else if (!strncmp("xglOpenPeerImage", (const char *) funcName, sizeof("xglOpenPeerImage"))) + return xglOpenPeerImage; + else if (!strncmp("xglDestroyObject", (const char *) funcName, sizeof("xglDestroyObject"))) + return xglDestroyObject; + else if (!strncmp("xglGetObjectInfo", (const char *) funcName, sizeof("xglGetObjectInfo"))) + return xglGetObjectInfo; + else if (!strncmp("xglBindObjectMemory", (const char *) funcName, sizeof("xglBindObjectMemory"))) + return xglBindObjectMemory; + else if (!strncmp("xglCreateFence", (const char *) funcName, sizeof("xglCreateFence"))) + return xglCreateFence; + else if (!strncmp("xglGetFenceStatus", (const char *) funcName, sizeof("xglGetFenceStatus"))) + return xglGetFenceStatus; + else if (!strncmp("xglWaitForFences", (const char *) funcName, sizeof("xglWaitForFences"))) + return xglWaitForFences; + else if (!strncmp("xglCreateQueueSemaphore", (const char *) funcName, sizeof("xglCreateQueueSemaphore"))) + return xglCreateQueueSemaphore; + else if (!strncmp("xglSignalQueueSemaphore", (const char *) funcName, sizeof("xglSignalQueueSemaphore"))) + return xglSignalQueueSemaphore; + else if (!strncmp("xglWaitQueueSemaphore", (const char *) funcName, sizeof("xglWaitQueueSemaphore"))) + return xglWaitQueueSemaphore; + else if (!strncmp("xglCreateEvent", (const char *) funcName, sizeof("xglCreateEvent"))) + return xglCreateEvent; + else if (!strncmp("xglGetEventStatus", (const char *) funcName, sizeof("xglGetEventStatus"))) + return xglGetEventStatus; + else if (!strncmp("xglSetEvent", (const char *) funcName, sizeof("xglSetEvent"))) + return xglSetEvent; + else if (!strncmp("xglResetEvent", (const char *) funcName, sizeof("xglResetEvent"))) + return xglResetEvent; + else if (!strncmp("xglCreateQueryPool", (const char *) funcName, sizeof("xglCreateQueryPool"))) + return xglCreateQueryPool; + else if (!strncmp("xglGetQueryPoolResults", (const char *) funcName, sizeof("xglGetQueryPoolResults"))) + return xglGetQueryPoolResults; + else if (!strncmp("xglGetFormatInfo", (const char *) funcName, sizeof("xglGetFormatInfo"))) + return xglGetFormatInfo; + else if (!strncmp("xglCreateImage", (const char *) funcName, sizeof("xglCreateImage"))) + return xglCreateImage; + else if (!strncmp("xglGetImageSubresourceInfo", (const char *) funcName, sizeof("xglGetImageSubresourceInfo"))) + return xglGetImageSubresourceInfo; + else if (!strncmp("xglCreateImageView", (const char *) funcName, sizeof("xglCreateImageView"))) + return xglCreateImageView; + else if (!strncmp("xglCreateColorAttachmentView", (const char *) funcName, sizeof("xglCreateColorAttachmentView"))) + return xglCreateColorAttachmentView; + else if (!strncmp("xglCreateDepthStencilView", (const char *) funcName, sizeof("xglCreateDepthStencilView"))) + return xglCreateDepthStencilView; + else if (!strncmp("xglCreateShader", (const char *) funcName, sizeof("xglCreateShader"))) + return xglCreateShader; + else if (!strncmp("xglCreateGraphicsPipeline", (const char *) funcName, sizeof("xglCreateGraphicsPipeline"))) + return xglCreateGraphicsPipeline; + else if (!strncmp("xglCreateComputePipeline", (const char *) funcName, sizeof("xglCreateComputePipeline"))) + return xglCreateComputePipeline; + else if (!strncmp("xglStorePipeline", (const char *) funcName, sizeof("xglStorePipeline"))) + return xglStorePipeline; + else if (!strncmp("xglLoadPipeline", (const char *) funcName, sizeof("xglLoadPipeline"))) + return xglLoadPipeline; + else if (!strncmp("xglCreatePipelineDelta", (const char *) funcName, sizeof("xglCreatePipelineDelta"))) + return xglCreatePipelineDelta; + else if (!strncmp("xglCreateSampler", (const char *) funcName, sizeof("xglCreateSampler"))) + return xglCreateSampler; + else if (!strncmp("xglCreateDescriptorSet", (const char *) funcName, sizeof("xglCreateDescriptorSet"))) + return xglCreateDescriptorSet; + else if (!strncmp("xglBeginDescriptorSetUpdate", (const char *) funcName, sizeof("xglBeginDescriptorSetUpdate"))) + return xglBeginDescriptorSetUpdate; + else if (!strncmp("xglEndDescriptorSetUpdate", (const char *) funcName, sizeof("xglEndDescriptorSetUpdate"))) + return xglEndDescriptorSetUpdate; + else if (!strncmp("xglAttachSamplerDescriptors", (const char *) funcName, sizeof("xglAttachSamplerDescriptors"))) + return xglAttachSamplerDescriptors; + else if (!strncmp("xglAttachImageViewDescriptors", (const char *) funcName, sizeof("xglAttachImageViewDescriptors"))) + return xglAttachImageViewDescriptors; + else if (!strncmp("xglAttachMemoryViewDescriptors", (const char *) funcName, sizeof("xglAttachMemoryViewDescriptors"))) + return xglAttachMemoryViewDescriptors; + else if (!strncmp("xglAttachNestedDescriptors", (const char *) funcName, sizeof("xglAttachNestedDescriptors"))) + return xglAttachNestedDescriptors; + else if (!strncmp("xglClearDescriptorSetSlots", (const char *) funcName, sizeof("xglClearDescriptorSetSlots"))) + return xglClearDescriptorSetSlots; + else if (!strncmp("xglCreateViewportState", (const char *) funcName, sizeof("xglCreateViewportState"))) + return xglCreateViewportState; + else if (!strncmp("xglCreateRasterState", (const char *) funcName, sizeof("xglCreateRasterState"))) + return xglCreateRasterState; + else if (!strncmp("xglCreateMsaaState", (const char *) funcName, sizeof("xglCreateMsaaState"))) + return xglCreateMsaaState; + else if (!strncmp("xglCreateColorBlendState", (const char *) funcName, sizeof("xglCreateColorBlendState"))) + return xglCreateColorBlendState; + else if (!strncmp("xglCreateDepthStencilState", (const char *) funcName, sizeof("xglCreateDepthStencilState"))) + return xglCreateDepthStencilState; + else if (!strncmp("xglCreateCommandBuffer", (const char *) funcName, sizeof("xglCreateCommandBuffer"))) + return xglCreateCommandBuffer; + else if (!strncmp("xglBeginCommandBuffer", (const char *) funcName, sizeof("xglBeginCommandBuffer"))) + return xglBeginCommandBuffer; + else if (!strncmp("xglEndCommandBuffer", (const char *) funcName, sizeof("xglEndCommandBuffer"))) + return xglEndCommandBuffer; + else if (!strncmp("xglResetCommandBuffer", (const char *) funcName, sizeof("xglResetCommandBuffer"))) + return xglResetCommandBuffer; + else if (!strncmp("xglCmdBindPipeline", (const char *) funcName, sizeof("xglCmdBindPipeline"))) + return xglCmdBindPipeline; + else if (!strncmp("xglCmdBindPipelineDelta", (const char *) funcName, sizeof("xglCmdBindPipelineDelta"))) + return xglCmdBindPipelineDelta; + else if (!strncmp("xglCmdBindStateObject", (const char *) funcName, sizeof("xglCmdBindStateObject"))) + return xglCmdBindStateObject; + else if (!strncmp("xglCmdBindDescriptorSet", (const char *) funcName, sizeof("xglCmdBindDescriptorSet"))) + return xglCmdBindDescriptorSet; + else if (!strncmp("xglCmdBindDynamicMemoryView", (const char *) funcName, sizeof("xglCmdBindDynamicMemoryView"))) + return xglCmdBindDynamicMemoryView; + else if (!strncmp("xglCmdBindIndexData", (const char *) funcName, sizeof("xglCmdBindIndexData"))) + return xglCmdBindIndexData; + else if (!strncmp("xglCmdBindAttachments", (const char *) funcName, sizeof("xglCmdBindAttachments"))) + return xglCmdBindAttachments; + else if (!strncmp("xglCmdPrepareMemoryRegions", (const char *) funcName, sizeof("xglCmdPrepareMemoryRegions"))) + return xglCmdPrepareMemoryRegions; + else if (!strncmp("xglCmdPrepareImages", (const char *) funcName, sizeof("xglCmdPrepareImages"))) + return xglCmdPrepareImages; + else if (!strncmp("xglCmdDraw", (const char *) funcName, sizeof("xglCmdDraw"))) + return xglCmdDraw; + else if (!strncmp("xglCmdDrawIndexed", (const char *) funcName, sizeof("xglCmdDrawIndexed"))) + return xglCmdDrawIndexed; + else if (!strncmp("xglCmdDrawIndirect", (const char *) funcName, sizeof("xglCmdDrawIndirect"))) + return xglCmdDrawIndirect; + else if (!strncmp("xglCmdDrawIndexedIndirect", (const char *) funcName, sizeof("xglCmdDrawIndexedIndirect"))) + return xglCmdDrawIndexedIndirect; + else if (!strncmp("xglCmdDispatch", (const char *) funcName, sizeof("xglCmdDispatch"))) + return xglCmdDispatch; + else if (!strncmp("xglCmdDispatchIndirect", (const char *) funcName, sizeof("xglCmdDispatchIndirect"))) + return xglCmdDispatchIndirect; + else if (!strncmp("xglCmdCopyMemory", (const char *) funcName, sizeof("xglCmdCopyMemory"))) + return xglCmdCopyMemory; + else if (!strncmp("xglCmdCopyImage", (const char *) funcName, sizeof("xglCmdCopyImage"))) + return xglCmdCopyImage; + else if (!strncmp("xglCmdCopyMemoryToImage", (const char *) funcName, sizeof("xglCmdCopyMemoryToImage"))) + return xglCmdCopyMemoryToImage; + else if (!strncmp("xglCmdCopyImageToMemory", (const char *) funcName, sizeof("xglCmdCopyImageToMemory"))) + return xglCmdCopyImageToMemory; + else if (!strncmp("xglCmdCloneImageData", (const char *) funcName, sizeof("xglCmdCloneImageData"))) + return xglCmdCloneImageData; + else if (!strncmp("xglCmdUpdateMemory", (const char *) funcName, sizeof("xglCmdUpdateMemory"))) + return xglCmdUpdateMemory; + else if (!strncmp("xglCmdFillMemory", (const char *) funcName, sizeof("xglCmdFillMemory"))) + return xglCmdFillMemory; + else if (!strncmp("xglCmdClearColorImage", (const char *) funcName, sizeof("xglCmdClearColorImage"))) + return xglCmdClearColorImage; + else if (!strncmp("xglCmdClearColorImageRaw", (const char *) funcName, sizeof("xglCmdClearColorImageRaw"))) + return xglCmdClearColorImageRaw; + else if (!strncmp("xglCmdClearDepthStencil", (const char *) funcName, sizeof("xglCmdClearDepthStencil"))) + return xglCmdClearDepthStencil; + else if (!strncmp("xglCmdResolveImage", (const char *) funcName, sizeof("xglCmdResolveImage"))) + return xglCmdResolveImage; + else if (!strncmp("xglCmdSetEvent", (const char *) funcName, sizeof("xglCmdSetEvent"))) + return xglCmdSetEvent; + else if (!strncmp("xglCmdResetEvent", (const char *) funcName, sizeof("xglCmdResetEvent"))) + return xglCmdResetEvent; + else if (!strncmp("xglCmdMemoryAtomic", (const char *) funcName, sizeof("xglCmdMemoryAtomic"))) + return xglCmdMemoryAtomic; + else if (!strncmp("xglCmdBeginQuery", (const char *) funcName, sizeof("xglCmdBeginQuery"))) + return xglCmdBeginQuery; + else if (!strncmp("xglCmdEndQuery", (const char *) funcName, sizeof("xglCmdEndQuery"))) + return xglCmdEndQuery; + else if (!strncmp("xglCmdResetQueryPool", (const char *) funcName, sizeof("xglCmdResetQueryPool"))) + return xglCmdResetQueryPool; + else if (!strncmp("xglCmdWriteTimestamp", (const char *) funcName, sizeof("xglCmdWriteTimestamp"))) + return xglCmdWriteTimestamp; + else if (!strncmp("xglCmdInitAtomicCounters", (const char *) funcName, sizeof("xglCmdInitAtomicCounters"))) + return xglCmdInitAtomicCounters; + else if (!strncmp("xglCmdLoadAtomicCounters", (const char *) funcName, sizeof("xglCmdLoadAtomicCounters"))) + return xglCmdLoadAtomicCounters; + else if (!strncmp("xglCmdSaveAtomicCounters", (const char *) funcName, sizeof("xglCmdSaveAtomicCounters"))) + return xglCmdSaveAtomicCounters; + else if (!strncmp("xglDbgSetValidationLevel", (const char *) funcName, sizeof("xglDbgSetValidationLevel"))) + return xglDbgSetValidationLevel; + else if (!strncmp("xglDbgRegisterMsgCallback", (const char *) funcName, sizeof("xglDbgRegisterMsgCallback"))) + return xglDbgRegisterMsgCallback; + else if (!strncmp("xglDbgUnregisterMsgCallback", (const char *) funcName, sizeof("xglDbgUnregisterMsgCallback"))) + return xglDbgUnregisterMsgCallback; + else if (!strncmp("xglDbgSetMessageFilter", (const char *) funcName, sizeof("xglDbgSetMessageFilter"))) + return xglDbgSetMessageFilter; + else if (!strncmp("xglDbgSetObjectTag", (const char *) funcName, sizeof("xglDbgSetObjectTag"))) + return xglDbgSetObjectTag; + else if (!strncmp("xglDbgSetGlobalOption", (const char *) funcName, sizeof("xglDbgSetGlobalOption"))) + return xglDbgSetGlobalOption; + else if (!strncmp("xglDbgSetDeviceOption", (const char *) funcName, sizeof("xglDbgSetDeviceOption"))) + return xglDbgSetDeviceOption; + else if (!strncmp("xglCmdDbgMarkerBegin", (const char *) funcName, sizeof("xglCmdDbgMarkerBegin"))) + return xglCmdDbgMarkerBegin; + else if (!strncmp("xglCmdDbgMarkerEnd", (const char *) funcName, sizeof("xglCmdDbgMarkerEnd"))) + return xglCmdDbgMarkerEnd; + else if (!strncmp("xglWsiX11AssociateConnection", (const char *) funcName, sizeof("xglWsiX11AssociateConnection"))) + return xglWsiX11AssociateConnection; + else if (!strncmp("xglWsiX11GetMSC", (const char *) funcName, sizeof("xglWsiX11GetMSC"))) + return xglWsiX11GetMSC; + else if (!strncmp("xglWsiX11CreatePresentableImage", (const char *) funcName, sizeof("xglWsiX11CreatePresentableImage"))) + return xglWsiX11CreatePresentableImage; + else if (!strncmp("xglWsiX11QueuePresent", (const char *) funcName, sizeof("xglWsiX11QueuePresent"))) + return xglWsiX11QueuePresent; + else { + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + if (gpuw->pGPA == NULL) + return NULL; + return gpuw->pGPA(gpuw->nextObject, funcName); + } +} + diff --git a/layers/xgl_struct_string_helper.h b/layers/xgl_struct_string_helper.h index ffd97441..a5d82342 100644 --- a/layers/xgl_struct_string_helper.h +++ b/layers/xgl_struct_string_helper.h @@ -785,8 +785,8 @@ char* xgl_print_xgl_pipeline_shader_stage_create_info(const XGL_PIPELINE_SHADER_ str = (char*)malloc(sizeof(char)*1024); sprintf(str, "%ssType = %s\n%spNext = %p\n%sshader = %p\n", prefix, string_XGL_STRUCTURE_TYPE(pStruct->sType), prefix, (pStruct->pNext), prefix, (void*)&(pStruct->shader)); } else { - str = (char*)malloc(sizeof(char)*2048); char *pTmpStr = dynamic_display((XGL_VOID*)pStruct->pNext, prefix); + str = (char*)malloc(strlen(pTmpStr) + sizeof(char)*1024); sprintf(str, "%ssType = %s\n%spNext = %p\n%sshader = %p\n %spNext (%p)\n%s\n", prefix, string_XGL_STRUCTURE_TYPE(pStruct->sType), prefix, (pStruct->pNext), prefix, (void*)&(pStruct->shader), prefix, (void*)pStruct->pNext, pTmpStr); free(pTmpStr); } |
