class
CrShader::Optimizer::NameOptimizer
- CrShader::Optimizer::NameOptimizer
- Reference
- Object
Overview
Optimizes and minifies local variable names inside functions into compact, collision-free identifiers (_v0, _v1, ...) while strictly preserving all outward/inward facing uniforms, varyings, built-ins, and function signatures.
Defined in:
crshader/optimizer/name_optimizer.crConstant Summary
-
RESERVED_NAMES =
Set {"VERTEX", "POSITION", "NORMAL", "TANGENT", "BINORMAL", "COLOR", "UV", "UV2", "POINT_SIZE", "POINT_COORD", "ROUGHNESS", "METALLIC", "SPECULAR", "ALBEDO", "EMISSION", "FRAGCOORD", "SCREEN_UV", "TIME", "PI", "TAU", "INV_PROJECTION_MATRIX", "PROJECTION_MATRIX", "VIEW_MATRIX", "MODEL_MATRIX", "MODELVIEW_MATRIX", "MODEL_NORMAL_MATRIX", "TEXTURE", "TEXTURE_PIXEL_SIZE", "OUTPUT_IS_SRGB", "NODE_POSITION_WORLD", "CAMERA_POSITION_WORLD", "gl_GlobalInvocationID", "gl_LocalInvocationID", "gl_WorkGroupID", "gl_NumWorkGroups", "gl_WorkGroupSize", "float", "int", "uint", "bool", "vec2", "vec3", "vec4", "ivec2", "ivec3", "ivec4", "uvec2", "uvec3", "uvec4", "bvec2", "bvec3", "bvec4", "mat2", "mat3", "mat4", "sampler2D", "sampler3D", "isampler2D", "usampler2D", "void", "if", "else", "for", "while", "do", "return", "break", "continue", "discard", "in", "out", "inout", "const", "uniform", "varying", "buffer", "shared", "sin", "cos", "tan", "asin", "acos", "atan", "sinh", "cosh", "tanh", "pow", "exp", "log", "exp2", "log2", "sqrt", "inversesqrt", "abs", "sign", "floor", "trunc", "round", "roundEven", "ceil", "fract", "mod", "min", "max", "clamp", "mix", "step", "smoothstep", "isnan", "isinf", "floatBitsToInt", "floatBitsToUint", "intBitsToFloat", "length", "distance", "dot", "cross", "normalize", "faceforward", "reflect", "refract", "matrixCompMult", "outerProduct", "transpose", "determinant", "inverse", "texture", "textureLod", "textureProj", "texelFetch", "textureSize", "imageLoad", "imageStore", "imageSize"} -
Reserved keywords and built-in identifiers across GDShader & GLSL
Constructors
Instance Method Summary
-
#optimize_function(def_node : Crystal::Def) : Crystal::Def
Optimizes local variables within a single function
-
#optimize_program(program : ShaderProgram) : ShaderProgram
Optimizes all functions in a ShaderProgram
- #protected_names : Set(String)
Constructor Detail
Instance Method Detail
def optimize_function(def_node : Crystal::Def) : Crystal::Def
#
Optimizes local variables within a single function
Optimizes all functions in a ShaderProgram