Commit Graph

53 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
7ffc24fa20 MSVC 2015: Workaround bogus warning with move_backwards. 2019-07-12 10:19:16 +02:00
Hans-Kristian Arntzen
656d129c00 Add C API for get_declared_struct_member_size. 2019-06-26 19:12:32 +02:00
Hans-Kristian Arntzen
048f2380f3 MSL: Support custom bindings for argument buffer itself. 2019-06-24 11:10:20 +02:00
Hans-Kristian Arntzen
3a4a9acac9 MSL: Add C API for querying automatic resource bindings. 2019-06-21 13:19:59 +02:00
Hans-Kristian Arntzen
30bb197a5d MSL: Support remapping constexpr samplers by set/binding.
Older API was oriented around IDs which are not available unless you're
doing full reflection, which is awkward for certain use cases which know
their set/bindings up front.

Optimize resource bindings to be hashmap rather than doing linear seeks
all the time.
2019-06-10 15:41:36 +02:00
Hans-Kristian Arntzen
65af09d2d1 Support emitting OpLine directive.
Facilitates easier mapping from source language to cross-compiled output
in tooling.
2019-05-28 13:44:24 +02:00
Hans-Kristian Arntzen
7b9e0fb428 MSL: Implement OpArrayLength.
This gets rather complicated because MSL does not support OpArrayLength
natively. We need to pass down a buffer which contains buffer sizes, and
we compute the array length on-demand.

Support both discrete descriptors as well as argument buffers.
2019-05-27 16:13:09 +02:00
Hans-Kristian Arntzen
0b9a884f3f Add Git/timestamp --revision support. 2019-05-24 15:24:41 +02:00
Hans-Kristian Arntzen
09c01c2d45 Fix formatting, update C ABI version.
There are some issues with clang-format which require auto-formatting to
be disabled for this file.
2019-05-18 10:47:02 +02:00
Hans-Kristian Arntzen
eaf7afed97 MSL: Support argument buffers and image swizzling.
Change aux buffer to swizzle buffer.
There is no good reason to expand the aux buffer, so name it
appropriately.

Make the code cleaner by emitting a straight pointer to uint rather than
a dummy struct which only contains a single unsized array member anyways.

This will also end up being very similar to how we implement swizzle
buffers for argument buffers.

