Grigory Dzhavadyan
a5d82d1138
Alter the handling of spec consts in non-Vulkan GLSL
...
Previously, when generating non-Vulkan GLSL, each use of a spec constant
would be subsituted for its default value and the declaration of the constant
itself would be omitted completely.
This change slightly alters this behavior. The uses of the constant are kept,
as well as the declaration, although the latter is stripped of the layout
qualifier. The declaration is also prepended with the following code:
#ifndef <constant name>_value
#define <constant name> <default constant value>
#endif
and the constant itself now looks like
const <constant type> <constant name> = <constant name>_value;
The rationale for this change is that it gives the user a way to provide
custom values for specialization constants even when the target does not
support them.
2018-11-01 00:39:09 -07: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
d29f48ef06
Deduce constant LUTs from read-write variables.
2018-07-05 13:25:57 +02:00
Hans-Kristian Arntzen
7eba247864
Handle inout properly with split access chains.
...
Found some other issues. Had some bugs with variable writes not properly
invalidating if writes came from split access chains.
2018-05-11 10:15:42 +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
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
e8e58844d4
Rewrite everything to use Bitset rather than uint64_t.
2018-03-12 13:24:14 +01:00
Hans-Kristian Arntzen
5fe79eb59c
Update tests.
...
Adds an earlier reported shader packing failure into regression suite.
2018-03-05 16:34:42 +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
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
7e02f7fd62
Check more places where we can potentially read phi variables.
2017-11-23 09:50:11 +01:00
Hans-Kristian Arntzen
6a7b95d2d6
Validate that std140 packing can actually be used.
2017-10-10 10:12:27 +02:00
Hans-Kristian Arntzen
a2229a0327
Add regression test for RMW optimizations.
2017-09-06 09:20:55 +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
744d0405b0
Preserve arguments with inout unless complete writes are made.
2017-08-09 17:06:41 +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
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
0e7c33ff81
Update glslang to latest on Travis.
...
Fix a lingering bug with OpSelect and boolean mix().
2017-02-11 10:52:34 +01:00
Hans-Kristian Arntzen
d93dc38415
Use correct glslang revision for reference output ...
2017-01-21 12:53:17 +01:00
Hans-Kristian Arntzen
016b1d86e9
Emit readonly, writeonly for SSBOs.
2017-01-21 10:08:27 +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
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
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
b6847168b2
Update test suite for latest glslang.
2016-09-10 12:53:41 +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
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
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
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
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