diff options
| author | Chia-I Wu <olv@lunarg.com> | 2015-01-04 15:32:52 +0800 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-02-04 17:58:04 -0700 |
| commit | 4b5f16148851557a68bcb747cdeff4bcc86c4d64 (patch) | |
| tree | f21d490d5c7ce434129c29bb38e5b6c2b8593b40 | |
| parent | 9e1922254e0be59e689e2e6a6c0ebd457b534756 (diff) | |
| download | usermoji-4b5f16148851557a68bcb747cdeff4bcc86c4d64.tar.xz | |
xgl.py: remove special-purpose functions
Move them to LoaderEntrypointsSubcommand as they are loader-specific.
| -rwxr-xr-x | xgl-generate.py | 54 | ||||
| -rw-r--r-- | xgl.py | 50 |
2 files changed, 52 insertions, 52 deletions
diff --git a/xgl-generate.py b/xgl-generate.py index 77015f69..edd759d2 100755 --- a/xgl-generate.py +++ b/xgl-generate.py @@ -96,13 +96,63 @@ class LoaderEntrypointsSubcommand(Subcommand): def generate_header(self): return "#include \"loader.h\"" + def _does_function_create_object(self, name): + return name in ( + "CreateDevice", + "GetDeviceQueue", + "AllocMemory", + "PinSystemMemory", + "OpenSharedMemory", + "OpenSharedQueueSemaphore", + "OpenPeerMemory", + "OpenPeerImage", + "CreateFence", + "CreateQueueSemaphore", + "CreateEvent", + "CreateQueryPool", + "CreateImage", + "CreateImageView", + "CreateColorAttachmentView", + "CreateDepthStencilView", + "CreateShader", + "CreateGraphicsPipeline", + "CreateComputePipeline", + "LoadPipeline", + "CreatePipelineDelta", + "CreateSampler", + "CreateDescriptorSet", + "CreateViewportState", + "CreateRasterState", + "CreateMsaaState", + "CreateColorBlendState", + "CreateDepthStencilState", + "CreateCommandBuffer", + "WsiX11CreatePresentableImage") + + def _is_name_dispatchable(self, name): + return name not in ( + "GetProcAddr", + "InitAndEnumerateGpus", + "EnumerateLayers", + "DbgRegisterMsgCallback", + "DbgUnregisterMsgCallback", + "DbgSetGlobalOption") + + def _is_dispatchable(self, proto): + """Return true if the prototype is dispatchable. + + That is, return true when the prototype takes a XGL_PHYSICAL_GPU or + XGL_BASE_OBJECT. + """ + return self._is_name_dispatchable(proto.name) + def _generate_loader_dispatch_entrypoints(self, qual=""): if qual: qual += " " funcs = [] for proto in self.protos: - if not xgl.is_dispatchable(proto): + if not self._is_dispatchable(proto): continue decl = proto.c_func(prefix="xgl", attr="XGLAPI") stmt = "(*disp)->%s" % proto.c_call() @@ -120,7 +170,7 @@ class LoaderEntrypointsSubcommand(Subcommand): "}" % (qual, decl, proto.params[0].name, proto.params[1].name, proto.params[0].name, proto.params[0].name, stmt, proto.params[-1].name)) - elif xgl.does_function_create_object(proto.name) and qual == "LOADER_EXPORT ": + elif self._does_function_create_object(proto.name) and qual == "LOADER_EXPORT ": funcs.append("%s%s\n" "{\n" " const XGL_LAYER_DISPATCH_TABLE **disp =\n" @@ -879,56 +879,6 @@ for ext in extensions: proto_names = [proto.name for proto in protos] -def does_function_create_object(name): - return name in ( - "CreateDevice", - "GetDeviceQueue", - "AllocMemory", - "PinSystemMemory", - "OpenSharedMemory", - "OpenSharedQueueSemaphore", - "OpenPeerMemory", - "OpenPeerImage", - "CreateFence", - "CreateQueueSemaphore", - "CreateEvent", - "CreateQueryPool", - "CreateImage", - "CreateImageView", - "CreateColorAttachmentView", - "CreateDepthStencilView", - "CreateShader", - "CreateGraphicsPipeline", - "CreateComputePipeline", - "LoadPipeline", - "CreatePipelineDelta", - "CreateSampler", - "CreateDescriptorSet", - "CreateViewportState", - "CreateRasterState", - "CreateMsaaState", - "CreateColorBlendState", - "CreateDepthStencilState", - "CreateCommandBuffer", - "WsiX11CreatePresentableImage") - -def is_name_dispatchable(name): - return name not in ( - "GetProcAddr", - "InitAndEnumerateGpus", - "EnumerateLayers", - "DbgRegisterMsgCallback", - "DbgUnregisterMsgCallback", - "DbgSetGlobalOption") - -def is_dispatchable(proto): - """Return true if the prototype is dispatchable. - - That is, return true when the prototype takes a XGL_PHYSICAL_GPU or - XGL_BASE_OBJECT. - """ - return is_name_dispatchable(proto.name) - def parse_xgl_h(filename): # read object and protoype typedefs object_lines = [] |
