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/multi.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'layers/multi.cpp') diff --git a/layers/multi.cpp b/layers/multi.cpp index 3a5e4fcc..f8c2bc9f 100644 --- a/layers/multi.cpp +++ b/layers/multi.cpp @@ -132,6 +132,8 @@ XGL_LAYER_EXPORT void * XGLAPI multi1GetProcAddr(XGL_PHYSICAL_GPU gpu, const cha return (void *) multi1CreateGraphicsPipeline; else if (!strncmp("xglStorePipeline", pName, sizeof ("xglStorePipeline"))) return (void *) multi1StorePipeline; + else if (!strncmp("xglGetExtensionSupport", pName, sizeof ("xglGetExtensionSupport"))) + return (void *) xglGetExtensionSupport; else { if (gpuw->pGPA == NULL) return NULL; @@ -232,6 +234,8 @@ XGL_LAYER_EXPORT void * XGLAPI multi2GetProcAddr(XGL_PHYSICAL_GPU gpu, const cha return (void *) multi2CreateCommandBuffer; else if (!strncmp("xglBeginCommandBuffer", pName, sizeof ("xglBeginCommandBuffer"))) return (void *) multi2BeginCommandBuffer; + else if (!strncmp("xglGetExtensionSupport", pName, sizeof ("xglGetExtensionSupport"))) + return (void *) xglGetExtensionSupport; else { if (gpuw->pGPA == NULL) return NULL; @@ -255,6 +259,33 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglEnumerateLayers(XGL_PHYSICAL_GPU gpu, size return XGL_SUCCESS; } +XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetExtensionSupport(XGL_PHYSICAL_GPU gpu, const char* pExtName) +{ + XGL_RESULT result; + XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; + + /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */ + if (!strncmp(pExtName, "multi1", strlen("multi1"))) + { + result = XGL_SUCCESS; + } else if (!strncmp(pExtName, "multi2", strlen("multi2"))) + { + result = XGL_SUCCESS; + } else if (!tableMap1.empty() && (tableMap1.find(gpuw) != tableMap1.end())) + { + XGL_LAYER_DISPATCH_TABLE* pTable = tableMap1[gpuw]; + result = pTable->GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName); + } else if (!tableMap2.empty() && (tableMap2.find(gpuw) != tableMap2.end())) + { + XGL_LAYER_DISPATCH_TABLE* pTable = tableMap2[gpuw]; + result = pTable->GetExtensionSupport((XGL_PHYSICAL_GPU)gpuw->nextObject, pExtName); + } else + { + result = XGL_ERROR_INVALID_EXTENSION; + } + return result; +} + XGL_LAYER_EXPORT void * XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const char* pName) { // to find each layers GPA routine Loader will search via "GetProcAddr" -- cgit v1.2.3