Check if mesh perviewNV attributes have a view dimension and resize it to gl_MaxMeshViewCountNV when implicitly sized.
| 5864 | // Check if mesh perviewNV attributes have a view dimension |
| 5865 | // and resize it to gl_MaxMeshViewCountNV when implicitly sized. |
| 5866 | void TParseContext::checkAndResizeMeshViewDim(const TSourceLoc& loc, TType& type, bool isBlockMember) |
| 5867 | { |
| 5868 | // see if member is a per-view attribute |
| 5869 | if (!type.getQualifier().isPerView()) |
| 5870 | return; |
| 5871 | |
| 5872 | if ((isBlockMember && type.isArray()) || (!isBlockMember && type.isArrayOfArrays())) { |
| 5873 | // since we don't have the maxMeshViewCountNV set during parsing builtins, we hardcode the value. |
| 5874 | int maxViewCount = parsingBuiltins ? 4 : resources.maxMeshViewCountNV; |
| 5875 | // For block members, outermost array dimension is the view dimension. |
| 5876 | // For non-block members, outermost array dimension is the vertex/primitive dimension |
| 5877 | // and 2nd outermost is the view dimension. |
| 5878 | int viewDim = isBlockMember ? 0 : 1; |
| 5879 | int viewDimSize = type.getArraySizes()->getDimSize(viewDim); |
| 5880 | |
| 5881 | if (viewDimSize != UnsizedArraySize && viewDimSize != maxViewCount) |
| 5882 | error(loc, "mesh view output array size must be gl_MaxMeshViewCountNV or implicitly sized", "[]", ""); |
| 5883 | else if (viewDimSize == UnsizedArraySize) |
| 5884 | type.getArraySizes()->setDimSize(viewDim, maxViewCount); |
| 5885 | } |
| 5886 | else { |
| 5887 | error(loc, "requires a view array dimension", "perviewNV", ""); |
| 5888 | } |
| 5889 | } |
| 5890 | |
| 5891 | // Returns true if the first argument to the #line directive is the line number for the next line. |
| 5892 | // |
nothing calls this directly
no test coverage detected