Commit Graph

107 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
938c7debed Handle control-dependent temporaries.
Derivatives, subgroup and implicit-lod instructions all need to happen
in the block they were created.
2018-03-12 17:34:54 +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
8d557d4103 Handle cases where merge selects as also loop merge or continue blocks. 2018-03-08 14:01:10 +01:00
Hans-Kristian Arntzen
294259e2f1 Fix type aliasing on MSL.
Be careful about who gets to be the alias master, and don't alias types
when we have packed types in play.
2018-03-05 16:27:04 +01:00
Hans-Kristian Arntzen
467c95679e
Merge pull request #480 from KhronosGroup/fix-476
Take execution model into account for entry point methods.
2018-03-01 14:42:16 +01:00
Hans-Kristian Arntzen
1e4db56a65 Run format_all.sh. 2018-03-01 14:03:59 +01:00
Hans-Kristian Arntzen
eecbeaa33d Take execution model into account for entry point methods.
SPIR-V allows names to alias if they implement different stages.
Deprecate the old interface and replace it with a new one which takes
execution modes into account.
2018-03-01 14:00:55 +01:00
Hans-Kristian Arntzen
3c1b147272 Support Invariant for BuiltInPosition. 2018-03-01 12:31:39 +01:00
Hans-Kristian Arntzen
fb3f92a3ff Overhaul clip/cull distance support in GLSL. 2018-02-22 14:36:50 +01:00
Hans-Kristian Arntzen
1a2e4de7a5 Add test for texelFetch without sampler. 2018-02-21 13:45:59 +01:00
Hans-Kristian Arntzen
4db7061dd1 Begin implementing texelFetch(texture2D) workaround on GLSL. 2018-02-21 13:08:30 +01:00
Hans-Kristian Arntzen
18a594a76b Implement subpass input support in HLSL. 2018-02-10 10:54:42 +01:00
Bill Hollings
1c94715350 Update copyright dates to 2018 in main files. 2018-01-31 17:08:43 -05:00
Hans-Kristian Arntzen
7d223b8987 Fix CFG for forwarded temporaries.
Forwarded temporaries would never declare a temporary.
Figure out all result types ahead of time so we can deal with those
temporaries as well.
2018-01-18 12:11:33 +01:00
Hans-Kristian Arntzen
d4e470babd Analyze the CFG for temporaries as well.
Normally, temporary declaration must dominate any use of it,
so we generally did not need to analyze the CFG for these variables,
but there is an edge case where you have an inliner doing:

do {
	create_temporary;
	break;
} while(0);

use_temporary;

The inside of the loop dominates the outer scope, but we cannot emit
code like this in GLSL, so make sure we hoist these temporaries outside
the "loop".
2018-01-12 10:56:11 +01:00
Hans-Kristian Arntzen
b737d2bc07 Lift variable accesses in continue blocks out to loop header. 2017-12-05 17:40:23 +01:00
Hans-Kristian Arntzen
2c90ea3acc Improve handling of block name declaration in GLSL.
HLSL UAVs are a bit annoying because they can share block types,
so reflection becomes rather awkward. Sometimes we will need to make
some nasty fallbacks, so add a reflection interface which lets you query
post-shader compile which names was actually declared in the shader.
2017-12-01 14:30:10 +01:00
Hans-Kristian Arntzen
0fd028147f Hoist all phi-local variables to entry block.
We don't have a mechanism to move temporaries to their appropriate
scope, and Phi behavior is weird enough that it will be a heroic effort
to not do this rather ugly codegen :(
2017-11-23 09:50:11 +01:00
Hans-Kristian Arntzen
4427cb993d Add support for renaming entry points. 2017-11-13 13:50:37 +01:00
Bill Hollings
1014847f17 Fixes from review #3 of PR 321. 2017-11-10 16:40:33 -05:00
Bill Hollings
696bf0db0f Fixes from review #2 of PR 321. 2017-11-08 13:54:28 -05:00
Bill Hollings
bac657d873 Fixes from review of PR 321. 2017-11-07 15:38:13 -05: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
f0200bb18d Use packoffset in HLSL.
Rewrite how cbuffers are emitted.
2017-10-10 13:15:49 +02:00
Hans-Kristian Arntzen
5a89606f26 Add support for GL_ARB_enhanced_layouts. 2017-10-10 11:05:46 +02:00
Hans-Kristian Arntzen
6a7b95d2d6 Validate that std140 packing can actually be used. 2017-10-10 10:12:27 +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
8d7a909c92 Add support for querying SPIR-V Capabilities and Extensions. 2017-08-15 15:27:53 +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
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
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
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
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
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
c609eab443 Fix includes. 2017-03-25 16:43:26 +01: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
cd9c90202e Make buffer decoration interface public. 2017-03-23 12:36:53 +01:00