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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract @Nullable ByteBuffer
Generates the code and returns a buffer slice.protected Context
-
Field Details
-
mContext
-
mTranslationUnit
-
-
Constructor Details
-
CodeGenerator
-
-
Method Details
-
generateCode
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()
.- Returns:
- the generated code, or null if there's an error
-
getContext
-