Commit Graph

367 Commits

Author SHA1 Message Date
Lou Kramer
6671f52334 Add support for new extensions. 2017-11-22 19:05:38 +01:00
Hans-Kristian Arntzen
ce18d4ce74 Run format_all.sh. 2017-11-17 13:38:29 +01:00
Bill Hollings
e83e2b2217 CompilerMSL support and tests for OpUndef. 2017-11-15 22:44:42 -05:00
Hans-Kristian Arntzen
4427cb993d Add support for renaming entry points. 2017-11-13 13:50:37 +01:00
Hans-Kristian Arntzen
f486142e36 Run format_all.sh. 2017-11-13 09:52:35 +01:00
Bill Hollings
1014847f17 Fixes from review #3 of PR 321. 2017-11-10 16:40:33 -05:00
Bill Hollings
bac657d873 Fixes from review of PR 321. 2017-11-07 15:38:13 -05:00
Bill Hollings
42e718b77d Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-11-06 09:06:46 -05:00
Hans-Kristian Arntzen
ca69b614e5 Fix some warnings on older GCC. 2017-11-06 09:49:52 +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
94ff355812 Fix some naming issues for stripped and flattened structs. 2017-10-10 17:32:26 +02:00
Hans-Kristian Arntzen
1079e7930b Run format_all.sh. 2017-10-10 10:22:40 +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
153fed031d Add basic support for StorageClassStorageBuffer.
Needs more testing, but seems to work.
2017-09-28 13:29:57 +02:00
Hans-Kristian Arntzen
86eb874568 Implement specialization constants for work group sizes. 2017-09-28 11:33:30 +02:00
Hans-Kristian Arntzen
ceefae5584 Support mixed constant composites. 2017-09-27 16:10:29 +02:00
Hans-Kristian Arntzen
5e1d6fb3ce Refactor constant construction. 2017-09-27 15:16:33 +02:00
Hans-Kristian Arntzen
89bb31ac51 Remove some dead code. 2017-09-15 16:30:04 +02:00
Hans-Kristian Arntzen
a1c0ab67eb Fix variable scoping when dest block only uses OpPhi to read variable. 2017-08-21 09:36:53 +02:00
Hans-Kristian Arntzen
8d7a909c92 Add support for querying SPIR-V Capabilities and Extensions. 2017-08-15 15:27:53 +02:00
Hans-Kristian Arntzen
945425eaa8 Add some access chain tests. 2017-08-15 10:23:04 +02:00
Hans-Kristian Arntzen
e2bb5b8959 Add test for compute shader builtins. 2017-08-15 09:35:23 +02:00
Hans-Kristian Arntzen
7d7f4b3b50 Emit flattened loads and stores. 2017-08-15 09:15:23 +02:00
Hans-Kristian Arntzen
3cbdbec712 Begin implementing ByteAddressBuffer flattening for HLSL. 2017-08-15 09:15: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
2abdc135c3 Declare undefined values up front.
They might potentially be used as part of OpStore in the SPIRV-Tools
inliner in some cases.

