Class Shaderc
- java.lang.Object
-
- org.lwjgl.util.shaderc.Shaderc
-
public class Shaderc extends java.lang.ObjectNative bindings to the libshaderc C API of the shaderc library.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classShaderc.FunctionsContains the function pointers loaded from the shadercSharedLibrary.
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.lwjgl.system.SharedLibrarygetLibrary()Returns the shadercSharedLibrary.static longnshaderc_assemble_into_spv(long compiler, long source_assembly, long source_assembly_size, long additional_options)Unsafe version of:assemble_into_spvstatic longnshaderc_compile_into_preprocessed_text(long compiler, long source_text, long source_text_size, int shader_kind, long input_file_name, long entry_point_name, long additional_options)Unsafe version of:compile_into_preprocessed_textstatic longnshaderc_compile_into_spv(long compiler, long source_text, long source_text_size, int shader_kind, long input_file_name, long entry_point_name, long additional_options)Unsafe version of:compile_into_spvstatic longnshaderc_compile_into_spv_assembly(long compiler, long source_text, long source_text_size, int shader_kind, long input_file_name, long entry_point_name, long additional_options)Unsafe version of:compile_into_spv_assemblystatic voidnshaderc_compile_options_add_macro_definition(long options, long name, long name_length, long value, long value_length)Unsafe version of:compile_options_add_macro_definitionstatic voidnshaderc_compile_options_set_hlsl_register_set_and_binding(long options, long reg, long set, long binding)Unsafe version of:compile_options_set_hlsl_register_set_and_bindingstatic voidnshaderc_compile_options_set_hlsl_register_set_and_binding_for_stage(long options, int shader_kind, long reg, long set, long binding)Unsafe version of:compile_options_set_hlsl_register_set_and_binding_for_stagestatic voidnshaderc_compile_options_set_include_callbacks(long options, long resolver, long result_releaser, long user_data)Unsafe version of:compile_options_set_include_callbacksstatic voidnshaderc_get_spv_version(long version, long revision)Unsafe version of:get_spv_versionstatic booleannshaderc_parse_version_profile(long str, long version, long profile)Unsafe version of:parse_version_profilestatic longnshaderc_result_get_bytes(long result)Unsafe version of:result_get_bytesstatic longnshaderc_result_get_error_message(long result)Unsafe version of:result_get_error_messagestatic longshaderc_assemble_into_spv(long compiler, java.lang.CharSequence source_assembly, long additional_options)Takes an assembly string of the format defined in the SPIRV-Tools project, assembles it into SPIR-V binary and ashaderc_compilation_result_twill be returned to hold the results.static longshaderc_assemble_into_spv(long compiler, java.nio.ByteBuffer source_assembly, long additional_options)Takes an assembly string of the format defined in the SPIRV-Tools project, assembles it into SPIR-V binary and ashaderc_compilation_result_twill be returned to hold the results.static longshaderc_compile_into_preprocessed_text(long compiler, java.lang.CharSequence source_text, int shader_kind, java.lang.CharSequence input_file_name, java.lang.CharSequence entry_point_name, long additional_options)Likecompile_into_spv, but the result contains preprocessed source code instead of a SPIR-V binary modulestatic longshaderc_compile_into_preprocessed_text(long compiler, java.nio.ByteBuffer source_text, int shader_kind, java.nio.ByteBuffer input_file_name, java.nio.ByteBuffer entry_point_name, long additional_options)Likecompile_into_spv, but the result contains preprocessed source code instead of a SPIR-V binary modulestatic longshaderc_compile_into_spv(long compiler, java.lang.CharSequence source_text, int shader_kind, java.lang.CharSequence input_file_name, java.lang.CharSequence entry_point_name, long additional_options)Takes a GLSL source string and the associated shader kind, input file name, compiles it according to the givenadditional_options.static longshaderc_compile_into_spv(long compiler, java.nio.ByteBuffer source_text, int shader_kind, java.nio.ByteBuffer input_file_name, java.nio.ByteBuffer entry_point_name, long additional_options)Takes a GLSL source string and the associated shader kind, input file name, compiles it according to the givenadditional_options.static longshaderc_compile_into_spv_assembly(long compiler, java.lang.CharSequence source_text, int shader_kind, java.lang.CharSequence input_file_name, java.lang.CharSequence entry_point_name, long additional_options)Likecompile_into_spv, but the result contains SPIR-V assembly text instead of a SPIR-V binary module.static longshaderc_compile_into_spv_assembly(long compiler, java.nio.ByteBuffer source_text, int shader_kind, java.nio.ByteBuffer input_file_name, java.nio.ByteBuffer entry_point_name, long additional_options)Likecompile_into_spv, but the result contains SPIR-V assembly text instead of a SPIR-V binary module.static voidshaderc_compile_options_add_macro_definition(long options, java.lang.CharSequence name, java.lang.CharSequence value)Adds a predefined macro to the compilation options.static voidshaderc_compile_options_add_macro_definition(long options, java.nio.ByteBuffer name, java.nio.ByteBuffer value)Adds a predefined macro to the compilation options.static longshaderc_compile_options_clone(long options)Returns a copy of the givenshaderc_compile_options_t.static longshaderc_compile_options_initialize()Returns a default-initializedshaderc_compile_options_tthat can be used to modify the functionality of a compiled module.static voidshaderc_compile_options_release(long options)Releases the compilation options.static voidshaderc_compile_options_set_auto_bind_uniforms(long options, boolean auto_bind)Sets whether the compiler should automatically assign bindings to uniforms that aren't already explicitly bound in the shader source.static voidshaderc_compile_options_set_auto_combined_image_sampler(long options, boolean upgrade)Sets whether the compiler should automatically remove sampler variables and convert image variables to combined image-sampler variables.static voidshaderc_compile_options_set_auto_map_locations(long options, boolean auto_map)Sets whether the compiler should automatically assign locations to uniform variables that don't have explicit locations in the shader source.static voidshaderc_compile_options_set_binding_base(long options, int kind, int base)Sets the base binding number used for for a uniform resource type when automatically assigning bindings.static voidshaderc_compile_options_set_binding_base_for_stage(long options, int shader_kind, int kind, int base)Likecompile_options_set_binding_base, but only takes effect when compiling a given shader stage.static voidshaderc_compile_options_set_forced_version_profile(long options, int version, int profile)Forces the GLSL language version and profile to a given pair.static voidshaderc_compile_options_set_generate_debug_info(long options)Sets the compiler mode to generate debug information in the output.static voidshaderc_compile_options_set_hlsl_functionality1(long options, boolean enable)Sets whether the compiler should enable extensionSPV_GOOGLE_hlsl_functionality1.static voidshaderc_compile_options_set_hlsl_io_mapping(long options, boolean hlsl_iomap)Sets whether the compiler should use HLSL IO mapping rules for bindings.static voidshaderc_compile_options_set_hlsl_offsets(long options, boolean hlsl_offsets)Sets whether the compiler should determine block member offsets using HLSL packing rules instead of standard GLSL rules.static voidshaderc_compile_options_set_hlsl_register_set_and_binding(long options, java.lang.CharSequence reg, java.lang.CharSequence set, java.lang.CharSequence binding)Likecompile_options_set_hlsl_register_set_and_binding_for_stage, but affects all shader stages.static voidshaderc_compile_options_set_hlsl_register_set_and_binding(long options, java.nio.ByteBuffer reg, java.nio.ByteBuffer set, java.nio.ByteBuffer binding)Likecompile_options_set_hlsl_register_set_and_binding_for_stage, but affects all shader stages.static voidshaderc_compile_options_set_hlsl_register_set_and_binding_for_stage(long options, int shader_kind, java.lang.CharSequence reg, java.lang.CharSequence set, java.lang.CharSequence binding)Sets a descriptor set and binding for an HLSL register in the given stage.static voidshaderc_compile_options_set_hlsl_register_set_and_binding_for_stage(long options, int shader_kind, java.nio.ByteBuffer reg, java.nio.ByteBuffer set, java.nio.ByteBuffer binding)Sets a descriptor set and binding for an HLSL register in the given stage.static voidshaderc_compile_options_set_include_callbacks(long options, ShadercIncludeResolveI resolver, ShadercIncludeResultReleaseI result_releaser, long user_data)Sets includer callback functions.static voidshaderc_compile_options_set_invert_y(long options, boolean enable)Sets whether the compiler should invertposition.Youtput in vertex shader.static voidshaderc_compile_options_set_limit(long options, int limit, int value)Sets a resource limit.static voidshaderc_compile_options_set_nan_clamp(long options, boolean enable)Sets whether the compiler generates code formaxandminbuiltins which, if given aNaNoperand, will return the other operand.static voidshaderc_compile_options_set_optimization_level(long options, int level)Sets the compiler optimization level to the given level.static voidshaderc_compile_options_set_source_language(long options, int lang)Sets the source language.static voidshaderc_compile_options_set_suppress_warnings(long options)Sets the compiler mode to suppress warnings, overriding warnings-as-errors mode.static voidshaderc_compile_options_set_target_env(long options, int target, int version)Sets the target shader environment, affecting which warnings or errors will be issued.static voidshaderc_compile_options_set_target_spirv(long options, int version)Sets the target SPIR-V version.static voidshaderc_compile_options_set_warnings_as_errors(long options)Sets the compiler mode to treat all warnings as errors.static longshaderc_compiler_initialize()Returns ashaderc_compiler_tthat can be used to compile modules.static voidshaderc_compiler_release(long compiler)Releases the resources held by theshaderc_compiler_t.static voidshaderc_get_spv_version(java.nio.IntBuffer version, java.nio.IntBuffer revision)Provides the version and revision of the SPIR-V which will be producedstatic booleanshaderc_parse_version_profile(java.lang.CharSequence str, java.nio.IntBuffer version, java.nio.IntBuffer profile)Parses the version and profile from a given null-terminated string containing both version and profile, like:'450core'.static booleanshaderc_parse_version_profile(java.nio.ByteBuffer str, java.nio.IntBuffer version, java.nio.IntBuffer profile)Parses the version and profile from a given null-terminated string containing both version and profile, like:'450core'.static java.nio.ByteBuffershaderc_result_get_bytes(long result)Returns the compilation output data bytes, either SPIR-V binary or char string.static java.nio.ByteBuffershaderc_result_get_bytes(long result, long length)Returns the compilation output data bytes, either SPIR-V binary or char string.static intshaderc_result_get_compilation_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.Stringshaderc_result_get_error_message(long result)Returns a null-terminated string that contains any error messages generated during the compilation.static longshaderc_result_get_length(long result)Returns the number of bytes of the compilation output data in the givenresultobject.static longshaderc_result_get_num_errors(long result)Returns the number of errors generated during the compilation.static longshaderc_result_get_num_warnings(long result)Returns the number of warnings generated during the compilation.static voidshaderc_result_release(long result)Releases the resources held by theresultobject.
-
-
-
Field Detail
-
shaderc_target_env_vulkan, shaderc_target_env_opengl, shaderc_target_env_opengl_compat, shaderc_target_env_webgpu, shaderc_target_env_default
shaderc_target_envEnum values:
target_env_vulkan- SPIR-V under Vulkan semanticstarget_env_opengl- SPIR-V under OpenGL semantics. SPIR-V code generation is not supported for shaders under OpenGL compatibility profile.target_env_opengl_compat- SPIR-V under OpenGL semantics, including compatibility profile functionstarget_env_webgpu- deprecated, SPIR-V under WebGPU semanticstarget_env_default
-
shaderc_env_version_vulkan_1_0, shaderc_env_version_vulkan_1_1, shaderc_env_version_vulkan_1_2, shaderc_env_version_vulkan_1_3, shaderc_env_version_opengl_4_5, shaderc_env_version_webgpu
shaderc_env_versionEnum values:
env_version_vulkan_1_0env_version_vulkan_1_1env_version_vulkan_1_2env_version_vulkan_1_3env_version_opengl_4_5env_version_webgpu- deprecated, WebGPU env never defined versions
-
shaderc_spirv_version_1_0, shaderc_spirv_version_1_1, shaderc_spirv_version_1_2, shaderc_spirv_version_1_3, shaderc_spirv_version_1_4, shaderc_spirv_version_1_5, shaderc_spirv_version_1_6
The known versions of SPIR-V. (shaderc_spirv_versionEnum values:
-
shaderc_compilation_status_success, shaderc_compilation_status_invalid_stage, shaderc_compilation_status_compilation_error, shaderc_compilation_status_internal_error, shaderc_compilation_status_null_result_object, shaderc_compilation_status_invalid_assembly, shaderc_compilation_status_validation_error, shaderc_compilation_status_transformation_error, shaderc_compilation_status_configuration_error
Indicate the status of a compilation. (shaderc_compilation_status)Enum values:
compilation_status_successcompilation_status_invalid_stage- error stage deductioncompilation_status_compilation_errorcompilation_status_internal_error- unexpected failurecompilation_status_null_result_objectcompilation_status_invalid_assemblycompilation_status_validation_errorcompilation_status_transformation_errorcompilation_status_configuration_error
-
shaderc_source_language_glsl, shaderc_source_language_hlsl
Source language kind. (shaderc_source_language)Enum values:
-
shaderc_vertex_shader, shaderc_fragment_shader, shaderc_compute_shader, shaderc_geometry_shader, shaderc_tess_control_shader, shaderc_tess_evaluation_shader, shaderc_glsl_vertex_shader, shaderc_glsl_fragment_shader, shaderc_glsl_compute_shader, shaderc_glsl_geometry_shader, shaderc_glsl_tess_control_shader, shaderc_glsl_tess_evaluation_shader, shaderc_glsl_infer_from_source, shaderc_glsl_default_vertex_shader, shaderc_glsl_default_fragment_shader, shaderc_glsl_default_compute_shader, shaderc_glsl_default_geometry_shader, shaderc_glsl_default_tess_control_shader, shaderc_glsl_default_tess_evaluation_shader, shaderc_spirv_assembly, shaderc_raygen_shader, shaderc_anyhit_shader, shaderc_closesthit_shader, shaderc_miss_shader, shaderc_intersection_shader, shaderc_callable_shader, shaderc_glsl_raygen_shader, shaderc_glsl_anyhit_shader, shaderc_glsl_closesthit_shader, shaderc_glsl_miss_shader, shaderc_glsl_intersection_shader, shaderc_glsl_callable_shader, shaderc_glsl_default_raygen_shader, shaderc_glsl_default_anyhit_shader, shaderc_glsl_default_closesthit_shader, shaderc_glsl_default_miss_shader, shaderc_glsl_default_intersection_shader, shaderc_glsl_default_callable_shader, shaderc_task_shader, shaderc_mesh_shader, shaderc_glsl_task_shader, shaderc_glsl_mesh_shader, shaderc_glsl_default_task_shader, shaderc_glsl_default_mesh_shader
shaderc_shader_kindEnum values:
vertex_shaderfragment_shader- Forced the compiler to compile the source code as a fragment shader.compute_shader- Forced the compiler to compile the source code as a compute shader.geometry_shader- Forced the compiler to compile the source code as a geometry shader.tess_control_shader- Forced the compiler to compile the source code as a tessellation control shader.tess_evaluation_shader- Forced the compiler to compile the source code as a tessellation evaluation shader.glsl_vertex_shader- Forced the compiler to compile the source code as a GLSL vertex shader.glsl_fragment_shader- Forced the compiler to compile the source code as a GLSL fragment shader.glsl_compute_shader- Forced the compiler to compile the source code as a GLSL compute shader.glsl_geometry_shader- Forced the compiler to compile the source code as a GLSL geometry shader.glsl_tess_control_shader- Forced the compiler to compile the source code as a GLSL tessellation control shader.glsl_tess_evaluation_shader- Forced the compiler to compile the source code as a GLSL tessellation evaluation shader.glsl_infer_from_source- Deduce the shader kind from #pragma annotation in the source code. Compiler will emit error if #pragma annotation is not found.glsl_default_vertex_shader- Default shader kinds. Compiler will fall back to compile the source code as the specified kind of shader when #pragma annotation is not found in the source code.glsl_default_fragment_shader- Default shader kinds. Compiler will fall back to compile the source code as the specified kind of shader when #pragma annotation is not found in the source code.glsl_default_compute_shader- Default shader kinds. Compiler will fall back to compile the source code as the specified kind of shader when #pragma annotation is not found in the source code.glsl_default_geometry_shader- Default shader kinds. Compiler will fall back to compile the source code as the specified kind of shader when #pragma annotation is not found in the source code.glsl_default_tess_control_shader- Default shader kinds. Compiler will fall back to compile the source code as the specified kind of shader when #pragma annotation is not found in the source code.glsl_default_tess_evaluation_shader- Default shader kinds. Compiler will fall back to compile the source code as the specified kind of shader when #pragma annotation is not found in the source code.spirv_assembly- Default shader kinds. Compiler will fall back to compile the source code as the specified kind of shader when #pragma annotation is not found in the source code.raygen_shaderanyhit_shaderclosesthit_shadermiss_shaderintersection_shadercallable_shaderglsl_raygen_shaderglsl_anyhit_shaderglsl_closesthit_shaderglsl_miss_shaderglsl_intersection_shaderglsl_callable_shaderglsl_default_raygen_shaderglsl_default_anyhit_shaderglsl_default_closesthit_shaderglsl_default_miss_shaderglsl_default_intersection_shaderglsl_default_callable_shadertask_shadermesh_shaderglsl_task_shaderglsl_mesh_shaderglsl_default_task_shaderglsl_default_mesh_shader
-
shaderc_profile_none, shaderc_profile_core, shaderc_profile_compatibility, shaderc_profile_es
shaderc_profileEnum values:
profile_none- Used if and only if GLSL version did not specify profiles.profile_coreprofile_compatibility- Disabled. This generates an error.profile_es
-
shaderc_optimization_level_zero, shaderc_optimization_level_size, shaderc_optimization_level_performance
Optimization level. (shaderc_optimization_level)Enum values:
optimization_level_zero- no optimizationoptimization_level_size- optimize towards reducing code sizeoptimization_level_performance- optimize towards performance
-
shaderc_limit_max_lights, shaderc_limit_max_clip_planes, shaderc_limit_max_texture_units, shaderc_limit_max_texture_coords, shaderc_limit_max_vertex_attribs, shaderc_limit_max_vertex_uniform_components, shaderc_limit_max_varying_floats, shaderc_limit_max_vertex_texture_image_units, shaderc_limit_max_combined_texture_image_units, shaderc_limit_max_texture_image_units, shaderc_limit_max_fragment_uniform_components, shaderc_limit_max_draw_buffers, shaderc_limit_max_vertex_uniform_vectors, shaderc_limit_max_varying_vectors, shaderc_limit_max_fragment_uniform_vectors, shaderc_limit_max_vertex_output_vectors, shaderc_limit_max_fragment_input_vectors, shaderc_limit_min_program_texel_offset, shaderc_limit_max_program_texel_offset, shaderc_limit_max_clip_distances, shaderc_limit_max_compute_work_group_count_x, shaderc_limit_max_compute_work_group_count_y, shaderc_limit_max_compute_work_group_count_z, shaderc_limit_max_compute_work_group_size_x, shaderc_limit_max_compute_work_group_size_y, shaderc_limit_max_compute_work_group_size_z, shaderc_limit_max_compute_uniform_components, shaderc_limit_max_compute_texture_image_units, shaderc_limit_max_compute_image_uniforms, shaderc_limit_max_compute_atomic_counters, shaderc_limit_max_compute_atomic_counter_buffers, shaderc_limit_max_varying_components, shaderc_limit_max_vertex_output_components, shaderc_limit_max_geometry_input_components, shaderc_limit_max_geometry_output_components, shaderc_limit_max_fragment_input_components, shaderc_limit_max_image_units, shaderc_limit_max_combined_image_units_and_fragment_outputs, shaderc_limit_max_combined_shader_output_resources, shaderc_limit_max_image_samples, shaderc_limit_max_vertex_image_uniforms, shaderc_limit_max_tess_control_image_uniforms, shaderc_limit_max_tess_evaluation_image_uniforms, shaderc_limit_max_geometry_image_uniforms, shaderc_limit_max_fragment_image_uniforms, shaderc_limit_max_combined_image_uniforms, shaderc_limit_max_geometry_texture_image_units, shaderc_limit_max_geometry_output_vertices, shaderc_limit_max_geometry_total_output_components, shaderc_limit_max_geometry_uniform_components, shaderc_limit_max_geometry_varying_components, shaderc_limit_max_tess_control_input_components, shaderc_limit_max_tess_control_output_components, shaderc_limit_max_tess_control_texture_image_units, shaderc_limit_max_tess_control_uniform_components, shaderc_limit_max_tess_control_total_output_components, shaderc_limit_max_tess_evaluation_input_components, shaderc_limit_max_tess_evaluation_output_components, shaderc_limit_max_tess_evaluation_texture_image_units, shaderc_limit_max_tess_evaluation_uniform_components, shaderc_limit_max_tess_patch_components, shaderc_limit_max_patch_vertices, shaderc_limit_max_tess_gen_level, shaderc_limit_max_viewports, shaderc_limit_max_vertex_atomic_counters, shaderc_limit_max_tess_control_atomic_counters, shaderc_limit_max_tess_evaluation_atomic_counters, shaderc_limit_max_geometry_atomic_counters, shaderc_limit_max_fragment_atomic_counters, shaderc_limit_max_combined_atomic_counters, shaderc_limit_max_atomic_counter_bindings, shaderc_limit_max_vertex_atomic_counter_buffers, shaderc_limit_max_tess_control_atomic_counter_buffers, shaderc_limit_max_tess_evaluation_atomic_counter_buffers, shaderc_limit_max_geometry_atomic_counter_buffers, shaderc_limit_max_fragment_atomic_counter_buffers, shaderc_limit_max_combined_atomic_counter_buffers, shaderc_limit_max_atomic_counter_buffer_size, shaderc_limit_max_transform_feedback_buffers, shaderc_limit_max_transform_feedback_interleaved_components, shaderc_limit_max_cull_distances, shaderc_limit_max_combined_clip_and_cull_distances, shaderc_limit_max_samples
Resource limits. (shaderc_limit)Enum values:
limit_max_lightslimit_max_clip_planeslimit_max_texture_unitslimit_max_texture_coordslimit_max_vertex_attribslimit_max_vertex_uniform_componentslimit_max_varying_floatslimit_max_vertex_texture_image_unitslimit_max_combined_texture_image_unitslimit_max_texture_image_unitslimit_max_fragment_uniform_componentslimit_max_draw_bufferslimit_max_vertex_uniform_vectorslimit_max_varying_vectorslimit_max_fragment_uniform_vectorslimit_max_vertex_output_vectorslimit_max_fragment_input_vectorslimit_min_program_texel_offsetlimit_max_program_texel_offsetlimit_max_clip_distanceslimit_max_compute_work_group_count_xlimit_max_compute_work_group_count_ylimit_max_compute_work_group_count_zlimit_max_compute_work_group_size_xlimit_max_compute_work_group_size_ylimit_max_compute_work_group_size_zlimit_max_compute_uniform_componentslimit_max_compute_texture_image_unitslimit_max_compute_image_uniformslimit_max_compute_atomic_counterslimit_max_compute_atomic_counter_bufferslimit_max_varying_componentslimit_max_vertex_output_componentslimit_max_geometry_input_componentslimit_max_geometry_output_componentslimit_max_fragment_input_componentslimit_max_image_unitslimit_max_combined_image_units_and_fragment_outputslimit_max_combined_shader_output_resourceslimit_max_image_sampleslimit_max_vertex_image_uniformslimit_max_tess_control_image_uniformslimit_max_tess_evaluation_image_uniformslimit_max_geometry_image_uniformslimit_max_fragment_image_uniformslimit_max_combined_image_uniformslimit_max_geometry_texture_image_unitslimit_max_geometry_output_verticeslimit_max_geometry_total_output_componentslimit_max_geometry_uniform_componentslimit_max_geometry_varying_componentslimit_max_tess_control_input_componentslimit_max_tess_control_output_componentslimit_max_tess_control_texture_image_unitslimit_max_tess_control_uniform_componentslimit_max_tess_control_total_output_componentslimit_max_tess_evaluation_input_componentslimit_max_tess_evaluation_output_componentslimit_max_tess_evaluation_texture_image_unitslimit_max_tess_evaluation_uniform_componentslimit_max_tess_patch_componentslimit_max_patch_verticeslimit_max_tess_gen_levellimit_max_viewportslimit_max_vertex_atomic_counterslimit_max_tess_control_atomic_counterslimit_max_tess_evaluation_atomic_counterslimit_max_geometry_atomic_counterslimit_max_fragment_atomic_counterslimit_max_combined_atomic_counterslimit_max_atomic_counter_bindingslimit_max_vertex_atomic_counter_bufferslimit_max_tess_control_atomic_counter_bufferslimit_max_tess_evaluation_atomic_counter_bufferslimit_max_geometry_atomic_counter_bufferslimit_max_fragment_atomic_counter_bufferslimit_max_combined_atomic_counter_bufferslimit_max_atomic_counter_buffer_sizelimit_max_transform_feedback_bufferslimit_max_transform_feedback_interleaved_componentslimit_max_cull_distanceslimit_max_combined_clip_and_cull_distanceslimit_max_samples
-
shaderc_uniform_kind_image, shaderc_uniform_kind_sampler, shaderc_uniform_kind_texture, shaderc_uniform_kind_buffer, shaderc_uniform_kind_storage_buffer, shaderc_uniform_kind_unordered_access_view
Uniform resource kinds. In Vulkan, uniform resources are bound to the pipeline via descriptors with numbered bindings and sets.(
shaderc_uniform_kind)Enum values:
uniform_kind_image- Image and image buffer.uniform_kind_sampler- Pure sampler.uniform_kind_texture- Sampled texture in GLSL, and Shader Resource View in HLSL.uniform_kind_buffer- Uniform Buffer Object (UBO) in GLSL. Cbuffer in HLSL.uniform_kind_storage_buffer- Shader Storage Buffer Object (SSBO) in GLSL.uniform_kind_unordered_access_view- Unordered Access View, in HLSL. (Writable storage image or storage buffer.)
-
shaderc_include_type_relative, shaderc_include_type_standard
The kinds of include requests.(
enum shaderc_include_type)Enum values:
include_type_relative- E.g. #include "source"include_type_standard- E.g. #include <source>
-
-
Method Detail
-
getLibrary
public static org.lwjgl.system.SharedLibrary getLibrary()
Returns the shadercSharedLibrary.
-
shaderc_compiler_initialize
public static long shaderc_compiler_initialize()
Returns ashaderc_compiler_tthat can be used to compile modules.A return of
NULLindicates that there was an error initializing the compiler. Any function operating onshaderc_compiler_tmust 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_compiler_release
public static void shaderc_compiler_release(long compiler)
Releases the resources held by theshaderc_compiler_t.After this call it is invalid to make any future calls to functions involving this
shaderc_compiler_t.
-
shaderc_compile_options_initialize
public static long shaderc_compile_options_initialize()
Returns a default-initializedshaderc_compile_options_tthat can be used to modify the functionality of a compiled module.A return of
NULLindicates that there was an error initializing the options. Any function operating onshaderc_compile_options_tmust offer the basic thread-safety guarantee.
-
shaderc_compile_options_clone
public static long shaderc_compile_options_clone(long options)
Returns a copy of the givenshaderc_compile_options_t.If
NULLis passed as the parameter the call is the same ascompile_options_initialize.
-
shaderc_compile_options_release
public static void shaderc_compile_options_release(long options)
Releases the compilation options.It is invalid to use the given
shaderc_compile_options_tobject in any future calls. It is safe to passNULLto this function, and doing such will have no effect.
-
nshaderc_compile_options_add_macro_definition
public static void nshaderc_compile_options_add_macro_definition(long options, long name, long name_length, long value, long value_length)Unsafe version of:compile_options_add_macro_definition
-
shaderc_compile_options_add_macro_definition
public static void shaderc_compile_options_add_macro_definition(long options, java.nio.ByteBuffer name, @Nullable java.nio.ByteBuffer value) public static void shaderc_compile_options_add_macro_definition(long options, java.lang.CharSequence name, @Nullable java.lang.CharSequence value)Adds a predefined macro to the compilation options.This has the same effect as passing
-Dname=valueto the command-line compiler. IfvalueisNULL, it has the same effect as passing-Dnameto the command-line compiler. If a macro definition with the same name has previously been added, the value is replaced with the new value. The macro name and value are passed in with char pointers, which point to their data, and the lengths of their data. The stringsnameandvaluemust remain valid for the duration of the call, but can be modified or deleted after this function has returned. In case of adding a valueless macro, thevalueargument should benull.
-
shaderc_compile_options_set_source_language
public static void shaderc_compile_options_set_source_language(long options, int lang)Sets the source language.The default is GLSL.
-
shaderc_compile_options_set_generate_debug_info
public static void shaderc_compile_options_set_generate_debug_info(long options)
Sets the compiler mode to generate debug information in the output.
-
shaderc_compile_options_set_optimization_level
public static void shaderc_compile_options_set_optimization_level(long options, int level)Sets the compiler optimization level to the given level.Only the last one takes effect if multiple calls of this function exist.
-
shaderc_compile_options_set_forced_version_profile
public static void shaderc_compile_options_set_forced_version_profile(long options, int version, int profile)Forces the GLSL language version and profile to a given pair.The
versionnumber is the same as would appear in the #version annotation in the source. Theversionandprofilespecified here override the #version annotation in the source. Useprofile: 'shaderc_profile_none'for GLSL versions that do not define profiles, e.g. versions below 150.
-
nshaderc_compile_options_set_include_callbacks
public static void nshaderc_compile_options_set_include_callbacks(long options, long resolver, long result_releaser, long user_data)Unsafe version of:compile_options_set_include_callbacks
-
shaderc_compile_options_set_include_callbacks
public static void shaderc_compile_options_set_include_callbacks(long options, @Nullable ShadercIncludeResolveI resolver, @Nullable ShadercIncludeResultReleaseI result_releaser, long user_data)Sets includer callback functions.
-
shaderc_compile_options_set_suppress_warnings
public static void shaderc_compile_options_set_suppress_warnings(long options)
Sets the compiler mode to suppress warnings, overriding warnings-as-errors mode.When both suppress-warnings and warnings-as-errors modes are turned on, warning messages will be inhibited, and will not be emitted as error messages.
-
shaderc_compile_options_set_target_env
public static void shaderc_compile_options_set_target_env(long options, int target, int version)Sets the target shader environment, affecting which warnings or errors will be issued.The
versionwill be for distinguishing between different versions of the target environment. Theversionvalue should be either 0 or a value listed inshaderc_env_version. The 0 value maps to Vulkan 1.0 iftargetis Vulkan, and it maps to OpenGL 4.5 iftargetis OpenGL.
-
shaderc_compile_options_set_target_spirv
public static void shaderc_compile_options_set_target_spirv(long options, int version)Sets the target SPIR-V version.The generated module will use this version of SPIR-V. Each target environment determines what versions of SPIR-V it can consume. Defaults to the highest version of SPIR-V 1.0 which is required to be supported by the target environment. E.g. Default to SPIR-V 1.0 for Vulkan 1.0 and SPIR-V 1.3 for Vulkan 1.1.
-
shaderc_compile_options_set_warnings_as_errors
public static void shaderc_compile_options_set_warnings_as_errors(long options)
Sets the compiler mode to treat all warnings as errors.Note the suppress-warnings mode overrides this option, i.e. if both warning-as-errors and suppress-warnings modes are set, warnings will not be emitted as error messages.
-
shaderc_compile_options_set_limit
public static void shaderc_compile_options_set_limit(long options, int limit, int value)Sets a resource limit.
-
shaderc_compile_options_set_auto_bind_uniforms
public static void shaderc_compile_options_set_auto_bind_uniforms(long options, boolean auto_bind)Sets whether the compiler should automatically assign bindings to uniforms that aren't already explicitly bound in the shader source.
-
shaderc_compile_options_set_auto_combined_image_sampler
public static void shaderc_compile_options_set_auto_combined_image_sampler(long options, boolean upgrade)Sets whether the compiler should automatically remove sampler variables and convert image variables to combined image-sampler variables.
-
shaderc_compile_options_set_hlsl_io_mapping
public static void shaderc_compile_options_set_hlsl_io_mapping(long options, boolean hlsl_iomap)Sets whether the compiler should use HLSL IO mapping rules for bindings.Defaults to
false.
-
shaderc_compile_options_set_hlsl_offsets
public static void shaderc_compile_options_set_hlsl_offsets(long options, boolean hlsl_offsets)Sets whether the compiler should determine block member offsets using HLSL packing rules instead of standard GLSL rules.Defaults to
false. Only affects GLSL compilation. HLSL rules are always used when compiling HLSL.
-
shaderc_compile_options_set_binding_base
public static void shaderc_compile_options_set_binding_base(long options, int kind, int base)Sets the base binding number used for for a uniform resource type when automatically assigning bindings.For GLSL compilation, sets the lowest automatically assigned number. For HLSL compilation, the register number assigned to the resource is added to this specified base.
-
shaderc_compile_options_set_binding_base_for_stage
public static void shaderc_compile_options_set_binding_base_for_stage(long options, int shader_kind, int kind, int base)Likecompile_options_set_binding_base, but only takes effect when compiling a given shader stage.The stage is assumed to be one of vertex, fragment, tessellation evaluation, tesselation control, geometry, or compute.
-
shaderc_compile_options_set_auto_map_locations
public static void shaderc_compile_options_set_auto_map_locations(long options, boolean auto_map)Sets whether the compiler should automatically assign locations to uniform variables that don't have explicit locations in the shader source.
-
nshaderc_compile_options_set_hlsl_register_set_and_binding_for_stage
public static void nshaderc_compile_options_set_hlsl_register_set_and_binding_for_stage(long options, int shader_kind, long reg, long set, long binding)Unsafe version of:compile_options_set_hlsl_register_set_and_binding_for_stage
-
shaderc_compile_options_set_hlsl_register_set_and_binding_for_stage
public static void shaderc_compile_options_set_hlsl_register_set_and_binding_for_stage(long options, int shader_kind, java.nio.ByteBuffer reg, java.nio.ByteBuffer set, java.nio.ByteBuffer binding) public static void shaderc_compile_options_set_hlsl_register_set_and_binding_for_stage(long options, int shader_kind, java.lang.CharSequence reg, java.lang.CharSequence set, java.lang.CharSequence binding)Sets a descriptor set and binding for an HLSL register in the given stage. This method keeps a copy of the string data.
-
nshaderc_compile_options_set_hlsl_register_set_and_binding
public static void nshaderc_compile_options_set_hlsl_register_set_and_binding(long options, long reg, long set, long binding)Unsafe version of:compile_options_set_hlsl_register_set_and_binding
-
shaderc_compile_options_set_hlsl_register_set_and_binding
public static void shaderc_compile_options_set_hlsl_register_set_and_binding(long options, java.nio.ByteBuffer reg, java.nio.ByteBuffer set, java.nio.ByteBuffer binding) public static void shaderc_compile_options_set_hlsl_register_set_and_binding(long options, java.lang.CharSequence reg, java.lang.CharSequence set, java.lang.CharSequence binding)Likecompile_options_set_hlsl_register_set_and_binding_for_stage, but affects all shader stages.
-
shaderc_compile_options_set_hlsl_functionality1
public static void shaderc_compile_options_set_hlsl_functionality1(long options, boolean enable)Sets whether the compiler should enable extensionSPV_GOOGLE_hlsl_functionality1.
-
shaderc_compile_options_set_invert_y
public static void shaderc_compile_options_set_invert_y(long options, boolean enable)Sets whether the compiler should invertposition.Youtput in vertex shader.
-
shaderc_compile_options_set_nan_clamp
public static void shaderc_compile_options_set_nan_clamp(long options, boolean enable)Sets whether the compiler generates code formaxandminbuiltins which, if given aNaNoperand, will return the other operand.Similarly, the
clampbuiltin will favour the non-NaNoperands, as ifclampwere implemented as a composition ofmaxandmin.
-
nshaderc_compile_into_spv
public static long nshaderc_compile_into_spv(long compiler, long source_text, long source_text_size, int shader_kind, long input_file_name, long entry_point_name, long additional_options)Unsafe version of:compile_into_spv
-
shaderc_compile_into_spv
public static long shaderc_compile_into_spv(long compiler, java.nio.ByteBuffer source_text, int shader_kind, java.nio.ByteBuffer input_file_name, java.nio.ByteBuffer entry_point_name, long additional_options) public static long shaderc_compile_into_spv(long compiler, java.lang.CharSequence source_text, int shader_kind, java.lang.CharSequence input_file_name, java.lang.CharSequence entry_point_name, long additional_options)Takes a GLSL source string and the associated shader kind, input file name, compiles it according to the givenadditional_options.If the shader kind is not set to a specified kind, but
glsl_infer_from_source, the compiler will try to deduce the shader kind from the source string and a failure in deducing will generate an error. Currently only #pragma annotation is supported. If the shader kind is set to one of the default shader kinds, the compiler will fall back to the default shader kind in case it failed to deduce the shader kind from source string. Theinput_file_nameis a null-termintated string. It is used as a tag to identify the source string in cases like emitting error messages. It doesn't have to be a 'file name'. The source string will be compiled into SPIR-V binary and ashaderc_compilation_result_twill be returned to hold the results. Theentry_point_namenull-terminated string defines the name of the entry point to associate with this GLSL source. If theadditional_optionsparameter is notNULL, then the compilation is modified by any options present. May be safely called from multiple threads without explicit synchronization. If there was failure in allocating the compiler object,NULLwill be returned.
-
nshaderc_compile_into_spv_assembly
public static long nshaderc_compile_into_spv_assembly(long compiler, long source_text, long source_text_size, int shader_kind, long input_file_name, long entry_point_name, long additional_options)Unsafe version of:compile_into_spv_assembly
-
shaderc_compile_into_spv_assembly
public static long shaderc_compile_into_spv_assembly(long compiler, java.nio.ByteBuffer source_text, int shader_kind, java.nio.ByteBuffer input_file_name, java.nio.ByteBuffer entry_point_name, long additional_options) public static long shaderc_compile_into_spv_assembly(long compiler, java.lang.CharSequence source_text, int shader_kind, java.lang.CharSequence input_file_name, java.lang.CharSequence entry_point_name, long additional_options)Likecompile_into_spv, but the result contains SPIR-V assembly text instead of a SPIR-V binary module.The SPIR-V assembly syntax is as defined by the SPIRV-Tools open source project.
-
nshaderc_compile_into_preprocessed_text
public static long nshaderc_compile_into_preprocessed_text(long compiler, long source_text, long source_text_size, int shader_kind, long input_file_name, long entry_point_name, long additional_options)Unsafe version of:compile_into_preprocessed_text
-
shaderc_compile_into_preprocessed_text
public static long shaderc_compile_into_preprocessed_text(long compiler, java.nio.ByteBuffer source_text, int shader_kind, java.nio.ByteBuffer input_file_name, java.nio.ByteBuffer entry_point_name, long additional_options) public static long shaderc_compile_into_preprocessed_text(long compiler, java.lang.CharSequence source_text, int shader_kind, java.lang.CharSequence input_file_name, java.lang.CharSequence entry_point_name, long additional_options)Likecompile_into_spv, but the result contains preprocessed source code instead of a SPIR-V binary module
-
nshaderc_assemble_into_spv
public static long nshaderc_assemble_into_spv(long compiler, long source_assembly, long source_assembly_size, long additional_options)Unsafe version of:assemble_into_spv
-
shaderc_assemble_into_spv
public static long shaderc_assemble_into_spv(long compiler, java.nio.ByteBuffer source_assembly, long additional_options) public static long shaderc_assemble_into_spv(long compiler, java.lang.CharSequence source_assembly, long additional_options)Takes an assembly string of the format defined in the SPIRV-Tools project, assembles it into SPIR-V binary and ashaderc_compilation_result_twill be returned to hold the results. The assembling will pick options suitable for assembling specified in theadditional_optionsparameter. May be safely called from multiple threads without explicit synchronization. If there was failure in allocating the compiler object,NULLwill be returned.
-
shaderc_result_release
public static void shaderc_result_release(long result)
Releases the resources held by theresultobject.It is invalid to use the result object for any further operations.
-
shaderc_result_get_length
public static long shaderc_result_get_length(long result)
Returns the number of bytes of the compilation output data in the givenresultobject.
-
shaderc_result_get_num_warnings
public static long shaderc_result_get_num_warnings(long result)
Returns the number of warnings generated during the compilation.
-
shaderc_result_get_num_errors
public static long shaderc_result_get_num_errors(long result)
Returns the number of errors generated during the compilation.
-
shaderc_result_get_compilation_status
public static int shaderc_result_get_compilation_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_result_get_bytes
public static long nshaderc_result_get_bytes(long result)
Unsafe version of:result_get_bytes
-
shaderc_result_get_bytes
@Nullable public static java.nio.ByteBuffer shaderc_result_get_bytes(long result) @Nullable public static java.nio.ByteBuffer shaderc_result_get_bytes(long result, long length)Returns the compilation output data bytes, either SPIR-V binary or char string.When the source string is compiled into SPIR-V binary, this is guaranteed to be castable to a
uint32_t*. If the result contains assembly text or preprocessed source text, the pointer will point to the resulting array of characters.
-
nshaderc_result_get_error_message
public static long nshaderc_result_get_error_message(long result)
Unsafe version of:result_get_error_message
-
shaderc_result_get_error_message
@Nullable public static java.lang.String shaderc_result_get_error_message(long result)
Returns a null-terminated string that contains any error messages generated during the compilation.
-
nshaderc_get_spv_version
public static void nshaderc_get_spv_version(long version, long revision)Unsafe version of:get_spv_version
-
shaderc_get_spv_version
public static void shaderc_get_spv_version(java.nio.IntBuffer version, java.nio.IntBuffer revision)Provides the version and revision of the SPIR-V which will be produced
-
nshaderc_parse_version_profile
public static boolean nshaderc_parse_version_profile(long str, long version, long profile)Unsafe version of:parse_version_profile
-
shaderc_parse_version_profile
public static boolean shaderc_parse_version_profile(java.nio.ByteBuffer str, java.nio.IntBuffer version, java.nio.IntBuffer profile) public static boolean shaderc_parse_version_profile(java.lang.CharSequence str, java.nio.IntBuffer version, java.nio.IntBuffer profile)Parses the version and profile from a given null-terminated string containing both version and profile, like:'450core'.Returns false if the string can not be parsed. Returns true when the parsing succeeds. The parsed version and profile are returned through arguments.
-
-