Commit Graph

2155 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
5b603e0166 Try another MSVC 2013 workaround. 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
6f8982bf3f Fix GCC 4.x warnings. 2019-04-09 15:09:44 +02:00
Hans-Kristian Arntzen
b5db60297a Workaround lack of alignas on MSVC 2013. 2019-04-09 15:09:44 +02:00
Hans-Kristian Arntzen
a489ba7fd1 Reduce pressure on global allocation.
- Replace ostringstream with custom implementation.
  ~30% performance uplift on vector-shuffle-oom test.
  Allocations are measurably reduced in Valgrind.

- Replace std::vector with SmallVector.
  Classic malloc optimization, small vectors are backed by inline data.
  ~ 7-8% gain on vector-shuffle-oom on GCC 8 on Linux.

- Use an object pool for IVariant type.
  We generally allocate a lot of SPIR* objects. We can amortize these
  allocations neatly by pooling them.

- ~15% overall uplift on ./test_shaders.py --iterations 10000 shaders/.
2019-04-09 15:09:44 +02:00
Hans-Kristian Arntzen
c60b9a1e96 CLI: Make --iterations more useful.
Add a basic benchmarking mode to test_shaders.py.
We cannot safely just call compile() in a loop. Do the full pipeline for
each iteration.
2019-04-09 15:09:16 +02:00
Hans-Kristian Arntzen
b2c2f724f4
Merge pull request #938 from KhronosGroup/fix-937
MSL: Fix OpLoad of array which is forced to a temporary.
2019-04-09 15:08:53 +02:00
Hans-Kristian Arntzen
23db744e35 Deal with case where we need to emit SpvImplArrayCopy late.
We cannot deduce if OpLoad needs ArrayCopy templates early since it's
heavily context dependent, and we might only know on 3rd iteration of
the compile loop.
2019-04-09 12:28:46 +02:00
Hans-Kristian Arntzen
bf07e5fa7b MSL: Fix OpLoad of array which is forced to a temporary. 2019-04-09 11:50:45 +02:00
Hans-Kristian Arntzen
2aec41dac8
Merge pull request #936 from lifpan/master
Add OpUndef instruction to block's instruction list for completeness.
2019-04-08 14:42:49 +02:00
lifpan
876627df3b Add OpUndef instruction to block's instruction list for completeness. 2019-04-08 19:45:31 +08:00
Hans-Kristian Arntzen
b7aa0d4e08
Merge pull request #935 from KhronosGroup/fix-931
Support fma() in older GLSL targets.
2019-04-08 12:04:46 +02:00
Hans-Kristian Arntzen
3ca8bc5e0d Support fma() in older GLSL targets. 2019-04-08 10:38:32 +02:00
Hans-Kristian Arntzen
133ea8fd82
Merge pull request #932 from billhollings/master
MSL: Fix infinite CAS loop on atomic_compare_exchange_weak_explicit().
2019-04-06 13:20:43 +02:00
Bill Hollings
efbe7ca16f MSL: Fix infinite CAS loop on atomic_compare_exchange_weak_explicit(). 2019-04-05 21:28:57 -04:00
Hans-Kristian Arntzen
4395339586
Merge pull request #930 from KhronosGroup/fix-929
Detect invalid DoWhileLoop early.
2019-04-05 14:03:06 +02:00
Hans-Kristian Arntzen
317144a59c Detect invalid DoWhileLoop early.
We had a bug where error conditions in DoWhileLoop emit path would not
detect that statements were being emitted due to the masking behavior
which happens when force_recompile is true. Fix this.