Implement these as declared variables but without any initializer.
2017-08-02 10:33:03 +02:00
Hans-Kristian Arntzen
818c1bea21 Fix spurious struct type aliasing in stripped binaries.
Should not consider aliasing when names are stripped.
2017-07-31 09:31:20 +02:00
Hans-Kristian Arntzen
f0c50a618d Fix parsing time explosion for huge shaders.
Need to prune already walked blocks.
2017-07-25 18:22:15 +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
David Srbecky
a08b26926c Ignore debug instruction OpString
It may be used with OpLine or OpSource to specify filename.
2017-06-27 15:34:45 +01:00
Bill Hollings
6f3381a5d3 Fixes from review of PR #190. 2017-06-01 16:29:39 -04:00
Bill Hollings
b41e1482c8 Support emitting SPIR-V type declarations tuned for specified SPIR-V objects.
CompilerGLSL type_to_glsl() and image_type_glsl() functions support optional object ID.
Add SPIRType::Image::access member to support SPIR-V OpTypeImage access qualifier.
Remove SPIRType::Image::is_read and ::is_written members.
Use DecorationNonReadable and DecorationNonWritable to mark read/write access for image variables.
CompilerMSL emit access qualifiers per image variable, instead of per image type.
CompilerGLSL and CompilerHLSL behaviour is unchanged.
2017-05-29 20:45:05 -04: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
c1b8154f2c CompilerMSL fix variables used in interface blocks aren't resolved correctly (#179). 2017-05-22 21:41:19 -04:00
Bill Hollings
94fdcecce9 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2017-05-22 11:57:25 -04:00
Hans-Kristian Arntzen
e5595270c7 Support SPIR-V 1.2.
It's the default with recent spirv-as, so be more friendly.
2017-05-22 13:59:58 +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
4fef0f3227 Fix switch statement. 2017-05-09 09:41:17 +02:00
Hans-Kristian Arntzen
9c9e2674d2 Fix typo. 2017-05-09 09:38:33 +02:00
Hans-Kristian Arntzen
08b3c674a9 Check size of name before testing for @count. 2017-05-09 09:30:30 +02:00
Hans-Kristian Arntzen
ec45c9efb3 Add interface for reflecting "magic" HLSL counter buffers. 2017-05-09 09:21:54 +02:00
Hans-Kristian Arntzen
36e1c470a2 Fix formatting. 2017-05-06 13:59:00 +02:00
Hans-Kristian Arntzen
07ee7d09cb Fix deep call hierarchies in CombinedImageSamplerUsageHandler. 2017-05-06 13:53:06 +02:00
Hans-Kristian Arntzen
f4d7268565 GLSL will also need shadow state analysis.
Refactor stuff out to top-level.

