Commit Graph

1025 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
0673f27b7c Fix incorrect loop range. 2018-02-22 17:00:41 +01:00
Hans-Kristian Arntzen
114c2c5e37 Add clip/cull-distance support to HLSL. 2018-02-22 16:40:04 +01:00
Hans-Kristian Arntzen
fb3f92a3ff Overhaul clip/cull distance support in GLSL. 2018-02-22 14:36:50 +01:00
Bill Hollings
50ef6cd95f CompilerMSL remove incorrect packing of non-interface type-aliased structs. 2018-02-21 17:52:03 -05:00
Hans-Kristian Arntzen
1a2e4de7a5 Add test for texelFetch without sampler. 2018-02-21 13:45:59 +01:00
Hans-Kristian Arntzen
8a3bef2bd6 Add OpFRem tests. 2018-02-15 13:36:59 +01:00
Hans-Kristian Arntzen
843e34b604 Add IsFrontFace support to HLSL. 2018-02-15 12:42:56 +01:00
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
Bill Hollings
e83e2b2217 CompilerMSL support and tests for OpUndef. 2017-11-15 22:44:42 -05: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
ba865733eb Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-11-05 22:49:08 -05:00
Bill Hollings
1c18078811 Enhancements to MSL compute and entry point naming.
Support Workgroup (threadgroup) variables.
Mark if SPIRConstant is used as an array length, since it cannot be specialized.
Resolve specialized array length constants.
Support passing an array to MSL function.
Support emitting GLSL array assignments in MSL via an array copy function.
Support for memory and control barriers.
Struct packing enhancements, including packing nested structs.
Enhancements to replacing illegal MSL variable and function names.
Add Compiler::get_entry_point_name_map() function to retrieve entry point renamings.
Remove CompilerGLSL::clean_func_name() as obsolete.
Fixes to types in bitcast MSL functions.
Add Variant::get_id() member function.
Add CompilerMSL::Options::msl_version option.
Add numerous MSL compute tests.
2017-11-05 21:34:42 -05:00
Hans-Kristian Arntzen
22e94913d4 Add test for row/col-major matrix read/write for HLSL. 2017-10-26 17:40:45 +02:00
Hans-Kristian Arntzen
2ba7ed1c09 Fix tests after rebase. 2017-10-24 09:56:08 +02:00
Hans-Kristian Arntzen
a95295cb23 Remap swizzle for HLSL and RWBuffer. 2017-10-24 09:55:25 +02:00
Hans-Kristian Arntzen
ae236e7056 Add GroupSync() in HLSL. 2017-10-24 09:55:25 +02:00
Hans-Kristian Arntzen
85eb972259 Add some HLSL tests for atomics and image load store. 2017-10-24 09:55:25 +02:00
James Ross-Gowan
1f16f0d260 Use 'static const' for spec constants in HLSL
If 'const' is used, the shader expects the variable to be backed by a
constant buffer. 'static const' is probably preferred for a value that
is initialized with a constant in the HLSL source code.

