Lines Matching defs:constant
213 spv::Id makeSmearedConstant(spv::Id constant, int vectorSize);
1356 for (auto constant : constants) {
1357 if (constant->getBasicType() == glslang::EbtFloat) {
1358 float floatValue = static_cast<float>(constant->getConstArray()[0].getDConst());
1363 } else if (constant->getBasicType() == glslang::EbtInt) {
1364 unsigned literal = constant->getConstArray()[0].getIConst();
1366 } else if (constant->getBasicType() == glslang::EbtUint) {
1367 unsigned literal = constant->getConstArray()[0].getUConst();
1369 } else if (constant->getBasicType() == glslang::EbtBool) {
1370 unsigned literal = constant->getConstArray()[0].getBConst();
1372 } else if (constant->getBasicType() == glslang::EbtString) {
1373 auto str = constant->getConstArray()[0].getSConst()->c_str();
2536 // Normal .length() would have been constant folded by the front-end.
2682 // Translate the constant to a literal value
3749 // Translate the constant to a literal value
4077 spv::Id constant = createSpvConstantFromConstUnionArray(node->getType(), node->getConstArray(), nextConst, false);
4080 builder.setAccessChainRValue(constant);
4555 auto constant = typeParam.getAsConstant();
4556 if (constant->isLiteral()) {
4557 if (constant->getBasicType() == glslang::EbtFloat) {
4558 float floatValue = static_cast<float>(constant->getConstArray()[0].getDConst());
4563 } else if (constant->getBasicType() == glslang::EbtInt) {
4564 unsigned literal = constant->getConstArray()[0].getIConst();
4566 } else if (constant->getBasicType() == glslang::EbtUint) {
4567 unsigned literal = constant->getConstArray()[0].getUConst();
4569 } else if (constant->getBasicType() == glslang::EbtBool) {
4570 unsigned literal = constant->getConstArray()[0].getBConst();
4572 } else if (constant->getBasicType() == glslang::EbtString) {
4573 auto str = constant->getConstArray()[0].getSConst()->c_str();
4598 operands.push_back({true, createSpvConstant(*constant)});
5031 // Sometimes, a raw constant is turned into an Id, and sometimes
5032 // a specialization constant expression is.
5035 // First, see if this is sized with a node, meaning a specialization constant:
7780 spv::Id TGlslangToSpvTraverser::makeSmearedConstant(spv::Id constant, int vectorSize)
7783 return constant;
7785 spv::Id vectorTypeId = builder.makeVectorType(builder.getTypeId(constant), vectorSize);
7788 components.push_back(constant);
9702 // Make a full tree of instructions to build a SPIR-V specialization constant,
9703 // or regular constant if possible.
9710 // - emit specialization constant-building instructions for specConstant
9711 // - when running into a non-spec-constant, switch to createSpvConstant()
9718 // hand off to the non-spec-constant path
9726 // We now know we have a specialization constant to build
9755 // An AST node labelled as specialization constant should be a symbol node.
9756 // Its initializer should either be a sub tree with constant nodes, or a constant union array.
9760 // Traverse the constant constructor sub tree like generating normal run-time instructions.
9762 // will set the builder into spec constant op instruction generating mode.
9776 // Neither a front-end constant node, nor a specialization constant node with constant union array or
9777 // constant sub tree as initializer.
9778 logger->missingFunctionality("Neither a front-end constant nor a spec constant.");
9783 // build the aggregate SPIR-V constant.
9786 // an empty 'consts' can be used to create a fully zeroed SPIR-V constant.
9864 // we have a non-aggregate (scalar) constant
9927 // Return true if the node is a constant or symbol whose reading has no
9935 // a constant is safe