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
FieldsFields inherited from class icyllis.arc3d.compiler.CodeGenerator
mContext, mTranslationUnit
-
Constructor Summary
ConstructorsConstructorDescriptionGLSLCodeGenerator
(@NonNull Context context, @NonNull TranslationUnit translationUnit, @NonNull ShaderCaps shaderCaps) -
Method Summary
Modifier and TypeMethodDescription@Nullable ByteBuffer
Generates the code and returns a buffer slice.Methods inherited from class icyllis.arc3d.compiler.CodeGenerator
getContext
-
Field Details
-
mOutputTarget
-
mOutputVersion
-
-
Constructor Details
-
GLSLCodeGenerator
public GLSLCodeGenerator(@NonNull Context context, @NonNull TranslationUnit translationUnit, @NonNull ShaderCaps shaderCaps)
-
-
Method Details
-
generateCode
Description copied from class:CodeGenerator
Generates the code and returns a buffer slice. The code size in bytes isBuffer.remaining()
.The return value is a direct buffer allocated via
ByteBuffer.allocateDirect(int)
. The byte order isByteOrder.nativeOrder()
(i.e. host endianness) and it's safe to pass the result to OpenGL and Vulkan. There is no way to free this buffer explicitly, as it is subject to GC. UseReference.reachabilityFence(Object)
to keep it alive.Check errors via
Context.getErrorHandler()
.- Specified by:
generateCode
in classCodeGenerator
- Returns:
- the generated code, or null if there's an error
-