FXC also emits a warning for 'const' variables with initializers, since
'static const' was probably intended.
2017-10-21 19:19:32 +11:00
Hans-Kristian Arntzen
d48876ac41 Add test for stripped cbuffer members. 2017-10-10 17:40:37 +02:00
Hans-Kristian Arntzen
94ff355812 Fix some naming issues for stripped and flattened structs. 2017-10-10 17:32:26 +02:00
Hans-Kristian Arntzen
c68c72c5be Fix ARB_enhanced_layout test. 2017-10-10 16:25:47 +02:00
Hans-Kristian Arntzen
620d01c5d6 Generate decorations for row_major/column_major in HLSL. 2017-10-10 16:11:25 +02:00
Hans-Kristian Arntzen
6feff98295 Update HLSL cbuffer tests. 2017-10-10 15:37:53 +02:00
Hans-Kristian Arntzen
4d11220aa8 Add a test for enhanced layouts. 2017-10-10 11:30:29 +02:00
Hans-Kristian Arntzen
6a7b95d2d6 Validate that std140 packing can actually be used. 2017-10-10 10:12:27 +02:00
Hans-Kristian Arntzen
c9168cd981 Merge pull request #299 from KhronosGroup/fix-173
Stamp out all variants for mod().
2017-10-06 13:53:06 +02:00
Hans-Kristian Arntzen
d4727fe696 Stamp out all variants for mod(). 2017-10-06 13:21:42 +02:00
Hans-Kristian Arntzen
8538b4c9c0 Handle empty struct declarations with best effort.
This "feature" is a bit icky as we have no useful representation of it,
so never emit code which has anything to do with empty structs.
2017-10-06 13:05:14 +02:00
Hans-Kristian Arntzen
eb58f67727 Only unroll matrices for vertex input.
Bandaid, might have to revisit this later.
2017-10-05 16:31:52 +02:00
Hans-Kristian Arntzen
067f241bf8 Runtime arrays do not work yet in MSL, so don't try to test that yet. 2017-10-02 09:24:16 +02:00
Hans-Kristian Arntzen
ecaea50739 Add SPVASM test from clspv. 2017-09-29 12:20:57 +02:00
Hans-Kristian Arntzen
aab3107a3f Add WorkGroupID/NumWorkGroups to MSL. Fix block name alias. 2017-09-29 12:16:53 +02:00
Hans-Kristian Arntzen
db5d49f04a Add SPVASM testing support for HLSL/MSL. 2017-09-29 11:07:11 +02:00
Hans-Kristian Arntzen
cff0fb57dc Add specialization constant work group size test for MSL. 2017-09-29 10:22:19 +02:00
Hans-Kristian Arntzen
825f07c04a Add test for specialization constant workgroup size on HLSL. 2017-09-29 10:21:02 +02:00
Hans-Kristian Arntzen
84f8c9935b Declare work group size constants in HLSL and MSL.
Technically not needed, but it does make compute code easier to read
compared to magical constants being used for work group size.
2017-09-29 10:15:33 +02:00
Hans-Kristian Arntzen
0e4ed4102b Only declare with specialization constant when in Vulkan semantics. 2017-09-28 12:24:04 +02:00
Hans-Kristian Arntzen
3339fd4e87 Fix case when Phi variable is a loop variable.
Need to flush variable to static expression rather than a variable.
2017-09-25 10:15:17 +02:00
Hans-Kristian Arntzen
9aa42a87af Just emit textureSize variants we actually need. 2017-09-20 10:31:56 +02:00
Hans-Kristian Arntzen
1bc5b70752 Add exhaustive image query to HLSL.
Need to strip this down somehow ...
2017-09-20 10:00:13 +02:00
Hans-Kristian Arntzen
7064c54820 Various fixes to texture/image query in GLSL. 2017-09-19 16:08:25 +02:00
James Ross-Gowan
02e6be7288 Fix texture GatherRed/Green/etc. methods for SM 5.0
Unlike GLSL, the component is selected by calling a specific method.
2017-09-12 07:20:01 +10:00
Hans-Kristian Arntzen
eab66fcd55 Update HLSL references. 2017-09-08 09:14:00 +02:00
Hans-Kristian Arntzen
656a7ba1d3 Remove irrelevant test.
The UDIV test was testing invalid SPIR-V and recent SPIRV-Tools errors
out on it.
2017-09-06 10:56:14 +02:00
Hans-Kristian Arntzen
a2229a0327 Add regression test for RMW optimizations. 2017-09-06 09:20:55 +02:00
Hans-Kristian Arntzen
9091eadb0d Support FrexpStruct/ModfStruct. 2017-09-04 10:27:08 +02:00
Hans-Kristian Arntzen
11dfcb6531 Add restrict qualifier for images. 2017-08-29 15:54:22 +02:00
Hans-Kristian Arntzen
d55898ec74 Fix declaration of coherent images. 2017-08-29 15:52:59 +02:00
Hans-Kristian Arntzen
536d888a92 Add test shader for coherent SSBO. 2017-08-28 09:02:08 +02:00
Hans-Kristian Arntzen
e8d2c8e710 Support samplerBuffer as function parameters in HLSL. 2017-08-21 10:26:44 +02:00
Hans-Kristian Arntzen
e8d5d71cad Add sampler buffer support to HLSL. 2017-08-21 10:01:03 +02:00
Hans-Kristian Arntzen
d7f38ab4bf Add support for SPV_KHR_multiview. 2017-08-15 13:28:16 +02:00
Hans-Kristian Arntzen
945425eaa8 Add some access chain tests. 2017-08-15 10:23:04 +02:00
Hans-Kristian Arntzen
af2b233582 Add test for ByteAddressBuffer vs. RWByteAddressBuffer. 2017-08-15 09:39:45 +02:00
Hans-Kristian Arntzen
e2bb5b8959 Add test for compute shader builtins. 2017-08-15 09:35:23 +02:00
Bill Hollings
1e84a379ff Fix issue #245: assignment of flattened input struct.
Emit input struct assignment by assigning member by member from stage_in struct.
Map qualified member name from pointer type, not base type.
Add Comiler::expression_type_id() function, similar to expression_type().
2017-08-12 00:21:13 -04:00
Bill Hollings
77f5812c55 Fix issue #239: compilation of shaders-msl/frag/texture-proj-shadow.frag.
Remove unsupported sampler1DShadow from shaders-msl/frag/texture-proj-shadow.frag.
Improve error message response from unsupported depth texture formats.
Fix several integer cast warnings in unrelated code.
Run ./format_all.sh on unrelated files.
2017-08-11 14:54:58 -04:00
Bill Hollings
730257cf67 Merge upstream 2017-08-10 17:27:01 -04:00
Hans-Kristian Arntzen
744d0405b0 Preserve arguments with inout unless complete writes are made. 2017-08-09 17:06:41 +02:00
Hans-Kristian Arntzen
48ccde3779 Support OpConstantNull. 2017-08-03 14:32:29 +02:00
Hans-Kristian Arntzen
a4fafa0607 Fix edge-case where do/while body is a dominator.
Shows up quite a lot in inlined code, should get more test coverage in
this area ...
2017-08-02 11:58:24 +02:00
Hans-Kristian Arntzen
f337e50844 Remove MSL textureProj test shader. Need to sort it out later. 2017-07-31 10:16:07 +02:00
Hans-Kristian Arntzen
cbcaca5a39 Fix textureProj with shadow on GLSL. 2017-07-31 10:05:32 +02:00
Hans-Kristian Arntzen
24c35e3fb3 Merge pull request #235 from KhronosGroup/hlsl-spec-constant
Declare specialization constants in HLSL.
2017-07-30 06:32:20 +02:00
Hans-Kristian Arntzen
98c76eed69 Declare specialization constants in HLSL. 2017-07-29 22:13:27 +02:00
Hans-Kristian Arntzen
dbaaf1b69e Add test for default member names. 2017-07-29 21:58:37 +02:00
Hans-Kristian Arntzen
955319aa66 Update test files. 2017-07-29 21:47:28 +02:00
Hans-Kristian Arntzen
6ff9007311 Fix unary enclosures. 2017-07-24 10:17:19 +02:00
Hans-Kristian Arntzen
c8d60914c4 Add support for SampleId/SampleMask/SamplePosition builtins. 2017-07-24 10:07:31 +02:00
Hans-Kristian Arntzen
df6aa0e609 Support SampleCmpLevelZero on cubes as well. 2017-07-24 09:28:24 +02:00
Bill Hollings
5f42746389 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-06-30 19:11:46 -04:00
Bill Hollings
f591bc0d4a CompilerMSL enhancements.
Support BuiltInFragDepth.
Emit interface block for StorageClassUniformConstant.
Throw exception when output or fragment input structs contain matrix or array.
Dynamically created interface structs sorted by location number instead of alphabetically.
Add Compiler::is_array() function.
2017-06-30 19:10:46 -04:00
Hans-Kristian Arntzen
ecf56cff2b Add support for SM5.1 ConstantBuffer<T>. 2017-06-30 10:34:21 +02:00
David Srbecky
77b5b4446b Always make a copy when handling OpCompositeInsert
The modified object might not be mutable (e.g. shader input).

Added a test for the case when this happens.
2017-06-26 18:32:53 +01:00
Hans-Kristian Arntzen
ad2b7c05e7 Implement workaround for textureLod on 2D array shadow.
This does not exist in GLSL, but it exists in HLSL if LOD == 0.0.
2017-06-23 09:45:42 +02:00
Hans-Kristian Arntzen
a1f5453519 Assign block locations to members in MSL. 2017-06-21 09:55:46 +02:00
Hans-Kristian Arntzen
de33d89074 Add explicit in/out locations everywhere.
Needed for newer glslang. With Vulkan semantics for SPIR-V, all
locations must be explicitly defined.
2017-06-21 09:39:08 +02:00
Hans-Kristian Arntzen
620da7b943 Add basic support for : register() declaration in HLSL. 2017-06-17 10:15:32 +02:00
Bill Hollings
1f83856366 CompilerMSL add support for MSL specialization function constants.
CompilerMSL add emit_custom_functions() function.
CompilerMSL restrict use of as_type<> cast to necessary conditions.
CompilerMSL refactor get_declared_struct_member_size() and
get_declared_struct_member_alignment() functions, and remove
unnecessary get_declared_type_size() functions.
Add test shaders-msl/vulkan/frag/spec-constant.vk.frag.
2017-06-15 15:24:22 -04:00
Bill Hollings
ba245697f1 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-06-01 10:20:00 -04:00
Hans-Kristian Arntzen
470ae7a7f6 Add multidimensional array flattening test. 2017-05-31 10:00:52 +02:00
Hans-Kristian Arntzen
842eff9647 Merge pull request #188 from KhronosGroup/sso
Add support for Separate Shader Objects
2017-05-31 09:55:34 +02:00
Bill Hollings
192bdc9516 CompilerMSL elide unused builtins from entry function input and output structs.
Add Compiler::has_active_builtin() function.
Update test reference shaders that included unused builtins.
2017-05-24 09:31:38 -04:00
Bill Hollings
d77de7ab80 CompilerMSL add support for MSL qualifiers on gl_ClipDistance and other array-based builtins. 2017-05-23 13:24:41 -04:00
Bill Hollings
0f97ffd8be Fix merge conflicts with upstream master, plus fixes from review of PR #186. 2017-05-23 10:44:10 -04:00
Hans-Kristian Arntzen
91379fb0d0 Implement more sophisticated check for point_size. 2017-05-23 10:15:22 +02:00
Bill Hollings
c1b8154f2c CompilerMSL fix variables used in interface blocks aren't resolved correctly (#179). 2017-05-22 21:41:19 -04:00
Hans-Kristian Arntzen
623eaebdf8 Add test shaders for SSO. 2017-05-22 15:53:38 +02:00
Bill Hollings
d677e63860 Merge with upstream 2017-05-19 19:36:24 -04:00
Bill Hollings
8f6df770ce CompilerMSL map many GLSL functions to MSL functions.
Add bool members is_read and is_written to SPIRType::Image.
Output correct texture read/write access by marking whether textures
are read from and written to by the shader.
Override bitcast_glsl_op() to use Metal as_type<type> functions.
Add implementations of SPIR-V functions inverse(), degrees() & radians().
Map inverseSqrt() to rsqrt().
Map roundEven() to rint().
GLSL functions imageSize() and textureSize() map to equivalent
expression using MSL get_width() & get_height() functions.
Map several SPIR-V integer bitfield functions to MSL equivalents.
Map SPIR-V atomic functions to MSL equivalents.
Map texture packing and unpacking functions to MSL equivalents.
Refactor existing, and add new, image query functions.
Reorganize header lines into includes and pragmas.
Simplify type_to_glsl() logic.
Add MSL test case vert/functions.vert for added function implementations.
Add MSL test case comp/atomic.comp for added function implementations.
test_shaders.py use macOS compilation for MSL shader compilation validations.
2017-05-19 18:14:08 -04:00
Hans-Kristian Arntzen
686ac6812b HLSL: Can pass down combined image samplers as arguments. 2017-05-07 13:22:16 +02:00
Hans-Kristian Arntzen
59ad08429b HLSL: Add test for passing down separate image and samplers to functions. 2017-05-07 12:53:51 +02:00
Hans-Kristian Arntzen
f081fe1125 Fix separate sampler images in MSL. 2017-05-07 12:36:14 +02:00
Hans-Kristian Arntzen
89d57e15ba Add test case for combined depth image sampler in GLSL. 2017-05-06 13:56:45 +02:00
Hans-Kristian Arntzen
100e9d34b8 HLSL: Basic support for separate image/samplers. 2017-05-06 12:39:04 +02:00
Bill Hollings
f9f87ca391 CompilerMSL output [[point_size]] attribute for BuiltInPointSize member by default.
CompilerMSL::Options::is_rendering_points defaults to true.
2017-05-05 16:13:55 -04:00
Hans-Kristian Arntzen
851acf3712 Avoid boolean mix in HLSL.
Update glslang travis checkout as boolean mix support was broken on that commit.
2017-05-04 10:28:30 +02:00
Hans-Kristian Arntzen
17d88ca928 Add compatibility option for PointSize in HLSL.
If we opt-in to it, PointSize can be ignored to avoid more annoying
workarounds.
2017-05-04 10:12:14 +02:00
Robert Konrad
bb9dbd4149 Support texelFetch in HLSL 2017-04-24 11:08:55 +02:00
Robert Konrad
7d8be83cb3 Support shadow sampling in HLSL 2017-04-21 17:52:04 +02:00
Robert Konrad
585339f3cd Test HLSL cube maps 2017-04-21 14:55:01 +02:00
Robert Konrad
9020c48076 Support and test 1D and 3D textures in HLSL4/5 2017-04-21 14:05:17 +02:00
Robert Konrad
23d993546c Add texture sampling HLSL test 2017-04-21 11:46:10 +02:00
Robert Konrad
be4c919d08 Update HLSL test results 2017-04-18 15:17:55 +02:00
Robert Konrad
3804292c43 Merge branch 'master' of github.com:KhronosGroup/SPIRV-Cross into fix 2017-04-03 11:43:35 +02:00
Robert Konrad
1fb2315a35 Add a test for HLSL matrix unrolling 2017-04-03 11:42:36 +02:00
Hans-Kristian Arntzen
543e380d90 Fix case where samplerBuffer is emitted without combined sampler. 2017-04-02 11:03:07 +02:00
Hans-Kristian Arntzen
b2c2e6483b Analyze parameter preservation for functions.
This is kinda tricky, because if we only conditionally write to a
function parameter variable it is implicitly preserved in SPIR-V, so we must force
an in qualifier on the parameter to get the same behavior in GLSL.
2017-03-25 16:25:30 +01:00
Hans-Kristian Arntzen
24382a8ea2 Use findLSB as well in bitfield test. 2017-03-25 15:46:12 +01:00
Hans-Kristian Arntzen
6801af4dce Fix bitfield functions. 2017-03-25 15:38:20 +01:00
Hans-Kristian Arntzen
f4749df09a Merge pull request #151 from Kode/fix
Transform more functions for HLSL
2017-03-24 16:13:34 +01:00
Robert Konrad
9fadd34afe Add new HLSL tests 2017-03-24 15:41:20 +01:00
Robert Konrad
78ec0fcb22 Update HLSL test output
HLSL requires builtins to be defined after
texcoords in some cases.
2017-03-24 14:40:13 +01:00
Hans-Kristian Arntzen
840a72d47a Workaround empty struct declaration and empty IO variables. 2017-03-24 10:03:11 +01:00
Robert Konrad
eab111ed32 Add tests for legacy lod handling 2017-03-23 15:51:43 +01:00
Hans-Kristian Arntzen
a0a582dd04 Do not emit interpolation qualifiers to static globals. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
b8bda45802 Add test case for interpolation qualifiers in HLSL. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
447545311b Add test for input I/O blocks in fragment. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
e89b789af3 Add some tests for no stage inputs or outputs in HLSL. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
62df60ea3d Update vertex locations test to include I/O blocks. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
784a23b92a Add instancing test to HLSL. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
a4aa89e992 Add test for fragment builtins like gl_FragDepth/gl_FragCoord. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
61c31c6054 Make use of explicit locations in HLSL. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
bdea1a444a Begin rewriting how HLSL deals with inputs and outputs. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
75391f9a68 Handle vector variants of OpLogicalAnd/Or/Not. 2017-03-20 22:45:40 +01:00
Bill Hollings
5550c87b1f CompilerMSL options access and UBO alignment test case.
CompilerMSL accesses options using same design pattern as CompilerGLSL and CompilerHLSL.
CompilerMSL support setting VA & rez binding specs via either constructor or compile() method overload.
CompilerMSL support single UBO packing and padding in single pass.
spriv_cross app (main.cpp) supports turning off UBO packing and padding via command line option.
Add MSL UBO alignment test shader.
2017-03-12 17:42:51 -04:00
Hans-Kristian Arntzen
fd12124bf7 Add tests for legacy I/O flattening. 2017-03-06 14:04:01 +01:00
Hans-Kristian Arntzen
7f2e17969b Add built-in cull distance. 2017-03-05 12:47:03 +01:00
Hans-Kristian Arntzen
036b9b73f5 Emit storage qualifier in the correct place.
Need to emit qualifiers in a specific order for legacy GLSL.

