[][src]Module glsl::transpiler::glsl

A GLSL450/GLSL460 transpiler that takes a syntax tree and writes it as a plain raw GLSL String.

Foreword

This module exports several functions that just transform a part of a syntax tree into its raw GLSL String representation.

Important note: this module – and actually, any transpiler module – is not responsible in optimizing the syntax tree nor semantically check its validity. This is done in other stages of the compilation process.

In order to achieve that purpose, you could:

  • For each elements in the AST, return a String or Cow<str>.
  • Insert the string representation via a formatter.

The second solution is better because it lets the user handle the memory the way they want: they might just use a dynamic buffer that implements Write or simply pass a &mut String. It’s up to you.

How to use this module

First, head over to the syntax module. That module defines the AST items defined by GLSL. This very module provides you with functions like show_* taking the AST item and writing it to a Write object. You’re likely to be interested in show_translation_unit to start with.

Functions

show_array_spec
show_arrayed_identifier
show_assignment_op
show_binary_op
show_block
show_case_label
show_compound_statement
show_condition
show_declaration
show_double
show_expr
show_expression_statement
show_external_declaration
show_float
show_for_init_statement
show_for_rest_statement
show_fully_specified_type
show_function_definition
show_function_identifier
show_function_parameter_declaration
show_function_parameter_declarator
show_function_prototype
show_identifier
show_init_declarator_list
show_initializer
show_interpolation_qualifier
show_iteration_statement
show_jump_statement
show_layout_qualifier
show_layout_qualifier_spec
show_precision_qualifier
show_preprocessor
show_preprocessor_define
show_preprocessor_extension
show_preprocessor_version
show_selection_rest_statement
show_selection_statement
show_simple_statement
show_single_declaration
show_single_declaration_no_type
show_statement
show_storage_qualifier
show_struct
show_struct_field
show_struct_non_declaration
show_subroutine
show_switch_statement
show_translation_unit
show_type_name
show_type_qualifier
show_type_qualifier_spec
show_type_specifier
show_type_specifier_non_array
show_unary_op