Commit Graph

544 Commits

Author SHA1 Message Date
Greg Fischer
fb0e4983e4
Merge pull request #2767 from greg-lunarg/i2763
Fix unreachable code in getSampledType()
2021-09-23 10:41:34 -06:00
Greg Fischer
3d03b7822e
Scalarize vector readFirstInvocationARB (#2766)
Fixes #2761
2021-09-23 10:40:43 -06:00
Greg Fischer
4ea41b650d Fix unreachable code in getSampledType()
Fixed #2763
2021-09-22 15:16:30 -06:00
Jeremy Hayes
012436d680 Fix GCC warnings
Fix -Wsign-compare warnings.
Fix -Wunused-parameter warnings.
2021-08-31 16:40:35 -06:00
alelenv
fc60f77aa2 Add support for GL_NV_ray_tracing_motion_blur. 2021-08-10 10:40:28 -07:00
Nathan Reed
fc9897d1ba
Fix OpImageRead result type when compiling HLSL (#2706)
Fix OpImageRead result type when compiling HLSL

- Per the Vulkan spec, OpImageRead must return a 4-component vector always. When compiling HLSL, loads from a RWTexture of a template type with < 4 components would incorrectly generate an OpImageRead with a < 4 component result, resulting in validation errors.
- This was previously fixed for OpImageFetch in commit 4425f24; this commit does the same thing for OpImageRead.
- Added associated tests and expanded existing image fetch tests to check all the different types of textures, in both float and int incarnations, for completeness.
- Update other HLSL tests involving OpImageRead
2021-07-28 09:29:17 -06:00
Peter Kasting
e8cffa5b7f Fix some instances of -Wunused-but-set-variable.
Bug: chromium:1203071
2021-07-26 07:34:37 -07:00
Shahbaz Youssefi
097215f618 Fix loading bool arrays from interface blocks
SPIR-V disallows bool in interface blocks, which is emulated with uint.
When loading a bool variable (through accessChainLoad()), it's converted
from uint to bool if it came from an interface block.

This was handled for bool and bvecN, but not for bool arrays.  This
change implements the conversion for bool arrays.

Closes #2694
2021-07-15 22:29:48 -04:00
Greg Fischer
b9d06bdb01
Merge pull request #2668 from cmarcelo/GLSL_EXT_shader_atomic_float2
Implement GLSL_EXT_shader_atomic_float2
2021-06-17 11:27:47 -06:00
Jason Ekstrand
d352577a99 Implement GLSL_EXT_shader_atomic_float2 2021-06-16 09:11:14 -07:00
Rex Xu
65a7fb7054 Implement the extension GL_EXT_spirv_intrinsics
- Add support of SPIR-V execution mode qualifiers.
- Add support of SPIR-V storage class qualifier.
- Add support of SPIR-V decorate qualifiers.
- Add support of SPIR-V type specifier.
- Add support of SPIR-V intruction qualifiers.
- Add support of spirv_by_reference/spirv_literal parameter qualifier.
- Add shader stage macros introduced by this extension.
2021-06-09 14:18:06 +08:00
John Kessenich
848d3a9447 Implement GL_EXT_subgroup_uniform_control_flow. 2021-06-07 10:21:05 -04:00
Greg Fischer
11c24e9adb Do true SPV type check for function array arg linkage
Previous check was missing type difference between uniform array
actual arg with stride decoration and the formal arg without. Now
does logical or component-wise copy where needed.

Fixes #2637
2021-05-20 10:51:14 -06:00
Greg Fischer
1464d036b8 Fix arrays dimensioned with spec constant sized gl_WorkGroupSize 2021-05-06 18:05:16 -06:00
Greg Fischer
7fbaca0d06 Fix SPIR-V for HLSL EvaluateAttribute* of interpolants in structs
Generate load of interpolant for first operand to GLSLstd450
InterpolateAt* SPIR-V ops. This allows the interpolants to
propagate from the input struct in the wrapper around main
into the shader during HLSL legalization. A new pass has been
added to legalization which will remove the load and replace
with the pointer of the load to create valid external
interpolate op.

Fixes #2584
2021-04-01 00:31:31 -06:00
Jeremy Hayes
13e27f9dd0 Default to KHR extension
Fix #2530.
2021-03-22 13:42:43 -06:00
greg-lunarg
4e064eef46
Revert "Revert "GL_ext_vulkan_glsl_relaxed extension support, and cross stage aware IO mapper"" 2021-03-15 11:26:11 -06:00
greg-lunarg
e063363878
Revert "GL_ext_vulkan_glsl_relaxed extension support, and cross stage aware IO mapper" 2021-03-10 11:26:43 -07:00
greg-lunarg
84e11a858c
Merge pull request #2565 from greg-lunarg/i2564
Pass correct proxy type for atomicStore
2021-03-09 02:15:26 -07:00
Greg Fischer
b5c8fd4fcf Pass correct proxy type for atomicStore
Fixes #2564
2021-03-08 14:19:31 -07:00
will brown
ecc9b9149f Implement GL_EXT_vulkan_glsl_relaxed option 2021-03-08 13:31:39 -05:00
Greg Fischer
b479ce0bfa Allow DepthUnchanged and DepthReplaced Modes in same SPIR-V module.
Fixes #2555
2021-03-01 17:45:03 -07:00
Rex Xu
77fe62f477 SPV: Change the key of extBuiltinMap to std::string
Using const char* is not a good choice. We assume strings are always
from spv::E_SPV_XXX definitions. However, it is not the case. We can
store the name strings of extended intruction set in local variables.
2021-02-26 18:47:10 +08:00
greg-lunarg
b0f8a0c3ab
Merge pull request #2458 from ShchchowAMD/unique_id-fix
Fix issue for new unique id system.
2021-02-15 13:22:14 -07:00
Chow
93b400f267 Fix issue for new unique id system. Add level bits to help verifying symbols and split symbol tables.
For intermediates rebuilding, now need manually amending level bits for redeclaring built-ins.
2021-02-15 20:35:20 +08:00
Caio Marcelo de Oliveira Filho
4bfbf62794 Add support for GL_EXT_shared_memory_block
Uses SPV_KHR_workgroup_memory_explicit_layout.  Note that if
GL_EXT_scalar_block_layout is enabled, Workgroup blocks can also use
scalar layout.
2021-01-29 11:23:05 -08:00
Jeff Bolz
bfd84a39f2 Add missing capability when QueueFamily scope is used
Also, if this capability is added and the memory model is not
otherwise enabled by pragma, enable it as part of postprocessing.
2021-01-27 13:14:34 -06:00
John Kessenich
c739e03748 Implement GL_EXT_null_initializer
Adds null initializer syntax (empty braces)
Allows null initialization of shared variables
2021-01-25 15:54:52 -05:00
Daniel Koch
c0bcfaf3ba
Fix SPV return type of rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT (#2484)
Issue #2483

According to GLSL spec the prototype is:
        uint rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQueryEXT q, bool committed);

but that was incorrectly getting translated to SPIRV as an `int`, and this was
causing SPIR-V validation errors when used.

Added explicit testing for the return types of all the builtin functions in GL_EXT_ray_query
2020-12-12 10:34:24 -07:00
Daniel Koch
e11a2c8bec
update spirv-headers and fix handling of gl_HitTEXT (#2471)
* update spirv-headers and fix handling of gl_HitTEXT

Update spirv-headers known_good to f027d53ded7e230e008d37c8b47ede7cd308e19d
and update SPIRV/spirv.hpp to copy from that version as well.

In GLSL gl_HitTNV/gl_HitTEXT is defined as an alias of gl_RayTmaxNV/gl_RayTmaxEXT
SPV_NV_ray_tracing has a dedicated HitTNV which gl_HitTNV maps to.
For SPV_KHR_ray_tracing, gl_HitTEXT gets mapped to a RayTmaxKHR decoraged variable
to simplify the SPIRV consumer.
This change fixes the mapping for the GL_EXT_ray_tracing extension, and updates
the test results to match.

* update MissNV shader test to not use ObjectRay builtins

They shouldn't existing in the miss stage because there is no object intersected
2020-11-30 09:57:34 -07:00
Daniel Koch
4d41da3b81
Add ray query capability if acceleration structure or ray query types declared (#2469)
* Add ray query capability if acceleration structure used

Fixes #2430

in non-ray tracing stages and the extension is enabled

* Add ray query capability if ray query declared

* Fix printing of TypeRayQueryKHR

It's no longer spelled with "Provisional"
2020-11-24 21:06:16 -07:00
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
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
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
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
John Kessenich
142cb87f80
Merge pull request #2387 from BNieuwenhuizen/nonuniform
NonUniform SPIR-V fixes.
2020-10-30 15:10:11 -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
Chow
a315b5633b Add GL_EXT_fragment_shading_rate 2020-10-20 13:46:13 +01:00
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
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
johnkslang
f881f08358 SPV: Fix #2363: include trailing newline named text SPV output. 2020-08-04 02:13:50 -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
Vikram Kushwaha
79b93923d2 Add changes for SPV_EXT_shader_atomic_float_add 2020-07-22 05:52:22 -07: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