if (WIN32)
macro(add_xgl_layer target)
add_custom_command(OUTPUT XGLLayer${target}.def
- COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/xgl-win-def-file-generate.py ${target} > XGLLayer${target}.def
- DEPENDS ${PROJECT_SOURCE_DIR}/xgl-win-def-file-generate.py
+ COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/xgl-generate.py win-def-file XGLLayer${target} layer > XGLLayer${target}.def
+ DEPENDS ${PROJECT_SOURCE_DIR}/xgl-generate.py ${PROJECT_SOURCE_DIR}/xgl.py
)
add_library(XGLLayer${target} SHARED ${ARGN} XGLLayer${target}.def)
target_link_Libraries(XGLLayer${target} layer_utils)
COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/xgl-generate.py dispatch-table-ops loader > table_ops.h
DEPENDS ${PROJECT_SOURCE_DIR}/xgl-generate.py ${PROJECT_SOURCE_DIR}/xgl.py)
+add_custom_command(OUTPUT XGL.def
+ COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/xgl-generate.py win-def-file XGL all > XGL.def
+ DEPENDS ${PROJECT_SOURCE_DIR}/xgl-generate.py ${PROJECT_SOURCE_DIR}/xgl.py)
+
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
+++ /dev/null
-;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; XGL
-;
-; Copyright (C) 2015 LunarG, Inc.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a
-; copy of this software and associated documentation files (the "Software"),
-; to deal in the Software without restriction, including without limitation
-; the rights to use, copy, modify, merge, publish, distribute, sublicense,
-; and/or sell copies of the Software, and to permit persons to whom the
-; Software is furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included
-; in all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-; DEALINGS IN THE SOFTWARE.
-;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; The following is required on Windows, for exporting symbols from the DLL
-
-LIBRARY XGL
-EXPORTS
- xglCreateInstance
- xglDestroyInstance
- xglEnumerateGpus
- xglGetGpuInfo
- xglGetProcAddr
- xglCreateDevice
- xglDestroyDevice
- xglGetExtensionSupport
- xglEnumerateLayers
- xglGetDeviceQueue
- xglQueueSubmit
- xglQueueSetGlobalMemReferences
- xglQueueWaitIdle
- xglDeviceWaitIdle
- xglAllocMemory
- xglFreeMemory
- xglSetMemoryPriority
- xglMapMemory
- xglUnmapMemory
- xglPinSystemMemory
- xglGetMultiGpuCompatibility
- xglOpenSharedMemory
- xglOpenSharedQueueSemaphore
- xglOpenPeerMemory
- xglOpenPeerImage
- xglDestroyObject
- xglGetObjectInfo
- xglBindObjectMemory
- xglBindObjectMemoryRange
- xglBindImageMemoryRange
- xglCreateFence
- xglGetFenceStatus
- xglWaitForFences
- xglCreateQueueSemaphore
- xglSignalQueueSemaphore
- xglWaitQueueSemaphore
- xglCreateEvent
- xglGetEventStatus
- xglSetEvent
- xglResetEvent
- xglCreateQueryPool
- xglGetQueryPoolResults
- xglGetFormatInfo
- xglCreateBuffer
- xglCreateBufferView
- xglCreateImage
- xglSetFastClearColor
- xglSetFastClearDepth
- xglGetImageSubresourceInfo
- xglCreateImageView
- xglCreateColorAttachmentView
- xglCreateDepthStencilView
- xglCreateShader
- xglCreateGraphicsPipeline
- xglCreateComputePipeline
- xglStorePipeline
- xglLoadPipeline
- xglCreatePipelineDelta
- xglCreateSampler
- xglCreateDescriptorSetLayout
- xglBeginDescriptorRegionUpdate
- xglEndDescriptorRegionUpdate
- xglCreateDescriptorRegion
- xglClearDescriptorRegion
- xglAllocDescriptorSets
- xglClearDescriptorSets
- xglUpdateDescriptors
- xglCreateDynamicViewportState
- xglCreateDynamicRasterState
- xglCreateDynamicColorBlendState
- xglCreateDynamicDepthStencilState
- xglCreateCommandBuffer
- xglBeginCommandBuffer
- xglEndCommandBuffer
- xglResetCommandBuffer
- xglCmdBindPipeline
- xglCmdBindPipelineDelta
- xglCmdBindDynamicStateObject
- xglCmdBindDescriptorSet
- xglCmdBindVertexBuffer
- xglCmdBindIndexBuffer
- xglCmdDraw
- xglCmdDrawIndexed
- xglCmdDrawIndirect
- xglCmdDrawIndexedIndirect
- xglCmdDispatch
- xglCmdDispatchIndirect
- xglCmdCopyBuffer
- xglCmdCopyImage
- xglCmdCopyBufferToImage
- xglCmdCopyImageToBuffer
- xglCmdCloneImageData
- xglCmdUpdateBuffer
- xglCmdFillBuffer
- xglCmdClearColorImage
- xglCmdClearColorImageRaw
- xglCmdClearDepthStencil
- xglCmdResolveImage
- xglCmdSetEvent
- xglCmdResetEvent
- xglCmdWaitEvents
- xglCmdPipelineBarrier
- xglCmdBeginQuery
- xglCmdEndQuery
- xglCmdResetQueryPool
- xglCmdWriteTimestamp
- xglCmdInitAtomicCounters
- xglCmdLoadAtomicCounters
- xglCmdSaveAtomicCounters
- xglCreateFramebuffer
- xglCreateRenderPass
- xglCmdBeginRenderPass
- xglCmdEndRenderPass
- xglDbgSetValidationLevel
- xglDbgRegisterMsgCallback
- xglDbgUnregisterMsgCallback
- xglDbgSetMessageFilter
- xglDbgSetObjectTag
- xglDbgSetGlobalOption
- xglDbgSetDeviceOption
- xglCmdDbgMarkerBegin
- xglCmdDbgMarkerEnd
- xglWsiX11AssociateConnection
- xglWsiX11GetMSC
- xglWsiX11CreatePresentableImage
- xglWsiX11QueuePresent
return "\n".join(body)
+class WinDefFileSubcommand(Subcommand):
+ def run(self):
+ library_exports = {
+ "all": [],
+ "icd": [
+ "EnumerateGpus",
+ "CreateInstance",
+ "DestroyInstance",
+ "GetProcAddr",
+ ],
+ "layer": [
+ "GetProcAddr",
+ "EnumerateLayers",
+ ],
+ }
+
+ if len(self.argv) != 2 or self.argv[1] not in library_exports:
+ print("WinDefFileSubcommand: <library-name> {%s}" %
+ "|".join(library_exports.keys()))
+ return
+
+ self.library = self.argv[0]
+ self.exports = library_exports[self.argv[1]]
+
+ super().run()
+
+ def generate_copyright(self):
+ return """; THIS FILE IS GENERATED. DO NOT EDIT.
+
+;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; XGL
+;
+; Copyright (C) 2015 LunarG, Inc.
+;
+; Permission is hereby granted, free of charge, to any person obtaining a
+; copy of this software and associated documentation files (the "Software"),
+; to deal in the Software without restriction, including without limitation
+; the rights to use, copy, modify, merge, publish, distribute, sublicense,
+; and/or sell copies of the Software, and to permit persons to whom the
+; Software is furnished to do so, subject to the following conditions:
+;
+; The above copyright notice and this permission notice shall be included
+; in all copies or substantial portions of the Software.
+;
+; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+; DEALINGS IN THE SOFTWARE.
+;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"""
+
+ def generate_header(self):
+ return "; The following is required on Windows, for exporting symbols from the DLL"
+
+ def generate_body(self):
+ body = []
+
+ body.append("LIBRARY " + self.library)
+ body.append("EXPORTS")
+
+ for proto in self.protos:
+ if self.exports and proto.name not in self.exports:
+ continue
+ body.append(" xgl" + proto.name)
+
+ return "\n".join(body)
+
def main():
subcommands = {
"loader-entrypoints": LoaderEntrypointsSubcommand,
"icd-dummy-entrypoints": IcdDummyEntrypointsSubcommand,
"icd-get-proc-addr": IcdGetProcAddrSubcommand,
"layer-intercept-proc": LayerInterceptProcSubcommand,
+ "win-def-file": WinDefFileSubcommand,
}
if len(sys.argv) < 2 or sys.argv[1] not in subcommands:
+++ /dev/null
-#!/usr/bin/env python3
-#
-# XGL
-#
-# Copyright (C) 2015 LunarG, Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-# Authors:
-# Chia-I Wu <olv@lunarg.com>
-# Ian Elliott <ian@lunarg.com>
-
-import sys
-
-import xgl
-
-def generate_get_proc_addr_check(name):
- return " if (!%s || %s[0] != 'x' || %s[1] != 'g' || %s[2] != 'l')\n" \
- " return NULL;" % ((name,) * 4)
-
-class Subcommand(object):
- def __init__(self, argv):
- self.argv = argv
- self.headers = xgl.headers
- self.protos = xgl.protos
-
- def run(self):
- print(self.generate())
-
- def generate(self):
- copyright = self.generate_copyright()
- header = self.generate_header()
- body = self.generate_body()
- footer = self.generate_footer()
-
- contents = []
- if copyright:
- contents.append(copyright)
- if header:
- contents.append(header)
- if body:
- contents.append(body)
- if footer:
- contents.append(footer)
-
- return "\n\n".join(contents)
-
- def generate_copyright(self):
- return """; THIS FILE IS GENERATED. DO NOT EDIT.
-
-;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; XGL
-;
-; Copyright (C) 2015 LunarG, Inc.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a
-; copy of this software and associated documentation files (the "Software"),
-; to deal in the Software without restriction, including without limitation
-; the rights to use, copy, modify, merge, publish, distribute, sublicense,
-; and/or sell copies of the Software, and to permit persons to whom the
-; Software is furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included
-; in all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-; DEALINGS IN THE SOFTWARE.
-;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-; The following is required on Windows, for exporting symbols from the DLL"""
-
- def generate_header(self):
- pass
-
- def generate_body(self):
- return "LIBRARY XGLLayer" + sys.argv[1]
-
- def generate_footer(self):
- return "EXPORTS\n xglGetProcAddr\n xglEnumerateLayers"
-
-def main():
-
- if len(sys.argv) < 1:
- print("Usage: %s <file>" % sys.argv[0])
- exit(1)
-
- subcmd = Subcommand(sys.argv[1:])
- subcmd.run()
-
-if __name__ == "__main__":
- main()