Package icyllis.arc3d.compiler.spirv
Class SPIRVCodeGenerator
java.lang.Object
icyllis.arc3d.compiler.CodeGenerator
icyllis.arc3d.compiler.spirv.SPIRVCodeGenerator
SPIR-V code generator for OpenGL 4.5 and Vulkan 1.0 or above.
A SPIR-V module is a stream of uint32 words, the generated code is in host endianness, which can be little-endian or big-endian.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
final TargetApi
final SPIRVVersion
static final int
Fields inherited from class icyllis.arc3d.compiler.CodeGenerator
mCompiler, mTranslationUnit
-
Constructor Summary
ConstructorDescriptionSPIRVCodeGenerator
(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
-
GENERATOR_MAGIC_NUMBER
public static final int GENERATOR_MAGIC_NUMBER- See Also:
-
NONE_ID
public static final int NONE_ID- See Also:
-
mOutputTarget
-
mOutputVersion
-
-
Constructor Details
-
SPIRVCodeGenerator
public SPIRVCodeGenerator(@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
-