<interpolation> <storage> <precision> <type>.
2017-02-24 09:56:17 +01:00
Hans-Kristian Arntzen
fc80cd8cbf Add support for loading flattened structs. 2017-02-23 19:31:56 +01:00
Hans-Kristian Arntzen
97350d32fd Fix cases for flattened struct write.
Handle writing the entire struct as well as writing the elements
individually.
2017-02-23 19:05:11 +01:00
Bill Hollings
1699e69ccd Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-02-11 10:58:07 -05:00
Hans-Kristian Arntzen
0e7c33ff81 Update glslang to latest on Travis.
Fix a lingering bug with OpSelect and boolean mix().
2017-02-11 10:52:34 +01:00
Bill Hollings
e016de860a Update MSL reference shaders affected by upstream pull. 2017-02-09 13:16:13 -05:00
Bill Hollings
6159a61c95 CompilerMSL add support for texel buffers.
Compiler MSL support DimBuffer as image dimension.
CompilerMSL check texture coordinate result type dimension before adding swizzles.
Update MSL reference shaders affected by this update.
2017-02-09 12:14:30 -05:00
Hans-Kristian Arntzen
5dd7c04195 Merge branch 'master' of git://github.com/brenwill/SPIRV-Cross into pr-109 2017-02-05 10:59:44 +01:00
Hans-Kristian Arntzen
9cb8616c31 Do not use write/read counters for "global" parameters.
Fixes device const & SSBO issues.
2017-02-05 10:50:14 +01:00
Hans-Kristian Arntzen
4ca769b546 Merge branch 'msl_global-invocation-id' of git://github.com/Kangz/SPIRV-Cross into pr-105 2017-02-05 10:14:38 +01:00
Hans-Kristian Arntzen
ab21dfb25b Fix execution order for for-loop emission.
In some cases, the compiler decided to emit continue block first,
which invalidated the expressions used by the condition.
Parameters to functions can be evaluated in any order which caused
"random" behavior.
2017-02-04 10:07:20 +01:00
Bill Hollings
e791c0b9e6 Removed Travis-killing MSL test: frag/for-loop-init.frag. 2017-01-31 12:08:08 -05:00
Bill Hollings
de72b3328e Removed Travis-killing MSL test: flatten/copy.flatten.vert. 2017-01-31 12:01:13 -05:00
Bill Hollings
d1737c65cf Removed Travis-killing MSL test: flatten/dynamic.flatten.vert. 2017-01-31 11:53:20 -05:00
Bill Hollings
be4cb17a14 Enhance MSL testing and add numerous MSL test cases.
Add to suite of MSL tests and references any existing GLSL tests
that successfully convert GLSL->SPIRV->MSL and compile as MSL.
test_shaders_helper() ignores hidden files that start with '.',
to avoid accidentally finding hidden OSX files such as .DS_Store.
Use xcrun to compile MSL shaders instead of hard-coded path to Metal compiler.
Wrap calls to xcrun in exception handling to ignore if Xcode not installed.
For MSL tests, move call to validate_shader_msl() to after call to
regression_check() to allow a converted MSL shader to be saved for
manual review even if it doesn't successfully compile as MSL.
2017-01-30 22:55:21 -05:00
Hans-Kristian Arntzen
1850457b28 Merge pull request #107 from Kode/hlsl
HLSL Support
2017-01-28 08:53:24 +01:00
Robert Konrad
e49cff5055 Update HLSL reference shader 2017-01-27 16:34:52 +01:00
Corentin Wallez
d8278a8e3b msl: Add support for gl_LocalInvocationID and gl_LocalInvocationIndex 2017-01-26 20:22:31 -05:00
Corentin Wallez
3542168f51 Add SSBO and gl_GlobalInvocationID MSL tests 2017-01-26 20:12:00 -05:00
Robert Konrad
82959c86bb Use \n line endings in HLSL reference shaders 2017-01-26 13:22:52 +01:00
Robert Konrad
d6b3efaaaf Add HLSL reference shader outputs 2017-01-26 11:41:22 +01:00
Robert Konrad
7b3d0686ef Adjust metal reference output
Y flipping is now off by default.
2017-01-26 10:32:50 +01:00
Arseny Kapoulkine
f45075b08b Validate Metal shaders on OSX with Metal compiler
If we run on a system with Xcode installed to a default path, run Xcode
Metal shader compiler to validate the generated MSL shader.

