Blender V5.3
blender::gpu::shader::SourceProcessor Class Reference

#include <processor.hh>

Classes

struct  Result

Public Types

using ErrorHandler = parser::ErrorHandler
using Parser = parser::IntermediateForm<parser::FullLexer, parser::FullParser>
using Scope = parser::Scope
using Token = parser::Token
using Tokens = std::vector<parser::Token>

Public Member Functions

 SourceProcessor (const std::string &source, const std::string &filepath, Language language, const std::vector< std::string > &file_list)
Result convert (metadata::Source external_sources_symbols={})
metadata::Source parse_include_and_symbols ()
metadata::Source parse_include_and_symbols (SourceManager &sources, bsl::SymbolTable &symbols, std::vector< std::string > &visited_files)
std::string remove_comments ()

Static Public Member Functions

static uint32_t hash_string (const std::string &str)
static bool has_pragma (Parser &parser, std::string_view pragma_str)
static std::string strip_whitespace (const std::string &str)
static std::string template_arguments_mangle (const Scope template_args)
static std::string get_create_info_placeholder (const std::string &name)
static void guarded_scope_mutation (Parser &parser, Scope scope, const std::string &condition, Token fn_type)
static std::string line_directive_prefix (const std::string &filename)

Static Public Attributes

static constexpr const char * namespace_separator = "_"
static constexpr const char * method_call_prefix = "_"
static constexpr const char * linted_struct_suffix = "_host_shared_"
static constexpr const char * uniform_struct_suffix = "uniform_"

Detailed Description

Shader source preprocessor that allow to mutate shader sources into cross API source that can be interpreted by the different GPU backends. Some syntax are mutated or reported as incompatible.

Definition at line 42 of file processor.hh.

Member Typedef Documentation

◆ ErrorHandler

◆ Parser

◆ Scope

◆ Token

◆ Tokens

Definition at line 48 of file processor.hh.

Constructor & Destructor Documentation

◆ SourceProcessor()

blender::gpu::shader::SourceProcessor::SourceProcessor ( const std::string & source,
const std::string & filepath,
Language language,
const std::vector< std::string > & file_list )
inline

Definition at line 105 of file processor.hh.

Member Function Documentation

◆ convert()

◆ get_create_info_placeholder()

string blender::gpu::shader::SourceProcessor::get_create_info_placeholder ( const std::string & name)
static

Definition at line 660 of file processor.cc.

◆ guarded_scope_mutation()

void blender::gpu::shader::SourceProcessor::guarded_scope_mutation ( Parser & parser,
Scope scope,
const std::string & condition,
Token fn_type )
static

◆ has_pragma()

bool blender::gpu::shader::SourceProcessor::has_pragma ( Parser & parser,
std::string_view pragma_str )
static

◆ hash_string()

uint32_t blender::gpu::shader::SourceProcessor::hash_string ( const std::string & str)
inlinestatic

Definition at line 143 of file processor.hh.

References str.

◆ line_directive_prefix()

string blender::gpu::shader::SourceProcessor::line_directive_prefix ( const std::string & filename)
static

Definition at line 2680 of file processor.cc.

◆ parse_include_and_symbols() [1/2]

metadata::Source blender::gpu::shader::SourceProcessor::parse_include_and_symbols ( )

Definition at line 416 of file processor.cc.

References remove_comments(), and str.

Referenced by scan_external_symbols().

◆ parse_include_and_symbols() [2/2]

metadata::Source blender::gpu::shader::SourceProcessor::parse_include_and_symbols ( SourceManager & sources,
bsl::SymbolTable & symbols,
std::vector< std::string > & visited_files )

◆ remove_comments()

std::string blender::gpu::shader::SourceProcessor::remove_comments ( )
inline

Definition at line 137 of file processor.hh.

References remove_comments().

Referenced by parse_include_and_symbols(), and remove_comments().

◆ strip_whitespace()

string blender::gpu::shader::SourceProcessor::strip_whitespace ( const std::string & str)
static

Remove trailing white-spaces.

Definition at line 2197 of file processor.cc.

References str.

◆ template_arguments_mangle()

string blender::gpu::shader::SourceProcessor::template_arguments_mangle ( const Scope template_args)
static

Member Data Documentation

◆ linted_struct_suffix

const char* blender::gpu::shader::SourceProcessor::linted_struct_suffix = "_host_shared_"
staticconstexpr

Definition at line 54 of file processor.hh.

◆ method_call_prefix

const char* blender::gpu::shader::SourceProcessor::method_call_prefix = "_"
staticconstexpr

Definition at line 53 of file processor.hh.

◆ namespace_separator

const char* blender::gpu::shader::SourceProcessor::namespace_separator = "_"
staticconstexpr

Definition at line 51 of file processor.hh.

Referenced by blender::gpu::shader::lower_namespace().

◆ uniform_struct_suffix

const char* blender::gpu::shader::SourceProcessor::uniform_struct_suffix = "uniform_"
staticconstexpr

Definition at line 55 of file processor.hh.


The documentation for this class was generated from the following files: