From 833b6ab443214c0091c2a81127a5a4a965ffccaf Mon Sep 17 00:00:00 2001 From: Hoe Hao Cheng Date: Fri, 15 Jan 2021 17:23:59 +0800 Subject: [PATCH] zink/codegen: adding/fixing comments and copyright notice Reviewed-By: Mike Blumenkrantz Part-of: --- src/gallium/drivers/zink/zink_device_info.py | 2 +- src/gallium/drivers/zink/zink_extensions.py | 24 ++++++++++++- src/gallium/drivers/zink/zink_instance.py | 37 ++++++++++++++++++++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_device_info.py b/src/gallium/drivers/zink/zink_device_info.py index f849356105f..21ea498dde6 100644 --- a/src/gallium/drivers/zink/zink_device_info.py +++ b/src/gallium/drivers/zink/zink_device_info.py @@ -30,7 +30,7 @@ from zink_extensions import Extension,Version import sys # constructor: -# Extensions(name, alias="", required=False, properties=False, features=False, conditions=None, guard=False) +# Extension(name, alias="", required=False, properties=False, features=False, conditions=None, guard=False) # The attributes: # - required: the generated code debug_prints "ZINK: {name} required!" and # returns NULL if the extension is unavailable. diff --git a/src/gallium/drivers/zink/zink_extensions.py b/src/gallium/drivers/zink/zink_extensions.py index 0681446c4c4..6d01052c39f 100644 --- a/src/gallium/drivers/zink/zink_extensions.py +++ b/src/gallium/drivers/zink/zink_extensions.py @@ -1,3 +1,25 @@ +# Copyright © 2020 Hoe Hao Cheng +# +# 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 (including the next +# paragraph) 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. +# + class Version: device_version : (1,0,0) struct_version : (1,0) @@ -10,7 +32,7 @@ class Version: else: self.struct_version = struct - # e.g. "VM_MAKE_VERSION(1,2,0)" + # e.g. "VK_MAKE_VERSION(1,2,0)" def version(self): return ("VK_MAKE_VERSION(" + str(self.device_version[0]) diff --git a/src/gallium/drivers/zink/zink_instance.py b/src/gallium/drivers/zink/zink_instance.py index 551ee3895f4..4302c64db14 100644 --- a/src/gallium/drivers/zink/zink_instance.py +++ b/src/gallium/drivers/zink/zink_instance.py @@ -1,8 +1,44 @@ +# Copyright © 2020 Hoe Hao Cheng +# +# 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 (including the next +# paragraph) 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: +# Hoe Hao Cheng +# + from mako.template import Template from os import path from zink_extensions import Extension,Layer,Version import sys +# constructor: Extension(name, core_since=None, functions=[]) +# The attributes: +# - core_since: the Vulkan version where this extension is promoted to core. +# When screen->loader_version is greater than or equal to this +# instance_info.have_{name} is set to true unconditionally. This +# is done because loading extensions that are promoted to core is +# considered to be an error. +# +# - functions: functions which are added by the extension. The function names +# should not include the "vk" prefix and the vendor suffix - these +# will be added by the codegen accordingly. EXTENSIONS = [ Extension("VK_EXT_debug_utils"), Extension("VK_KHR_maintenance2", @@ -18,6 +54,7 @@ EXTENSIONS = [ Extension("VK_MVK_moltenvk"), ] +# constructor: Layer(name, conditions=[]) LAYERS = [ # if we have debug_util, allow a validation layer to be added. Layer("VK_LAYER_KHRONOS_validation",