Commit Graph

18 Commits

Author SHA1 Message Date
David Neto
97d06a36b0 Mere mention of PointSize BuiltIn does not require Shader capability
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/365 which
was reopened for this.
2016-08-24 10:04:17 -04:00
David Neto
358cb2940a Relax ClipDistance, CullDistance capability check in all environments
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/365
2016-08-23 18:41:44 -04:00
David Neto
06581f5ce6 Turn off ClipDistance CullDistance cap checks for Vulkan
Turn them off until resolution of the debate over how they should be checked.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/261
2016-07-08 11:47:40 -04:00
David Neto
e461cbe268 Avoid capability checks on ID values. They are not literals
Works around issue 248 by weakening the test:
https://github.com/KhronosGroup/SPIRV-Tools/issues/248

The validator should try to track (32-bit) constant values, and then
for capability checks on IDs, check the referenced value, not the
raw ID number.
2016-06-29 10:39:21 -04:00
Umar Arshad
886dd352d5 Fix several violations of the style guide 2016-06-27 10:45:46 -04:00
Umar Arshad
90a4252aae Split validate_types file into multiple classes
Creates separate files for the ValidationState, Function and
BasicBlock classes.
2016-06-08 14:40:33 -04:00
Umar Arshad
00b72c2995 Remove redundant in_block function from Function
Same test can be done through the get_current_block function
2016-06-06 10:27:40 -04:00
Umar Arshad
0b9fd50d31 Control Flow Graph Validation 2016-06-02 12:11:52 -04:00
Florian Ziesche
66fcb456c1 bitcast fixes
* ValidationState_t and idUsage now store the addressing model and memory model of the SPIR-V module (this is necessary for certain instructions that need different checks depending on if the logical or physical addressing model is used)
 * removed SpvOpPtrAccessChain and SpvOpInBoundsPtrAccessChain from spvOpcodeIsPointer again as these are disallowed in logical addressing mode and only allowed in physical addressing mode (which doesn't use/need spvOpcodeIsPointer in the first place)
 * added SpvOpImageTexelPointer and SpvOpCopyObject to spvOpcodeIsPointer
 * OpLoad/OpStore now only check if the used pointer operand originated from a valid pointer producing opcode in logical addressing mode (as per 2.16.1)
 * moved bitcast pointer tests to the kernel / physical addressing model part (+cleanup)
 * renamed spvOpcodeIsPointer to spvOpcodeReturnsLogicalPointer to clarify this function is only meant to be used with the logical addressing model
2016-04-29 14:55:05 -04:00
Lei Zhang
6fa3f8aad9 Remove dependency on SPIR-V headers in libspirv.h.
For fulfilling this purpose, the |opcode| field in the
|spv_parsed_instruction_t| struct is changed to of type uint16_t.

Also add functions to query the information of a given SPIR-V
target environment.
2016-04-04 10:34:28 -04:00
Lei Zhang
b6ccd0d891 Remove spv_validate_options_t and change tests accrodingly.
Users always want to run all the checks. The spv_validate_options_t
mechanism, which provides little benefits to users, complicates the
internal implementation and also makes the tests exercise different
paths as users do.

Right now the tests are more like integration tests instead of
unit tests, which should be our next refactoring aim.
2016-02-23 16:19:33 -05:00
David Neto
adb8725900 Validation of mask operand capabilities is more data driven
Use spvOperandIsConcreteMask to determine if an operand is
a bitmask.  Check its individual bits in a generic way.
2016-02-02 12:12:48 -05:00
Dejan Mircevski
0c8bdfe163 Use AssemblyGrammar for capability validation.
Also:
- ForEach() for spv_capability_mask_t.
- Add capability min/max constants.
- Move max definition from validate_types.cpp to spirv_definition.h.
2016-02-02 11:40:05 -05:00
Dejan Mircevski
5f99fc33cd Forbid Generic variables. 2016-01-29 17:08:41 -05:00
Dejan Mircevski
8177fbea06 Fix in-function storage class validation.
Move tests into a fixture that properly turns on the relevant passes.
2016-01-29 16:30:23 -05:00
Umar Arshad
61a627586b Initial capability implementation and unit tests
* Register capabilility and checks
* Add validate storage class capabilities checks and tests
* Instruction pass refactor
  - More generic form of capability checking by checking operands
    instead of instructions
* Execution Model capabilities checks
* Decorate BuiltIn capability checks
* Addressing Model capability checks
* Memory Model capability checks
* Execution Mode capability checks
* Dim capability checks
* SamplerAddressingMode capability checks
2016-01-27 08:37:23 -05:00
Dejan Mircevski
961f5dc544 Track uses and defs during parsing.
Replace two other, imperfect mechanisms for use-def tracking.

Use ValidationState_t::entry_points to track entry points.

Concentrate undefined-ID diagnostics in a single place.

Move validate_types.h content into validate.h due to increased
inter-dependency.

Track uses of all IDs: TYPE_ID, SCOPE_ID, ...

Also update some blurbs.

Fix entry-point accumulation and move it outside ProcessIds().

Remove validate_types.h from CMakeLists.txt.

Blurb for spvIsIdType.

Remove redundant diagnostics for undefined IDs.

Join "can not" and reformat.
2016-01-20 17:00:58 -05:00
Umar Arshad
1ddeb246eb Validation refactor
* Organize passes into seperate files
* Remove module layout logic from Cfg pass
* Remove module layout logic from Functions class
* Refactor ModuleLayoutPass for readability
* Adapt consistent naming of layout sections (Stage/Section -> Section)
2016-01-14 21:59:28 -05:00