Commit Graph

44 Commits

Author SHA1 Message Date
David Neto
a91cecfefc Recognize SPV_AMD_shader_fragment_mask 2017-09-14 10:37:18 -04:00
David Neto
0d3b8329a4 Make enums for all currently published extensions
Use the list from the SPIR-V registry page.  Also, capture it as
a string so it's much easier to update via copy-paste.

The validator will accept modules that declare these known
extensions.  However, we might not know about new tokens or
instructions declared in them.  For that we need grammar updates
applied to SPIRV-Headers.
2017-09-02 15:10:52 -04:00
Rex Xu
5fbbadca4e Add support for SPV AMD extensions 2017-06-21 15:08:07 -04:00
Andrey Tuganov
20fe946666 Added extension SPV_VALIDATOR_ignore_type_decl_unique
If extension is present in the module, validator will ignore the "type
declaration must be unique" rule.
2017-05-25 11:36:48 -04:00
David Neto
bf68c81426 Support SPV_KHR_storage_buffer_storage_class
Includes interaction with SPV_KHR_variable_pointers

TODO: Update capabilitly dependency tests for new capabilities.
2017-04-07 09:54:38 -04:00
David Neto
7fe8a57a5b Support SPV_AMD_gcn_shader
Supported in assembler, disassembler, and binary parser.

The validator does not check SPV_AMD_gcn_shader validation rules
beyond parsing the extension.

Adds generic support for generating instruction tables for vendor
extensions.

Adds generic support for extensions the validator should recognize
(but not check) but which aren't derived from the SPIR-V core
grammar file.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/594
2017-03-23 16:32:35 -04:00
David Neto
654feb32f2 Do nothing if trying to make the current dir 2017-03-20 11:23:35 -04:00
Andrey Tuganov
c804c125c5 Autogenererating enum-string mappings from grammar
Autogenerating the following code:
- extension enum
- extension-to-string
- string-to-extension
- capability-to-string

Capability mapping table will not compile if incomplete.
TODO: Use "spirv-latest-version.h" instead of 1.1.

Added function to generate capability tables for tests.
2017-03-16 15:29:17 -04:00
Andrey Tuganov
12f5509734 Fix extension grammar parsing
Extensions were not parsed correctly due to a typo in the Python script.
2017-03-09 15:32:42 -05:00
David Neto
699943d297 Say why we allow override of build timestamp
It's for reproducible builds.

Also, fix Python formatting.
2017-01-17 15:42:02 -05:00
Bernhard M. Wiedemann
29b37fb310 make build reproducible
see https://reproducible-builds.org/ for why this is good
2017-01-17 19:36:39 +01:00
Ehsan Nasiri
fcf7df069d Adding decoration class and tests.
* Added the decoration class as well as the code that registers the
decorations for each <id> and also decorations for struct members.

* Added unit tests for decorations in ValidationState as well as
decoration id tests.
2017-01-16 16:52:08 -05:00
David Neto
558ac1e5aa Allow trailing whitespace on version lines in CHANGES 2017-01-06 13:18:50 -05:00
David Neto
37422e9dba Support building under CYGWIN
- Parse CHANGES file with Universal Python line endings in case
  the source tree was checked out with Windows line endings.
- Use our own clone of strnlen_s which might not be available
  everywhere.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/508
2016-12-21 10:34:23 -05:00
David Neto
f8cc397573 Generate spvasm.vim
Generate a vim syntax file for SPIR-V assembly.
Copy the resulting spvasm.vim into your $HOME/.vim/syntax directory
to get syntax highlighting in Vim.

Also, suggest that the grammar file include information
about what opcodes can be used in OpSpecConstantOp.
2016-12-20 11:36:41 -05:00
David Neto
5a0b5ca4a7 Get vendor tool info from the SPIR-V registry file
Update old tests to use officially registered vendor names;
this affected "Codeplay".
2016-12-09 14:01:43 -05:00
David Neto
9382035a22 Add basic support for SPV_KHR_shader_ballot
Requires use of SPIRV-Headers that has support
for SPV_KHR_shader_ballot.

Adds assembler, disassembler, binary parser support.

Adds general support for allowing an operand to be
only enabled by a set of extensions.

TODO: Validator support for extension checking.
2016-09-16 16:38:36 -04:00
steve-lunarg
6accefc3a4 add spirv-dis/spirv-as support for emacs when loading .spv binaries 2016-09-11 09:55:15 -06:00
David Neto
9fc8658ef3 Relicense SPIRV-Tools under Apache 2.0
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/383

Finalize v2016.4
2016-09-02 10:00:29 -04:00
David Neto
6f35405a97 Add check_copyright to check or update copyright.
It will also replace an MIT or Khronos free use license with
the Apache license notice.
2016-09-02 10:00:29 -04:00
David Neto
0e001b70e4 Fix Google copyright lines 2016-09-02 10:00:29 -04:00
David Neto
273920c554 Handle capabilities larger than value 63
Use libspirv::CapabilitySet instead of a 64-bit mask.

Remove dead function spvOpcodeRequiresCapability and its tests.

