- Use much simpler method to update implicit array sizes.
The previous overly complicated method was error prone.
- Rationalize all use of unsized arrays.
- Combine decorations when generating SPIR-V, to simplify
adding extensions.
There a couple functional problems, which when reduced down also led to
some good simplifications and rationalization. So, this commit:
- corrects "mixed" functionality: int[A] f[B] -> f[B][A]
- correct multi-identifier decls: int[A] f[B], g[C] -> f and g are independently sized.
- increases symmetry between different places in the code that do this
- makes fewer ways to do the same thing; several methods are just gone now
- makes more clear when something is copied or shared
When assigning uniform locations it now takes into account the number
of locations occupied by the type. For uniforms, all types except
arrays and structs take up one location. For arrays the base location
count is multiplied by the array dimensions and for structs it is the
sum of the locations of each member.
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).
glslang/SPIRV/SpvBuilder.cpp:2533:27: error: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
for (int c = 0; c < accessChain.swizzle.size(); ++c)
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
glslang/hlsl/hlslParseHelper.cpp:69:5: error: field 'cullDistanceInput' will be initialized after field 'clipDistanceOutput' [-Werror,-Wreorder]
cullDistanceInput(nullptr),
^
1 error generated.
glslang/glslang/MachineIndependent/attribute.cpp:85:16: error: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
if (argNum >= args->getSequence().size())
~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
When a matrix is divided by a scalar it tries to take the reciprocal
of the scalar to convert the operation into a multiply. However it was
always doing this by making a 32-bit constant. If the scalar is a
double then this would end up making an FDiv instruction with
different types in the operands.
This patch adds a helper method called makeFpConstant which makes a
floating-point constant of the given type. The code to take the
reciprocal now uses it to make the same type as the result.
Fixes https://github.com/KhronosGroup/glslang/issues/1278
- Add missing constructor ops to support float16/int16/uint16 types
- Allow half float literals
- Correct two errors of double literal parse in HLSL: extension check and
postfix
On some systems sstream defines snprintf, this leads to the a redefinition of sprintf_s if snprintf is defined before checking if it exists in sstream.