MCPcopy Create free account
hub / github.com/KhronosGroup/glslang / constructorError

Method constructorError

glslang/MachineIndependent/ParseHelper.cpp:4404–4765  ·  view source on GitHub ↗

Make sure there is enough data and not too many arguments provided to the constructor to build something of the type of the constructor. Also returns the type of the constructor. Part of establishing type is establishing specialization-constness. We don't yet know "top down" whether type is a specialization constant, but a const constructor can becomes a specialization constant if any of its chi

Source from the content-addressed store, hash-verified

4402// Returns true if there was an error in construction.
4403//
4404bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, TFunction& function, TOperator op, TType& type)
4405{
4406 // See if the constructor does not establish the main type, only requalifies
4407 // it, in which case the type comes from the argument instead of from the
4408 // constructor function.
4409 switch (op) {
4410 case EOpConstructNonuniform:
4411 if (node != nullptr && node->getAsTyped() != nullptr) {
4412 type.shallowCopy(node->getAsTyped()->getType());
4413 type.getQualifier().makeTemporary();
4414 type.getQualifier().nonUniform = true;
4415 }
4416 break;
4417 default:
4418 type.shallowCopy(function.getType());
4419 break;
4420 }
4421
4422 TString constructorString;
4423 if (intermediate.getEnhancedMsgs())
4424 constructorString.append(type.getCompleteString(true, false, false, true)).append(" constructor");
4425 else
4426 constructorString.append("constructor");
4427
4428 // See if it's a matrix
4429 bool constructingMatrix = false;
4430 switch (op) {
4431 case EOpConstructTextureSampler:
4432 return constructorTextureSamplerError(loc, function);
4433 case EOpConstructMat2x2:
4434 case EOpConstructMat2x3:
4435 case EOpConstructMat2x4:
4436 case EOpConstructMat3x2:
4437 case EOpConstructMat3x3:
4438 case EOpConstructMat3x4:
4439 case EOpConstructMat4x2:
4440 case EOpConstructMat4x3:
4441 case EOpConstructMat4x4:
4442 case EOpConstructDMat2x2:
4443 case EOpConstructDMat2x3:
4444 case EOpConstructDMat2x4:
4445 case EOpConstructDMat3x2:
4446 case EOpConstructDMat3x3:
4447 case EOpConstructDMat3x4:
4448 case EOpConstructDMat4x2:
4449 case EOpConstructDMat4x3:
4450 case EOpConstructDMat4x4:
4451 case EOpConstructF16Mat2x2:
4452 case EOpConstructF16Mat2x3:
4453 case EOpConstructF16Mat2x4:
4454 case EOpConstructF16Mat3x2:
4455 case EOpConstructF16Mat3x3:
4456 case EOpConstructF16Mat3x4:
4457 case EOpConstructF16Mat4x2:
4458 case EOpConstructF16Mat4x3:
4459 case EOpConstructF16Mat4x4:
4460 constructingMatrix = true;
4461 break;

Callers

nothing calls this directly

Calls 15

errorFunction · 0.85
shallowCopyMethod · 0.80
getTypeMethod · 0.80
getEnhancedMsgsMethod · 0.80
appendMethod · 0.80
getParamCountMethod · 0.80
isUnsizedArrayMethod · 0.80
c_strMethod · 0.80
computeNumComponentsMethod · 0.80
contains16BitFloatMethod · 0.80
contains16BitIntMethod · 0.80
contains8BitIntMethod · 0.80

Tested by

no test coverage detected