3843 Commits

Author SHA1 Message Date
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
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
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
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
John Kessenich
8397044502
Merge pull request #2260 from gnl21/not-equal
Use OpFUnordNotEqual for floating-point !=
2020-06-22 05:35:20 -06:00
Graeme Leese
182ab460d9 Update test expected files with new magic number
Updating the SPIR-V generator version number changes the output of all
the SPIR-V tests.
2020-06-22 11:49:38 +01:00
Graeme Leese
060882fd37 Update SPIR-V generator version
Change to 10 to reflect the change to generating unordered !=
operations.
2020-06-22 11:03:46 +01:00
Graeme Leese
ff4b156e91 Update test results to expect OpFUnordNotEqual 2020-06-22 10:59:34 +01:00
Graeme Leese
65ce566cbc Use OpFUnordNotEqual for floating-point !=
The normal IEEE not equal operation tests whether operands are unordered
or not equal (so comparison with a NaN returns true). This corresponds
to the SPIR-V OpFUnordNotEqual, so change to using that.
2020-06-22 10:59:33 +01:00
John Kessenich
adacba3ee9
Update README.md 2020-06-22 01:44:53 -06:00
John Kessenich
b97d7669bc
Merge pull request #2278 from ShabbyX/master
Add -g0 command line argument
2020-06-22 01:08:52 -06:00
John Kessenich
e20ac35adb
Merge pull request #2281 from ben-clayton/moar-kokoro
Add more Kokoro configurations
2020-06-19 09:43:49 -06:00
Ben Clayton
b2a4399dcc Add kokoro configs for android-ndk and cmake 2020-06-19 15:34:31 +01:00
Ben Clayton
ca17b723fb Switch ndk_test from gnustl_static to c++_static
gnustl_static is no longer supported.
2020-06-19 12:35:57 +01:00
Shahbaz Youssefi
d52dce5067
Add -g0 command line argument
Analogous to gcc, -g0 would strip all debug info.  This is done
regardless of whether optimizations are enabled.

Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
2020-06-18 10:16:40 -04:00
John Kessenich
051c6fed88 Build: use better MSVC subfolder names for the previous build changes. 2020-06-16 07:47:48 -06:00
John Kessenich
b247cfcd59
Merge pull request #2275 from ben-clayton/mv-hlsl
Move hlsl/ source to glslang/HLSL/
2020-06-16 06:26:17 -06:00
John Kessenich
abd91adf9d Bump version numbers. 2020-06-16 06:22:56 -06: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
John Kessenich
4928d556e6
Merge pull request #2271 from ben-clayton/fold-hlsl
Untangle build target cyclic dependencies (approach #2)
2020-06-16 04:20:32 -06:00
John Kessenich
bd392c639e Bump version. 2020-06-16 04:18:48 -06:00
Ben Clayton
dcad9ad056 CMake: Fold HLSL source into glslang
... and stub the HLSL target.

Fixes the building of shared libraries.

This breaks the cyclic dependency between the `glslang` and `hlsl` targets (by essentially removing the `hlsl` target).

The `BUILD.gn` and `BUILD.bazel` build rules already pull the `HLSL` source into the `glslang` target.

`Android.mk` is the only remaining build config that has a dedicated `HLSL` target, but this is explicity static and does not suffer the same link-time issues with the cyclic dependency (we may wish to stub this target too).

Related issue: #1484, #2147
Related PR: #2267
2020-06-16 10:46:06 +01:00
dan sinclair
00965b9fa9
Remove unused variable. (#2273)
The `isMat` variable is no longer used in the HLSL parser. Removed.
2020-06-15 12:10:44 -06:00
Ryan Harrison
8496b782fb
Remove unused function, BaseTypeName (#2272) 2020-06-15 10:58:02 -06:00
John Kessenich
a58978ac9a HLSL: Remove support for having GLSL versions of HLSL intrinsics.
Related to PR #2265.
2020-06-15 10:28:09 -06:00
rdb
ebf55a0711
HLSL: Fix incorrect case in name of DX9-style cube sampler type (#2265) 2020-06-15 06:39:43 -06:00
Ben Clayton
1a6c8ecb20 C Interface: Split SPIR-V C interface to own file
This breaks a cyclic dependency between the SPIRV and glslang build targets.
2020-06-15 13:22:19 +01:00
Ben Clayton
b919bc889e
Fix signed / unsigned mismatch warning (#2266) 2020-06-10 21:41:47 -06:00
John Kessenich
3641ff7378 Bump code gen version, due to removal of OpEntryPoint operands. 2020-06-10 07:40:56 -06:00
John Kessenich
c30d335377 Fix #2264: OpEntryPoint incorrectly including function parameters. 2020-06-10 07:17:11 -06:00
Ryan Harrison
68b2e15ee0
Use correct type for var storing returned value (#2263) 2020-06-09 10:01:43 -06:00