Commit Graph

20 Commits

Author SHA1 Message Date
alan-baker
d35a78db57
Switch SPIRV-Tools to use spirv.hpp11 internally (#4981)
Fixes #4960

* Switches to using enum classes with an underlying type to avoid
  undefined behaviour
2022-11-04 17:27:10 -04:00
luzpaz
65ecfd1093
Fix various source comment (doxygen) typos (#4680)
Found via `codespell -q 3 -L fo,lod,parm
2022-01-26 15:13:08 -05:00
Marius Hillenbrand
1ed847f438
Fix endianness of string literals (#4622)
* Fix endianness of string literals

To get correct and consistent encoding and decoding of string literals
on big-endian platforms, use spvtools::utils::MakeString and MakeVector
(or wrapper functions) consistently for handling string literals.

- add variant of MakeVector that encodes a string literal into an
  existing vector of words
- add variants of MakeString
- add a wrapper spvDecodeLiteralStringOperand in source/
- fix wrapper Operand::AsString to use MakeString (source/opt)
- remove Operand::AsCString as broken and unused
- add a variant of GetOperandAs for string literals (source/val)
... and apply those wrappers throughout the code.

Fixes  #149

* Extend round trip test for StringLiterals to flip word order

In the encoding/decoding roundtrip tests for string literals, include
a case that flips byte order in words after encoding and then checks for
successful decoding. That is, on a little-endian host flip to big-endian
byte order and then decode, and vice versa.

* BinaryParseTest.InstructionWithStringOperand: also flip byte order

Test binary parsing of string operands both with the host's and with the
reversed byte order.
2021-12-08 12:01:26 -05:00
Corentin Wallez
4a59fd4763
Fix -Wextra-semi-stmt -Wsuggest-destructor-override -Wdeprecated-copy-dtor (#4164)
* Fix -Wextra-semi-stmt
* Fix -Wsuggest-destructor-override
* Fix -Wdeprecated-copy-dtor
2021-03-09 13:16:43 +00:00
Alastair Donaldson
ed9863e46e
Favour 'integrity' over 'coherence' as a replacement for 'sanity'. (#3619) 2020-09-10 09:52:21 -04:00
Alastair Donaldson
f9b088fe0d
Avoid use of 'sanity' and 'sanity check' in the code base (#3585)
In line with:

  https://source.android.com/setup/contribute/respectful-code

this change uses the terms 'coherence' and 'coherence check' where
'sanity' and 'sanity check' were previously used.
2020-07-28 23:55:02 -04:00
Steven Perron
4b64beb1ae
Add descriptor array scalar replacement (#2742)
Creates a pass that will replace a descriptor array with individual variables.  See #2740 for details.

Fixes #2740.
2019-08-08 10:53:19 -04:00
Steven Perron
464111eaef
Remove use of deprecated googletest macro (#2286)
* Remove use of deprecated googletest macro

INSTANTIATE_TEST_CASE_P has been deprecated.  We need to use
INSTANTIATE_TEST_SUITE_P instead.

* Remove extra commas from test suites.
2019-01-29 18:56:52 -05:00
David Neto
70404a96ab
Fix leaks in tests (#2295)
Generally, a test fixture in a method that can generate a binary
should release any previously cached binary.  Similarly for diagnostics.
2019-01-16 16:53:10 -05:00
dan sinclair
167f1270a9
Output disassembly line number for binary parse errors. (#2195)
This Cl changes the binary parser to keep track of the instruction count
being processed. The parser will then use that instruction number as the
error number, instead of the binary word.

This should make it easier to match the error up to what the
disassembler would output for the error.

Issue #2091
2018-12-21 16:24:15 -05:00
dan sinclair
45784eb2c8
Remove use of SetContextMessageConsumer from binary_parse_test (#1925)
This CL removes the use of SetContextMessageConsumer from the
binary_parse_test tests and creates a Context object and uses
SetMessageConsumer instead.
2018-09-26 13:17:36 -07:00
David Neto
571251c8f8 Support SPV_KHR_vulkan_memory_model rev2
Support collapsed into one commit:
- Asm/Dis support for SPV_KHR_vulkan_memory_model
- Add Vulkan mem model image operands to switch
- Add TODO for source/validate_image.cpp
- val: Image operands NonPrivateTexelKHR, VolatileTexelKHR have no operands
  This is required for memory model tests to pass SPIR-V validation.
- Round trip tests: Test new flags on OpCopyMemory*
2018-09-06 13:30:32 -04:00
dan sinclair
ef678672fb
Remove source/message.h (#1838)
The code in source/message was only used in a single set of tests to
format the output results. This CL changes the test to verify the
message instead of all the error values and removes the source/message
code.
2018-08-14 15:41:21 -04:00
dan sinclair
eda2cfbe12
Cleanup includes. (#1795)
This Cl cleans up the include paths to be relative to the top level
directory. Various include-what-you-use fixes have been added.
2018-08-03 15:06:09 -04:00
dan sinclair
3dad1cda11
Change libspirv to spvtools namespace (#1678)
This CL changes all of the libspirv namespace code to spvtools to match
the rest of the code base.
2018-07-07 09:38:00 -04:00
David Neto
363bfca2ed Operand lookup succeeds if it's enabled by a capability
- Fix tests for basic group operations (e.g. Reduce) to allow for
new capabilities in SPIR-V 1.3 that enable them.
- Refactor operand capability check to avoid code duplication and
to put all checks that don't need table lookup before any table
lookup.
- Test round trip assembly/disassembly support for extension
SPV_NV_viewport_array2
- Test assembly and validation of decoration ViewportRelativeNV

Fixes #1596
2018-06-11 19:27:52 -04:00
Andrey Tuganov
af7d5799a5 Refactor include of latest spir-v header versions 2017-12-14 11:18:20 -05:00
Diego Novillo
83228137e1 Re-format source tree - NFC.
Re-formatted the source tree with the command:

$ /usr/bin/clang-format -style=file -i \
    $(find include source tools test utils -name '*.cpp' -or -name '*.h')

This required a fix to source/val/decoration.h.  It was not including
spirv.h, which broke builds when the #include headers were re-ordered by
clang-format.
2017-11-27 14:31:49 -05:00
David Neto
c2999273d9 Move SetContextMessageConsumer into libspirv namespace
Avoid polluting the global namespace.
2017-11-23 13:56:12 -05:00
Lei Zhang
4f57e140bf Renaming test files to comply with Google style guide.
Also posfixing test files with `_test' to make it more clear.
2016-11-07 14:41:51 -05:00