Commit Graph

2023 Commits

Author SHA1 Message Date
Greg Fischer
a40e4ac3f7
Merge branch 'master' into textureQueryLOD 2021-11-22 10:39:03 -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
Greg Fischer
2c54c20813
Merge pull request #2782 from kevin-mccullough/FixIomapperSeperableShaderValidation
Fix issue with separable shader validation in iomapper
2021-11-19 15:19:27 -07:00
Greg Fischer
dd83c37b98
Merge pull request #2826 from amdrexu/bugfix
Fix an issue of spirv_type used in local variable definitions
2021-11-18 11:20:02 -07: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
Kevin McCullough
cbab732905 Fix issue with separable shader validation in iomapper 2021-11-17 14:28:16 -08:00
Greg Fischer
0d468a7eee
Merge pull request #2824 from alan-baker/update-tools
Update SPIRV-Tools
2021-11-17 15:26:19 -07:00
Greg Fischer
e9564feb55 Add --hlsl-dx-position-w option
This reciprocates the w component of SV_Position in HLSL fragment shaders
to provide DirectX compatibility for HLSL shaders in Vulkan.

Fixes #2244
2021-11-16 18:42:12 -07:00
Alan Baker
1025f4736a Update SPIRV-Tools
* Fix test expectations
2021-11-16 19:03:12 -05:00
Marius Hillenbrand
d13f81510f remove undefined conversions from test constantUnaryConversion.comp
Remove remaining conversions from negative float64_t to unsigned
integers, which are undefined behavior.

As a result, this test will also succeed on platforms that implement
those conversions differently than x86. That addresses one of the issues
in #2815.
2021-11-15 14:01:15 -07:00
Marius Hillenbrand
0d85595e33 add negative float conversions to test constantUnaryConversion.comp
Add conversions from negative float16_t and float32_t to bool, all
signed integer types (i.e., including those in
GL_EXT_shader_explicit_arithmetic_types), and all float types (from the
same extension) to extend coverage.

Note that converting negative float values to unsigned integers is
undefined behavior. Thus, we exclude them.
2021-11-15 14:00:22 -07:00
Greg Fischer
7141f89a89
Merge pull request #2806 from ZhiqianXia/bestFunctionMatching
#extension GL_ARB_gpu_shader5 support the implicit conversion ,
2021-11-15 13:28:53 -07:00
Greg Fischer
10be28ac9b Fix struct type sharing
Fixes #2812
2021-11-12 16:57:11 -07:00
Greg Fischer
002b3f55c7 Generate error for binding on push_constant 2021-11-10 15:15:43 -07:00
ZhiqianXia
50a6a51625 Support the #extension GL_ARB_fragment_coord_conventions.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-11-10 10:41:40 +08:00
ZhiqianXia
77b0d72c68 #extension GL_ARB_gpu_shader5 support the implicit conversion ,
So the best function matching algorithm should be actived.


Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-11-10 09:44:16 +08:00
Greg Fischer
9600b97c6a Fix test spv.1.4.OpEntryPoint.frag
Cannot apply binding qualifier to push_constant
2021-11-09 15:46:08 -07:00
Greg Fischer
bb5b357550
Merge pull request #2781 from kevin-mccullough/FixLinkTimeValidationForGl_PerVertex
Fix incorrect link time validation for unused gl_PerVertex members
2021-11-09 13:44:32 -07:00
Greg Fischer
9535746aa3
Merge pull request #2798 from alan-baker/update-tools
Update tools
2021-11-08 18:29:53 -07:00
Kevin McCullough
13fd2d6470 Fix incorrect link time validation for unused gl_PerVertex members 2021-11-08 15:23:02 -08:00
ZhiqianXia
46d3a30bd9 Support the #extension GL_ARB_draw_instanced.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-11-08 13:48:03 +08:00
Alan Baker
8092870281 Update test expectations 2021-11-05 14:33:46 -04:00
ZhiqianXia
e76116982a Add the GL_EXT_shader_integer_mix Preamble for glsl.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-11-02 14:39:28 +08:00
Greg Fischer
432a43cccb Remove support for double trig, pow, exp and log
These are not supported in core GLSL or under any extension

Fixes 2793
2021-10-27 11:59:26 -06:00
Greg Fischer
38fd9221db
Merge pull request #2777 from amdrexu/bugfix
Make modifications of GL_EXT_spirv_intrinsics
2021-10-21 12:59:22 -06:00
Greg Fischer
9290474dcf
Merge pull request #2787 from greg-lunarg/i2779
Allow 8/16-bit integer as array index
2021-10-20 18:26:59 -06:00
Greg Fischer
8020da3f18
Merge pull request #2788 from alelenv/iomapper_sr_fix
Skip auto decorating shader record buffer blocks with 'set' and 'binding'.
2021-10-20 16:28:11 -06:00
Greg Fischer
82b2668d58 Allow 8/16-bit integer as array index
Also enable 8/16 bit int capability in SPIR-V in such cases.

