Commit Graph

3951 Commits

Author SHA1 Message Date
John Kessenich
f5add0b20d
Merge pull request #2337 from KhronosGroup/revert-ANGLE
Revert "Merge pull request #2330 from ShabbyX/optimize_for_angle"
2020-07-13 17:34:05 +07:00
John Kessenich
07211b42db Fix comma in licence checker. 2020-07-13 03:52:02 -06: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
5799f5befe Fix a couple lines that were too long, to retrigger bots. 2020-07-13 02:52:11 -06:00
John Kessenich
4e13c90944 Fix #2329: don't use invalid initializers. 2020-07-13 00:35:58 -06:00
John Kessenich
206886948a
Merge pull request #2334 from ben-clayton/license-checker-cfg
Add missing comma from license-checker.cfg
2020-07-12 22:43:35 +07:00
Ben Clayton
6788647d8e Add missing comma from license-checker.cfg
Fixes license checker presubmit.
2020-07-12 13:07:39 +01:00
John Kessenich
09ea6fa99a
Merge pull request #2333 from 1480c1/mingw-w64
Common: include standard headers before doing any defines
2020-07-12 17:05:59 +07:00
Christopher Degawa
8486b2e0db
Common: include standard headers before doing any defines
currently, due to

```c++
\#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) || defined MINGW_HAS_SECURE_API
    #include <basetsd.h>
    #ifndef snprintf
    #define snprintf sprintf_s
    #endif
    #define safe_vsprintf(buf,max,format,args) vsnprintf_s((buf), (max), (max), (format), (args))
```

defining `snprintf` to `sprintf_s` essentially unconditionally, this will break the
stdio.h+cstdio system header for mingw-w64 g++ in msys2 with shaderc
https://github.com/google/shaderc/issues/1065

an alternative change would be
https://raw.githubusercontent.com/shinchiro/mpv-winbuild-cmake/master/packages/glslang-0001-fix-gcc-10.1-error.patch
in which the `|| defined MINGW_HAS_SECURE_API` part is removed

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
2020-07-12 00:06:35 +00:00
John Kessenich
1ee5d1c0bb
Merge pull request #2330 from ShabbyX/optimize_for_angle
Optimize for angle
2020-07-12 00:32:52 +07:00
John Kessenich
906d48a7e8
Merge pull request #2332 from ben-clayton/fix-cmake-include
Fix CMake rules when nesting CMake projects
2020-07-10 21:54:37 +07:00
Ben Clayton
2270713d6a Fix CMake rules when nesting CMake projects
`${CMAKE_SOURCE_DIR}` points to the outer project root, not the current directory.

Fixes building of `glslang` when included into another CMake project.
2020-07-10 14:39:39 +01:00
John Kessenich
2041586674
Merge pull request #2331 from ben-clayton/fix-chromium
Attempt to fix chromium builds
2020-07-10 07:00:11 -06: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
John Kessenich
020397608e
Merge pull request #2277 from ben-clayton/build-info
Generate build information from CHANGES.md
2020-07-10 05:43:10 -06: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
John Kessenich
5aaa0c2bc8
Merge pull request #2327 from ben-clayton/fix-pch
Use CMake's builtin functionality for pre-compiled headers
2020-07-09 00:39:31 -06: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
John Kessenich
29c9135d06
Merge pull request #2328 from zoddicus/fixBUILDgn
Make sure glslang_angle has a definition in BUILD.gn
2020-07-07 11:01:30 -06: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
Ben Clayton
31cad22758 Use CMake's builtin functionality for PCHs
`glslang_pch()` did manual mangling of the compiler flags to enable pre-compiled headers.
I couldn't get this approach to work with the `MachineIndependent` subdirectory, but fortunately CMake has added first-class support for precompiled headers in 3.16, which does work with subdirectories.

Moved `glslang_pch()` to the other global function declarations.

`glslang_pch()` is a no-op when using CMake earlier than `3.16`.

