Commit Graph

3870 Commits

Author SHA1 Message Date
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
John Kessenich
9e4429f31e Bump revision. 2020-07-02 05:02:17 -06:00
John Kessenich
57002d0447
Merge pull request #2307 from KhronosGroup/location-validation
Location validation, with update to SPIR-V tools validating location
2020-07-01 09:52:18 -06:00
John Kessenich
863ea235bb SPIRV-Tools and tests: Update to location-validation in SPIRV-Tools.
This introduces five new "Validation failures":
- baseResults/hlsl.semantic.vert: issue with gl_ClipDistance/CullDistance
- baseResults/spv.430.vert: issue gl_ClipDistance
- baseResults/spv.450.tesc: still unknown
- baseResults/spv.dataOut.frag: gl_FragData should not be supported, problem with front end
- baseResults/spv.meshShaderPerViewUserDefined.mesh: seems okay, maybe a problem with SPIRV-Tools
2020-07-01 07:18:57 -06:00
John Kessenich
f6facfa189 Tests: More broadly use automapping binding/location.
This adds or changes binding/location decorations in 100s of shaders.
It also allows more output (spv.register.autoassign.rangetest.frag)
due to allowing ioMap() to fail.
2020-07-01 06:40:13 -06:00
John Kessenich
b5cc1465f2
Merge pull request #2306 from ben-clayton/licenses
Add additional licenses in use to LICENSE.txt
2020-07-01 05:38:22 -06:00
Ben Clayton
2962be40ba Add additional licenses in use to LICENSE.txt
Ideally we'd unify the licenses in use by changing the licenses in the file headers to BSD-3-clause.

Until then, let's correctly list all the licenses currently in use.

Issue: #2305
2020-07-01 10:48:27 +01:00
John Kessenich
b112fac003 HLSL: Catch error cases earlier, preventing a later assert.
Related to https://github.com/KhronosGroup/SPIRV-Cross/issues/1414.
The real problem is either using DX10 semantics for DX9 or missing
functionality in DX10 parsing.
2020-07-01 00:53:37 -06:00
John Kessenich
8d3f3b7dac
Merge pull request #2302 from KhronosGroup/fix-texture-precision
SPV: RelaxedPrecision: use the result precision for texture sampling.
2020-06-30 12:41:15 -06:00
John Kessenich
d5b5215a88
Merge pull request #2300 from KhronosGroup/generalize-precision
SPV: RelaxedPrecision: Generalize fix #2293 to cover more operations.
2020-06-30 10:57:16 -06:00
Ben Clayton
d64e859987 glslang: Only export public interface for SOs
Default to `-fvisibility=hidden`, and annotate the public glslang interface with `GLSLANG_EXPORT` to change the visibility of these cherry-picked symbols to default.
This is also used by Windows builds for `__declspec(dllexport)`-ing the public DLL interface.

This allows us to classify API changes into those that are publicly backwards compatible, and those that are not.

Note that `libSPIRV` will likely need similar treatment.

Issues: #2283, #1484
2020-06-30 17:06:17 +01:00
John Kessenich
c858d7bd81
Merge pull request #2301 from ben-clayton/split-libs
CMake: break up glslang into smaller static libs
2020-06-30 10:05:37 -06:00
Ben Clayton
b8c3386ec0 CMake: break up glslang into smaller static libs
Add `GenericCodeGen` and `MachineIndependent` static library targets.
Privately import both of these into the `glslang` target.
Privately import `MachineIndependent` into the  `SPIRV` target.

This is done to break the dependency of `libglslang.so` non-public APIs from `libspirv.so`,
which will become problematic once `glslang` hides its non-public symbols.

| File                      | Before     |     After  |
|---------------------------|-----------:|-----------:|
| `libGenericCodeGen.a`     |  -         |   `527716` |
| `libglslang.a`            | `68175944` |   `512938` |
| `libHLSL.a`               |     `1428` |     `1428` |
| `libMachineIndependent.a` |  -         | `67132202` |
| `libOGLCompiler.a`        |    `75908` |    `75908` |
| `libOSDependent.a`        |    `23768` |    `23768` |
| `libSPIRV.a`              | `15710210` | `15710210` |
| `libSPVRemapper.a`        |  `3250894` |  `3250894` |

