Commit Graph

1994 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
a94490498d
Merge pull request #894 from KhronosGroup/fix-882
GLSL: Support emitting push constant block as a plain UBO.
2019-03-19 11:56:24 +01:00
Hans-Kristian Arntzen
1389aa34e4 GLSL: Check target version for push constant location = N. 2019-03-19 11:20:53 +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
66f32eca72
Merge pull request #893 from KhronosGroup/fix-891
Fix build on Android API < 26.
2019-03-18 10:15:20 +01:00
Hans-Kristian Arntzen
7310274a4f Fix build on Android API < 26. 2019-03-18 10:14:04 +01:00
Hans-Kristian Arntzen
f1d10089fa
Merge pull request #892 from fjhenigman/roll
Update to latest glslang/SPIRV-Tools.
2019-03-18 09:59:21 +01:00
Frank Henigman
b393fa5c85 Update to latest glslang/SPIRV-Tools. 2019-03-17 23:38:34 -04:00
Hans-Kristian Arntzen
62dce70c2e
Merge pull request #890 from KhronosGroup/msl-argument-buffers
MSL: Add support for Metal 2 indirect argument buffers.
2019-03-16 10:31:54 +01:00
Hans-Kristian Arntzen
d8e4d995e5 Remove strange include which got included for some reason. 2019-03-15 21:55:53 +01:00
Hans-Kristian Arntzen
e2aadf8995 Rename "push descriptor set" to "discrete descriptor set".
Check for case where iOS doesn't support writable argument buffer
textures.
2019-03-15 21:53:21 +01:00
Hans-Kristian Arntzen
b3380ec9dd MSL: Support VK_KHR_push_descriptor.
If we have argument buffers, we also need to support using plain
descriptor sets for certain cases where API wants it.
2019-03-15 14:08:47 +01:00
Hans-Kristian Arntzen
a5f072d2ab MSL: Add some comments about how we remap bindings for IAB. 2019-03-15 13:07:59 +01:00
Hans-Kristian Arntzen
c310b40fd3 MSL: Make sure get_buffer_block_flags is only used in right context. 2019-03-15 12:27:54 +01:00
Hans-Kristian Arntzen
bc21ccb7ce MSL: Emit correct SSBO constness for argument buffers. 2019-03-15 12:05:35 +01:00
Hans-Kristian Arntzen
969566aff5 MSL: Fixup buffer array case issue on MSL 1.0. 2019-03-15 11:37:34 +01:00
Hans-Kristian Arntzen
af8a9ccdcb MSL: Need to emit two layers of address space.
When passing down arrays of buffer pointers, the array itself needs an
address space.
2019-03-15 11:29:17 +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
ed55e0ac6d
Merge pull request #886 from KhronosGroup/fix-885
Gracefully fall back in test suite if we haven't built external dependencies
2019-03-07 14:39:31 +01:00
Hans-Kristian Arntzen
852e63eebc Clean up some very verbose argument passing. 2019-03-07 12:43:00 +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
46290a67d1 Update spirv.h. 2019-03-07 10:21:18 +01:00
Hans-Kristian Arntzen
a206afa785
Merge pull request #884 from KhronosGroup/negative-loop-tests
Extend loop tests to cover negative tests.
2019-03-06 13:27:00 +01:00
Hans-Kristian Arntzen
cff057ca5a We emit loop header variables even for while and dowhile.
Make the name clearer.
2019-03-06 12:30:11 +01:00
Hans-Kristian Arntzen
8bfb04d29d Run format_all.sh
Disable clang format in C wrapper for now.
Some weird formatting bug with the try/catch macro.
2019-03-06 12:20:13 +01:00
Hans-Kristian Arntzen
ef24337849 Support do-while where test is negative. 2019-03-06 12:17:38 +01:00
Hans-Kristian Arntzen
70ff96b03f Deal with more for loop candidate cases.
We can trivially deal with cases where the loop tests are simply
inverted. We can also deal with cases where the condition block branches
to the merge block via other noop blocks.
This makes SPIR-V codegen easier when targeting SPIRV-Cross.
2019-03-06 11:24:43 +01:00
Hans-Kristian Arntzen
b680c5fa34
Merge pull request #869 from KhronosGroup/c-api
Add a stable C API for SPIRV-Cross.
2019-03-06 10:09:53 +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
e4704c5cf7 Run install targets on Travis. 2019-03-04 11:39:27 +01:00
Hans-Kristian Arntzen
73db6f3437 Build shared library in travis. 2019-03-04 11:38:39 +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
b206d47cb7
Merge pull request #881 from KhronosGroup/fix-880
Rewrite how we deal with locales and decimal point
2019-02-28 14:40:36 +01:00
Hans-Kristian Arntzen
4096552c26 Use RADIXCHAR, which is the portable variant of DECIMAL_POINT. 2019-02-28 12:32:52 +01:00
Hans-Kristian Arntzen
8255dd3ed6 Use nl_langinfo on POSIX systems.
localeconv is not MT-safe.
2019-02-28 11:51:08 +01:00
Hans-Kristian Arntzen
825ff4af7e Replace locale handling.
We were using std::locale::global() to force a C locale which is not
safe when SPIRV-Cross is used in a multi-threaded environment.

