Class Parser
-
Constructor Summary
ConstructorDescriptionParser
(ShaderCompiler compiler, ShaderKind kind, CompileOptions options, char[] source, int offset, int length) -
Method Summary
Modifier and TypeMethodDescriptionparse
(ModuleUnit parent) parseModule
(ModuleUnit parent) Preprocess directives.
-
Constructor Details
-
Parser
public Parser(ShaderCompiler compiler, ShaderKind kind, CompileOptions options, char[] source, int offset, int length)
-
-
Method Details
-
preprocess
Preprocess directives. A directive can only appear before any declaration.#version 3-digits (core|es)?
The version number has no semantics impact, but must be 300 at least.#extension extension_name : behavior
The extension has no semantics impact when generating SPIR-V, but it's retained when generating GLSL for some GLSL only extensions. A new behavior will override the earlier one for the same extension name.#include <file>
#include "file"
#import <file>
#import "file"
This method returns the include files as a list of (file,boolean) pairs. The second boolean value of true represents it's angle-bracketed (system include), otherwise it's double-quoted (local include). An implementation should normalize the file name and compile the include files first (via a new Parser'sparseModule(icyllis.arc3d.compiler.ModuleUnit)
). The return list is not deduplicated.#pragma
The whole line is silently ignored.Note that version, extension, and include must appear in order. Other directives can cause compilation errors. This process is optional.
- Returns:
- include files (can be empty) or null if there's an error
-
parse
-
parseModule
-