summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-07-31 16:31:30 -0400
committerGitHub <noreply@github.com>2020-07-31 13:31:30 -0700
commit4549597709e29b85b5f95503f4f2258c16db12be (patch)
treeef9dd57c9975e928950e0289e017bf622bea9298 /source
parentfc8b5758ca7a9b3aaf2f93d45ff570fab2a68bb8 (diff)
Upgrade to Glslang 11.0.0 (#1466)
* Fix premake5.lua so it uses the new path needed for OpenCLDebugInfo100.h * Keep including the includes directory. * Added the spirv-tools-generated files. * We don't need to include the spirv/unified1 path because the files needed are actually in the spirv-tools-generated folder. * Put the build_info.h glslang generated files in external/glslang-generated. Alter premake5.lua to pick up that header. * First pass at documenting how to build glslang and spirv-tools. * Improved glsl/spir-v tools README.md * Added revision.h * Change how gResources is calculated. Update about revision.h * Update docs a little. * Split out spirv-tools into a separate project for building glslang. This was not necessary on linux, but *is* necessary on windows, because there is a file disassemble.cpp in spirv-tools and in glslang, and this leads to VS choosing only one. With the separate library, the problem is resolved. * Fix direct-spirv-emit output. * Update to latest version of spirv headers and spirv-tools. * Upgrade submodule version of glslang in external. * Add fPIC to build options of slang-spirv-tools * Upgrade slang-binaries to have new glslang. * Fix issues with Windows slang-glslang binaries, via update of slang-binaries used. * Small improvements to glslang building process documentation. Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang-glslang/slang-glslang.cpp48
1 files changed, 34 insertions, 14 deletions
diff --git a/source/slang-glslang/slang-glslang.cpp b/source/slang-glslang/slang-glslang.cpp
index 64680fe54..02d5a8459 100644
--- a/source/slang-glslang/slang-glslang.cpp
+++ b/source/slang-glslang/slang-glslang.cpp
@@ -41,21 +41,41 @@
#define UNLIMITED 9999
-static TBuiltInResource gResources =
+static TBuiltInResource _calcBuiltinResources()
{
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,-UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED, UNLIMITED,
- UNLIMITED, UNLIMITED,
-
- { true, true, true, true, true, true, true, true, true, }
-};
+ // NOTE! This is a bit of a hack - to set all the fields to true/UNLIMITED.
+
+ // We are relying on limits being after the other fields.
+ SLANG_COMPILE_TIME_ASSERT(SLANG_OFFSET_OF(TBuiltInResource, limits) > 0);
+ // We are relying on maxLights being the first parameter, and all values will have the same type
+ SLANG_COMPILE_TIME_ASSERT(SLANG_OFFSET_OF(TBuiltInResource, maxLights) == 0);
+
+ TBuiltInResource resource;
+ // Set up all the integer values.
+ {
+
+ auto* dst = &resource.maxLights;
+ const size_t count = SLANG_OFFSET_OF(TBuiltInResource, limits) / sizeof(*dst);
+ for (size_t i = 0; i < count; ++i)
+ {
+ dst[i] = UNLIMITED;
+ }
+ }
+ // Set up the bools
+ {
+ TLimits* limits = &resource.limits;
+ bool* dst = (bool*)limits;
+
+ const size_t count = sizeof(TLimits) / sizeof(bool);
+ for (size_t i = 0; i < count; ++i)
+ {
+ dst[i] = true;
+ }
+ }
+ return resource;
+}
+
+static TBuiltInResource gResources = _calcBuiltinResources();
static void dump(
void const* data,