class Nya::Render::Backends::GL::GLSLCompiler

Overview

GLSL shader compiler

Defined in:

nya/render/backends/gl/glsl_compiler.cr

Constant Summary

REQUIRE_REGEX = /^\s*\/\/\s*@require (?<name>.+)/

Class Method Summary

Class Method Detail

def self.compile(filename : String, stype : ShaderType | Nil = nil) #

Compiles shader If stype is not set, it is detected automatically using .detect_type


[View source]
def self.detect_type(text, filename : String | Nil = nil) #

Detects shader type using //@type shader_type directive and file extension frag* - fragment shader tess*c* - tesselation control shader tess*e* - tesselation evaluation shader geom* - geometry shader Shader with other type is considered vertex shader


[View source]
def self.flush_cache! #

Flushes preprocessor, compiler and linker cache


[View source]
def self.link(shaders : Array(UInt32)) #

Links a shader program


[View source]
def self.preprocess(text : String) #

Preprocesses shader In fact, that only replaces @require file with the contents of the file


[View source]