Commit Graph

97 Commits

Author SHA1 Message Date
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