Commit Graph

189 Commits

Author SHA1 Message Date
Greg Fischer
7a49192d23 Add support for spirv1.6
Add command line support which enables the following behavior:

- Remap discard

  Map discard to DemoteToHelperInvocation for HLSL shaders. Map to
  OpTerminateInvocation for GLSL shaders.

- Decorate HelperInvocation with Volatile

- Use localSizeId for execution mode

  WorkGroupSize is deprecated in spirv1.6

Also update known goods to SPIRV 1.6
2021-12-16 15:01:42 -07:00
Rex Xu
3e9e60af86 Remove the test spv.intrinsicsSpecConst
According to current SPIR-V spec, we couldn't write a valid case that
references OpExecutionModeId and OpDecorateId.
2021-11-22 21:33:36 +08:00
Rex Xu
bee91eb479 Fix an issue of spirv_type used in local variable definitions
We previously use createOp() in SPV builder to create type declaration.
However, all type declarations should be placed in const-type-variable
declaration section. And duplicated type defintions ought to be avoided.
We now make a method in SPV builder to perform this operation with a
more general solution: makeGenericType().
2021-11-18 20:17:04 +08:00
Rex Xu
07aec25f82 Make modifications of GL_EXT_spirv_intrinsics
1. spirv_execution_mode_id and spirv_decorate_id could support
   specialization constants. The original implementation always
   assume only normal frontend constants are valid. It is not true.

2. spirv_type donesn't support type_specifier as an option of
   spirv_type_parameter. At present, only constant_expression is the
   valid option.
2021-10-15 20:22:36 +08:00
alelenv
fc60f77aa2 Add support for GL_NV_ray_tracing_motion_blur. 2021-08-10 10:40:28 -07:00
Greg Fischer
e0f3fdf433
Merge pull request #2716 from greg-lunarg/i2689
Add support for pragma STDGL invariant(all)
2021-08-01 00:13:10 -06:00
Greg Fischer
715f5c6cf1 Add support for pragma STDGL invariant(all)
Fixes #2689
2021-07-31 15:55:25 -06:00
Greg Fischer
9ff6cd0bd6
Merge branch 'master' into BugPoint 2021-07-29 14:48:24 -06: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
ZhiqianXia
cf52f73a0c Atomic memory function can only be used for shader storage block member or shared variable.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-07-12 16:57:25 +08: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
186e66c1a3
Revert "Update minimum SPIR-V requirement for GL_EXT_buffer_reference" 2021-04-07 15:20:16 -06:00
Jeremy Hayes
97dfbe2c4b Update minimum SPIR-V requirement
Require SPIR-V 1.3 when using GL_EXT_buffer_reference.
Migrate tests to SPIR-V 1.3 fixture as necessary.
Fix extension table key.
Fix whitespace.
2021-03-29 15:10:43 -06:00
Greg Fischer
b5c8fd4fcf Pass correct proxy type for atomicStore
Fixes #2564
2021-03-08 14:19:31 -07:00
Greg Fischer
b479ce0bfa Allow DepthUnchanged and DepthReplaced Modes in same SPIR-V module.
Fixes #2555
2021-03-01 17:45:03 -07: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
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
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
a315b5633b Add GL_EXT_fragment_shading_rate 2020-10-20 13:46:13 +01: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
Tobias Hector
395bce6c85 Added missing copyright amendment 2020-09-08 11:10:27 +01:00
Tobias Hector
ed7a097d19 Error when initializing rayQuery with assignment 2020-09-03 15:16:25 +01:00
johnkslang
23f3bdfea1 Build/Test: Dropping 2013 allows using the latest googletests.
These have a new spelling: INSTANTIATE_TEST_CASE_P -> INSTANTIATE_TEST_SUITE_P
2020-08-05 11:07:07 -06: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
fe24a54808 Non-determinism: Remove test file that seems to trigger non-determinism.
This problem needs to be fixed, but in parallel, we need to see master
and any other changes to it passing all tests.

The removed test is ray-tracing centric, and may indicate non-determinism
in recent code added for that functionality.
2020-07-14 00:32:25 -06:00
John Kessenich
4e13c90944 Fix #2329: don't use invalid initializers. 2020-07-13 00:35:58 -06:00
John Kessenich
12c155f303 SPV: RelaxedPrecision: use the result precision for texture sampling.
Fix #2298.

The AST has two precisions, an operation precision and a result precision.
Actual use of GLSL with mediump samplers wants the result precision, so
pick that up instead of the operation precision.
2020-06-30 07:52:05 -06:00
John Kessenich
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
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
alelenv
d39b8afc47
EXT_ray_tracing requires spv1.4 (#2237)
* EXT_ray_tracing requires spv1.4

* Fix typo.

* Add extension data table.

* Updated feedback #2.
2020-05-28 09:18:07 -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
John Kessenich
4657244018 Fix #2178: Allow specialization constants for texel offsets. 2020-04-12 22:57:07 -06:00
alelenv
f986436a90 Error assigns to objects of rayQueryEXT type. 2020-03-30 10:24:30 -07:00
Neslisah Torosdagli
054b5e35eb pass by reference updates 2020-03-26 12:24:31 -04:00
Neslisah Torosdagli
65c81bf236 compute and fragment shader test_cases added for rayQuery 2020-03-23 21:56:31 -04:00
Neslisah Torosdagli
2fb45def04 rayQuery test cases added 2020-03-23 21:34:09 -04:00
Neslisah Torosdagli
4893bae5e9 test names updated 2020-03-23 19:20:24 -04:00
Neslisah Torosdagli
39a7fc3700 rayQuery test cases disabled 2020-03-23 11:36:06 -04:00
Neslisah Torosdagli
50a722818b GL_EXT_ray_query glslang updates, and test cases added. 2020-03-20 18:23:27 -04:00