Граф коммитов

104 Коммитов

Автор SHA1 Сообщение Дата
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 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 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 e47a77d596 MSL: Implement Metal 2.0 indirect argument buffers. 2019-03-15 11:01:27 +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
Chip Davis 41d9424233 MSL: Add an option to set the tessellation domain origin.
This is intended to be used to support `VK_KHR_maintenance2`'s
tessellation domain origin feature. If `tess_domain_origin_lower_left`
is `true`, the `v` coordinate will be inverted with respect to the
domain. Additionally, in `Triangles` mode, the `v` and `w` coordinates
will be swapped. This is because the winding order is interpreted
differently in lower-left mode.
2019-02-18 14:25:42 -06:00
Chip Davis c51e5b7911 MSL: Add a setting to capture vertex shader output to a buffer.
This will be necessary to support transform feedback, as well as
tessellation shaders.
2019-02-05 20:00:10 -06:00
Hans-Kristian Arntzen b8033d7525 MSL: Add option to pad fragment outputs.
If not enough components are provided in the shader,
the shader MSL compiler throws an error rather than make components
undefined. This hurts portability, so we need to add explicit padding
here.
2019-01-14 15:11:52 +01:00
Hans-Kristian Arntzen 6e1c3ccb72 Run format_all.sh. 2019-01-11 12:56:00 +01:00
Hans-Kristian Arntzen a2a44d944e HLSL: Support BaseVertex/BaseInstance offsets.
Opt-in, since user need to know about a cbuffer.
Conflicts a bit with the GLSL option for base instance,
since that one is enabled by default, but the HLSL one isn't (because
user needs to know about a magic cbuffer, whereas GLSL can only get
default initialized uniform).
2019-01-11 10:32:14 +01:00
Hans-Kristian Arntzen 318c17cbb2 Nonfunctional: Update copyright headers for 2019. 2019-01-04 12:38:35 +01:00
Hans-Kristian Arntzen b778e16e48 HLSL: Complete support for combined image samplers in legacy. 2018-11-12 09:59:39 +01:00
Minmin Gong e3ebfdaae5 HLSL: Combine image and sampler on shader model <= 30 2018-11-10 13:44:59 -08: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
Chip Davis 2506046cb4 Merge remote-tracking branch 'origin' into resource-arrays-msl 2018-09-27 10:50:16 -05:00
Hans-Kristian Arntzen c07c303999 Use GL_EXT_samplerless_texture_functions in Vulkan GLSL. 2018-09-27 13:36:38 +02:00
Chip Davis 3a9af9681c MSL: Expand arrays of buffers passed as input.
Even as of Metal 2.1, MSL still doesn't support arrays of buffers
directly. Therefore, we must manually expand them. In the prologue, we
define arrays holding the argument pointers; these arrays are what the
transpiled code ends up referencing. We might be able to do similar
things for textures and samplers prior to MSL 2.0.

