Commit Graph

977 Commits

Author SHA1 Message Date
Bas Nieuwenhuizen
c9ffeec6e3 SPV: Add NonUniform decoration for constructors.
This is missing in particular for OpSampledImage, which can be
a direct argument for texture operations.
2020-09-10 23:02:54 +02:00
Bas Nieuwenhuizen
58064311be SPV: Add NonUniform decoration for OpImages created during lowering.
By directly creating the OpImage instructions we were not propagating
the appropriate decorations.

Since this had a lot of cases I centralized the OpImage creation
a bit too.
2020-09-10 23:02:54 +02:00
Bas Nieuwenhuizen
de949a2afc SPV: Add NonUniform decorations for stores.
The direct pointer argument to stores has to use
the NonUniform decoration but we were not using
qualifiers at all to decorate the NonUniform pointer.

(Test fixes by Greg Fischer <greg@lunarg.com>)
2020-09-10 23:02:29 +02:00
Rex Xu
2d66614c0a SPIRV: Fix some disassembly issues
- OpExecutionModeId is not supported in disassembly.
- Some execution modes are missing in disassembled strings.
2020-09-07 11:09:21 +08:00
John Kessenich
8f0c6bd773
Merge pull request #2369 from ezdiy/c_api_export
GLSLANG_EXPORT for C APIs.
2020-08-17 03:02:44 -06:00
johnkslang
01384725c2 Fix #2366, fix #2358, correctly separate out numerical feature checking
We need separate concepts for
 - total set of extensions ever enabled, for the back end
 - current state of extensions, for parsing
 - the set of features currently enabled for building the AST
2020-08-14 08:40:06 -06:00
Ez Diy
1fde85ab96 GLSLANG_EXPORT for C APIs.
Fixes FFI breakage introduced in #2283
2020-08-10 22:26:41 +02:00
johnkslang
a1a497ffe7 SPV: Use more correct SPV-Tools environment, partially addressing #2290 2020-08-04 03:00:32 -06:00
johnkslang
f881f08358 SPV: Fix #2363: include trailing newline named text SPV output. 2020-08-04 02:13:50 -06:00
John Kessenich
5743eed4d1
Merge pull request #2362 from ShabbyX/optimize_for_angle
Use GLSLANG_ANGLE to strip features to what ANGLE requires
2020-08-03 01:28:52 -06: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
Ben Clayton
2a44064885 Revert changes that migrate to thread_local.
iOS 8 does not support `thread_local`, which is still in use.
Another approach will have to be found.

This change is a revert of the following changes:

a3845240 - "Simplify PoolAlloc with use of thread_local."
abf92c80 - "Deprecate InitializeDll functions"
33585c87 - "Limit visibility of symbols for internal libraries"

Issue: #2346
2020-07-31 07:13:24 +01:00
John Kessenich
7923b3e3d9
Merge pull request #2353 from vkushwaha-nv/SPV_EXT_shader_atomic_float
Add changes for SPV_EXT_shader_atomic_float_add
2020-07-22 22:06:01 +07:00
Vikram Kushwaha
79b93923d2 Add changes for SPV_EXT_shader_atomic_float_add 2020-07-22 05:52:22 -07:00
Ben Clayton
33585c871d Limit visibility of symbols for internal libraries
Also remove `SPIRV/doc.cpp` from the `SPVRemapper` target as this
is part of `SPIRV`, causing ODR violations. Instead have
`SPVRemapper` link against `SPIRV`.

