* Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2408)
* Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output.
Improve documentation on existing SpirvToolsDisassemble interface.
* Update pre-processor check - following existing ENABLE_OPT checks.
* Fix not-found header paths for glslangValidator and glslangtests.
* Add spirv_tools/include path where there is an ENABLE_OPT=1 in the BUILD.gn configuration.
The glslang public includes dir contains headers with implicit
conversion issues. Add -Wno-conversion to glslang's public config.
Bug: 60140
Bug: 58162
Change-Id: Iec27cb4242e9fdceddd6a3e02044a0bccfa0ce36
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/glslang/+/429054
Reviewed-by: Petr Hosek <phosek@google.com>
Co-authored-by: Shai Barack <shayba@google.com>
This change strips a few features similar to GLSLANG_WEB but doesn't
remove every detail like the latter. It also hardcodes profile/version
to core/450.
In particular, TBuiltIns::initialize is specialized to remove most of
what is not supported or won't be supported by ANGLE. The result of
this function is parsed with TParseContext::parseShaderStrings which is
a performance bottleneck.
This change shaves about 300KB off of ANGLE's binary size and reduces
the cost of SetupBuiltinSymbolTable to nearly a sixth.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
It would seem that `glslang_sources` has a private dependency on `glslang_build_info`, so `glslang_validator` cannot transitively `#include` the generated `glslang/build_info.h` header.
Add `glslang_build_info` as a direct dependency to `glslang_validator`.
Also remove the duplicate dependency on `glslang_build_info` in `glslang_sources_common`
Note: This is a speculative fix as I can build Chromium fine without these changes.
Not sure what's different between these configs.
This PR significantly reworks the way glslang is versioned.
Instead of committing changes to the `GLSLANG_MINOR_VERSION` define in
`glslang/Public/ShaderLang.h`, and using `make-revision` to generate
`GLSLANG_PATCH_LEVEL` in `glslang/Include/revision.h`, all version
information is now derived from the new `CHANGES.md` file.
`CHANGES.md` acts as the single source of truth for glslang version
information, along with a convenient place to put all release notes for
each notable change made.
`CHANGES.md` is parsed using the new `build_info.py` python script.
This script can read basic template files to produce new source files,
which it does to read the new `build_info.h.tmpl` to generate (at build
time) a glslang private header at
`<build-dir>/include/glslang/build_info.h`.
I've written generators for each of the CMake, Bazel, gn, and
`Android.mk` build scripts.
The new version code conforms to the Semantic Versioning 2.0 spec.
This new version is also used by the CMake rules to produce versioned
shared objects, including a major-versioned SONAME.
New APIs:
---------
* `glslang::GetVersion()` returns a `Version` struct with the version
major, minor, patch and flavor.
Breaking API changes:
---------------------
* The public defines `GLSLANG_MINOR_VERSION` and `GLSLANG_PATCH_LEVEL`
have been entirely removed.
* `glslang/Public/ShaderLang.h` and `glslang/Include/revision.h` have
been deleted.
* Instead, `<build-dir>/include/glslang/build_info.h` is created in
the build directory, and `<build-dir>/include` is a CMake `PUBLIC`
(dependee-inherited) include directory for the glslang targets.
* `<build-dir>/include/glslang/build_info.h` contains the following
new #defines:
`GLSLANG_VERSION_MAJOR`, `GLSLANG_VERSION_MINOR`,
`GLSLANG_VERSION_PATCH`, `GLSLANG_VERSION_FLAVOR`,
`GLSLANG_VERSION_GREATER_THAN(major, minor, patch)`,
`GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch)`,
`GLSLANG_VERSION_LESS_THAN(major, minor, patch)`,
`GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch)`
* The CMake install output directory contains a copy of
`build_info.h` at: `include/glslang/build_info.h`
* Python3 is now always required to build glslang (likely always
required for transitive dependency builds).
glslang.y is specialized to remove what is not supported or won't be
supported by ANGLE.
This change shaves about 125KB off of ANGLE's binary size with minor
improvement to the cost of SetupBuiltinSymbolTable.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
This change strips a few features similar to GLSLANG_WEB but doesn't
remove every detail like the latter. It also hardcodes profile/version
to core/450.
In particular, TBuiltIns::initialize is specialized to remove most of
what is not supported or won't be supported by ANGLE. The result of
this function is parsed with TParseContext::parseShaderStrings which is
a performance bottleneck.
This change shaves about 300KB off of ANGLE's binary size and reduces
the cost of SetupBuiltinSymbolTable to nearly a sixth.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
Dawn tests use shaderc, which assumes glslang has HLSL support. This
change makes HLSL support also follow template arguments, and changes
the target names such that glslang_sources will remain the "has all
features" target and the new glslang_lib_sources would be what ANGLE
would use.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
To reduce the binary size of ANGLE, a gn override is added
(glslang_angle) which:
- Controls whether ENABLE_OPT=1 is set
- Customizes the build for the Vulkan backend of ANGLE. As a first
step, this removes HLSL functionality which together with no
optimization shave ~2.5MB off of ANGLE's binary size.
Upcoming changes will add a macro for GLSLANG_ANGLE similar to
GLSLANG_WEB that will strip features from glslang to support only what
ANGLE needs.
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
Now that the HLSL source files are part of the `glslang` target (#2271), it makes sense for these to sit in the `glslang` directory.
Changed the case of the directory from `hlsl` to `HLSL` to better match the sibling directories.
The Fuchsia platform build and the Chromium one use a completely
different set of configs to specify default warnings. The previous
version of BUILD.gn worked with Chromium, but failed to build
with Fuchsia.
This CL fixes the issue by identifying said configs and reusing
them consistently.
Change-Id: I7de526a57d2f14eb93c03e06401d2c3059d35e9a
This reverts commit 41261d95a4.
This reverts commit 7c9accb653.
Instead of trying to work around all of the potential semicolon issues
in glslang, making it conform to Chromium's style, mark the code
explicitly as non-chromium in the BUILD.gn, so chromium doesn't
attempt to enforce its style rules on glslang.
Fixes#1931
The Fuchsia build is very picky about newlines at the end of files
and will complain loudly about them. Removing the -Wnewline-eof
warning solves the issue.
In order to upgrade the version of glslang used by the
Fuchsia platform source tree, BUILD.gn needs to be
slightly modified to care about the case where it is
not used with the Chromium //build configuration:
- Remove a new compiler warning to ensure proper
compilation with -Werror (which is the default).
- Add a build target for spirv-remap, which is used
by Fuchsia at build time to optimize the precompiled
shaders of some of its graphics libraries.
One variable was only used in an 'assert' call. MSVC flagged this
as unused in Release. Suppress the warning and also add a static
cast to void so the variable becomes referenced.
Usually this warning is disabled by default. But when turned on Clang
complains about extra semicolons in Glslang headers. Turn this off for
now. See http://crbug.com/926235
* adds a source set for default resource limits to mirror CMake
* adds a target executable for the standalone validator
* fixes a missing warning
Allows ANGLE to use the integrated BUILD.gn instead of a custom one.
ANGLE bug: 3088
This had no sources and depended on a source_set which is an invalid use
of GN because the source_set gets propagated to dependents of the
static_library instead.
This CL adds the necessary configuration to build glslang inside a
Chromium checkout. Two build warnings were fixed in the process to
make things compile.