Users always want to run all the checks. The spv_validate_options_t
mechanism, which provides little benefits to users, complicates the
internal implementation and also makes the tests exercise different
paths as users do.
Right now the tests are more like integration tests instead of
unit tests, which should be our next refactoring aim.
Now we have public headers arranged as follows:
$SPIRV_TOOLS_ROOT/include/spirv-tools/libspirv.h
$SPIRV_TOOLS_ROOT/include/spirv/spirv.h
$SPIRV_TOOLS_ROOT/include/spirv/GLSL.std.450.h
$SPIRV_TOOLS_ROOT/include/spirv/OpenCL.std.h
A project should use -I$SPIRV_TOOLS_ROOT/include
and then #include "spirv-tools/libspirv.h"
The headers from the SPIR-V Registry can be accessed as "spirv/spirv."
for example.
The install target should also install the headers from the SPIR-V
Registry. The libspirv.h header is broken otherwise.
The SPIRV-Tools library depends on the headers from the SPIR-V Registry.
The util/bitutils.h and util/hex_float.h are pulled into the internal
source tree. Those are not part of the public API to SPIRV-Tools.
Also tweak the image operands test with OpImageFetch so the input assembly
more closely matches the expected output. But don't make it a round
trip test since we want to check the assembler's ability to read the
image operand mask with out-of-order mask names.
The OpImageSparseRead assembly test is also a round trip disassembler
test.
This showed up in mips and mips64 builds. A combination of templates
and the error reporting were causing gcc to crash. This splits up the
functionality in a way that now successfully compiles.
- The SPIR-V spec generator has changed how it represents optional
operands. Now it tracks a separate boolean flag indicating optionality.
However, SPIRV-Tools still wants to represent both operand class
and optionality in the same enums space (SPV_OPERAND_TYPE_*).
So there's extra work in the patch.
- In the spec generator, OperandImage is now OperandImageOperands.
This affects enum translation in opcode.cpp.
- In the spec generator, image operands are explicitly followed by
Id, and VariableIds. However, SPIRV-Tools uses the bits set
in the image operand bitmask to control the number and meaning
of the Ids that follow. So in writing the opcode.inc syntax
table, drop all operands after OperandImageOperands.
- Some enums are now more explicitly represented in the generated
opcode.inc:
- AccessQualifier (e.g. on OpTypeImage), in both required and
optional flavours.
- MemoryAccess (e.g. on loads and stores)
- Add SPV_OPERAND_TYPE_OPTIONAL_ACCESS_QUALIFIER
- Add tests for the optional AccessQualifier operand on OpTypeImage.
- Update the AccessQualifier test for OpTypeImage so it's a round
trip test through the disassembler as well.
Allows an enclosing project to have already configured gmock, even
if the developer has placed the googletest sources under this
project's external/googletest directory.
Describe how to enable the tests in the two essential scenarios:
where SPIR-V Tools is standalone, or where SPIR-V Tools is configured
as a part of a larger project.
- For 32- and 64-bit floats, overflow is a parse error
This works around a difference between Xcode's istringstream
and other platforms. Xcode's runtime library will happlily
"round up" overflow values to infinity. We want to make it fail.
- When parsing a float fails due to bad syntax, follow C++11
behaviour for operator>> and set the value to zero.
- When parsing a 32-bit or 64-bit float overflows, follow C++11
behaviour for operator>> and set the value to the nearest
normal value: either max or lowest finite value for the type.
- Add FloatProxy<T>::max() and ::lowest()
- Make 16-bit overflow behaviour more consistent: we always get a
16-bit infinity of the right sign, whether the original string
is a normal value for 32-bit or an overflow value for 32-bit.
That matches our earlier intent.
Added TODO's to make 16-bit overflow always an error, just like
for 32-bit and 64-bit.
- Simplify normal parsing of Float16 values by delegating to
normal parsing of 32-bit floats.
Also checks some hex literal cases.
This addresses part of
https://github.com/KhronosGroup/SPIRV-Tools/issues/45
by removing the parseNumber case for "-0" on unsigned
integers. We don't care about that platform difference
at the level of std::istringstream, since we reject it
at a higher parsing level.
Also
- Add type_id to spv_id_info_t.
- Use spv_id_info_t::type_id instead of words[1].
Triggered some asserts on tests, where the code incorrectly assumed
words[1] had a type. Remove the asserts and handle gracefully.
- Add tests for OpStore of a label, a void, and a function.
If a third-party project defines a CMake function with the same
name, by importing that project's CMake configuration, we may end
up overwriting our own copy. Qualify all defined functions to
reduce that probability.