SPV: Scalar smear operation should use type of the scalar to make the
expected vector type when the provided vector type is incompatible with the scalar.
This commit is contained in:
@@ -1190,6 +1190,10 @@ Id Builder::smearScalar(Decoration /*precision*/, Id scalar, Id vectorType)
|
||||
if (numComponents == 1)
|
||||
return scalar;
|
||||
|
||||
// Make new vector type if the provided one is incompatible with type of the scalar
|
||||
if (getTypeId(scalar) != getScalarTypeId(vectorType))
|
||||
vectorType = makeVectorType(getTypeId(scalar), numComponents);
|
||||
|
||||
Instruction* smear = new Instruction(getUniqueId(), vectorType, OpCompositeConstruct);
|
||||
for (int c = 0; c < numComponents; ++c)
|
||||
smear->addIdOperand(scalar);
|
||||
|
||||
Reference in New Issue
Block a user