Commit Graph

62 Commits

Author SHA1 Message Date
Spencer Fricke
bc5c8760af
spirv-val: Add Vulkan decoration interface (#4831) 2022-07-07 13:03:52 -04:00
stu-s
c267127846
Add SPV_KHR_fragment_shader_barycentric support (#4805)
* Add SPV_KHR_fragment_shader_barycentric support
2022-05-25 09:20:39 -04:00
Daniel Koch
9e377b0f97
spirv-val: Add CullMaskKHR support (#4792)
Co-authored-by: sfricke-samsung <s.fricke@samsung.com>
2022-05-06 07:32:56 -04:00
David Neto
df2aad68b9
val: interface struct with builtins must be Block (#4665)
For a shader input/output interface variable of structure type:
If the structure has BuiltIn members, then the structure type
must be Block decorated.

Otherwise, the variable, or the struct members must have locations,
but nothing can have both a location be a BuiltIn.

Implements validation needed to reject the example in
https://github.com/KhronosGroup/SPIRV-Registry/issues/134
2021-12-16 16:48:12 -05:00
alan-baker
339d4475c1
Improve decoration validation (#4490)
Fixes #4469

* Checks that decorations only usable with structure members are not
  used by OpDecorate or OpDecorateId
* Checks that decorations not allowed on structure members are not used
  with OpMemberDecorate
* Checks decoration targets for most core decorations
* Performs some Vulkan specific validation on deorations
2021-11-05 13:18:19 -04:00
sfricke-samsung
d699296b4d
spirv-val: Fix WorkgroupSize VUID 04425 (#4482) 2021-08-19 16:06:01 -04:00
sfricke-samsung
693d564db4
spriv-val: Fix clang-format bug for VUID string (#4238) 2021-04-16 08:52:48 -04:00
sfricke-samsung
f37547c73a
spirv-val: Add Vulkan EXT builtins (#4115) 2021-01-20 10:40:31 -05:00
Ryan Harrison
9150cd441f
Remove WebGPU support (#4108)
Leaves SPV_ENV_WEBGPU_0 enum in place, but marked deprecated, so users
of the library are not broken by an API enum being removed.

Fixes #4101
2021-01-14 16:45:18 -05:00
sfricke-samsung
17ffa89097
spirv-val: Add first StandAlone VUID 04633 (#4077) 2020-12-17 13:51:17 -05:00
sfricke-samsung
8f4b35c332
spirv-val: Add Subgroup VUIDs (#4074) 2020-12-17 08:37:43 -05:00
sfricke-samsung
3b85234542
spirv-val: Add last TessLevelOuter and TessLevelInner VUID (#4055) 2020-12-08 14:38:55 -05:00
sfricke-samsung
171290703a
spirv-val: Add last ClipDistance and CullDistance VUID (#4054) 2020-12-08 14:37:24 -05:00
sfricke-samsung
1a6b4053fa
spirv-val: Add last ViewportIndex and Layer VUID (#4053) 2020-12-08 14:34:51 -05:00
sfricke-samsung
9df5225e67
spirv-val: Add last Position VUID (#4052) 2020-12-08 14:31:40 -05:00
Daniel Koch
32573bb216
Add validation support for the ray tracing built-in variables (#4041)
* Add validation for ray tracing builtins

- Remove existing InstanceId testing that was combined with VertexId in awkward ways.
- Rather than adding a new set of functions for each ray tracing builtin, add
  an error table that maps the builtin ID to the 3 common VUIDs for each builtin
  (I could see this being extended for other builtins in the future).
- add F32 matrix validation function
- augment existing PrimitiveId validation to verify Input storage class for the
  RT stages this is accepted in, and correct the list of stages that it is actually
  accepted in (only Intersection / Any Hit / Closest Hit)

* add testing for ray tracing builtins

- remove exising InstanceId testing as it was tangled in with VertexId in now weird ways
  and combine it with the new tests
- add testing for ray tracing builtins
- builtins accepted in the same stages and of the same types are combined into test functions
- add some new matrix types to the code generator so they can be used for testing
2020-12-01 11:42:37 -05:00
sfricke-samsung
a61d07a727
spirv-val: Fix SPV_KHR_fragment_shading_rate VUID label (#4014)
in 3943 the new tests should have failed, but didn't due to the AnyVUID
check not handling case with trailing whitespace. Added trimming to handle
it as easily might happen again in future
2020-11-05 13:04:47 -05:00
sfricke-samsung
650acb575b
spirv-val: Label Layer and ViewportIndex VUIDs (#4013) 2020-11-05 13:04:07 -05:00
Sidney Just
5edb328e81
spirv-val: Allow the ViewportIndex and Layer built-ins on SPIR-V 1.5 (#3986)
* spirv-val: Allow the ViewportIndex and Layer built-ins when their corresponding SPIR-V 1.5 capabilities are present
* Added tests for OpCapability ShaderViewportIndex and OpCapability ShaderLayer
2020-10-28 14:05:06 -04:00
Tobski
a1d38174b1
Support SPV_KHR_fragment_shading_rate (#3943) 2020-10-20 08:00:13 -04:00
sfricke-samsung
937a757f04
spirv-val: Add DeviceIndex (#3812) 2020-09-17 08:27:40 -04:00
sfricke-samsung
5df9300549
spirv-val: Add BaseInstance, BaseVertex, DrawIndex, and ViewIndex (#3782)
* spirv-val: Add BaseInstance and BaseVertex

* spirv-val: Add DrawIndex

* spirv-val: Add ViewIndex
2020-09-14 10:23:44 -04:00
sfricke-samsung
2c60d16a64
spirv-val: Add Vulkan VUID labels to BuiltIn (#3756)
The Vulkan 1.2.152 headers/spec now include Valid Usage IDs (VUID)
for every BuiltIn. This change adds labeling to help aid tracking
the coverage gap in Vulkan targeted validation. This is done with
a script in the Validation Layers that parses the source for VUID
strings, both that there is an implementation and a test for it.

There are 2 main changes:

1. A VUID string is added where applicable. It is wrapped in a function
that at runtimes checks if Vulkan is the target so that other targets
will not be effected as the output error only changes for Vulkan and
the overhead only occurs if there is an error at all.

2. For unit test, a new parameter value was added to allow make sure
that for each VUID there is a matching test. There are cases where the
same unit test checks multiple VUs via the parameter feature of gtest.
For this, I added a custom gMock Matcher to simply loop over a list
of VUID strings
2020-09-02 14:02:13 -04:00
alan-baker
a1fb255a2a
Validate location assignments (#3308)
* Add validation that input/output locations are assigned correctly
* Account for component assignment
* Account for 4 components per location and track the combined
coordinate
* Account for multiple output indexes
* handle specifically arrayed variables
* Arrayed variables that specify a component get locations determined
per index of the array for the sub type
  * Added tests that check locations and components can be assigned
  to interleave an array's locations and components
* Fix up which interfaces are allowed to be arrayed for various shader
stages based on glslang
2020-06-25 13:22:45 -04:00
dan sinclair
52a5f074e9
Update access control lists. (#3433)
This CL updates the access control lists used in SPIRV-Tools to the more
descriptive allow/deny naming.
2020-06-15 13:20:40 -04:00
alan-baker
a464ac1a27
Add generic builtin validation of target (#2843)
* Validate the target's opcode is acceptable
* Update tests
* New tests
* move early exit for builtins a bit later in the pass
2019-09-09 14:53:30 -04:00
alan-baker
b4bf7bcf0a
Add validation for Subgroup builtins (#2637)
Fixes #2611

* Validates builtins in the Vulkan environment:
  * NumSubgroups
  * SubgroupId
  * SubgroupEqMask
  * SubgroupGeMask
  * SubgroupGtMask
  * SubgroupLeMask
  * SubgroupLtMask
  * SubgroupLocalInvocationId
  * SubgroupSize
2019-06-13 08:47:05 -04:00
Daniel Koch
0755d6ce82 Add builtin validation for SPV_NV_shader_sm_builtins (#2656)
Also add a Builtin test generator variant that takes
capabilities and extensions.

Tests
 - verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
   accepted as Inputs in Vertex, Fragment, TessControl, TessEval, Geometry,
   and Compute.
 - verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
   accepted as Inputs in MeshNV and TaskNV shaders.
 - verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
   accepted as Inputs in the 6 ray tracing stages
 - verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
   NOT accepted as Outputs.
 - verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
   NOT accepted as non-scalar integers (f32, uvec3)
 - verify that the SMCountNV, SMIDNV, WarpsPerSMNV, and WarpIDNV Builtins are
   NOT accepted as non-32-bit integers (u64)
2019-06-06 14:53:48 -04:00
Ryan Harrison
699e167d78
Remove asserts from GetUnderlyingType (#2646)
Fixes #2463
2019-05-31 08:57:41 -07:00
Sahil Parmar
b8fe7211c4 Allow arrays of out per-primitive builtins for mesh shaders (#2617)
- PrimitiveID, Layer, ViewportIndex
* Add validation tests for mesh builtins
2019-05-23 15:08:59 -04:00
Ryan Harrison
368567bc51
Convert deprecated GoogleTest fixture to the new version (#2357)
Fixes #2356
2019-02-05 10:33:55 -05:00
Steven Perron
453b7c85c8
Fix up some test (#2351)
I made a mistake merging a PR, and it contained tests that break with
the latest google test.  I've fixed them up.
2019-01-31 16:44:15 -05:00
Ryan Harrison
2acbf488b8
Add WebGPU specific validation for WorkgroupSize BuiltIn decoration (#2334)
Part of resolving #2276
2019-01-30 17:01:17 -05:00
Ryan Harrison
e2f4622627
Add WebGPU specific validation for multiple BuiltIn decorations (#2333)
Covers NumWorkgroups, LocalInvocationId & GlobalInvocationId

Part of resolving #2276
2019-01-30 17:00:58 -05:00
Ryan Harrison
3d2afb78c2
Add whitelist of allowed BuiltIn decorations for WebGPU (#2337)
Part of resolving #2276
2019-01-30 15:46:02 -05:00
Ryan Harrison
d17fcf8abd
Add WebGPU validation for LocalInvocationIndex BuiltIn decoration (#2335)
Part of resolving #2276
2019-01-30 15:45:31 -05:00
Ryan Harrison
837153ccdd
Add WebGPU specific validation for FragDepth BuiltIn decoration (#2332)
Part of resolving #2276
2019-01-30 15:27:04 -05:00
Ryan Harrison
0c14583f15
Add WebGPU specific validation for FragCoord BuiltIn decoration (#2331)
Part of resolving #2276
2019-01-30 14:53:43 -05:00
Ryan Harrison
b6698e0d83
Add WebGPU specific validation for FrontFacing BuiltIn decoration (#2330)
Part of resolving #2276
2019-01-30 14:48:43 -05:00
Ryan Harrison
734def1447
Add WebGPU specific validation for InstanceIndex BuiltIn decoration (#2329)
Part of resolving #2276
2019-01-30 14:20:55 -05:00
Ryan Harrison
b947ecfe79
Add WebGPU specific validation for VertexIndex BuiltIn decoration (#2328)
Part of resolving #2276
2019-01-30 12:22:30 -05:00
Steven Perron
464111eaef
Remove use of deprecated googletest macro (#2286)
* Remove use of deprecated googletest macro

INSTANTIATE_TEST_CASE_P has been deprecated.  We need to use
INSTANTIATE_TEST_SUITE_P instead.

* Remove extra commas from test suites.
2019-01-29 18:56:52 -05:00
Ryan Harrison
5d6b4c4b1b
Move CodeGenerator to be accessible by other validation tests (#2343)
Fixes #2342
2019-01-29 10:27:11 -05:00
Ryan Harrison
1e3c589a6d
Add WebGPU specific validation for Position BuiltIn decoration (#2309)
This CL adds in the specific checks required for WebGPU, enables
running the builtin checks for WebGPU, and refactors the existing
testing infrastructure to support testing the new checks.

This PR is part of resolving #2276
2019-01-24 12:08:25 -05:00
Alejandro Lopez
03afee3b90 Test for WorkgroupId not being a uvec3 (#2173)
Test for WorkgroupId not being a uvec3

Fixes #1545

Make %workgroup_id an Input variable as required by spec
2018-12-05 16:34:57 -05:00
alelenv
f989b2dbd7 Add precise check for allowing use of gl_InstanceID for specific vulkan raytracing stages . (#2096)
* Checks that gl_InstanceID is only used in specific execution models
2018-11-27 08:35:29 -05:00
fjhenigman
ab76e332de
Validate uniform variable type in Vulkan (#1949) (#2055)
From the Vulkan 1.1 spec 14.5.2:
  Variables identified with the Uniform storage class are used to access
  transparent buffer backed resources. Such variables must be typed as
  OpTypeStruct, or an array of this type.

Fixes #1949
2018-11-15 13:42:17 -05:00
alan-baker
5c334514d6
Allow InstanceId for NV ray tracing (#2049)
* Allow InstanceId for NV ray tracing

Fixes #2046

* Allows InstanceId in the Vulkan environment if RayTracingNV
capability is specified
2018-11-14 15:03:40 -05:00
Ryan Harrison
a362e60d5a
Validate variable types for UniformConstant storage in Vulkan (#2008) (#2044)
Validate variable types for UniformConstant storage in Vulkan (#2008)

From the Vulkan 1.1 spec 14.5.2:
  Variables identified with the UniformConstant storage class are used
  only as handles to refer to opaque resources. Such variables must be
  typed as OpTypeImage, OpTypeSampler, OpTypeSampledImage, or an array
  of one of these types.

Fixes #2008
2018-11-14 15:00:03 -05:00
Neil Henning
2b1f6b373c Validate that VertexId and InstanceId are not allowed in Vulkan. (#2036)
The Vulkan specification does not permit use of the VertexId and
InstanceId BuiltIn decorations, so add a check to ensure they are not
being used when the target environment is Vulkan.
2018-11-13 09:22:48 -05:00