aboutsummaryrefslogtreecommitdiff
path: root/layers/basic.cpp
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2015-04-02 12:06:28 -0600
committerChia-I Wu <olv@lunarg.com>2015-04-16 17:33:29 +0800
commit3d98fec8d8c5b9a1e9b45c32ba50ca4ab651754c (patch)
tree1d07d0cc90ffc123e33a0425a0c8d811ed4fe36d /layers/basic.cpp
parent07b8cc331f9eb6c53cd32d4eeaff1c12f4685203 (diff)
downloadusermoji-3d98fec8d8c5b9a1e9b45c32ba50ca4ab651754c.tar.xz
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
Diffstat (limited to 'layers/basic.cpp')
-rw-r--r--layers/basic.cpp22
1 files changed, 16 insertions, 6 deletions
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);