This uncovers an issue in the existing MSL test - MSL backend currently
does not auto-assign attribute locations, which means that translating
GLSL shader without location layout produces an invalid MSL which
generates "error: 'attribute' index '0' is used more than once".
2017-01-25 00:12:09 -08:00
Hans-Kristian Arntzen
7daba19223 Merge pull request #108 from zeux/flatten-row-major-matrix-index
Implement flattening of row major matrix indexing
2017-01-24 18:47:00 +01:00
Arseny Kapoulkine
32a561a6c3 Remove redundant constructor calls for scalar types 2017-01-24 08:09:58 -08:00
Arseny Kapoulkine
ed04c95b08 Implement flattening of row major matrix indexing
To extract a column from row-major matrix, we need to do a strided load one
component at a time. In this case flattened_access_chain_offset still returns
the offset to the first element, but the stride is equal to matrix stride
instead of vector stride.

For this to work, we need to pass matrix stride (and transpose flag) through,
similar to how matrix flattening works.

Additionally slightly clean up recursive flattened_access_chain structure -
specifically, instead of deciding mid-traversal that we need matrix stride
information, we can just pass the matrix stride through - for access chains
that end in matrix/vector this gets us what we need, and for access chains
that end in structs the flattened_access_chain_struct code will recompute
correct stride/transposition data to pass through further.
2017-01-24 07:42:19 -08:00
Hans-Kristian Arntzen
1c28ec6885 Add basic setup for regression testing Metal output. 2017-01-24 14:04:55 +01:00
Hans-Kristian Arntzen
a35073ad78 Add test for flattened 3-dimensional arrays. 2017-01-22 08:49:11 +01:00
Hans-Kristian Arntzen
3eb2e52c4e Fix bugs with row-major matrices inside flattened UBOs. 2017-01-21 13:50:01 +01:00
Hans-Kristian Arntzen
d93dc38415 Use correct glslang revision for reference output ... 2017-01-21 12:53:17 +01:00
Hans-Kristian Arntzen
d1dcced1cb Fixups to the flatten tests. 2017-01-21 12:39:16 +01:00
Hans-Kristian Arntzen
69af27d8be Expand array flatten test a little. 2017-01-21 12:35:57 +01:00
Hans-Kristian Arntzen
9540979c55 Support int and uint as flattened UBO types. 2017-01-21 12:29:20 +01:00
Hans-Kristian Arntzen
016b1d86e9 Emit readonly, writeonly for SSBOs. 2017-01-21 10:08:27 +01:00
Arseny Kapoulkine
62b27f1d81 Implement access chain flattening support for row major matrices
We currently only support access chains that end in a matrix by propagating
"needs transpose" flag upstream which flips the matrix multiplication order.

