Commit Graph

16 Commits

Author SHA1 Message Date
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
Alan Baker
a77bb2e54b Add validation for execution modes
* Check rules from Execution Mode tables, 2.16.2 and the Vulkan
environment spec

* Allows MeshNV execution model with the following execution modes
 * LocalSize, LocalSizeId, OutputPoints and OutputVertices
 * Done to not break their validation
2018-10-02 10:22:23 -04:00
dan sinclair
eda2cfbe12
Cleanup includes. (#1795)
This Cl cleans up the include paths to be relative to the top level
directory. Various include-what-you-use fixes have been added.
2018-08-03 15:06:09 -04:00
dan sinclair
2cce2c5b97
Move tests into namespaces (#1689)
This CL moves the test into namespaces based on their directories.
2018-07-11 09:24:49 -04:00
Alan Baker
4f866abfd8 Validate static uses of interfaces
Fixes #1120

Checks that all static uses of the Input and Output variables are listed
as interfaces in each corresponding entry point declaration.
 * Changed validation state to track interface lists
 * updated many tests
* Modified validation state to store entry point names
 * Combined with interface list and called EntryPointDescription
 * Updated uses
* Changed interface validation error messages to output entry point name
in addtion to ID
2018-06-13 10:56:14 -04:00
Lei Zhang
b09e3ce842
Allow ViewportIndex & Layer to be used in VS/DS with extension
SPV_EXT_shader_viewport_index_layer enables using ViewportIndex
and Layer in vertex and tessellation shaders.

Also, as per the Vulkan spec:

> The ViewportIndex decoration must be used only within vertex,
> tessellation evaluation, geometry, and fragment shaders.

> In a vertex, tessellation evaluation, or geometry shader, any
> variable decorated with ViewportIndex must be declared using
> the Output storage class.

> In a fragment shader, any variable decorated with ViewportIndex
> must be declared using the Input storage class.

Similarly for Layer.
2018-05-16 13:16:27 -04:00
Alan Baker
0e80b86dbe Fixes #1472. Per-vertex variable validation fixes.
Relaxs checks for per-vertex builtin variables. If the builtin
decoration is applied to a variable, then those checks now allow a level
of arraying on the variable before checking the type consistency.

* Allows arrays of variables to be present for the per-vertex variables:
 * Position
 * PointSize
 * ClipDistance
 * CullDistance
* Updated tests
2018-04-16 12:58:35 -04:00
Alan Baker
c522b697bf Fixes #1470. Don't restrict WGS storage class
* Removed restriction that workgroup size can only be on Input storage
class
* added test
2018-04-12 09:22:34 -04:00
Lei Zhang
26a698c347 Fix PrimitiveId builtin check for Vulkan
According to Vulkan spec 1.1.72:

> The PrimitiveId decoration must be used only within fragment,
> tessellation control, tessellation evaluation, and geometry shaders.

> In a tessellation control or tessellation evaluation shader, any
> variable decorated with PrimitiveId must be declared using the Input
> storage class.

We were enforcing that PrimitiveId can only be used with Output
storage class for TCS and TES before.
2018-04-06 22:38:32 -04:00
Andrey Tuganov
d7fff408e3 Fix bug validate_builtins (additional def checks)
At every definition of a builtin id, run at-reference-check rules on the
defining instruction as well.

Previosly the validation was missing the case when invalid storage class
was defined in the instruction which defines the built-in, and not in
the instruction which references the built-in.
2018-04-05 13:55:18 -04:00
Andrey Tuganov
691eed92cb Fix major bug in validate_builtins
Fixed an early return in the loop, resulting in only one decoration
being checked.
2018-04-05 13:45:45 -04:00
Andrey Tuganov
da332cf332 Execution mode/model available in validation state
Refactored validate built-ins to make
GetExecutionModels(entry_point)
and
GetExecutionModes(entry_point)
available in validation state.

Entry points are allowed to have multiple execution modes and execution
models.

Finished the last missing feature in Vulkan built-ins validation:
FragDepth requires DepthReplacing.
2018-04-05 11:55:42 -04:00
Andrey Tuganov
fe9121f721 Add Vulkan validation rules for BuiltIn variables
Added a framework for validation of BuiltIn variables. The framework
allows implementation of flexible abstract rules which are required for
built-ins as the information (decoration, definition, reference) is not
in one place, but is scattered all over the module.

Validation rules are implemented as a map
id -> list<functor(instrution)>

Ids which are dependent on built-in types or objects receive a task
list, such as "this id cannot be referenced from function which is
called from entry point with execution model X; propagate this rule
to your descendants in the global scope".

Also refactored test/val/val_fixtures.

All built-ins covered by tests
2018-03-23 14:02:42 -04:00