Commit Graph

204 Commits

Author SHA1 Message Date
David Neto
ddda85a5c5 Fix capabilities for enums in Rev32, sec 3.3-3.20 2015-10-26 12:55:33 -04:00
David Neto
3d2bf53294 Move AutoText and EnumCase into spvtest namespace
Also fix using declaration order.
Also put a few tests into the anonymous namespace.
2015-10-26 12:55:33 -04:00
David Neto
104da61432 Update readme: Finish assembler !<integer> support
Also internal cleanups and additional tests.
2015-10-26 12:55:33 -04:00
Dejan Mircevski
78f6a4a649 Test operand-table capabilities. 2015-10-26 12:55:33 -04:00
David Neto
e3296f0945 Add TODO for fixing endianness testing.
Currently it uses a union, a write to one field, and read from
another of a different type.

Moves the endianness-determining macro close to the variable
it references.
2015-10-26 12:55:33 -04:00
David Neto
287fdb0eb0 Test SPV_CAPABILITY_AS_MASK macro 2015-10-26 12:55:33 -04:00
David Neto
0cd7352d7d Use 3-arg MakeInstruction to reduce logic in tests
Avoids open-coded vector inserts and two variables in various
tests.  Should improve readability.
2015-10-26 12:55:33 -04:00
Dejan Mircevski
924997dc7f Test opcode table capability entries. 2015-10-26 12:55:33 -04:00
Dejan Mircevski
205408bae4 Make capabilities a bitfield in opcode/operand tables. 2015-10-26 12:55:33 -04:00
Dejan Mircevski
4170ceca12 Create spv_language_capabilities_t and widen capabilities fields.
If this is acceptable, I'll do a wholesale switch of operand and opcode
definitions to capability bitfields.
2015-10-26 12:55:33 -04:00
David Neto
ff5dce48a1 Add assembler test for OpEnqueueKernel.
Adds a form of spvtest::MakeInstruction which takes two vectors
of operands.  That leads to simpler test code.
We can clean up some other test code, in another CL.
2015-10-26 12:55:33 -04:00
Dejan Mircevski
114206e0bc Clarify !<integer> parsing.
Implement some outstanding feedback from
Ic29c5a4a8178a62a5a1acad13d02f19cc1307097:

 - use "token" instead of "word" when referring to assembly text

 - specify how the numbers are parsed

Add a test for negative numbers.
2015-10-26 12:55:33 -04:00
Dejan Mircevski
97e2c8fc3d Try to fix the Android build. 2015-10-26 12:55:33 -04:00
Dejan Mircevski
14c4b10d44 Detect overflow in !<integer>. 2015-10-26 12:55:33 -04:00
David Neto
8bed0cea13 Add a .csv showing test coverage for operand class
It shows which spv::OperandClass values are used in
the syntax table in source/opcode.inc, and what tests
exercise those operand types.
2015-10-26 12:55:33 -04:00
Dejan Mircevski
897bff924a Simplify (and test) the alternate-parsing pattern. 2015-10-26 12:55:33 -04:00
David Neto
42bfd4bfab Assembly test for OpSwitch
Removes old weak and fragile tests for OpSwitch.

Adds spvtest::TextToBinaryTest::CompileWithFormatFailure
2015-10-26 12:55:33 -04:00
David Neto
e77a7dd821 Assembly failure cases for OpMemoryBarrier
Fully tests OperandMemorySemantics from the syntax table.
2015-10-26 12:55:33 -04:00
David Neto
cb3db4327d Assembler failing cases for OpCapability 2015-10-26 12:55:33 -04:00
David Neto
7cefb23ddb Document non-use of certain operand types
Operand class enum values not used in the syntax table:
- Image channel order: only used to describe a return value
- Image channel type: only used to describe a return value
- "Image operands": used to make a section in the spec
  to describe values used to construct an optional image id,
  but does not itself appear in the syntax table.

