• Home
  • Raw
  • Download

Lines Matching refs:SpvId

830 void SPIRVCodeGenerator::writeLabel(SpvId label, OutputStream& out) {  in writeLabel()
964 this->writeInstruction(SpvOpCapability, (SpvId) i, out); in writeCapabilities()
969 SpvId SPIRVCodeGenerator::nextId() { in nextId()
974 SpvId resultId) { in writeStruct()
978 std::vector<SpvId> types; in writeStruct()
984 for (SpvId id : types) { in writeStruct()
1014 this->writeInstruction(SpvOpMemberDecorate, resultId, (SpvId) i, SpvDecorationOffset, in writeStruct()
1015 (SpvId) offset, fDecorationBuffer); in writeStruct()
1021 (SpvId) memoryLayout.stride(*type.fields()[i].fType), in writeStruct()
1032 SpvId SPIRVCodeGenerator::getType(const Type& type) { in getType()
1036 SpvId SPIRVCodeGenerator::getType(const Type& type, const MemoryLayout& layout) { in getType()
1040 SpvId result = this->nextId(); in getType()
1090 SpvId image = result; in getType()
1121 SpvId SPIRVCodeGenerator::getImageType(const Type& type) { in getImageType()
1129 SpvId SPIRVCodeGenerator::getFunctionType(const FunctionDeclaration& function) { in getFunctionType()
1140 SpvId result = this->nextId(); in getFunctionType()
1142 SpvId returnType = this->getType(function.fReturnType); in getFunctionType()
1143 std::vector<SpvId> parameterTypes; in getFunctionType()
1177 for (SpvId id : parameterTypes) { in getFunctionType()
1186 SpvId SPIRVCodeGenerator::getPointerType(const Type& type, SpvStorageClass_ storageClass) { in getPointerType()
1190 SpvId SPIRVCodeGenerator::getPointerType(const Type& type, const MemoryLayout& layout, in getPointerType()
1195 SpvId result = this->nextId(); in getPointerType()
1204 SpvId SPIRVCodeGenerator::writeExpression(const Expression& expr, OutputStream& out) { in writeExpression()
1238 SpvId SPIRVCodeGenerator::writeIntrinsicCall(const FunctionCall& c, OutputStream& out) { in writeIntrinsicCall()
1257 SpvId result = this->nextId(); in writeIntrinsicCall()
1258 std::vector<SpvId> arguments; in writeIntrinsicCall()
1267 for (SpvId id : arguments) { in writeIntrinsicCall()
1273 SpvId result = this->nextId(); in writeIntrinsicCall()
1274 std::vector<SpvId> arguments; in writeIntrinsicCall()
1281 for (SpvId id : arguments) { in writeIntrinsicCall()
1293 SpvId SPIRVCodeGenerator::writeSpecialIntrinsic(const FunctionCall& c, SpecialIntrinsic kind, in writeSpecialIntrinsic()
1295 SpvId result = this->nextId(); in writeSpecialIntrinsic()
1298 std::vector<SpvId> arguments; in writeSpecialIntrinsic()
1307 for (SpvId id : arguments) { in writeSpecialIntrinsic()
1313 SpvId img = this->writeExpression(*c.fArguments[0], out); in writeSpecialIntrinsic()
1318 SpvId coords = this->writeConstantVector(ctor); in writeSpecialIntrinsic()
1328 SpvId sample = this->writeExpression(*c.fArguments[1], out); in writeSpecialIntrinsic()
1342 SpvId image = this->nextId(); in writeSpecialIntrinsic()
1386 SpvId type = this->getType(c.fType); in writeSpecialIntrinsic()
1387 SpvId sampler = this->writeExpression(*c.fArguments[0], out); in writeSpecialIntrinsic()
1388 SpvId uv = this->writeExpression(*c.fArguments[1], out); in writeSpecialIntrinsic()
1405 SpvId SPIRVCodeGenerator::writeFunctionCall(const FunctionCall& c, OutputStream& out) { in writeFunctionCall()
1411 std::vector<std::tuple<SpvId, SpvId, std::unique_ptr<LValue>>> lvalues; in writeFunctionCall()
1412 std::vector<SpvId> arguments; in writeFunctionCall()
1416 SpvId tmpVar; in writeFunctionCall()
1418 SpvId tmpValueId; in writeFunctionCall()
1421 SpvId ptr = lv->getPointer(); in writeFunctionCall()
1448 SpvId result = this->nextId(); in writeFunctionCall()
1453 for (SpvId id : arguments) { in writeFunctionCall()
1459 SpvId load = this->nextId(); in writeFunctionCall()
1466 SpvId SPIRVCodeGenerator::writeConstantVector(const Constructor& c) { in writeConstantVector()
1468 SpvId result = this->nextId(); in writeConstantVector()
1469 std::vector<SpvId> arguments; in writeConstantVector()
1473 SpvId type = this->getType(c.fType); in writeConstantVector()
1487 for (SpvId id : arguments) { in writeConstantVector()
1494 SpvId SPIRVCodeGenerator::writeFloatConstructor(const Constructor& c, OutputStream& out) { in writeFloatConstructor()
1498 SpvId result = this->nextId(); in writeFloatConstructor()
1499 SpvId parameter = this->writeExpression(*c.fArguments[0], out); in writeFloatConstructor()
1512 SpvId SPIRVCodeGenerator::writeIntConstructor(const Constructor& c, OutputStream& out) { in writeIntConstructor()
1516 SpvId result = this->nextId(); in writeIntConstructor()
1517 SpvId parameter = this->writeExpression(*c.fArguments[0], out); in writeIntConstructor()
1530 SpvId SPIRVCodeGenerator::writeUIntConstructor(const Constructor& c, OutputStream& out) { in writeUIntConstructor()
1534 SpvId result = this->nextId(); in writeUIntConstructor()
1535 SpvId parameter = this->writeExpression(*c.fArguments[0], out); in writeUIntConstructor()
1548 void SPIRVCodeGenerator::writeUniformScaleMatrix(SpvId id, SpvId diagonal, const Type& type, in writeUniformScaleMatrix()
1551 SpvId zeroId = this->writeFloatLiteral(zero); in writeUniformScaleMatrix()
1552 std::vector<SpvId> columnIds; in writeUniformScaleMatrix()
1558 SpvId columnId = this->nextId(); in writeUniformScaleMatrix()
1569 for (SpvId id : columnIds) { in writeUniformScaleMatrix()
1574 void SPIRVCodeGenerator::writeMatrixCopy(SpvId id, SpvId src, const Type& srcType, in writeMatrixCopy()
1579 SpvId SPIRVCodeGenerator::writeMatrixConstructor(const Constructor& c, OutputStream& out) { in writeMatrixConstructor()
1583 std::vector<SpvId> arguments; in writeMatrixConstructor()
1587 SpvId result = this->nextId(); in writeMatrixConstructor()
1595 std::vector<SpvId> columnIds; in writeMatrixConstructor()
1609 SpvId id = this->nextId(); in writeMatrixConstructor()
1621 for (SpvId id : columnIds) { in writeMatrixConstructor()
1628 SpvId SPIRVCodeGenerator::writeVectorConstructor(const Constructor& c, OutputStream& out) { in writeVectorConstructor()
1635 std::vector<SpvId> arguments; in writeVectorConstructor()
1639 SpvId result = this->nextId(); in writeVectorConstructor()
1651 for (SpvId id : arguments) { in writeVectorConstructor()
1658 SpvId SPIRVCodeGenerator::writeConstructor(const Constructor& c, OutputStream& out) { in writeConstructor()
1711 std::vector<SpvId> SPIRVCodeGenerator::getAccessChain(const Expression& expr, OutputStream& out) { in getAccessChain()
1712 std::vector<SpvId> chain; in getAccessChain()
1735 PointerLValue(SPIRVCodeGenerator& gen, SpvId pointer, SpvId type) in PointerLValue()
1740 virtual SpvId getPointer() override { in getPointer()
1744 virtual SpvId load(OutputStream& out) override { in load()
1745 SpvId result = fGen.nextId(); in load()
1750 virtual void store(SpvId value, OutputStream& out) override { in store()
1756 const SpvId fPointer;
1757 const SpvId fType;
1762 SwizzleLValue(SPIRVCodeGenerator& gen, SpvId vecPointer, const std::vector<int>& components, in SwizzleLValue()
1770 virtual SpvId getPointer() override { in getPointer()
1774 virtual SpvId load(OutputStream& out) override { in load()
1775 SpvId base = fGen.nextId(); in load()
1777 SpvId result = fGen.nextId(); in load()
1789 virtual void store(SpvId value, OutputStream& out) override { in store()
1800 SpvId base = fGen.nextId(); in store()
1802 SpvId shuffle = fGen.nextId(); in store()
1829 const SpvId fVecPointer;
1849 std::vector<SpvId> chain = this->getAccessChain(expr, out); in getLValue()
1850 SpvId member = this->nextId(); in getLValue()
1851 this->writeOpCode(SpvOpAccessChain, (SpvId) (3 + chain.size()), out); in getLValue()
1854 for (SpvId idx : chain) { in getLValue()
1866 SpvId base = this->getLValue(*swizzle.fBase, out)->getPointer(); in getLValue()
1870 SpvId member = this->nextId(); in getLValue()
1897 SpvId result = this->nextId(); in getLValue()
1898 SpvId type = this->getPointerType(expr.fType, SpvStorageClassFunction); in getLValue()
1909 SpvId SPIRVCodeGenerator::writeVariableReference(const VariableReference& ref, OutputStream& out) { in writeVariableReference()
1910 SpvId result = this->nextId(); in writeVariableReference()
1913 SpvId var = entry->second; in writeVariableReference()
1918 if (fRTHeightStructId == (SpvId) -1) { in writeVariableReference()
1921 ASSERT(fRTHeightFieldIndex == (SpvId) -1); in writeVariableReference()
1941 ASSERT(fRTHeightFieldIndex != (SpvId) -1); in writeVariableReference()
1943 SpvId xId = this->nextId(); in writeVariableReference()
1947 SpvId fieldIndexId = this->writeIntLiteral(fieldIndex); in writeVariableReference()
1948 SpvId heightPtr = this->nextId(); in writeVariableReference()
1954 SpvId heightRead = this->nextId(); in writeVariableReference()
1957 SpvId rawYId = this->nextId(); in writeVariableReference()
1960 SpvId flippedYId = this->nextId(); in writeVariableReference()
1964 SpvId zeroId = writeFloatLiteral(zero); in writeVariableReference()
1966 SpvId oneId = writeFloatLiteral(one); in writeVariableReference()
1967 SpvId flipped = this->nextId(); in writeVariableReference()
1980 SpvId SPIRVCodeGenerator::writeIndexExpression(const IndexExpression& expr, OutputStream& out) { in writeIndexExpression()
1984 SpvId SPIRVCodeGenerator::writeFieldAccess(const FieldAccess& f, OutputStream& out) { in writeFieldAccess()
1988 SpvId SPIRVCodeGenerator::writeSwizzle(const Swizzle& swizzle, OutputStream& out) { in writeSwizzle()
1989 SpvId base = this->writeExpression(*swizzle.fBase, out); in writeSwizzle()
1990 SpvId result = this->nextId(); in writeSwizzle()
2008 SpvId SPIRVCodeGenerator::writeBinaryOperation(const Type& resultType, in writeBinaryOperation()
2009 const Type& operandType, SpvId lhs, in writeBinaryOperation()
2010 SpvId rhs, SpvOp_ ifFloat, SpvOp_ ifInt, in writeBinaryOperation()
2012 SpvId result = this->nextId(); in writeBinaryOperation()
2049 SpvId SPIRVCodeGenerator::foldToBool(SpvId id, const Type& operandType, OutputStream& out) { in foldToBool()
2051 SpvId result = this->nextId(); in foldToBool()
2058 SpvId SPIRVCodeGenerator::writeMatrixComparison(const Type& operandType, SpvId lhs, SpvId rhs, in writeMatrixComparison()
2063 SpvId rowType = this->getType(operandType.componentType().toCompound(fContext, in writeMatrixComparison()
2066 SpvId bvecType = this->getType(fContext.fBool_Type->toCompound(fContext, in writeMatrixComparison()
2069 SpvId boolType = this->getType(*fContext.fBool_Type); in writeMatrixComparison()
2070 SpvId result = 0; in writeMatrixComparison()
2072 SpvId rowL = this->nextId(); in writeMatrixComparison()
2074 SpvId rowR = this->nextId(); in writeMatrixComparison()
2076 SpvId compare = this->nextId(); in writeMatrixComparison()
2078 SpvId all = this->nextId(); in writeMatrixComparison()
2081 SpvId next = this->nextId(); in writeMatrixComparison()
2092 SpvId SPIRVCodeGenerator::writeBinaryExpression(const BinaryExpression& b, OutputStream& out) { in writeBinaryExpression()
2096 SpvId rhs = this->writeExpression(*b.fRight, out); in writeBinaryExpression()
2111 SpvId lhs; in writeBinaryExpression()
2119 SpvId rhs = this->writeExpression(*b.fRight, out); in writeBinaryExpression()
2131 SpvId vec = this->nextId(); in writeBinaryExpression()
2143 SpvId vec = this->nextId(); in writeBinaryExpression()
2163 SpvId result = this->nextId(); in writeBinaryExpression()
2172 SpvId result = this->nextId(); in writeBinaryExpression()
2246 SpvId result = this->nextId(); in writeBinaryExpression()
2277 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFAdd, in writeBinaryExpression()
2284 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFSub, in writeBinaryExpression()
2294 SpvId result = this->nextId(); in writeBinaryExpression()
2301 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFMul, in writeBinaryExpression()
2308 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFDiv, in writeBinaryExpression()
2315 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, SpvOpFMod, in writeBinaryExpression()
2322 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, in writeBinaryExpression()
2330 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, in writeBinaryExpression()
2338 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, in writeBinaryExpression()
2346 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, in writeBinaryExpression()
2354 SpvId result = this->writeBinaryOperation(resultType, *operandType, lhs, rhs, in writeBinaryExpression()
2366 SpvId SPIRVCodeGenerator::writeLogicalAnd(const BinaryExpression& a, OutputStream& out) { in writeLogicalAnd()
2369 SpvId falseConstant = this->writeBoolLiteral(falseLiteral); in writeLogicalAnd()
2370 SpvId lhs = this->writeExpression(*a.fLeft, out); in writeLogicalAnd()
2371 SpvId rhsLabel = this->nextId(); in writeLogicalAnd()
2372 SpvId end = this->nextId(); in writeLogicalAnd()
2373 SpvId lhsBlock = fCurrentBlock; in writeLogicalAnd()
2377 SpvId rhs = this->writeExpression(*a.fRight, out); in writeLogicalAnd()
2378 SpvId rhsBlock = fCurrentBlock; in writeLogicalAnd()
2381 SpvId result = this->nextId(); in writeLogicalAnd()
2387 SpvId SPIRVCodeGenerator::writeLogicalOr(const BinaryExpression& o, OutputStream& out) { in writeLogicalOr()
2390 SpvId trueConstant = this->writeBoolLiteral(trueLiteral); in writeLogicalOr()
2391 SpvId lhs = this->writeExpression(*o.fLeft, out); in writeLogicalOr()
2392 SpvId rhsLabel = this->nextId(); in writeLogicalOr()
2393 SpvId end = this->nextId(); in writeLogicalOr()
2394 SpvId lhsBlock = fCurrentBlock; in writeLogicalOr()
2398 SpvId rhs = this->writeExpression(*o.fRight, out); in writeLogicalOr()
2399 SpvId rhsBlock = fCurrentBlock; in writeLogicalOr()
2402 SpvId result = this->nextId(); in writeLogicalOr()
2408 SpvId SPIRVCodeGenerator::writeTernaryExpression(const TernaryExpression& t, OutputStream& out) { in writeTernaryExpression()
2409 SpvId test = this->writeExpression(*t.fTest, out); in writeTernaryExpression()
2412 SpvId result = this->nextId(); in writeTernaryExpression()
2413 SpvId trueId = this->writeExpression(*t.fIfTrue, out); in writeTernaryExpression()
2414 SpvId falseId = this->writeExpression(*t.fIfFalse, out); in writeTernaryExpression()
2421 SpvId var = this->nextId(); in writeTernaryExpression()
2424 SpvId trueLabel = this->nextId(); in writeTernaryExpression()
2425 SpvId falseLabel = this->nextId(); in writeTernaryExpression()
2426 SpvId end = this->nextId(); in writeTernaryExpression()
2436 SpvId result = this->nextId(); in writeTernaryExpression()
2452 SpvId SPIRVCodeGenerator::writePrefixExpression(const PrefixExpression& p, OutputStream& out) { in writePrefixExpression()
2454 SpvId result = this->nextId(); in writePrefixExpression()
2455 SpvId typeId = this->getType(p.fType); in writePrefixExpression()
2456 SpvId expr = this->writeExpression(*p.fOperand, out); in writePrefixExpression()
2471 SpvId one = this->writeExpression(*create_literal_1(fContext, p.fType), out); in writePrefixExpression()
2472 SpvId result = this->writeBinaryOperation(p.fType, p.fType, lv->load(out), one, in writePrefixExpression()
2480 SpvId one = this->writeExpression(*create_literal_1(fContext, p.fType), out); in writePrefixExpression()
2481 SpvId result = this->writeBinaryOperation(p.fType, p.fType, lv->load(out), one, in writePrefixExpression()
2489 SpvId result = this->nextId(); in writePrefixExpression()
2495 SpvId result = this->nextId(); in writePrefixExpression()
2505 SpvId SPIRVCodeGenerator::writePostfixExpression(const PostfixExpression& p, OutputStream& out) { in writePostfixExpression()
2507 SpvId result = lv->load(out); in writePostfixExpression()
2508 SpvId one = this->writeExpression(*create_literal_1(fContext, p.fType), out); in writePostfixExpression()
2511 SpvId temp = this->writeBinaryOperation(p.fType, p.fType, result, one, SpvOpFAdd, in writePostfixExpression()
2517 SpvId temp = this->writeBinaryOperation(p.fType, p.fType, result, one, SpvOpFSub, in writePostfixExpression()
2527 SpvId SPIRVCodeGenerator::writeBoolLiteral(const BoolLiteral& b) { in writeBoolLiteral()
2545 SpvId SPIRVCodeGenerator::writeIntLiteral(const IntLiteral& i) { in writeIntLiteral()
2549 SpvId result = this->nextId(); in writeIntLiteral()
2550 this->writeInstruction(SpvOpConstant, this->getType(i.fType), result, (SpvId) i.fValue, in writeIntLiteral()
2560 SpvId result = this->nextId(); in writeIntLiteral()
2561 this->writeInstruction(SpvOpConstant, this->getType(i.fType), result, (SpvId) i.fValue, in writeIntLiteral()
2570 SpvId SPIRVCodeGenerator::writeFloatLiteral(const FloatLiteral& f) { in writeFloatLiteral()
2575 SpvId result = this->nextId(); in writeFloatLiteral()
2589 SpvId result = this->nextId(); in writeFloatLiteral()
2602 SpvId SPIRVCodeGenerator::writeFunctionStart(const FunctionDeclaration& f, OutputStream& out) { in writeFunctionStart()
2603 SpvId result = fFunctionMap[&f]; in writeFunctionStart()
2608 SpvId id = this->nextId(); in writeFunctionStart()
2610 SpvId type; in writeFunctionStart()
2617 SpvId SPIRVCodeGenerator::writeFunction(const FunctionDefinition& f, OutputStream& out) { in writeFunction()
2619 SpvId result = this->writeFunctionStart(f.fDeclaration, out); in writeFunction()
2635 void SPIRVCodeGenerator::writeLayout(const Layout& layout, SpvId target) { in writeLayout()
2662 void SPIRVCodeGenerator::writeLayout(const Layout& layout, SpvId target, int member) { in writeLayout()
2689 SpvId SPIRVCodeGenerator::writeInterfaceBlock(const InterfaceBlock& intf) { in writeInterfaceBlock()
2694 SpvId result = this->nextId(); in writeInterfaceBlock()
2697 ASSERT(fRTHeightStructId == (SpvId) -1); in writeInterfaceBlock()
2698 ASSERT(fRTHeightFieldIndex == (SpvId) -1); in writeInterfaceBlock()
2705 SpvId typeId = this->getType(*type, layout); in writeInterfaceBlock()
2712 SpvId ptrType = this->nextId(); in writeInterfaceBlock()
2723 void SPIRVCodeGenerator::writePrecisionModifier(const Modifiers& modifiers, SpvId id) { in writePrecisionModifier()
2776 SpvId id = this->nextId(); in writeGlobalVars()
2778 SpvId type = this->getPointerType(var->fType, storageClass); in writeGlobalVars()
2783 this->writeInstruction(SpvOpMemberDecorate, id, (SpvId) i, SpvDecorationColMajor, in writeGlobalVars()
2785 this->writeInstruction(SpvOpMemberDecorate, id, (SpvId) i, SpvDecorationMatrixStride, in writeGlobalVars()
2786 (SpvId) fDefaultLayout.stride(var->fType), fDecorationBuffer); in writeGlobalVars()
2791 SpvId value = this->writeExpression(*varDecl.fValue, fGlobalInitializersBuffer); in writeGlobalVars()
2811 SpvId id = this->nextId(); in writeVarDeclarations()
2813 SpvId type = this->getPointerType(var->fType, SpvStorageClassFunction); in writeVarDeclarations()
2817 SpvId value = this->writeExpression(*varDecl.fValue, out); in writeVarDeclarations()
2872 SpvId test = this->writeExpression(*stmt.fTest, out); in writeIfStatement()
2873 SpvId ifTrue = this->nextId(); in writeIfStatement()
2874 SpvId ifFalse = this->nextId(); in writeIfStatement()
2876 SpvId end = this->nextId(); in writeIfStatement()
2906 SpvId header = this->nextId(); in writeForStatement()
2907 SpvId start = this->nextId(); in writeForStatement()
2908 SpvId body = this->nextId(); in writeForStatement()
2909 SpvId next = this->nextId(); in writeForStatement()
2911 SpvId end = this->nextId(); in writeForStatement()
2919 SpvId test = this->writeExpression(*f.fTest, out); in writeForStatement()
2946 SpvId header = this->nextId(); in writeWhileStatement()
2947 SpvId start = this->nextId(); in writeWhileStatement()
2948 SpvId body = this->nextId(); in writeWhileStatement()
2950 SpvId end = this->nextId(); in writeWhileStatement()
2957 SpvId test = this->writeExpression(*w.fTest, out); in writeWhileStatement()
2978 SpvId header = this->nextId(); in writeDoStatement()
2979 SpvId start = this->nextId(); in writeDoStatement()
2980 SpvId next = this->nextId(); in writeDoStatement()
2982 SpvId end = this->nextId(); in writeDoStatement()
2994 SpvId test = this->writeExpression(*d.fTest, out); in writeDoStatement()
3013 std::set<SpvId> interfaceVars; in writeInstructions()
3024 SpvId id = this->writeInterfaceBlock(intf); in writeInstructions()
3060 this->writeOpCode(SpvOpEntryPoint, (SpvId) (3 + (strlen(main->fName.c_str()) + 4) / 4) + in writeInstructions()