Enum Class TransformationPhase.InjectionPoint

java.lang.Object
java.lang.Enum<TransformationPhase.InjectionPoint>
io.github.douira.glsl_transformer.transform.TransformationPhase.InjectionPoint
All Implemented Interfaces:
Serializable, Comparable<TransformationPhase.InjectionPoint>, Constable
Enclosing class:
TransformationPhase<T extends JobParameters>

public static enum TransformationPhase.InjectionPoint extends Enum<TransformationPhase.InjectionPoint>
Shader code is expected to be roughly structured as follows: version, extensions, other directives (#define, #pragma etc.), declarations (layout etc.), functions (void main etc.). These injection points can be used to insert nodes into the translation unit's child list. An injection will happen before the syntax feature it describes and any that follow it in the list.
Implementation Note:
AFTER versions of these points would be the same as the next BEFORE point in the list.
  • Enum Constant Details

    • BEFORE_VERSION

      public static final TransformationPhase.InjectionPoint BEFORE_VERSION
      Before the #version statement (and all other syntax features by necessity)
    • BEFORE_EXTENSIONS

      public static final TransformationPhase.InjectionPoint BEFORE_EXTENSIONS
      Before the #extension statement, before other directives, declarations and function definitions
    • BEFORE_DIRECTIVES

      public static final TransformationPhase.InjectionPoint BEFORE_DIRECTIVES
      Before non-extension parsed #-directives such as #pragma, before declarations and function definitions. (after extension statements if they aren't mixed with other directives and directly follow the #version) TODO: describe what happens to unparsed tokens that are in the stream
    • BEFORE_DECLARATIONS

      public static final TransformationPhase.InjectionPoint BEFORE_DECLARATIONS
      Before declarations like layout and struct, before function definitions
    • BEFORE_FUNCTIONS

      public static final TransformationPhase.InjectionPoint BEFORE_FUNCTIONS
      Before function definitions
    • BEFORE_EOF

      public static final TransformationPhase.InjectionPoint BEFORE_EOF
      Before the end of the file, basically the last possible location
  • Field Details

    • EDBeforeTypes

      public Set<Class<? extends ParseTree>> EDBeforeTypes
      A set of the rule contexts that can make up an external declaration that each injection point needs to inject before.
  • Method Details

    • values

      public static TransformationPhase.InjectionPoint[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TransformationPhase.InjectionPoint valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • checkChildRelevant

      protected boolean checkChildRelevant(Class<?> childClass)
      Checks if the given class of the child of an external declaration makes the external declaration one that should be injected before. When this method returns true, the injection happens right before the external declaration that has the child that was found to be relevant.
      Parameters:
      childClass - The class of the only child node of the external declaration being tested for being a node before which the injection has to happen
      Returns:
      true if the class means the injection should happen before this external declaration according to the implementing injection location