| 5621 | } |
| 5622 | |
| 5623 | void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qualifier, TArraySizes* arraySizes, |
| 5624 | const TIntermTyped* initializer, bool lastMember) |
| 5625 | { |
| 5626 | assert(arraySizes); |
| 5627 | |
| 5628 | // always allow special built-in ins/outs sized to topologies |
| 5629 | if (parsingBuiltins) |
| 5630 | return; |
| 5631 | |
| 5632 | // initializer must be a sized array, in which case |
| 5633 | // allow the initializer to set any unknown array sizes |
| 5634 | if (initializer != nullptr) { |
| 5635 | if (initializer->getType().isUnsizedArray()) |
| 5636 | error(loc, "array initializer must be sized", "[]", ""); |
| 5637 | return; |
| 5638 | } |
| 5639 | |
| 5640 | // No environment allows any non-outer-dimension to be implicitly sized |
| 5641 | if (arraySizes->isInnerUnsized()) { |
| 5642 | error(loc, "only outermost dimension of an array of arrays can be implicitly sized", "[]", ""); |
| 5643 | arraySizes->clearInnerUnsized(); |
| 5644 | } |
| 5645 | |
| 5646 | if (arraySizes->isInnerSpecialization() && |
| 5647 | (qualifier.storage != EvqTemporary && qualifier.storage != EvqGlobal && qualifier.storage != EvqShared && qualifier.storage != EvqConst)) |
| 5648 | error(loc, "only outermost dimension of an array of arrays can be a specialization constant", "[]", ""); |
| 5649 | |
| 5650 | // desktop always allows outer-dimension-unsized variable arrays, |
| 5651 | if (!isEsProfile()) |
| 5652 | return; |
| 5653 | |
| 5654 | // for ES, if size isn't coming from an initializer, it has to be explicitly declared now, |
| 5655 | // with very few exceptions |
| 5656 | |
| 5657 | // implicitly-sized io exceptions: |
| 5658 | switch (language) { |
| 5659 | case EShLangGeometry: |
| 5660 | if (qualifier.storage == EvqVaryingIn) |
| 5661 | if ((isEsProfile() && version >= 320) || |
| 5662 | extensionsTurnedOn(Num_AEP_geometry_shader, AEP_geometry_shader)) |
| 5663 | return; |
| 5664 | break; |
| 5665 | case EShLangTessControl: |
| 5666 | if ( qualifier.storage == EvqVaryingIn || |
| 5667 | (qualifier.storage == EvqVaryingOut && ! qualifier.isPatch())) |
| 5668 | if ((isEsProfile() && version >= 320) || |
| 5669 | extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) |
| 5670 | return; |
| 5671 | break; |
| 5672 | case EShLangTessEvaluation: |
| 5673 | if ((qualifier.storage == EvqVaryingIn && ! qualifier.isPatch()) || |
| 5674 | qualifier.storage == EvqVaryingOut) |
| 5675 | if ((isEsProfile() && version >= 320) || |
| 5676 | extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) |
| 5677 | return; |
| 5678 | break; |
| 5679 | case EShLangMesh: |
| 5680 | if (qualifier.storage == EvqVaryingOut) |
nothing calls this directly
no test coverage detected