Fixes ODR violations.
2020-07-22 10:53:50 +01:00
johnkslang
c63502cf67 SPV: Update to the latest SPIR-V headers. 2020-07-21 21:05:25 -06:00
John Kessenich
f80ef74c80 Fix recently found non-determinism with gl_WorldToObject3x4EXT. 2020-07-14 01:44:35 -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
1ee5d1c0bb
Merge pull request #2330 from ShabbyX/optimize_for_angle
Optimize for angle
2020-07-12 00:32:52 +07: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
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
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
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
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
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
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
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
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
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
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
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
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
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
Alejandro Piñeiro
ff6dcca575
spirv: Support initializers on uniforms (#1588)
If a uniform has an initializer it will now be given as the optional
initializer operand to the OpVariable instruction.

Fixes: https://github.com/KhronosGroup/glslang/issues/1259

Signed-off-by: Neil Roberts <nroberts@igalia.com> (the code)
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com> (the tests)
Signed-off-by: Arcady Goldmints-Orlov <agoldmints@igalia.com>

Co-authored-by: Neil Roberts <nroberts@igalia.com>
2020-06-04 01:39:31 -06:00
Ricardo Garcia
232ba0d848
Add SPIR-V capabilities needed for spec constants (#2199)
Fixes #2198.
2020-06-03 07:52:55 -06:00
rdb
d8edfd8e66
HLSL: fix handling of uniform qualifier in entry point parameters (#2254)
* HLSL: Fix handling of uniforms in entry point parameters

* HLSL: fix handling of "uniform in"

* Tests: Update baseResults of hlsl.function.frag.out for #2254

* HLSL: fix uniforms in function parameters for opaque types
2020-06-02 00:30:07 -06:00
alelenv
999d4fdcdd
Add default descriptorset decoration for acceleration structure (#2257)
variables.
2020-06-02 00:24:41 -06:00
dan sinclair
f15982ebeb
Remove install to the SPIRV/ folder. (#2256)
This CL updates the build scripts to only install to glslang/SPIRV
instead of also installing to the SPIRV/ folder. The deprecation notice
is also removed.

Note, this may cause downstream build issues if include directories have
not been updated

Fixes #1964 #2216
2020-06-01 23:21:03 -06:00
alelenv
59216d5cd8
Add support for primitive culling layout qualifier. (#2220)
* Add support for primitive culling layout qualifier.

* Add error checks for primitive flags and negative test.
2020-05-21 05:38:41 -06:00
Pankaj Mistry
2a8ead2109 Add support for extension GL_EXT_shader_implicit_conversions
Updated extension management in TIntermediate class.
2020-04-30 08:41:23 -07:00
John Kessenich
bcf6a2430e Move to SPIR-V 1.5 Rev. 3, bump revision, remove a status from README. 2020-04-27 02:12:05 -06:00
John Kessenich
52d34b4c65 Move to latest SPIR-V header, and bump glslang revision. 2020-04-24 08:46:32 -06:00
Cody Northrop
4d2298bfd7
Support multiple swizzled out operands (#2175)
Swizzled out operands were added in bbbd9a2a. This was sufficient
for most tests, but we ran into problems with umulExtended and
imulExtended, which have two.

This CL converts the tracking values to vectors so multiple operands
can be supported.

Test: KHR-GLES31.core.shader_bitfield_operation.*
Test: ctest
2020-04-13 21:59:49 -06:00
alelenv
75de196cec
Add support for EXT_ray_flags_primitive_culling. (#2173)
Fixes issue #2169.
2020-04-08 22:09:20 -06:00
John Kessenich
1fff362355 Build warning: Fix #2167: Remove nested reuse of 'unreachable'. 2020-04-01 00:46:57 -06:00
ntfs.hard
7fc409eecc bitwise on boolean 2020-03-30 01:32:23 +03:00
Neslisah Torosdagli
054b5e35eb pass by reference updates 2020-03-26 12:24:31 -04:00
Neslisah Torosdagli
7d37a68ad7 pass-by-reference updates 2020-03-26 11:08:28 -04:00
John Kessenich
8e26c5f50e
Merge pull request #2139 from neslimsah/master
GL_EXT_ray_query updates
2020-03-25 08:18:33 -06:00
Neslisah Torosdagli
cea9384b6b switch format update 2020-03-25 08:13:32 -04:00
Neslisah Torosdagli
ea98c46c2b spirv.hpp reverted to commit f368dcbb7d 2020-03-24 12:02:20 -04: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
Neslisah Torosdagli
7d122c96a4 Merge branch 'master' of https://github.com/neslimsah/glslang 2020-03-20 18:35:57 -04:00
Neslisah Torosdagli
50a722818b GL_EXT_ray_query glslang updates, and test cases added. 2020-03-20 18:23:27 -04:00
Torosdagli
06c2eee720 GL_EXT_ray_query updates 2020-03-19 16:46:30 -04:00
Torosdagli
74d6d6a208 GL_EXT_ray_query updates 2020-03-19 11:09:57 -04:00
Daniel Koch
db32b243ff Add support for GLSL_EXT_ray_tracing
and SPV_KHR_ray_tracing
2020-03-17 20:42:47 -04:00
John Kessenich
f368dcbb7d SPV headers: Bump up to the latest header.
This contains the base for ray tracing extensions.
2020-03-17 08:00:41 -06:00
Ryan Harrison
56a7e02056
Use strcmp for all of the extended instruction set checks in the disassembler (#2107)
Fixes #2106

* Convert memcmps to strcmps
2020-03-11 01:00:13 -06:00
Jeff Bolz
b57af2f5ad Decorate accesschain operand for nonuniform UBO loads
This is conservative and still also decorates the loaded value.
2020-03-09 14:09:41 -05:00
Jeff Bolz
39ffdaf2ab Allow nonuniformEXT() on sampler types.
Also add missing NonUniformEXT decoration on OpImageTexelPointer.
2020-03-09 10:48:12 -05:00
Jeff Bolz
04d73731de GL_EXT_debug_printf implementation 2020-03-05 13:41:34 -06:00
John Kessenich
8985fc9108 Fix long lines in the SPIR-V generator, retrigger bots. 2020-03-03 10:25:07 -07:00
John Kessenich
bbbd9a2a1f Fix #1843: Handle built-in function output parameters to a swizzled arg
In GLSL/HLSL/AST,  v.zyx is an l-value, but not in SPIR-V, which cannot represent it.
So, a temporary is used instead.
2020-03-03 07:21:37 -07:00
John Kessenich
56364b6b60 Copyright update, mostly to trigger bots again. 2020-03-01 04:51:40 -07:00
John Kessenich
9606a5cb99 Fix #1461: set the SPIRV-Tools' optimizer's target environment. 2020-02-28 07:10:59 -07:00
Rex Xu
fb18b6df28 Fix an issue of SPV generation for imageAtomicStore.
For GLSL function imageAtomicStore, it will be translated to
OpImageTexelPointer + OpAtomicStore. The result type of
OpImageTexelPointer must be the same as the sampled type of OpTypeImage.
On translation, the result type is mistakenly fetched from operand list
operands[2] while operands[2] corresponds to sampleNum whose type is
always uint. This leads to an error if the image type is iimageXXX that is
int image.
2020-02-22 22:04:31 +08:00
John Kessenich
d5f2f7b93d
Merge pull request #1940 from tsuoranta/fix-gcc9
Fix for GCC 9 / Werror=deprecated-copy
2020-01-27 01:02:08 -07:00
John Kessenich
c3bb5d6914 Update to latest SPIRV-Tools, supporting Vulkan 1.2. 2020-01-15 09:35:48 -07:00
John Kessenich
273d3a5093 SPV/Vulkan: Add support for Vulkan 1.2, which defaults to SPIR-V 1.5. 2020-01-15 00:10:41 -07:00
Roy
05a5b53208 Fix glslang can't link multiple AST in a single stage
Root cause:
GlslangToSpv use symbol structure's ptr as a map key, but multiple shader object can build a new AST.
In the AST the the same symbol has different ptr point to their structure, so indext map faild.

solution:
Add a new map glslangTypeToIdMap to map ptr to symbol id, and use symbol id to index memberRemapper.
2020-01-03 16:30:37 +08:00
John Kessenich
5de15a256e HLSL: Fix #2037: Integer dot used incorrect input for adds. 2019-12-26 10:56:54 -07:00
John Kessenich
b5d9dee710 Fix #2007: Fix a couple relative header paths in header files. 2019-12-09 03:12:10 -07:00
Ian Romanick
b3bd402c7c INTEL_shader_integer_functions2: Add SPIR-V generation
v2: Move addCapability and addExtension extension calls from
TGlslangToSpvTraverser::createBinaryOperation to
TGlslangToSpvTraverser::visitAggregate.  Suggested by JohnK.
2019-12-03 11:06:41 -08:00
John Kessenich
e01c847a70 Merge branch 'dj2-install' 2019-11-22 06:24:38 -07:00
Dan Sinclair
04567eb232 Check for ENABLE_SPVREMAPPER flag in CMakeList files.
There is a flag to disable the SPVRemapper during the GLSLang build.
That flag is check in some, but not all spots so if you try to build
with SPVRemapper disabled you get CMake errors and compile errors.

This CL fixs up the build so building with -DENABLE_SPVREMAPPER=0 will
complete correclty.
2019-11-21 10:33:32 -05:00
Arfrever Frehtes Taifersar Arahesis
bd69a4fb12 Respect CMAKE_INSTALL_LIBDIR in installed CMake files
Fixes #1965
2019-11-18 11:11:55 -08:00
David Neto
e43e8ba9f3 SPIR-V postprocessing: WEB case only needs CFG mods
The SPIR-V post-processing to discover capabilities and
extensions does not apply to WebGPU compilation.  So don't include
that code.

This reclaims some of the code space added by #1943
2019-11-07 17:55:22 -05:00
John Kessenich
199d115e15 Fix #1959 by reverting 7b0e236 to put files in two places. 2019-11-05 18:05:42 -07:00
Ryan Harrison
0552c0acc8 Remove std::move that is breaking chromium roll
This is causing the following error:

moving a temporary object prevents copy elision
[-Werror,-Wpessimizing-move]
2019-11-04 16:23:11 -05:00
John Kessenich
31c3370d83 Bump up the generator version, which is exposed in SPV test results. 2019-11-02 21:26:40 -06:00
David Neto
8c3d5b4b6c SPIR-V: Aggressively prune unreachable merge, continue target
More aggressively prune unreachable code as follows.
When no control flow edges reach a merge block or continue target:
- delete their contents so that:
  - a merge block becomes OpLabel, then OpUnreachable
  - a continue target becomes OpLabel, then an OpBranch back to the
    loop header
- any basic block which is dominated by such a merge block or continue
  target is removed as well.
- decorations targeting the removed instructions are removed.

Enables the SPIR-V builder post-processing step the GLSLANG_WEB case.
2019-10-29 15:33:54 -04:00
Greg Fischer
b44dac1968 Update spirv-tools known good. 2019-10-24 10:37:01 -06:00
John Kessenich
f8d1d7442b Web: Reclaim more space and make all work w/wo GLSLANG_WEB. 2019-10-23 03:15:55 -06:00
John Kessenich
e5eee8fb03 Web: Add basic atomics for SSBOs. 2019-10-23 00:25:39 -06:00
John Kessenich
3dd1ce5b54 Web: Add SSBOs and a few other missing compute features. 2019-10-23 00:25:39 -06:00
John Kessenich
51ed01c877 Web: Add compute stage. 2019-10-23 00:25:39 -06:00
Timo Suoranta
f0a85fc744 Fixes for gcc 9 / -Werror=deprecated-copy
Also enable -Werror-deprecated-copy for GCC version 9 and later.
2019-10-19 15:36:34 +03:00
Jeff Bolz
016ddee83a Only apply volatile semantics to atomics when using Vulkan Memory Model 2019-10-17 11:22:57 -05:00
John Kessenich
b03e4fc4e0
Merge pull request #1866 from rumblehhh/master
Export glslang targets on installation
2019-10-15 04:25:20 -06: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
John Kessenich
ee8e9c1522 Fix #1924: Promote SPV_EXT_physical_storage_buffer to KHR when required.
If the semantics that require the KHR form over the EXT form are seen
(OpBitcast between a vector and a pointer) promote the requested extension
from the EXT to the KHR.
2019-10-10 20:54:21 -06:00
John Kessenich
1ff0c181bb Fix #1924: Emit SPV_EXT_physical_storage_buffer, not the KHR form.
The KHR form comes along as part of 1.5, and otherwise should require
another form of request to emit it.
2019-10-10 12:01:13 -06:00
dan sinclair
78ba2510b8 single line 2019-10-06 10:00:37 -04:00
dan sinclair
7b0e236325 Move install directory for SPIRV/ folder.
Currently the SPIRV/ folder will get installed into the include
directory. This folder is part of GLSLang, so it makes more sense under
glslang/SPIRV.

Currently, GLSLang will install a SPIRV/ folder while spirv-headers will
install a spirv/ folder. This is confusing and will cause issues on a
case sensitive filesystem if both are installed at the same time.
2019-10-03 19:35:44 -04:00
John Kessenich
90e402f42b SPV_KHR_physical_storage_buffer/SPV: Add GL_EXT_buffer_reference_uvec2
Adds uvec2 <-> reference constructor support.
Switches from EXT to KHR for physical_storage_buffer.
2019-09-18 23:52:36 -06:00
John Kessenich
e4e56bcf86
Merge pull request #1902 from jeffbolznv/extended_types
Add GL_EXT_shader_subgroup_extended_types support
2019-09-17 23:18:20 -06:00
Jeff Bolz
c5b669e04c Add GL_EXT_shader_subgroup_extended_types support 2019-09-17 23:44:27 -05:00
John Kessenich
8317e6c683 SPV: Support SPIR-V 1.5; five extensions no longer need OpExtension.
The generalization to addIncorporatedExtension() also fixed a 1.3
corner case with SPV_KHR_16bit_storage.
2019-09-16 07:14:10 -06:00
John Kessenich
aaff6cddd0 SPV 1.5: Switch to the 1.5 header, for SPIR-V 1.5. 2019-09-13 09:32:00 -06:00
Jeff Bolz
387657e4cf GL_NV_integer_cooperative_matrix support 2019-08-22 20:37:59 -05:00
John Kessenich
deec1933e9 Web: Turn off includes, independent preprocessing path, fine tune all.
Saved about 21K, size down to 380K of MSVC x86 code.
Fixed one bug that needs to be looked at on the master branch:
The test for needing a Vulkan binding has a bug in it, "!layoutAttachment"
which does not mean "no layoutAttachment", because that is non-zero.
This is why some test and test results changed.
2019-08-20 23:21:56 -06:00
John Kessenich
b9197c812e Web: Make switched methods all be non-virtual, more web-dependent code,
added a few more HLSL flag tests.  This was mostly focused on the SPV generator.
Saves about 17K.
2019-08-20 23:21:56 -06:00
John Kessenich
fb4f2333da Web: Use isEsProfile() instead of run-time testing; remove more atomics
Saves 2.5K, and design is better.
2019-08-20 23:21:56 -06:00
John Kessenich
155d351f86 Web: Remove unused stage functionality, SPIR-V logger, and hex_utils
Saves another 20K.
2019-08-20 23:21:56 -06:00
John Kessenich
39697cdb9d Web: Remove unnecessary GLSL numeric types, and some collateral.
This saves another 40K of x86 binary, which is about 13% of the target size.
2019-08-20 23:21:56 -06:00
John Kessenich
3e4b6ff76a Web: Tighten up sampling code and interfaces.
Saves about 9K.
2019-08-20 23:21:56 -06:00
John Kessenich
eaf4496312 Web: Complete the removal of vendor-specific #ifdef's, including CMake. 2019-08-20 23:21:56 -06:00
John Kessenich
a28f7a75d1 Web: Generalize _EXTENSIONS* in SPIR-V back-end.
About 50 fewer #ifdefs.
About 14K smaller.
Note, the base size is ill-defined due to optimizer settings (size vs. performance),
compression, and target architecture.  Some recent %'s are accidentally reported as
3X the real savings.  Early %'s were accurate.  What matters though is that each
step got worthwhile gains, and what the final size ends up being.
2019-08-20 23:21:55 -06:00
John Kessenich
7015bd658e Web: Remove/rationalize a set of *_EXTENSIONS, using GLSLANG_WEB.
Focus was on the front end (not SPIR-V), minus the grammar.
Reduces #ifdef count by around 320 and makes the web build 270K smaller,
which is about 90% the  target size.

The grammar and scanner will be another step, as will the SPIR-V backend.
This makes heavy use of methods #ifdef'd to return false as a global way
of turning off code, relying on C++ DCE to do the rest.
2019-08-20 23:21:55 -06:00
John Kessenich
23d27751e8 Web: Selectively remove a few key features, using #ifndef GLSLANG_WEB
Save about 100K.

N.B.: This is done by eliminating a function call, at a high level,
not by #ifdef'ing a bunch of code.

Also, removed no longer needed *_EXTENSION #ifdef in the code not
needed by GLSLANG_WEB.
2019-08-20 23:21:55 -06:00
James Rumble
c6f7294ced
Handle install vs build include directories
Fix target_include_directories to appropriately handle build-tree and the install-tree.
2019-08-06 15:29:31 +01:00
James Rumble
ab6d1499e1
Export glslang targets on installation
This allows the targets to be used in other cmake projects. See the following for more details:
https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#creating-packages
https://foonathan.net/blog/2016/07/07/cmake-dependency-handling.html
2019-08-06 14:47:51 +01:00
John Kessenich
3cea2e5882 Bump revision and give the bots another chance to work. 2019-08-02 06:34:15 -06:00
John Kessenich
7fc8683491
Merge pull request #1813 from jeffbolznv/compositeconstruct
Handle SPIR-V type mismatch when constructing a composite
2019-07-28 23:20:26 -06:00
Ashwin Lele
c1e61d6cff Fix bugs in missing Builtin decoration for some NV builtins for tessellation
control shaders.
Fix bug in member remapping.
2019-07-22 12:36:38 -07:00
John Kessenich
2bb2da9193 SPV: Update to latest SPIR-V header. 2019-07-22 07:06:50 -06:00
Rex Xu
bb7307b4a8 OpIsHelperInvocationEXT should declare relevant SPV extension and capability 2019-07-15 14:57:20 +08:00
Jason Macnak
dbd4c3ce11 spirv: Generate missing SampleMaskOverrideCoverageNV capability op
The SampleMaskOverrideCoverageNV capability should be declared when
gl_SampleMask is used.
2019-07-12 14:33:02 -07:00
amhagan
91fb0091a2 Add support for SPV_KHR_shader_clock 2019-07-10 21:34:12 -04:00
Jeff Bolz
6a50a7850d update spirv-headers to pick up demote_to_helper_invocation 2019-07-02 10:58:15 -05:00
Jeff Bolz
ba6170b534 Implement GL_EXT_demote_to_helper_invocation 2019-07-01 09:36:15 -05:00
Jeff Bolz
531344905f Handle SPIR-V type mismatch when constructing a composite 2019-06-25 13:32:35 -05:00
Shahbaz Youssefi
6cca0e983e Remove extraneous semicolons
They cause a warning (-Wextra-semi) that can lead to a compile error
(-Werror).
2019-06-25 13:20:16 -04:00
John Kessenich
9c14f77f5d AST/SPV: Fix #930: translate uvec4 <-> uint64 for SubgroupGeMask et. al.
On reading built-in variables SubgroupEqMask, SubgroupGeMask, SubgroupGtMask,
SubgroupLeMask, and SubgroupLtMask, the AST expects 64-bit ints, while SPIR-V
is defined as vectors of 32-bit ints.

The declaration type has to be translated in the opposite direction.
2019-06-18 00:36:17 -06:00
John Kessenich
a9b00ac5d5
Merge pull request #1806 from KhronosGroup/nan-clamp
SPV: Add a switch for favoring non-NaN operands in min, max, and clamp.
2019-06-18 00:26:25 -06:00
John Kessenich
5d73a3c95c
Merge pull request #1698 from jeffbolznv/private_storage_variables
Add Float16/Int8/Int16 capabilities for private variables and function parameters
2019-06-17 23:42:13 -06:00
John Kessenich
605afc7b1b SPV: Add a switch for favoring non-NaN operands in min, max, and clamp. 2019-06-17 23:33:09 -06:00
Jeff Bolz
38a52fca93 Add gl_SemanticsVolatile to GL_KHR_memory_scope_semantics, and make volatile-qualified atomics generate MemorySemanticsVolatile when using the Vulkan memory model 2019-06-14 09:57:01 -05:00
Daniel Koch
2cb2f197a7 Add support for GL_NV_shader_sm_builtins
Including spirv and AST tests

Also increase size of TBuiltInVariable bitfields since we've now exceeded 127
and add a static_assert to make this easier to find next time it happens!
2019-06-08 08:53:11 -04:00
Jeff Bolz
fd556e32b3 Use spvValidatorOptionsSetBeforeHlslLegalization for pre-legalized HLSL 2019-06-07 14:42:08 -05:00
Jeff Bolz
c6f0ce8dbc Support GL_ARB_fragment_shader_interlock 2019-06-03 11:55:25 -05:00
Daniel Koch
593a4e0aa5 Fix subgroup support for ray tracing
Closes #1735

GlslangToSpv.cpp
- minor formatting cleanup

BaseTypes.h
- minor formatting cleanup
- add subgroup builtins to GetBuiltInVariableString
  (was resulting in "unknown built-in variable" messages in test output)

Initialize.cpp
- better naming and re-use of strings for subgroup builtin variable declarations
- define subgroup builtin variables in ray-tracing shaders

intermOut.cpp
- add handling of the EOpSubgroupParition* variables
  (was resulting in "ERROR: Bad aggregation op" messages in test output)

Update test results.
2019-05-31 14:17:36 -04:00
Daniel Koch
9bb17cd0eb Return consistent names from CapabilityString
Don't prefix with "Capability" since the majority of them don't.
Also add missing CapabilityImageFootprintNV
2019-05-28 15:23:10 -04:00
Matthew Albrecht
cda52d5333 Fixed .dll install on MSVC. 2019-05-23 19:06:44 -05:00
John Kessenich
6e384fef6c Build: Fix 3 warnings. 2019-05-10 06:47:00 -06:00
John Kessenich
b64952eddd SPV 1.4: Move to 1.4 validation, removing all 1.4 validation failures. 2019-05-10 00:02:45 -06:00
John Kessenich
f43c739ac5 SPV 1.4: Emit SignExtend and ZeroExtend for integer image reads/writes. 2019-05-10 00:02:45 -06:00
John Kessenich
61a5ce190a SPV 1.4: Lookup tables: Use variable initializer and NonWritable...
...when doing a variable lookup on an array of constants.
2019-05-10 00:02:45 -06:00
John Kessenich
fbb6bdf046 SPV 1.4: Add support for OpCopyLogical, careful of Boolean differences. 2019-05-10 00:02:45 -06:00
John Kessenich
1f4d04687b SPV 1.4: Implement the 5 new loop controls. 2019-05-10 00:02:45 -06:00
John Kessenich
0c1e71a123 SPV 1.4: Use OpSelect for trivial typed non-scalar/vector expressions. 2019-05-10 00:02:45 -06:00
John Kessenich
7c7731ecbb SPV 1.4: Generate all globals on OpEntryPoint interface list. 2019-05-10 00:02:45 -06:00
John Kessenich
2dd4ab3a4a SPV: Move to the SPIR-V 1.4 header. 2019-05-09 23:59:37 -06:00
Jeff Bolz
88220d507e For nonuniformEXT constructor, make a copy of the node to decorate 2019-05-08 10:24:46 -05:00
Jeff Bolz
faac86e5d6 If a shader's only use of float16 is for FConvert, add the Float16 capability.
When visiting instructions, check that there are no 16-bit storage capabilities
and add the Float16 capability. Same for int8/int16.
2019-05-01 11:45:51 -05:00
John Kessenich
3416d48b59 Update to latest SPIR-V header and bump revision. 2019-04-04 09:38:26 -06:00
Daniel Koch
8b2f96d3fe Check if _MSC_VER is defined before using.
Fixes compilation errors on some platforms.
2019-04-03 17:21:06 -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
Panagiotis Christopoulos Charitos
35aeb042a2 Avoid running the validator as part of the optimization pass.
The spvtools::Optimizer::Run method glslang is using constructs a default set
of spvtools::OptimizerOptions. This default set of options instructs the
validator to run. That is not quite correct since glslang will invoke the
validator _explicitly_ after the optimization pass.

Change-Id: I30f458304c6e7f81e89fc4ebd25eabbbd8348063
2019-03-18 11:34:17 +01:00
John Kessenich
b184e41a06 Build: Update to the most recent SPIR-V headers, for Rev. 7 of SPV 1.3 2019-03-17 22:29:25 -06:00
John Kessenich
40c16ec0b3
Merge pull request #1717 from jeffbolznv/getBufferReferenceAlignment
Move getBufferReferenceAlignment to be a method of TType
2019-03-07 11:05:08 +07:00
Jeff Bolz
7895e473c3 Move getBufferReferenceAlignment to be a method of TType
This is a better place for it logically, since it is not specific to
glsl->spirv translation. And in a future change I want to use it outside
of glslangtospv.
2019-03-06 13:40:33 -06:00
Jeff Bolz
3fd1232665 Improved fix for buffer reference constants
This is an alternate fix for the issue described in commit be63facd, whose
solution didn't work if there were non-trivial operations involved in computing
a constant initializer which caused the 'constant unfolding' code to kick in
(addConstantReferenceConversion). Instead, this change does the 'unfolding'
later in createSpvConstantFromConstUnionArray. If a reference-type constant has
survived that long, then folding is already done, this must be a 'real' (inside
a function) use of the constant, and it should be safe to unfold and apply the
bitcast.
2019-03-06 09:28:29 -06:00
John Kessenich
79d25ea0ce
Merge pull request #1714 from jeffbolznv/volatil
Fix interactions between 'volatile' and the Vulkan memory model
2019-03-06 20:43:07 +07:00
John Kessenich
cc4a756d48 Build: Update to latest SPIR-V header. 2019-03-06 11:21:38 +07:00
Jeff Bolz
38cbad15ca Fix interactions between 'volatile' and the Vulkan memory model
Last year we changed 'volatile' to also act as 'coherent', but when I
resolved the memory model changes against that change I missed handling
volatile in a couple places that we check for coherent. There was also
a place in post-processing that acted as if the volatile memory access
flag has a literal number associated with it, when it doesn't.
2019-03-05 14:40:07 -06:00
Jeff Bolz
1994fe4523 Fix NV_EXTENSIONS-disabled build 2019-02-28 11:59:35 -06:00
Jeff Bolz
4605e2ed2b Implement GL_NV_cooperative_matrix 2019-02-25 23:42:59 -06:00
Nico Weber
76577b1aec Fix -Wextra-semi warnings in headers used in Chromium 2019-02-21 11:05:21 -05:00
Jeff Bolz
2b2316d3fa Add Float16/Int8/Int16 capabilities for private variables and function parameters 2019-02-17 22:50:00 -06:00
baldurk
332b173c82 Fix mismatched integer comparison (size_t/unsigned int vs int) 2019-01-30 17:29:44 +00:00
John Kessenich
d72f488cc6 Build: fix warnings. Fixes #1653. 2019-01-16 14:55:37 +07:00
John Kessenich
69932ab47f
Merge pull request #1645 from KhronosGroup/dupe-accelstruct
Don't output duplicate OpTypeAccelerationStructureNV declarations
2019-01-08 09:39:32 +07:00
Piers Daniell
3cf3f96292 Don't output duplicate TypeAccelerationStructureNV declarations 2019-01-07 14:17:44 -07:00
Jeff Bolz
9f2aec49e9 GL_EXT_buffer_reference 2019-01-07 12:36:13 -06:00
John Kessenich
d12fbc4c0c SPV: Move to the latest header. 2019-01-07 23:52:34 +07:00
Greg Fischer
d445bb2867 Create separate OpSource for each included file 2018-12-28 12:06:43 -07:00
John Kessenich
9ed38739b9
Merge pull request #1627 from greg-lunarg/lines8
Add passes to spirv-opt passes to preserve source line info when compiling -g.
2018-12-18 10:38:32 -07:00
Greg Fischer
5620a2f95e Add passes to legalization to preserve source line info when generated. 2018-12-16 13:13:46 -07:00
Jeff Bolz
61a0cd19cc Fix bug where shaderRecordNV buffers were using StorageBuffer storage class 2018-12-14 20:59:53 -06:00
John Kessenich
b23d232ec5 Licensing. Fixes #958. Add licenes file and update copyrights. 2018-12-14 10:47:35 -07:00
John Kessenich
236eb0d325 GLSL/SPV: XFB: No streams on types, but support them on built-in blocks.
From internal Khronos discussions, work, and testing.
2018-12-13 12:06:12 -07:00
Jeff Bolz
0a93cfbb79 Update to newest SPIRV-Tools. It checks the Vulkan rule that all resources must have a set and binding decoration, which many tests fail. So add code to set a default value of zero. Also disable PCH for Ninja builds. 2018-12-11 20:58:29 -06:00
Rémi Verschelde
ebfd91a719 Remove Unix executable permission from text files 2018-12-10 10:49:16 +01:00
greg-lunarg
5d43c4aac7 SPV: Fix #1575, fix #1593: Support HLSL #line
SPIR-V OpLines now contain filenames from HLSL-style #lines.
2018-12-07 17:36:33 -07:00
John Kessenich
667506a5ea
Merge pull request #1602 from Igalia/apinheiro/prevent-xfbstride-twice
GlslangToSpv: prevent add XfbStride twice
2018-11-29 10:43:25 -07:00
Alejandro Piñeiro
16ef9da372 GlslangToSpv: prevent add XfbStride twice
Without this commit, if the XfbStride was explicitly set, the
decoration was added twice on the shader.

v2 (changes after Jonh Kessenich first review)
   * Simplified by just removing the firs assignment
   * Removed assert
2018-11-29 11:49:04 +01:00
John Kessenich
8c869679f2 SPV: For GLSL only, bitcast OpArrayLength result back to int.
This makes the rest of the AST consuming the result match GLSL
semantics and hence get complete type matching.
2018-11-28 07:01:37 -07:00
John Kessenich
e045c23a34 SPV: Generate OpArrayLength with no signedness. 2018-11-27 09:19:10 -07:00
John Kessenich
d7baecfab7
Merge pull request #1595 from dgkoch/EXT_fragment_invocation_density
Implement GL_EXT_fragment_invocation_density
2018-11-27 06:41:36 -07:00
Alan Baker
440f95b1e7 Update known good SPIRV tools and headers
* Fixes use of optimizer
* Updated test outputs
 * GeometryStreams and TransformFeedback no longer fail validation
2018-11-26 11:24:22 -05:00
Daniel Koch
5154db5183 Implement GL_EXT_fragment_invocation_density
including SPV generation using SPV_EXT_fragment_invocation_density.
This is an alias of the functionality in SPV_NV_shading_rate, and thus in some
cases we can only have one set of the tokens present (switch statements), so
we have picked the EXT version. This required updating the expected test
results for SPV_NV_shading_rate.

Also updated the known-good for spirv-headers so that the validator in
spirv-tools knows about the new extension.
2018-11-26 10:01:58 -05:00
John Kessenich
83fe01e274 SPV: non-functional: update to latest headers. 2018-11-26 06:34:38 -07:00
John Kessenich
e3b76ed608 Merge branch 'scalar_block_layout' of https://github.com/jeffbolznv/glslang into jeffbolznv-scalar_block_layout 2018-11-16 09:57:33 -07:00
t.jung
b16bea801c [HLSL/Spir-V] fix for incorrect spir-v on int dot(int, int)
Decomposes OpDot into corresponding multiplies and additions.
2018-11-15 11:02:30 +01:00
Jeff Bolz
7da39ed968 Implement GL_EXT_scalar_block_layout 2018-11-14 09:30:53 -06:00
t.jung
697fdf015f HLSL: fix invalid spir-v vector * scalar for float1
Missing check for float results in always emitting OpIMul even for float types
2018-11-14 14:27:22 +01:00
Dan Sinclair
12fcaa2cc2 Review feedback 2018-11-13 09:17:44 -05:00
Dan Sinclair
70661b9c08 Handle potentially uninitialized result 2018-11-12 13:56:52 -05:00
GregF
68fbda9862 Add DeadBranchElim before MergeReturn in legalization.
MergeReturn now requires this or could throw an error.
2018-11-08 10:35:45 -07:00
John Kessenich
cdf7a85b14
Merge pull request #1557 from nicebyte/spec-const-decorations
Add names for composite spec constants in SPIR-V
2018-11-02 10:23:22 -06:00
Grigory Dzhavadyan
4c9876b34c Add names for composite constants in SPIR-V
Consider the following code:

    layout(constant_id=0) const int Y = 1;
    layout(constant_id=1) const int Z = 2;
    layout(constant_id=3) const int X = Y + Z;

Previously, it would produce SPIR-V decorations like this:

    Decorate 21(Y) SpecId 1
    Decorate 22 SpecId 3
    Decorate 33(Z) SpecId 0

This seems inaccurate, since the spec constant `X` that is dependent on
the two others did not get a name in the SPIR-V decorations. This behavior
may potentially negatively affect shader introspection capabilities.

This change alters the behavior to always add a name, which results in the code
above producing the following decorations:

    Decorate 21(Y) SpecId 1
    Decorate 22(X) SpecId 3
    Decorate 33(Z) SpecId 0
2018-11-02 00:45:12 -07:00
Ashwin Lele
ff1783db87 Multiple features and misc fixes for final raytracing non experimental version. 2018-10-31 07:55:24 -07:00
John Kessenich
b2b3d81e9b
Merge pull request #1556 from Kangz/msvc
Fix MSVC warning C4065: 'default' but no 'case' labels
2018-10-29 16:16:46 -06:00
Corentin Wallez
04a2fe93d0 Fix MSVC warning C4065: 'default' but no 'case' labels
This would happen in SpvPostProcess when we don't enable AMD extensions.
2018-10-29 16:24:00 +01:00
John Kessenich
25ed3fce0c
Merge pull request #1542 from sheredom/fix_8bit_storagebuffer
Fix 8-bit storage nearly always using the UniformAndStorageBuffer8BitAccess capability.
2018-10-26 10:27:46 -06:00
John Kessenich
8717a5d39a SPV/Standalone: Support specifying arbitrary versions of SPIR-V. 2018-10-26 10:16:47 -06:00
Neil Henning
b6b01f067b Fix 8-bit storage nearly always using the
UniformAndStorageBuffer8BitAccess capability.

When using the 8-bit storage extension it basically always used the
`UniformAndStorageBuffer8BitAccess` capability, even in cases where it
wasn't required. For instance if we are targeting Vulkan 1.1 (SPIR-V 1.3
or higher), and we are only using 8-bit types in an SSBO, we only need
the `StorageBuffer8BitAccess` capability.

I fixed this by enabling storage buffer use in Vulkan 1.1 / SPIR-V 1.3
or higher, and then changing the logic to match.

I also added some tests that will output different capabilities when run
on Vulkan 1.0 and 1.1, thus they are added twice to the test list (one
for each version).

Fixes #1539
2018-10-26 14:23:41 +01:00
Sahil Parmar
38772c0434 Allow GL_NV_mesh_shader in fragment shaders for perprimitiveNV
- Emit relevant capability/extension for use of perprimitiveNV in fragment shader
- Remove redundant checks for mesh shader qualifiers in glslang.y
- Add profile version check for use of extension GL_NV_mesh_shader
- Add a new gtest for use of perprimitiveNV in fragment shader
2018-10-25 23:50:59 -07:00
Dan Sinclair
70f13b2ed5 Fixup unused parameter warnings
This CL removes the current parameters which are unused in order to
fixup the issued clang warnings.
2018-10-24 09:54:48 -04:00
Jeff Bolz
ab3c965a46 Fix flags.nonprivate to be true for workgroup memory, which is implicitly workgroupcoherent/nonprivate 2018-10-15 22:46:48 -05:00
John Kessenich
5ff3c3da3b Interfaces: Remove NV_EXTENSIONS from two more headers.
This also fixes some cpp files that uncover issues when building
with the flags turned off.
2018-09-26 09:38:20 -06:00
Dan Sinclair
aac6d63716 Use unsigned int instead of uint32_t 2018-09-25 16:32:06 -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
Chao Chen
5b2203db04 Add-support-for-SPV_NV_shading_rate 2018-09-19 13:07:43 -07:00
Chao Chen
b50c02ef53 Add-support-for-SPV_NVX_raytracing 2018-09-19 13:07:43 -07:00
Chao Chen
3c3669904c Add-support-for-SPV_NV_mesh_shader 2018-09-19 13:07:43 -07:00
Chao Chen
3a1379667d 0003-Add-support-for-SPV_NV_shader_image_footprint 2018-09-19 13:07:42 -07:00
Chao Chen
beae2251b7 Add-support-for-SPV_NV_compute_shader_derivatives 2018-09-19 13:07:42 -07:00
Chao Chen
9eada4b971 Add-support-for-SPV_NV_fragment_shader_barycentric 2018-09-19 13:07:42 -07:00
John Kessenich
6dd4757f0f Update to latest spirv.hpp header (which fixed a typo). 2018-09-19 13:58:01 -06:00
John Kessenich
7105cb308a SPV: Move to latest SPIR-V header (latest NV extensions support). 2018-09-19 03:54:48 -06:00
John Kessenich
d122a72852 Build: Fix some warnings. 2018-09-18 03:43:30 -06:00
Dennis Luxen
fc89f065e9
Fix compiler warning emitted from GCC8
the following warning gets emitted:

```
In file included from ./Vulkan/glslang/SPIRV/hex_float.h:39,
                 from ./Vulkan/glslang/SPIRV/SpvBuilder.cpp:49:
./Vulkan/glslang/SPIRV/bitutils.h: In instantiation of ‘Dest spvutils::BitwiseCast(Src) [with Dest = spvutils::Float16; Src = short unsigned int]’:
./Vulkan/glslang/SPIRV/hex_float.h:138:47:   required from ‘T spvutils::FloatProxy<T>::getAsFloat() const [with T = spvutils::Float16]’
./Vulkan/glslang/SPIRV/hex_float.h:821:52:   required from here
./Vulkan/glslang/SPIRV/bitutils.h:29:14: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of non-trivially copyable type ‘class spvutils::Float16’; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
   std::memcpy(&dest, &source, sizeof(dest));
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./Vulkan/glslang/SPIRV/SpvBuilder.cpp:49:
./Vulkan/glslang/SPIRV/hex_float.h:43:7: note: ‘class spvutils::Float16’ declared here
 class Float16 {
       ^~~~~~~
In file included from ./Vulkan/glslang/SPIRV/hex_float.h:39,
                 from ./Vulkan/glslang/SPIRV/SpvBuilder.cpp:49:
./Vulkan/glslang/SPIRV/bitutils.h: In instantiation of ‘Dest spvutils::BitwiseCast(Src) [with Dest = spvutils::FloatProxy<spvutils::Float16>; Src = short unsigned int]’:
./Vulkan/glslang/SPIRV/hex_float.h:431:28:   required from ‘void spvutils::HexFloat<T, Traits>::setFromSignUnbiasedExponentAndNormalizedSignificand(bool, spvutils::HexFloat<T, Traits>::int_type, spvutils::HexFloat<T, Traits>::uint_type, bool) [with T = spvutils::FloatProxy<spvutils::Float16>; Traits = spvutils::HexFloatTraits<spvutils::FloatProxy<spvutils::Float16> >; spvutils::HexFloat<T, Traits>::int_type = short int; spvutils::HexFloat<T, Traits>::uint_type = short unsigned int]’
./Vulkan/glslang/SPIRV/hex_float.h:633:5:   required from ‘void spvutils::HexFloat<T, Traits>::castTo(other_T&, spvutils::round_direction) [with other_T = spvutils::HexFloat<spvutils::FloatProxy<spvutils::Float16>, spvutils::HexFloatTraits<spvutils::FloatProxy<spvutils::Float16> > >; T = spvutils::FloatProxy<float>; Traits = spvutils::HexFloatTraits<spvutils::FloatProxy<float> >]’
./Vulkan/glslang/SPIRV/hex_float.h:817:39:   required from here
./Vulkan/glslang/SPIRV/bitutils.h:29:14: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘class spvutils::FloatProxy<spvutils::Float16>’ from an array of ‘short unsigned int’ [-Wclass-memaccess]
   std::memcpy(&dest, &source, sizeof(dest));
   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./Vulkan/glslang/SPIRV/SpvBuilder.cpp:49:
./Vulkan/glslang/SPIRV/hex_float.h:115:7: note: ‘class spvutils::FloatProxy<spvutils::Float16>’ declared here
 class FloatProxy {
       ^~~~~~~~~~
```
2018-09-12 10:34:54 +02:00
John Kessenich
afe0c66f65 SPV: Fix #1487: Only declare AMD int16/half_float extensions when needed. 2018-09-10 18:10:51 -06:00
John Kessenich
ddfb4a8022 Merge branch 'jeffbolznv-memory_scope_semantics' 2018-09-07 08:58:53 -06:00
Jeff Bolz
36831c9bad GL_KHR_memory_scope_semantics 2018-09-06 20:36:14 -05:00
John Kessenich
97068d8b30
Merge pull request #1465 from otakuto/remove-execute-permissions
Remove execute permissions
2018-08-31 08:14:47 -07:00
Denis Zdorovtsov
949344f081
Update SpvTools.cpp
Fix build.
2018-08-31 17:36:15 +03:00
John Kessenich
4e11b615db SPV: Turn off the default validation done by the SPIRV-Tools optimizer.
Also use the glslang namespace qualifier consistently and validate after
legalization, not before. (But most tests don't legalize.)
2018-08-30 16:59:13 -06:00
John Kessenich
c340425bb2 SPV: Add option for controling when the SPIRV-Tools validator is used. 2018-08-23 15:29:08 -06:00
John Kessenich
717c80a9de SPV: Isolate SPIRV-tools glue to its own file. 2018-08-23 15:17:10 -06:00
John Kessenich
cc14f2d329 SPV: Add SPIRV-Tools validator. This needs the latest SPIR-Tools. 2018-08-23 13:46:48 -06:00
John Kessenich
e7df8e0b76 Non-functional: Rationalize some existing use of SPIRV-Tools. 2018-08-22 17:12:46 -06:00
David Neto
9fd2a8cdfc Use our own SPIRV-Tools message stringifier
Stop including an internal SPIRV-Tools header. It has been
deleted.

Fixes #1477
2018-08-20 10:36:27 -04:00
John Kessenich
31aa3d6019 SPV: only declare the pure 8/16-bit capabilities when needed.
Only when operations stray outside the 8/16-bit storage-capabilities
are the general (pure 8/16-bit) capabilities needed.
2018-08-16 15:54:21 -06:00
John Kessenich
149afc3930 SPV: More corrections of <id> versus "immediate" operands. 2018-08-14 13:31:43 -06:00
John Kessenich
228e964bcc SPV: Correct SPIR-V operands for <id> versus immediate. 2018-08-13 21:37:59 -06:00
John Kessenich
c4510e5ebc
Merge pull request #1466 from Kangz/warning_fixes
Fix -Wignored-qualifier and -Wunused-variable warnings
2018-08-09 12:49:56 -07:00
Corentin Wallez
e70614223f Fix -Wignored-qualifier and -Wunused-variable warnings 2018-08-09 14:54:33 +02:00
otakuto
d03da06ac1 Remove execute permissions 2018-08-07 03:16:20 +09:00
John Kessenich
f04c51b3bd Non-Functional: Add postprocess as more robust way to add capabilities
When capabilities are needed for specific SPIR-V instructions, it is
fragile to do so based on GLSL/AST usage; it should be based on actual
instructions they got translated to.
2018-08-03 15:56:12 -06:00
John Kessenich
5a7321eb03 Merge branch 'master' of https://github.com/zeux/glslang into zeux-master 2018-07-20 17:11:44 -06:00
John Kessenich
ebd989dd58
Merge pull request #1437 from mattparks/patch-2
CMake options for postfix and SPVRemapper.
2018-07-18 17:15:32 -07:00
Jeff Bolz
c140b96892 Add missing OpExtension SPV_EXT_descriptor_indexing for dynamic indexing capabilities 2018-07-12 16:51:18 -05:00
Matthew Albrecht
857f25cfd2 Added the cmake option to disable building SPVRemapper. 2018-07-07 16:54:34 -05:00
Arseny Kapoulkine
112e2858cf SPIRV: Simplify matrix->matrix constructor
When constructing a matrix from another matrix with smaller dimensions,
there's no need to extract the scalars out of columns and rebuild the
resulting matrix from scalars - instead, we can just construct shorter
vectors with OpShuffle and combine them to the final result.

This keeps the common casts such as mat3(mat4) in vector registers,
which may improve performance for some GPUs, and cleans up output of
translation tools like SPIRV-Cross.

Fixes #1412.
2018-07-05 15:55:12 -07:00
Lei Zhang
a2c39a2947 Use public SPIRV-Tools header 2018-07-04 14:53:45 -04:00
John Kessenich
312dcfb070 Implement GL_EXT_shader_16bit_storage and GL_EXT_shader_8bit_storage extensions.
These introduce limited support for 8/16-bit types such that they can only be accessed in buffer memory and converted to/from 32-bit types.

Contributed from Khronos-internal work.
2018-07-03 13:51:31 -06:00
John Kessenich
e2156222d3 SPV: Add option to print disassembly in standard form using SPIRV-Tools. 2018-07-02 15:54:12 -06:00
GregF
c6831d1ed4 Add support for OpConstantNull and OpConstantSampler to spirv-remap
Fixes issue #1408
2018-06-19 13:51:28 -06:00
John Kessenich
ba018e6762 SPV: Fix #1399 emit ImageGatherExtended when using ConstOffsets operand 2018-06-05 08:53:36 -06:00
John Kessenich
ad7645f4f5 Fix #1360: uint->int width conversions must still be typed as uint. 2018-06-04 20:09:30 -06:00