HLSL: allow promotion from 1-vector types to scalars, e.g, float<-float1
Previously, an error was thrown when assigning a float1 to a scalar float, or similar for other basic types. This allows that. Also, this allows calling functions accepting scalars with float1 params, so for example sin(float1) will work. This is a minor change in HlslParseContext::findFunction().
This commit is contained in:
@@ -4308,8 +4308,8 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, const TFu
|
||||
return false;
|
||||
|
||||
// shapes have to be convertible
|
||||
if ((from.isScalar() && to.isScalar()) ||
|
||||
(from.isScalar() && to.isVector()) ||
|
||||
if ((from.isScalarOrVec1() && to.isScalarOrVec1()) ||
|
||||
(from.isScalarOrVec1() && to.isVector()) ||
|
||||
(from.isVector() && to.isVector() && from.getVectorSize() >= to.getVectorSize()))
|
||||
return true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user