From 8e568797182cbf0e051ac17c21f702e54a2b90c5 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 4 Jan 2015 23:11:43 +0800 Subject: [PATCH] layers: simplify initLayerTable() Generate xgl_dispatch_table_helper.h with $ ./xgl-generate.py dispatch-table-ops layer and make use of layer_initialize_dispatch_table() in initLayerTable(). There should be no functional difference with this change. --- .gitignore | 1 + layers/CMakeLists.txt | 5 ++ layers/basic.cpp | 127 +------------------------- layers/draw_state.c | 243 +------------------------------------------------- layers/mem_tracker.c | 243 ++------------------------------------------------ layers/multi.cpp | 127 +------------------------- xgl-layer-generate.py | 7 +- 7 files changed, 22 insertions(+), 731 deletions(-) diff --git a/.gitignore b/.gitignore index ce64764..09c4b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ tests/xgl_image_tests tests/xgl_render_tests tests/xglbase tests/xglinfo +layers/xgl_dispatch_table_helper.h layers/xgl_enum_string_helper.h layers/xgl_struct_string_helper.h layers/xgl_struct_wrappers.cpp diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt index de32b24..9b59e90 100644 --- a/layers/CMakeLists.txt +++ b/layers/CMakeLists.txt @@ -26,6 +26,10 @@ include_directories( set (CMAKE_CXX_FLAGS "-std=c++11") +add_custom_command(OUTPUT xgl_dispatch_table_helper.h + COMMAND ${PROJECT_SOURCE_DIR}/xgl-generate.py dispatch-table-ops layer > xgl_dispatch_table_helper.h + DEPENDS ${PROJECT_SOURCE_DIR}/xgl-generate.py ${PROJECT_SOURCE_DIR}/xgl.py) + run_xgl_helper(gen_enum_string_helper xgl_enum_string_helper.h) run_xgl_helper(gen_struct_wrappers xgl_struct_string_helper.h @@ -36,6 +40,7 @@ run_xgl_helper(gen_struct_wrappers run_xgl_helper(gen_graphviz xgl_struct_graphviz_helper.h) add_custom_target(generate_xgl_layer_helpers DEPENDS + xgl_dispatch_table_helper.h xgl_enum_string_helper.h xgl_struct_string_helper.h xgl_struct_string_helper_no_addr.h diff --git a/layers/basic.cpp b/layers/basic.cpp index 8e9efd0..57c865c 100644 --- a/layers/basic.cpp +++ b/layers/basic.cpp @@ -25,6 +25,7 @@ #include #include #include +#include "xgl_dispatch_table_helper.h" #include "xglLayer.h" static std::unordered_map tableMap; @@ -44,129 +45,9 @@ static XGL_LAYER_DISPATCH_TABLE * initLayerTable(const XGL_BASE_LAYER_OBJECT *gp { return it->second; } - fpGPA = gpuw->pGPA; - assert(fpGPA); - pTable->GetProcAddr = fpGPA; - pTable->InitAndEnumerateGpus = (InitAndEnumerateGpusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglInitAndEnumerateGpus"); - pTable->GetGpuInfo = (GetGpuInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetGpuInfo"); - pTable->CreateDevice = (CreateDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDevice"); - pTable->DestroyDevice = (DestroyDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDestroyDevice"); - pTable->GetExtensionSupport = (GetExtensionSupportType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetExtensionSupport"); - pTable->EnumerateLayers = (EnumerateLayersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEnumerateLayers"); - pTable->GetDeviceQueue = (GetDeviceQueueType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetDeviceQueue"); - pTable->QueueSubmit = (QueueSubmitType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueSubmit"); - pTable->QueueSetGlobalMemReferences = (QueueSetGlobalMemReferencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueSetGlobalMemReferences"); - pTable->QueueWaitIdle = (QueueWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueWaitIdle"); - pTable->DeviceWaitIdle = (DeviceWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDeviceWaitIdle"); - pTable->GetMemoryHeapCount = (GetMemoryHeapCountType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMemoryHeapCount"); - pTable->GetMemoryHeapInfo = (GetMemoryHeapInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMemoryHeapInfo"); - pTable->AllocMemory = (AllocMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAllocMemory"); - pTable->FreeMemory = (FreeMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglFreeMemory"); - pTable->SetMemoryPriority = (SetMemoryPriorityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSetMemoryPriority"); - pTable->MapMemory = (MapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglMapMemory"); - pTable->UnmapMemory = (UnmapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglUnmapMemory"); - pTable->PinSystemMemory = (PinSystemMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglPinSystemMemory"); - pTable->RemapVirtualMemoryPages = (RemapVirtualMemoryPagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglRemapVirtualMemoryPages"); - pTable->GetMultiGpuCompatibility = (GetMultiGpuCompatibilityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMultiGpuCompatibility"); - pTable->OpenSharedMemory = (OpenSharedMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenSharedMemory"); - pTable->OpenSharedQueueSemaphore = (OpenSharedQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenSharedQueueSemaphore"); - pTable->OpenPeerMemory = (OpenPeerMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenPeerMemory"); - pTable->OpenPeerImage = (OpenPeerImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenPeerImage"); - pTable->DestroyObject = (DestroyObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDestroyObject"); - pTable->GetObjectInfo = (GetObjectInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetObjectInfo"); - pTable->BindObjectMemory = (BindObjectMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBindObjectMemory"); - pTable->CreateFence = (CreateFenceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateFence"); - pTable->GetFenceStatus = (GetFenceStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetFenceStatus"); - pTable->WaitForFences = (WaitForFencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWaitForFences"); - pTable->CreateQueueSemaphore = (CreateQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateQueueSemaphore"); - pTable->SignalQueueSemaphore = (SignalQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSignalQueueSemaphore"); - pTable->WaitQueueSemaphore = (WaitQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWaitQueueSemaphore"); - pTable->CreateEvent = (CreateEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateEvent"); - pTable->GetEventStatus = (GetEventStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetEventStatus"); - pTable->SetEvent = (SetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSetEvent"); - pTable->ResetEvent = (ResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglResetEvent"); - pTable->CreateQueryPool = (CreateQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateQueryPool"); - pTable->GetQueryPoolResults = (GetQueryPoolResultsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetQueryPoolResults"); - pTable->GetFormatInfo = (GetFormatInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetFormatInfo"); - pTable->CreateImage = (CreateImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateImage"); - pTable->GetImageSubresourceInfo = (GetImageSubresourceInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetImageSubresourceInfo"); - pTable->CreateImageView = (CreateImageViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateImageView"); - pTable->CreateColorAttachmentView = (CreateColorAttachmentViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateColorAttachmentView"); - pTable->CreateDepthStencilView = (CreateDepthStencilViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDepthStencilView"); - pTable->CreateShader = (CreateShaderType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateShader"); - pTable->CreateGraphicsPipeline = (CreateGraphicsPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateGraphicsPipeline"); - pTable->CreateComputePipeline = (CreateComputePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateComputePipeline"); - pTable->StorePipeline = (StorePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglStorePipeline"); - pTable->LoadPipeline = (LoadPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglLoadPipeline"); - pTable->CreatePipelineDelta = (CreatePipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreatePipelineDelta"); - pTable->CreateSampler = (CreateSamplerType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateSampler"); - pTable->CreateDescriptorSet = (CreateDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDescriptorSet"); - pTable->BeginDescriptorSetUpdate = (BeginDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBeginDescriptorSetUpdate"); - pTable->EndDescriptorSetUpdate = (EndDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEndDescriptorSetUpdate"); - pTable->AttachSamplerDescriptors = (AttachSamplerDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachSamplerDescriptors"); - pTable->AttachImageViewDescriptors = (AttachImageViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachImageViewDescriptors"); - pTable->AttachMemoryViewDescriptors = (AttachMemoryViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachMemoryViewDescriptors"); - pTable->AttachNestedDescriptors = (AttachNestedDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachNestedDescriptors"); - pTable->ClearDescriptorSetSlots = (ClearDescriptorSetSlotsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglClearDescriptorSetSlots"); - pTable->CreateViewportState = (CreateViewportStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateViewportState"); - pTable->CreateRasterState = (CreateRasterStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateRasterState"); - pTable->CreateMsaaState = (CreateMsaaStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateMsaaState"); - pTable->CreateColorBlendState = (CreateColorBlendStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateColorBlendState"); - pTable->CreateDepthStencilState = (CreateDepthStencilStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDepthStencilState"); - pTable->CreateCommandBuffer = (CreateCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateCommandBuffer"); - pTable->BeginCommandBuffer = (BeginCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBeginCommandBuffer"); - pTable->EndCommandBuffer = (EndCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEndCommandBuffer"); - pTable->ResetCommandBuffer = (ResetCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglResetCommandBuffer"); - pTable->CmdBindPipeline = (CmdBindPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindPipeline"); - pTable->CmdBindPipelineDelta = (CmdBindPipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindPipelineDelta"); - pTable->CmdBindStateObject = (CmdBindStateObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindStateObject"); - pTable->CmdBindDescriptorSet = (CmdBindDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindDescriptorSet"); - pTable->CmdBindDynamicMemoryView = (CmdBindDynamicMemoryViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindDynamicMemoryView"); - pTable->CmdBindVertexData = (CmdBindVertexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindVertexData"); - pTable->CmdBindIndexData = (CmdBindIndexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindIndexData"); - pTable->CmdBindAttachments = (CmdBindAttachmentsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindAttachments"); - pTable->CmdPrepareMemoryRegions = (CmdPrepareMemoryRegionsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdPrepareMemoryRegions"); - pTable->CmdPrepareImages = (CmdPrepareImagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdPrepareImages"); - pTable->CmdDraw = (CmdDrawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDraw"); - pTable->CmdDrawIndexed = (CmdDrawIndexedType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndexed"); - pTable->CmdDrawIndirect = (CmdDrawIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndirect"); - pTable->CmdDrawIndexedIndirect = (CmdDrawIndexedIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndexedIndirect"); - pTable->CmdDispatch = (CmdDispatchType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDispatch"); - pTable->CmdDispatchIndirect = (CmdDispatchIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDispatchIndirect"); - pTable->CmdCopyMemory = (CmdCopyMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyMemory"); - pTable->CmdCopyImage = (CmdCopyImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyImage"); - pTable->CmdCopyMemoryToImage = (CmdCopyMemoryToImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyMemoryToImage"); - pTable->CmdCopyImageToMemory = (CmdCopyImageToMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyImageToMemory"); - pTable->CmdCloneImageData = (CmdCloneImageDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCloneImageData"); - pTable->CmdUpdateMemory = (CmdUpdateMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdUpdateMemory"); - pTable->CmdFillMemory = (CmdFillMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdFillMemory"); - pTable->CmdClearColorImage = (CmdClearColorImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearColorImage"); - pTable->CmdClearColorImageRaw = (CmdClearColorImageRawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearColorImageRaw"); - pTable->CmdClearDepthStencil = (CmdClearDepthStencilType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearDepthStencil"); - pTable->CmdResolveImage = (CmdResolveImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResolveImage"); - pTable->CmdSetEvent = (CmdSetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdSetEvent"); - pTable->CmdResetEvent = (CmdResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResetEvent"); - pTable->CmdMemoryAtomic = (CmdMemoryAtomicType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdMemoryAtomic"); - pTable->CmdBeginQuery = (CmdBeginQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBeginQuery"); - pTable->CmdEndQuery = (CmdEndQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdEndQuery"); - pTable->CmdResetQueryPool = (CmdResetQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResetQueryPool"); - pTable->CmdWriteTimestamp = (CmdWriteTimestampType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdWriteTimestamp"); - pTable->CmdInitAtomicCounters = (CmdInitAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdInitAtomicCounters"); - pTable->CmdLoadAtomicCounters = (CmdLoadAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdLoadAtomicCounters"); - pTable->CmdSaveAtomicCounters = (CmdSaveAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdSaveAtomicCounters"); - pTable->DbgSetValidationLevel = (DbgSetValidationLevelType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetValidationLevel"); - pTable->DbgRegisterMsgCallback = (DbgRegisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgRegisterMsgCallback"); - pTable->DbgUnregisterMsgCallback = (DbgUnregisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgUnregisterMsgCallback"); - pTable->DbgSetMessageFilter = (DbgSetMessageFilterType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetMessageFilter"); - pTable->DbgSetObjectTag = (DbgSetObjectTagType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetObjectTag"); - pTable->DbgSetGlobalOption = (DbgSetGlobalOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetGlobalOption"); - pTable->DbgSetDeviceOption = (DbgSetDeviceOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetDeviceOption"); - pTable->CmdDbgMarkerBegin = (CmdDbgMarkerBeginType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDbgMarkerBegin"); - pTable->CmdDbgMarkerEnd = (CmdDbgMarkerEndType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDbgMarkerEnd"); - pTable->WsiX11AssociateConnection = (WsiX11AssociateConnectionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11AssociateConnection"); - pTable->WsiX11GetMSC = (WsiX11GetMSCType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11GetMSC"); - pTable->WsiX11CreatePresentableImage = (WsiX11CreatePresentableImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11CreatePresentableImage"); - pTable->WsiX11QueuePresent = (WsiX11QueuePresentType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11QueuePresent"); + + layer_initialize_dispatch_table(pTable, gpuw->pGPA, (XGL_PHYSICAL_GPU) gpuw->nextObject); + return pTable; } diff --git a/layers/draw_state.c b/layers/draw_state.c index e603fe3..c821a1d 100644 --- a/layers/draw_state.c +++ b/layers/draw_state.c @@ -28,6 +28,7 @@ #include #include #include +#include "xgl_dispatch_table_helper.h" #include "xgl_struct_string_helper.h" #include "xgl_struct_graphviz_helper.h" #include "draw_state.h" @@ -945,248 +946,10 @@ static void initDrawState() fpNextGPA = pCurObj->pGPA; assert(fpNextGPA); + layer_initialize_dispatch_table(&nextTable, fpNextGPA, (XGL_PHYSICAL_GPU) pCurObj->nextObject); + 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; - CmdBindVertexDataType fpCmdBindVertexData = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCmdBindVertexData"); - nextTable.CmdBindVertexData = fpCmdBindVertexData; - 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; } diff --git a/layers/mem_tracker.c b/layers/mem_tracker.c index 8d1b228..a49b543 100644 --- a/layers/mem_tracker.c +++ b/layers/mem_tracker.c @@ -27,6 +27,7 @@ #include #include #include +#include "xgl_dispatch_table_helper.h" #include "xgl_struct_string_helper.h" #include "mem_tracker.h" #include "layers_config.h" @@ -857,246 +858,12 @@ static void initMemTracker() fpNextGPA = pCurObj->pGPA; assert(fpNextGPA); + layer_initialize_dispatch_table(&nextTable, fpNextGPA, (XGL_PHYSICAL_GPU) pCurObj->nextObject); + 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; + + nextTable.CmdBindVertexData = NULL; } diff --git a/layers/multi.cpp b/layers/multi.cpp index 77f951d..6d43ea0 100644 --- a/layers/multi.cpp +++ b/layers/multi.cpp @@ -27,6 +27,7 @@ #include #include #include +#include "xgl_dispatch_table_helper.h" #include "xglLayer.h" static void initLayerTable(const XGL_BASE_LAYER_OBJECT *gpuw, XGL_LAYER_DISPATCH_TABLE *pTable, const unsigned int layerNum); @@ -740,134 +741,10 @@ XGL_LAYER_EXPORT XGL_VOID * XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XG static void initLayerTable(const XGL_BASE_LAYER_OBJECT *gpuw, XGL_LAYER_DISPATCH_TABLE *pTable, const unsigned int layerNum) { - GetProcAddrType fpGPA; - fpGPA = gpuw->pGPA; - assert(fpGPA); - if (layerNum == 2 && layer1_first_activated == false) layer2_first_activated = true; if (layerNum == 1 && layer2_first_activated == false) layer1_first_activated = true; - pTable->GetProcAddr = fpGPA; - pTable->InitAndEnumerateGpus = (InitAndEnumerateGpusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglInitAndEnumerateGpus"); - pTable->GetGpuInfo = (GetGpuInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetGpuInfo"); - pTable->CreateDevice = (CreateDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDevice"); - pTable->DestroyDevice = (DestroyDeviceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDestroyDevice"); - pTable->GetExtensionSupport = (GetExtensionSupportType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetExtensionSupport"); - pTable->EnumerateLayers = (EnumerateLayersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEnumerateLayers"); - pTable->GetDeviceQueue = (GetDeviceQueueType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetDeviceQueue"); - pTable->QueueSubmit = (QueueSubmitType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueSubmit"); - pTable->QueueSetGlobalMemReferences = (QueueSetGlobalMemReferencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueSetGlobalMemReferences"); - pTable->QueueWaitIdle = (QueueWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglQueueWaitIdle"); - pTable->DeviceWaitIdle = (DeviceWaitIdleType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDeviceWaitIdle"); - pTable->GetMemoryHeapCount = (GetMemoryHeapCountType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMemoryHeapCount"); - pTable->GetMemoryHeapInfo = (GetMemoryHeapInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMemoryHeapInfo"); - pTable->AllocMemory = (AllocMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAllocMemory"); - pTable->FreeMemory = (FreeMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglFreeMemory"); - pTable->SetMemoryPriority = (SetMemoryPriorityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSetMemoryPriority"); - pTable->MapMemory = (MapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglMapMemory"); - pTable->UnmapMemory = (UnmapMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglUnmapMemory"); - pTable->PinSystemMemory = (PinSystemMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglPinSystemMemory"); - pTable->RemapVirtualMemoryPages = (RemapVirtualMemoryPagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglRemapVirtualMemoryPages"); - pTable->GetMultiGpuCompatibility = (GetMultiGpuCompatibilityType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetMultiGpuCompatibility"); - pTable->OpenSharedMemory = (OpenSharedMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenSharedMemory"); - pTable->OpenSharedQueueSemaphore = (OpenSharedQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenSharedQueueSemaphore"); - pTable->OpenPeerMemory = (OpenPeerMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenPeerMemory"); - pTable->OpenPeerImage = (OpenPeerImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglOpenPeerImage"); - pTable->DestroyObject = (DestroyObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDestroyObject"); - pTable->GetObjectInfo = (GetObjectInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetObjectInfo"); - pTable->BindObjectMemory = (BindObjectMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBindObjectMemory"); - pTable->CreateFence = (CreateFenceType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateFence"); - pTable->GetFenceStatus = (GetFenceStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetFenceStatus"); - pTable->WaitForFences = (WaitForFencesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWaitForFences"); - pTable->CreateQueueSemaphore = (CreateQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateQueueSemaphore"); - pTable->SignalQueueSemaphore = (SignalQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSignalQueueSemaphore"); - pTable->WaitQueueSemaphore = (WaitQueueSemaphoreType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWaitQueueSemaphore"); - pTable->CreateEvent = (CreateEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateEvent"); - pTable->GetEventStatus = (GetEventStatusType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetEventStatus"); - pTable->SetEvent = (SetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglSetEvent"); - pTable->ResetEvent = (ResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglResetEvent"); - pTable->CreateQueryPool = (CreateQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateQueryPool"); - pTable->GetQueryPoolResults = (GetQueryPoolResultsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetQueryPoolResults"); - pTable->GetFormatInfo = (GetFormatInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetFormatInfo"); - pTable->CreateImage = (CreateImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateImage"); - pTable->GetImageSubresourceInfo = (GetImageSubresourceInfoType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglGetImageSubresourceInfo"); - pTable->CreateImageView = (CreateImageViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateImageView"); - pTable->CreateColorAttachmentView = (CreateColorAttachmentViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateColorAttachmentView"); - pTable->CreateDepthStencilView = (CreateDepthStencilViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDepthStencilView"); - pTable->CreateShader = (CreateShaderType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateShader"); - pTable->CreateGraphicsPipeline = (CreateGraphicsPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateGraphicsPipeline"); - pTable->CreateComputePipeline = (CreateComputePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateComputePipeline"); - pTable->StorePipeline = (StorePipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglStorePipeline"); - pTable->LoadPipeline = (LoadPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglLoadPipeline"); - pTable->CreatePipelineDelta = (CreatePipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreatePipelineDelta"); - pTable->CreateSampler = (CreateSamplerType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateSampler"); - pTable->CreateDescriptorSet = (CreateDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDescriptorSet"); - pTable->BeginDescriptorSetUpdate = (BeginDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBeginDescriptorSetUpdate"); - pTable->EndDescriptorSetUpdate = (EndDescriptorSetUpdateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEndDescriptorSetUpdate"); - pTable->AttachSamplerDescriptors = (AttachSamplerDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachSamplerDescriptors"); - pTable->AttachImageViewDescriptors = (AttachImageViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachImageViewDescriptors"); - pTable->AttachMemoryViewDescriptors = (AttachMemoryViewDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachMemoryViewDescriptors"); - pTable->AttachNestedDescriptors = (AttachNestedDescriptorsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglAttachNestedDescriptors"); - pTable->ClearDescriptorSetSlots = (ClearDescriptorSetSlotsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglClearDescriptorSetSlots"); - pTable->CreateViewportState = (CreateViewportStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateViewportState"); - pTable->CreateRasterState = (CreateRasterStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateRasterState"); - pTable->CreateMsaaState = (CreateMsaaStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateMsaaState"); - pTable->CreateColorBlendState = (CreateColorBlendStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateColorBlendState"); - pTable->CreateDepthStencilState = (CreateDepthStencilStateType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateDepthStencilState"); - pTable->CreateCommandBuffer = (CreateCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCreateCommandBuffer"); - pTable->BeginCommandBuffer = (BeginCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglBeginCommandBuffer"); - pTable->EndCommandBuffer = (EndCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglEndCommandBuffer"); - pTable->ResetCommandBuffer = (ResetCommandBufferType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglResetCommandBuffer"); - pTable->CmdBindPipeline = (CmdBindPipelineType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindPipeline"); - pTable->CmdBindPipelineDelta = (CmdBindPipelineDeltaType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindPipelineDelta"); - pTable->CmdBindStateObject = (CmdBindStateObjectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindStateObject"); - pTable->CmdBindDescriptorSet = (CmdBindDescriptorSetType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindDescriptorSet"); - pTable->CmdBindDynamicMemoryView = (CmdBindDynamicMemoryViewType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindDynamicMemoryView"); - pTable->CmdBindVertexData = (CmdBindVertexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindVertexData"); - pTable->CmdBindIndexData = (CmdBindIndexDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindIndexData"); - pTable->CmdBindAttachments = (CmdBindAttachmentsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBindAttachments"); - pTable->CmdPrepareMemoryRegions = (CmdPrepareMemoryRegionsType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdPrepareMemoryRegions"); - pTable->CmdPrepareImages = (CmdPrepareImagesType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdPrepareImages"); - pTable->CmdDraw = (CmdDrawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDraw"); - pTable->CmdDrawIndexed = (CmdDrawIndexedType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndexed"); - pTable->CmdDrawIndirect = (CmdDrawIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndirect"); - pTable->CmdDrawIndexedIndirect = (CmdDrawIndexedIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDrawIndexedIndirect"); - pTable->CmdDispatch = (CmdDispatchType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDispatch"); - pTable->CmdDispatchIndirect = (CmdDispatchIndirectType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDispatchIndirect"); - pTable->CmdCopyMemory = (CmdCopyMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyMemory"); - pTable->CmdCopyImage = (CmdCopyImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyImage"); - pTable->CmdCopyMemoryToImage = (CmdCopyMemoryToImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyMemoryToImage"); - pTable->CmdCopyImageToMemory = (CmdCopyImageToMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCopyImageToMemory"); - pTable->CmdCloneImageData = (CmdCloneImageDataType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdCloneImageData"); - pTable->CmdUpdateMemory = (CmdUpdateMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdUpdateMemory"); - pTable->CmdFillMemory = (CmdFillMemoryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdFillMemory"); - pTable->CmdClearColorImage = (CmdClearColorImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearColorImage"); - pTable->CmdClearColorImageRaw = (CmdClearColorImageRawType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearColorImageRaw"); - pTable->CmdClearDepthStencil = (CmdClearDepthStencilType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdClearDepthStencil"); - pTable->CmdResolveImage = (CmdResolveImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResolveImage"); - pTable->CmdSetEvent = (CmdSetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdSetEvent"); - pTable->CmdResetEvent = (CmdResetEventType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResetEvent"); - pTable->CmdMemoryAtomic = (CmdMemoryAtomicType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdMemoryAtomic"); - pTable->CmdBeginQuery = (CmdBeginQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdBeginQuery"); - pTable->CmdEndQuery = (CmdEndQueryType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdEndQuery"); - pTable->CmdResetQueryPool = (CmdResetQueryPoolType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdResetQueryPool"); - pTable->CmdWriteTimestamp = (CmdWriteTimestampType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdWriteTimestamp"); - pTable->CmdInitAtomicCounters = (CmdInitAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdInitAtomicCounters"); - pTable->CmdLoadAtomicCounters = (CmdLoadAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdLoadAtomicCounters"); - pTable->CmdSaveAtomicCounters = (CmdSaveAtomicCountersType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdSaveAtomicCounters"); - pTable->DbgSetValidationLevel = (DbgSetValidationLevelType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetValidationLevel"); - pTable->DbgRegisterMsgCallback = (DbgRegisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgRegisterMsgCallback"); - pTable->DbgUnregisterMsgCallback = (DbgUnregisterMsgCallbackType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgUnregisterMsgCallback"); - pTable->DbgSetMessageFilter = (DbgSetMessageFilterType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetMessageFilter"); - pTable->DbgSetObjectTag = (DbgSetObjectTagType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetObjectTag"); - pTable->DbgSetGlobalOption = (DbgSetGlobalOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetGlobalOption"); - pTable->DbgSetDeviceOption = (DbgSetDeviceOptionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglDbgSetDeviceOption"); - pTable->CmdDbgMarkerBegin = (CmdDbgMarkerBeginType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDbgMarkerBegin"); - pTable->CmdDbgMarkerEnd = (CmdDbgMarkerEndType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglCmdDbgMarkerEnd"); - pTable->WsiX11AssociateConnection = (WsiX11AssociateConnectionType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11AssociateConnection"); - pTable->WsiX11GetMSC = (WsiX11GetMSCType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11GetMSC"); - pTable->WsiX11CreatePresentableImage = (WsiX11CreatePresentableImageType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11CreatePresentableImage"); - pTable->WsiX11QueuePresent = (WsiX11QueuePresentType) fpGPA((XGL_PHYSICAL_GPU) gpuw->nextObject, "xglWsiX11QueuePresent"); + layer_initialize_dispatch_table(pTable, gpuw->pGPA, (XGL_PHYSICAL_GPU) gpuw->nextObject); } diff --git a/xgl-layer-generate.py b/xgl-layer-generate.py index 610a796..928dc68 100755 --- a/xgl-layer-generate.py +++ b/xgl-layer-generate.py @@ -585,17 +585,14 @@ class Subcommand(object): return "\n".join(func_body) def _generate_layer_dispatch_table(self, prefix='xgl'): - func_body = [] + func_body = ["#include \"xgl_dispatch_table_helper.h\""] func_body.append('static void initLayerTable()\n' '{\n' ' GetProcAddrType fpNextGPA;\n' ' fpNextGPA = pCurObj->pGPA;\n' ' assert(fpNextGPA);\n'); - for name in xgl.proto_names: - func_body.append(' %sType fp%s = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "%s%s");\n' - ' nextTable.%s = fp%s;' % (name, name, prefix, name, name, name)) - + func_body.append(" layer_initialize_dispatch_table(&nextTable, fpNextGPA, (XGL_PHYSICAL_GPU) pCurObj->nextObject);") func_body.append("}\n") return "\n".join(func_body) -- 2.7.4