The JSON grammar parser is simplified since it just writes the
list of capabilities as a braced list, and takes advantage of
the CapabilitySet intializer-list constructor.
2016-08-30 15:41:39 -04:00
David Neto
033b7d00f0 Avoid race on mkdir
Should fix https://github.com/KhronosGroup/SPIRV-Tools/issues/340
2016-08-15 11:14:34 -04:00
Lei Zhang
0d8ddd0b75 Create directory first if not existing and always refresh. 2016-08-05 10:23:41 -04:00
Lei Zhang
c6465fb220 Avoid redefining builtin dir. 2016-08-05 10:23:41 -04:00
David Neto
1a18739650 Fix ExtInst parsing: no IdRef* at end
The operands following the extended instruction literal
number are determined by the extended instruction itself.
So drop the zero-or-more IdRef pattern at the end of OpExtInst.

It's arguable whether this should actually be a grammar fix.  I've
chosen to patch this in SPIRV-Tools instead of in the grammar file.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/233

Also fix two test cases for OpenCL extended instructions.  These
errors of supplying too many operands are now detected.
2016-06-15 10:00:06 -04:00
David Neto
87125a19c6 Fix CHANGES file version parsing. -dev is optional 2016-06-02 15:32:28 -04:00
David Neto
9166854ac9 Add CHANGES file with high level software history
Add a high level version number for SPIRV-Tools, beginning
with v2016.0-dev.  The README describes the format of the
version number.

The high level version number is extracted from the CHANGES
file.  That works around:
 - stale-bait for when we don't add tags to the repository
 - our inability to add tags to the repository

Option --version causes spirv-as, spirv-dis, and spirv-val to
show the high level version number.

Add spvSoftwareVersionString to return the C-string for
the high level version number.

Add spvSoftwareVersionDetailsString() so that clients can get
more information if they want to.
Also allows us to clean up the uses in the tool executables files,
so now only one file includes build-version.inc.

Move the update-build-version logic to the only
CMakeLists file that needs it.

The update build version script takes a new argument
to name the output file.
2016-04-22 15:19:45 -04:00
Dejan Mircevski
776029fb71 Make grammar-generation fail if over 64 capabilities. 2016-04-22 14:56:07 -04:00
David Neto
552d319962 Make directories more safely.
Avoid a race on check-for-dir vs. make-dir
when running the inc-file generation script concurrently.
2016-04-18 10:46:15 -04:00
Lei Zhang
489786465a Grammar update: OpPhi now uses PairIdRefIdRef as the last operand. 2016-04-13 13:43:44 -04:00
Lei Zhang
11636fb100 Update the core grammar.
* IdType is renamed to IdResultType.
* version is splitted into major_version and minor_version.
* Seperate Scope and IdScope operand kinds. Same for MemorySemantics.
2016-04-13 13:43:44 -04:00
David Neto
469f0e8fd5 Make paths to grammar output files
The directory for a grammar output file will be created if
it doesn't already exist.

This is required to make the Android.mk build work.
2016-04-12 16:09:13 -04:00
Lei Zhang
670c0ac831 Allow to only build certain grammar tables. 2016-04-08 15:38:02 -04:00
Lei Zhang
80e416ce91 Use JSON grammar files to generate extended instruction sets. 2016-04-04 16:13:06 -04:00
Lei Zhang
4f293b7139 Use the JSON grammar file to generate various info tables.
This patch uses a Python script to parse the JSON grammar file to
generate the opcode table and operand kind tables.

Now we don't need to do the post-processing (from OperandClass
to spv_operand_type_t) and copying of the opcode info table is
not required anymore!
2016-04-01 13:18:42 -04:00
Lei Zhang
476989e7b7 Return str in describe() as said by the blurb. 2016-03-11 15:30:38 -05:00
Lei Zhang
9149a66ca4 Fix the corner case in version generation script.
When the given directory is not inside the SPIRV-Tools project,
describe() returns a str instance instead of bytes instance
in Python3, which will case problem when calling decode() on it.
2016-03-11 15:06:15 -05:00
Lei Zhang
f7e63786a9 Add comments to explain why calling decode(). 2016-03-07 13:44:09 -05:00
Lei Zhang
c15683906c Run pyformat with -s 4 --force_quote_type=single. 2016-03-06 13:00:58 -05:00
Lei Zhang
703b0f7ab4 Imporve compatibility with Python3.
* Use print_function from __future__ to tackle the print syntax
   change.
 * In Python3 str and bytes are no longer the same thing. Need
   proper decode.
2016-03-06 12:58:13 -05:00
David Neto
3deecefde5 If no tag in the repo, then show the commit hash 2016-02-24 12:42:13 -05:00
David Neto
b38ac4bae6 Use subprocess.Popen, hoping for Windows portability
Replaces use of subprocess.check_output
2016-02-23 18:09:50 -05:00
qining
4e797f8236 Implement --version for spirv-tools
'spirv-as --version', 'spirv-dis --version' and 'spirv-val --version'
will display version information.
2016-02-23 14:14:23 -05:00