It's possible to support indexed extraction as well, however it would have to
generate code like this:

    vec4 row = vec4(UBO[0].y, UBO[1].y, UBO[2].y, UBO[3].y);

for a column equivalent of:

    vec4 row = UBO[1];

It is definitely possible to do so but it requires signaling the vector output
that it needs to switch to per-component extraction which is a bit more trouble
than this is worth for now.
2017-01-17 23:26:23 -08:00
Arseny Kapoulkine
64c17b59e5 Fix whitespace in generated flattened expressions
Add whitespace after comma and around arithmetic operators.
2017-01-17 23:26:19 -08:00
Arseny Kapoulkine
24c66250c7 Add tests for buffer block flattening 2017-01-17 23:26:18 -08:00
Hans-Kristian Arntzen
41f7e5b6a1 Add ability to have legacy-specific tests. 2017-01-16 09:08:06 +01:00
Hans-Kristian Arntzen
44b3216611 Sort loop variables to make sure Travis CI runs are reproducable. 2016-12-16 14:01:09 +01:00
Hans-Kristian Arntzen
45c797d54c Improve debuggability of Travis CI when things go wrong. 2016-12-16 13:48:30 +01:00
Hans-Kristian Arntzen
d11b8aa3ef Optimize += 1, -= 1 to ++, --.
Purely cosmetic, but easier to read.
2016-12-16 13:24:49 +01:00
Hans-Kristian Arntzen
62613df5a5 Optimize for read-modify-writes.
Required for legacy loop increments.
2016-12-16 13:14:22 +01:00
Hans-Kristian Arntzen
a714d424d0 Add directed test for for-loop-init. 2016-12-16 12:43:12 +01:00
Hans-Kristian Arntzen
51d45511a6 Check if we can use multiple initializers.
Need same type and qualifiers in GLSL and friends.
2016-12-15 17:54:49 +01:00
Hans-Kristian Arntzen
b8b202f489 Add more dedicated test shader for defer-parens. 2016-12-08 09:05:30 +01:00
Hans-Kristian Arntzen
03a26e593d Fixes for MSL and strip redundant parens in some places. 2016-12-06 23:03:35 +01:00
Hans-Kristian Arntzen
e67f6f85a4 Defer parenthesis generation until needed.
Previously, we would generate parentheses proactively when generating
binary ops, however, this leads to uglier code and hits warnings in
compilers when used as a conditional.
2016-12-05 10:56:54 +01:00
Hans-Kristian Arntzen
2d79d365dc Fix get_declared_struct_size for nested arrays of structs.
The array size was dropped from consideration during recursion.
2016-11-28 15:01:36 +01:00
Hans-Kristian Arntzen
5ff11cc689 Handle more corner cases with the CFG traversal. 2016-11-18 16:45:11 +01:00
Hans-Kristian Arntzen
edbe867b74 Improve handling of dead blocks.
All tests pass now.
Still need to handle OpFunction, atomics, OpPhi, etc ...
2016-11-17 22:15:07 +01:00
Hans-Kristian Arntzen
206cb9157c Handle interpolation qualifiers inside IO blocks. 2016-10-07 16:30:11 +02:00
Hans-Kristian Arntzen
5d4bb687bc Support arrays which have spec constant size.
The size of an array can be a specialization constant or a spec constant
op. This complicates things quite a lot.

