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);
--- /dev/null
+spv.shiftOps.frag\r
+Warning, version 450 is not yet complete; most version-specific features are present, but some are missing.\r
+\r
+\r
+Linked fragment stage:\r
+\r
+\r
+// Module Version 10000\r
+// Generated by (magic number): 80001\r
+// Id's are bound by 38\r
+\r
+ Capability Shader\r
+ 1: ExtInstImport "GLSL.std.450"\r
+ MemoryModel Logical GLSL450\r
+ EntryPoint Fragment 4 "main" 9 25\r
+ ExecutionMode 4 OriginLowerLeft\r
+ Source GLSL 450\r
+ Name 4 "main"\r
+ Name 9 "icolor"\r
+ Name 11 "i3"\r
+ Name 15 "u1"\r
+ Name 25 "ucolor"\r
+ Name 27 "u3"\r
+ Name 30 "i1"\r
+ 2: TypeVoid\r
+ 3: TypeFunction 2\r
+ 6: TypeInt 32 1\r
+ 7: TypeVector 6(int) 3\r
+ 8: TypePointer Output 7(ivec3)\r
+ 9(icolor): 8(ptr) Variable Output\r
+ 10: TypePointer UniformConstant 7(ivec3)\r
+ 11(i3): 10(ptr) Variable UniformConstant\r
+ 13: TypeInt 32 0\r
+ 14: TypePointer UniformConstant 13(int)\r
+ 15(u1): 14(ptr) Variable UniformConstant\r
+ 17: TypeVector 13(int) 3\r
+ 20: 13(int) Constant 4\r
+ 24: TypePointer Output 17(ivec3)\r
+ 25(ucolor): 24(ptr) Variable Output\r
+ 26: TypePointer UniformConstant 17(ivec3)\r
+ 27(u3): 26(ptr) Variable UniformConstant\r
+ 29: TypePointer UniformConstant 6(int)\r
+ 30(i1): 29(ptr) Variable UniformConstant\r
+ 34: 6(int) Constant 5\r
+ 4(main): 2 Function None 3\r
+ 5: Label\r
+ 12: 7(ivec3) Load 11(i3)\r
+ 16: 13(int) Load 15(u1)\r
+ 18: 17(ivec3) CompositeConstruct 16 16 16\r
+ 19: 7(ivec3) ShiftLeftLogical 12 18\r
+ Store 9(icolor) 19\r
+ 21: 7(ivec3) Load 9(icolor)\r
+ 22: 17(ivec3) CompositeConstruct 20 20 20\r
+ 23: 7(ivec3) ShiftLeftLogical 21 22\r
+ Store 9(icolor) 23\r
+ 28: 17(ivec3) Load 27(u3)\r
+ 31: 6(int) Load 30(i1)\r
+ 32: 7(ivec3) CompositeConstruct 31 31 31\r
+ 33: 17(ivec3) ShiftRightLogical 28 32\r
+ Store 25(ucolor) 33\r
+ 35: 17(ivec3) Load 25(ucolor)\r
+ 36: 7(ivec3) CompositeConstruct 34 34 34\r
+ 37: 17(ivec3) ShiftRightLogical 35 36\r
+ Store 25(ucolor) 37\r
+ Return\r
+ FunctionEnd\r