Hans-Kristian Arntzen
636cc30088
Fix case where hoisted temporaries were used before being declared.
2018-02-15 10:52:56 +01:00
Bill Hollings
2964e328e6
CompilerMSL support gl_SampleMask and convert it to scalar uint from array.
2018-02-13 14:44:40 -05:00
Bill Hollings
b453348370
Merge branch 'master' of https://github.com/billhollings/SPIRV-Cross
2018-02-11 16:54:25 -05:00
Bill Hollings
607b0d6d42
CompilerMSL support smaller offsets for 3-row row-major matrices.
...
Support MSL typedefs to declare 3-row row-major matrices as 3-column matrices.
Allow those matrices to be decorated as packed.
Support transposing those matrices when used.
Modify how member alignments are calculated.
2018-02-11 16:52:57 -05:00
Hans-Kristian Arntzen
a3ae861844
Fix depth image usage in MSL for separate image/samplers.
2018-02-10 10:55:10 +01:00
Hans-Kristian Arntzen
702e08671b
Support passing implicit frag_coord arguments down to functions.
2018-02-10 10:55:09 +01:00
Hans-Kristian Arntzen
18a594a76b
Implement subpass input support in HLSL.
2018-02-10 10:54:42 +01:00
Hans-Kristian Arntzen
c9db3e5521
Overload on constant storage.
2018-02-08 17:58:46 +01:00
Hans-Kristian Arntzen
b2c9487b0f
Attempt to deduce constant/thread storage.
2018-02-08 17:07:50 +01:00
Hans-Kristian Arntzen
1a9c960058
MSL cannot declare inline arrays except in certain cases.
2018-02-08 13:06:29 +01:00
Hans-Kristian Arntzen
156dd905fd
Implicit return value takes thread storage.
2018-02-08 12:22:08 +01:00
Hans-Kristian Arntzen
d89b79025b
Fix wrong function declaration in MSL.
2018-02-08 12:22:08 +01:00
Hans-Kristian Arntzen
00ccd590ee
Return arrays in HLSL/MSL by writing to an output variable instead.
2018-02-08 12:22:08 +01:00
Hans-Kristian Arntzen
9fa91f7e1c
Support returning arrays from functions in GLSL/MSL.
...
Not possible in HLSL apparently, need workaround ...
2018-02-08 12:22:08 +01:00
Hans-Kristian Arntzen
18e8833eeb
Support gl_NumWorkgroups in HLSL.
2018-02-05 10:29:20 +01:00
Hans-Kristian Arntzen
5d9df6a31c
Do not declare constant composites inline in HLSL.
...
Move arrays and structs out to their own global static constants.
Also, replace illegal names in HLSL as well.
2018-02-02 10:12:26 +01:00
Hans-Kristian Arntzen
8841f15283
Fix case where loop header branches into continue block.
2018-02-01 10:00:16 +01:00
Hans-Kristian Arntzen
988f00fe3c
Fix OpImage on OpSampledImages in HLSL.
2018-02-01 09:22:16 +01:00
Hans-Kristian Arntzen
d1399f01ab
Update reference file after merge.
2018-02-01 09:14:45 +01:00
Hans-Kristian Arntzen
4c1e57ee03
Merge pull request #413 from zeux/master
...
MSL: Order resources by type and binding index in the output
2018-02-01 09:01:34 +01:00
Arseny Kapoulkine
5cbed7a69f
Update test files
2018-01-29 06:40:45 -08:00
Hans-Kristian Arntzen
38b8f733d1
Fix passing arrays of arrays to functions in MSL.
2018-01-29 10:57:52 +01:00
Hans-Kristian Arntzen
6714a9fa23
Need to sort declared temporaries to ensure stable output.
2018-01-29 10:24:15 +01:00
Bill Hollings
e43f244399
Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross
2018-01-24 17:34:50 -05:00
Bill Hollings
fe3683eefa
CompilerMSL declare threadgroup variables accessed in called functions.
2018-01-24 15:38:17 -05:00
Hans-Kristian Arntzen
b3f6e3de8e
Fix CFG::update_common_dominator.
...
The algorithm was too conservative causing lots of unnecessary
temporaries to be created.
2018-01-24 20:32:11 +01:00
Hans-Kristian Arntzen
09f550f718
Handle exponential explosion of code-gen during first phase of compile.
...
Certain patterns with OpVectorShuffle (and probably others) will cascade
to so large, that they can cause OOM. After we have observed
force_recompile, don't spend unnecessary memory emitting code which will
never be used.
2018-01-24 18:12:41 +01:00
Hans-Kristian Arntzen
af0a887997
Add test for false loop init.
...
Clean up how for loop variables are declared.
2018-01-23 21:15:09 +01:00
Hans-Kristian Arntzen
56acf9728a
Merge pull request #406 from KhronosGroup/fix-405
...
Fix HLSL regression with struct declaration.
2018-01-23 16:54:13 +01:00
Hans-Kristian Arntzen
06041985d0
Fix HLSL regression with struct declaration.
...
It actually worked surprisingly. Fix it properly.
2018-01-23 16:36:20 +01:00
Hans-Kristian Arntzen
d0ce948df4
Do not merge swizzles for anything other than vectors.
2018-01-22 09:52:57 +01:00
Hans-Kristian Arntzen
7d223b8987
Fix CFG for forwarded temporaries.
...
Forwarded temporaries would never declare a temporary.
Figure out all result types ahead of time so we can deal with those
temporaries as well.
2018-01-18 12:11:33 +01:00
Hans-Kristian Arntzen
b902d5400c
Do not use inline for-loop initializers with different types.
2018-01-16 10:27:58 +01:00
Hans-Kristian Arntzen
168bcc7b3b
Add unreachable tests for MSL/HLSL.
2018-01-15 09:39:15 +01:00
Hans-Kristian Arntzen
0f4adaa09d
Handle OpUnreachable in code-gen.
...
Forgot to add it to emit_block_chain. It should just be a noop.
2018-01-15 09:35:09 +01:00
Hans-Kristian Arntzen
d4e470babd
Analyze the CFG for temporaries as well.
...
Normally, temporary declaration must dominate any use of it,
so we generally did not need to analyze the CFG for these variables,
but there is an edge case where you have an inliner doing:
do {
create_temporary;
break;
} while(0);
use_temporary;
The inside of the loop dominates the outer scope, but we cannot emit
code like this in GLSL, so make sure we hoist these temporaries outside
the "loop".
2018-01-12 10:56:11 +01:00
Hans-Kristian Arntzen
39e7ddea94
Disable mem_texture checks on MSL.
...
Doesn't seem to work on Travis even though spec says it should, oh well
:)
2018-01-09 14:09:29 +01:00
Hans-Kristian Arntzen
cfe568f237
Add exhaustive barrier tests for MSL.
...
Seems incorrect, need to be fixed later.
2018-01-09 12:55:46 +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
166eed8c18
Add test shaders for barriers.
2018-01-09 12:19:31 +01:00
Hans-Kristian Arntzen
7bb8874b43
Optimize away redundant barriers.
2018-01-09 12:17:38 +01:00
Hans-Kristian Arntzen
9c72aa00c9
Overhaul barrier handling in GLSL.
2018-01-09 12:07:07 +01:00
Hans-Kristian Arntzen
23f0abf112
Update tests for struct flattening.
2018-01-09 10:40:34 +01:00
Bill Hollings
27d4af75a0
Revert to not forcing gl_in/gl_out block for MSL, and add MSL gl_ClipDistance tests.
2018-01-08 16:18:34 -05:00
Hans-Kristian Arntzen
513ba86fc8
Merge pull request #373 from billhollings/master
...
CompilerMSL enhancements PLUS refactoring of MSL tests to avoid optimization crashes
2018-01-08 09:04:03 +01:00
Bill Hollings
6371d9e43a
CompilerMSL emit no-warning pragma when emitting spvConvertFromRowMajorCxR functions.
2018-01-06 00:51:25 -05:00
Bill Hollings
5ee6b46087
Fixes from review of PR #373 .
...
Code fixes from review.
Refactor MSL tests back to using the SPIRV-Tools
and glslang loaded by checkout_glslang_spirv_tools.sh.
2018-01-05 23:22:36 -05:00
Bill Hollings
d8d2da9d8d
CompilerMSL allow swizzle of packed_float3 vectors by unpacking to float3.
...
Pass packed indicator back through OpAccessChain and OpLoad.
Unpack packed vector before applying swizzle.
Add packed swizzle test.
2018-01-05 17:46:56 -05:00
Hans-Kristian Arntzen
9bdfd7025e
Fix tessellation control shaders from HLSL.
...
Need to take into account that gl_Position[i] needs to be rewritten as
gl_out[i].gl_Position instead.
2018-01-04 16:22:44 +01:00
Hans-Kristian Arntzen
8412b10550
Merge pull request #380 from KhronosGroup/fix-368
...
Add support for gl_ViewportIndex.
2018-01-04 14:09:36 +01:00
Hans-Kristian Arntzen
41ffb1064e
Add basic test for viewport-index builtin.
2018-01-04 13:51:05 +01:00
Hans-Kristian Arntzen
c4e787ccf8
Merge pull request #378 from KhronosGroup/fix-371
...
Fix swizzling of scalar integers in HLSL.
2018-01-04 13:42:27 +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
e51b7cd162
Add test for sampler arrays.
2018-01-04 12:28:57 +01:00
Bill Hollings
95910ddd5a
MSL test shader refactoring to avoid optimization crashes.
2017-12-26 18:40:46 -05:00
Bill Hollings
a68b32733a
CompilerMSL enhancements to nested function use of globals.
...
Allow function calls to include globals as arguments.
Allow function calls to include built-ins as arguments.
Include all meta info when creating function args from globals.
Do not manufacture a sampler for Buffer-type sampled images.
Add code option to test_shaders.py to preserve SPIR-V code for interactive debugging.
2017-12-26 16:32:45 -05:00
Hans-Kristian Arntzen
789fa91987
Support running FXC on Unix-likes as well.
...
Assumes a wine wrapper script is set up, but should be good enough.
2017-12-12 13:23: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
3630d7ef75
Merge pull request #360 from KhronosGroup/vulkan-glsl-desktop-mediump
...
Support mediump in desktop Vulkan GLSL.
2017-12-07 17:40:14 +01:00
Hans-Kristian Arntzen
5e9b53e354
Support VertexID/InstanceID in HLSL.
2017-12-06 11:01:32 +01:00
Hans-Kristian Arntzen
2e68675ef7
Support mediump in desktop Vulkan GLSL.
2017-12-06 10:25:58 +01:00
Hans-Kristian Arntzen
6d7af5c83c
Add test for continue block lifting.
2017-12-05 17:44:52 +01:00
Hans-Kristian Arntzen
aa2557c7df
Fixups for PR #353 .
2017-12-05 09:58:12 +01:00
Bill Hollings
12988801c4
Update reference shaders in reference/opt/shaders-msl.
...
Remove shaders-msl/comp/bake_gradient.comp, which now breaks spirv-opt.
2017-12-04 18:17:06 -05:00
Bill Hollings
5502b00682
Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross
2017-12-04 17:02:08 -05:00
Hans-Kristian Arntzen
4a9d3cebd0
Merge pull request #355 from KhronosGroup/fix-345
...
Improve handling of block name declaration in GLSL.
2017-12-02 13:01:32 +01:00
Hans-Kristian Arntzen
197e5bd7fb
Merge pull request #356 from KhronosGroup/fix-352
...
Make sure image integer coords are int, not uint.
2017-12-02 12:59:31 +01:00
Hans-Kristian Arntzen
3c52771aee
Make sure image integer coords are int, not uint.
...
HLSL can emit uint here.
2017-12-01 15:02:50 +01:00
Hans-Kristian Arntzen
2c90ea3acc
Improve handling of block name declaration in GLSL.
...
HLSL UAVs are a bit annoying because they can share block types,
so reflection becomes rather awkward. Sometimes we will need to make
some nasty fallbacks, so add a reflection interface which lets you query
post-shader compile which names was actually declared in the shader.
2017-12-01 14:30:10 +01:00
Hans-Kristian Arntzen
aeeb0e3dd0
Support textureQueryLod in HLSL.
2017-12-01 13:30:31 +01:00
Bill Hollings
c93d44ba3c
For MSL, use {} instead of constructors to init OpUndef values.
2017-11-30 15:03:27 -05:00
Hans-Kristian Arntzen
975cf86892
Test textureProjLodOffset with compare in HLSL as well.
2017-11-29 12:48:06 +01:00
Hans-Kristian Arntzen
dbfa686990
Emit SampleCmpLevelZero for lod/grad variants of SampleCmp.
2017-11-29 12:38:13 +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
656af7e3ed
Implement unorm16/snorm16 packing in HLSL.
2017-11-27 15:03:40 +01:00
Hans-Kristian Arntzen
719ba63416
Add pack/unpack snorm8/unorm8.
2017-11-27 14:49:47 +01:00
Hans-Kristian Arntzen
6c7c680d01
Implement FP16 unpack/pack on HLSL.
2017-11-27 14:24:30 +01:00
Hans-Kristian Arntzen
c64c3de01f
Add new optimized test shaders.
2017-11-23 09:59:25 +01:00
Hans-Kristian Arntzen
f929078f1e
Disable --opt for in_block_assign for now.
...
Bug: OpLoad fails when loading an interface struct directly, followed by
OpCompositeExtract. This should be fixed, but not critical enough to
block this PR.
2017-11-23 09:59:25 +01:00
Hans-Kristian Arntzen
8e14eadb95
Disable opts for loop on MSL as well.
2017-11-23 09:59:25 +01:00
Hans-Kristian Arntzen
65cd417630
Do not hoist OpUndef variables.
2017-11-23 09:59:25 +01:00
Hans-Kristian Arntzen
3ce6b2a23b
Make bitfield test noopt for now.
...
SPIRV-Tools trips assertion.
2017-11-23 09:59:25 +01:00
Hans-Kristian Arntzen
7238e57933
Enforce stable order for dominated phi variables.
2017-11-23 09:59:25 +01:00
Hans-Kristian Arntzen
c52776af78
Update to correct SPIRV-Tools revision.
2017-11-23 09:59:21 +01:00
Hans-Kristian Arntzen
b39e829fc2
Add reference output for --opt.
2017-11-23 09:50:11 +01:00
Hans-Kristian Arntzen
3440263d60
Update MSL tests.
2017-11-23 09:50:11 +01:00
Hans-Kristian Arntzen
7e02f7fd62
Check more places where we can potentially read phi variables.
2017-11-23 09:50:11 +01:00
Hans-Kristian Arntzen
0fd028147f
Hoist all phi-local variables to entry block.
...
We don't have a mechanism to move temporaries to their appropriate
scope, and Phi behavior is weird enough that it will be a heroic effort
to not do this rather ugly codegen :(
2017-11-23 09:50:11 +01:00
Hans-Kristian Arntzen
bcdff2d2e1
Fixups for PR #338 review.
2017-11-22 20:51:26 +01:00
Lou Kramer
6671f52334
Add support for new extensions.
2017-11-22 19:05:38 +01:00
msiglreith
f4bde2b3ef
HLSL: Support early fragment tests attribute
2017-11-21 14:51:03 +01:00
Hans-Kristian Arntzen
b629ca1c33
Fix complicated Phi case.
...
A continue block might have used a temporary which existed only in the
loop body.
2017-11-21 09:27:49 +01:00
Hans-Kristian Arntzen
3cacaf614d
Merge pull request #333 from KhronosGroup/fix-331
...
Do not allow base expressions when extracting struct members.
2017-11-20 23:29:30 +01:00
Hans-Kristian Arntzen
851e584338
Do not allow base expressions when extracting struct members.
2017-11-20 21:32:13 +01:00
Hans-Kristian Arntzen
5352615ce1
Update tests.
2017-11-20 21:10:00 +01:00
Hans-Kristian Arntzen
dd604fec9a
Fix SSO for HLSL vertex shaders.
2017-11-17 13:37:28 +01:00