Fix some bugs with combined shadow samplers in regular GLSL.
2017-05-06 13:21:35 +02:00
Hans-Kristian Arntzen
100e9d34b8 HLSL: Basic support for separate image/samplers. 2017-05-06 12:39:04 +02:00
Hans-Kristian Arntzen
93fe19c0f7 Add support for querying binary offsets of decorations in SPIR-V.
Facilitates easy SPIR-V patching when needed.
2017-04-26 09:24:24 +02:00
Hans-Kristian Arntzen
543e380d90 Fix case where samplerBuffer is emitted without combined sampler. 2017-04-02 11:03:07 +02:00
Yuriy O'Donnell
ae8de51138 Added a Compiler ctor that takes IR as raw array and count
This avoids the need to construct a temporary std::vector on the application side just to create a Compiler instance if application itself doesn't use STL containers.
2017-04-01 14:35:42 +02:00
Hans-Kristian Arntzen
bf5c07532c Run format_all.sh. 2017-03-25 16:28:44 +01: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
fd432f8580 Ensure struct members have valid identifiers. 2017-03-23 09:47:43 +01:00
Hans-Kristian Arntzen
299e19fb61 Do not crash on unknown extensions. 2017-03-21 16:33:54 +01:00
Hans-Kristian Arntzen
61c31c6054 Make use of explicit locations in HLSL. 2017-03-21 13:48:50 +01:00
Hans-Kristian Arntzen
2ebe1a87a1 Run format_all.sh. 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
099f307123 Add traversal for active builtin variables.
Refactor some ugly type-copying for access chains.
2017-03-21 13:48:28 +01:00
Hans-Kristian Arntzen
75391f9a68 Handle vector variants of OpLogicalAnd/Or/Not. 2017-03-20 22:45:40 +01:00
Bill Hollings
dc69427402 Updates to MSL functionality to support PR review feedback. 2017-03-11 12:17:22 -05:00
Bill Hollings
484931d8b2 spirv_msl auto-alignment of members of MSL uniform structs.
spirv_msl optionally add padding and packing to allow MSL
struct members to align with SPIR-V struct alignments.
spirv_cross add convenience methods for testing Decorations.
spirv_glsl replace member_decl() function with new emit_stuct_member().
Allow struct member types to be marked as packed via DecorationCPacked decoration.
2017-02-28 21:44:36 -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
24df8f0019 Run format_all.sh. 2017-02-04 10:26:26 +01:00
Syoyo Fujita
29179f746a Fix build when SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS=On. 2017-02-03 13:54:35 +09:00
Bill Hollings
81757507be CompilerMSL support separate indexed MTLBuffers for stage_in containing matrices.
Add DecorationBinding to Compiler::get_member_decoration()/set_member_decoration().
2017-01-29 13:28:20 -05:00
Hans-Kristian Arntzen
18c37bcdab Update license headers for 2017. 2017-01-28 09:00:40 +01:00
Hans-Kristian Arntzen
1850457b28 Merge pull request #107 from Kode/hlsl
HLSL Support
2017-01-28 08:53:24 +01:00
Robert Konrad
4846e081a7 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross into metalcat
# Conflicts:
#	spirv_msl.cpp
2017-01-26 10:19:26 +01:00
Robert Konrad
429b8cb25f Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross into hlsl
# Conflicts:
#	spirv_glsl.hpp
2017-01-23 14:44:41 +01:00
Robert Konrad
451bdeeeff Fix HLSL binding numbers 2017-01-23 14:40:25 +01:00
Hans-Kristian Arntzen
8a80e62fb4 Make get_buffer_block_flags clearer.
Fix empty struct case.
2017-01-22 08:51:24 +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
d3cad99347 Cleanups for flattened access chains. 2017-01-21 11:30:33 +01:00
Hans-Kristian Arntzen
016b1d86e9 Emit readonly, writeonly for SSBOs. 2017-01-21 10:08:27 +01:00
Arseny Kapoulkine
f63e7c5c98 Fix get_declared_struct_member_size for struct members
When a member of a struct is a struct, get_declared_struct_member_size
instead returned the size of the entire outer struct because it added
the offset of the last field to the size of the last field.

Restructure the function so that it handles all arrays in the same way
(by using array stride) and for the rest reuses get_declared_struct_size
if possible - this simplifies the function and fixes the issue.
2017-01-17 01:52:12 -08:00
Polona Caserman
3e0f52d44c Remove redundant function 2017-01-16 17:35:13 +01:00
Robert Konrad
9802823deb Re-add accidentally removed break 2017-01-15 22:42:22 +01:00
Robert Konrad
881725fb36 Remove video code I accidentally put in 2017-01-15 16:48:01 +01:00
Robert Konrad
a778c363e1 Format code 2017-01-15 16:39:03 +01:00
Robert Konrad
fe5de5e03c Merge branch 'original' into metalcat 2017-01-15 16:33:14 +01:00
Polona Caserman
84c3092aba Merge with KhronosGroup/SPIRV-Cross 2017-01-15 16:21:15 +01:00
Polona Caserman
989563ad3f Add uniform structure 2017-01-15 16:05:11 +01:00
Polona Caserman
bafde4e917 Check if the location of the original variable is set 2017-01-15 16:05:11 +01:00
Hans-Kristian Arntzen
ce3fe29557 MSVC maintenance. 2017-01-12 10:57:44 +01:00
Endre Oma
6ad8b307a1 Use the classic locale when converting floats to string 2017-01-11 17:06:06 +01:00
Hans-Kristian Arntzen
c7659507e8 Merge pull request #90 from gwihlidal/master
Improve useability of get_decoration and friends.
2017-01-05 23:07:40 +01:00
Graham Wihlidal
9b1ee8f10a Improve fix for boolean decorations queried in get_decoration, added support to get_member_decoration, and updated comments to reflect the change in behavior. 2017-01-05 21:01:49 +01:00
Graham Wihlidal
acd98ac0d5 Fix typo in comment 2017-01-05 21:00:05 +01:00
Graham Wihlidal
862a71b4d3 Fix Compiler::get_decoration to correctly return > 0 if DecorationNonWritable or DecorationNonReadable are specified. 2017-01-05 20:19:59 +01:00
Graham Wihlidal
fadc1f9e10 Fix for "error C4146: unary minus operator applied to unsigned type, result still unsigned" 2017-01-05 20:14:53 +01:00
Hans-Kristian Arntzen
97f7ab865a Fix handling of NoWrite/NoRead decoration for images.
The old workaround for glslang is no longer needed, so only apply workaround
carefully.
2017-01-05 18:16:33 +01:00
Hans-Kristian Arntzen
9ccd1aea42 Merge pull request #85 from godlikepanos/master
Add the option to build without exceptions
2016-12-19 12:32:04 +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
a714d424d0 Add directed test for for-loop-init. 2016-12-16 12:43:12 +01:00
Panagiotis Christopoulos Charitos
946f7796c1 Add an option to disable exceptions
Some refactoring in the no-exceptions case

