Commit Graph

4029 Commits

Author SHA1 Message Date
Daniel Koch
ffccefddfd
Updates for final Vulkan ray tracing extensions (#2466)
* Fix traceRay/executeCallable to have id instead of constant.

Update to final (non-provisional) SPIR-V capabilities
(includes review feedback)
- Change visibilty of findLinkerObjects.

See merge request GLSL/glslang!78

* Add support for OpConvertUToAccelerationStructureKHR.

GLSL : https://gitlab.khronos.org/GLSL/GLSL/-/merge_requests/60

SPV : https://gitlab.khronos.org/spirv/spirv-extensions/-/merge_requests/182

See merge request GLSL/glslang!77

* Add volatile qualifier to certain builtins for ray tracing.

See merge request GLSL/glslang!81

* make gl_RayTmaxEXT volatile in intersection shader

Vulkan Issue #2268

* Add testing for layouts on SBT

vulkan/vulkan#2230

- no layout specified should be same as std430
- explicitly test std140, std430, scalar layouts

See merge request GLSL/glslang!86

* Support for new opcodes OpIgnoreIntersectionKHR and OpTerminateRayKHR

vulkan/vulkan#2374

Add support for ignoreIntersectionEXT and terminateRayEXT as block
terminator statements.

See merge request GLSL/glslang!87

* Fix code-generation issues with global ray query variables

See merge request GLSL/glslang!88

* update dependencies for spirv-headers and tools

And update mesh shader results

* Fix indeterminate argument ordering

Authored-by: David Neto <dneto@google.com>

Co-authored-by: Ashwin Lele (NVIDIA Corporation) <alele@nvidia.com>
Co-authored-by: Neslisah <Neslisah.Torosdagli@amd.com>
2020-11-23 13:41:27 -07:00
Shahbaz Youssefi
7f6559d280
Compile out code for GL_EXT_shader_image_int64 for ANGLE (#2463)
Fixes a crash in ANGLE.

Closes: #2452
2020-11-16 10:22:34 -07:00
Malcolm Bechard
beec2e4a7c
tweak local_size comparison a bit (#2456)
no longer causes an incorrect error if the current unit has local_size
set, but the incoming unit does not
2020-11-12 13:55:50 -07:00
David Neto
fb53f83503
Avoid spuriously adding Geometry capability for vert, tesc, tese (#2462)
Use of gl_Layer and gl_ViewportIndex in tessellation and vertex
shaders should not trigger the addition of the Geometry capability.

Fixes #2461

Added tests for use of gl_Layer and gl_ViewportIndex in a tessellation
evaluation shader.

Several tests for NVIDIA features for tessellation, vertex, or mesh
shaders now lose the Geometry or MultiViewport capabilities.
This is ok because the functionality is already covered by
the ShaderViewportIndexLayerNV capability.

The spv.meshShaderPerViewBuiltins.mesh test now fails validation
because the validator does not know that PrimitiveId (and possibly
other) builtins are enabled by the MeshShadingNV capability.
I filed https://github.com/KhronosGroup/SPIRV-Headers/issues/179 to
fix the grammar upstream.
2020-11-12 13:00:16 -07:00
greg-lunarg
639f5461e3
New nonuniform analysis (#2457)
This implements a new nonunifom analysis suggested by @jbolz. This change
generates nonUniform decorations that were previously missing and avoids
generation of incorrect decorations. Most notably, it now generates
decorations for nonuniform functions and out params. It avoids generating
decorations for lvalues which themselves are not nonuniform.
2020-11-12 11:10:07 -07:00
Jesse Hall
74e8f05b9f
Implement GL_EXT_terminate_invocation (#2454)
* Implement GL_EXT_terminate_invocation.

* terminateInvocation: declare the SPV extension

* Update test results for spirv-tools and bison version bumps

Co-authored-by: John Kessenich <cepheus@frii.com>
2020-11-09 09:30:01 -07:00
rdb
383eaf3293
Fix token-pasting macros not working in preprocessor directives. (#2453)
Fixes #2443
2020-11-06 10:51:07 -07:00
Chow
3d7984dd1e
Fix warning in iomapper. (#2449)
ATT.
2020-11-05 10:33:45 -07:00
Tobski
8c1a3a06b8
Add GL_EXT_shader_image_int64 support (#2409) 2020-11-04 09:24:23 -07:00
Chow
478b232952
8. io mapping refine & qualifier member check & resolver expand (#2396)
* Code refine and adding missing features

1. Add new level for built in symbols.
2. Fix issues for structure members' qualifiers.
3. Global qualifier fix.
4. IO Mapper refine. Add support for checking with mangle names.

* Additional missing features

* Invariant member. (Only check non-interface).

* Split block nesting level and struct nesting level. To fix issues of checking 'invariant' qualifier.

Current grammar would check block/struct member without its parent class's information.
So we split nesting level, and 'invariant' would only be checked within a struct.

* Format anonymous block names. Refine codes for symbols from all kinds of resouces.

* Fix writeonly check.

* Use LValueBase to find operator.

* Fix random null ptr issue.

* invariant check, stage in io mapping, reference parameter should be used and remove wrong codes introduced with ordering vector.

* Remained: to be fixed with double check link.vk.multiblocksValid

* Fix version error.

invariant

* Revert loc modification.
2020-11-03 13:34:19 -07:00
Courtney Goeltzenleuchter
d550bebee9
Fix build error with Chromium & ANGLE (#2446)
Getting error about undefined symbol (include_dir) at line 320.
Was trying to append to a non-existant variable.

Bug #2445
2020-11-02 21:22:55 -07:00
pheonix
c897c3bc23
Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2442)
* Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2408)

* Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output.
Improve documentation on existing SpirvToolsDisassemble interface.

* Update pre-processor check - following existing ENABLE_OPT checks.

* Fix not-found header paths for glslangValidator and glslangtests.

* Add spirv_tools/include path where there is an ENABLE_OPT=1 in the BUILD.gn configuration.
2020-11-02 14:40:50 -07:00
Sidney Just
56350cadfe
Support for CapabilityShaderViewportIndex and CapabilityShaderLayer (#2432)
* When targeting SPIR-V 1.5, using gl_ViewportIndex will emit OpCapability ShaderViewportIndex and using gl_Layer will emit OpCapability CapabilityShaderLayer. OpCapability ShaderViewportIndexLayerEXT will only get emitted if the target < SPIR-V 1.5

* When using one of the viewport/layer arrays extensions, fallback to OpCapability ShaderViewportIndexLayerEXT, even when targeting SPIR-V 1.5

* Revert "When using one of the viewport/layer arrays extensions, fallback to OpCapability ShaderViewportIndexLayerEXT, even when targeting SPIR-V 1.5"

This reverts commit dccca82f40.

* Using gl_Layer and gl_ViewportIndex outside of the geometry shader stage still requires one of the viewport extensions even when targeting SPIR-V 1.5
(Fixes a problem introduced by 670536b663)
2020-11-02 12:27:40 -07:00
Jaebaek Seo
ed8bd0453f
Do not use PropagateLineInfoPass and RedundantLineInfoElimPass (#2440)
* Do not use PropagateLineInfoPass and RedundantLineInfoElimPass

Since spirv-opt will remove PropagateLineInfoPass and
RedundantLineInfoElimPass, glslang should not use it. spirv-opt will
propagate the line instructions and eliminate the redundant lines by
default in IR loading/emission.

* Update known_good.json for spirv-tool
2020-11-02 10:49:31 -07:00
John Kessenich
142cb87f80
Merge pull request #2387 from BNieuwenhuizen/nonuniform
NonUniform SPIR-V fixes.
2020-10-30 15:10:11 -06:00
John Kessenich
740ae9f60b
Merge pull request #2435 from amdrexu/feature
HLSL: Add support for printf().
2020-10-26 14:29:10 -06:00
Rex Xu
f6e0fe8600 HLSL: Add support for printf().
Translate printf() to what GL_EXT_debug_printf has done. HLSL could
define non-constant string variable and we don't have such features
in SPIR-V, so just support constant string variable.
2020-10-24 22:10:13 +08:00
John Kessenich
3b334b2b8e
Merge pull request #2429 from ben-clayton/test-gn-presubmit
Fix GN build and presubmits
2020-10-22 10:35:16 -06:00
Ben Clayton
0f52e7ef12 Fix GN build and presubmits
Add missing `.cfg` files for GN presubmit.
Add missing `recursedeps` in the `DEPS` file.
Call `./update_glslang_sources.py` before attempting to build.
Add more GN spew to the `.gitignore` file.
2020-10-21 15:49:08 +01:00
John Kessenich
ea52b3c2d2
Merge pull request #2427 from ben-clayton/gn
Kokoro: Add configurations for GN presubmit
2020-10-20 17:21:56 -06:00
John Kessenich
00d05d23a2
Merge pull request #2428 from Tobski/GL_EXT_fragment_shading_rate
Add GL_EXT_fragment_shading_rate
2020-10-20 15:25:26 -06:00
John Kessenich
490eba591d SPV: Update to the latest SPIR-V header, includes variable-rate shading 2020-10-20 14:47:10 -06:00
Chow
a315b5633b Add GL_EXT_fragment_shading_rate 2020-10-20 13:46:13 +01:00
Ben Clayton
b2b1e2da46 Kokoro: Add configurations for GN presubmit
Issue: #2421
2020-10-20 11:12:31 +01:00
John Kessenich
3ead011912
Merge pull request #2422 from ben-clayton/gn
Add basic GN configurations
2020-10-19 17:29:18 -06:00
Ben Clayton
5b99b448b3
Fix uninitialized use of TIntermediate::resource (#2424)
TIntermediate was constructed without initializing any of the `resources` fields,
and `TProgram::linkStage()` was not calling `TIntermediate::setLimits()`
after constructing new `TIntermediate`s for non-first stages.

Fields of `resources` were then read in `TIntermediate::finalCheck()`
triggering undefined behavior.

This CL makes three changes:
(1) `TIntermediate::setLimits()` is now called for non-first stages by
    copying the `firstIntermediate`'s limits. This ensures that the
    `resources` fields is initialized, fixing the bug.
(2) `TIntermediate::resources` is now wrapped in a `MustBeAssigned<>`
    helper struct, asserting in non-release builds that this field is
    always initialized before reading.
(3) `TIntermediate::resources` is now zero-initialized, so that if
    the `TIntermediate::resources` field is not set in a release build
    (and so the `assert()` will be disabled) behavior is still
    deterministic.

Fixes #2423
2020-10-19 15:21:12 -06:00
Ben Clayton
f915cc2b2b Add GN build instructions to README.md 2020-10-16 14:26:05 +01:00
Ben Clayton
dac38b8fce Add basic GN configurations
This allows glslang to be build standalone using the gn build system.

To build with gn:

```
gclient sync --gclientfile=standalone.gclient
gn gen out/default
cd out/default
ninja
```
2020-10-16 13:15:47 +01:00
Triang3l
f4f1d8a352
SPIR-V: Remove SpvTools.h include from disassemble.cpp (#2417)
disassemble.cpp appears not to be using anything from SpvTools.h, but the inclusion of it prevents standalone building of the SPIR-V portion (for instance, when needed purely for generation and disassembly) without SPIRV-Tools dependency.
2020-10-12 10:33:01 -06:00
Rémi Verschelde
69d0c1acc2
Remove executable bits from code/data files (#2420) 2020-10-12 10:08:47 -06:00
David Neto
2067d1a93e
Add test case for read-only storage texture passed to helper function (#2414)
This is based on spv.paramMemory.frag.out which exercises the
writeonly storage image case.

This appears to need desktop GLSL.

The generated SPIR-V fails validation because the image_write function
takes a parameter which is pointer to an OpTypeImage with Unknown format.
But the parameters passed in are pointer to OpTypeImage with formats Rgba32f
and Rgba16f. The validator rejects this, saying the parameter types must
match.
2020-10-07 16:10:27 -06:00
jonahryandavis
3ce148638b
Disable -Wno-conversion on MSVC compiler (#2410) 2020-10-07 11:32:49 -06:00
John Kessenich
2b77059502 Revert "Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2408)"
See issue #2413.

This reverts commit d1929f359a.
2020-10-05 16:58:31 -06:00
pheonix
d1929f359a
Add new SpirvToolsDisassemble API interface + Improve Doc on existing API interface (#2408)
* Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output.
Improve documentation on existing SpirvToolsDisassemble interface.

* Update pre-processor check - following existing ENABLE_OPT checks.

* Fix not-found header paths for glslangValidator and glslangtests.
2020-10-05 09:59:27 -06:00
John Kessenich
f05c076e26 Revert "Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output. (#2406)"
This reverts commit 2eed8236d0.
2020-09-27 18:15:41 -06:00
pheonix
2eed8236d0
Add more flexible SpirvToolsDisassemble interface to allow specifying spv_target_env for disassembly output. (#2406)
Improve documentation on existing SpirvToolsDisassemble interface.
Fix cmake build scripts to account for `spirv-tools` external when -DENABLE_OPT=ON
2020-09-27 17:53:18 -06:00
craig stout
d0e7ed37fc
[spirv-remap] Fix undefined behavior in hashing (#2403)
There's a statement that intends to generate a 32-bit hashcode, but due
to integer promotion, the intermediate values can trigger signed integer
overflow, which is undefined behavior.

To avoid this, cast at least one operand to unsigned int before
multiplying, which will cause the result to be promoted to unsigned int
instead of signed int.

With this patch, I'm able to build core for qemu-x64 with host_asan-ubsan.

Fixed: 60128
Change-Id: Idd644e534116bf29dca8013936ac39901bbe68fc
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/glslang/+/428254
Reviewed-by: John Bauman <jbauman@google.com>

Co-authored-by: Drew Fisher <zarvox@google.com>
2020-09-26 18:43:30 -06:00
craig stout
1815d86a22
[Wconversion] Suppress glslang issue (#2404)
The glslang public includes dir contains headers with implicit
conversion issues. Add -Wno-conversion to glslang's public config.

Bug: 60140
Bug: 58162
Change-Id: Iec27cb4242e9fdceddd6a3e02044a0bccfa0ce36
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/glslang/+/429054
Reviewed-by: Petr Hosek <phosek@google.com>

Co-authored-by: Shai Barack <shayba@google.com>
2020-09-26 11:02:33 -06:00
greg-lunarg
bacaef3237
Update spirv-tools and spirv-headers known goods (#2401) 2020-09-24 20:07:15 -06:00
Rex Xu
4dcc12d1a4
SPIRV: Add more utility functions to build some opcodes (#2398)
Add more builder functions to OpExecutionMode, OpExecutionModeId,
OpDecorateString, OpMemberDecorateString.

According to SPIR-V, OpExecutionMode and OpExecutionModeId could
take variable extra operands. Current implementation doesn't support
this and assumes at most 3 operands are extra operands. It is not
true. Similarly, OpDecorateString and OpMemberDecorateString could
support multiple strings either as literal strings or as string
operands. Further, OpDecorate and OpDecorateId have the same problem,
taking variable extra operands.
2020-09-18 07:18:35 -06:00
Chow
9eaa69c21c
Preprocessor related issue fix (#2378)
* Preprocessor related fix

1). Accoding to ESSL spec : All macro names containing two consecutive underscores ( __ ) are reserved for future use as predefined macro names, so just report a warning instead of error when the shader defines the macro names begining with  '__';

2. According to spec:  If an implementation does not recognize the tokens following #pragma, then it will ignore that pragma, so report a compile-time warning intead of error for the following statement:
#pragma debug(1.23)

3. The 'defined' macro should be allowed to expand and '__LINE__' should be allowed to be replaced with its original line number (otherwise, other expanding macros may change this value).

4. Add a flag 'indentifierSeen' in PPContext to indicate whether the any non-preprocessor tokens is existed before the extension directives, because the built-in symbols and functions are parsed before paring the user shader, so add a 'shaderSource' flag to check this error only for the user shader source;

5. Add missing type int16 and uint16.

* Add test results, remove restriction of #extension.

1. Remove extension restriction in first line , as this is contraversy now.

2. The following shader is compiled failed as glslang consider the keyword 'defined' can not be undefined(in the 9th line: "#define defined BBB")
The shader is as following:
According to ES3.0 spec: It is an error to undefine or to redefine a built-in (pre-defined) macro name.
This rule is aimed to the  __LINE__,  __FILE__, __VERSION__ and  GL_ES,
the keyword "defined" should not be restricted by this rule,
so change the compile error to warning and make the following shader compile successfully.

* 1. Using relaxedError to control error/warning report level. 2. remove #extension restriction. 3. Fix version related issue.

1. Using relaxedError to control error/warning report level. 2. remove #extension restriction. 3. Fix version related issue.

* Add test results

* Turn conditional warnings about pragma to unconditional ones.
2020-09-14 21:46:24 -06:00
Rex Xu
ac2f01f4bd
SPIRV: Add disassembly support for multiple literal strings (#2397)
According to the extension SPV_GOOGLE_decorate_string,
OpDecorateString (or OpMemberDecorateString) ought to be capable of
supporting multiple literal strings. Each literal strings are padded
with null terminator to make word alignment. The layout is:

  Inst | Target | Decoration | Literal String, Literal String, ...
2020-09-14 09:57:09 -06:00
Chow
3933d7d414
Fix scope definition in ES 100. (#2379)
* Remove image2DShadow and other 3 tokens. Refine codes.

Remove image2DShadow and other 3 tokens. Refine codes.

* 110scope.vert has redefinition part of what's removed from 100scope.vert
2020-09-14 08:00:48 -06:00
johnkslang
f8a5602c55 Fix #2385: guard against constant_id on non-const. 2020-09-14 02:49:38 -06:00
John Kessenich
759ae5aec0
Merge pull request #2394 from ShabbyX/subpassLoad
Allow subpassLoad for ANGLE
2020-09-12 22:45:53 -06:00
John Kessenich
d091728a67
Merge pull request #2395 from nihui/patch-4
Find python interpreter from host when cross-compiling
2020-09-12 22:45:22 -06:00
nihui
967fa92d14
Try to find python interpreter from host first 2020-09-12 11:18:02 +08:00
Shahbaz Youssefi
91ac2245e9
Allow subpassLoad for ANGLE
Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>
2020-09-11 22:30:49 -04:00
Greg Fischer
8eb0bdce92 Add texture sample to nonuniform test
This verifies that the nonuniform decoration does NOT propagate
to the OpSampledImage.
2020-09-10 23:02:54 +02:00
Greg Fischer
889ac20408 Add buffer store to nonuniform tests 2020-09-10 23:02:54 +02:00