Sarek_vulkan.Sarek_ir_glslval current_variants :
(string * (string * Sarek_ir_types.elttype list) list) list Stdlib.refCurrent kernel's variant definitions (set during generate)
Helper function vector parameter indices - maps function name to set of parameter indices that are vectors. In GLSL, vectors cannot be passed as function parameters, so these must be filtered out at call sites.
Escape reserved GLSL keywords by adding 'v' suffix (avoids double underscore with _len)
val glsl_type_of_elttype : Sarek_ir_types.elttype -> stringMap Sarek IR element type to GLSL type string
val gen_expr : Stdlib.Buffer.t -> Sarek_ir_types.expr -> unitval gen_binop : Sarek_ir_types.binop -> stringval gen_unop : Sarek_ir_types.unop -> stringval gen_intrinsic :
Stdlib.Buffer.t ->
string list ->
string ->
Sarek_ir_types.expr list ->
unitval gen_lvalue : Stdlib.Buffer.t -> Sarek_ir_types.lvalue -> unitval gen_match_pattern :
Stdlib.Buffer.t ->
string ->
string ->
string ->
string list ->
(string -> Sarek_ir_types.elttype list option) ->
unitGenerate match case pattern with variable bindings
val gen_var_decl :
Stdlib.Buffer.t ->
string ->
string ->
Sarek_ir_types.elttype ->
Sarek_ir_types.expr ->
unitGenerate variable declaration with optional initialization
val gen_array_decl :
Stdlib.Buffer.t ->
string ->
string ->
Sarek_ir_types.elttype ->
Sarek_ir_types.expr ->
unitGenerate array declaration
val gen_stmt : Stdlib.Buffer.t -> string -> Sarek_ir_types.stmt -> unitval gen_helper_func :
pc_names:string list ->
Stdlib.Buffer.t ->
Sarek_ir_types.helper_func ->
unitGenerate helper function with #undef/#define guards to avoid macro collisions. Push constant macros (e.g., #define max_iter pc.max_iter) would otherwise expand function parameters with the same name, causing syntax errors.
val count_vec_params : Sarek_ir_types.decl list -> intCount vector parameters for binding assignment
Generate GLSL compute shader header.
val gen_buffer_binding :
Stdlib.Buffer.t ->
int ->
Sarek_ir_types.var ->
Sarek_ir_types.elttype ->
unitGenerate buffer binding for a vector parameter
val gen_push_constants : Stdlib.Buffer.t -> Sarek_ir_types.decl list -> unitCollect shared array declarations from a statement tree. Returns list of (name, elem_type, size_expr)
Generate shared declarations at module scope
val generate : ?block:(int * int * int) -> Sarek_ir_types.kernel -> stringGenerate complete GLSL source for a kernel.
val gen_record_def :
Stdlib.Buffer.t ->
(string * (string * Sarek_ir_types.elttype) list) ->
unitGenerate GLSL record type definition - simple struct without tag
val gen_variant_def :
Stdlib.Buffer.t ->
(string * (string * Sarek_ir_types.elttype list) list) ->
unitGenerate GLSL variant type definition
val generate_with_types :
?block:(int * int * int) ->
types:(string * (string * Sarek_ir_types.elttype) list) list ->
Sarek_ir_types.kernel ->
stringGenerate GLSL source with custom type definitions.