David Neto [Fri, 27 Jan 2017 01:05:01 +0000 (20:05 -0500)]
Test SPV_KHR_device_group in assembler, disassembler
David Neto [Fri, 27 Jan 2017 01:02:24 +0000 (20:02 -0500)]
Test SPV_KHR_16bit_storage in assembler, disassembler
David Neto [Thu, 26 Jan 2017 23:26:20 +0000 (18:26 -0500)]
Test SPV_KHR_subgroup_vote support in assembler, disassembler
Andrey Tuganov [Wed, 8 Mar 2017 17:06:31 +0000 (12:06 -0500)]
Fix nullptr dereferencing in val_fixtures.cpp
David Neto [Tue, 7 Mar 2017 14:49:43 +0000 (09:49 -0500)]
Change Ids in tests to avoid confusion
The assembler assigns ID numbers sequentially, so it's confusing
to have a %1 in the source assembly when it isn't the first mentioned
ID. Rewrite the ID names to avoid this situation in a few cases.
Aliya Pazylbekova [Sat, 25 Feb 2017 01:43:28 +0000 (20:43 -0500)]
Validate that SpecId decoration target is a OpSpecConstant instruction
on a scalar
Fixes: https://github.com/KhronosGroup/SPIRV-Tools/issues/275
Andrey Tuganov [Thu, 2 Mar 2017 22:24:29 +0000 (17:24 -0500)]
Validator: unique type check allows runtime arrays
OpTypeRuntimeArray is an aggregate and therefore can have duplicate
declarations.
David Neto [Wed, 1 Mar 2017 20:37:20 +0000 (15:37 -0500)]
Use OpenCL extinst definitions from SPIRV-Headers
Remove the local copy of that file.
Ehsan Nasiri [Fri, 27 Jan 2017 16:33:33 +0000 (11:33 -0500)]
Fixes issue #489.
From the SPIR-V Spec 2.16.1:
A function declaration (an OpFunction with no basic blocks), must have
a Linkage Attributes Decoration with the Import Linkage Type.
A function definition (an OpFunction with basic blocks) cannot be
decorated with the Import Linkage Type.
Lei Zhang [Wed, 1 Mar 2017 20:51:44 +0000 (15:51 -0500)]
Allow using FPRoundingMode when see VK_KHR_16bit_storage
According to the extension, FPRoundingMode should be allowed to
use without requiring Kernel capability when VK_KHR_16bit_storage
is enabled.
Andrey Tuganov [Wed, 1 Mar 2017 17:49:17 +0000 (12:49 -0500)]
Validator: downgraded dupl type decl to warning
Validator check for uniqueness of type declarations
(commit
0e9c24fdd112e7742b9b5dcff35aee32e71a66fd)
was causing failures in vulkancts tests.
Downgrading from error to warning.
Jean-Francois Roy [Tue, 28 Feb 2017 19:34:18 +0000 (11:34 -0800)]
Add a default virtual dtor to Pass and check for missing virtual dtors
Andrey Tuganov [Thu, 23 Feb 2017 21:07:52 +0000 (16:07 -0500)]
Issue 559: check type declaration uniqueness
Adds PassTypeUnique to the validator.
Disallows repeated declarations of all types except for aggregates.
Andrey Tuganov [Tue, 28 Feb 2017 16:53:47 +0000 (11:53 -0500)]
Refactored validation_state, added new types
- validation_state.cpp uses functions from opcode.h instead of in-place
switches which need to be updated.
- added new spirv 1.1 type declaration opcodes to a 'is op type
declaration' switch in opcode.cpp.
Ehsan Nasiri [Wed, 15 Feb 2017 18:29:33 +0000 (13:29 -0500)]
Add command line options struct for the validator
The limit for the number of struct members is parameterized using
command line options.
Add --max-struct-depth command line option.
Add --max-switch-branches command line option.
Add --max-function-args command line option.
Add --max-control-flow-nesting-depth option.
Add --max-access-chain-indexes option.
David Neto [Tue, 28 Feb 2017 16:53:05 +0000 (11:53 -0500)]
Update CHANGES for SPV_KHR_16bit_storage validator
David Neto [Wed, 22 Feb 2017 23:10:05 +0000 (18:10 -0500)]
Validation of type decls for SPV_KHR_16bit_storage
Allow declaration of 16bit int or 16bit float in
the presence of capabilities from SPV_KHR_16bit_storage
David Neto [Wed, 22 Feb 2017 22:53:08 +0000 (17:53 -0500)]
Add a Feature struct to validation state.
For now, it is used only for checks of 16bit int and float types.
Adam Van Ymeren [Wed, 15 Feb 2017 18:31:07 +0000 (13:31 -0500)]
Fixes issue #548
Add validation checks for the reserved OpImageSparseSampleProj* opcodes.
David Neto [Thu, 9 Feb 2017 19:23:52 +0000 (14:23 -0500)]
Check strict domination of merge block
If a merge block is reachable, then it must be *strictly* dominated
by its header. Until now we've allowed the header and the merge
block to be the same.
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/551
Also: Use dominates and postdominates methods on BasicBlock to
improve readability.
Ehsan Nasiri [Thu, 9 Feb 2017 21:23:40 +0000 (16:23 -0500)]
The Signedness in OpTypeInt must always be 0.
When Kernel capability is used, The Signedness in OpTypeInt must always
be 0. Fixes issue #492.
Kenneth Benzie (Benie) [Wed, 1 Feb 2017 21:35:59 +0000 (21:35 +0000)]
Add vim-spirv plugin description to the README
Fixes #359
David Neto [Fri, 27 Jan 2017 20:30:09 +0000 (15:30 -0500)]
Encourage use of the validator
Ehsan Nasiri [Mon, 23 Jan 2017 23:31:14 +0000 (18:31 -0500)]
Making the unit tests more robust.
It is best to check the error messages of unit tests that fail
validation. This will ensure that a validation failure is due to what we
expect and not due to some secondary reason.
Updating SPIR-V Validator unit tests with error message checks.
Ehsan Nasiri [Tue, 17 Jan 2017 20:10:43 +0000 (15:10 -0500)]
Fixes issue #497.
The Linkage Attributes Decoration cannot be applied to functions
targeted by an OpEntryPoint instruction.
Ehsan Nasiri [Mon, 16 Jan 2017 17:54:15 +0000 (12:54 -0500)]
Check BuiltIn Decoration rules.
When applied to a structure-type member, all members of that structure
type must also be decorated with BuiltIn. (No allowed mixing of built-in
variables and non-built-in variables within a single structure.)
When applied to a structure-type member, that structure type cannot be
contained as a member of another structure type.
There is at most one object per Storage Class that can contain a
structure type containing members decorated with BuiltIn, consumed per
entry-point.
Ehsan Nasiri [Thu, 19 Jan 2017 16:03:04 +0000 (11:03 -0500)]
Fixes issue #532.
It is acceptable for OpAccessChain, OpInBoundsAccessChain,
OpPtrAccessChain, OpInBoundsPtrAccessChain, OpCompositeInsert, and
OpCompositeExtract to not take any indexes as arguments. In such cases,
no indexing will be done on the Base pointer/composite.
Ehsan Nasiri [Tue, 17 Jan 2017 21:28:59 +0000 (16:28 -0500)]
Fixes issue #493.
Check function call operands and return type agree with the called
function type.
The validation code exists. I have fixed the unit tests.
Ehsan Nasiri [Fri, 13 Jan 2017 16:46:21 +0000 (11:46 -0500)]
Validation for decoration rules. Fixes issue #499.
Added a new file where all the decoration validation can be performed.
In this change the SPIRV Spec Section 2.16.1 is implemented:
"It is illegal to initialize an imported variable. This means
that a module-scope OpVariable with initialization value cannot be
marked with the Import Linkage Type."
Also added unit tests.
David Neto [Tue, 17 Jan 2017 20:41:23 +0000 (15:41 -0500)]
Say why we allow override of build timestamp
It's for reproducible builds.
Also, fix Python formatting.
Bernhard M. Wiedemann [Tue, 17 Jan 2017 18:32:28 +0000 (18:32 +0000)]
make build reproducible
see https://reproducible-builds.org/ for why this is good
Ehsan Nasiri [Wed, 11 Jan 2017 15:51:23 +0000 (10:51 -0500)]
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.
Ehsan Nasiri [Mon, 9 Jan 2017 16:10:52 +0000 (11:10 -0500)]
Validation of OpEntryPoint usage.
According to the SPIRV Spec (2.16.1):
* There is at least one OpEntryPoint instruction, unless the Linkage
capability is being used.
* No function can be targeted by both an OpEntryPoint instruction and an
OpFunctionCall instruction.
Also updated unit tests to includ OpEntryPoint.
Ehsan Nasiri [Wed, 11 Jan 2017 20:03:53 +0000 (15:03 -0500)]
Introducing a new flow for running the Validator.
We are adding a new API which can be called to run the SPIR-V validator,
and retrieve the ValidationState_t object. This is very useful for
unit testing.
I have also added basic unit tests that demonstrate usage of this flow
and ease of use to verify correctness.
Lei Zhang [Thu, 12 Jan 2017 19:15:36 +0000 (14:15 -0500)]
Update Travis CI configuration.
* Stop updating brew.
* Shadow clone of dependencies.
* Fix `nproc` on macOS.
David Neto [Wed, 11 Jan 2017 21:12:50 +0000 (16:12 -0500)]
Provide friendly names for true and false
Ehsan Nasiri [Wed, 4 Jan 2017 20:56:17 +0000 (15:56 -0500)]
Validation for Composite Extract and Insert.
The validity of each command is checked based on the descripton in
SPIR-V Spec Section 3.32.12 (Composite Instructions).
Also checked that the number of indexes passed to these commands does
not exceed the limit described in 2.17 (Universal Limits).
Also added unit tests for each one.
Ehsan Nasiri [Thu, 5 Jan 2017 17:53:02 +0000 (12:53 -0500)]
Fixes bug #517.
entry_block_to_construct_ maps an entry block to its construct. The key
in this map (the entry block) is not unique, and therefore the entry for
the continue construct gets overwritten when the selection construct is
discovered.
Since a given block may be the entry block of different types of
constructs, the (basic_block, construct_type) pair should be able to
uniquely identify the construct.
Adds test:
- In this test, a basic block is the entry block of a continue construct
as well as the entry block of a selection construct.
It can be shown that this unit test would crash without the fix in this
PR and passes with the fix in this PR.
David Neto [Wed, 4 Jan 2017 16:04:47 +0000 (11:04 -0500)]
Allow trailing whitespace on version lines in CHANGES
David Neto [Thu, 5 Jan 2017 21:00:58 +0000 (16:00 -0500)]
Use the default Xcode image on OSX
As of November 2016, the default OSX image is Xcode 7.3.1, which works.
Ehsan Nasiri [Thu, 22 Dec 2016 19:31:21 +0000 (14:31 -0500)]
Adding validation code for PtrAccessChain.
Validation for OpPtrAccessChain is similar to OpAccessChain with the
following difference: OpPtrAccessChain takes an extra argument (word 4)
which is the Element <id> argument.
Validation for OpInBoundsPtrAccessChain is also similar to OpPtrAccessChain.
Also added tests for all access chain instructions:
Modified the existing parameterized tests to accommodate OpPtrAccessChain and
OpInBoundsPtrAccessChain.
Also fixed a typo in previous commits.
Ehsan Nasiri [Tue, 3 Jan 2017 19:53:50 +0000 (14:53 -0500)]
Refactoring unit tests using TEST_P.
Using parameterized unit tests to avoid duplicate code that runs the
tests of OpAccessChain and OpInBoundsAccessChain.
This is also a steppingstone to adding tests for OpPtrAccessChain and
OpInBoundsPtrAccessChain.
Ehsan Nasiri [Wed, 21 Dec 2016 19:39:01 +0000 (14:39 -0500)]
Validation code for control flow nesting depth.
According to Section 2.17 (Universal Limits) of the SPIR-V Spec, the
control flow nesting depth may not be larger than 1023.
This is checked only when we are required to have structured
control flow. Otherwise it's not clear how to compute control
flow nesting depth.
David Neto [Mon, 19 Dec 2016 18:26:42 +0000 (13:26 -0500)]
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
David Neto [Wed, 21 Dec 2016 15:31:29 +0000 (10:31 -0500)]
Update Travis notification emails
Remove deki, add ehsann
David Neto [Fri, 16 Dec 2016 20:32:56 +0000 (15:32 -0500)]
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.
David Neto [Tue, 13 Dec 2016 16:49:50 +0000 (11:49 -0500)]
Start v2016.7-dev
David Neto [Tue, 13 Dec 2016 16:49:09 +0000 (11:49 -0500)]
Finalize v2016.6
David Neto [Fri, 9 Dec 2016 19:01:43 +0000 (14:01 -0500)]
Get vendor tool info from the SPIR-V registry file
Update old tests to use officially registered vendor names;
this affected "Codeplay".
David Neto [Thu, 8 Dec 2016 23:21:17 +0000 (18:21 -0500)]
Document the use of the GitHub Project feature
Ehsan Nasiri [Tue, 6 Dec 2016 16:59:49 +0000 (11:59 -0500)]
Adding validation for OpInBoundsAccessChain.
The validation for this instruction is similar to OpAccessChain.
Include a test for testing a struct with (valid) depth of 255.
Ehsan Nasiri [Sun, 4 Dec 2016 15:48:26 +0000 (10:48 -0500)]
Validation for struct nesting depth.
According to sectin 2.17 in SPIR-V Spec, the structure nesting depth may
not be larger than 255. This is interpreted as structures nested in
structures. The code does not look into arrays or follow pointers to see
if it reaches a structure downstream.
Use memoization to avoid exponential runtime.
David Neto [Wed, 7 Dec 2016 15:33:27 +0000 (10:33 -0500)]
An OpVariable initializer can be a module-scope variable
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/482
Ehsan Nasiri [Mon, 5 Dec 2016 20:11:51 +0000 (15:11 -0500)]
Fixing bug in OpAccessChain validation code.
The validation code for OpAccessChain was missing OpTypeRuntimeArray as
a possible type that can be indexed into.
This was caught by running the validator on VKCTS.
Also adding unit tests for it.
Ehsan Nasiri [Mon, 5 Dec 2016 19:00:18 +0000 (14:00 -0500)]
Add a test that exercises wrong usage of result id
Result <id> resulting from an instruction within a function may not be
used outside that function.
Ehsan Nasiri [Wed, 30 Nov 2016 18:29:12 +0000 (13:29 -0500)]
Adding validation code for OpAccessChain.
* Result Type must be an OpTypePointer. Its Type operand must be the
type reached by walking the Base’s type hierarchy down to the last
provided index in Indexes, and its Storage Class operand must be the
same as the Storage Class of Base.
* Base must be a pointer, pointing to the base of a composite object.
* Indexes walk the type hierarchy to the desired depth, potentially down
to scalar granularity. The first index in Indexes will select the
top-level member/element/component/element of the base composite. All
composite constituents use zero-based numbering, as described by their
OpType... instruction. The second index will apply similarly to that
result, and so on. Once any non-composite type is reached, there must
be no remaining (unused) indexes. Each of the Indexes must:
- be a scalar integer type,
- be an OpConstant when indexing into a structure.
* Check for the case where no indexes are passed to OpAccessChain.
Minor improvements based on code review.
Ehsan Nasiri [Thu, 1 Dec 2016 21:18:15 +0000 (16:18 -0500)]
No need to install cmake for new osx images.
It seems that the osx image has been updated and already includes ctest.
As a result, all jobs fail with this error:
Error: cmake-3.6.2 already installed
Ehsan Nasiri [Tue, 29 Nov 2016 20:50:34 +0000 (15:50 -0500)]
Validate the number of global and local variables.
According to the Universal Limits section of the SPIR-V Spec (2.17), the
number of global variables may not exceed 65,535 and the number of local
variables may not exceed 524,287.
Also added unit tests for each one.
Ehsan Nasiri [Mon, 28 Nov 2016 18:04:32 +0000 (13:04 -0500)]
Validate the number of arguments in OpTypeFunction
According to the SPIR-V spec (section 2.17: Universal Limits), the
OpTypeFunction instruction may not take more than 255 arguments for the
function. Also added unit tests for it.
David Neto [Wed, 30 Nov 2016 20:48:39 +0000 (15:48 -0500)]
Say how the validator checks universal limits
Indicate it's future work to allow parameterization of those
limits.
Ehsan Nasiri [Fri, 25 Nov 2016 14:26:26 +0000 (09:26 -0500)]
Adding validation code for OpSwitch limits
The number of (literal, label) pairs passed to OpSwitch may not exceed
16,383. Added code to validate this and added unit tests for it.
Also fixed a typo in another validor error message.
Ehsan Nasiri [Thu, 24 Nov 2016 20:37:22 +0000 (15:37 -0500)]
Validation for number of Struct members.
The number of members in a struct may not exceed 16,383.
Also Adding unit tests for Struct size limit check.
Ehsan Nasiri [Thu, 24 Nov 2016 20:37:22 +0000 (15:37 -0500)]
Checks that result IDs are within the ID bound specified in the SPIR-V header
This is described in Section 2.17 of the SPIR-V Spec.
* Updated existing unit test 'SemanticsIdIsAnIdNotALiteral' to pass by
manipulating the ID bound in its binary header.
* Fixed boundary check in the code.
* Added unit test to check the case that the largest ID is equal to the
ID bound.
Ehsan Nasiri [Tue, 22 Nov 2016 23:06:55 +0000 (18:06 -0500)]
Validation for OpSampledImage instruction.
This change implements the validation for usages of OpSampledImage
instruction as described in the Data Rules section of the Universal
Validation Rules of the SPIR-V Spec.
Ehsan Nasiri [Wed, 16 Nov 2016 16:04:13 +0000 (11:04 -0500)]
Adding validation for OpSpecConstantComposite.
SpecConstantComposite may specialize to a vector, matrix, array, or
struct. In each case, the number of components and type of components
that are being specialized to must match the expected result type.
Removed use of macros in these tests.
Now using the spvValidateBase class. Using CompileSuccessfully(), and
ValidateInstructions() to compile to binary and run the validator. Also
using getDiagnosticString() to check the proper error message string.
All the heavy lifting is done in ValidateBase class.
Ehsan Nasiri [Thu, 10 Nov 2016 20:12:26 +0000 (15:12 -0500)]
Adding validation code for OpTypeStruct.
According to the Data Rules section of 2.16.1. Universal Validation
Rules of the SPIR-V Spec:
Forward reference operands in an OpTypeStruct
* must be later declared with OpTypePointer
* the type pointed to must be an OpTypeStruct
* had an earlier OpTypeForwardPointer forward reference to the same <id>
David Neto [Wed, 16 Nov 2016 15:52:31 +0000 (10:52 -0500)]
Skip building example executable when asked
David Neto [Thu, 13 Oct 2016 20:22:04 +0000 (16:22 -0400)]
Make friendly number-based names for OpConstant
For example:
%int_42 = OpConstant %int 42
%int_n42 = OpConstant %int -42
%float_3_14 = OpConstant %float 3.14
David Neto [Thu, 13 Oct 2016 19:17:11 +0000 (15:17 -0400)]
Extract EmitNumericLiteral from disassembler
Test with disassembly of numeric literals.
Ehsan Nasiri [Thu, 10 Nov 2016 20:12:26 +0000 (15:12 -0500)]
Adding validation code for more data rules.
These rules are under "Data Rules" in 2.16.1 (Universal Validation
Rules) part of the SPIR-V 1.1 Specification document:
* Scalar floating-point types can be parameterized only as 32 bit, plus
any additional sizes enabled by capabilities.
* Scalar integer types can be parameterized only as 32 bit, plus any
additional sizes enabled by capabilities.
* Vector types can only be parameterized with numerical types or the
OpTypeBool type.
* Matrix types can only be parameterized with floating-point types.
* Matrix types can only be parameterized as having only 2, 3, or 4
columns.
* Specialization constants (see Specialization) are limited to integers,
Booleans, floating-point numbers, and vectors of these.
Lei Zhang [Tue, 8 Nov 2016 18:26:09 +0000 (10:26 -0800)]
Rename validation source files to comply with Google style guide.
Lei Zhang [Tue, 8 Nov 2016 18:11:07 +0000 (10:11 -0800)]
Rename validation tests to comply with Google style guide.
Ehsan Nasiri [Fri, 4 Nov 2016 22:31:21 +0000 (18:31 -0400)]
Adding validation for vector data rule.
Number of components in a vector can be 2 or 3 or 4. If Vector16
capability is used, 8 and 16 components are also allowed.
Also added unit tests for vector data rule.
Lei Zhang [Thu, 22 Sep 2016 15:05:30 +0000 (11:05 -0400)]
Renaming test files to comply with Google style guide.
Also posfixing test files with `_test' to make it more clear.
David Neto [Fri, 28 Oct 2016 02:47:20 +0000 (22:47 -0400)]
Remove source/instruction.cpp
Avoids linker problems on Windows and OSX with duplicate object file
names. Avoids collision with source/val/instruction.cpp
Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/451
Jamie Madill [Thu, 27 Oct 2016 20:09:06 +0000 (16:09 -0400)]
enum_set: Fix bool performance warning.
Implicit casts from int to bool cause a warning in visual studio.
Christopher Gautier [Fri, 14 Oct 2016 10:45:27 +0000 (12:45 +0200)]
Do not gitignore source/opt/build_module.*
David Neto [Wed, 12 Oct 2016 14:47:28 +0000 (10:47 -0400)]
Test SPV_KHR_shader_draw_parameters support
In assembler, disassembler, parser.
Corentin Wallez [Tue, 4 Oct 2016 21:47:19 +0000 (17:47 -0400)]
Fix compilation errors when building inside Chromium
Example of an error:
spirv-tools/source/validate_cfg.cpp:516:45: error: chosen constructor is
explicit in copy-initialization:
_.current_function().RegisterBlockEnd({}, opcode);
Lei Zhang [Thu, 29 Sep 2016 16:00:35 +0000 (12:00 -0400)]
Add begin() and end() for TypeManager.
David Neto [Thu, 29 Sep 2016 20:43:47 +0000 (16:43 -0400)]
Remove unnecessary #include
This will make it easier to port these tests to different contexts.
Lei Zhang [Wed, 28 Sep 2016 14:50:43 +0000 (10:50 -0400)]
Add examples to demo C++ library APIs.
Lei Zhang [Fri, 23 Sep 2016 19:13:24 +0000 (15:13 -0400)]
Avoid appending EOL in StringifyMessage().
EOL should be appended when outputing to streams by the tool.
Lei Zhang [Thu, 22 Sep 2016 15:28:48 +0000 (11:28 -0400)]
Fix operand class test coverage table.
* Fix a missing column.
* Convert line endings.
This will make the table beautiful and searchable on Github.
Lei Zhang [Wed, 21 Sep 2016 21:16:31 +0000 (17:16 -0400)]
Clean up header dependency.
David Neto [Thu, 22 Sep 2016 21:09:34 +0000 (17:09 -0400)]
Handle parse failure for setting spec constants
Umar Arshad [Thu, 22 Sep 2016 14:23:08 +0000 (10:23 -0400)]
Fix forward reference issues with forword pointer
* Allows OpTypeForwardPointer to reference IDs not yet declared in
the module
* Allows OpTypeStruct to reference IDs not yet declared in
the module
Possible Issue: OpTypeStruct should only allow forward references
if the ID is a pointer that is referenced by a forward pointer. Need
Type support in Validator which is currently a work in progress.
qining [Thu, 22 Sep 2016 15:50:12 +0000 (11:50 -0400)]
Command line option for set default value for spec constant
Format:
```
--set-spec-constant-default-value "<spec id A>:<default value A> <spec id
B>:<default value B> ..."
```
Example:
shader: `test.vert`
```
layout(constant_id = 100) const int myint = 10;
layout(constant_id = 101) const int myuint = 100;
layout(constant_id = 200) const float myfloat = 1.25;
layout(constant_id = 201) const double mydouble = 2.34;
void main() {}
```
command line:
```
spirv-opt --set-spec-const-default-value "100:12 101:200 200:1.2323
201:1.2345" test.vert -o output.spv
```
output:
```
...
OpDecorate %7 SpecId 100
OpDecorate %8 SpecId 101
OpDecorate %10 SpecId 200
OpDecorate %12 SpecId 201
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%7 = OpSpecConstant %int 12
%8 = OpSpecConstant %int 200
%float = OpTypeFloat 32
%10 = OpSpecConstant %float 1.23232
%double = OpTypeFloat 64
%12 = OpSpecConstant %double 2.34232
...
```
Lei Zhang [Wed, 21 Sep 2016 20:45:53 +0000 (16:45 -0400)]
Use nullptr as the default message consumer to ignore all messages.
There is no difference between the previous IgnoreMessage() function
and a null std::function, from functionality's perspective.
The user can set nullptr as the MessageConsumer, so need to guard
against nullptr before calling the consumer anyway. It's better
we use it internally so that it may expose problems by us instead
of the user.
Lei Zhang [Wed, 21 Sep 2016 14:53:15 +0000 (10:53 -0400)]
Change some asserts to normal errors in IrLoader.
Lei Zhang [Wed, 21 Sep 2016 14:52:31 +0000 (10:52 -0400)]
Add two more utility functions for sending errors to consumer.
Lei Zhang [Wed, 14 Sep 2016 16:09:52 +0000 (12:09 -0400)]
Change parameter name from file to source in Log() and Logf().
Lei Zhang [Tue, 20 Sep 2016 22:03:37 +0000 (18:03 -0400)]
Add more Assemble(), Disassemble() and Validate() overloads.
Lei Zhang [Fri, 16 Sep 2016 20:12:04 +0000 (16:12 -0400)]
Publish the C++ interface.
Lei Zhang [Fri, 16 Sep 2016 19:56:30 +0000 (15:56 -0400)]
Rename SpvTools to SpirvTools.
Lei Zhang [Wed, 21 Sep 2016 16:44:37 +0000 (12:44 -0400)]
Use C style names for MessageLevel.
Lei Zhang [Wed, 21 Sep 2016 15:30:41 +0000 (11:30 -0400)]
Change to use enum instead of enum class for MessageLevel.
This allows us to create C interface with MessageLevel later.
Lei Zhang [Mon, 12 Sep 2016 18:11:46 +0000 (14:11 -0400)]
Add a C++ interface to the optimization functionalities.
Lei Zhang [Tue, 20 Sep 2016 20:48:00 +0000 (16:48 -0400)]
Allow changing MessageConsumer in Pass & PassManager.
Default-constructed Pass/PassManager will have a MessageConsumer
which ignores all messages. SetMessageConsumer() should be called
to supply a meaningful MessageConsumer.
Lei Zhang [Tue, 20 Sep 2016 20:44:24 +0000 (16:44 -0400)]
Change BuildModule() to accept pointer-size pair for binary.