Updated glslang.
This commit is contained in:
parent
71fc5457e6
commit
70732ad420
96
3rdparty/glslang/CHANGES.md
vendored
96
3rdparty/glslang/CHANGES.md
vendored
@ -1,96 +0,0 @@
|
||||
# Revision history for `glslang`
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## 11.8.0 2022-01-27
|
||||
|
||||
### Other changes
|
||||
* Add support for SPIR-V 1.6
|
||||
* Add support for Vulkan 1.3
|
||||
* Add --hlsl-dx-position-w option
|
||||
|
||||
## 11.7.0 2021-11-11
|
||||
|
||||
### Other changes
|
||||
* Add support for targeting Vulkan 1.2 in the C API
|
||||
|
||||
## 11.6.0 2021-08-25
|
||||
|
||||
### Other changes
|
||||
* Atomic memory function only for shader storage block member or shared variable
|
||||
* Add support for gl_MaxVaryingVectors for ogl
|
||||
* Fix loading bool arrays from interface blocks
|
||||
* Generate separate stores for partially swizzled memory stores
|
||||
* Allow layout(std430) uniform with GL_EXT_scalar_block_layout
|
||||
* Support for pragma STDGL invariant(all)
|
||||
* Support for GL_NV_ray_tracing_motion_blur
|
||||
|
||||
## 11.5.0 2021-06-23
|
||||
|
||||
### Other changes
|
||||
* Implement GLSL_EXT_shader_atomic_float2
|
||||
* Implement GL_EXT_spirv_intrinsics
|
||||
* Fixed SPIR-V remapper not remapping OpExtInst instruction set IDs
|
||||
* only declare compatibility gl_ variables in compatibility mode
|
||||
* Add support for float spec const vector initialization
|
||||
* Implement GL_EXT_subgroup_uniform_control_flow.
|
||||
* Fix arrays dimensioned with spec constant sized gl_WorkGroupSize
|
||||
* Add support for 64bit integer scalar and vector types to bitCount() builtin
|
||||
|
||||
## 11.4.0 2021-04-22
|
||||
|
||||
### Other changes
|
||||
* Fix to keep source compatible with CMake 3.10.2
|
||||
|
||||
## 11.3.0 2021-04-21
|
||||
|
||||
### Other changes
|
||||
* Added --depfile
|
||||
* Added --auto-sampled-textures
|
||||
* Now supports InterpolateAt-based functions
|
||||
* Supports cross-stage automatic IO mapping
|
||||
* Supports GL_EXT_vulkan_glsl_relaxed (-R option)
|
||||
|
||||
## 11.2.0 2021-02-18
|
||||
|
||||
### Other changes
|
||||
* Removed Python requirement when not building with spirv-tools
|
||||
* Add support for GL_EXT_shared_memory_block
|
||||
* Implement GL_EXT_null_initializer
|
||||
* Add CMake support for Fuschia
|
||||
|
||||
## 11.1.0 2020-12-07
|
||||
|
||||
### Other changes
|
||||
* Added ray-tracing extension support
|
||||
|
||||
## 11.0.0 2020-07-20
|
||||
|
||||
### Breaking changes
|
||||
|
||||
#### Visual Studio 2013 is no longer supported
|
||||
|
||||
[As scheduled](https://github.com/KhronosGroup/glslang/blob/9eef54b2513ca6b40b47b07d24f453848b65c0df/README.md#planned-deprecationsremovals),
|
||||
Microsoft Visual Studio 2013 is no longer officially supported. Please upgrade
|
||||
to at least Visual Studio 2015.
|
||||
|
||||
## 10.15.3847 2020-07-20
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* The following files have been removed:
|
||||
* `glslang/include/revision.h`
|
||||
* `glslang/include/revision.template`
|
||||
|
||||
The `GLSLANG_MINOR_VERSION` and `GLSLANG_PATCH_LEVEL` defines have been removed
|
||||
from the public headers. \
|
||||
Instead each build script now uses the new `build_info.py`
|
||||
script along with the `build_info.h.tmpl` and this `CHANGES.md` file to generate
|
||||
the glslang build-time generated header `glslang/build_info.h`.
|
||||
|
||||
The new public API to obtain the `glslang` version is `glslang::GetVersion()`.
|
||||
|
||||
### Other changes
|
||||
* `glslang` shared objects produced by CMake are now `SONAME` versioned using
|
||||
[Semantic Versioning 2.0.0](https://semver.org/).
|
1016
3rdparty/glslang/LICENSE.txt
vendored
1016
3rdparty/glslang/LICENSE.txt
vendored
File diff suppressed because it is too large
Load Diff
9
3rdparty/glslang/SPIRV/GlslangToSpv.cpp
vendored
9
3rdparty/glslang/SPIRV/GlslangToSpv.cpp
vendored
@ -1007,6 +1007,8 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
||||
return spv::BuiltInRayTminKHR;
|
||||
case glslang::EbvRayTmax:
|
||||
return spv::BuiltInRayTmaxKHR;
|
||||
case glslang::EbvCullMask:
|
||||
return spv::BuiltInCullMaskKHR;
|
||||
case glslang::EbvInstanceCustomIndex:
|
||||
return spv::BuiltInInstanceCustomIndexKHR;
|
||||
case glslang::EbvHitT:
|
||||
@ -1777,6 +1779,13 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion,
|
||||
builder.addCapability(spv::CapabilityRayTracingNV);
|
||||
builder.addExtension("SPV_NV_ray_tracing");
|
||||
}
|
||||
if (glslangIntermediate->getStage() != EShLangRayGen && glslangIntermediate->getStage() != EShLangCallable)
|
||||
{
|
||||
if (extensions.find("GL_EXT_ray_cull_mask") != extensions.end()) {
|
||||
builder.addCapability(spv::CapabilityRayCullMaskKHR);
|
||||
builder.addExtension("SPV_KHR_ray_cull_mask");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EShLangTaskNV:
|
||||
|
2
3rdparty/glslang/SPIRV/doc.cpp
vendored
2
3rdparty/glslang/SPIRV/doc.cpp
vendored
@ -392,6 +392,7 @@ const char* BuiltInString(int builtIn)
|
||||
case BuiltInObjectRayDirectionKHR: return "ObjectRayDirectionKHR";
|
||||
case BuiltInRayTminKHR: return "RayTminKHR";
|
||||
case BuiltInRayTmaxKHR: return "RayTmaxKHR";
|
||||
case BuiltInCullMaskKHR: return "CullMaskKHR";
|
||||
case BuiltInInstanceCustomIndexKHR: return "InstanceCustomIndexKHR";
|
||||
case BuiltInRayGeometryIndexKHR: return "RayGeometryIndexKHR";
|
||||
case BuiltInObjectToWorldKHR: return "ObjectToWorldKHR";
|
||||
@ -925,6 +926,7 @@ const char* CapabilityString(int info)
|
||||
case CapabilityRayTracingNV: return "RayTracingNV";
|
||||
case CapabilityRayTracingMotionBlurNV: return "RayTracingMotionBlurNV";
|
||||
case CapabilityRayTracingKHR: return "RayTracingKHR";
|
||||
case CapabilityRayCullMaskKHR: return "RayCullMaskKHR";
|
||||
case CapabilityRayQueryKHR: return "RayQueryKHR";
|
||||
case CapabilityRayTracingProvisionalKHR: return "RayTracingProvisionalKHR";
|
||||
case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
|
||||
|
2
3rdparty/glslang/SPIRV/spirv.hpp
vendored
2
3rdparty/glslang/SPIRV/spirv.hpp
vendored
@ -673,6 +673,7 @@ enum BuiltIn {
|
||||
BuiltInSMCountNV = 5375,
|
||||
BuiltInWarpIDNV = 5376,
|
||||
BuiltInSMIDNV = 5377,
|
||||
BuiltInCullMaskKHR = 6021,
|
||||
BuiltInMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
@ -1069,6 +1070,7 @@ enum Capability {
|
||||
CapabilityDotProductInput4x8BitPackedKHR = 6018,
|
||||
CapabilityDotProduct = 6019,
|
||||
CapabilityDotProductKHR = 6019,
|
||||
CapabilityRayCullMaskKHR = 6020,
|
||||
CapabilityBitInstructions = 6025,
|
||||
CapabilityAtomicFloat32AddEXT = 6033,
|
||||
CapabilityAtomicFloat64AddEXT = 6034,
|
||||
|
2
3rdparty/glslang/build_info.h
vendored
2
3rdparty/glslang/build_info.h
vendored
@ -35,7 +35,7 @@
|
||||
#define GLSLANG_BUILD_INFO
|
||||
|
||||
#define GLSLANG_VERSION_MAJOR 11
|
||||
#define GLSLANG_VERSION_MINOR 8
|
||||
#define GLSLANG_VERSION_MINOR 9
|
||||
#define GLSLANG_VERSION_PATCH 0
|
||||
#define GLSLANG_VERSION_FLAVOR ""
|
||||
|
||||
|
62
3rdparty/glslang/build_info.h.tmpl
vendored
62
3rdparty/glslang/build_info.h.tmpl
vendored
@ -1,62 +0,0 @@
|
||||
// Copyright (C) 2020 The Khronos Group Inc.
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
//
|
||||
// Neither the name of The Khronos Group Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef GLSLANG_BUILD_INFO
|
||||
#define GLSLANG_BUILD_INFO
|
||||
|
||||
#define GLSLANG_VERSION_MAJOR @major@
|
||||
#define GLSLANG_VERSION_MINOR @minor@
|
||||
#define GLSLANG_VERSION_PATCH @patch@
|
||||
#define GLSLANG_VERSION_FLAVOR "@flavor@"
|
||||
|
||||
#define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \
|
||||
(((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
(((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
((patch) > GLSLANG_VERSION_PATCH)))))
|
||||
|
||||
#define GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch) \
|
||||
(((major) > GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
(((minor) > GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
((patch) >= GLSLANG_VERSION_PATCH)))))
|
||||
|
||||
#define GLSLANG_VERSION_LESS_THAN(major, minor, patch) \
|
||||
(((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
(((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
((patch) < GLSLANG_VERSION_PATCH)))))
|
||||
|
||||
#define GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch) \
|
||||
(((major) < GLSLANG_VERSION_MAJOR) || ((major) == GLSLANG_VERSION_MAJOR && \
|
||||
(((minor) < GLSLANG_VERSION_MINOR) || ((minor) == GLSLANG_VERSION_MINOR && \
|
||||
((patch) <= GLSLANG_VERSION_PATCH)))))
|
||||
|
||||
#endif // GLSLANG_BUILD_INFO
|
226
3rdparty/glslang/build_info.py
vendored
226
3rdparty/glslang/build_info.py
vendored
@ -1,226 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2020 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import datetime
|
||||
import errno
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
usage = """{} emits a string to stdout or file with project version information.
|
||||
|
||||
args: <project-dir> [<input-string>] [-i <input-file>] [-o <output-file>]
|
||||
|
||||
Either <input-string> or -i <input-file> needs to be provided.
|
||||
|
||||
The tool will output the provided string or file content with the following
|
||||
tokens substituted:
|
||||
|
||||
<major> - The major version point parsed from the CHANGES.md file.
|
||||
<minor> - The minor version point parsed from the CHANGES.md file.
|
||||
<patch> - The point version point parsed from the CHANGES.md file.
|
||||
<flavor> - The optional dash suffix parsed from the CHANGES.md file (excluding
|
||||
dash prefix).
|
||||
<-flavor> - The optional dash suffix parsed from the CHANGES.md file (including
|
||||
dash prefix).
|
||||
<date> - The optional date of the release in the form YYYY-MM-DD
|
||||
<commit> - The git commit information for the directory taken from
|
||||
"git describe" if that succeeds, or "git rev-parse HEAD"
|
||||
if that succeeds, or otherwise a message containing the phrase
|
||||
"unknown hash".
|
||||
|
||||
-o is an optional flag for writing the output string to the given file. If
|
||||
ommitted then the string is printed to stdout.
|
||||
"""
|
||||
|
||||
def mkdir_p(directory):
|
||||
"""Make the directory, and all its ancestors as required. Any of the
|
||||
directories are allowed to already exist."""
|
||||
|
||||
if directory == "":
|
||||
# We're being asked to make the current directory.
|
||||
return
|
||||
|
||||
try:
|
||||
os.makedirs(directory)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST and os.path.isdir(directory):
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def command_output(cmd, directory):
|
||||
"""Runs a command in a directory and returns its standard output stream.
|
||||
|
||||
Captures the standard error stream.
|
||||
|
||||
Raises a RuntimeError if the command fails to launch or otherwise fails.
|
||||
"""
|
||||
p = subprocess.Popen(cmd,
|
||||
cwd=directory,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
(stdout, _) = p.communicate()
|
||||
if p.returncode != 0:
|
||||
raise RuntimeError('Failed to run %s in %s' % (cmd, directory))
|
||||
return stdout
|
||||
|
||||
|
||||
def deduce_software_version(directory):
|
||||
"""Returns a software version number parsed from the CHANGES.md file
|
||||
in the given directory.
|
||||
|
||||
The CHANGES.md file describes most recent versions first.
|
||||
"""
|
||||
|
||||
# Match the first well-formed version-and-date line.
|
||||
# Allow trailing whitespace in the checked-out source code has
|
||||
# unexpected carriage returns on a linefeed-only system such as
|
||||
# Linux.
|
||||
pattern = re.compile(r'^#* +(\d+)\.(\d+)\.(\d+)(-\w+)? (\d\d\d\d-\d\d-\d\d)? *$')
|
||||
changes_file = os.path.join(directory, 'CHANGES.md')
|
||||
with open(changes_file, mode='r') as f:
|
||||
for line in f.readlines():
|
||||
match = pattern.match(line)
|
||||
if match:
|
||||
flavor = match.group(4)
|
||||
if flavor == None:
|
||||
flavor = ""
|
||||
return {
|
||||
"major": match.group(1),
|
||||
"minor": match.group(2),
|
||||
"patch": match.group(3),
|
||||
"flavor": flavor.lstrip("-"),
|
||||
"-flavor": flavor,
|
||||
"date": match.group(5),
|
||||
}
|
||||
raise Exception('No version number found in {}'.format(changes_file))
|
||||
|
||||
|
||||
def describe(directory):
|
||||
"""Returns a string describing the current Git HEAD version as descriptively
|
||||
as possible.
|
||||
|
||||
Runs 'git describe', or alternately 'git rev-parse HEAD', in directory. If
|
||||
successful, returns the output; otherwise returns 'unknown hash, <date>'."""
|
||||
try:
|
||||
# decode() is needed here for Python3 compatibility. In Python2,
|
||||
# str and bytes are the same type, but not in Python3.
|
||||
# Popen.communicate() returns a bytes instance, which needs to be
|
||||
# decoded into text data first in Python3. And this decode() won't
|
||||
# hurt Python2.
|
||||
return command_output(['git', 'describe'], directory).rstrip().decode()
|
||||
except:
|
||||
try:
|
||||
return command_output(
|
||||
['git', 'rev-parse', 'HEAD'], directory).rstrip().decode()
|
||||
except:
|
||||
# This is the fallback case where git gives us no information,
|
||||
# e.g. because the source tree might not be in a git tree.
|
||||
# In this case, usually use a timestamp. However, to ensure
|
||||
# reproducible builds, allow the builder to override the wall
|
||||
# clock time with environment variable SOURCE_DATE_EPOCH
|
||||
# containing a (presumably) fixed timestamp.
|
||||
timestamp = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
|
||||
formatted = datetime.datetime.utcfromtimestamp(timestamp).isoformat()
|
||||
return 'unknown hash, {}'.format(formatted)
|
||||
|
||||
def parse_args():
|
||||
directory = None
|
||||
input_string = None
|
||||
input_file = None
|
||||
output_file = None
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
raise Exception("Invalid number of arguments")
|
||||
|
||||
directory = sys.argv[1]
|
||||
i = 2
|
||||
|
||||
if not sys.argv[i].startswith("-"):
|
||||
input_string = sys.argv[i]
|
||||
i = i + 1
|
||||
|
||||
while i < len(sys.argv):
|
||||
opt = sys.argv[i]
|
||||
i = i + 1
|
||||
|
||||
if opt == "-i" or opt == "-o":
|
||||
if i == len(sys.argv):
|
||||
raise Exception("Expected path after {}".format(opt))
|
||||
val = sys.argv[i]
|
||||
i = i + 1
|
||||
if (opt == "-i"):
|
||||
input_file = val
|
||||
elif (opt == "-o"):
|
||||
output_file = val
|
||||
else:
|
||||
raise Exception("Unknown flag {}".format(opt))
|
||||
|
||||
return {
|
||||
"directory": directory,
|
||||
"input_string": input_string,
|
||||
"input_file": input_file,
|
||||
"output_file": output_file,
|
||||
}
|
||||
|
||||
def main():
|
||||
args = None
|
||||
try:
|
||||
args = parse_args()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("\nUsage:\n")
|
||||
print(usage.format(sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
directory = args["directory"]
|
||||
template = args["input_string"]
|
||||
if template == None:
|
||||
with open(args["input_file"], 'r') as f:
|
||||
template = f.read()
|
||||
output_file = args["output_file"]
|
||||
|
||||
software_version = deduce_software_version(directory)
|
||||
commit = describe(directory)
|
||||
output = template \
|
||||
.replace("@major@", software_version["major"]) \
|
||||
.replace("@minor@", software_version["minor"]) \
|
||||
.replace("@patch@", software_version["patch"]) \
|
||||
.replace("@flavor@", software_version["flavor"]) \
|
||||
.replace("@-flavor@", software_version["-flavor"]) \
|
||||
.replace("@date@", software_version["date"]) \
|
||||
.replace("@commit@", commit)
|
||||
|
||||
if output_file is None:
|
||||
print(output)
|
||||
else:
|
||||
mkdir_p(os.path.dirname(output_file))
|
||||
|
||||
if os.path.isfile(output_file):
|
||||
with open(output_file, 'r') as f:
|
||||
if output == f.read():
|
||||
return
|
||||
|
||||
with open(output_file, 'w') as f:
|
||||
f.write(output)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
98
3rdparty/glslang/gen_extension_headers.py
vendored
98
3rdparty/glslang/gen_extension_headers.py
vendored
@ -1,98 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2020 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import glob
|
||||
import sys
|
||||
import os
|
||||
|
||||
def generate_main(glsl_files, output_header_file):
|
||||
# Write commit ID to output header file
|
||||
with open(output_header_file, "w") as header_file:
|
||||
# Copyright Notice
|
||||
header_string = '/***************************************************************************\n'
|
||||
header_string += ' *\n'
|
||||
header_string += ' * Copyright (c) 2015-2021 The Khronos Group Inc.\n'
|
||||
header_string += ' * Copyright (c) 2015-2021 Valve Corporation\n'
|
||||
header_string += ' * Copyright (c) 2015-2021 LunarG, Inc.\n'
|
||||
header_string += ' * Copyright (c) 2015-2021 Google Inc.\n'
|
||||
header_string += ' * Copyright (c) 2021 Advanced Micro Devices, Inc.All rights reserved.\n'
|
||||
header_string += ' *\n'
|
||||
header_string += ' ****************************************************************************/\n'
|
||||
header_string += '#pragma once\n\n'
|
||||
header_string += '#ifndef _INTRINSIC_EXTENSION_HEADER_H_\n'
|
||||
header_string += '#define _INTRINSIC_EXTENSION_HEADER_H_\n\n'
|
||||
header_file.write(header_string)
|
||||
|
||||
symbol_name_list = []
|
||||
|
||||
for i in glsl_files:
|
||||
glsl_contents = open(i,"r").read()
|
||||
|
||||
filename = os.path.basename(i)
|
||||
symbol_name = filename.split(".")[0]
|
||||
symbol_name_list.append(symbol_name)
|
||||
header_name = symbol_name + ".h"
|
||||
header_str = 'std::string %s_GLSL = R"(\n%s\n)";\n' % (symbol_name, glsl_contents)
|
||||
header_str += '\n'
|
||||
header_file.write(header_str)
|
||||
|
||||
contents = ''
|
||||
contents += '\n'
|
||||
contents += 'std::string getIntrinsic(const char* const* shaders, int n) {\n'
|
||||
contents += '\tstd::string shaderString = "";\n';
|
||||
|
||||
contents += '\tfor (int i = 0; i < n; i++) {\n'
|
||||
|
||||
for symbol_name in symbol_name_list:
|
||||
contents += '\t\tif (strstr(shaders[i], "%s") != NULL) {\n' % (symbol_name)
|
||||
contents += '\t\t shaderString.append(%s_GLSL);\n' % (symbol_name)
|
||||
contents += '\t\t}\n'
|
||||
|
||||
contents += '\t}\n'
|
||||
contents += '\treturn shaderString;\n';
|
||||
contents += '}\n'
|
||||
|
||||
contents += '\n#endif\n'
|
||||
header_file.write(contents)
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
raise Exception("Invalid number of arguments")
|
||||
|
||||
i = 0
|
||||
while i < len(sys.argv):
|
||||
opt = sys.argv[i]
|
||||
i = i + 1
|
||||
|
||||
if opt == "-i" or opt == "-o":
|
||||
if i == len(sys.argv):
|
||||
raise Exception("Expected path after {}".format(opt))
|
||||
val = sys.argv[i]
|
||||
i = i + 1
|
||||
if (opt == "-i"):
|
||||
input_dir = val
|
||||
elif (opt == "-o"):
|
||||
output_file = val
|
||||
else:
|
||||
raise Exception("Unknown flag {}".format(opt))
|
||||
|
||||
glsl_files = glob.glob(input_dir + '/*.glsl')
|
||||
|
||||
# Generate main header
|
||||
generate_main(glsl_files, output_file)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -5430,7 +5430,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
|
||||
}
|
||||
case EOpWavePrefixCountBits:
|
||||
{
|
||||
// Mapped to subgroupBallotInclusiveBitCount(subgroupBallot())
|
||||
// Mapped to subgroupBallotExclusiveBitCount(subgroupBallot())
|
||||
// builtin
|
||||
|
||||
// uvec4 type.
|
||||
@ -5444,7 +5444,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
|
||||
TType uintType(EbtUint, EvqTemporary);
|
||||
|
||||
node = intermediate.addBuiltInFunctionCall(loc,
|
||||
EOpSubgroupBallotInclusiveBitCount, true, res, uintType);
|
||||
EOpSubgroupBallotExclusiveBitCount, true, res, uintType);
|
||||
|
||||
break;
|
||||
}
|
||||
|
1
3rdparty/glslang/glslang/Include/BaseTypes.h
vendored
1
3rdparty/glslang/glslang/Include/BaseTypes.h
vendored
@ -263,6 +263,7 @@ enum TBuiltInVariable {
|
||||
EbvObjectRayDirection,
|
||||
EbvRayTmin,
|
||||
EbvRayTmax,
|
||||
EbvCullMask,
|
||||
EbvHitT,
|
||||
EbvHitKind,
|
||||
EbvObjectToWorld,
|
||||
|
@ -5857,6 +5857,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"in uint gl_IncomingRayFlagsNV;"
|
||||
"in uint gl_IncomingRayFlagsEXT;"
|
||||
"in float gl_CurrentRayTimeNV;"
|
||||
"in uint gl_CullMaskEXT;"
|
||||
"\n";
|
||||
const char *hitDecls =
|
||||
"in uvec3 gl_LaunchIDNV;"
|
||||
@ -5893,6 +5894,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"in uint gl_IncomingRayFlagsNV;"
|
||||
"in uint gl_IncomingRayFlagsEXT;"
|
||||
"in float gl_CurrentRayTimeNV;"
|
||||
"in uint gl_CullMaskEXT;"
|
||||
"\n";
|
||||
const char *missDecls =
|
||||
"in uvec3 gl_LaunchIDNV;"
|
||||
@ -5912,6 +5914,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
|
||||
"in uint gl_IncomingRayFlagsNV;"
|
||||
"in uint gl_IncomingRayFlagsEXT;"
|
||||
"in float gl_CurrentRayTimeNV;"
|
||||
"in uint gl_CullMaskEXT;"
|
||||
"\n";
|
||||
|
||||
const char *callableDecls =
|
||||
@ -8743,6 +8746,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
symbolTable.setVariableExtensions("gl_RayTminEXT", 1, &E_GL_EXT_ray_tracing);
|
||||
symbolTable.setVariableExtensions("gl_RayTmaxNV", 1, &E_GL_NV_ray_tracing);
|
||||
symbolTable.setVariableExtensions("gl_RayTmaxEXT", 1, &E_GL_EXT_ray_tracing);
|
||||
symbolTable.setVariableExtensions("gl_CullMaskEXT", 1, &E_GL_EXT_ray_cull_mask);
|
||||
symbolTable.setVariableExtensions("gl_HitTNV", 1, &E_GL_NV_ray_tracing);
|
||||
symbolTable.setVariableExtensions("gl_HitTEXT", 1, &E_GL_EXT_ray_tracing);
|
||||
symbolTable.setVariableExtensions("gl_HitKindNV", 1, &E_GL_NV_ray_tracing);
|
||||
@ -8792,6 +8796,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||
BuiltInVariable("gl_RayTminEXT", EbvRayTmin, symbolTable);
|
||||
BuiltInVariable("gl_RayTmaxNV", EbvRayTmax, symbolTable);
|
||||
BuiltInVariable("gl_RayTmaxEXT", EbvRayTmax, symbolTable);
|
||||
BuiltInVariable("gl_CullMaskEXT", EbvCullMask, symbolTable);
|
||||
BuiltInVariable("gl_HitTNV", EbvHitT, symbolTable);
|
||||
BuiltInVariable("gl_HitTEXT", EbvHitT, symbolTable);
|
||||
BuiltInVariable("gl_HitKindNV", EbvHitKind, symbolTable);
|
||||
|
@ -2327,7 +2327,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
|
||||
error(loc, "argument must be compile-time constant", "payload number", "a");
|
||||
else {
|
||||
unsigned int location = (*argp)[10]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
|
||||
if (intermediate.checkLocationRT(0, location) < 0)
|
||||
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(0, location) < 0)
|
||||
error(loc, "with layout(location =", "no rayPayloadEXT/rayPayloadInEXT declared", "%d)", location);
|
||||
}
|
||||
break;
|
||||
@ -2340,7 +2340,7 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
|
||||
error(loc, "argument must be compile-time constant", "callable data number", "");
|
||||
else {
|
||||
unsigned int location = (*argp)[1]->getAsConstantUnion()->getAsConstantUnion()->getConstArray()[0].getUConst();
|
||||
if (intermediate.checkLocationRT(1, location) < 0)
|
||||
if (!extensionTurnedOn(E_GL_EXT_spirv_intrinsics) && intermediate.checkLocationRT(1, location) < 0)
|
||||
error(loc, "with layout(location =", "no callableDataEXT/callableDataInEXT declared", "%d)", location);
|
||||
}
|
||||
break;
|
||||
|
@ -334,6 +334,7 @@ void TParseVersions::initializeExtensionBehavior()
|
||||
extensionBehavior[E_GL_EXT_ray_tracing] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_ray_query] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_ray_flags_primitive_culling] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_ray_cull_mask] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_blend_func_extended] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_shader_implicit_conversions] = EBhDisable;
|
||||
extensionBehavior[E_GL_EXT_fragment_shading_rate] = EBhDisable;
|
||||
@ -505,6 +506,7 @@ void TParseVersions::getPreamble(std::string& preamble)
|
||||
"#define GL_EXT_ray_tracing 1\n"
|
||||
"#define GL_EXT_ray_query 1\n"
|
||||
"#define GL_EXT_ray_flags_primitive_culling 1\n"
|
||||
"#define GL_EXT_ray_cull_mask 1\n"
|
||||
"#define GL_EXT_spirv_intrinsics 1\n"
|
||||
|
||||
"#define GL_AMD_shader_ballot 1\n"
|
||||
|
@ -201,6 +201,7 @@ const char* const E_GL_EXT_debug_printf = "GL_EXT_debug_prin
|
||||
const char* const E_GL_EXT_ray_tracing = "GL_EXT_ray_tracing";
|
||||
const char* const E_GL_EXT_ray_query = "GL_EXT_ray_query";
|
||||
const char* const E_GL_EXT_ray_flags_primitive_culling = "GL_EXT_ray_flags_primitive_culling";
|
||||
const char* const E_GL_EXT_ray_cull_mask = "GL_EXT_ray_cull_mask";
|
||||
const char* const E_GL_EXT_blend_func_extended = "GL_EXT_blend_func_extended";
|
||||
const char* const E_GL_EXT_shader_implicit_conversions = "GL_EXT_shader_implicit_conversions";
|
||||
const char* const E_GL_EXT_fragment_shading_rate = "GL_EXT_fragment_shading_rate";
|
||||
|
Loading…
Reference in New Issue
Block a user