glslang-zig/glslang/MachineIndependent
steve-lunarg ef33ec0925 HLSL: add intrinsic function implicit promotions
This PR handles implicit promotions for intrinsics when there is no exact match,
such as for example clamp(int, bool, float).  In this case the int and bool will
be promoted to a float, and the clamp(float, float, float) form used.

These promotions can be mixed with shape conversions, e.g, clamp(int, bool2, float2).

Output conversions are handled either via the existing addOutputArgumentConversion
function, which this PR generalizes to handle either aggregates or unaries, or by
intrinsic decomposition.  If there are methods or intrinsics to be decomposed,
then decomposition is responsible for any output conversions, which turns out to
happen automatically in all current cases.  This can be revisited once inout
conversions are in place.

Some cases of actual ambiguity were fixed in several tests, e.g, spv.register.autoassign.*

Some intrinsics with only uint versions were expanded to signed ints natively, where the
underlying AST and SPIR-V supports that.  E.g, countbits.  This avoids extraneous
conversion nodes.

A new function promoteAggregate is added, and used by findFunction.  This is essentially
a generalization of the "promote 1st or 2nd arg" algorithm in promoteBinary.

The actual selection proceeds in three steps, as described in the comments in
hlslParseContext::findFunction:

1. Attempt an exact match.  If found, use it.
2. If not, obtain the operator from step 1, and promote arguments.
3. Re-select the intrinsic overload from the results of step 2.
2016-11-23 10:36:34 -07:00
..
preprocessor Address some compiler warnings. 2016-10-08 22:07:20 -03:00
Constant.cpp Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
gl_types.h Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
glslang.y Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
glslang_tab.cpp Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
glslang_tab.cpp.h Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
InfoSink.cpp HLSL: Change the final syntax-error printf to go to the infoLog. 2016-09-19 14:56:55 -06:00
Initialize.cpp Parser: Some function prototypes of interpolateAtXXX are incorrect. 2016-10-10 16:55:04 +08:00
Initialize.h SPV: Non-functional: Condense SPV-related versioning, and rationalize all uses. 2016-06-16 23:31:29 -06:00
Intermediate.cpp HLSL: add intrinsic function implicit promotions 2016-11-23 10:36:34 -07:00
intermOut.cpp HLSL: Enable component-wise vector comparisons from operators 2016-10-26 08:50:10 -06:00
IntermTraverse.cpp Comments only. 2016-05-06 13:06:11 -06:00
iomapper.cpp Add UAV (image) binding offset and HLSL register support 2016-11-01 14:44:54 -06:00
iomapper.h New uniform mapping handling 2016-10-28 15:43:14 +02:00
limits.cpp Array of Array prep: Turn a batch of 0's into nullptr or UnsizedArraySize. 2015-08-09 18:15:25 -06:00
linkValidate.cpp HLSL: add intrinsic function implicit promotions 2016-11-23 10:36:34 -07:00
LiveTraverser.h Fix defects in uniform array flattening 2016-09-22 15:58:06 -06:00
localintermediate.h HLSL: add intrinsic function implicit promotions 2016-11-23 10:36:34 -07:00
parseConst.cpp glslang: Fix over 100 warnings from MSVC warning level 4. 2015-05-15 17:30:55 +00:00
ParseContextBase.cpp Whole stack: Fix stale types in the AST linker object nodes, fixing #557. 2016-11-05 10:22:33 -06:00
ParseHelper.cpp Whole stack: Fix stale types in the AST linker object nodes, fixing #557. 2016-11-05 10:22:33 -06:00
ParseHelper.h Whole stack: Fix stale types in the AST linker object nodes, fixing #557. 2016-11-05 10:22:33 -06:00
parseVersions.h Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
PoolAlloc.cpp Whitespace: Nonfunctional: fix inconsistent white space, esp. no tabs. 2016-08-05 17:34:34 -06:00
propagateNoContraction.cpp Address some compiler warnings. 2016-10-08 22:07:20 -03:00
propagateNoContraction.h Non-functional: Fix some comments English and brace formatting in recent merges. 2016-05-17 10:24:00 -06:00
reflection.cpp add reflection queries to return a TType. Fix minor issue with interface names. 2016-10-02 16:57:58 -06:00
reflection.h add reflection queries to return a TType. Fix minor issue with interface names. 2016-10-02 16:57:58 -06:00
RemoveTree.cpp Improvement to the AST traversal infrastructure. 2014-01-11 19:29:55 +00:00
RemoveTree.h Put all glslang internals (but not the external interface) into the glslang namespace. 2013-08-29 00:39:25 +00:00
Scan.cpp Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
Scan.h Front-ends: Remove now defunct afterEOF and related, use scanner's instead. 2016-08-31 13:46:50 -06:00
ScanContext.h Refactor TParseContext into 3 level inheritance. 2016-03-12 19:08:55 -07:00
ShaderLang.cpp Merge pull request #601 from BearishSun/master 2016-11-23 00:38:32 -07:00
SymbolTable.cpp Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
SymbolTable.h Add amend ability for anonymous blocks, so they can grow between function bodies. 2016-09-29 23:59:26 -06:00
Versions.cpp Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00
Versions.h Parser: Implement extension GL_AMD_gpu_shader_half_float. 2016-09-30 16:13:06 +08:00