Grooming the no-exceptions patch for pull request
2016-12-15 17:49:01 +01:00
Hans-Kristian Arntzen
4f07a32c29 Begin implementing for loop initializer propagation. 2016-12-15 17:44:47 +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
7630d3cc9c MSVC maintenance.
Fix compilation and warnings.
2016-11-21 12:18:45 +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
0c9683cd85 Distinguish between cross edges and back edges.
Handle the weird opcodes CopyMemory/CopyObject.
2016-11-18 09:59:54 +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
dad4a34072 Start adding CFG analysis.
Not complete yet, but partly working ...
2016-11-17 16:58:05 +01:00
Hans-Kristian Arntzen
526d06d0a4 Add more descriptive error message. 2016-11-12 10:04:42 +01:00
Bill Hollings
ac00c6032f Run clang-format. 2016-10-24 09:24:24 -04:00
Bill Hollings
0943d9fece MoltenVK shader converter handle missing names.
Use entry point name if no function name provided.
When flattening in/out structs, qualify member names with struct name.
Fix issue when determining declared size of struct types.
Refactor use of m_ name prefix.
Identify header defines in MSL code.
2016-10-23 21:42:54 -04:00
Nathaniel Brown
9577568d56 Corrects some problems converting to compilable MSL from SPIRV. A better solution is to refactor the glsl compiler base-class so some keywords and actions can be overridden, and then the msl subclass can override them - this is a quick & dirty solution.
- adds some common macros that correct for intrinsic differences
 - adds some inline functions to adapt for GLSL terms
 - injects structure member names when the original SPV has been stripped - there is another way to use the correct temporarily assigned member name, but using m_<id> based on the inside SPV code yields metal code that more correctly maps to the original SPV opcodes/slots.
2016-10-21 13:48:21 -07:00
Bill Hollings
a759e2c872 Merge Brenwill fork with upstream. 2016-10-19 14:09:51 -07:00
Corentin Wallez
ef9ee49276 Fix compilation on some old C++11 standard libraries. 2016-10-05 16:13:51 -04: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
6bd545bc6b Basic support for specialization constant reflection. 2016-10-03 12:29:46 +02:00
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
Bill Hollings
cf476f36d1 Merge MSL with upstream. 2016-08-31 21:00:56 -04: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
Bill Hollings
0dfeabc6d2 Merge branch 'master' of https://github.com/KhronosGroup/SPIRV-Cross 2016-08-01 15:38:57 -04: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
Bill Hollings
7c255dde4d Merged with upstream 2016-07-24 22:40:20 -07: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
Bill Hollings
c45e74f1c0 MSL support global input vars as automatic function args.
Add Decoration qualified_alias element.
Virualize Compiler to_name() function.
MSL use qualified_alias instead of alias when inside entry-point function.
2016-07-08 12:39:22 -04: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