Speaking of which, also enable texture arrays on iOS MSL 1.2.
2018-09-26 20:48:09 -05:00
Chip Davis 2583321657 MSL: Add an option to insert texture swizzles into generated shaders.
It's intended to be used with MoltenVK to support arbitrary
`VkComponentMapping` settings. The idea is that MoltenVK will pass a
buffer (which it set to some buffer index that isn't being used)
containing packed versions of the `VkComponentMapping` struct, one for
each sampled image.

Yes, this is horribly ugly. It is unfortunately necessary. Much of the
ugliness is to support swizzling gather operations, where we need to
alter the component that the gather operates on--something complicated
by the `gather()` method requiring the passed-in component to be a
constant expression. It doesn't even support swizzling gathers on depth
textures, though I could add that if it turns out we need it.
2018-09-19 22:32:24 -05:00
Hans-Kristian Arntzen e86018f8a1 Add a helper function to improve reflection on runtime sized arrays. 2018-09-10 11:08:47 +02:00
Hans-Kristian Arntzen b29629fd46 Add support to remove SPIRV_Cross_BaseInstance uniform. 2018-06-22 10:01:38 +02:00
Brad Davis 0ad0f948e1 More PR feedback 2018-06-21 07:43:52 -07:00
Brad Davis 762040084d More feedback 2018-06-20 10:25:38 -07:00
Brad Davis 6c88b0048b PR feedback 2018-06-20 09:20:45 -07:00
Brad Davis ee86000529 Cleanup code 2018-06-20 09:20:45 -07:00
Brad Davis 709d3c60f2 Working on reflection output 2018-06-20 09:20:45 -07:00
Hans-Kristian Arntzen 3a9b045dc3 Various maintenance fixes.
- Do not emit set = in GLSL, even when non-zero.
- Fix warning on tautological comparison.
- Expose get_buffer_block_flags as mentioned in reflection guide.
2018-06-03 12:00:22 +02:00
Hans-Kristian Arntzen a1b3964cbd Run format_all.sh. 2018-05-25 10:14:13 +02:00
Hans-Kristian Arntzen ba15daee33 Add support for inheriting bindings for combined image samplers. 2018-05-23 20:34:26 +01:00
Hans-Kristian Arntzen e30a94225f Complete MSL constexpr samplers.
Deal with defaults and avoid verbose declarations.
2018-04-18 16:19:55 +02:00
Hans-Kristian Arntzen e8e58844d4 Rewrite everything to use Bitset rather than uint64_t. 2018-03-12 13:24:14 +01:00
Hans-Kristian Arntzen a803e5ae38 Deprecate set_options()/get_options() interface, replace it.
Replace with common/hlsl/msl instead. The old interface had some bad
interaction with overloading which meant you had to up-cast to base
class to be able to use set_options, which was awkward.
2018-03-09 15:25:25 +01:00
grovesNL 94cd77799f Move `rename_interface_variable` to util 2018-03-01 23:47:08 -07:00
Hans-Kristian Arntzen 1e4db56a65 Run format_all.sh. 2018-03-01 14:03:59 +01:00
Hans-Kristian Arntzen eecbeaa33d Take execution model into account for entry point methods.
SPIR-V allows names to alias if they implement different stages.
Deprecate the old interface and replace it with a new one which takes
execution modes into account.
2018-03-01 14:00:55 +01:00
Hans-Kristian Arntzen f6d08e6113 Add workaround for PointCoord builtin on HLSL. 2018-02-23 15:58:35 +01:00
Hans-Kristian Arntzen 1a2e4de7a5 Add test for texelFetch without sampler. 2018-02-21 13:45:59 +01:00
Hans-Kristian Arntzen 4db7061dd1 Begin implementing texelFetch(texture2D) workaround on GLSL. 2018-02-21 13:08:30 +01:00
Hans-Kristian Arntzen 18e8833eeb Support gl_NumWorkgroups in HLSL. 2018-02-05 10:29:20 +01:00
Hans-Kristian Arntzen bfe6f50b8e Remove cfg_analysis option.
Not using this is broken, and won't work anymore.
2018-01-15 13:21:01 +01:00
Hans-Kristian Arntzen 4427cb993d Add support for renaming entry points. 2017-11-13 13:50:37 +01:00
Hans-Kristian Arntzen f486142e36 Run format_all.sh. 2017-11-13 09:52:35 +01:00
Hans-Kristian Arntzen 4f88f9750f Cleanups for HLSL vertex attribute remap.
Add CLI support as well.
2017-11-13 09:46:45 +01:00
Bill Hollings bac657d873 Fixes from review of PR 321. 2017-11-07 15:38:13 -05:00
Hans-Kristian Arntzen 51e50c06c0 Automatically rename structs as well in rename_interface_variable. 2017-10-06 12:35:55 +02:00
Hans-Kristian Arntzen 0eaa2dee13 Merge pull request #279 from KhronosGroup/fix-276
Add option to disable use of 420pack extension.
2017-09-08 10:15:02 +02:00
Hans-Kristian Arntzen 6599a41aad Add option to disable use of 420pack extension. 2017-09-08 09:56:06 +02:00
Hans-Kristian Arntzen d9cbc03c9f Ensure that exceptions are logged. 2017-09-08 09:35:13 +02:00
Hans-Kristian Arntzen 8d7a909c92 Add support for querying SPIR-V Capabilities and Extensions. 2017-08-15 15:27:53 +02:00