To fix this, we could tap into various per-platform specific locale
handling to get safe thread-local locales, but since locales only affect
the decimal point in floats, we simply query the locale instead and do
the necessary radix replacement ourselves, without touching the locale.

This should be much safer and cleaner than the alternative.
2019-02-28 11:28:31 +01:00
Patrick Mours
da39a7b02f Add support for SPV_NV_ray_tracing 2019-02-26 15:43:03 +01:00
Hans-Kristian Arntzen
6f50806698
Merge pull request #879 from KhronosGroup/fix-878
MSL: Emit proper name for optimized UBO/SSBO arrays.
2019-02-25 12:43:33 +01:00
Hans-Kristian Arntzen
ee395afa83 MSL: Emit proper name for optimized UBO/SSBO arrays. 2019-02-25 11:09:00 +01:00
Hans-Kristian Arntzen
ad6134262e
Merge pull request #877 from cdavis5e/msl-tesc-early-return
MSL: Return early from helper tesc invocations.
2019-02-25 09:13:06 +01:00
Hans-Kristian Arntzen
7874f7fc49
Merge pull request #876 from cdavis5e/msl-tese-fixup-2
MSL: Make sure we fix up the output position.
2019-02-25 09:12:47 +01:00
Hans-Kristian Arntzen
ba0d5d12a5
Merge pull request #875 from cdavis5e/msl-tess-levels-tese
MSL: Use vectors for the tessellation level builtins in tese shaders.
2019-02-25 09:12:37 +01:00
Chip Davis
a43dcd7b99 MSL: Return early from helper tesc invocations.
Return after loading the input control point array if there are more
input points than output points, and this was one of the helper
invocations spun off to load the input points. I was hesitant to do this
initially, since the MSL spec has this to say about barriers:

> The `threadgroup_barrier` (or `simdgroup_barrier`) function must be
> encountered by all threads in a threadgroup (or SIMD-group) executing
> the kernel.

That is, if any thread executes the barrier, then all threads must
execute it, or the barrier'd invocations will hang. But, the key words
here seem to be "executing the kernel;" inactive invocations, those that
have already returned, need not encounter the barrier to prevent hangs.
Indeed, I've encountered no problems from doing this, at least on my
hardware. This also fixes a few CTS tests that were failing due to
execution ordering; apparently, my assumption that the later, invalid
data written by the helpers would get overwritten was wrong.
2019-02-24 12:17:47 -06:00
Chip Davis
f3267db1d8 MSL: Make sure we fix up the output position.
If a stage takes the position as both an input and an output (i.e. a
tessellation shader or a geometry shader), then we could wind up fixing
up the input position by mistake. Ensure that doesn't happen, by only
setting the `qual_pos_var_name` variable from the output position.
2019-02-22 15:28:28 -06:00
Chip Davis
f3c0942d10 MSL: Use vectors for the tessellation level builtins in tese shaders.
The tessellation levels in Metal are stored as a densely-packed array of
half-precision floating point values. But, stage-in attributes in Metal
have to have offsets and strides aligned to a multiple of four, so we
can't add them individually. Luckily for us, the arrays have lengths
less than 4. So, let's use vectors for them!

Triangles get a single attribute with a `float4`, where the outer levels
are in `.xyz` and the inner levels are in `.w`. The arrays are unpacked
as though we had added the elements individually. Quads get two: a
`float4` with the outer levels and a `float2` with the inner levels.
Further, since vectors can be indexed as arrays, there's no need to
unpack them in this case.

This also saves on precious vertex attributes. Before, we were using up
to 6 of them. Now we need two at most.
2019-02-22 12:18:51 -06:00