Also, refactor force_recompile into member functions so we can properly
break on any situation where this is set, without having to rely on
watchpoints in debuggers.
2019-04-05 12:19:32 +02:00
Hans-Kristian Arntzen
8db9ae0e9c
Merge pull request #928 from fjhenigman/roll2
Update to latest glslang/SPIRV-Tools.
2019-04-03 22:44:56 +02:00
Frank Henigman
248e95a42f Update to latest glslang/SPIRV-Tools. 2019-04-03 15:37:38 -04:00
Hans-Kristian Arntzen
44834f2115
Merge pull request #927 from KhronosGroup/fix-925
GLSL: Fix OpImageFetch with uint coordinates and LOD.
2019-04-03 12:32:43 +02:00
Hans-Kristian Arntzen
52e8547fd2
Merge pull request #926 from KhronosGroup/fix-msl-depth-texture-sampling
MSL: Fix depth2d 4-component fixup.
2019-04-03 12:32:26 +02:00
Hans-Kristian Arntzen
e4d5c6183a GLSL: Fix OpImageFetch with uint coordinates and LOD.
Also fix some minor issues with too many coordinate dimensions in HLSL and GLSL.
2019-04-03 10:50:32 +02:00
Hans-Kristian Arntzen
7e37623e82 MSL: Fix depth2d 4-component fixup.
Need to look at the backing image for the image. We might have found
diverging use at the image variable level, not just expression level.
2019-04-03 10:24:22 +02:00
Hans-Kristian Arntzen
fc37c52d26 Fix typo with array stride error message.
Trivial copy-paste bug.
2019-04-02 19:18:13 +02:00
Hans-Kristian Arntzen
5c239b857b
Merge pull request #921 from KhronosGroup/fix-902
Add an option to override the namespace used for spirv_cross.
2019-03-29 11:29:48 +01: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
3fa09f5677 HLSL: Fix up int16_t_literal_suffix. 2019-03-29 09:44:32 +01:00
Hans-Kristian Arntzen
9e8fc8caa9 Merge git://github.com/billhollings/SPIRV-Cross 2019-03-29 09:42:00 +01:00
Bill Hollings
c48702d8c2 Fix crash when backend.int16_t_literal_suffix set to null.
The design of backend.int16_t_literal_suffix and backend.uint16_t_literal_suffix
allows them to be set to null, but that was not always tested for.
I have removed the expectation that they can be null and set
backend.int16_t_literal_suffix to "" when no suffix is needed.
That has the same effect, and seemed to be a more usable and defensive approach.
2019-03-28 14:23:32 -04:00
Hans-Kristian Arntzen
18d4f67a87
Merge pull request #919 from KhronosGroup/fix-915
MSL: Declare gl_WorkGroupSize constant with [[maybe_unused]].
2019-03-28 14:00:49 +01:00
Hans-Kristian Arntzen
61cde3c3d0
Merge pull request #918 from KhronosGroup/fix-916
MSL: Fix crash where variable storage buffer pointers are passed down.
2019-03-28 13:54:20 +01:00
Hans-Kristian Arntzen
0909975655 MSL: Declare gl_WorkGroupSize constant with [[maybe_unused]].
Avoids ugly warnings on nearly every compute shader.
We could do analysis to detect whether we need to emit this constant,
but it's a bit tedious to figure out if an OpConstantComponent is
actually used by opcodes, so just make it simple.
2019-03-28 10:54:18 +01:00
Hans-Kristian Arntzen
c37f88fea6 MSL: Fix crash where variable storage buffer pointers are passed down.
Only deal with readonly decoration for actual block types.
2019-03-28 10:16:46 +01:00
Hans-Kristian Arntzen
ef4aa46be7
Merge pull request #914 from KhronosGroup/fix-909
Make build system more modular.
2019-03-27 14:18:12 +01:00
Hans-Kristian Arntzen
6648ccc9e5
Merge pull request #913 from KhronosGroup/fix-908
Properly deal with sign-dependent GLSL opcodes.
2019-03-27 14:18:01 +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
eeb3f24991 Properly deal with sign-dependent GLSL opcodes.
The GLSLstd450 spec is very lax about input signs, so we need to do the
bitcasting dance to implement it correctly.
2019-03-27 12:20:53 +01:00
Hans-Kristian Arntzen
b64e4564ba
Merge pull request #912 from KhronosGroup/fix-910
Parser: Fix OpCompositeConstruct with OpUndef.
2019-03-27 12:20:41 +01:00
Hans-Kristian Arntzen
df3e21a762 Parser: Fix OpCompositeConstruct with OpUndef.
Just treat any undefined argument as 0. It is risky to use the undefined
variable as it might not lower to a true constant.
2019-03-27 10:51:23 +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
689a7deb3e Make ray-tracing files .nocompat. 2019-03-27 10:04:42 +01:00
Hans-Kristian Arntzen
82e23e4221 Merge branch 'SPV_NV_ray_tracing' of git://github.com/pmoursnv/SPIRV-Cross 2019-03-27 09:58:23 +01:00
Patrick Mours
0f72199b8f Add generated reference shaders again 2019-03-26 15:21:12 +01:00
Patrick Mours
b2a667520d Add reflection support for ray tracing acceleration structures 2019-03-26 15:09:42 +01:00
Patrick Mours
524bd43deb Add reflection support for ray tracing exection models 2019-03-26 14:46:51 +01:00
Patrick Mours
9910cdbf0c Remove reference shaders again 2019-03-26 14:27:42 +01:00
Patrick Mours
90c91e4f23 Fix missing check for purity on ray tracing builtins 2019-03-26 14:25:25 +01:00
Patrick Mours
c96bab0659 Replace usage of "require_extension" with "require_extension_internal" and "to_func_call_arg" with "to_expression" 2019-03-26 14:04:39 +01:00
Patrick Mours
dfa2a0abf9 Add generated reference shaders
See commit aa1c72bc51
2019-03-25 15:16:08 +01:00
Patrick Mours
aa1c72bc51 Add ray tracing test shaders
Slightly modified from https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#_sample_code_2
2019-03-25 15:07:51 +01:00