Also enable 64 bit capabilities when used in operations.

Fixes #2779
2021-10-20 15:15:30 -06:00
Greg Fischer
6639be7c2d Accept gl_ViewportMask in version 430 and later
Was previously accepted only in 450 or later.

Fixes #2785
2021-10-20 13:51:23 -06:00
alelenv
c571cd8f89 Skip auto decorating shader record buffer blocks with 'set' and
'binding'.
2021-10-19 20:59:35 -07: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
Greg Fischer
3d03b7822e
Scalarize vector readFirstInvocationARB (#2766)
Fixes #2761
2021-09-23 10:40:43 -06:00
Greg Fischer
c2604615f4
Merge pull request #2685 from kevin-mccullough/FixIsIoResizeArrayTesselationStageHandling
Fix isIoResizeArray() tessellation stage handling
2021-09-21 16:29:30 -06:00
Greg Fischer
8b87b84001 Fix SPIR-V for SampleBias
Fixes #2757
2021-09-17 17:22:39 -06:00
Malcolm Bechard
05794b46a7 GL_EXT_vulkan_glsl_relaxed - retarget gl_VertexID to gl_VertexIndex
instead of allowing for multiple declarations of the variable in the
resulting SPIR-V, instead use a retargeted mechanism to cause references
to gl_VertexID and gl_InstanceID to use the gl_VertexIndex and
gl_InstanceIndex symbol.
2021-09-16 17:40:49 -04:00
Greg Fischer
8ef6a4cb4d Perform update_precision on constructors and converts
Fixes #2740
2021-09-02 14:18:51 -06:00
Greg Fischer
a4599ef756
Merge pull request #2718 from ZhiqianXia/AtomicOpsARB
Support the atomic_counter_xxxARB  built-in functons at #extension GL_ARB_shader_atomic_counter_ops.
2021-08-18 12:59:27 -06:00
alelenv
fc60f77aa2 Add support for GL_NV_ray_tracing_motion_blur. 2021-08-10 10:40:28 -07:00
ZhiqianXia
78de10954e Support the textureQueryLOD at #extension GL_ARB_texture_query_lod.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-08-02 16:20:02 +08:00
ZhiqianXia
bf56773517 Support Extension GL_ARB_shader_atomic_counter_ops and relative intrisic functions.
refs:
https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_shader_atomic_counter_ops.txt

Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-08-02 10:16:25 +08: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
27384e04f6 Allow layout(std430) uniform with GL_EXT_scalar_block_layout 2021-07-30 11:11:16 -06:00
Greg Fischer
9ff6cd0bd6
Merge branch 'master' into BugPoint 2021-07-29 14:48:24 -06:00
Greg Fischer
ba540202cd
Merge pull request #2700 from ZhiqianXia/u2i
Support Uint to Int implicit conversions at #extension GL_ARB_gpu_shader5.
2021-07-29 14:10:40 -06:00
Greg Fischer
d433cccb8a
Merge pull request #2702 from jeremy-lunarg/hayes-2518
Generate separate stores for partially swizzled memory stores
2021-07-28 16:49:27 -06:00
Jeremy Hayes
6d5b40f051 Generate separate stores for partially swizzled memory stores
Full vector and fully specified vector swizzle stores are not affected by this change, only partial swizzles ie swizzles with fewer components than the vector being stored to.

Previously the vector being stored to loaded and any components not specified in the swizzle were used to create a full store to the vector.

While this change generates more SPIR-V instructions, it is necessary for correctness.

Fixes #2518.
2021-07-28 14:55:45 -06: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
ZhiqianXia
8cd85272ad Support Uint to Int implicit conversions at #extension GL_ARB_gpu_shader5.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-07-19 17:24:28 +08: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
Kevin McCullough
5597c8d7cf Fix isIoResizeArray() tessellation stage handling 2021-07-09 09:51:16 -07:00
Greg Fischer
263e50f6aa
Revert "Atomic memory function can only be used for shader storage block member or shared variable." 2021-07-08 13:10:58 -06:00
ZhiqianXia
8a5c5e8210
Merge branch 'KhronosGroup:master' into master 2021-07-07 14:12:33 +08:00
Greg Fischer
e74b35f3f5
Merge pull request #2664 from mbechard/master
only declare compatibility gl_ variables in compatibility mode
2021-06-17 14:49:02 -06: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
Greg Fischer
71612a7e5d
Merge pull request #2625 from amdrexu/feature
Implement the extension GL_EXT_spirv_intrinsics
2021-06-16 14:52:35 -06:00
Jason Ekstrand
d352577a99 Implement GLSL_EXT_shader_atomic_float2 2021-06-16 09:11:14 -07:00
Greg Fischer
cd6b2382d0 Remove output variables from compute regression tests
Output variables in GLCompute shaders is not supported in Vulkan.
Recent upgrade of spirv-tools revealed this problem.
2021-06-15 15:56:27 -06:00
Alan Baker
3d9a31c6d1 Update test expectations 2021-06-15 11:13:35 -04:00
Malcolm Bechard
275d7ae882 only declare compatibility gl_ variables in compatibility mode
avoid declaring them in GLSL 1.50+ if core profile is chosen by the
version statement

fixes #2663
2021-06-10 21:52:09 -04:00
Greg Fischer
fe15158676
Merge pull request #2662 from greg-lunarg/spec1
Add support for float spec const vector initialization
2021-06-09 13:09:28 -06:00
Greg Fischer
230168d5d9 Add support for float spec const vector initialization
Fixes #2025
2021-06-09 10:07:03 -06: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
Jaebaek Seo
02f1c80d77 Fix unit test failures 2021-06-08 10:39:55 -04: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
John Stiles
9724ee42df Fix mat4x2(scalar) constructor. 2021-05-18 12:13:41 -04:00
ZhiqianXia
587261a817 Atomic memory function can only be used for shader storage block member or shared variable.
The glsl spec says:A shader will fail to compile if the value passed to the mem argument of an atomic memory function does not
correspond to a buffer or shared variable.
2021-05-15 00:13:43 +08:00
tgfrerer
adfa0938a2
fix error message for hlslGrammar::acceptConstructor
Fix the error message for when an erroneous HLSL constructor statement
is detected.

Prior to this change, such error messages would not show correct file
path and line number information.

Additionally, update test data to account for updated error messages.
2021-05-11 09:42:11 +01:00
Greg Fischer
1464d036b8 Fix arrays dimensioned with spec constant sized gl_WorkGroupSize 2021-05-06 18:05:16 -06:00
Panagiotis Christopoulos Charitos
6113723e40 Add support for 64bit integer types and 64bit integer vector types to bitCount() builtin.
Fixes #2630
2021-05-03 14:26:11 +02:00
Robin Quint
e50b0a857c Added usage hint for --auto-sampled-textures, added test cases 2021-04-22 13:13:38 +02:00
Georg Lehmann
498d74d84c Add some basic --depfile tests 2021-04-20 18:12:39 +02:00
Greg Fischer
60ce877de0
Merge pull request #2609 from ZhiqianXia/Feature2
TextureOffset not support sampler2DArrayShadow sampler until 430.
2021-04-19 12:03:05 -06:00
Greg Fischer
12f3eb8e3f Fix and enable textureOffset_samper2darrayshadow test 2021-04-19 09:37:45 -06:00
ZhiqianXia
41992e432c TextureOffset not support sampler2DArrayShadow sampler until 430.
Signed-off-by: ZhiqianXia <xzq0528@outlook.com>
2021-04-15 21:38:35 +08:00
Jeremy Hayes
4b900778c3 Issue error when declaration rule fails
Fix #2514.
2021-04-09 16:55:23 -06:00
Greg Fischer
186e66c1a3
Revert "Update minimum SPIR-V requirement for GL_EXT_buffer_reference" 2021-04-07 15:20:16 -06:00
Greg Fischer
02132406bc Do not propagate packing qualifiers to scalars or vectors
Packing qualifiers have no practical effect on scalars or vectors
so this is unnecessary and its confusing tools downstream that
consume the AST.
2021-04-06 15:40:22 -06:00
Greg Fischer
5878bcb17e
Merge pull request #2593 from jeremy-lunarg/hayes-update-min-spv-requirement
Update minimum SPIR-V requirement for GL_EXT_buffer_reference
2021-04-01 12:32:57 -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
Pankaj Mistry
18cfc3f106 For bug #2580: sparseTextureGatherOffsetsARB should only take constant offsets. 2021-03-29 14:27:17 -07: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
Jeremy Hayes
13e27f9dd0 Default to KHR extension
Fix #2530.
2021-03-22 13:42:43 -06:00
greg-lunarg
847a19cd2b
Merge pull request #2581 from mbechard/InconsistentGLPerVertex
Partial fix for inconsistencies re: #2578
2021-03-19 17:38:51 -06:00
Malcolm Bechard
9b962f611c Partial fix for inconsistencies re: #2578
gl_SecondaryPositionNV and gl_PositionPerViewNV are inconsistently
declared inside and outside of gl_PerVertex. This breaks interface block
matching. For now ignore these errors since it should be fixed with how
they are declared.
2021-03-19 16:18:42 -04:00
Malcolm Bechard
5340752190 Fix issue with remapping global uniform blocks
Avoid adding global uniform blocks to stages that don't already have it.
Otherwise multiple stages point to the same block object, and a
remapping that occurs later on will change the mapping on multiple
stages.
2021-03-17 19:30:22 -04: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
Greg Fischer
740def238e Allow grad texture ops in all shaders
Fixes #2551
2021-03-01 12:34:53 -07:00
Greg Fischer
051fbbb69c Fix off-by-1 bug in gl_MaxCombinedTextureImageUnits check
The problem was only with arrays of samplers.

Fixed #2552
2021-02-26 17:07:52 -07:00
Greg Fischer
c176085909 Fix precision propagation around shifts
Fixes #2541
2021-02-26 14:25:38 -07:00
Jeremy Hayes
1c62806468 Require fixed workgroup size declaration
Fix 2479.
2021-02-24 14:49:31 -07: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
Caio Marcelo de Oliveira Filho
3785ddd59a Update known_good.json to pick up SPV_KHR_workgroup_memory_explicit_layout
Also update the test expectations regarding validation accordingly and
the in-tree spirv.hpp copy.
2021-01-29 11:22:22 -08:00
Caio Marcelo de Oliveira Filho
a38df83d3e Consider GL_EXT_scalar_block_layout when validating SPIR-V
If GL_EXT_scalar_block_layout is requested by the shader, set the
option to allow scalar blocks in the SPIR-V validator.

Fix the existing tests using scalar layout to not expect "Validation
failed".

Fixes #2400.
2021-01-28 14:11:24 -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
Greg Fischer
e453088a8a Fix debugInfo test to target vulkan1.1 as intended
Fixes #2494
2021-01-05 14:45:11 -07:00
rdb
589aaff11c Don't use roundEven() to implement round() in DX9 compatibility mode 2020-12-16 18:35:42 +01:00
David Neto
1ef5e20290 Test updates for ImageRead result type validation
See #2486
2020-12-15 12:19:00 -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
rdb
383eaf3293
Fix token-pasting macros not working in preprocessor directives. (#2453)
Fixes #2443
2020-11-06 10:51:07 -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
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
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
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
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
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
Tobias Hector
ed7a097d19 Error when initializing rayQuery with assignment 2020-09-03 15:16:25 +01:00
John Kessenich
5bfb42301a
Merge pull request #2367 from KhronosGroup/fix-semantic-checking
Remove incorrect style of extension-based semantic checking.
2020-08-14 09:41:18 -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
Alan Baker
157fe5f8fb Update test expectations 2020-08-12 09:04:56 -04:00
johnkslang
d8daeb4323 Non-functional: correctly do GL_EXT_buffer_reference2 semantic checking
See #2366 for detail.
2020-08-07 02:26:04 -06:00
johnkslang
b60e067b43 SPV: Fix #1829: don't emit OpModuleProcessed use-storage-buffer 2020-08-06 01:34:14 -06:00
Vikram Kushwaha
79b93923d2 Add changes for SPV_EXT_shader_atomic_float_add 2020-07-22 05:52:22 -07:00
John Kessenich
3d2391fb25 GLSL/SPV: Propagaet precision qualifier from function to return value.
When a return value's type has no precision qualification (e.g., the return
expression is formed from a constructor), and the formal function return type
has a precision qualification, back propagate that from the return type to the
type of the return value's expression.
2020-07-15 23:38:47 -06:00
Ben Clayton
f429b72298 runtests: Check error codes, set LD_LIBRARY_PATH
`glslangValidator` will only return [the codes 0..6](b481744aea/StandAlone/StandAlone.cpp (L117-L125)). Fail the test if anything else is returned (like due to the exe crashing).

Also set `LD_LIBRARY_PATH` to contain the `lib` directory before calling glslang.
2020-07-15 11:59:44 +01:00
John Kessenich
f80ef74c80 Fix recently found non-determinism with gl_WorldToObject3x4EXT. 2020-07-14 01:44:35 -06:00
John Kessenich
4e13c90944 Fix #2329: don't use invalid initializers. 2020-07-13 00:35:58 -06:00
John Kessenich
a70f7dea77
Merge pull request #2268 from lriki/hlsl-pack_matrix
HLSL: Fix #pragma pack_matrix(row_major) not work on global uniforms
2020-07-02 05:21:45 -06:00
John Kessenich
863ea235bb SPIRV-Tools and tests: Update to location-validation in SPIRV-Tools.
This introduces five new "Validation failures":
- baseResults/hlsl.semantic.vert: issue with gl_ClipDistance/CullDistance
- baseResults/spv.430.vert: issue gl_ClipDistance
- baseResults/spv.450.tesc: still unknown
- baseResults/spv.dataOut.frag: gl_FragData should not be supported, problem with front end
- baseResults/spv.meshShaderPerViewUserDefined.mesh: seems okay, maybe a problem with SPIRV-Tools
2020-07-01 07:18:57 -06:00
John Kessenich
f6facfa189 Tests: More broadly use automapping binding/location.
This adds or changes binding/location decorations in 100s of shaders.
It also allows more output (spv.register.autoassign.rangetest.frag)
due to allowing ioMap() to fail.
2020-07-01 06:40:13 -06: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
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
lriki
1ee750aed5 Add pack_matrix test 2020-06-25 17:54:16 +09:00
Graeme Leese
182ab460d9 Update test expected files with new magic number
Updating the SPIR-V generator version number changes the output of all
the SPIR-V tests.
2020-06-22 11:49:38 +01:00
Graeme Leese
ff4b156e91 Update test results to expect OpFUnordNotEqual 2020-06-22 10:59:34 +01:00
rdb
ebf55a0711
HLSL: Fix incorrect case in name of DX9-style cube sampler type (#2265) 2020-06-15 06:39:43 -06: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
Roy.li
08328fea5a
Fix xfb stride limit issue (#2088)
* Fix xfb_stride limit issue

Unsized array can't apply to transform trace. layout qualifier "offset" require GL_ARB_enhanced_layouts enable or glsl core version > 440.

* Add negative test for xfb limit

* update case result

* Fix compile information issue

Fix compile information issue and test comment issue.

* remove es profile condition, use profileRequires to limit.

* Fix xfb_stride limit issue

Unsized array can't apply to transform trace. layout qualifier "offset" require GL_ARB_enhanced_layouts enable or glsl core version > 440.
Add negative test for xfb limit

* Move es profile check out of version number check

* Adjust error information and related cases

remove the new version check, refine original version check.

* Revert condition for vulkan, and remove redundant test code.
2020-06-09 02:30:14 -06:00
Chow
8111268575
Add Shared/Std140 SSBO process & top-level array elements related (#2231)
* Add Shared/Std140 SSBO process & top-level array elements related
process

1.Add process options for shared/std140 ssbo, following ubo process
2.Add IO Variables reflection option, would keep all input/output
variables in reflection
3.Add Top-level related process, fix top-level array size issues,
following spec
4.Split ssbo/ubo reflection options, merge blowup expanding all into
function blowupActiveAggregate to allow other functions keep same entry
format.

Add options in StandAlone and test symbols.

1. Add options in StandAlone for std140/shared ubo/ssbo and all io variables reflection.
2. Add test for ssbo. When EShReflectionSharedStd140SSBO turns on, generated symbol and output would be different, to remind the difference. Defaultly disabled and nothing would change, nor blocking normal test.

* Add options in runtest script, refresh test results.

Add options in StandAlone:
--reflect-all-io-variables --reflect-shared-std140-ubo --reflect-shared-std140-ssbo

refresh test results.
Now the index, size of unsized array are expected.
2020-06-04 01:47:18 -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
78a3c915a1
HLSL: Add better diagnostic when using in/out qualifiers in global scope (#2258) 2020-06-02 00:32:35 -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
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
greg-lunarg
e00d27c6d6
Fix missing patch decoration for TessFactor PCF arg (#2249)
Fixes #1553
2020-05-27 22:12:42 -06:00
alan-baker
2b0eafb1de
Update spirv tools (#2246)
* Update known good SPIRV-Tools

* Update test expectations
2020-05-25 10:18:42 -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
Malcolm Bechard
6f723ebbe3
fix incorrect error when multiple compilation units don't declare layouts (#2238)
when using multiple compilation units, input/output layouts don't need
to be declared in every unit.
2020-05-21 00:10:33 -06:00
Chow
0ab78114a9
Add check for DOUBLE in low versions (#2223)
Add check for DOUBLE in low versions, fix issue #2206
2020-05-18 03:41:52 -06:00
greg-lunarg
7c753a7253
Flatten all interface variables (#2217)
Specifically, add flattening of arrayed io for geometry and
tesselation shaders. Previously some interface structs just had
builtins split out which caused some interfaces to not be exactly
the same as that of flattened adjacent stages, affecting validation
and correctness.

This obviates builtin splitting. That will be removed in a followup
commit. It was left in for this commit to better exhibit the functional
changes that were made.

Fixes #1660.
2020-05-18 02:13:10 -06:00
Roy.li
24dcbd1b1f
Reserve unused std140 uniform block in reflection, and fix uniform block matrix layout (#2041)
According to the spec glsl4.60.7:
4.4.5. Uniform and Shader Storage Block Layout Qualifiers:
"The packed qualifier overrides only std140, std430, and shared; other qualifiers are inherited.
When packed is used, no shareable layout is guaranteed. The compiler and linker can optimize
memory use based on what variables actively get used and on other criteria. Offsets must be
queried, as there is no other way of guaranteeing where (and which) variables reside within the
block"

we should reserve std140 block and shared block in reflection.

According to the spec glsl4.60.7:
4.4.5. Uniform and Shader Storage Block Layout Qualifiers:
"The row_major and column_major qualifiers only affect the layout of matrices, including all
matrices contained in structures and arrays they are applied to, to all depths of nesting. These
qualifiers can be applied to other types, but will have no effect."

We need ensure all matrix block member been effect.

Support EShMsgKeepUncalled in reflection

EShMsgKeepUncalled  is a link message for link program.
We need only one option to control uncalled function optimization.
If we set EShMsgKeepUncalled as false in link time, linker won't be keep the uncall function sequence in AST,  and if we set EShMsgKeepUncalled as true in link time, linker will keep all uncalled function sequence in AST.
So, in reflecte time, we just only travers all function sequence. It make EShMsgKeepUncalled  only work at linker, and can effect reflection.

Recursively layout packing to "block member"

layout packing isn't set recursively, it causes TReflection::getOffsets doesn't work correctly.
2020-05-15 02:26:48 -06:00
Jaebaek Seo
08a05bc2b9
Move to newer version of SPIRV-Tools
* Update tests according to spirv-opt update

We refactored function inlining pass of spirv-opt and it results in
different numbering of result ids in SPIR-V code. This commit updates
test cases to avoid a test failure according to the spirv-opt update.

* Update known good
2020-05-14 11:06:05 -06:00
John Kessenich
b5f003d7a3 Fix #2191: Error check for indexing reference containing unsize array. 2020-05-01 08:19:59 -06:00
John Kessenich
7c4dc1299e
Merge branch 'master' into GL_EXT_blend_func_extended 2020-05-01 02:41:31 -06:00
Pankaj Mistry
e05cc20ec2 Add support for es extension GL_EXT_blend_func_extended
* Introduces builtin variables gl_SecondaryFragColorEXT and gl_SecondaryFragDataEXT
* Introduces builtin constant gl_MaxDualSourceDrawBuffersEXT
* enables support for layout qualifier "index" in es profile
2020-04-30 23:21:14 -07:00
John Kessenich
9fcc078724
Merge branch 'master' into GL_EXT_shader_implicit_conversions 2020-04-30 23:09:13 -06:00
pmistryNV
2c53baedbb
Add support for extension GL_EXT_shader_integer_mix (#2203) 2020-04-30 22:41:33 -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
pmistryNV
39281fb710
Add support for extension GL_ARB_vertex_attrib_64bit (#2193) 2020-04-29 06:58:49 -06:00
pmistryNV
f03cb290ac
Add support for extension GL_ARB_texture_query_lod. (#2194) 2020-04-27 23:46:54 -06:00
pmistryNV
ea50f6d77e
Add support for extension GL_ARB_shading_language_packing (#2192) 2020-04-27 02:46:32 -06:00
pmistryNV
7d65f09b83
Add support for extension GL_ARB_shader_storage_buffer_object (#2184)
Enable below features for GL Core version 420:
* layout qualifier "std430"
* storage qualifier "buffer"
* atomic memory functions
2020-04-22 22:46:52 -06:00
pmistryNV
3f4e5c4563
Add support for extension GL_ARB_shader_image_size (#2185) 2020-04-19 20:47:54 -06:00
pmistryNV
9f46e3dd5e
Add support for extension GL_ARB_shader_bit_encoding (#2183) 2020-04-17 05:24:12 -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
John Kessenich
4657244018 Fix #2178: Allow specialization constants for texel offsets. 2020-04-12 22:57:07 -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
9c3204a1fd Error message: Finish addressing #2097, better texture error message. 2020-04-07 02:18:23 -06:00
Malcolm Bechard
0b66fa3b62
Shader interface matching rework to fix #2136 (#2156)
* rework how shader interface block naming rules are handled

* Fixes 2136

According to the spec, shader interfaces (uniform blocks, buffer
blocks, input blocks, output blocks) all should be matched up via
their block names across all compilation units, not instance names.
Also, all block names can be re-used between all 4 interface types
without conflict. This change makes it so all of these blocks are
matched and remapped using block name and not by instance name.
Additional the rule that matched uniform and buffer blocks must
either be anonymous or named (but not nessearily the same name) is
now imposed.

* add warning if instance names differ between matched shader interfaces

* Add test cases from #2137 which is now fixed as well.

* replace some tab characters with spaces

* buffer blocks and uniform blocks now share the same block namespace
2020-04-02 02:03:53 -06:00
alelenv
f986436a90 Error assigns to objects of rayQueryEXT type. 2020-03-30 10:24:30 -07:00
Neslisah Torosdagli
915f119199 accelerationStructureEXT - issue #2152 2020-03-26 18:51:18 -04: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
7f689bebec const rayFlag defs used in the test cases in stead of numerical values 2020-03-23 23:09:44 -04:00
Neslisah Torosdagli
2fb45def04 rayQuery test cases added 2020-03-23 21:34:09 -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
50a722818b GL_EXT_ray_query glslang updates, and test cases added. 2020-03-20 18:23:27 -04:00
John Kessenich
3f7c957e0a Fix #2132: constant matrix constructor from single non-scalar argument 2020-03-19 16:46:30 -04:00
John Kessenich
8c21e0a250 Fix #2132: constant matrix constructor from single non-scalar argument 2020-03-18 10:27:59 -06:00
Daniel Koch
db32b243ff Add support for GLSL_EXT_ray_tracing
and SPV_KHR_ray_tracing
2020-03-17 20:42:47 -04:00
Jeff Bolz
40007b862d Forbid memoryBarrierAtomicCounter for Vulkan compiles 2020-03-16 23:53:04 -05:00
Malcolm Bechard
4b2483ee88
Fix #2005. Allow multiple compilation units to declare identical push_constant blocks (#2123)
* Fixes #2005

Allow multiple units in a stage to have push_constants as long
as the blocks match.
Requires #2006 to be fixed to be functional.

* tweaks to #2005 fix after some testing

* add unit tests for push constants across multiple compilation units

For #2005

* update reference output for tests that fail validation

* fix uninitialized result.validationResult
2020-03-16 08:51:15 -06:00
Jeff Bolz
ad3f10bbd0 EXT_debug_printf - make escape sequences better match C/C++ 2020-03-10 10:23:07 -05:00
John Kessenich
dbb56a1d48
Merge pull request #2105 from jeffbolznv/nonunif
Allow nonuniformEXT() on sampler types
2020-03-10 03:50:27 -06:00
Jeff Bolz
13444545a9 disable escape sequences for #line and #error 2020-03-09 21:09:18 -05: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
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
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
c12493ff69
Merge pull request #2086 from samuelig/SPV_AMD_shader_image_load_store_lod
SPV_AMD_shader_image_load_store_lod is now validated by spirv-tools
2020-02-19 23:25:39 -07:00
Samuel Iglesias Gonsálvez
a515fff401 SPV_AMD_shader_image_load_store_lod is now validated by spirv-tools 2020-02-20 06:57:49 +01:00
John Kessenich
abfc4c2ceb Fix part of #2070: Correctly handle promotion for <unary-op>(int).
This still only handles a scalar correctly, and some
vector cases need additional fixes.
2020-02-18 06:53:39 -07:00
John Kessenich
2d70e98dea
Merge pull request #2028 from ShchchowAMD/constant_expressions_array_mod
GLSL: Support constant folding for mod
2020-02-06 02:56:37 -07:00
Rex Xu
b4bab3ce01 Fix a parser error of GL_KHR_memory_scope_semantics
When 2DMS or 2DMSArray is used, IMAGE_PARAMS will take an additional
paramter to represent sample number. The semantics check should get the
correct semantics values, taking this case into account.
2020-02-06 16:51:10 +08:00
John Kessenich
b0ada80356 HLSL: Fix #1974: ignore input primitives on non-entry-point functions. 2020-01-17 00:14:51 -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
John Kessenich
5181367062
Merge pull request #1998 from ShchchowAMD/ARB_gpu_shader_fp64
Add support for ARB_gpu_shader_fp64
2020-01-08 06:18:44 -07:00
John Kessenich
6f98892dd1 Fix #1829: Add "--" command-line options for macro def/undef.
This allows OpModuleProcessed logging to be consistent with everything taking
"--" options.
2020-01-08 01:28:45 -07:00
John Kessenich
1d258ac346
Merge pull request #2032 from ShchchowAMD/atomic-uint-binding
Modify max binding checks for atomic_uint
2020-01-06 23:49:23 -07:00
Chow
ac6b7cf581 Add builtin constants
Add builtin constants:

gl_MaxFragmentUniformVectors and gl_MaxVertexUniformVectors.
They should both be available since version 410 for core.
2020-01-06 15:53:20 +08:00
Chow
a3c7a25e10 Add support for ARB_gpu_shader_fp64
GLSL Version : >= 150

Purpose:
Allow users to use features by enabling this extension, even in low versions.

Extension Name:
ARB_gpu_shader_fp64

Builtin-variables:
Nah

Builtin-functions:
functions overloaded for this extension, please check registry in reference.

Keywords:
Double

Features:
add support for type "double"

Reference:
https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_gpu_shader_fp64.txt

Add support for implicit conversion

1. Remove builtin double vertex (this is introduced by vertex_attrib_64bit
2. Add extension check and implicit conversion as double has been introduced
3. Add test results.
2020-01-06 11:08:20 +08:00
John Kessenich
930403e5b3
Merge branch 'master' into ARB_uniform_buffer_object 2019-12-29 21:32:41 -07:00
John Kessenich
18fb7f24b8
Merge pull request #1996 from ShchchowAMD/ARB_texture_multisample
Add support for ARB_texture_multisample
2019-12-29 20:19:39 -07:00
John Kessenich
c674299ddb
Merge pull request #2036 from ShchchowAMD/fix_atomic_uint_offset_check
atomic counter offset should align to 4 (compute shader)
2019-12-29 19:49:16 -07:00
John Kessenich
01aee059f5
Merge pull request #1995 from ShchchowAMD/ARB_sample_shading_support
Add support for ARB_sample_shading
2019-12-29 19:35:18 -07:00
John Kessenich
5de15a256e HLSL: Fix #2037: Integer dot used incorrect input for adds. 2019-12-26 10:56:54 -07:00
Chow
5db058c020 atomic counter offset should align to 4
atomic counter offset should align to 4
Ref:
glspec46.core - 6.8 BufferObjectState
offset restriction multiple of 4
2019-12-25 17:27:45 +08:00
Chow
891ec09c62 Modify atomic_uint binding check
Modify atomic_uint binding check.

Currently, when not declared with offset, default atomic_unint won't check whether its binding is valid or not more than its limit value.
2019-12-25 17:08:48 +08:00
Chow
97c4c0936f Add support for ARB_uniform_buffer_object
GLSL Version : >= 120

Purpose:
Allow users to use features by enabling this extension, even in low versions.

Extension Name:
ARB_uniform_buffer_object

Builtin-variables:
Uniform

Builtin-functions:
Nah

Keywords:
Nah

Features:
uniform block

Reference:
https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_uniform_buffer_object.txt
2019-12-23 16:30:12 +08:00
Chow
a8f9886cc6 Add support for ARB_texture_multisample
GLSL Version : >= 140

Purpose:
Allow users to use features by enabling this extension, even in low versions.

Extension Name:
ARB_texture_multisample

Builtin-variables:
Nah

Builtin-functions:
Nah

Keywords:
      sampler2DMS, isampler2DMS, usampler2DMS,
      sampler2DMSArray, isampler2DMSArray, usampler2DMSArray

Reference:
https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_texture_multisample.txt
2019-12-23 15:37:04 +08:00
Chow
78b1180466 Add support for ARB_sample_shading
Version : >= 130

Extension Name: ARB_sample_shading

Builtin-variables:
"gl_SampleID"
"gl_SamplePosition"
"gl_SampleMask"
"gl_NumSamples"

Reference:
https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_sample_shading.txt
2019-12-23 14:34:38 +08:00
Chow
44e842cd9c Add constant expression with mod
Purpose:
glsl spec allows to define array with the length of the result of  constant expression, the arithmetic operation of "mod(float (7.1), float (4.0))" should be generate the array length at the shader compile time,

but glslang didn't support mod operation for the constant expression in previous implementation;

An example is as following:

###########
#version 460
flat out highp int vtx_out_out0;
void main (void)
{
     float array[int(mod(float (7.1), float (4.0)))];
     vtx_out_out0 =  array.length();
}
###########
2019-12-23 11:29:52 +08:00
Ian Romanick
fbcdcac254 INTEL_shader_integer_functions2: Add compiler front-end support
The changes to glslang/glslang/MachineIndependent/ParseHelper.cpp exist
purely to prevent even more instances of "warning: enumeration value
‘EOp...’ not handled in switch"

v2: Remove 8-bit types.  Overzealous copy-and-paste led to adding
support for a bunch of types that the extension doesn't actually enable.

v3: Update expected test results file.  Just changing an expected
results file to make a test pass seems sketchy to me, but I'm not sure
what else to do.

v4: Add missing entry for EOpAbsDifference in
TOutputTraverser::visitBinary.  Noticed by JohnK.
2019-12-03 11:06:34 -08:00
John Kessenich
38b4db48f9 Fix #1983: __ is okay starting with ES 300, rather than 310. 2019-11-23 01:29:02 -07:00
John Kessenich
86258aab80
Merge pull request #1972 from andflo-Arm/master
Fix construction issue for 8 and 16 bit types.
2019-11-22 21:38:36 -07:00
John Kessenich
3c0d2e5b67 HLSL: Fix #1976: Don't let ENABLE_HLSL change struct/class layout. 2019-11-15 05:01:27 -07:00
Andreas Flöjt
cb563e68d2 Add a test for 8- and 16-bit construction. 2019-11-14 14:41:52 +01:00
John Kessenich
e7cb9cb9c4 HLSL: Fix #1960: fmod() was not converting int args to float. 2019-11-12 05:32:51 -07:00
John Kessenich
18d6b6b63e Tests: Add more test results for the previous generator version bump. 2019-11-03 00:22:47 -06: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
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
John Kessenich
61c22e255d Web: Add separate texture/sampler, exclude *CubeArray*.
Looks like will add about 1K compressed size to executable footprint.
2019-10-23 00:25:38 -06:00
Jeff Bolz
016ddee83a Only apply volatile semantics to atomics when using Vulkan Memory Model 2019-10-17 11:22:57 -05:00
Dan Sinclair
3290d38011 Use commandline options instead of ENV variables 2019-10-16 13:08:48 -04:00
Dan Sinclair
3f072e158c Move TARGETDIR as well 2019-10-15 16:47:28 -04:00
Dan Sinclair
167201430d Make runtests configurable.
This CL allows setting the location of glslangValidator and spirv-remap
when calling the runtests script. A test target is added to CMake to
execute runtests and sets the location to the build folder for the two
applications.
2019-10-15 15:21:21 -04:00
John Kessenich
765cee8441 GLSL/SPV: Pre SPIR-V 1.5, subgroupQuadBroadcast index must be constant 2019-10-14 23:08:26 -06:00
John Kessenich
101ca388fb
Merge pull request #1880 from georgeouzou/master
Add support for GL_ARB_explicit_uniform_location
2019-10-12 08:24:11 -06:00