From 3d98fec8d8c5b9a1e9b45c32ba50ca4ab651754c Mon Sep 17 00:00:00 2001 From: Jon Ashburn Date: Thu, 2 Apr 2015 12:06:28 -0600 Subject: layers: Update GetExtensionSupport() to handle queries for layer name Layers now support loader querying their layer name via GetExtensionSupport in addition to EnumerateLayers. Also fixed bugs in ObjectTracker and DrawState to add the extensions they support in the GetExtensionSupport queries. Conflicts: xgl-layer-generate.py --- layers/basic.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'layers/basic.cpp') diff --git a/layers/basic.cpp b/layers/basic.cpp index 2f3deac0..627dc879 100644 --- a/layers/basic.cpp +++ b/layers/basic.cpp @@ -63,23 +63,33 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglLayerExtension1(XGL_DEVICE device) XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const char* pExtName) { - XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; XGL_RESULT result; - XGL_LAYER_DISPATCH_TABLE* pTable = initLayerTable(gpuw); + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; - printf("At start of wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu); + /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */ if (!strncmp(pExtName, "xglLayerExtension1", strlen("xglLayerExtension1"))) + { + result = XGL_SUCCESS; + } else if (!strncmp(pExtName, "Basic", strlen("Basic"))) + { result = XGL_SUCCESS; - else + } else if (!tableMap.empty() && (tableMap.find(gpuw) != tableMap.end())) + { + printf("At start of wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu); + XGL_LAYER_DISPATCH_TABLE* pTable = tableMap[gpuw]; result = pTable->GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName); - printf("Completed wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu); + printf("Completed wrapped xglGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu); + } else + { + result = XGL_ERROR_INVALID_EXTENSION; + } 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; - XGL_LAYER_DISPATCH_TABLE* pTable = initLayerTable(gpuw); + XGL_LAYER_DISPATCH_TABLE* pTable = tableMap[gpuw]; printf("At start of wrapped xglCreateDevice() call w/ gpu: %p\n", (void*)gpu); XGL_RESULT result = pTable->CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice); -- cgit v1.2.3