Hans-Kristian Arntzen
9b7140e2ba
Implement OpAtomicLoad/OpAtomicStore.
...
Need some emulation on GLSL/HLSL, fix bug with atomic store on MSL.
2020-04-27 12:11:46 +02:00
Hans-Kristian Arntzen
6ef47d6657
MSL: Fix case where subpassInput is passed to leaf functions.
2020-04-27 11:29:21 +02:00
dan sinclair
171c646474
Roll GLSLang, SPIRV-Tools and SPIRV-Headers.
...
This CL rolls the various dependencies and updates tests to match.
2020-04-23 10:53:49 -04:00
Hans-Kristian Arntzen
5e5d1c27ce
GLSL: Support f16x2 <-> f32 bitcast.
...
There is no native formulation, so introduce a concept of a "complex"
bitcast to handle odd-ball cases which have no native unary operation.
2020-04-21 23:27:33 +02:00
Hans-Kristian Arntzen
bdb343ea06
Be a bit more careful what nonuniform state is propagated.
2020-04-21 14:48:44 +02:00
Hans-Kristian Arntzen
5cb0f0a640
Merge pull request #1335 from KhronosGroup/fix-1325
...
GLSL/HLSL: Implement unpack/pack2x32Uint
2020-04-21 14:05:12 +02:00
Hans-Kristian Arntzen
7b9cba7424
HLSL: Add parens in unpackUint2x32 for clarity.
2020-04-21 11:49:26 +02:00
Hans-Kristian Arntzen
a396744f89
Ensure unpack/pack2x32 tests are compatible with test suite.
2020-04-21 11:48:58 +02:00
Asuka
55dfbead2f
GLSL/HLSL: Support packUint2x32 and unpackUint2x32
2020-04-21 11:34:12 +02:00
Hans-Kristian Arntzen
f8592ecdfc
MSL: Deal correctly with initializers on Private variables.
...
Do not attempt to defer declaration. It would happen to work in most
cases, but the edge case is where the first thing that happens to a
variable is being OpStore'd into.
2020-04-21 11:20:49 +02:00
Hans-Kristian Arntzen
17ad62eea4
MSL: Support edge case with DX layout in scalar block layout.
...
DX may emit ArrayStride and MatrixStride of 16, but the size of the
object does not align with that and expect to pack other members inside
its last member.
The workaround is to emit array size/col/row one less than we expect and
rely on padding to carve out a "dead zone" for the last member.
2020-04-20 15:29:24 +02:00
Hans-Kristian Arntzen
ebf463674d
MSL: Allow removing clip distance user varyings.
...
Only safe if user knows that subsequent shader stage will not read clip
distance.
2020-04-20 09:58:40 +02:00
Panagiotis Christopoulos Charitos
b3109b8ad0
Reflection: Add specialization constant name
...
Fixes #1311
2020-04-18 22:00:36 +02:00
Chip Davis
96f7008aa8
MSL: Force disabled fragment builtins to have the right name.
...
DXVK emits SPIR-V where fragment shader builtins have names derived from
DXBC assembly, e.g. `oDepth` for `FragDepth`. When we declared the
disabled output, we used this name, but when referencing it, we
continued to use the GLSL name. This breaks compilation.
2020-04-15 19:25:18 -05:00
Chip Davis
495e48de44
MSL: Only disable output variables in fragment shaders.
...
Forgot to do this in #1319 .
Fixes #1322 .
2020-04-15 12:14:57 -05:00
Chip Davis
b29f83c383
MSL: Add options to control emission of fragment outputs.
...
Like with `point_size` when not rendering points, Metal complains when
writing to a variable using the `[[depth]]` qualifier when no depth
buffer be attached. In that case, we must avoid emitting `FragDepth`,
just like with `PointSize`.
I assume it will also complain if there be no stencil attachment and the
shader write to `[[stencil]]`, or it write to `[[color(n)]]` but there
be no color attachment at n.
2020-04-13 15:29:11 -05:00
Hans-Kristian Arntzen
c7b75a8fe6
MSL: Do not use base expression with PhysicalTypeID OpCompositeExtract.
...
Similar reasoning as packed expressions.
2020-04-07 18:25:44 +02:00
Hans-Kristian Arntzen
14f24d71ab
Merge pull request #1308 from KhronosGroup/fix-1306
...
HLSL: Add support for treating NonWritable UAV texture as SRV instead.
2020-04-03 17:42:56 +02:00
Hans-Kristian Arntzen
d9d3359ffb
MSL: Deal with cases where builtin is implicitly needed, declared, but unused.
...
We need to make sure any builtins which are declared and unused are
emitted as active variables.
2020-04-03 12:50:21 +02:00
Hans-Kristian Arntzen
28bf9057df
HLSL: Add support for treating NonWritable UAV texture as SRV instead.
2020-04-03 11:50:50 +02:00
Hans-Kristian Arntzen
3cb6aeb480
MSL: Fix access chain for deep struct hierarchy on array of buffers.
2020-03-31 14:17:29 +02:00
dan sinclair
32307df73a
Roll GLSLang, SPIRV-Tools and SPIRV-Headers
...
This CL rolls the various dependencies and updates tests as needed.
2020-03-30 11:03:43 -04:00
Hans-Kristian Arntzen
b8905bbd95
Add support for forcefully zero-initialized variables.
...
Useful to better support certain platforms which require all variables
to be initialized to something.
2020-03-26 13:38:27 +01:00
Hans-Kristian Arntzen
04e877df12
GLSL: Implement GL_EXT_shader_framebuffer_fetch.
2020-03-19 14:53:39 +01:00
Hans-Kristian Arntzen
05004a57ea
GLSL/HLSL: Fix nonuniform qualifier for SSBO atomics.
2020-03-19 12:05:27 +01:00
Hans-Kristian Arntzen
a3d3c80dd7
GLSL/HLSL: Implement nonuniform qualifier for image atomics.
2020-03-19 11:35:29 +01:00
Hans-Kristian Arntzen
185551bfaf
HLSL: Do not emit globallycoherent for SRV ByteAddressBuffer.
2020-03-05 10:37:36 +01:00
Hans-Kristian Arntzen
95cd20f1c7
Add test for disable-storage-image-qualifier-deduction.
2020-03-04 16:42:31 +01:00
Hans-Kristian Arntzen
c27e1efbf1
HLSL: Add option to always treat SSBO as UAV, even with readonly.
...
This can make codegen more predictable since ByteAddressBuffer is SRV
and not UAV.
2020-03-04 16:42:31 +01:00
Hans-Kristian Arntzen
d91e134500
MSL: Add native array test for composite array initialization.
2020-02-24 13:34:51 +01:00
Hans-Kristian Arntzen
30343f3e95
MSL: Reintroduce workaround for constant arrays being passed by value.
2020-02-24 13:22:52 +01:00
Hans-Kristian Arntzen
20b28f72fa
MSL: Reinstate workaround for returning arrays.
2020-02-24 13:04:10 +01:00
Hans-Kristian Arntzen
c9d4f9cd74
MSL: Add a workaround path to force native arrays for everything.
2020-02-24 12:47:14 +01:00
Dan Sinclair
7ec16b64c8
Roll GLSLang, SPIRV-Tools and SPIRV-Headers
...
This CL rolls the various dependencies of SPIRV-Cross and updates the
tests as needed.
2020-02-19 10:13:52 -05:00
Hans-Kristian Arntzen
e81c1b1d98
HLSL: Declare undef variables as static.
...
Undef variables would somehow become cbuffer variables without any
warning ...
2020-02-08 13:39:50 +01:00
Hans-Kristian Arntzen
655312cb47
GLSL: Support GL_ARB_enchanced_layouts for XFB.
2020-01-27 13:11:38 +01:00
Chip Davis
ae6c05f6f4
MSL: Move inline uniform blocks to the end of the argument buffer.
...
Limit inline blocks to one per descriptor set.
This should avoid the need for complicated code to calculate the
argument buffer ID stride of an inline uniform block. If there's demand
for more inline blocks, we can revisit this.
2020-01-25 13:40:51 -06:00
Chip Davis
fedbc35315
MSL: Support inline uniform blocks in argument buffers.
...
Here, the inline uniform block is explicit: we instantiate the buffer
block itself in the argument buffer, instead of a pointer to the buffer.
I just hope this will work with the `MTLArgumentDescriptor` API...
Note that Metal recursively assigns individual members of embedded
structs IDs. This means for automatic assignment that we have to
calculate the binding stride for a given buffer block. For MoltenVK,
we'll simply increment the ID by the size of the inline uniform block.
Then the later IDs will never conflict with the inline uniform block. We
can get away with this because Metal doesn't require that IDs be
contiguous, only monotonically increasing.
2020-01-24 18:51:24 -06:00
Hans-Kristian Arntzen
af787a8a79
Merge pull request #1264 from KhronosGroup/msl-argument-buffer-persist
...
MSL: Add support for force-activating IAB resources.
2020-01-16 14:44:23 +01:00
Hans-Kristian Arntzen
c3bd136df1
MSL: Add support for force-activating IAB resources.
...
Important for ABI compatibility on MSL in certain cases.
2020-01-16 11:12:06 +01:00
Hans-Kristian Arntzen
f79c1e2fed
Deal with illegal names in types as well.
...
- Fixes issue with clip_distance flattening in MSL where member to
flatten from would come from to_member_name, where it should have used
the builtin name directly. This member name was modified by this patch
and broke clip distance test shaders.
- Some cleanups with ir.meta, use ir.find_meta instead to not create
unnecessary hashmap nodes.
2020-01-16 10:34:49 +01:00
Hans-Kristian Arntzen
79700d5412
Merge pull request #1262 from KhronosGroup/json-reflection-improvements
...
Reflection: Various improvements
2020-01-15 18:51:34 +01:00
Hans-Kristian Arntzen
762c87a7bb
Reflection: Add array stride/matrix stride reflection.
2020-01-15 17:01:35 +01:00
Hans-Kristian Arntzen
18e24c3ca2
Reflection: Emit reflection information for array size literalness.
...
If not literal, check specialization_constant entries for "variable_id"
to link up ID with spec constant values. This maps directly to C++ API.
2020-01-15 16:49:19 +01:00
Hans-Kristian Arntzen
55fe6050fe
GLSL: Implement geometry shader passthrough extension.
2020-01-15 16:18:29 +01:00
Hans-Kristian Arntzen
2bbb012e9c
MSL: Deal with sign on wave min/max.
2020-01-09 12:35:18 +01:00
Hans-Kristian Arntzen
88ddeec49a
HLSL: Deal with casting for WaveActiveMin/Max.
2020-01-09 12:35:18 +01:00
Hans-Kristian Arntzen
5253da9e63
GLSL: Deal with sign in subgroup Min/Max operations.
2020-01-09 12:35:14 +01:00
Hans-Kristian Arntzen
1cbd71b354
HLSL: Fix bug when reading and writing structs from SSBO.
2020-01-08 14:27:02 +01:00
Hans-Kristian Arntzen
151ff1e870
HLSL: Implement stores for complex composites in ByteAddressBuffers.
2020-01-08 14:17:28 +01:00
Hans-Kristian Arntzen
ca9398c122
HLSL: Support loading complex composites from ByteAddressBuffer.
2020-01-08 13:05:56 +01:00
Hans-Kristian Arntzen
c024e24d45
MSL: Deal with padded fragment output + Component decoration.
2020-01-07 17:02:12 +01:00
Hans-Kristian Arntzen
93f3265fe0
MSL: Deal with packing vectors for vertex input/fragment output.
2020-01-07 14:14:31 +01:00
Hans-Kristian Arntzen
7a69d764b0
MSL: Add trivial tests for Component decoration.
...
Verifies that Component decoration is honored for vertex outputs and
fragment inputs.
2020-01-07 11:36:51 +01:00
Hans-Kristian Arntzen
8bef6ff167
Add test shader for OpCopyLogical with packing/unpacking.
2020-01-06 12:44:18 +01:00
Hans-Kristian Arntzen
9012a39b60
Basic implementation of OpCopyLogical.
2020-01-06 11:47:26 +01:00
Hans-Kristian Arntzen
7c1e34f3b9
GLSL: Fix array of input patch variables.
...
Hoist out the hack to make array sizes unsized to a place where we can
differentiate patch variables from control point variables.
2019-12-10 12:02:12 +01:00
Hans-Kristian Arntzen
d7e612f91a
GLSL: Fix EmitStreamVertex/Primitive.
2019-12-09 10:49:48 +01:00
Hans-Kristian Arntzen
67b2991451
Don't emit memoryBarrierShared() in workgroup control barriers.
...
This is implied in both GL and GLES. Emitting memoryBarrierShared() was
based on earlier confusion in the spec which has since been fixed and
clarified.
2019-12-04 15:06:19 +01:00
Dan Sinclair
b77be9f347
Update graphics robust access results
...
The robust access code was fixed to use a signed clamp which generates
different results in the SPIR-V cross test.
2019-12-03 16:49:43 -05:00
Dan Sinclair
f40c629821
Roll SPIRV-Tools, SPIRV-Headers and GLSLang
...
This CL updates the three depdencies and updates the tests to handle the
new validation errors which are produced.
2019-12-02 16:17:21 -05:00
Hans-Kristian Arntzen
a3fe9756d2
MSL: Support ClipDistance as an input stage variable.
...
MSL does not support this, so we have to emulate it by passing it around
as a varying between stages. We use a special "user(clipN)" attribute
for this rather than locN which is used for user varyings.
2019-12-02 13:19:42 +01:00
Hans-Kristian Arntzen
4edb99d476
Fix sign handling for S/UToF.
2019-11-28 13:55:28 +01:00
Hans-Kristian Arntzen
b85ab5f5ff
MSL: Fix automatic binding allocation for image atomic buffers.
...
The Primary decoration was used by the atomic buffer, causing the
texture binding to be potentially overlapping with other resources.
2019-11-28 11:07:44 +01:00
Hans-Kristian Arntzen
d9afa9e238
MSL: Fix unpack_expression from column of padded matrix.
2019-11-07 11:35:07 +01:00
Hans-Kristian Arntzen
b56c2f4271
Merge branch 'deps' of git://github.com/dj2/SPIRV-Cross
2019-11-06 10:43:17 +01:00
Hans-Kristian Arntzen
d4ca91f6c2
Move .invalid. test shaders to the more appropriate subfolders.
2019-11-06 10:40:37 +01:00
Dan Sinclair
d409210ee5
Move all .invalid shaders into no-opt folders.
2019-11-05 13:19:19 -05:00
Dan Sinclair
79721eda12
Remove old reference shaders
2019-11-05 12:49:04 -05:00
Dan Sinclair
e5af41255c
Only run spirv-opt if the spirv is valid.
...
This CL updates the test runner to only run spirv-opt if the generated
SPIR-V is valid. If validation is skipped it's possible to hit aborts
and other memory errors in the optimizer as it assumes the SPIR-V is
valid.
2019-11-05 11:00:49 -05:00
Dan Sinclair
9da21c24a4
Roll GLSLang and SPIRV-Tools
...
This CL rolls the GLSLang and SPIRV-Tools dependencies to tip-of-tree
and updates the tests as required.
2019-11-05 10:07:15 -05:00
Hans-Kristian Arntzen
a8d676f2e4
GLSL: Fix issue with array-of-array inputs in tess.
...
Only one dimension can be unsized and wrong dimension was used for
unrolling purposes.
2019-11-04 10:34:49 +01:00
Hans-Kristian Arntzen
00189b19a5
Merge pull request #1188 from KhronosGroup/missing-reference-ue4
...
MSL: Add missing reference output.
2019-10-29 12:36:01 +01:00
Hans-Kristian Arntzen
42e6ce073b
MSL: Add missing reference output.
2019-10-29 11:17:38 +01:00
Hans-Kristian Arntzen
e2155053c5
Fix broken access tracking for OpFunctionCall results.
...
We were looking at args[1] after incrementing args array, not before,
which means we tracked garbage.
This is also an out-of-bounds hazard.
2019-10-29 11:13:39 +01:00
Hans-Kristian Arntzen
1d5eba67f8
MSL: Remove hacky workaround for patch constant passing.
...
There was a hack to workaround a bug in DXC where control point -> patch
constant phase was passed in Function storage, but we have to use
Workgroup here. We will not support these kinds of hacks for invalid
SPIR-V, so hack the reference files to use the "proper" fix and remove
the hack for time being.
2019-10-28 12:52:28 +01:00
Hans-Kristian Arntzen
8f13a3f4b1
MSL: Remove workaround for passing constant arrays to functions.
...
Arrays are value-types now, so remove the old workaround.
2019-10-28 12:14:43 +01:00
Hans-Kristian Arntzen
32bd1329b6
Remove another dead reference file.
2019-10-28 11:51:31 +01:00
Hans-Kristian Arntzen
8670f7cbab
Remove some more dead reference files.
2019-10-28 11:49:57 +01:00
Hans-Kristian Arntzen
b2c6362c4b
Remove another dead reference file.
2019-10-28 11:33:09 +01:00
Hans-Kristian Arntzen
93ceead289
Remove dead reference file.
2019-10-28 11:31:04 +01:00
Hans-Kristian Arntzen
e1919744e9
Hack some constants in UE4 tests.
...
Need to make output 100% exact for MSVC and GCC libc testing, but they are 1 ULP
off when converting fp32 to string in some weird corner cases.
Roundtrip should be correct though, but that outside the scope of
SPIRV-Cross.
2019-10-28 11:20:41 +01:00
Hans-Kristian Arntzen
648dfa5070
MSL: Ensure stable output for access chain CFG workarounds.
...
We had output dependent on complex_continue being set, but setting that
flag was dependent on unordered_set declaration order. Make it invariant
to ordering and change the implementation so it knows about the new
temporary hoisting for access chains.
2019-10-28 10:57:51 +01:00
Hans-Kristian Arntzen
fa011f8547
MSL: Declare arrays with proper type wrapper.
...
Need to construct with value type spvUnsafeArray<T, N>({ elem0, elem1 })
to make array initialization work in complex scenarios.
2019-10-26 17:57:34 +02:00
Hans-Kristian Arntzen
2745959646
MSL: Deal with chained access chains for tessellation IO variables.
...
Need to specially deal with this since we might have to split up access
chain and deal with indexing into IB struct.
2019-10-26 17:26:56 +02:00
Hans-Kristian Arntzen
e1acbd3dcf
MSL: Declare struct type explicitly.
...
Disambiguates initializer list.
2019-10-26 16:21:46 +02:00
Hans-Kristian Arntzen
1fc3347873
MSL: Fix array of array declaration.
...
Arrays-of-arrays were declared in wrong order.
2019-10-26 16:10:12 +02:00
Hans-Kristian Arntzen
27d6d45671
MSL: Rewrite tessellation_access_chain.
...
To support loading array of array properly in tessellation, we need a
rewrite of how tessellation access chains are handled.
The major change is to remove the implicit unflatten step inside
access_chain which does not take into account the case where you load
directly from a control point array variable.
We defer unflatten step until OpLoad time instead.
This fixes cases where we load array of {array,matrix,struct}.
Removes the hacky path for MSL access chain index workaround.
2019-10-26 16:10:12 +02:00
Hans-Kristian Arntzen
d0953f6e4c
MSL: Do not declare variables which will not be unflattened.
...
Non-patch arrays of IO variables in tesc/tese have their array index
stripped, and access chains are specially handled, we shouldn't attempt
to create "normal" arrays of these.
2019-10-26 16:10:12 +02:00
Hans-Kristian Arntzen
3b5c4c7316
Implement constant empty struct correctly on all backends.
...
MSL actually supports empty structs, so enable that path as well.
2019-10-26 16:10:11 +02:00
Hans-Kristian Arntzen
8066d13599
MSL: Rewrite propagated depth comparison state handling.
...
Far cleaner, and more correct to run the traversal twice.
Fixes a case where we propagate depth state through multiple functions.
2019-10-26 16:10:11 +02:00
Hans-Kristian Arntzen
2767257adc
MSL: Do not declare array of UBO/SSBO as spvUnsafeArray<T>.
...
There is no need for these to be copied, and cuts down on template
stamping bloat.
2019-10-26 16:10:08 +02:00
Hans-Kristian Arntzen
a82ecbeba9
MSL: Enable proper value types for return and value-passing of arrays.
...
Now that we have spvUnsafeArray<T> there is no need to deal with these
special purpose cases.
2019-10-24 13:03:38 +02:00
Hans-Kristian Arntzen
d1479f871a
MSL: Do not generate UnsafeArray<> for any array inside buffer objects.
...
This avoids a lot of huge code changes.
Arrays generally cannot be copied in and out of buffers, at least no
compiler frontend seems to do it.
Also avoids a lot of issues surrounding packed vectors and matrices.
2019-10-24 12:22:30 +02:00
Hans-Kristian Arntzen
db55d474f9
MSL: Do not declare complex composite array in main for non-inlined.
...
Need to consider that complex composite arrays may be used in leaf
functions, and avoid the MSL library link fix unless everything is
nicely inlined.
2019-10-24 11:12:01 +02:00
Lukas Hermanns
c236ca4572
Moved all UE4 test shaders into 'shaders-ue4/' folder.
2019-10-23 17:39:05 -04:00
Lukas Hermanns
b0d616aa6d
Removed 'argument_buffer_offset' and fixed packed matrix Metal output.
2019-10-23 16:28:32 -04:00
Lukas Hermanns
84351d3aed
Merge remote-tracking branch 'upstream/master'
2019-10-21 18:55:36 -04:00
Lukas Hermanns
e1b161b54b
Removed bounds checks in favor of SPIRV-Tools pass '--graphics-robust-access'
2019-10-21 16:39:53 -04:00
Hans-Kristian Arntzen
4550f18b37
Fix OpVectorExtractDynamic with spec constant op index.
...
We cannot lower this to a swizzle, keep it dynamically indexed.
2019-10-17 11:12:14 +02:00