// so short circuit the access-chain stuff with a swizzle.\r
std::vector<unsigned> swizzle;\r
swizzle.push_back(node->getRight()->getAsConstantUnion()->getConstArray()[0].getIConst());\r
- builder.accessChainPushSwizzle(swizzle, node->getLeft()->getVectorSize(), convertGlslangToSpvType(node->getType()));\r
+ builder.accessChainPushSwizzle(swizzle, node->getLeft()->getVectorSize());\r
} else {\r
// normal case for indexing array or structure or block\r
builder.accessChainPush(builder.makeIntConstant(index), convertGlslangToSpvType(node->getType()));\r
std::vector<unsigned> swizzle;\r
for (int i = 0; i < (int)swizzleSequence.size(); ++i)\r
swizzle.push_back(swizzleSequence[i]->getAsConstantUnion()->getConstArray()[0].getIConst());\r
- builder.accessChainPushSwizzle(swizzle, node->getLeft()->getVectorSize(), convertGlslangToSpvType(node->getType()));\r
+ builder.accessChainPushSwizzle(swizzle, node->getLeft()->getVectorSize());\r
}\r
return false;\r
default:\r
return insert->getResultId();\r
}\r
\r
+Id Builder::createVectorExtractDynamic(Id vector, Id typeId, Id componentIndex)\r
+{\r
+ Instruction* extract = new Instruction(getUniqueId(), typeId, OpVectorExtractDynamic);\r
+ extract->addIdOperand(vector);\r
+ extract->addIdOperand(componentIndex);\r
+ buildPoint->addInstruction(extract);\r
+\r
+ return extract->getResultId();\r
+}\r
+\r
+Id Builder::createVectorInsertDynamic(Id vector, Id typeId, Id component, Id componentIndex)\r
+{\r
+ Instruction* insert = new Instruction(getUniqueId(), typeId, OpVectorInsertDynamic);\r
+ insert->addIdOperand(vector);\r
+ insert->addIdOperand(component);\r
+ insert->addIdOperand(componentIndex);\r
+ buildPoint->addInstruction(insert);\r
+\r
+ return insert->getResultId();\r
+}\r
+\r
// An opcode that has no operands, no result id, and no type\r
void Builder::createNoResultOp(Op opCode)\r
{\r
return createCompositeExtract(source, typeId, channels.front());\r
\r
Instruction* swizzle = new Instruction(getUniqueId(), typeId, OpVectorShuffle);\r
+ assert(isVector(source));\r
swizzle->addIdOperand(source);\r
swizzle->addIdOperand(source);\r
for (int i = 0; i < (int)channels.size(); ++i)\r
return createCompositeInsert(source, target, typeId, channels.front());\r
\r
Instruction* swizzle = new Instruction(getUniqueId(), typeId, OpVectorShuffle);\r
+ assert(isVector(source));\r
+ assert(isVector(target));\r
swizzle->addIdOperand(target);\r
swizzle->addIdOperand(source);\r
\r
accessChain.instr = 0;\r
accessChain.swizzle.clear();\r
accessChain.component = 0;\r
- accessChain.swizzleTargetWidth = 0;\r
accessChain.resultType = NoType;\r
accessChain.isRValue = false;\r
}\r
\r
// Comments in header\r
-void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, int width, Id type)\r
+void Builder::accessChainPushSwizzle(std::vector<unsigned>& swizzle, int width)\r
{\r
// if needed, propagate the swizzle for the current access chain\r
if (accessChain.swizzle.size()) {\r
for (unsigned int i = 0; i < swizzle.size(); ++i) {\r
accessChain.swizzle.push_back(oldSwizzle[swizzle[i]]);\r
}\r
- } else {\r
+ } else\r
accessChain.swizzle = swizzle;\r
- }\r
-\r
- // track width the swizzle operates on; once known, it does not change\r
- if (accessChain.swizzleTargetWidth == 0)\r
- accessChain.swizzleTargetWidth = width;\r
-\r
- accessChain.resultType = type;\r
\r
// determine if we need to track this swizzle anymore\r
simplifyAccessChainSwizzle();\r
\r
Id base = collapseAccessChain();\r
\r
+ if (accessChain.swizzle.size() && accessChain.component)\r
+ MissingFunctionality("simultaneous l-value swizzle and dynamic component selection");\r
+\r
// If swizzle exists, it is out-of-order or not full, we must load the target vector,\r
// extract and insert elements to perform writeMask and/or swizzle.\r
- Id source;\r
-\r
+ Id source = NoResult;\r
if (accessChain.swizzle.size()) {\r
Id tempBaseId = createLoad(base);\r
source = createLvalueSwizzle(getTypeId(tempBaseId), tempBaseId, rvalue, accessChain.swizzle);\r
- } else if (accessChain.component) {\r
- Id tempBaseId = createLoad(base);\r
- Instruction* vectorInsert = new Instruction(getUniqueId(), getTypeId(tempBaseId), OpVectorInsertDynamic);\r
- vectorInsert->addIdOperand(tempBaseId);\r
- vectorInsert->addIdOperand(rvalue);\r
- vectorInsert->addIdOperand(accessChain.component);\r
- buildPoint->addInstruction(vectorInsert);\r
+ }\r
\r
- source = vectorInsert->getResultId();\r
- } else\r
+ // dynamic component selection\r
+ if (accessChain.component) {\r
+ Id tempBaseId = (source == NoResult) ? createLoad(base) : source;\r
+ source = createVectorInsertDynamic(tempBaseId, getTypeId(tempBaseId), rvalue, accessChain.component);\r
+ }\r
+\r
+ if (source == NoResult)\r
source = rvalue;\r
\r
createStore(source, base);\r
\r
if (accessChain.isRValue) {\r
if (accessChain.indexChain.size() > 0) {\r
+ mergeAccessChainSwizzle(); // TODO: optimization: look at applying this optimization more widely\r
// if all the accesses are constants, we can use OpCompositeExtract\r
std::vector<unsigned> indexes;\r
bool constant = true;\r
id = createLoad(collapseAccessChain());\r
}\r
\r
- if (accessChain.component) {\r
- Instruction* vectorExtract = new Instruction(getUniqueId(), getScalarTypeId(getTypeId(id)), OpVectorExtractDynamic);\r
- vectorExtract->addIdOperand(id);\r
- vectorExtract->addIdOperand(accessChain.component);\r
- buildPoint->addInstruction(vectorExtract);\r
- id = vectorExtract->getResultId();\r
- } else if (accessChain.swizzle.size())\r
- id = createRvalueSwizzle(accessChain.resultType, id, accessChain.swizzle);\r
+ // Done, unless there are swizzles to do\r
+ if (accessChain.swizzle.size() == 0 && accessChain.component == 0)\r
+ return id;\r
+\r
+ Id componentType = getScalarTypeId(accessChain.resultType);\r
+\r
+ // Do remaining swizzling\r
+ // First, static swizzling\r
+ if (accessChain.swizzle.size()) {\r
+ // static swizzle\r
+ Id resultType = componentType;\r
+ if (accessChain.swizzle.size() > 1)\r
+ resultType = makeVectorType(componentType, accessChain.swizzle.size());\r
+ id = createRvalueSwizzle(resultType, id, accessChain.swizzle);\r
+ }\r
+\r
+ // dynamic single-component selection\r
+ if (accessChain.component)\r
+ id = createVectorExtractDynamic(id, componentType, accessChain.component);\r
\r
return id;\r
}\r
// clear out swizzle if it is redundant\r
void Builder::simplifyAccessChainSwizzle()\r
{\r
- // if swizzle has fewer components than our target, it is a writemask\r
- if (accessChain.swizzleTargetWidth > (int)accessChain.swizzle.size())\r
+ // If the swizzle has fewer components than the vector, it is subsetting, and must stay\r
+ // to preserve that fact.\r
+ if (getNumTypeComponents(accessChain.resultType) > (int)accessChain.swizzle.size())\r
return;\r
\r
// if components are out of order, it is a swizzle\r
\r
// otherwise, there is no need to track this swizzle\r
accessChain.swizzle.clear();\r
- accessChain.swizzleTargetWidth = 0;\r
+}\r
+\r
+// clear out swizzle if it can become part of the indexes\r
+void Builder::mergeAccessChainSwizzle()\r
+{\r
+ // is there even a chance of doing something? Need a single-component swizzle\r
+ if (accessChain.swizzle.size() > 1 ||\r
+ accessChain.swizzle.size() == 0 && accessChain.component == 0)\r
+ return;\r
+\r
+ // TODO: optimization: remove this, but for now confine this to non-dynamic accesses\r
+ // (the above test is correct when this is removed.)\r
+ if (accessChain.component)\r
+ return;\r
+\r
+ // move the swizzle over to the indexes\r
+ if (accessChain.swizzle.size() == 1)\r
+ accessChain.indexChain.push_back(makeUintConstant(accessChain.swizzle.front()));\r
+ else\r
+ accessChain.indexChain.push_back(accessChain.component);\r
+ accessChain.resultType = getScalarTypeId(accessChain.resultType);\r
+\r
+ // now there is no need to track this swizzle\r
+ accessChain.component = NoResult;\r
+ accessChain.swizzle.clear();\r
}\r
\r
// Utility method for creating a new block and setting the insert point to\r
Id createCompositeInsert(Id object, Id composite, Id typeId, unsigned index);\r
Id createCompositeInsert(Id object, Id composite, Id typeId, std::vector<unsigned>& indexes);\r
\r
+ Id createVectorExtractDynamic(Id vector, Id typeId, Id componentIndex);\r
+ Id createVectorInsertDynamic(Id vector, Id typeId, Id component, Id componentIndex);\r
+\r
void createNoResultOp(Op);\r
void createNoResultOp(Op, Id operand);\r
void createControlBarrier(unsigned executionScope);\r
\r
// Take a copy of an lvalue (target) and a source of components, and set the\r
// source components into the lvalue where the 'channels' say to put them.\r
- // An update version of the target is returned.\r
+ // An updated version of the target is returned.\r
// (No true lvalue or stores are used.)\r
Id createLvalueSwizzle(Id typeId, Id target, Id source, std::vector<unsigned>& channels);\r
\r
std::vector<Id> indexChain;\r
Id instr; // the instruction that generates this access chain\r
std::vector<unsigned> swizzle;\r
- Id component; // a dynamic component index\r
- int swizzleTargetWidth;\r
- Id resultType; // dereferenced type, to be inclusive of swizzles, which can't have a pointer\r
+ Id component; // a dynamic component index, can coexist with a swizzle, done after the swizzle\r
+ Id resultType; // dereferenced type, to be exclusive of swizzles\r
bool isRValue;\r
};\r
\r
{\r
assert(isPointer(lValue));\r
accessChain.base = lValue;\r
+ accessChain.resultType = getContainedTypeId(getTypeId(lValue));\r
}\r
\r
// set new base value as an r-value\r
}\r
\r
// push new swizzle onto the end of any existing swizzle, merging into a single swizzle\r
- void accessChainPushSwizzle(std::vector<unsigned>& swizzle, int width, Id type);\r
+ void accessChainPushSwizzle(std::vector<unsigned>& swizzle, int width);\r
\r
// push a variable component selection onto the access chain; supporting only one, so unsided\r
void accessChainPushComponent(Id component) { accessChain.component = component; }\r
Id findCompositeConstant(Op typeClass, std::vector<Id>& comps) const;\r
Id collapseAccessChain();\r
void simplifyAccessChainSwizzle();\r
+ void mergeAccessChainSwizzle();\r
void createAndSetNoPredecessorBlock(const char*);\r
void createBranch(Block* block);\r
void createMerge(Op, Block*, unsigned int control);\r
292: 19(int) Constant 2\r
299: 19(int) Constant 1\r
301: TypePointer Function 7(float)\r
- 331: TypeVector 7(float) 3\r
+ 332: TypeVector 7(float) 3\r
347: 7(float) Constant 1073741824\r
354: 7(float) Constant 1065353216\r
359: 19(int) Constant 66\r
329: 7(float) Load 302(f) \r
330: 7(float) FAdd 329 328\r
Store 302(f) 330 \r
- 332: 8(fvec4) Load 10(v) \r
- 333: 331(fvec3) VectorShuffle 332 332 0 1 2\r
+ 331: 8(fvec4) Load 10(v) \r
+ 333: 332(fvec3) VectorShuffle 331 331 0 1 2\r
334: 8(fvec4) Load 10(v) \r
- 335: 331(fvec3) VectorShuffle 334 334 0 1 2\r
- 336: 331(fvec3) ExtInst 1(GLSL.std.450) 60(cross) 333 335\r
+ 335: 332(fvec3) VectorShuffle 334 334 0 1 2\r
+ 336: 332(fvec3) ExtInst 1(GLSL.std.450) 60(cross) 333 335\r
337: 7(float) CompositeExtract 336 0\r
338: 7(float) Load 302(f) \r
339: 7(float) FAdd 338 337\r
--- /dev/null
+spv.accessChain.frag\r
+Warning, version 420 is not yet complete; most version-specific features are present, but some are missing.\r
+\r
+\r
+\r
+Linked fragment stage:\r
+\r
+\r
+\r
+// Module Version 99\r
+// Generated by (magic number): 51a00bb\r
+// Id's are bound by 198\r
+\r
+ Source GLSL 420\r
+ 1: ExtInstImport "GLSL.std.450"\r
+ MemoryModel Logical GLSL450\r
+ EntryPoint Fragment 4\r
+ Name 4 "main"\r
+ Name 9 "S"\r
+ MemberName 9(S) 0 "color"\r
+ Name 12 "GetColor1(struct-S-vf31;"\r
+ Name 11 "i"\r
+ Name 19 "GetColor2(struct-S-vf31;i1;"\r
+ Name 17 "i"\r
+ Name 18 "comp"\r
+ Name 23 "GetColor3(struct-S-vf31;i1;"\r
+ Name 21 "i"\r
+ Name 22 "comp"\r
+ Name 27 "GetColor4(struct-S-vf31;i1;"\r
+ Name 25 "i"\r
+ Name 26 "comp"\r
+ Name 31 "GetColor5(struct-S-vf31;i1;"\r
+ Name 29 "i"\r
+ Name 30 "comp"\r
+ Name 35 "GetColor6(struct-S-vf31;i1;"\r
+ Name 33 "i"\r
+ Name 34 "comp"\r
+ Name 39 "GetColor7(struct-S-vf31;i1;"\r
+ Name 37 "i"\r
+ Name 38 "comp"\r
+ Name 43 "GetColor8(struct-S-vf31;i1;"\r
+ Name 41 "i"\r
+ Name 42 "comp"\r
+ Name 47 "GetColor9(struct-S-vf31;i1;"\r
+ Name 45 "i"\r
+ Name 46 "comp"\r
+ Name 51 "GetColor10(struct-S-vf31;i1;"\r
+ Name 49 "i"\r
+ Name 50 "comp"\r
+ Name 55 "GetColor11(struct-S-vf31;i1;"\r
+ Name 53 "i"\r
+ Name 54 "comp"\r
+ Name 59 "GetColor12(struct-S-vf31;i1;"\r
+ Name 57 "i"\r
+ Name 58 "comp"\r
+ Name 63 "GetColor13(struct-S-vf31;i1;"\r
+ Name 61 "i"\r
+ Name 62 "comp"\r
+ Name 66 "OutColor"\r
+ Name 145 "s"\r
+ Name 150 "u"\r
+ Name 151 "param"\r
+ Name 155 "param"\r
+ Name 159 "param"\r
+ Name 163 "param"\r
+ Name 167 "param"\r
+ Name 171 "param"\r
+ Name 175 "param"\r
+ Name 179 "param"\r
+ Name 183 "param"\r
+ Name 187 "param"\r
+ Name 191 "param"\r
+ Name 195 "param"\r
+ Decorate 66(OutColor) Location 0\r
+ 2: TypeVoid\r
+ 3: TypeFunction 2 \r
+ 7: TypeFloat 32\r
+ 8: TypeVector 7(float) 3\r
+ 9(S): TypeStruct 8(fvec3)\r
+ 10: TypeFunction 2 9(S)\r
+ 14: TypeInt 32 1\r
+ 15: TypePointer Function 14(int)\r
+ 16: TypeFunction 2 9(S) 15(ptr)\r
+ 65: TypePointer Output 8(fvec3)\r
+ 66(OutColor): 65(ptr) Variable Output \r
+ 67: 14(int) Constant 0\r
+ 68: TypeInt 32 0\r
+ 69: 68(int) Constant 0\r
+ 97: TypeVector 7(float) 2\r
+ 110: 68(int) Constant 2\r
+ 142: 7(float) Constant 0\r
+ 143: 8(fvec3) ConstantComposite 142 142 142\r
+ 144: TypePointer Function 9(S)\r
+ 149: TypePointer UniformConstant 14(int)\r
+ 150(u): 149(ptr) Variable UniformConstant \r
+ 4(main): 2 Function None 3\r
+ 5: Label\r
+ 145(s): 144(ptr) Variable Function \r
+ 151(param): 15(ptr) Variable Function \r
+ 155(param): 15(ptr) Variable Function \r
+ 159(param): 15(ptr) Variable Function \r
+ 163(param): 15(ptr) Variable Function \r
+ 167(param): 15(ptr) Variable Function \r
+ 171(param): 15(ptr) Variable Function \r
+ 175(param): 15(ptr) Variable Function \r
+ 179(param): 15(ptr) Variable Function \r
+ 183(param): 15(ptr) Variable Function \r
+ 187(param): 15(ptr) Variable Function \r
+ 191(param): 15(ptr) Variable Function \r
+ 195(param): 15(ptr) Variable Function \r
+ Store 66(OutColor) 143 \r
+ 146: 9(S) Load 145(s) \r
+ 147: 2 FunctionCall 12(GetColor1(struct-S-vf31;) 146\r
+ 148: 9(S) Load 145(s) \r
+ 152: 14(int) Load 150(u) \r
+ Store 151(param) 152 \r
+ 153: 2 FunctionCall 19(GetColor2(struct-S-vf31;i1;) 148 151(param)\r
+ 154: 9(S) Load 145(s) \r
+ 156: 14(int) Load 150(u) \r
+ Store 155(param) 156 \r
+ 157: 2 FunctionCall 23(GetColor3(struct-S-vf31;i1;) 154 155(param)\r
+ 158: 9(S) Load 145(s) \r
+ 160: 14(int) Load 150(u) \r
+ Store 159(param) 160 \r
+ 161: 2 FunctionCall 27(GetColor4(struct-S-vf31;i1;) 158 159(param)\r
+ 162: 9(S) Load 145(s) \r
+ 164: 14(int) Load 150(u) \r
+ Store 163(param) 164 \r
+ 165: 2 FunctionCall 31(GetColor5(struct-S-vf31;i1;) 162 163(param)\r
+ 166: 9(S) Load 145(s) \r
+ 168: 14(int) Load 150(u) \r
+ Store 167(param) 168 \r
+ 169: 2 FunctionCall 35(GetColor6(struct-S-vf31;i1;) 166 167(param)\r
+ 170: 9(S) Load 145(s) \r
+ 172: 14(int) Load 150(u) \r
+ Store 171(param) 172 \r
+ 173: 2 FunctionCall 39(GetColor7(struct-S-vf31;i1;) 170 171(param)\r
+ 174: 9(S) Load 145(s) \r
+ 176: 14(int) Load 150(u) \r
+ Store 175(param) 176 \r
+ 177: 2 FunctionCall 43(GetColor8(struct-S-vf31;i1;) 174 175(param)\r
+ 178: 9(S) Load 145(s) \r
+ 180: 14(int) Load 150(u) \r
+ Store 179(param) 180 \r
+ 181: 2 FunctionCall 47(GetColor9(struct-S-vf31;i1;) 178 179(param)\r
+ 182: 9(S) Load 145(s) \r
+ 184: 14(int) Load 150(u) \r
+ Store 183(param) 184 \r
+ 185: 2 FunctionCall 51(GetColor10(struct-S-vf31;i1;) 182 183(param)\r
+ 186: 9(S) Load 145(s) \r
+ 188: 14(int) Load 150(u) \r
+ Store 187(param) 188 \r
+ 189: 2 FunctionCall 55(GetColor11(struct-S-vf31;i1;) 186 187(param)\r
+ 190: 9(S) Load 145(s) \r
+ 192: 14(int) Load 150(u) \r
+ Store 191(param) 192 \r
+ 193: 2 FunctionCall 59(GetColor12(struct-S-vf31;i1;) 190 191(param)\r
+ 194: 9(S) Load 145(s) \r
+ 196: 14(int) Load 150(u) \r
+ Store 195(param) 196 \r
+ 197: 2 FunctionCall 63(GetColor13(struct-S-vf31;i1;) 194 195(param)\r
+ Branch 6\r
+ 6: Label\r
+ Return\r
+ FunctionEnd\r
+12(GetColor1(struct-S-vf31;): 2 Function None 10\r
+ 11(i): 9(S) FunctionParameter\r
+ 13: Label\r
+ 70: 7(float) CompositeExtract 11(i) 0 0\r
+ 71: 8(fvec3) Load 66(OutColor) \r
+ 72: 8(fvec3) CompositeConstruct 70 70 70\r
+ 73: 8(fvec3) FAdd 71 72\r
+ Store 66(OutColor) 73 \r
+ Return\r
+ FunctionEnd\r
+19(GetColor2(struct-S-vf31;i1;): 2 Function None 16\r
+ 17(i): 9(S) FunctionParameter\r
+ 18(comp): 15(ptr) FunctionParameter\r
+ 20: Label\r
+ 74: 14(int) Load 18(comp) \r
+ 75: 8(fvec3) CompositeExtract 17(i) 0\r
+ 76: 7(float) VectorExtractDynamic 75 74\r
+ 77: 8(fvec3) Load 66(OutColor) \r
+ 78: 8(fvec3) CompositeConstruct 76 76 76\r
+ 79: 8(fvec3) FAdd 77 78\r
+ Store 66(OutColor) 79 \r
+ Return\r
+ FunctionEnd\r
+23(GetColor3(struct-S-vf31;i1;): 2 Function None 16\r
+ 21(i): 9(S) FunctionParameter\r
+ 22(comp): 15(ptr) FunctionParameter\r
+ 24: Label\r
+ 80: 14(int) Load 22(comp) \r
+ 81: 8(fvec3) CompositeExtract 21(i) 0\r
+ 82: 7(float) VectorExtractDynamic 81 80\r
+ 83: 8(fvec3) Load 66(OutColor) \r
+ 84: 8(fvec3) CompositeConstruct 82 82 82\r
+ 85: 8(fvec3) FAdd 83 84\r
+ Store 66(OutColor) 85 \r
+ Return\r
+ FunctionEnd\r
+27(GetColor4(struct-S-vf31;i1;): 2 Function None 16\r
+ 25(i): 9(S) FunctionParameter\r
+ 26(comp): 15(ptr) FunctionParameter\r
+ 28: Label\r
+ 86: 14(int) Load 26(comp) \r
+ 87: 8(fvec3) CompositeExtract 25(i) 0\r
+ 88: 7(float) VectorExtractDynamic 87 86\r
+ 89: 8(fvec3) Load 66(OutColor) \r
+ 90: 8(fvec3) CompositeConstruct 88 88 88\r
+ 91: 8(fvec3) FAdd 89 90\r
+ Store 66(OutColor) 91 \r
+ Return\r
+ FunctionEnd\r
+31(GetColor5(struct-S-vf31;i1;): 2 Function None 16\r
+ 29(i): 9(S) FunctionParameter\r
+ 30(comp): 15(ptr) FunctionParameter\r
+ 32: Label\r
+ 92: 8(fvec3) CompositeExtract 29(i) 0\r
+ 93: 8(fvec3) Load 66(OutColor) \r
+ 94: 8(fvec3) FAdd 93 92\r
+ Store 66(OutColor) 94 \r
+ Return\r
+ FunctionEnd\r
+35(GetColor6(struct-S-vf31;i1;): 2 Function None 16\r
+ 33(i): 9(S) FunctionParameter\r
+ 34(comp): 15(ptr) FunctionParameter\r
+ 36: Label\r
+ 95: 14(int) Load 34(comp) \r
+ 96: 8(fvec3) CompositeExtract 33(i) 0\r
+ 98: 97(fvec2) VectorShuffle 96 96 1 0\r
+ 99: 7(float) VectorExtractDynamic 98 95\r
+ 100: 8(fvec3) Load 66(OutColor) \r
+ 101: 8(fvec3) CompositeConstruct 99 99 99\r
+ 102: 8(fvec3) FAdd 100 101\r
+ Store 66(OutColor) 102 \r
+ Return\r
+ FunctionEnd\r
+39(GetColor7(struct-S-vf31;i1;): 2 Function None 16\r
+ 37(i): 9(S) FunctionParameter\r
+ 38(comp): 15(ptr) FunctionParameter\r
+ 40: Label\r
+ 103: 8(fvec3) CompositeExtract 37(i) 0\r
+ 104: 97(fvec2) VectorShuffle 103 103 0 1\r
+ 105: 8(fvec3) Load 66(OutColor) \r
+ 106: 97(fvec2) VectorShuffle 105 105 0 1\r
+ 107: 97(fvec2) FAdd 106 104\r
+ 108: 8(fvec3) Load 66(OutColor) \r
+ 109: 8(fvec3) VectorShuffle 108 107 3 4 2\r
+ Store 66(OutColor) 109 \r
+ Return\r
+ FunctionEnd\r
+43(GetColor8(struct-S-vf31;i1;): 2 Function None 16\r
+ 41(i): 9(S) FunctionParameter\r
+ 42(comp): 15(ptr) FunctionParameter\r
+ 44: Label\r
+ 111: 7(float) CompositeExtract 41(i) 0 2\r
+ 112: 8(fvec3) Load 66(OutColor) \r
+ 113: 8(fvec3) CompositeConstruct 111 111 111\r
+ 114: 8(fvec3) FAdd 112 113\r
+ Store 66(OutColor) 114 \r
+ Return\r
+ FunctionEnd\r
+47(GetColor9(struct-S-vf31;i1;): 2 Function None 16\r
+ 45(i): 9(S) FunctionParameter\r
+ 46(comp): 15(ptr) FunctionParameter\r
+ 48: Label\r
+ 115: 8(fvec3) CompositeExtract 45(i) 0\r
+ 116: 8(fvec3) Load 66(OutColor) \r
+ 117: 8(fvec3) VectorShuffle 116 116 2 0 1\r
+ 118: 8(fvec3) FAdd 117 115\r
+ 119: 8(fvec3) Load 66(OutColor) \r
+ 120: 8(fvec3) VectorShuffle 119 118 4 5 3\r
+ Store 66(OutColor) 120 \r
+ Return\r
+ FunctionEnd\r
+51(GetColor10(struct-S-vf31;i1;): 2 Function None 16\r
+ 49(i): 9(S) FunctionParameter\r
+ 50(comp): 15(ptr) FunctionParameter\r
+ 52: Label\r
+ 121: 8(fvec3) CompositeExtract 49(i) 0\r
+ 122: 97(fvec2) VectorShuffle 121 121 0 1\r
+ 123: 8(fvec3) Load 66(OutColor) \r
+ 124: 97(fvec2) VectorShuffle 123 123 2 1\r
+ 125: 97(fvec2) FAdd 124 122\r
+ 126: 8(fvec3) Load 66(OutColor) \r
+ 127: 8(fvec3) VectorShuffle 126 125 0 4 3\r
+ Store 66(OutColor) 127 \r
+ Return\r
+ FunctionEnd\r
+55(GetColor11(struct-S-vf31;i1;): 2 Function None 16\r
+ 53(i): 9(S) FunctionParameter\r
+ 54(comp): 15(ptr) FunctionParameter\r
+ 56: Label\r
+ 128: 8(fvec3) CompositeExtract 53(i) 0\r
+ 129: 97(fvec2) VectorShuffle 128 128 0 1\r
+ 130: 8(fvec3) Load 66(OutColor) \r
+ 131: 97(fvec2) VectorShuffle 130 130 0 2\r
+ 132: 97(fvec2) FAdd 131 129\r
+ 133: 8(fvec3) Load 66(OutColor) \r
+ 134: 8(fvec3) VectorShuffle 133 132 3 1 4\r
+ Store 66(OutColor) 134 \r
+ Return\r
+ FunctionEnd\r
+59(GetColor12(struct-S-vf31;i1;): 2 Function None 16\r
+ 57(i): 9(S) FunctionParameter\r
+ 58(comp): 15(ptr) FunctionParameter\r
+ 60: Label\r
+ 135: 14(int) Load 58(comp) \r
+ 136: 7(float) CompositeExtract 57(i) 0 0\r
+ 137: 8(fvec3) Load 66(OutColor) \r
+ 138: 7(float) VectorExtractDynamic 137 135\r
+ 139: 7(float) FAdd 138 136\r
+ 140: 8(fvec3) Load 66(OutColor) \r
+ 141: 8(fvec3) VectorInsertDynamic 140 139 135\r
+ Store 66(OutColor) 141 \r
+ Return\r
+ FunctionEnd\r
+63(GetColor13(struct-S-vf31;i1;): 2 Function None 16\r
+ 61(i): 9(S) FunctionParameter\r
+ 62(comp): 15(ptr) FunctionParameter\r
+ 64: Label\r
+ Return\r
+ FunctionEnd\r
25: TypeVector 24(int) 3\r
26: TypePointer Input 25(ivec3)\r
27(gl_GlobalInvocationID): 26(ptr) Variable Input \r
- 28: TypeVector 24(int) 2\r
+ 29: TypeVector 24(int) 2\r
32: TypePointer Function 8(float)\r
34(gl_LocalInvocationID): 26(ptr) Variable Input \r
38: 12(int) Constant 8\r
Store 16 14 \r
20: 19(ptr) AccessChain 11(bufInst) 17\r
Store 20 18 \r
- 29: 25(ivec3) Load 27(gl_GlobalInvocationID) \r
- 30: 28(ivec2) VectorShuffle 29 29 0 1\r
+ 28: 25(ivec3) Load 27(gl_GlobalInvocationID) \r
+ 30: 29(ivec2) VectorShuffle 28 28 0 1\r
31: 21(ivec2) Bitcast 30\r
Store 23(storePos) 31 \r
35: 25(ivec3) Load 34(gl_LocalInvocationID) \r
- 36: 28(ivec2) VectorShuffle 35 35 0 1\r
+ 36: 29(ivec2) VectorShuffle 35 35 0 1\r
37: 21(ivec2) Bitcast 36\r
39: 21(ivec2) CompositeConstruct 38 38\r
40: 21(ivec2) ISub 37 39\r
50: TypePointer UniformConstant 49(ivec4)\r
51(v4): 50(ptr) Variable UniformConstant \r
71: 48(int) Constant 4\r
- 85: TypeVector 7(float) 3\r
+ 86: TypeVector 7(float) 3\r
97: TypePointer Input 7(float)\r
98(f): 97(ptr) Variable Input \r
115: 14(int) Constant 16\r
82: 8(fvec4) Load 36(gl_FragColor) \r
83: 8(fvec4) FAdd 82 81\r
Store 36(gl_FragColor) 83 \r
- 86: 8(fvec4) Load 12(BaseColor) \r
- 87: 85(fvec3) VectorShuffle 86 86 0 1 2\r
+ 85: 8(fvec4) Load 12(BaseColor) \r
+ 87: 86(fvec3) VectorShuffle 85 85 0 1 2\r
88: 8(fvec4) Load 84(r) \r
89: 8(fvec4) VectorShuffle 88 87 4 5 6 3\r
Store 84(r) 89 \r
Branch 91\r
92: Label\r
104: 8(fvec4) Load 84(r) \r
- 105: 85(fvec3) VectorShuffle 104 104 0 1 2\r
+ 105: 86(fvec3) VectorShuffle 104 104 0 1 2\r
106: 8(fvec4) Load 36(gl_FragColor) \r
- 107: 85(fvec3) VectorShuffle 106 106 0 1 2\r
- 108: 85(fvec3) FAdd 107 105\r
+ 107: 86(fvec3) VectorShuffle 106 106 0 1 2\r
+ 108: 86(fvec3) FAdd 107 105\r
109: 8(fvec4) Load 36(gl_FragColor) \r
110: 8(fvec4) VectorShuffle 109 108 4 5 6 3\r
Store 36(gl_FragColor) 110 \r
--- /dev/null
+#version 420\r
+\r
+struct S \r
+{\r
+ vec3 color;\r
+};\r
+\r
+layout(location = 0) out vec3 OutColor;\r
+\r
+uniform int u;\r
+\r
+void GetColor1(const S i) \r
+{ \r
+ OutColor += i.color.x;\r
+}\r
+\r
+void GetColor2(const S i, int comp)\r
+{ \r
+ OutColor += i.color[comp];\r
+}\r
+\r
+void GetColor3(const S i, int comp)\r
+{ \r
+ OutColor += i.color[comp].x;\r
+}\r
+\r
+void GetColor4(const S i, int comp)\r
+{ \r
+ OutColor += i.color[comp].x;\r
+}\r
+\r
+void GetColor5(const S i, int comp)\r
+{ \r
+ OutColor += i.color;\r
+}\r
+\r
+void GetColor6(const S i, int comp)\r
+{ \r
+ OutColor += i.color.yx[comp];\r
+}\r
+\r
+void GetColor7(const S i, int comp)\r
+{ \r
+ OutColor.xy += i.color.yxz.yx;\r
+}\r
+\r
+void GetColor8(const S i, int comp)\r
+{ \r
+ OutColor += i.color.yzx.yx.x.x;\r
+}\r
+\r
+void GetColor9(const S i, int comp)\r
+{ \r
+ OutColor.zxy += i.color;\r
+}\r
+\r
+void GetColor10(const S i, int comp)\r
+{ \r
+ OutColor.zy += i.color.xy;\r
+}\r
+\r
+void GetColor11(const S i, int comp)\r
+{ \r
+ OutColor.zxy.yx += i.color.xy;\r
+}\r
+\r
+void GetColor12(const S i, int comp)\r
+{ \r
+ OutColor[comp] += i.color.x;\r
+}\r
+\r
+void GetColor13(const S i, int comp)\r
+{ \r
+ // OutColor.zy[comp] += i.color.x; // not yet supported\r
+}\r
+\r
+void main()\r
+{\r
+ S s;\r
+ OutColor = vec3(0.0);\r
+ GetColor1(s);\r
+ GetColor2(s, u);\r
+ GetColor3(s, u);\r
+ GetColor4(s, u);\r
+ GetColor5(s, u);\r
+ GetColor6(s, u);\r
+ GetColor7(s, u);\r
+ GetColor8(s, u);\r
+ GetColor9(s, u);\r
+ GetColor10(s, u);\r
+ GetColor11(s, u);\r
+ GetColor12(s, u);\r
+ GetColor13(s, u);\r
+}\r
spv.400.tese
spv.420.geom
spv.430.vert
+spv.accessChain.frag
spv.aggOps.frag
spv.always-discard.frag
spv.always-discard2.frag