| File                                    | Before     |     After  |
|-----------------------------------------|-----------:|-----------:|
| `libglslang-default-resource-limits.so` |   `117032` |   `117032` |
| `libglslang.so`                         | `22380688` | `22368216` |
| `libHLSL.so`                            |     `7520` |     `7520` |
| `libOGLCompiler.a`                      |    `75908` |    `75908` |
| `libOSDependent.a`                      |    `23768` |    `23768` |
| `libSPIRV.so`                           |  `7288336` | `28151016` |
| `libSPVRemapper.so`                     |  `1940208` |  `1940208` |

Issues: #2283, #1484
2020-06-30 14:57:40 +01:00
John Kessenich
8f4251a708
Merge pull request #2297 from ben-clayton/fpic
CMake: Compile with -fPIC when building SOs
2020-06-30 07:55:53 -06:00
John Kessenich
12c155f303 SPV: RelaxedPrecision: use the result precision for texture sampling.
Fix #2298.

The AST has two precisions, an operation precision and a result precision.
Actual use of GLSL with mediump samplers wants the result precision, so
pick that up instead of the operation precision.
2020-06-30 07:52:05 -06:00
John Kessenich
90f1d6ab58
Merge pull request #2296 from ben-clayton/err-unresolved
CMake: Error on unresolved symbols
2020-06-30 05:27:14 -06:00
John Kessenich
435dd8028b SPV: RelaxedPrecision: Generalize fix #2293 to cover more operations.
This simplifies and enforces use of precision in many more places,
to help avoid accidental loss of RelaxedPrecision through intermediate
operations. Known fixes are:
- ?:
- function return values with mis-matched precision
- precision of function return values when a copy was needed to fix types
2020-06-30 02:44:52 -06:00
John Kessenich
dca47063cc
Merge pull request #2295 from ben-clayton/rm-old-kokoro-cfgs
Remove root kokoro/linux-*-cmake configs
2020-06-29 22:07:40 -06:00
John Kessenich
2b6a18bd84
Merge pull request #2292 from proydakov/gcc-unused-parameter
Fixed GCC -Wunused-parameter in hlslParseables.cpp.
2020-06-29 21:54:06 -06:00
Evgeny Proydakov
f6e3446363 Fixed GCC -Wunused-parameter in hlslParseables.cpp.
Warnings before fix:

[3/7] Building CXX object glslang/CMakeFiles/glslang.dir/HLSL/hlslParseables.cpp.o
../glslang/HLSL/hlslParseables.cpp: In function ‘bool {anonymous}::IsValid(const char*, char, char, char, char, int, int)’:
../glslang/HLSL/hlslParseables.cpp:334:45: warning: unused parameter ‘retOrder’ [-Wunused-parameter]
  334 | inline bool IsValid(const char* cname, char retOrder, char retType, char argOrder, char argType, int dim0, int dim1)
      |                                        ~~~~~^~~~~~~~
../glslang/HLSL/hlslParseables.cpp:334:60: warning: unused parameter ‘retType’ [-Wunused-parameter]
  334 | inline bool IsValid(const char* cname, char retOrder, char retType, char argOrder, char argType, int dim0, int dim1)
      |                                                       ~~~~~^~~~~~~
../glslang/HLSL/hlslParseables.cpp:334:89: warning: unused parameter ‘argType’ [-Wunused-parameter]
  334 | inline bool IsValid(const char* cname, char retOrder, char retType, char argOrder, char argType, int dim0, int dim1)
      |                                                                                    ~~~~~^~~~~~~
../glslang/HLSL/hlslParseables.cpp:334:112: warning: unused parameter ‘dim1’ [-Wunused-parameter]
  334 | inline bool IsValid(const char* cname, char retOrder, char retType, char argOrder, char argType, int dim0, int dim1)
      |                                                                                                            ~~~~^~~~
2020-06-29 17:07:34 +03:00
Ben Clayton
981e127698 CMake: Compile with -fPIC when building SOs
Without this embedding static libraries into shared libraries may result in link time errors.

Issue: #2283
2020-06-29 14:57:47 +01:00
Ben Clayton
1fee6072d0 CMake: Error on unresolved symbols
Issue: #1484
2020-06-29 14:57:12 +01:00
Ben Clayton
08bc7cf5fc Remove root kokoro/linux-*-cmake configs
These have been superseded by the `static` and `shared` variants in the respective subdirectories.

