Package icyllis.arc3d.compiler
Class CodeGenerator
java.lang.Object
icyllis.arc3d.compiler.CodeGenerator
- Direct Known Subclasses:
GLSLCodeGenerator
,SPIRVCodeGenerator
Abstract superclass of all code generators, which take a
TranslationUnit
as input
and produce code as output.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract ByteBuffer
Generates the code and returns the pointer value.protected Context
-
Field Details
-
mCompiler
-
mTranslationUnit
-
-
Constructor Details
-
CodeGenerator
-
-
Method Details
-
generateCode
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.- Returns:
- the generated code, or null if there's an error
-
getContext
-