Use the correct type for the constant for matrix/scalar division
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
This commit is contained in:
@@ -226,6 +226,7 @@ public:
|
||||
Id makeFloatConstant(float f, bool specConstant = false);
|
||||
Id makeDoubleConstant(double d, bool specConstant = false);
|
||||
Id makeFloat16Constant(float f16, bool specConstant = false);
|
||||
Id makeFpConstant(Id type, double d, bool specConstant = false);
|
||||
|
||||
// Turn the array of constants into a proper spv constant of the requested type.
|
||||
Id makeCompositeConstant(Id type, const std::vector<Id>& comps, bool specConst = false);
|
||||
|
||||
Reference in New Issue
Block a user