Issue: #2283
2020-06-29 14:52:54 +01:00
John Kessenich
27e915ed4f
Merge pull request #2286 from ben-clayton/kokoro-static-shared
Kokoro: Split linux cmake cfgs into static/shared
2020-06-28 22:44:29 -06:00
John Kessenich
be06c6f282
Merge pull request #2294 from KhronosGroup/fix-arg-precision
Fix #2293: Get correct RelaxedPrecision settings for various ways of passing arguments to formal parameters.
2020-06-28 05:10:54 -06:00
John Kessenich
bf6efd0316 SPV: Fix #2293: keep relaxed precision on arg passed to relaxed param
When arguments are copied to make space for a writable formal parameter,
and the formal parameter is relaxed precision, make the copy also
relaxed precision.
2020-06-26 09:05:31 -06:00
John Kessenich
4df10335e6 SPV: Partially address #2293: correct "const in" precision matching.
Track whether formal parameters declare reduced precision and match
that with arguments, and if they differ, make a copy to promote the
precision.
2020-06-26 08:37:06 -06:00
lriki
1ee750aed5 Add pack_matrix test 2020-06-25 17:54:16 +09:00
lriki
3cae3c4da8 HLSL: Fix #pragma pack_matrix(row_major) not work on global uniforms 2020-06-25 16:10:00 +09:00
Ben Clayton
40e1ae11f4 Kokoro: Split linux cmake cfgs into static/shared
Allows for testing of generation of both static libraries and shared objects.

The old configs are staying in place until I'm confident everything is working correctly.

Issues: #1421, #1484, #2283
2020-06-24 14:16:17 +01:00
John Kessenich
fbb9dc2cf1
Merge pull request #2285 from proydakov/msvc-rtti-compilation-warning-fix
Fixed msvc 2019 nmake compiler warnings with RTTI.
2020-06-24 02:53:45 -06:00
Evgeny Proydakov
b90adef928 Fixed msvc 2019 nmake compiler warnings with RTTI.
By default cmake generates cxx_flags with `/GR` parameter.
I updated CMAKE_CXX_FLAGS string and replaced `/GR` -> `/GR-`

How to reproduce:

Visual Studio 2019 x64 command port

mkdir build-msvc2019
cd build-msvc2019
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=install ..
nmake

COMPILATION BEFORE:

Scanning dependencies of target OSDependent
[  1%] Building CXX object glslang/OSDependent/Windows/CMakeFiles/OSDependent.dir/ossource.cpp.obj
cl : Command line warning D9025 : overriding '/GR' with '/GR-'
ossource.cpp
[  3%] Linking CXX static library OSDependent.lib
[  3%] Built target OSDependent
Scanning dependencies of target OGLCompiler
[  4%] Building CXX object OGLCompilersDLL/CMakeFiles/OGLCompiler.dir/InitializeDll.cpp.obj
cl : Command line warning D9025 : overriding '/GR' with '/GR-'
InitializeDll.cpp
[  6%] Linking CXX static library OGLCompiler.lib
[  6%] Built target OGLCompiler
Scanning dependencies of target glslang
[  7%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/glslang_tab.cpp.obj
cl : Command line warning D9025 : overriding '/GR' with '/GR-'
glslang_tab.cpp
[  9%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/attribute.cpp.obj
cl : Command line warning D9025 : overriding '/GR' with '/GR-'

FLAGS BEFORE:

-- CMAKE_C_FLAGS:   /DWIN32 /D_WINDOWS /W3
-- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR /EHsc
-- CMAKE_CXX_FLAGS_DEBUG:   /MDd /Zi /Ob0 /Od /RTC1
-- CMAKE_CXX_FLAGS_RELEASE: /MD /O2 /Ob2 /DNDEBUG

COMPILATION AFTER:

[  1%] Building CXX object glslang/OSDependent/Windows/CMakeFiles/OSDependent.dir/ossource.cpp.obj
ossource.cpp
[  3%] Linking CXX static library OSDependent.lib
[  3%] Built target OSDependent
[  4%] Building CXX object OGLCompilersDLL/CMakeFiles/OGLCompiler.dir/InitializeDll.cpp.obj
InitializeDll.cpp
[  6%] Linking CXX static library OGLCompiler.lib
[  6%] Built target OGLCompiler
[  7%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/glslang_tab.cpp.obj
glslang_tab.cpp
[  9%] Building CXX object glslang/CMakeFiles/glslang.dir/MachineIndependent/attribute.cpp.obj

FLAGS AFTER:

-- CMAKE_C_FLAGS:   /DWIN32 /D_WINDOWS /W3
-- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR- /EHsc
-- CMAKE_CXX_FLAGS_DEBUG:   /MDd /Zi /Ob0 /Od /RTC1
-- CMAKE_CXX_FLAGS_RELEASE: /MD /O2 /Ob2 /DNDEBUG
2020-06-23 22:02:34 +03:00