Class ShadercSpvc
- java.lang.Object
-
- org.lwjgl.util.shaderc.ShadercSpvc
-
public class ShadercSpvc extends java.lang.Object
Native bindings to the libshaderc_spvc C API of the shaderc library.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShadercSpvc.Functions
Contains the function pointers loaded from the shadercSharedLibrary
.
-
Field Summary
Fields Modifier and Type Field Description static int
shaderc_spvc_msl_platform_ios
shaderc_spvc_msl_platform_macosEnum values:
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.lwjgl.system.SharedLibrary
getLibrary()
Returns the shadercSharedLibrary
.static long
nshaderc_spvc_compile_into_glsl(long compiler, long source, long source_len, long options)
Unsafe version of:compile_into_glsl
static long
nshaderc_spvc_compile_into_hlsl(long compiler, long source, long source_len, long options)
Unsafe version of:compile_into_hlsl
static long
nshaderc_spvc_compile_into_msl(long compiler, long source, long source_len, long options)
Unsafe version of:compile_into_msl
static long
nshaderc_spvc_compile_into_vulkan(long compiler, long source, long source_len, long options)
Unsafe version of:compile_into_vulkan
static void
nshaderc_spvc_compile_options_set_entry_point(long options, long entry_point)
Unsafe version of:compile_options_set_entry_point
static long
nshaderc_spvc_compile_options_set_for_fuzzing(long options, long data, long size)
Unsafe version of:compile_options_set_for_fuzzing
static void
nshaderc_spvc_compile_options_set_msl_discrete_descriptor_sets(long options, long descriptors, long num_descriptors)
Unsafe version of:compile_options_set_msl_discrete_descriptor_sets
static long
nshaderc_spvc_result_get_binary_output(long result)
Unsafe version of:result_get_binary_output
static long
nshaderc_spvc_result_get_messages(long result)
Unsafe version of:result_get_messages
static long
nshaderc_spvc_result_get_string_output(long result)
Unsafe version of:result_get_string_output
static long
shaderc_spvc_compile_into_glsl(long compiler, java.nio.IntBuffer source, long options)
Takes SPIR-V as a sequence of 32-bit words, validates it, then compiles to GLSL.static long
shaderc_spvc_compile_into_hlsl(long compiler, java.nio.IntBuffer source, long options)
Takes SPIR-V as a sequence of 32-bit words, validates it, then compiles to HLSL.static long
shaderc_spvc_compile_into_msl(long compiler, java.nio.IntBuffer source, long options)
Takes SPIR-V as a sequence of 32-bit words, validates it, then compiles to MSL.static long
shaderc_spvc_compile_into_vulkan(long compiler, java.nio.IntBuffer source, long options)
Takes SPIR-V as a sequence of 32-bit words, validates it, then compiles to Vulkan specific SPIR-V.static long
shaderc_spvc_compile_options_clone(long options)
Returns a copy of the given options.static long
shaderc_spvc_compile_options_initialize()
Returns default compiler options.static void
shaderc_spvc_compile_options_release(long options)
Releases the compilation options.static void
shaderc_spvc_compile_options_set_entry_point(long options, java.lang.CharSequence entry_point)
Sets the entry point.static void
shaderc_spvc_compile_options_set_entry_point(long options, java.nio.ByteBuffer entry_point)
Sets the entry point.static void
shaderc_spvc_compile_options_set_es(long options, boolean b)
Force interpretion as ES, or not.static void
shaderc_spvc_compile_options_set_fixup_clipspace(long options, boolean b)
If true (default is false): GLSL: map depth from Vulkan/D3D style to GL style, i.e.static void
shaderc_spvc_compile_options_set_flatten_multidimensional_arrays(long options, boolean b)
If true, flatten multidimensional arrays, e.g.static void
shaderc_spvc_compile_options_set_flatten_ubo(long options, boolean b)
Flatten uniform or push constant variable into(i|u)vec4
array.static void
shaderc_spvc_compile_options_set_flip_vert_y(long options, boolean b)
If true invertgl_Position.y
or equivalent.static long
shaderc_spvc_compile_options_set_for_fuzzing(long options, java.nio.ByteBuffer data)
Fill options with given data.static void
shaderc_spvc_compile_options_set_glsl_emit_push_constant_as_ubo(long options, boolean b)
If true, emit push constants as uniform buffer objects.static void
shaderc_spvc_compile_options_set_glsl_language_version(long options, int version)
Set GLSL language version.static void
shaderc_spvc_compile_options_set_hlsl_point_coord_compat(long options, boolean b)
If true, ignorePointCoord
.static void
shaderc_spvc_compile_options_set_hlsl_point_size_compat(long options, boolean b)
If true, ignorePointSize
.static void
shaderc_spvc_compile_options_set_hlsl_shader_model(long options, int model)
Set HLSL shader model.static void
shaderc_spvc_compile_options_set_msl_argument_buffers(long options, boolean b)
Enable use of MSL 2.0 indirect argument buffers.static void
shaderc_spvc_compile_options_set_msl_capture(long options, boolean b)
If true, capture MSL output to buffer.static void
shaderc_spvc_compile_options_set_msl_discrete_descriptor_sets(long options, java.nio.IntBuffer descriptors)
When using MSL argument buffers, force "classic" MSL 1.0 binding for the given descriptor sets.static void
shaderc_spvc_compile_options_set_msl_domain_lower_left(long options, boolean b)
If true, flip the Y-coord of the built-inTessCoord
.static void
shaderc_spvc_compile_options_set_msl_language_version(long options, int version)
Set MSL language version.static void
shaderc_spvc_compile_options_set_msl_pad_fragment_output(long options, boolean b)
If true, pad MSL fragment output.static void
shaderc_spvc_compile_options_set_msl_platform(long options, int platform)
Choose MSL platform.static void
shaderc_spvc_compile_options_set_msl_swizzle_texture_samples(long options, boolean b)
If true, swizzle MSL texture samples.static void
shaderc_spvc_compile_options_set_remove_unused_variables(long options, boolean b)
If true, unused variables will not appear in the output.static void
shaderc_spvc_compile_options_set_robust_buffer_access_pass(long options, boolean b)
If true, enable robust buffer access pass in the spirv-opt, meaning:static void
shaderc_spvc_compile_options_set_separate_shader_objects(long options, boolean b)
If true,gl_PerVertex
is explicitly redeclared in vertex, geometry and tessellation shaders.static void
shaderc_spvc_compile_options_set_source_env(long options, int env, int version)
Sets the source shader environment, affecting which warnings or errors will be issued during validation.static void
shaderc_spvc_compile_options_set_target_env(long options, int env, int version)
Sets the target shader environment, if this is different from the source environment, then a transform between the environments will be performed if possible.static void
shaderc_spvc_compile_options_set_validate(long options, boolean b)
Set if validation should be performed.static void
shaderc_spvc_compile_options_set_vulkan_semantics(long options, boolean b)
If true, Vulkan GLSL features are used instead of GL-compatible features.static long
shaderc_spvc_compiler_initialize()
Create a compiler.static void
shaderc_spvc_compiler_release(long compiler)
Release resources.static int
shaderc_spvc_result_get_binary_length(long result)
Get length of validation/compilation result as a binary buffer.static java.nio.IntBuffer
shaderc_spvc_result_get_binary_output(long result)
Get validation/compilation result as a binary buffer.static java.nio.IntBuffer
shaderc_spvc_result_get_binary_output(long result, long length)
Get validation/compilation result as a binary buffer.static java.lang.String
shaderc_spvc_result_get_messages(long result)
Get validation/compilation error or informational messages.static int
shaderc_spvc_result_get_status(long result)
Returns the compilation status, indicating whether the compilation succeeded, or failed due to some reasons, like invalid shader stage or compilation errors.static java.lang.String
shaderc_spvc_result_get_string_output(long result)
Get validation/compilation result as a string.static void
shaderc_spvc_result_release(long result)
Releases the resources held by the result object.
-
-
-
Method Detail
-
getLibrary
public static org.lwjgl.system.SharedLibrary getLibrary()
Returns the shadercSharedLibrary
.
-
shaderc_spvc_compiler_initialize
public static long shaderc_spvc_compiler_initialize()
Create a compiler.A return of
NULL
indicates that there was an error. Any function operating on a*_compiler_t
must offer the basic thread-safety guarantee. That is: concurrent invocation of these functions on DIFFERENT objects needs no synchronization; concurrent invocation of these functions on the SAME object requires synchronization IF AND ONLY IF some of them take a non-const argument.
-
shaderc_spvc_compiler_release
public static void shaderc_spvc_compiler_release(long compiler)
Release resources.After this the handle cannot be used.
-
shaderc_spvc_compile_options_initialize
public static long shaderc_spvc_compile_options_initialize()
Returns default compiler options.A return of
NULL
indicates that there was an error initializing the options. Any function operating onshaderc_spvc_compile_options_t
must offer the basic thread-safety guarantee.
-
shaderc_spvc_compile_options_clone
public static long shaderc_spvc_compile_options_clone(long options)
Returns a copy of the given options.If
NULL
is passed as the parameter the call is the same ascompile_options_initialize
.
-
shaderc_spvc_compile_options_release
public static void shaderc_spvc_compile_options_release(long options)
Releases the compilation options.It is invalid to use the given option object in any future calls. It is safe to pass
NULL
to this function, and doing such will have no effect.
-
nshaderc_spvc_compile_options_set_entry_point
public static void nshaderc_spvc_compile_options_set_entry_point(long options, long entry_point)
Unsafe version of:compile_options_set_entry_point
-
shaderc_spvc_compile_options_set_entry_point
public static void shaderc_spvc_compile_options_set_entry_point(long options, java.nio.ByteBuffer entry_point) public static void shaderc_spvc_compile_options_set_entry_point(long options, java.lang.CharSequence entry_point)
Sets the entry point.
-
shaderc_spvc_compile_options_set_remove_unused_variables
public static void shaderc_spvc_compile_options_set_remove_unused_variables(long options, boolean b)
If true, unused variables will not appear in the output.
-
shaderc_spvc_compile_options_set_robust_buffer_access_pass
public static void shaderc_spvc_compile_options_set_robust_buffer_access_pass(long options, boolean b)
If true, enable robust buffer access pass in the spirv-opt, meaning:Inject code to clamp indexed accesses to buffers and internal arrays, providing guarantees satisfying Vulkan's
robustBufferAccess
rules. This is useful when an implementation does not support robust-buffer access as a driver option.
-
shaderc_spvc_compile_options_set_source_env
public static void shaderc_spvc_compile_options_set_source_env(long options, int env, int version)
Sets the source shader environment, affecting which warnings or errors will be issued during validation.Default value for environment is Vulkan 1.0.
-
shaderc_spvc_compile_options_set_target_env
public static void shaderc_spvc_compile_options_set_target_env(long options, int env, int version)
Sets the target shader environment, if this is different from the source environment, then a transform between the environments will be performed if possible.Currently only WebGPU <-> Vulkan 1.1 are defined. Default value for environment is Vulkan 1.0.
-
shaderc_spvc_compile_options_set_vulkan_semantics
public static void shaderc_spvc_compile_options_set_vulkan_semantics(long options, boolean b)
If true, Vulkan GLSL features are used instead of GL-compatible features.
-
shaderc_spvc_compile_options_set_separate_shader_objects
public static void shaderc_spvc_compile_options_set_separate_shader_objects(long options, boolean b)
If true,gl_PerVertex
is explicitly redeclared in vertex, geometry and tessellation shaders.The members of
gl_PerVertex
is determined by which built-ins are declared by the shader.
-
shaderc_spvc_compile_options_set_flatten_ubo
public static void shaderc_spvc_compile_options_set_flatten_ubo(long options, boolean b)
Flatten uniform or push constant variable into(i|u)vec4
array.
-
shaderc_spvc_compile_options_set_glsl_language_version
public static void shaderc_spvc_compile_options_set_glsl_language_version(long options, int version)
Set GLSL language version.Default is 450 (i.e. 4.5).
-
shaderc_spvc_compile_options_set_flatten_multidimensional_arrays
public static void shaderc_spvc_compile_options_set_flatten_multidimensional_arrays(long options, boolean b)
If true, flatten multidimensional arrays, e.g.foo[a][b][c] -> foo[a*b*c]
. Default is false.
-
shaderc_spvc_compile_options_set_es
public static void shaderc_spvc_compile_options_set_es(long options, boolean b)
Force interpretion as ES, or not. Default is to detect from source.
-
shaderc_spvc_compile_options_set_glsl_emit_push_constant_as_ubo
public static void shaderc_spvc_compile_options_set_glsl_emit_push_constant_as_ubo(long options, boolean b)
If true, emit push constants as uniform buffer objects. Default is false.
-
shaderc_spvc_compile_options_set_msl_language_version
public static void shaderc_spvc_compile_options_set_msl_language_version(long options, int version)
Set MSL language version.Default is 10200 (i.e. 1.2).
-
shaderc_spvc_compile_options_set_msl_swizzle_texture_samples
public static void shaderc_spvc_compile_options_set_msl_swizzle_texture_samples(long options, boolean b)
If true, swizzle MSL texture samples. Default is false.
-
shaderc_spvc_compile_options_set_msl_platform
public static void shaderc_spvc_compile_options_set_msl_platform(long options, int platform)
Choose MSL platform. Default is MacOS.
-
shaderc_spvc_compile_options_set_msl_pad_fragment_output
public static void shaderc_spvc_compile_options_set_msl_pad_fragment_output(long options, boolean b)
If true, pad MSL fragment output. Default is false.
-
shaderc_spvc_compile_options_set_msl_capture
public static void shaderc_spvc_compile_options_set_msl_capture(long options, boolean b)
If true, capture MSL output to buffer. Default is false.
-
shaderc_spvc_compile_options_set_msl_domain_lower_left
public static void shaderc_spvc_compile_options_set_msl_domain_lower_left(long options, boolean b)
If true, flip the Y-coord of the built-inTessCoord
. Default is top left.
-
shaderc_spvc_compile_options_set_msl_argument_buffers
public static void shaderc_spvc_compile_options_set_msl_argument_buffers(long options, boolean b)
Enable use of MSL 2.0 indirect argument buffers. Default is not to use them.
-
nshaderc_spvc_compile_options_set_msl_discrete_descriptor_sets
public static void nshaderc_spvc_compile_options_set_msl_discrete_descriptor_sets(long options, long descriptors, long num_descriptors)
Unsafe version of:compile_options_set_msl_discrete_descriptor_sets
-
shaderc_spvc_compile_options_set_msl_discrete_descriptor_sets
public static void shaderc_spvc_compile_options_set_msl_discrete_descriptor_sets(long options, java.nio.IntBuffer descriptors)
When using MSL argument buffers, force "classic" MSL 1.0 binding for the given descriptor sets. This corresponds toVK_KHR_push_descriptor
in Vulkan.
-
shaderc_spvc_compile_options_set_hlsl_shader_model
public static void shaderc_spvc_compile_options_set_hlsl_shader_model(long options, int model)
Set HLSL shader model.Default is 30.
-
shaderc_spvc_compile_options_set_hlsl_point_size_compat
public static void shaderc_spvc_compile_options_set_hlsl_point_size_compat(long options, boolean b)
If true, ignorePointSize
. Default is false.
-
shaderc_spvc_compile_options_set_hlsl_point_coord_compat
public static void shaderc_spvc_compile_options_set_hlsl_point_coord_compat(long options, boolean b)
If true, ignorePointCoord
. Default is false.
-
shaderc_spvc_compile_options_set_fixup_clipspace
public static void shaderc_spvc_compile_options_set_fixup_clipspace(long options, boolean b)
If true (default is false):- GLSL: map depth from Vulkan/D3D style to GL style, i.e.
[ 0,w] -> [-w,w]
- MSL : map depth from GL style to Vulkan/D3D style, i.e.
[-w,w] -> [ 0,w]
- HLSL: map depth from GL style to Vulkan/D3D style, i.e.
[-w,w] -> [ 0,w]
- GLSL: map depth from Vulkan/D3D style to GL style, i.e.
-
shaderc_spvc_compile_options_set_flip_vert_y
public static void shaderc_spvc_compile_options_set_flip_vert_y(long options, boolean b)
If true invertgl_Position.y
or equivalent.Default is false.
-
shaderc_spvc_compile_options_set_validate
public static void shaderc_spvc_compile_options_set_validate(long options, boolean b)
Set if validation should be performed. Default is true.
-
nshaderc_spvc_compile_options_set_for_fuzzing
public static long nshaderc_spvc_compile_options_set_for_fuzzing(long options, long data, long size)
Unsafe version of:compile_options_set_for_fuzzing
-
shaderc_spvc_compile_options_set_for_fuzzing
public static long shaderc_spvc_compile_options_set_for_fuzzing(long options, java.nio.ByteBuffer data)
Fill options with given data.- Returns:
- amount of data used, or zero if not enough data was given
-
nshaderc_spvc_compile_into_glsl
public static long nshaderc_spvc_compile_into_glsl(long compiler, long source, long source_len, long options)
Unsafe version of:compile_into_glsl
-
shaderc_spvc_compile_into_glsl
public static long shaderc_spvc_compile_into_glsl(long compiler, java.nio.IntBuffer source, long options)
Takes SPIR-V as a sequence of 32-bit words, validates it, then compiles to GLSL.
-
nshaderc_spvc_compile_into_hlsl
public static long nshaderc_spvc_compile_into_hlsl(long compiler, long source, long source_len, long options)
Unsafe version of:compile_into_hlsl
-
shaderc_spvc_compile_into_hlsl
public static long shaderc_spvc_compile_into_hlsl(long compiler, java.nio.IntBuffer source, long options)
Takes SPIR-V as a sequence of 32-bit words, validates it, then compiles to HLSL.
-
nshaderc_spvc_compile_into_msl
public static long nshaderc_spvc_compile_into_msl(long compiler, long source, long source_len, long options)
Unsafe version of:compile_into_msl
-
shaderc_spvc_compile_into_msl
public static long shaderc_spvc_compile_into_msl(long compiler, java.nio.IntBuffer source, long options)
Takes SPIR-V as a sequence of 32-bit words, validates it, then compiles to MSL.
-
nshaderc_spvc_compile_into_vulkan
public static long nshaderc_spvc_compile_into_vulkan(long compiler, long source, long source_len, long options)
Unsafe version of:compile_into_vulkan
-
shaderc_spvc_compile_into_vulkan
public static long shaderc_spvc_compile_into_vulkan(long compiler, java.nio.IntBuffer source, long options)
Takes SPIR-V as a sequence of 32-bit words, validates it, then compiles to Vulkan specific SPIR-V.
-
shaderc_spvc_result_release
public static void shaderc_spvc_result_release(long result)
Releases the resources held by the result object.It is invalid to use the result object for any further operations.
-
shaderc_spvc_result_get_status
public static int shaderc_spvc_result_get_status(long result)
Returns the compilation status, indicating whether the compilation succeeded, or failed due to some reasons, like invalid shader stage or compilation errors.
-
nshaderc_spvc_result_get_messages
public static long nshaderc_spvc_result_get_messages(long result)
Unsafe version of:result_get_messages
-
shaderc_spvc_result_get_messages
@Nullable public static java.lang.String shaderc_spvc_result_get_messages(long result)
Get validation/compilation error or informational messages.
-
nshaderc_spvc_result_get_string_output
public static long nshaderc_spvc_result_get_string_output(long result)
Unsafe version of:result_get_string_output
-
shaderc_spvc_result_get_string_output
@Nullable public static java.lang.String shaderc_spvc_result_get_string_output(long result)
Get validation/compilation result as a string.This is only supported compiling to GLSL, HSL, and MSL.
-
nshaderc_spvc_result_get_binary_output
public static long nshaderc_spvc_result_get_binary_output(long result)
Unsafe version of:result_get_binary_output
-
shaderc_spvc_result_get_binary_output
@Nullable public static java.nio.IntBuffer shaderc_spvc_result_get_binary_output(long result) @Nullable public static java.nio.IntBuffer shaderc_spvc_result_get_binary_output(long result, long length)
Get validation/compilation result as a binary buffer.This is only supported compiling to Vulkan.
-
shaderc_spvc_result_get_binary_length
public static int shaderc_spvc_result_get_binary_length(long result)
Get length of validation/compilation result as a binary buffer.This is only supported compiling to Vulkan.
-
-