Reflection becomes very painful in the presence of expressions instead
of literals so add a new array which expresses this.

It is unlikely that we will need to do accurate reflection of interface
types which have specialization constant size.

SSBOs and UBOs will for now throw exception if a dynamic size is used since it
is very difficult to know the real size.
2016-10-03 17:17:11 +02:00
Hans-Kristian Arntzen
7e8afa872b Implement OpSpecConstantOp.
The details here get quite hairy, and it's not complete as not all
functionality is implemented in glslang yet.
2016-10-03 15:54:02 +02:00
Hans-Kristian Arntzen
25c4467a10 Add tests for all geometry shader primitive types. 2016-09-28 08:23:21 +02:00
Hans-Kristian Arntzen
f3220833e8 Fix triangle mode in tessellation output. 2016-09-28 08:12:04 +02:00
Hans-Kristian Arntzen
706d3ead29 Always run spirv-val for SPIR-V files created.
Add way to disable testing if SPIR-V is not validating properly.
2016-09-12 20:11:30 +02:00
Hans-Kristian Arntzen
88681fd7fd Struct packing test now works again in glslang. 2016-09-12 19:39:43 +02:00
Hans-Kristian Arntzen
3c5f55cde1 Add special test for more coverage in combined image sampler. 2016-09-11 13:41:38 +02:00
Hans-Kristian Arntzen
50839910a2 Separate image samplers are compatible now. 2016-09-11 13:26:03 +02:00
Hans-Kristian Arntzen
fab9ee8adf Update separate sampler test. 2016-09-11 13:23:38 +02:00
Hans-Kristian Arntzen
b6847168b2 Update test suite for latest glslang. 2016-09-10 12:53:41 +02:00
Hans-Kristian Arntzen
f61a5d1e5d Implement dead variable elimination. 2016-08-26 12:58:50 +02:00
Hans-Kristian Arntzen
042475e88e Add support for multiple entry points.
- Only consider I/O variables if part of OpEntryPoint.
- Keep a safe fallback if #entry-points is 1 to avoid potentially
  breaking previously working shaders.
2016-07-28 13:18:55 +02:00
Hans-Kristian Arntzen
fc2230ffff Add support for int64/uint64 in GLSL. 2016-07-27 11:31:58 +02:00
Hans-Kristian Arntzen
fa0255c43b Add support for FP64 in GLSL. 2016-07-27 11:31:54 +02:00
Hans-Kristian Arntzen
81d00da573 Implement OpImageQueryLevels. 2016-07-19 09:28:32 +02:00
Hans-Kristian Arntzen
1b4f7662d3 Add support for OpImageQueryLod. 2016-07-19 09:23:49 +02:00
Hans-Kristian Arntzen
36a0b63f28 Fix various corner cases with expression dependencies.
There was a potential problem if variables were invalidated and SPIR-V
read expressions which depended on other expression which in turn depended on the
invalidated variable.

Also fixes issue where variables were considered immutable if they were
forwardable. This allowed some incorrect optimizations to slip through.
2016-07-12 14:50:23 +02:00
Hans-Kristian Arntzen
2bfe98c35d Fix image-format test to use desktop extension. 2016-07-12 09:37:31 +02:00
Hans-Kristian Arntzen
606ecce0f1 Handle all desktop image formats. 2016-07-12 09:35:15 +02:00
Hans-Kristian Arntzen
3265e1fc3f Implement subpassInputMS loading. 2016-07-11 13:36:11 +02:00
Hans-Kristian Arntzen
7af13b68d5 Support ImageRead/Write on multisampled images. 2016-07-11 13:26:22 +02:00
Hans-Kristian Arntzen
2c7d2e4d3c Implement OpImageQuerySamples. 2016-07-11 12:47:46 +02:00
Hans-Kristian Arntzen
05a97883d2 Don't emit invocation layout for invocations == 1. 2016-06-23 13:49:19 +02:00
Hans-Kristian Arntzen
4bb9f092ab Only split expression in OpCompositeExtract if we forward the temporary. 2016-06-23 12:13:41 +02:00
Hans-Kristian Arntzen
9d4360fddf Fix sampler2DMS texelFetch. 2016-06-22 12:35:58 +02:00
Hans-Kristian Arntzen
81a8fc1952 Add support for OpQuantizeF16. 2016-05-31 16:56:15 +02:00
Hans-Kristian Arntzen
168e46fdf9 Use std::array in C++ backend.
Deals better with composite construction in C++
and also fixes a few bugs in GLSL backend with array-of-arrays.
2016-05-28 13:23:51 +02:00
Hans-Kristian Arntzen
4739d16e98 Remove workaround for overly conservative memory barriers.
This is now fixed in ESSL 3.10 backend of glslang, so we can remove the old workaround
of dropping full memory barriers.

