Commit Graph

46 Commits

Author SHA1 Message Date
amhagan
035a3bbc4a GL_EXT_spirv_intrinsics - Port extensions
Add mechanism to use GL_EXT_spirv_intrinsics headers in glslang.
Ported GL_EXT_shader_realtime_clock as an example.
2021-10-15 14:13:08 -04:00
Rex Xu
65a7fb7054 Implement the extension GL_EXT_spirv_intrinsics
- Add support of SPIR-V execution mode qualifiers.
- Add support of SPIR-V storage class qualifier.
- Add support of SPIR-V decorate qualifiers.
- Add support of SPIR-V type specifier.
- Add support of SPIR-V intruction qualifiers.
- Add support of spirv_by_reference/spirv_literal parameter qualifier.
- Add shader stage macros introduced by this extension.
2021-06-09 14:18:06 +08:00
Courtney Goeltzenleuchter
d550bebee9
Fix build error with Chromium & ANGLE (#2446)
Getting error about undefined symbol (include_dir) at line 320.
Was trying to append to a non-existant variable.

Bug #2445
2020-11-02 21:22:55 -07:00
pheonix
c897c3bc23
Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2442)
* 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.
2020-11-02 14:40:50 -07:00
jonahryandavis
3ce148638b
Disable -Wno-conversion on MSVC compiler (#2410) 2020-10-07 11:32:49 -06:00
craig stout
1815d86a22
[Wconversion] Suppress glslang issue (#2404)
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>
2020-09-26 11:02:33 -06:00
Jamie Madill
bb52b5e452 Suppress two override suggestion warnings.
We're turning these on in ANGLE and want to keep the build clean.
2020-08-26 00:54:50 -04:00
Shahbaz Youssefi
1ef2e250fc
Use GLSLANG_ANGLE to strip features to what ANGLE requires
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>
2020-07-31 12:44:49 -04:00
John Kessenich
4f32f93d7e Revert "Merge pull request #2330 from ShabbyX/optimize_for_angle"
This reverts commit 1ee5d1c0bb, reversing
changes made to 906d48a7e8.
2020-07-13 03:39:08 -06:00
John Kessenich
1ee5d1c0bb
Merge pull request #2330 from ShabbyX/optimize_for_angle
Optimize for angle
2020-07-12 00:32:52 +07:00
Ben Clayton
360ba05949 Attempt to fix chromium builds
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.
2020-07-10 13:46:32 +01:00
Ben Clayton
fbe9a23baf Generate build information from CHANGES.md
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).
2020-07-09 12:34:02 +01:00
Shahbaz Youssefi
59fb2d6361
Customize glslang.y to GLSLANG_ANGLE
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>
2020-07-08 16:01:42 -04:00
Shahbaz Youssefi
8c49d15fbf
Use GLSLANG_ANGLE to strip features to what ANGLE requires
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>
2020-07-08 15:33:20 -04:00
Ryan Harrison
eab46cfdd6 Make sure glslang_angle has a definition in BUILD.gn
Set the value to false if the environment doesn't declare this variable.
2020-07-07 11:45:02 -04:00
Shahbaz Youssefi
a55029d098
gn: Fix dawn tests in Chromium
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>
2020-07-05 16:48:34 -04:00
Shahbaz Youssefi
e2b7983593
gn: Fix gn gen --check by adding missing dependency
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
2020-07-05 06:26:04 -04:00
Shahbaz Youssefi
8f8f1bc518
gn: Optionally disable optimizations and HLSL
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>
2020-07-03 15:06:19 -04:00
Ben Clayton
f49820dd6b Move hlsl/ source to glslang/HLSL/
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.
2020-06-16 11:55:28 +01:00
Aaron Franke
c8274e941e
Make file formatting comply with POSIX and Unix standards
UTF-8, LF, no BOM, and newlines at the end of files
2020-03-21 03:20:25 -04:00
Jeff Bolz
04d73731de GL_EXT_debug_printf implementation 2020-03-05 13:41:34 -06:00
Jamie Madill
6fbc1af8ae Add a couple missing headers to the GN build.
Detected with ANGLE's export_targets script.
2019-11-02 09:56:09 -04:00
David Turner
a3f0da56e4 BUILD.gn: Fix fuchsia build (#1944)
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
2019-10-23 08:07:19 -06:00
Ryan Harrison
1aeceaea7d Fix config issues and revert previous fixes for semi-colon issues
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
2019-10-15 14:45:02 -04:00
Ryan Harrison
7c9accb653 Remove unnecessary semi-colons and add warning about them
These are causing integration issues with Chromium down stream since
it is more strict about these.
2019-10-11 11:25:04 -04:00
David 'Digit' Turner
9d43c7f393 Fix Fuchsia build.
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.
2019-09-18 10:35:11 +02:00
Corentin Wallez
5442b4fffc BUILD.gn: Add missing HLSL files. 2019-08-27 15:24:31 +02:00
Corentin Wallez
9757da4f8e GN build (for Chromium): enable HLSL in dependents.
The previous fix for this only enabled HLSL internally in glslang which
means that dependent using HLSL, for example shaderc, failed
compilation.
2019-08-26 14:13:54 +02:00
David Neto
96bec343d0 GN build (for Chromium): enable HLSL 2019-08-23 14:35:35 -04:00
David 'Digit' Turner
1f5799c155 BUILD.gn: Fix file for use with Fuchsia platform build.
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.
2019-06-21 16:00:30 +02:00
Tom Anderson
e10c87a306 Remove non-source sources from binary targets
No behavior changes.  Please see [1] for why this is necessary.

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=964411
2019-05-17 10:54:03 -07:00
Shahbaz Youssefi
741fc4ab77 Build.gn: allow optimization in glslang lib and standalone 2019-05-16 23:53:15 -04:00
John Kessenich
bd0f5ad278
Merge pull request #1733 from null77/fix-msvc-warn
Suppress MSVC warning about unused variable.
2019-03-18 23:41:27 +07:00
Jamie Madill
099a80dd76 Suppress MSVC warning about unused variable.
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.
2019-03-18 11:38:53 -04:00
Jamie Madill
e880e96f4d GN: Make glslang_validator an executable.
The target was accidentally listed as a source_set.
2019-03-11 15:45:31 -04:00
Jamie Madill
1a1651c6e9 Disable Clang extra semicolon warning.
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
2019-01-30 11:37:15 -05:00
Jamie Madill
08fe88a94c Suppress a MSVC cast warning in GN.
Also came up when using the BUILD.gn file with ANGLE.

ANGLE bug: 3088
2019-01-24 10:56:20 -05:00
Jamie Madill
9706106ecd Suppress inconsistent override warning in GN.
This came up when trying to roll the new glslang into Chromium.

ANGLE bug: 3088
2019-01-23 18:58:10 -05:00
Jamie Madill
0ceaebcff9 Fix a few GN build issues.
* 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
2019-01-18 17:01:46 -05:00
Corentin Wallez
ab5382cf79 BUILD.gn: remove reference to non-existent header 2018-10-30 16:11:46 +01:00
Corentin Wallez
5403f380a4 BUILD.gn: remove the static_library target.
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.
2018-10-17 12:22:28 +02:00
Corentin Wallez
6857c23825 BUILD.gn: glslang_sources need the public config too 2018-10-03 13:15:23 -04:00
Corentin Wallez
a26827adc2 BUILD.gn: only use complete_static_lib on mac 2018-10-02 09:28:15 -04:00
Corentin Wallez
873734dd3f BUILD.gn: make the static_lib complete to fix the build on OSX 2018-09-26 14:51:19 -07:00
Dan Sinclair
b29c58ea45 Review feedback 2018-09-24 18:40:38 -04:00
Dan Sinclair
257b25c81f Add BUILD.gn configuration.
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.
2018-09-24 16:57:55 -04:00