glslang/include/intermediate.h -> Add a new interface to set TIntermBranch's expression.
glslang/include/Types.h -> Add interface to set Type's basicType and add interface to get basicType form a TSampler.
glslang/MachineIndependent/intermediate.cpp -> Part of the code in createConversion been encapsulating as a new function called buildConvertOp
glslang/MachineIndependent/localintermediate.h -> Export createConversion and
buildConvertOp as a public function
glslang/Public/ShaderLang.h -> Add interface to get shader object and shader source.
Saved about 21K, size down to 380K of MSVC x86 code.
Fixed one bug that needs to be looked at on the master branch:
The test for needing a Vulkan binding has a bug in it, "!layoutAttachment"
which does not mean "no layoutAttachment", because that is non-zero.
This is why some test and test results changed.
Focus was on the front end (not SPIR-V), minus the grammar.
Reduces #ifdef count by around 320 and makes the web build 270K smaller,
which is about 90% the target size.
The grammar and scanner will be another step, as will the SPIR-V backend.
This makes heavy use of methods #ifdef'd to return false as a global way
of turning off code, relying on C++ DCE to do the rest.
Save about 100K.
N.B.: This is done by eliminating a function call, at a high level,
not by #ifdef'ing a bunch of code.
Also, removed no longer needed *_EXTENSION #ifdef in the code not
needed by GLSLANG_WEB.
This was added some time ago, but I suspect largely unused.
Christoph pointed out of few contradictions to actual convention,
so that's fixed. But, I suspect it is largely incomplete.
This is an alternate fix for the issue described in commit be63facd, whose
solution didn't work if there were non-trivial operations involved in computing
a constant initializer which caused the 'constant unfolding' code to kick in
(addConstantReferenceConversion). Instead, this change does the 'unfolding'
later in createSpvConstantFromConstUnionArray. If a reference-type constant has
survived that long, then folding is already done, this must be a 'real' (inside
a function) use of the constant, and it should be safe to unfold and apply the
bitcast.
Allow constructors to and from references to be constant folded. Section 4.3.3
says constructors whose arguments are all constant expressions must fold.
Disallow 'const' on buffer reference types. It is not a 'non-void transparent
basic data type' (it is not considered 'basic').
Handle buffer reference constants (which can be assigned to a non-const reference,
or can be further folded to another type of constant) by converting to
'constructor(uint64_t constant)' in addConversion.
Disallow == and != operators on reference types.
This change adds unary conversion folding when the source is a constant.
This fixes an ISV issue whereby:
```
const float16_t f = float16_t(42.0);
```
Wouldn't compile because the conversion operator would always produce an
EvqTemporary when it could have produced an EvqConst.
I've also added a test case that proves out that all basic-type to
basic-type conversions work.
These introduce limited support for 8/16-bit types such that they can only be accessed in buffer memory and converted to/from 32-bit types.
Contributed from Khronos-internal work.
The transform removes sampler arguments from functions and function
calls; this causes function arguments to change their indices. When some
function arguments have an output qualifier, this qualifier can get lost
because of the removal which can lead to incorrect results (e.g. out
qualifier not having effect).
To fix this we iterate through both seq & qual arrays in lock-step and
manually remove/replace entries as appropriate.
Added the needed 2 sets to TIntermediate, added accessor-functions, inserter functions. Implemented recording of such named defines inside the preprocessor parser.
Historically, addConversion() was split to handle binary node <-> node conversions
from non-binary node -> type conversions. However, the split wasn't entirely clean
WRT HLSL design and left duplication of case statements, which are misleading, and
this commit cleans up.
Reinforces that conversion rules are operation-specific.
Side effect is that HLSL logical-operator conversions are more direct
(e.g. float -> bool, rather than float -> int -> bool).