private Type getType(Type baseType, ArrayInfo arrayInfo) { if (arrayInfo == null) { return baseType; } return new ArrayType(baseType, arrayInfo); }
public String getOuterStructName() { return outerStruct.getStructNameType().getName(); } }
@Override public String toString() { String result = ""; for (TypeQualifier q : getQualifiers()) { result += q + " "; } result += targetType; return result; }
private Type stripQualifiers(Type type) { // TODO: when implementing this the only compound type I considered was ArrayType. if (type instanceof QualifiedType) { return stripQualifiers(type.getWithoutQualifiers()); } if (type instanceof ArrayType) { return new ArrayType(stripQualifiers(((ArrayType) type).getBaseType()), ((ArrayType) type).getArrayInfo()); } return type; }
public void addStructDefinition(StructDefinitionType sdt) { assert sdt.hasStructNameType(); structMapping.put(sdt.getStructNameType().getName(), sdt); }
boolean typeRefersToUniform(Type type) { if (type.hasQualifier(TypeQualifier.UNIFORM)) { return true; } if (!(type.getWithoutQualifiers() instanceof ArrayType)) { return false; } return typeRefersToUniform(((ArrayType) type.getWithoutQualifiers()).getBaseType()); }
private int getWidth(ScopeEntry entry) { return ((BasicType) entry.getType().getWithoutQualifiers()).getNumElements(); }
@Override public boolean preconditionHolds() { return targetStruct.getNumFields() > 1 && targetStruct.hasField(fieldToRemove); } }
@Override public Type getWithoutQualifiers() { return targetType.getWithoutQualifiers(); }
public boolean isBoolean() { return getElementType() == BOOL; }
@Override public Expr getCanonicalConstant() { return targetType.getCanonicalConstant(); }
@Override public boolean hasCanonicalConstant() { return targetType.hasCanonicalConstant(); }
private List<BasicType> numericTypesOrGenTypesIfEssl100() { if (shadingLanguageVersion == ShadingLanguageVersion.ESSL_100 || shadingLanguageVersion == ShadingLanguageVersion.WEBGL_SL) { return BasicType.allGenTypes(); } return BasicType.allNonMatrixNumericTypes(); }
@Override public void visitStructNameType(StructNameType structNameType) { if (structNameType.equals(toLookFor)) { counter++; } }
@Override public StructNameType clone() { return new StructNameType(name); }
private String unknownFieldMessage(String fieldName) { return "Field " + fieldName + " not found in struct" + (hasStructNameType() ? " " + structNameType : "") + "."; }
private boolean hasQualifiers(Type type) { return type instanceof QualifiedType && ((QualifiedType) type).hasQualifiers(); }
@Override public String toString() { return super.toString() + "(" + content + ")"; }
@Override public boolean preconditionHolds() { if (!outerStruct.hasField(fieldToInline)) { // The field has been reduced away. return false; } return true; }