Commit Graph

32 Commits

Author SHA1 Message Date
Lukas Hermanns
c3d6022956 Update for pull request #1162 rev. 1 2019-09-24 18:13:04 -04:00
Hans-Kristian Arntzen
f8b084de61 MSL/HLSL: Support OpOuterProduct. 2019-07-01 10:57:27 +02:00
Hans-Kristian Arntzen
ff87419607 Deal with scalar input values for distance/length/normalize.
HLSL and MSL don't support it, so fall back to simpler intrinsics.
2019-06-28 11:20:14 +02:00
Hans-Kristian Arntzen
e9da5ed631 HLSL: Support OpArrayLength. 2019-05-07 15:53:41 +02:00
Hans-Kristian Arntzen
4e7777c443 Update to latest glslang/SPIRV-Tools.
Fix various bugs along the way.
2019-01-30 13:41:57 +01:00
Hans-Kristian Arntzen
d92de00cc1 Rewrite how IDs are iterated over.
This is a fairly fundamental change on how IDs are handled.
It serves many purposes:

- Improve performance. We only need to iterate over IDs which are
  relevant at any one time.
- Makes sure we iterate through IDs in SPIR-V module declaration order
  rather than ID space. IDs don't have to be monotonically increasing,
  which was an assumption SPIRV-Cross used to have. It has apparently
  never been a problem until now.
- Support LUTs of structs. We do this by interleaving declaration of
  constants and struct types in SPIR-V module order.

To support this, the ParsedIR interface needed to change slightly.
Before setting any ID with variant_set<T> we let ParsedIR know
that an ID with a specific type has been added. The surface for change
should be minimal.

ParsedIR will maintain a per-type list of IDs which the cross-compiler
will need to consider for later.

Instead of looping over ir.ids[] (which can be extremely large), we loop
over types now, using:

ir.for_each_typed_id<SPIRVariable>([&](uint32_t id, SPIRVariable &var) {
	handle_variable(var);
});

Now we make sure that we're never looking at irrelevant types.
2019-01-10 12:52:56 +01:00
Hans-Kristian Arntzen
b778e16e48 HLSL: Complete support for combined image samplers in legacy. 2018-11-12 09:59:39 +01:00
Hans-Kristian Arntzen
480acdad18 Deal with OpSpecConstantOp used as array size.
When trying to validate buffer sizes, we usually need to bail out when
using SpecConstantOps, but for some very specific cases where we allow
unsized arrays currently, we can safely allow "unknown" sized arrays as
well.

This is probably the best we can do, when we have even more difficult
cases than this, we throw a more sensible error message.
2018-11-01 14:58:02 +01:00
Hans-Kristian Arntzen
d4ad1e266a Add test case for local_size_x_id and some complex cases. 2018-11-01 11:23:48 +01:00
Hans-Kristian Arntzen
62db535b3f Update tests. 2018-11-01 11:23:48 +01:00
Hans-Kristian Arntzen
226d837d7e HLSL: Use same logic as GLSL for picking cbuffer block name.
HLSL just picked the variable name which did not work as expected for
some users. Use the same logic as GLSL and set up declared_block_names,
so the actual name can be queried later.
2018-10-22 09:50:04 +02:00
Hans-Kristian Arntzen
af75ef005f Update glslang and SPIRV-Tools.
A lot of changes in spirv-opt output.
Some new invalid SPIR-V was found but most of them were not significant
for SPIRV-Cross, so just marked them as invalid.
2018-09-27 11:10:22 +02:00
Hans-Kristian Arntzen
737715214e Implement atomic increment/decrement in GLSL and HLSL. 2018-09-17 15:54:21 +02:00
Hans-Kristian Arntzen
af672b7a4b Add composite array test shaders for GLSL and HLSL as well. 2018-09-10 10:21:08 +02:00
Hans-Kristian Arntzen
10dfaf79d5 Support globallycoherent in HLSL. 2018-06-25 10:04:25 +02:00
Hans-Kristian Arntzen
85a8f066f4 Do not use RMW rewrite for matrices.
Does not work on MSL.
2018-05-04 10:35:56 +02:00
Hans-Kristian Arntzen
c266429be9 Partially implement subgroup ops for HLSL SM 6.0.
Lots of stuff that needs tons of emulation, which I'm not going to
bother with.
2018-04-11 15:57:41 +02:00
Hans-Kristian Arntzen
c1947aa447 Update glslang/SPIRV-Tools on Travis. 2018-03-24 04:16:18 +01:00
Hans-Kristian Arntzen
e7bf8d2f48 Refactor out noopt shaders to their own folders.
Makes maintenance easier with less clutter.
2018-03-13 10:39:49 +01:00
Hans-Kristian Arntzen
9fbd8b789e Update tests for latest SPIRV-Tools and glslang. 2018-03-12 15:11:55 +01:00
Hans-Kristian Arntzen
b380a2113a Implement MatrixInverse on HLSL.
Copy-paste implementation from MSL. I assume it's correct.
2018-02-23 16:42:40 +01:00
Hans-Kristian Arntzen
18e8833eeb Support gl_NumWorkgroups in HLSL. 2018-02-05 10:29:20 +01:00
Hans-Kristian Arntzen
9c3d4e7c60 Rewrite barrier handling in HLSL. 2018-01-09 12:41:13 +01:00
Hans-Kristian Arntzen
27ad8c0922 Add more exhaustive test for barrier handling. 2018-01-09 12:26:46 +01:00
Hans-Kristian Arntzen
23f0abf112 Update tests for struct flattening. 2018-01-09 10:40:34 +01:00
Hans-Kristian Arntzen
4590c63b40 Fix swizzling of integers.
Add scalar swizzling to constant composites as well.
2018-01-04 13:16:56 +01:00
Hans-Kristian Arntzen
ffad50b3c2 Remove duplicate swizzles in remap_swizzle.
Makes HLSL image-load-store look much nicer.
2017-12-12 13:01:10 +01:00
Hans-Kristian Arntzen
1c7980a778 Swizzle scalars when splatting in HLSL. 2017-12-12 12:52:45 +01:00
Hans-Kristian Arntzen
cc532cb7b6 Use t-namespace for ByteAddressBuffer.
FXC caught it, but not glslang, hm ...
2017-12-11 13:55:26 +01:00
Hans-Kristian Arntzen
c65248fdce Support image load-store without format in HLSL. 2017-11-29 12:14:06 +01:00
Hans-Kristian Arntzen
48f3fa4adb Implement bitfield ops in HLSL. 2017-11-29 11:33:44 +01:00
Hans-Kristian Arntzen
b39e829fc2 Add reference output for --opt. 2017-11-23 09:50:11 +01:00