Package icyllis.arc3d.compiler.glsl
Class GLSLCodeGenerator
java.lang.Object
icyllis.arc3d.compiler.CodeGenerator
icyllis.arc3d.compiler.glsl.GLSLCodeGenerator
Standard GLSL code generator for OpenGL 3.3 or above and Vulkan 1.0 or above (Vulkan GLSL).
A GLSL shader is a UTF-8 encoded string. However, our compiler only outputs ASCII characters.
-
Field Summary
Fields inherited from class icyllis.arc3d.compiler.CodeGenerator
mCompiler, mTranslationUnit
-
Constructor Summary
ConstructorDescriptionGLSLCodeGenerator
(ShaderCompiler compiler, TranslationUnit translationUnit, ShaderCaps shaderCaps) -
Method Summary
Modifier and TypeMethodDescriptionGenerates the code and returns the pointer value.Methods inherited from class icyllis.arc3d.compiler.CodeGenerator
getContext
-
Field Details
-
mOutputTarget
-
mOutputVersion
-
-
Constructor Details
-
GLSLCodeGenerator
public GLSLCodeGenerator(@Nonnull ShaderCompiler compiler, @Nonnull TranslationUnit translationUnit, @Nonnull ShaderCaps shaderCaps)
-
-
Method Details
-
generateCode
Description copied from class:CodeGenerator
Generates the code and returns the pointer value. The code size in bytes isBuffer.remaining()
. Check errors viaContext.getErrorHandler()
.The return value is a direct buffer, see
ByteBuffer.allocateDirect(int)
. A direct buffer wraps an address that points to off-heap memory, i.e. a native pointer. The byte order isByteOrder.nativeOrder()
and it's safe to pass the result to OpenGL and Vulkan API. There is no way to free this buffer explicitly, as it is subject to GC.- Specified by:
generateCode
in classCodeGenerator
- Returns:
- the generated code, or null if there's an error
-