Hans-Kristian Arntzen
041f103d44
MSL/HLSL: Support scalar reflect and refract.
2019-07-03 12:31:52 +02:00
Hans-Kristian Arntzen
fc9fe4e480
Fix variable scope when an if or else block dominates a variable.
...
Just like loops, we need complicated hoisting again to make this work.
2019-07-03 11:18:50 +02:00
Hans-Kristian Arntzen
707312b83a
GLSL: Support NV barycentrics.
2019-06-19 09:52:35 +02:00
Hans-Kristian Arntzen
6b52b0fe8b
Deal with nested loops.
...
Actually need to hoist out variable to outermost loop.
2019-06-06 14:37:02 +02:00
Hans-Kristian Arntzen
03d93abc1a
Deal with case where a variable is dominated by inner part of a loop.
...
There is a risk that we try to preserve a loop variable through multiple
iterations, even though the dominating block is inside a loop.
Fix this by analyzing if a block starts off by writing to a variable. In
that case, there cannot be any preservation going on. If we don't, pretend the
loop header is reading the variable, which moves the variable to an
appropriate scope.
2019-06-06 11:11:44 +02:00
Hans-Kristian Arntzen
acae607703
Register implied expression reads in OpLoad/OpAccessChain.
...
This is required to avoid relying on complex sub-expression elimination
in compilers, and generates cleaner code.
The problem case is if a complex expression is used in an access chain,
like:
Composite comp = buffer[texture(...)];
vec4 a = comp.a + comp.b + comp.c;
Before, we did not have common subexpression tracking for
OpLoad/OpAccessChain, so we easily ended up with code like:
vec4 a = buffer[texture(...)].a + buffer[texture(...)].b + buffer[texture(...)].c;
A good compiler will optimize this, but we should not rely on it, and
forcing texture(...) to a temporary also looks better.
The solution is to add a vector "implied_expression_reads", which works
similarly to expression_dependencies. We also need an extra mechanism in
to_expression which lets us skip expression read checking and do it
later. E.g. for expr -> access chain -> load, we should only trigger
a read of expr when using the loaded expression.
2019-01-04 14:56:12 +01:00
Hans-Kristian Arntzen
61f1d8b2cf
Support gl_HelperInvocation on GLSL and MSL.
...
There is no obvious builtin for this on HLSL.
2018-11-28 15:18:43 +01:00
Hans-Kristian Arntzen
04f410d35c
Fix unsigned switch case selectors.
2018-11-26 10:36:50 +01:00
Chip Davis
ca4744ab72
Support constants of 16-bit integral type in GLSL and MSL.
...
Constants of 8-bit type aren't supported in GLSL, since there's no
extension letting you use them.
2018-11-02 14:39:55 -05:00
Hans-Kristian Arntzen
6157bf3cae
Add Windows support in Travis CI.
...
- Add new Windows support
- Use CMake/CTest instead of Make + shell scripts
- Use --parallel in CTest
- Fix CTest on Windows
- Cleanups in test_shaders.py
- Force specific commit for SPIRV-Headers
- Fix Inf/NaN odd-ball case by moving to ASM
2018-10-27 00:22:30 +02:00
Hans-Kristian Arntzen
a985ac9499
Add test case for continue out of switch default block.
2018-09-18 11:01:15 +02:00
Hans-Kristian Arntzen
eee290a029
MSL: Fix support for texelFetchOffset.
...
Just apply the offset directly, MSL has no immediate offset parameter.
2018-08-07 15:28:04 +02:00
Hans-Kristian Arntzen
5582523d9a
Add some tests for LUT promotion.
...
Also, update other tests.
2018-07-05 14:14:18 +02:00
Hans-Kristian Arntzen
47081f810a
Fix GatherDref on GLSL.
2018-04-30 12:45:23 +02: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
922420e346
Disallow arrays and structs from becoming loop variables.
...
Fixes awkward code-gen issue.
2018-03-07 14:54:11 +01:00
Hans-Kristian Arntzen
047ad7df0f
Support special float constants (NaN/Inf).
2018-02-23 13:06:20 +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
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
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
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
9091eadb0d
Support FrexpStruct/ModfStruct.
2017-09-04 10:27: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
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
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
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
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
a714d424d0
Add directed test for for-loop-init.
2016-12-16 12:43:12 +01:00
Hans-Kristian Arntzen
d5dc5f3f1c
Fix issue with new glslang behavior for samplers as parameters.
...
Check case where storage class uniform is passed as function parameter.
2016-07-05 13:21:26 +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
75471fbb98
Initial commit.
2016-03-11 16:30:27 +01:00