Commit Graph

598 Commits

Author SHA1 Message Date
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