Removes some TODOs from opcode.cpp.
2015-10-26 12:55:33 -04:00
Andrew Woloszyn
71fc05587b Refactored dynamic and static state out of text processing.
This reduces the number of arguments required to be passed
to every single function. This is in preparation for adding
id tracking.
2015-10-26 12:55:33 -04:00
Dejan Mircevski
50babb2d00 Run clang-format. 2015-10-26 12:55:33 -04:00
Dejan Mircevski
903f9d6b70 Implement alternate-parsing mode for !<integer>. 2015-10-26 12:55:33 -04:00
David Neto
e3940ab166 Readme: capabilities for instructions are ok
Capabilities for enumerants may be out of date.
2015-10-26 12:55:33 -04:00
Andrew Woloszyn
38acba2c3c Updated syntax.md to remove references to % numerical ids. 2015-10-26 12:55:33 -04:00
Dejan Mircevski
9672ad39cf Remove isIdType(), which is now dead code. 2015-10-26 12:55:33 -04:00
David Neto
c348d18486 Test bad 2nd target to OpGroupMemberDecorate 2015-10-26 12:55:33 -04:00
David Neto
454f51fa4d Assembly test for OpGroupMemberDecorate
Provides test coverage for OperandVariableIdLiteral
from the syntax table in the file 'opcode.inc'.
2015-10-26 12:55:33 -04:00
Dejan Mircevski
1b6f1960a8 Uncomment some !<integer> tests. 2015-10-26 12:55:33 -04:00
David Neto
d83179af7e Cleanup: Use EnumCase in OpDecorateSimpleTest 2015-10-26 12:55:33 -04:00
David Neto
ab778dc1dc Cleanup: Use EnumCase for ExecutionMode test 2015-10-26 12:55:33 -04:00
David Neto
54b2ea1088 Assembler test for optional operands of OpSource
These are the first tests to cover OperandOptionalId
and OperandOptionalLiteralString from the grammar in
opcode.inc
2015-10-26 12:55:33 -04:00
David Neto
561dc4e975 Remove SPV_OPERAND_TYPE_LITERAL
All uses of OptionalLiteral by the SPIR-V spec are used
for literal numbers.

Also rename:
- SPV_OPERAND_TYPE_OPTIONAL_LITERAL to
  SPV_OPERAND_TYPE_OPTIONAL_LITERAL_NUMBER.
- SPV_OPERAND_TYPE_VARIABLE_LITERAL to
  SPV_OPERAND_TYPE_VARIABLE_LITERAL_NUMBER.
- SPV_OPERAND_TYPE_VARIABLE_LITERAL_ID to
  SPV_OPERAND_TYPE_VARIABLE_LITERAL_NUMBER_ID.
- SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL to
  SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_NUMBER.
- SPV_OPERAND_TYPE_LITERAL_IN_OPTIONAL_TUPLE to
  SPV_OPERAND_TYPE_LITERAL_NUMBER_IN_OPTIONAL_TUPLE.
2015-10-26 12:55:33 -04:00
David Neto
f1b6471670 Dissasembler test showing reordering of masks 2015-10-26 12:55:33 -04:00
David Neto
b14a727a30 Execution scope, memory semantics operands are IDs
They shouldn't be parsed or printed as masks.
2015-10-26 12:55:33 -04:00
David Neto
619db2612e Disassembler support for mask expressions. 2015-10-26 12:55:33 -04:00
David Neto
e4eba63932 Update Readme: Support Rev32; IDs never alias 2015-10-26 12:55:33 -04:00
David Neto
bfa3d86f7b Memory semantics Relaxed is a synonym for None
The disassembler should prefer to print Relaxed,
I think. (Untested.)
2015-10-26 12:55:33 -04:00
David Neto
212bafe4da Assembler tests for remaining Debug instructions
OpString, OpName, OpMemberName, OpLine, OpNoLine,
OpSourceContinued.
2015-10-26 12:55:33 -04:00
David Neto
e0890da603 Update core instruction syntax to Rev32
Many instructions added and a few changed structure.

Workarounds:
- Some operands can be enabled by either one of two
  capabilities.  The spv_operand_desc_t does not handle that
  now. For now just select the first one.

Fixes to tests:
- OpLoopMerge now takes a mandatory continue target.
- OpTypePipe drops the type argument.  Pipes are opaque.
- OpLine no longer takes a target ID argument.

The ID validator was fixed the OpLine and OpTypePipe
changes.  Those were the only ID validator tests affected.

The patch to the spec doc generator was updated so it handles
the two-capability case, even if in an hacky way.
2015-10-26 12:55:33 -04:00
David Neto
6b31ce4d50 Assembler test TODOs for image instructions. 2015-10-26 12:55:33 -04:00
David Neto
d768798d48 Assembler supports new decorations in Rev32
They are:
 - NoContraction
 - InputTargetIndex
 - Alignment
2015-10-26 12:55:33 -04:00
Lei Zhang
863ddbeeaa Rev32: Remove DepthAny and mark Xfb as requiring TransformFeedback. 2015-10-26 12:55:33 -04:00
David Neto
d30b2331a3 Fix Capability dependencies on capabilities, Rev32 2015-10-26 12:55:33 -04:00
David Neto
c66f5074e2 Assembler support for new capabilities in Rev32 2015-10-26 12:55:33 -04:00
David Neto
8576c9c327 Support Image operand MinLod 2015-10-26 12:55:33 -04:00
David Neto
2d1b5e5bba Assembler supports new builtins in Rev32
They are VertexIndex and InstanceIndex.
2015-10-26 12:55:33 -04:00
David Neto
49c299b094 Assembler support for Nontemporal memory access 2015-10-26 12:55:33 -04:00
Lei Zhang
85c6f79081 Define two macros to simplify code for ExecutionMode operands. 2015-10-26 12:55:33 -04:00
David Neto
c09d3857ff Fix permissions on test/TextToBinary.Barrier.cpp 2015-10-26 12:55:33 -04:00