Commit Graph

1262 Commits

Author SHA1 Message Date
Dejan Mircevski
2d975d54ae Mention 1.1 support in the README. 2016-04-20 12:58:59 -04:00
Dejan Mircevski
7b33485f6e First tests for SPIR-V v1.1.
Add test for named-barrier instructions and capability.

Add spv_target_env as an optional argument to CompileSuccessfully() and
CompileFailure().  Currently defaults to UNIVERSAL_1_0, though that
could change in the future.

Make spv_context a local variable in test methods instead of a
TextToBinaryTestBase member.  Introduce ScopedContext to make temp
contexts easier.
2016-04-19 16:34:12 -04:00
Lei Zhang
d12a10d2dd Fix wrong grammar .inc file dependency introduced by copy-paste. 2016-04-18 16:48:33 -04:00
Lei Zhang
e94d6d18dd Rework CMake rules for building grammar tables.
Use add_custom_command() to generate all .inc files and manage
dependency with set_source_files_properties().
2016-04-18 15:50:43 -04:00
Derek Sollenberger
009c4358b5 Update cmake files to support Android as a build target.
This enables cross-compiling to Android using scripts like
cmake-android that update the system name to reflect the build
target.
2016-04-18 11:43:24 -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
Dejan Mircevski
cb3c49ef82 Add SPIR-V 1.1 grammar.
Switch to SPIR-V 1.1 as default.
Introduce SPV_ENV_UNIVERSAL_1_1.
Add "1_0" to the internal variable names.
Add spv_target_env to spv*GetTable().
2016-04-18 10:45:57 -04:00
Dejan Mircevski
e26fdc6bd1 Mark SPIR-V grammar files as 1.0.
Factor the CMake generate_grammar_tables invocation into a function
parameterized on the version.
2016-04-18 10:00:01 -04:00
Lei Zhang
77d4e30eda GLSL grammar update.
* Add names to operands.
* Fix capability requirements for UnpackDouble2x32.
* Fix operands list error for NClamp.
2016-04-14 18:35:14 -04:00
John Kessenich
27d98e2954 Merge pull request #181 from antiagainst/readme
Use footnotes for links in README.md.
2016-04-14 13:09:09 -06:00
Lei Zhang
29ca6f9894 Use footnotes for links in README.md. 2016-04-14 14:13:28 -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
Dejan Mircevski
8ba7c92a94 Remove revision from SPV_ENV_*.
Revisions proliferate quickly and we don't promise to retain extra
grammar copies for every historical one.
2016-04-11 15:31:00 -04:00
Lei Zhang
670c0ac831 Allow to only build certain grammar tables. 2016-04-08 15:38:02 -04:00
Lei Zhang
051e067f25 Remove the outdated patch file.
Now we use the JSON grammar and the generate_grammar_tables.py
script to maintain various info tables. That patch file will not
be needed anymore.
2016-04-07 15:10:19 -04:00
Dejan Mircevski
7649c7362d Fix MSVC error C2797. 2016-04-04 20:16:15 -04:00
Lei Zhang
80e416ce91 Use JSON grammar files to generate extended instruction sets. 2016-04-04 16:13:06 -04:00
Lei Zhang
9ca2d6dcd2 Rname grammar.json to spirv.core.grammar.json and add version info. 2016-04-04 16:13:06 -04:00
Dejan Mircevski
3fb2676d23 Fix validation of array length. 2016-04-04 15: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
Chris Forbes
d03c0a1153 Enable linking against libSPIRV-Tools from linux shared libraries
Required for linking against libSPIRV-Tools from LVL's
libVkLayer_core_validation.so.

Signed-off-by: Chris Forbes <chrisforbes@google.com>
2016-04-04 10:21:35 +12:00
Eric Engestrom
c9b2285bfc Fix spelling mistakes 2016-04-02 22:54:59 +01: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
Dejan Mircevski
a1de2b37c7 Handle CRLF in assembly text. 2016-04-01 00:47:02 -04:00
Dejan Mircevski
3d27da4bc7 Add a target environment to spvContextCreate().
Run clang-format.
2016-03-31 12:16:51 -04:00
David Neto
6836e17f24 OpExecutionMode only takes a single ExecutionMode
Previously, the grammar allowed many execution modes for a single
OpExecutionMode instruction.