Also fixes unrelated issue which newer glslang detects.
2016-05-28 11:46:33 +02:00
Hans-Kristian Arntzen
5ad4340976 Workaround case with identical structs but different types.
With the current workarounds for SSBO type aliasing, we have no choice
but to look at OpName in order to figure this out properly.
2016-05-28 09:47:52 +02:00
Hans-Kristian Arntzen
6aa2007cba Deal better with OpName and OpMemberName which alias.
OpName is only for debug information, so we must be very careful that
we do not reuse the same name for different variables.

This was previously done for local variables, but this commit extends
this to global variables as well.
2016-05-23 13:19:41 +02:00
Hans-Kristian Arntzen
45ad58a903 Implement more correct integer op handling.
In some cases we need to bitcast when dealing with int vs. uint.
SPIR-V allows inputs to be of different integer signedness, so we need
to deal with this somehow.

Add testing system to test SPIR-V assembly.
For now, test all possible combination for all major cases.

 - IAdd (which doesn't care about input type as long as they're equal)
 - SDiv/UDiv operations which case about input type.
 - Arith/Logical right shifts.
 - IEqual to test outputs to bvec, which shouldn't get output cast. Also
   tests casting in function-like calls.
2016-05-13 15:23:33 +02:00
Hans-Kristian Arntzen
8869a167d6 Drop --vulkan flag to test_shaders.py
We can infer shader types from file extensions.
2016-05-11 20:02:31 +02:00
Hans-Kristian Arntzen
44ef367141 Handle padding for struct members in buffers.
Fixes earlier issues with struct-packing test.
2016-05-05 16:32:15 +02:00
Hans-Kristian Arntzen
2d38c6e192 Fixups for struct-packing test.
There seems to have been some changes to alignment in glslang here,
so workaround to verify that the other cases at least still work as expected.
2016-05-05 11:59:33 +02:00
Hans-Kristian Arntzen
f144b767ce Always emit DescriptorSet decoration for Vulkan GLSL. 2016-05-05 11:53:43 +02:00
Hans-Kristian Arntzen
b7a30b659e Remove stale reference shader. 2016-05-05 10:46:34 +02:00
Hans-Kristian Arntzen
dbee4e4346 Add support for Vulkan GLSL as output target.
Mostly useful for debugging SPIR-V where it is useful to see the
"original" Vulkan GLSL constructs which created the SPIR-V.
2016-05-05 10:44:45 +02:00
Hans-Kristian Arntzen
9d4b5c0c59 Use texel fetch instead of normalized sampling for subpass.
Cleaner output code, and matches more directly to how subpass reads work.
2016-05-05 09:19:38 +02:00
Hans-Kristian Arntzen
12cfbb221f Add support for querying DecorationInputAttachmentIndex.
Was missing from OpDecoration handling.
2016-05-04 13:41:04 +02:00
Hans-Kristian Arntzen
b6e3a00976 Support sampler and texture as function arguments.
sampler is also not an lvalue type.
2016-04-19 11:27:17 +02:00
Hans-Kristian Arntzen
7652c90802 Add support for separate samplers and textures.
This will not really make sense for plain GLSL/ESSL target, but other
backends might want it and useful to have for debugging.
2016-04-19 11:13:47 +02:00
Hans-Kristian Arntzen
b424851706 Fix floating point OpMod.
Floating point mod uses separate builtin in GLSL.
2016-04-16 09:25:14 +02:00
Hans-Kristian Arntzen
ba0ab875c8 Fix cases where SPIR-V conditionally branches to loop headers.
We should check if we are actually branching back to loop header.
Fixes some logic when continue_block == loop_header.
2016-04-04 08:53:37 +02:00
Hans-Kristian Arntzen
92134e410a Do not add dependencies for variables loaded from UniformConstant.
Fixes case where image variables (OpTypeImage), etc are
loaded from UniformConstant address space.
2016-04-01 19:58:26 +02:00
Hans-Kristian Arntzen
72e93672d3 Add array-of-SSBO test. 2016-03-22 14:49:43 +01:00
Hans-Kristian Arntzen
0ae2bcc3d0 Ensure that floating point literals are float.
Fixes regression from earlier workaround of std::to_string.
Update reference output.
2016-03-12 14:22:39 +01:00
Hans-Kristian Arntzen
75471fbb98 Initial commit. 2016-03-11 16:30:27 +01:00