Commit Graph

46 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
378fbe8b92 Consistently use "image" nomenclature for separate images. 2016-09-11 13:48:25 +02:00
Hans-Kristian Arntzen
313cb5f820 Declare shadow arguments. 2016-09-11 12:54:08 +02:00
Hans-Kristian Arntzen
948930b171 Build new IDs for shadow arguments. 2016-09-11 12:36:12 +02:00
Hans-Kristian Arntzen
dfb6597ee4 Begin redirecting separate params to other params. 2016-09-11 12:05:20 +02:00
Hans-Kristian Arntzen
ed98a8ec86 Begin implementing parameter remapping for combined image sampler.
The basic idea here is that all functions will have a list of which
combinations of parameters will be combined inside the function.
The caller will then know which combined samplers must be provided to
the callee in order to satisfy it.
2016-09-11 11:39:20 +02:00
Hans-Kristian Arntzen
901b45e09a Fix remap_parameter.
Need to return after backing variable resolve.
2016-09-10 22:21:57 +02:00
Hans-Kristian Arntzen
dd1513b814 Trace usage of image/sampler variants through calls. 2016-09-10 21:52:22 +02:00
Hans-Kristian Arntzen
14bc1ffed8 Correctly emit variable declarations for combined image samplers.
Only support direct accesses to global variables in this commit.
2016-09-10 18:09:32 +02:00
Hans-Kristian Arntzen
71bacc4469 Basic combined image sampler emulation hooked up. 2016-09-10 17:48:52 +02:00
Hans-Kristian Arntzen
1b5ca8d868 Move combined image hiding logic into is_hidden. 2016-09-10 16:20:19 +02:00
Hans-Kristian Arntzen
bcb5560109 Sketch out interface for combined image samplers. 2016-09-10 13:56:36 +02:00
Hans-Kristian Arntzen
e92020819e Add reflection support for separate textures and samplers. 2016-09-10 13:05:35 +02:00
Hans-Kristian Arntzen
f61a5d1e5d Implement dead variable elimination. 2016-08-26 12:58:50 +02:00
Hans-Kristian Arntzen
15679c724f Range check Compiler::get_member_decoration. 2016-08-17 11:35:34 +02:00
Robert Konrad
8f7c1af046 Do not try to pump OpLine instructions into a block
When the SPIR-V includes metadata for debugging
(aka OpLine instructions) the CompilerError at
line 1588 was eventually triggered.
2016-08-10 02:43:51 +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
5c24d99ff2 Add distinction between type_id and base_type_id in resource interface.
type_id was not intuitive and did not allow for parsing array sizes of
variables.

Expose another member, base_type_id which will provide the base type
suitable for parsing metadata such as decorations and type_id will now
point to the actual type which includes full type information such as
arrays and so on.
2016-07-12 21:20:18 +02:00
Hans-Kristian Arntzen
7d8add33e4 Avoid conflict with C99 keyword. 2016-07-12 15:00:10 +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
416566bab6 Throw if word count of SPIR-V instruction is 0.
Avoids infinite loop on garbage SPIR-V files.
2016-07-08 10:47:03 +02:00
Hans-Kristian Arntzen
c972894cea Be less conservative about which names are reserved. 2016-07-06 11:19:20 +02:00
Hans-Kristian Arntzen
078eec5894 Add support for generic remapping of variables. 2016-07-06 11:04:06 +02:00
Hans-Kristian Arntzen
8e63c770da Add explicit support for remapping variables.
Will enable use of extensions like framebuffer fetch, last fragment
depth and so on.
2016-07-06 09:58:01 +02: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
3c285a15e0 Add support for reflecting execution modes. 2016-07-04 13:30:05 +02:00
Hans-Kristian Arntzen
5f629276a7 Use Boolean instead of Bool.
Xlib.h header uses a very ugly define for Bool which conflicts with
SPIRV-Cross.

The hassle free solution is to use Boolean instead.
2016-06-05 20:13:45 +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
46892ab745 Fix MSVC warnings. 2016-05-23 13:45:20 +02:00
Hans-Kristian Arntzen
5ea59bd11b Non-functional: Update formatting. 2016-05-23 13:30:02 +02:00
Hans-Kristian Arntzen
f05373bdd1 Do not rely on OpName when finding OpTypeStruct aliases.
SPIR-V can stamp out multiple variants of the same types to deal with
different offsets, layouts, array strides and so on in buffer blocks.
2016-05-23 10:57:22 +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
5af1a51727 Treat more opcodes as impure. 2016-05-05 09:52:28 +02:00
Hans-Kristian Arntzen
4b8ed53974 Add Clang format.
Reformats the entire codebase. Better to do it now than later.

Adds .clang-format and a convenience script format_all.sh which formats
everything automatically.
2016-05-05 09:40:58 +02:00
Hans-Kristian Arntzen
926916d745 Add -Wshadow.
Fixes lots of dubious variable shadowing.
2016-05-05 09:15:25 +02:00
Bill Hollings
2b1e6a8706 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2016-05-04 12:02:45 -04:00
Hans-Kristian Arntzen
12cfbb221f Add support for querying DecorationInputAttachmentIndex.
Was missing from OpDecoration handling.
2016-05-04 13:41:04 +02:00
Bill Hollings
2570121582 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2016-04-19 10:14:01 -04: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
Bill Hollings
6236cc79f0 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2016-04-11 13:35:14 -04:00
Bill Hollings
f9e5fb38b8 Fix compiler warnings. 2016-04-11 10:19:20 -04:00
Hans-Kristian Arntzen
5ac882765d Avoid out of range access to spirv data.
Avoids debug assertion crashes on MSVC 2015 when trying to access
elements out of range.
2016-04-11 13:40:36 +02:00
Bill Hollings
6ddd80e3fe Fixes from code review of MSL functionality.
Rename MSLOptions to MSLConfiguration.
Convert tabs to spaces.
Replace Builtin with uint32_t as map key.
2016-04-08 15:12:40 -04:00
Bill Hollings
103aabf5e8 Initial support for Metal Shading Language. 2016-04-06 17:42:27 -04:00
Hans-Kristian Arntzen
147e53aeb2 Rename project to SPIRV-Cross.
Rename to coincide with moving the project to KhronosGroup.
2016-04-04 15:42:30 +02:00