Removes the variable- and optional- execution mode operand type
enum values.

Issue found by antiagainst@
2016-03-29 14:51:02 -04:00
Lei Zhang
452914634e Capability fix: ImageReadWrite & ImageMipmap require ImageBasic. 2016-03-29 09:47:23 -04:00
Andrew Woloszyn
4c657bfa8f Make everything compile cleanly with -Wpedantic.
This makes SPIRV_WARN_EVERYTHING compile cleanly.
2016-03-21 10:01:13 -04:00
David Neto
e04b935599 Support both -h, --help on spirv-as, spirv-val
The spirv-dis command already supports both.
2016-03-17 16:06:25 -04:00
Lei Zhang
d0f80fabbc Travis CI: update test binary location and return correct status. 2016-03-17 15:20:22 -04:00
Lei Zhang
eb6fc51d35 Split CMakeLists.txt into smaller ones. 2016-03-17 14:43:02 -04:00
Lei Zhang
02141e53a7 Travis CI: add configuration for testing on Mac OS X. 2016-03-17 11:41:30 -04:00
David Neto
7c58c1d59e Support Linux-to-Windows cross comiple via MinGW
For MinGW compile, statically link the C++ runtime

Change-Id: Ic58d1e47a814a265fd91edd7082e938ffc87f0c9
2016-03-16 16:55:32 -04:00
Lei Zhang
6032b98c53 Change the interface for getWord().
* It's redundant to provide two mutable spv_position to getWord().
* getWord() should take string pointer by the style guide.
2016-03-16 15:46:15 -04:00
Lei Zhang
de4a7c7f40 Travis CI: use Ubuntu 14.04 (Trusty) as the Linux environment. 2016-03-16 15:19:37 -04:00
Dejan Mircevski
755eb6dcfc Remove AssemblyContext::getWord().
Fixes #152.
2016-03-15 15:16:40 -04:00
Daniel Robertson
c31d7cb00a Add patchlevel to CMake requirement 2016-03-14 08:41:32 -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
Andrew Woloszyn
9dd1cd7f31 Fixed float->int16 conversion warnings in VS2013. 2016-03-07 15:55:44 -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
Florian Ziesche
680f9b7ef1 Don't check kernel entry-point signatures.
Recognize SpvOpInBoundsPtrAccessChain and SpvOpPtrAccessChain as opcodes
returning a pointer.

 * spvOpcodeIsPointer: recognize SpvOpInBoundsPtrAccessChain and SpvOpPtrAccessChain as opcodes returning a pointer

 * isValid<SpvOpEntryPoint>: don't check kernel function signatures (these don't have to be 'void main(void)')

 * added tests for kernel OpEntryPoint, OpInBoundsPtrAccessChain and OpPtrAccessChain, as well as facilities to actually test kernel/OpenCL SPIR-V

 * fixed pow and pown specification (both should take 2 parameters), spec bug reported at https://www.khronos.org/bugzilla/show_bug.cgi?id=1469

 * use ASSERT_TRUE instead of ASSERT_EQ

 * added pow and pown test (pow(val, 2.0f) and pown(val, 3))

Revert " * fixed pow and pown specification (both should take 2 parameters), spec bug reported at https://www.khronos.org/bugzilla/show_bug.cgi?id=1469"

This reverts commit c3d5a87e73.

Revert " * added pow and pown test (pow(val, 2.0f) and pown(val, 3))"

This reverts commit 7624aec720.
2016-03-02 15:27:26 -05:00
Dejan Mircevski
c31a31942b Make libspirv.h more C friendly.
In C, `#include <stdbool.h>` so `bool` is recognized.

Add a `typedef` for `spv_context_t`.
2016-03-01 12:38:59 -05:00
Lei Zhang
2923806314 Remove stale code. 2016-02-26 15:38:42 -05:00
Lei Zhang
712bed0227 Fix issues reported by cppcheck.
Remove code not being used, add explicit to constructors, and
add missing fields in constructors.
2016-02-25 16:16:28 -05:00
Andrew Woloszyn
96c80a1b5a Added missing <cstdint> in bitutils.
This was breaking MSVC2013.
2016-02-24 15:26:05 -05:00