CMake's PCH implementation does not need the `pch.cpp` files, so just remove them.
2020-07-07 16:44:19 +01:00
John Kessenich
e8c9fd602f
Merge pull request #2326 from ben-clayton/always_pic
Remove GLSLANG_BUILD_PIC flag
2020-07-07 09:12:12 -06:00
John Kessenich
ba17d8bcf0
Merge pull request #2324 from ben-clayton/gitignore
Add new rules to .gitignore
2020-07-07 04:56:39 -06:00
Ben Clayton
3604be156c Remove GLSLANG_BUILD_PIC flag
On closer inspection, it appears that nearly all the targets use the `POSITION_INDEPENDENT_CODE` target option anyway.
Simplify all this away by always being PIC.
2020-07-07 11:49:40 +01:00
Ben Clayton
948dc034c5 Add new static targets to VS solution folders
`GenericCodeGen` and `MachineIndependent` were missing from the generated visual studio solutions. Add these.
2020-07-07 11:45:11 +01:00
Ben Clayton
a21c5f3604 Add new rules to .gitignore
`.vscode/` ignores Visual Studio Code user config files
`bazel-*` ignores bazel build system symlinks.
`out/` ignores the default output directory for Visual Studio generated files.
2020-07-07 11:15:24 +01:00
John Kessenich
f5ed7a69d5
Merge pull request #2322 from ShabbyX/fix-dawn-tests
gn: Fix dawn tests in Chromium
2020-07-06 06:07:58 -06:00
John Kessenich
309ffa294c
Merge pull request #2314 from marcinslusarz/quiet
Add --quiet option.
2020-07-06 05:36:34 -06:00
Marcin Ślusarz
245c30c296 Add --quiet option.
Being quiet should have been the default, but I guess it's too late
now to change it.
2020-07-06 10:55:40 +02: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
John Kessenich
e7cb8bf080
Merge pull request #2320 from ShabbyX/fix-gn-check
gn: Fix `gn gen --check` by adding missing dependency
2020-07-05 10:12:27 -06: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
John Kessenich
909bca8ab9
Merge pull request #2317 from ShabbyX/glslang_angle
gn: Optionally disable optimizations and HLSL
2020-07-04 08:40:19 -06:00
John Kessenich
257e9a3f19
Merge pull request #2319 from ben-clayton/build-pic
Add GLSLANG_BUILD_PIC CMake flag
2020-07-03 22:37:25 -06:00
John Kessenich
0638724baa
Merge pull request #2316 from ben-clayton/fix-2315
Don't use add_link_options() on old CMake versions
2020-07-03 21:19:42 -06:00
Ben Clayton
1125f1b269 Add GLSLANG_BUILD_PIC CMake flag
Enables `-fPIC` compiler flag even when building statically.
This is helpful for statically linking a `glslang` target into a shared library.

Simplifies the workarounds seen in google/shaderc#1093 to a `set(GLSLANG_BUILD_PIC 1)`.
2020-07-03 23:24:08 +01: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
4af48da4e3 Don't use add_link_options() on old CMake versions
Fixes: #2315
2020-07-03 15:41:03 +01:00
John Kessenich
73e001a752
Merge pull request #2311 from ben-clayton/license-checker
Kokoro: Correct the `build_file' path to build.sh
2020-07-03 05:24:45 -06:00
John Kessenich
3ec0d74c05
Merge pull request #2312 from ben-clayton/fix-copyright
License headers: s/Google/The Khronos Group
2020-07-03 05:23:15 -06:00
Ben Clayton
cb261e3c21 License headers: s/Google/The Khronos Group
This was a copy-paste screwup, where the first line of the copyright had the company name was updated, but the company name mid way though was not.
2020-07-03 12:21:01 +01:00
Ben Clayton
751b3f83c5 Kokoro: Correct the `build_file' path to build.sh 2020-07-03 11:07:43 +01:00
John Kessenich
4728509962
Merge pull request #2310 from ben-clayton/license-checker
Add license checking continuous and presubmit tests
2020-07-02 23:33:30 -06:00
John Kessenich
ed3d5dbe99
Merge pull request #2309 from ben-clayton/fix-msvc-linker-warnings
Fix GLSLANG_IS_SHARED_LIBRARY define
2020-07-02 23:32:01 -06:00
Ben Clayton
fb187f3063 Add config for license-checker and Kokoro scripts.
The `license-checker` is a tool that verifies each file has contains a permitted license header.

See https://github.com/ben-clayton/license-checker for more information.
2020-07-02 18:59:34 +01:00
Ben Clayton
cb4788c7a6 Fix GLSLANG_IS_SHARED_LIBRARY define
It was incorrectly always being set, causing linker warnings for MSVC builds.
Also simplify the preprocessor nesting in `glslang\Public\ShaderLang.h`
2020-07-02 16:10:20 +01:00
Ben Clayton
1d21270ebf Add missing copyright headers
Add copyright headers to build files and scripts.
Simplifies automated scanning for bad license headers.
2020-07-02 16:03:48 +01:00
John Kessenich
a70f7dea77
Merge pull request #2268 from lriki/hlsl-pack_matrix
HLSL: Fix #pragma pack_matrix(row_major) not work on global uniforms
2020-07-02 05:21:45 -06:00
John Kessenich
5d4d211933
Merge pull request #2303 from ben-clayton/limit-public-2
glslang: Only export public interface for SOs
2020-07-02 05:02:59 -06:00