Do not use implied binding if it overflows int32_t.
2019-05-18 10:30:06 +02:00
Hans-Kristian Arntzen
542d6683b8 Validate that C ABI in CMakeLists.txt matches code. 2019-05-14 10:06:33 +02:00
Laszlo Agocs
7bc31491be GLSL: Add option to disable buffer blocks regardless of version 2019-05-13 21:29:06 +02:00
Hans-Kristian Arntzen
ae3783c725 Add texture_buffer_native option to C API. 2019-04-23 12:25:42 +02:00
Hans-Kristian Arntzen
03ddea8eb1 Refactor out error handling and containers to new headers.
spirv_common.hpp got very crowded and it made more sense to split out
concerns to different headers.
2019-04-09 15:09:44 +02:00
Hans-Kristian Arntzen
3a57286595 Implement edge cases in insert/end and add a simple test case. 2019-04-09 15:09:44 +02:00
Hans-Kristian Arntzen
9b92e68d71 Add an option to override the namespace used for spirv_cross.
This is a pragmatic trick to avoid symbol collision where a project
links against SPIRV-Cross statically, while linking to other projects
which also use SPIRV-Cross statically. We can end up with very awkward
symbol collisions which can resolve themselves silently because
SPIRV-Cross is pulled in as necessary. To fix this, we must use
different symbols and embed two copies of SPIRV-Cross in this scenario,
now with different namespaces, which in turn leads to different symbols.
2019-03-29 10:29:44 +01:00
Hans-Kristian Arntzen
6b69fe65f8 Make build system more modular.
Allow user to disable individual backends.
Disallow this for CLI builds for now, but should be useful for
library-only builds, and particularly for C API.
2019-03-27 13:21:11 +01:00
Hans-Kristian Arntzen
88ce958a51 Add ray-tracing reflection to main.cpp and C API. 2019-03-27 10:21:30 +01:00
Hans-Kristian Arntzen
0474848d4a GLSL: Support emitting push constant block as a plain UBO. 2019-03-19 10:58:52 +01:00
Hans-Kristian Arntzen
e47a77d596 MSL: Implement Metal 2.0 indirect argument buffers. 2019-03-15 11:01:27 +01:00
Hans-Kristian Arntzen
074f765a83 Explicitly pass down paths to glslang/spirv-tools.
Windows and CMake really cannot get along with %PATH%, sigh ...
2019-03-07 12:36:16 +01:00
Hans-Kristian Arntzen
79d995caab Gracefully fall back in test suite if we haven't built deps. 2019-03-07 10:22:58 +01:00
Hans-Kristian Arntzen
f0ad0f1015 Add ubsan and msan. 2019-03-05 11:15:08 +01:00
Hans-Kristian Arntzen
5341a189ff Add support for sanitizing address and threads. 2019-03-05 10:11:04 +01:00
Hans-Kristian Arntzen
afef135dd8 Add a simple SPIR-V for purposes of smoke testing the C API. 2019-03-04 11:37:01 +01:00
Hans-Kristian Arntzen
3699ead741 Add C sample code to the README. 2019-03-04 11:33:01 +01:00
Hans-Kristian Arntzen
ee11bb3bc6 Add a C API smoke test. 2019-03-04 11:14:33 +01:00
Hans-Kristian Arntzen
e74c21a39b Review fixups. 2019-03-04 10:08:31 +01:00
Hans-Kristian Arntzen
9bbdccddb7 Add a stable C API for SPIRV-Cross.
This adds a new C API for SPIRV-Cross which is intended to be stable,
both API and ABI wise.

The C++ API has been refactored a bit to make the C wrapper easier and
cleaner to write. Especially the vertex attribute / resource interfaces
for MSL has been rewritten to avoid taking mutable pointers into the
interface. This would be very annoying to wrap and it didn't fit well
with the rest of the C++ API to begin with. While doing this, I went
ahead and removed all the old deprecated interfaces.

The CMake build system has also seen an overhaul.
It is now possible to build static/shared/CLI separately with -D
options.
The shared library only exposes the C API, as it is the only ABI-stable
API. pkg-configs as well as CMake modules are exported and installed for
the shared library configuration.
2019-03-01 11:53:51 +01:00
Hans-Kristian Arntzen
6157bf3cae Add Windows support in Travis CI.
- Add new Windows support
- Use CMake/CTest instead of Make + shell scripts
- Use --parallel in CTest
- Fix CTest on Windows
- Cleanups in test_shaders.py
- Force specific commit for SPIRV-Headers
- Fix Inf/NaN odd-ball case by moving to ASM
2018-10-27 00:22:30 +02:00
Hans-Kristian Arntzen
5bcf02f7c9 Hoist out parsing module from spirv_cross::Compiler.
This is a large refactor which splits out the SPIR-V parser from
Compiler and moves it into its more appropriately named Parser module.

The Parser is responsible for building a ParsedIR structure which is
then consumed by one or more compilers.

