aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2015-01-09 10:13:48 -0700
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-02-04 17:58:04 -0700
commit015beed64be2639a87bfb9af1aa01a008a79e308 (patch)
treedb81597c2db81ba67a7e97021f32058be7dd713e
parent77b2a24da82050967e4c85b00d823e86a84e37d3 (diff)
downloadusermoji-015beed64be2639a87bfb9af1aa01a008a79e308.tar.xz
loader: Check for success on return from driver for create object calls
Allows errors from driver that prevented driver from creating object to return to the app.
-rwxr-xr-xxgl-generate.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/xgl-generate.py b/xgl-generate.py
index 75a22313..513438c7 100755
--- a/xgl-generate.py
+++ b/xgl-generate.py
@@ -130,26 +130,28 @@ class LoaderEntrypointsSubcommand(Subcommand):
" (const XGL_LAYER_DISPATCH_TABLE **) wrapped_obj->baseObject;\n"
" %s = wrapped_obj->nextObject;\n"
" XGL_RESULT res = %s;\n"
- " *(const XGL_LAYER_DISPATCH_TABLE **) (*%s) = *disp;\n"
+ " if (res == XGL_SUCCESS)\n"
+ " *(const XGL_LAYER_DISPATCH_TABLE **) (*%s) = *disp;\n"
" return res;\n"
"}" % (qual, decl, proto.params[0].name, proto.params[1].name,
proto.params[0].name, proto.params[0].name, stmt,
proto.params[-1].name))
elif self._does_function_create_object(proto):
+ if proto.name == "WsiX11CreatePresentableImage":
+ obj_write_stmt = "\n *(const XGL_LAYER_DISPATCH_TABLE **) (*%s) = *disp;" % ( proto.params[-2].name)
+ else:
+ obj_write_stmt = ""
funcs.append("%s%s\n"
"{\n"
" const XGL_LAYER_DISPATCH_TABLE **disp =\n"
" (const XGL_LAYER_DISPATCH_TABLE **) %s;\n"
" XGL_RESULT res = %s;\n"
- % (qual, decl, proto.params[0].name, stmt))
- if proto.name == "WsiX11CreatePresentableImage":
- funcs.append(
- " *(const XGL_LAYER_DISPATCH_TABLE **) (*%s) = *disp;\n"
- % ( proto.params[-2].name))
- funcs.append(
- " *(const XGL_LAYER_DISPATCH_TABLE **) (*%s) = *disp;\n"
+ " if (res == XGL_SUCCESS) {%s\n"
+ " *(const XGL_LAYER_DISPATCH_TABLE **) (*%s) = *disp;\n"
+ " }\n"
" return res;\n"
- "}" % ( proto.params[-1].name))
+ "}"
+ % (qual, decl, proto.params[0].name, stmt, obj_write_stmt, proto.params[-1].name))
elif proto.name == "GetMultiGpuCompatibility":
funcs.append("%s%s\n"
"{\n"