Compiler can take a ParsedIR by value or move reference. This should
allow for optimal case for both multiple compilations and single
compilation scenarios.
2018-10-19 12:01:31 +02:00
Jian Yang
df6574d764 fix typo in CMakeLists.txt 2018-08-04 14:40:06 +08:00
Brad Davis
709d3c60f2 Working on reflection output 2018-06-20 09:20:45 -07:00
Hans-Kristian Arntzen
d0c829b580 Add no-opt to CTest, make test_shaders.py faster when FXC is missing. 2018-04-18 16:53:43 +02:00
grovesNL
94cd77799f Move rename_interface_variable to util 2018-03-01 23:47:08 -07:00
Hans-Kristian Arntzen
3088701f59 Hook up --opt tests in Travis. 2017-11-23 09:50:11 +01:00
Geoffroy Aubey
3a0b20fd71 Add compile options and compile defines to spirv-cross target. 2017-09-28 00:19:01 +02:00
Joao Paulo Magalhaes
87df893ba9 Add missing parenthesis from the merge. 2017-05-31 10:20:28 +02:00
Joao Paulo Magalhaes
87e09f47f2 fix core library name 2017-05-31 10:18:27 +02:00
Joao Paulo Magalhaes
3db95327ac Added install targets to cmake. The following tree is produced:
.
./bin
./bin/spirv-cross.exe
./include
./include/spirv_cross
./include/spirv_cross/GLSL.std.450.h
./include/spirv_cross/spirv.hpp
./include/spirv_cross/spirv_cfg.hpp
./include/spirv_cross/spirv_common.hpp
./include/spirv_cross/spirv_cpp.hpp
./include/spirv_cross/spirv_cross.hpp
./include/spirv_cross/spirv_glsl.hpp
./include/spirv_cross/spirv_msl.hpp
./lib
./lib/spirv-cross-core.lib
./lib/spirv-cross-cpp.lib
./lib/spirv-cross-glsl.lib
./lib/spirv-cross-msl.lib
./share
./share/spirv_cross
./share/spirv_cross/cmake
./share/spirv_cross/cmake/spirv_crossConfig-release.cmake
./share/spirv_cross/cmake/spirv_crossConfig.cmake
./share/spirv_cross_cpp
./share/spirv_cross_cpp/cmake
./share/spirv_cross_cpp/cmake/spirv_cross_cppConfig-release.cmake
./share/spirv_cross_cpp/cmake/spirv_cross_cppConfig.cmake
./share/spirv_cross_glsl
./share/spirv_cross_glsl/cmake
./share/spirv_cross_glsl/cmake/spirv_cross_glslConfig-release.cmake
./share/spirv_cross_glsl/cmake/spirv_cross_glslConfig.cmake
./share/spirv_cross_msl
./share/spirv_cross_msl/cmake
./share/spirv_cross_msl/cmake/spirv_cross_mslConfig-release.cmake
./share/spirv_cross_msl/cmake/spirv_cross_mslConfig.cmake
2017-05-31 10:18:27 +02:00
Hans-Kristian Arntzen
56df3bf5fe Add HLSL testing to ctest. 2017-01-28 08:58:39 +01:00
Robert Konrad
98eadc086e Add HLSL to cmake file 2017-01-25 17:20:43 +01:00
Hans-Kristian Arntzen
1c28ec6885 Add basic setup for regression testing Metal output. 2017-01-24 14:04:55 +01:00
Hans-Kristian Arntzen
ce3fe29557 MSVC maintenance. 2017-01-12 10:57:44 +01:00
Panagiotis Christopoulos Charitos
7f69f9395e Rework after review 2016-12-15 20:46:10 +01:00
Panagiotis Christopoulos Charitos
946f7796c1 Add an option to disable exceptions
Some refactoring in the no-exceptions case

Grooming the no-exceptions patch for pull request
2016-12-15 17:49:01 +01:00
Hans-Kristian Arntzen
9075262787 Use -D__STDC_LIMIT_MACROS.
Avoids random #ifndef.
2016-11-25 23:40:28 +01:00
Hans-Kristian Arntzen
810fa633d0 Merge pull request #71 from KhronosGroup/cfg-analysis
WIP: Add control flow graph analysis for variable scoping
2016-11-21 09:11:54 +01:00
Cort
ffb6613482 Fixed python3 detection for spirv-cross-test.
Windows Python 3.x installations do not include a python3.exe; this
caused the old test to fail and issue a spurious warning.
2016-11-18 14:02:48 -08:00
Hans-Kristian Arntzen
dad4a34072 Start adding CFG analysis.
Not complete yet, but partly working ...
2016-11-17 16:58:05 +01:00