|
ReactOS 0.4.17-dev-934-g091855f
|
#include "vkd3d_shader_private.h"#include "vkd3d_version.h"#include "hlsl.h"#include <stdio.h>#include <math.h>
Go to the source code of this file.
Classes | |
| struct | shader_dump_data |
| struct | vkd3d_shader_scan_context |
| struct | vkd3d_shader_scan_context::vkd3d_shader_cf_info |
Variables | |
| static const struct vkd3d_debug_option | vkd3d_shader_config_options [] |
| size_t bytecode_align | ( | struct vkd3d_bytecode_buffer * | buffer | ) |
Definition at line 370 of file vkd3d_shader_main.c.
Referenced by add_section(), bytecode_put_bytes(), bytecode_reserve_bytes(), shader_write_root_parameters(), vkd3d_shader_serialize_dxbc(), write_sm1_type(), write_sm1_uniforms(), write_sm4_rdef(), and write_sm4_type().
| size_t bytecode_put_bytes | ( | struct vkd3d_bytecode_buffer * | buffer, |
| const void * | bytes, | ||
| size_t | size | ||
| ) |
Definition at line 402 of file vkd3d_shader_main.c.
Referenced by d3dbc_compile(), hlsl_fx_2_write(), hlsl_fx_4_write(), hlsl_fx_5_write(), put_f32(), put_string(), put_u32(), vkd3d_shader_serialize_dxbc(), write_fx_2_object_initializer(), and write_fx_2_string().
| size_t bytecode_put_bytes_unaligned | ( | struct vkd3d_bytecode_buffer * | buffer, |
| const void * | bytes, | ||
| size_t | size | ||
| ) |
Definition at line 385 of file vkd3d_shader_main.c.
Referenced by bytecode_put_bytes(), hlsl_fx_4_write(), hlsl_fx_5_write(), put_u32_unaligned(), write_fx_2_string(), and write_fx_4_string().
| size_t bytecode_reserve_bytes | ( | struct vkd3d_bytecode_buffer * | buffer, |
| size_t | size | ||
| ) |
Definition at line 408 of file vkd3d_shader_main.c.
Referenced by write_sm1_uniforms(), and write_sm4_rdef().
|
static |
Definition at line 426 of file vkd3d_shader_main.c.
Referenced by set_string(), and set_u32().
Definition at line 26 of file vkd3d_shader_main.c.
Referenced by vkd3d_parse_integer().
|
static |
Definition at line 1693 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile().
|
static |
Definition at line 1467 of file vkd3d_shader_main.c.
Referenced by vsir_program_scan().
|
static |
Definition at line 544 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile(), and vkd3d_shader_scan().
|
static |
Definition at line 1057 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_combined_sampler_usage().
|
static |
Definition at line 575 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile(), and vkd3d_shader_scan().
| void set_string | ( | struct vkd3d_bytecode_buffer * | buffer, |
| size_t | offset, | ||
| const char * | string, | ||
| size_t | length | ||
| ) |
Definition at line 441 of file vkd3d_shader_main.c.
| void set_u32 | ( | struct vkd3d_bytecode_buffer * | buffer, |
| size_t | offset, | ||
| uint32_t | value | ||
| ) |
Definition at line 436 of file vkd3d_shader_main.c.
Referenced by hlsl_fx_2_write(), hlsl_fx_4_write(), hlsl_fx_5_write(), shader_write_root_parameters(), shader_write_root_signature(), tpf_write_shdr(), tpf_write_signature(), vkd3d_shader_serialize_dxbc(), vkd3d_shader_serialize_root_signature(), write_fx_2_annotations(), write_fx_2_technique(), write_fx_4_annotations(), write_fx_4_buffer(), write_fx_4_numeric_variable(), write_fx_4_state_assignment(), write_fx_4_state_block(), write_fx_4_technique(), write_group(), write_sm1_uniforms(), write_sm4_instruction(), and write_sm4_rdef().
|
static |
Definition at line 500 of file vkd3d_shader_main.c.
Referenced by fill_shader_dump_data().
|
static |
Definition at line 518 of file vkd3d_shader_main.c.
Referenced by fill_shader_dump_data().
| bool shader_instruction_array_add_icb | ( | struct vkd3d_shader_instruction_array * | instructions, |
| struct vkd3d_shader_immediate_constant_buffer * | icb | ||
| ) |
Definition at line 2171 of file vkd3d_shader_main.c.
Referenced by shader_sm4_read_shader_data(), and value_allocate_constant_array().
|
static |
Definition at line 2202 of file vkd3d_shader_main.c.
Referenced by shader_instruction_array_clone_instruction().
| bool shader_instruction_array_clone_instruction | ( | struct vkd3d_shader_instruction_array * | instructions, |
| unsigned int | dst, | ||
| unsigned int | src | ||
| ) |
Definition at line 2244 of file vkd3d_shader_main.c.
Referenced by flattener_flatten_phases().
|
static |
Definition at line 2222 of file vkd3d_shader_main.c.
Referenced by shader_instruction_array_clone_instruction(), and shader_register_clone_relative_addresses().
| void shader_instruction_array_destroy | ( | struct vkd3d_shader_instruction_array * | instructions | ) |
Definition at line 2259 of file vkd3d_shader_main.c.
Referenced by spirv_compiler_generate_spirv(), and vsir_program_cleanup().
| bool shader_instruction_array_init | ( | struct vkd3d_shader_instruction_array * | instructions, |
| unsigned int | reserve | ||
| ) |
Definition at line 2132 of file vkd3d_shader_main.c.
Referenced by vsir_program_init().
| bool shader_instruction_array_insert_at | ( | struct vkd3d_shader_instruction_array * | instructions, |
| unsigned int | idx, | ||
| unsigned int | count | ||
| ) |
Definition at line 2154 of file vkd3d_shader_main.c.
Referenced by insert_alpha_test_before_ret(), insert_clip_planes_before_ret(), insert_point_size_before_ret(), vsir_program_ensure_diffuse(), vsir_program_ensure_ret(), vsir_program_insert_point_coord(), vsir_program_insert_point_size_clamp(), vsir_program_lower_ifc(), vsir_program_lower_precise_mad(), vsir_program_lower_sm1_sincos(), vsir_program_lower_texkill(), and vsir_program_remap_output_signature().
| bool shader_instruction_array_reserve | ( | struct vkd3d_shader_instruction_array * | instructions, |
| unsigned int | reserve | ||
| ) |
Definition at line 2143 of file vkd3d_shader_main.c.
Referenced by control_point_normaliser_emit_hs_input(), d3dbc_parse(), flattener_flatten_phases(), generate_vsir_add_program_instruction(), shader_instruction_array_init(), shader_instruction_array_insert_at(), sm1_generate_vsir_constant_defs(), sm1_generate_vsir_sampler_dcls(), sm6_parser_require_space(), tpf_parse(), and vsir_program_flatten_hull_shader_phases().
|
static |
Definition at line 2094 of file vkd3d_shader_main.c.
Referenced by shader_instruction_array_destroy().
| void * shader_param_allocator_get | ( | struct vkd3d_shader_param_allocator * | allocator, |
| unsigned int | count | ||
| ) |
Definition at line 2106 of file vkd3d_shader_main.c.
Referenced by shader_dst_param_allocator_get(), and shader_src_param_allocator_get().
|
static |
Definition at line 2084 of file vkd3d_shader_main.c.
Referenced by shader_instruction_array_init().
|
static |
Definition at line 2073 of file vkd3d_shader_main.c.
Referenced by shader_param_allocator_get().
|
static |
Definition at line 2185 of file vkd3d_shader_main.c.
Referenced by shader_instruction_array_clone_dst_params(), and shader_instruction_array_clone_src_params().
| void shader_signature_cleanup | ( | struct shader_signature * | signature | ) |
Definition at line 1846 of file vkd3d_shader_main.c.
Referenced by free_dxbc_shader_desc(), isgn_handler(), sm6_parser_init(), sm6_parser_read_signature(), spirv_compiler_destroy(), tpf_parse(), vkd3d_shader_parse_input_signature(), and vsir_program_cleanup().
Definition at line 37 of file vkd3d_shader_main.c.
| static void VKD3D_PRINTF_FUNC | ( | 3 | , |
| 4 | |||
| ) |
Definition at line 616 of file vkd3d_shader_main.c.
| void vkd3d_shader_build_varying_map | ( | const struct vkd3d_shader_signature * | output_signature, |
| const struct vkd3d_shader_signature * | input_signature, | ||
| unsigned int * | count, | ||
| struct vkd3d_shader_varying_map * | varyings | ||
| ) |
Build a mapping of output varyings in a shader stage to input varyings in the following shader stage.
This mapping should be used in struct vkd3d_shader_varying_map_info to compile the first shader.
| output_signature | The output signature of the first shader. |
| input_signature | The input signature of the second shader. |
| count | On output, contains the number of entries written into "varyings". |
| varyings | Pointer to an output array of varyings. This must point to space for N varyings, where N is the number of elements in the input signature. |
Definition at line 2271 of file vkd3d_shader_main.c.
Referenced by shader_spirv_compile_arguments_init().
| void vkd3d_shader_code_from_string_buffer | ( | struct vkd3d_shader_code * | code, |
| struct vkd3d_string_buffer * | buffer | ||
| ) |
Definition at line 235 of file vkd3d_shader_main.c.
Referenced by d3d_asm_compile(), fx_parse(), and msl_generator_generate().
| int vkd3d_shader_compile | ( | const struct vkd3d_shader_compile_info * | compile_info, |
| struct vkd3d_shader_code * | out, | ||
| char ** | messages | ||
| ) |
Transform a form of GPU shader source code or byte code into another form of source code or byte code.
This version of vkd3d-shader supports the following transformations:
Supported transformations can also be detected at runtime with the functions vkd3d_shader_get_supported_source_types() and vkd3d_shader_get_supported_target_types().
Depending on the source and target types, this function may support the following chained structures:
| compile_info | A chained structure containing compilation parameters. |
| out | A pointer to a vkd3d_shader_code structure in which the compiled code will be stored. The compiled shader is allocated by vkd3d-shader and should be freed with vkd3d_shader_free_shader_code() when no longer needed. |
| messages | Optional output location for error or informational messages produced by the compiler. This string is null-terminated and UTF-8 encoded. The messages are allocated by vkd3d-shader and should be freed with vkd3d_shader_free_messages() when no longer needed. The messages returned can be regulated with the log_level member of struct vkd3d_shader_compile_info. Regardless of the requested level, if this parameter is NULL, no compilation messages will be returned. If no messages are produced by the compiler, this parameter may receive NULL instead of a valid string pointer. |
Definition at line 1708 of file vkd3d_shader_main.c.
Referenced by compile_hlsl_cs(), compile_hlsl_shader(), create_shader_stage(), D3DCompile2(), D3DDisassemble(), fx_4_parse_shader_initializer(), shader_glsl_generate_vkd3d_shader(), shader_spirv_compile_shader(), and shader_trace().
|
static |
Definition at line 455 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile(), and vkd3d_shader_scan().
| void vkd3d_shader_error | ( | struct vkd3d_shader_message_context * | context, |
| const struct vkd3d_shader_location * | location, | ||
| enum vkd3d_shader_error | error, | ||
| const char * | format, | ||
| ... | |||
| ) |
Definition at line 360 of file vkd3d_shader_main.c.
| struct vkd3d_shader_signature_element * vkd3d_shader_find_signature_element | ( | const struct vkd3d_shader_signature * | signature, |
| const char * | semantic_name, | ||
| unsigned int | semantic_index, | ||
| unsigned int | stream_index | ||
| ) |
Find a single element of a parsed input signature.
| signature | The parsed input signature. This structure is normally populated by vkd3d_shader_parse_input_signature(). |
| semantic_name | Semantic name of the desired element. This function performs a case-insensitive comparison with respect to the ASCII plane. |
| semantic_index | Semantic index of the desired element. |
| stream_index | Geometry shader stream index of the desired element. If the signature is not a geometry shader output signature, this parameter must be set to 0. |
Definition at line 1885 of file vkd3d_shader_main.c.
Referenced by d3d12_pipeline_state_init_graphics(), and vkd3d_shader_build_varying_map().
Free shader messages allocated by another vkd3d-shader function, such as vkd3d_shader_compile().
| messages | Messages to free. This pointer is optional and may be NULL, in which case no action will be taken. |
Definition at line 728 of file vkd3d_shader_main.c.
Referenced by compile_hlsl_shader(), D3DCompile2(), D3DDisassemble(), preprocess_shader(), shader_glsl_generate_vkd3d_shader(), shader_spirv_compile_shader(), shader_spirv_scan_shader(), shader_trace(), vkd3d_serialize_root_signature(), and vkd3d_serialize_versioned_root_signature().
| void vkd3d_shader_free_root_signature | ( | struct vkd3d_shader_versioned_root_signature_desc * | root_signature | ) |
Free a structural representation of a shader root signature allocated by vkd3d_shader_convert_root_signature() or vkd3d_shader_parse_root_signature().
This function may free members of struct vkd3d_shader_versioned_root_signature_desc, but does not free the structure itself.
| root_signature | Signature description to free. |
Definition at line 1825 of file vkd3d_shader_main.c.
Referenced by d3d12_root_signature_create(), d3d12_root_signature_deserializer_Release(), d3d12_versioned_root_signature_deserializer_Release(), vkd3d_parse_root_signature_v_1_0(), and vkd3d_shader_parse_root_signature().
|
static |
Definition at line 1791 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_free_root_signature().
|
static |
Definition at line 1808 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_free_root_signature().
| void vkd3d_shader_free_scan_combined_resource_sampler_info | ( | struct vkd3d_shader_scan_combined_resource_sampler_info * | info | ) |
Free members of struct vkd3d_shader_scan_combined_resource_sampler_info allocated by vkd3d_shader_scan().
This function may free members of vkd3d_shader_scan_combined_resource_sampler_info, but does not free the structure itself.
| info | Combined resource-sampler information to free. |
Definition at line 1760 of file vkd3d_shader_main.c.
Referenced by vsir_program_compile(), and vsir_program_scan().
| void vkd3d_shader_free_scan_descriptor_info | ( | struct vkd3d_shader_scan_descriptor_info * | scan_descriptor_info | ) |
Free members of struct vkd3d_shader_scan_descriptor_info() allocated by vkd3d_shader_scan().
This function may free members of vkd3d_shader_scan_descriptor_info, but does not free the structure itself.
| scan_descriptor_info | Descriptor information to free. |
Definition at line 1768 of file vkd3d_shader_main.c.
Referenced by d3d12_pipeline_state_find_and_init_uav_counters(), shader_spirv_destroy(), shader_spirv_destroy_compute_vk(), and vsir_program_scan().
|
static |
Definition at line 1493 of file vkd3d_shader_main.c.
Referenced by vsir_program_compile(), and vsir_program_scan().
| void vkd3d_shader_free_scan_signature_info | ( | struct vkd3d_shader_scan_signature_info * | info | ) |
Free members of struct vkd3d_shader_scan_signature_info allocated by vkd3d_shader_scan().
This function may free members of vkd3d_shader_scan_signature_info, but does not free the structure itself.
| info | Scan information to free. |
Definition at line 1775 of file vkd3d_shader_main.c.
Referenced by shader_spirv_destroy(), and vsir_program_scan().
| void vkd3d_shader_free_shader_code | ( | struct vkd3d_shader_code * | code | ) |
Free shader code allocated by another vkd3d-shader function, such as vkd3d_shader_compile().
This function frees the vkd3d_shader_code::code member, but does not free the structure itself.
| code | Code to free. |
Definition at line 1784 of file vkd3d_shader_main.c.
Referenced by compile_hlsl(), create_shader_stage(), create_uav_pipeline(), D3DCompile2(), d3dcompiler_get_blob_part(), d3dcompiler_strip_shader(), D3DDisassemble(), fx_4_parse_shader_initializer(), hlsl_compile_shader(), hlsl_emit_bytecode(), preprocess_shader(), shader_glsl_generate_vkd3d_shader(), shader_spirv_compile_shader(), shader_trace(), spirv_compiler_generate_spirv(), tpf_compile(), vkd3d_serialize_root_signature(), vkd3d_serialize_versioned_root_signature(), vkd3d_uav_clear_state_init(), and vsir_program_trace().
| void vkd3d_shader_free_shader_signature | ( | struct vkd3d_shader_signature * | signature | ) |
Free a structural representation of a shader input signature allocated by vkd3d_shader_parse_input_signature().
This function may free members of struct vkd3d_shader_signature, but does not free the structure itself.
| signature | Signature description to free. |
Definition at line 1907 of file vkd3d_shader_main.c.
Referenced by d3d11_input_layout_to_wined3d_declaration(), d3d12_pipeline_state_init_graphics(), and vkd3d_shader_free_scan_signature_info().
| enum vkd3d_shader_source_type * vkd3d_shader_get_supported_source_types | ( | unsigned int * | count | ) |
Returns the source types supported, with any target type, by vkd3d_shader_compile(). Future versions of the library may introduce additional source types; callers should ignore unrecognised source types.
Use vkd3d_shader_get_supported_target_types() to determine which target types are supported for each source type.
| count | Output location for the size, in elements, of the returned array. |
Definition at line 1937 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_validate_compile_info().
| enum vkd3d_shader_target_type * vkd3d_shader_get_supported_target_types | ( | enum vkd3d_shader_source_type | source_type, |
| unsigned int * | count | ||
| ) |
Returns the target types supported, with the given source type, by vkd3d_shader_compile(). Future versions of the library may introduce additional target types; callers should ignore unrecognised target types.
| source_type | Source type for which to enumerate supported target types. |
| count | Output location for the size, in elements, of the returned array. |
Definition at line 1956 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_validate_compile_info().
Returns the current version of this library.
| major | Output location for the major version of this library. |
| minor | Output location for the minor version of this library. |
Definition at line 1919 of file vkd3d_shader_main.c.
Referenced by msl_generator_generate(), shader_glsl_alloc(), vkd3d_glsl_generator_generate(), wined3d_spirv_shader_backend_init_vk(), write_sm1_uniforms(), and write_sm4_rdef().
Definition at line 592 of file vkd3d_shader_main.c.
Referenced by hlsl_compile_shader(), hlsl_emit_bytecode(), vkd3d_shader_compile(), and vkd3d_shader_scan().
|
static |
Definition at line 976 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 963 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 946 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
| void vkd3d_shader_message_context_cleanup | ( | struct vkd3d_shader_message_context * | context | ) |
Definition at line 252 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile(), vkd3d_shader_parse_dxbc(), vkd3d_shader_parse_input_signature(), vkd3d_shader_parse_root_signature(), vkd3d_shader_preprocess(), vkd3d_shader_scan(), and vkd3d_shader_serialize_root_signature().
| bool vkd3d_shader_message_context_copy_messages | ( | struct vkd3d_shader_message_context * | context, |
| char ** | out | ||
| ) |
Definition at line 263 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile(), vkd3d_shader_parse_dxbc(), vkd3d_shader_parse_input_signature(), vkd3d_shader_parse_root_signature(), vkd3d_shader_preprocess(), vkd3d_shader_scan(), and vkd3d_shader_serialize_root_signature().
| void vkd3d_shader_message_context_init | ( | struct vkd3d_shader_message_context * | context, |
| enum vkd3d_shader_log_level | log_level | ||
| ) |
Definition at line 245 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile(), vkd3d_shader_parse_dxbc(), vkd3d_shader_parse_input_signature(), vkd3d_shader_parse_root_signature(), vkd3d_shader_preprocess(), vkd3d_shader_scan(), and vkd3d_shader_serialize_root_signature().
| void vkd3d_shader_message_context_trace_messages_ | ( | const struct vkd3d_shader_message_context * | context, |
| const char * | function | ||
| ) |
Definition at line 257 of file vkd3d_shader_main.c.
| int vkd3d_shader_parse_input_signature | ( | const struct vkd3d_shader_code * | dxbc, |
| struct vkd3d_shader_signature * | signature, | ||
| char ** | messages | ||
| ) |
Read the input signature of a compiled DXBC shader, returning a structural description which can be easily parsed by C code.
This function parses a compiled shader. To parse a standalone root signature, use vkd3d_shader_parse_root_signature().
This function only parses DXBC shaders, and only retrieves the input signature. To retrieve signatures from other shader types, or other signature types, use vkd3d_shader_scan() and struct vkd3d_shader_scan_signature_info. This function returns the same input signature that is returned in struct vkd3d_shader_scan_signature_info.
| dxbc | Compiled byte code, in DXBC format. |
| signature | Output location in which the parsed root signature will be stored. Members of signature may be allocated by vkd3d-shader. The signature should be freed with vkd3d_shader_free_shader_signature() when no longer needed. The signature may contain pointers into the input shader, and should only be accessed while the input shader remains valid. |
| messages | Optional output location for error or informational messages produced by the parser. This string is null-terminated and UTF-8 encoded. The messages are allocated by vkd3d-shader and should be freed with vkd3d_shader_free_messages() when no longer needed. If no messages are produced by the parser, this parameter may receive NULL instead of a valid string pointer. |
Definition at line 1858 of file vkd3d_shader_main.c.
Referenced by d3d11_input_layout_to_wined3d_declaration(), and d3d12_pipeline_state_init_graphics().
| void vkd3d_shader_parser_init | ( | struct vkd3d_shader_parser * | parser, |
| struct vsir_program * | program, | ||
| struct vkd3d_shader_message_context * | message_context, | ||
| const char * | source_name | ||
| ) |
Definition at line 606 of file vkd3d_shader_main.c.
Referenced by shader_sm1_init(), shader_sm4_init(), and sm6_parser_init().
| int vkd3d_shader_preprocess | ( | const struct vkd3d_shader_compile_info * | compile_info, |
| struct vkd3d_shader_code * | out, | ||
| char ** | messages | ||
| ) |
Preprocess the given source code.
This function supports the following chained structures:
| compile_info | A chained structure containing compilation parameters. |
| out | A pointer to a vkd3d_shader_code structure in which the preprocessed code will be stored. The preprocessed shader is allocated by vkd3d-shader and should be freed with vkd3d_shader_free_shader_code() when no longer needed. |
| messages | Optional output location for error or informational messages produced by the preprocessor. This string is null-terminated and UTF-8 encoded. The messages are allocated by vkd3d-shader and should be freed with vkd3d_shader_free_messages() when no longer needed. The messages returned can be regulated with the log_level member of struct vkd3d_shader_compile_info. Regardless of the requested level, if this parameter is NULL, no compilation messages will be returned. If no messages are produced by the preprocessor, this parameter may receive NULL instead of a valid string pointer. |
Definition at line 2043 of file vkd3d_shader_main.c.
Referenced by preprocess_shader().
| int vkd3d_shader_scan | ( | const struct vkd3d_shader_compile_info * | compile_info, |
| char ** | messages | ||
| ) |
Parse shader source code or byte code, returning various types of requested information.
The source_type member of compile_info must be set to the type of the shader.
The target_type member may be set to VKD3D_SHADER_TARGET_NONE, in which case vkd3d_shader_scan() will return information about the shader in isolation. Alternatively, it may be set to a valid compilation target for the shader, in which case vkd3d_shader_scan() will return information that reflects the interface for a shader as it will be compiled to that target. In this case other chained structures may be appended to compile_info as they would be passed to vkd3d_shader_compile(), and interpreted accordingly, such as vkd3d_shader_spirv_target_info.
(For a hypothetical example, suppose the source shader distinguishes float and integer texture data, but the target environment does not support integer textures. In this case vkd3d_shader_compile() might translate integer operations to float. Accordingly using VKD3D_SHADER_TARGET_NONE would accurately report whether the texture expects integer or float data, but using the relevant specific target type would report VKD3D_SHADER_RESOURCE_DATA_FLOAT.)
Currently this function supports the following code types:
| compile_info | A chained structure containing scan parameters. The scanner supports the following chained structures:
|
| messages | Optional output location for error or informational messages produced by the parser. This string is null-terminated and UTF-8 encoded. The messages are allocated by vkd3d-shader and should be freed with vkd3d_shader_free_messages() when no longer needed. The messages returned can be regulated with the log_level member of struct vkd3d_shader_compile_info. Regardless of the requested level, if this parameter is NULL, no compilation messages will be returned. If no messages are produced by the parser, this parameter may receive NULL instead of a valid string pointer. |
Definition at line 1595 of file vkd3d_shader_main.c.
Referenced by shader_spirv_scan_shader(), and vkd3d_scan_dxbc().
|
static |
Definition at line 990 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_combined_sampler_declaration(), vkd3d_shader_scan_constant_buffer_declaration(), vkd3d_shader_scan_resource_declaration(), vkd3d_shader_scan_sampler_declaration(), and vsir_program_scan().
|
static |
Definition at line 926 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_record_uav_atomic_op(), vkd3d_shader_scan_record_uav_counter(), and vkd3d_shader_scan_record_uav_read().
|
static |
Definition at line 1048 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 1072 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 1022 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 857 of file vkd3d_shader_main.c.
Referenced by vsir_program_scan().
|
static |
Definition at line 830 of file vkd3d_shader_main.c.
Referenced by vsir_program_scan().
|
static |
Definition at line 893 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 910 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 862 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 1224 of file vkd3d_shader_main.c.
Referenced by vsir_program_scan().
|
static |
Definition at line 886 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 869 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 984 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 970 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 957 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 1142 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction(), and vkd3d_shader_scan_typed_resource_declaration().
|
static |
Definition at line 1034 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
|
static |
Definition at line 1165 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan_instruction().
| void vkd3d_shader_set_log_callback | ( | PFN_vkd3d_log | callback | ) |
Set a callback to be called when vkd3d-shader outputs debug logging.
If NULL, or if this function has not been called, libvkd3d-shader will print all enabled log output to stderr.
| callback | Callback function to set. |
Definition at line 2068 of file vkd3d_shader_main.c.
Referenced by vkd3d_set_log_callback().
|
static |
Definition at line 735 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_parse_input_signature(), and vsir_program_scan().
Definition at line 169 of file vkd3d_shader_main.c.
Referenced by vkd3d_string_buffer_trace_().
|
static |
Definition at line 638 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile(), vkd3d_shader_preprocess(), and vkd3d_shader_scan().
| void vkd3d_shader_verror | ( | struct vkd3d_shader_message_context * | context, |
| const struct vkd3d_shader_location * | location, | ||
| enum vkd3d_shader_error | error, | ||
| const char * | format, | ||
| va_list | args | ||
| ) |
Definition at line 336 of file vkd3d_shader_main.c.
Referenced by hlsl_error(), VKD3D_PRINTF_FUNC(), and vkd3d_shader_error().
| void vkd3d_shader_vnote | ( | struct vkd3d_shader_message_context * | context, |
| const struct vkd3d_shader_location * | location, | ||
| enum vkd3d_shader_log_level | level, | ||
| const char * | format, | ||
| va_list | args | ||
| ) |
Definition at line 282 of file vkd3d_shader_main.c.
Referenced by hlsl_note().
| void vkd3d_shader_vwarning | ( | struct vkd3d_shader_message_context * | context, |
| const struct vkd3d_shader_location * | location, | ||
| enum vkd3d_shader_error | error, | ||
| const char * | format, | ||
| va_list | args | ||
| ) |
Definition at line 302 of file vkd3d_shader_main.c.
Referenced by hlsl_warning(), and vkd3d_shader_warning().
| void vkd3d_shader_warning | ( | struct vkd3d_shader_message_context * | context, |
| const struct vkd3d_shader_location * | location, | ||
| enum vkd3d_shader_error | error, | ||
| const char * | format, | ||
| ... | |||
| ) |
Definition at line 326 of file vkd3d_shader_main.c.
Referenced by sm6_parser_init().
| void vkd3d_string_buffer_cache_cleanup | ( | struct vkd3d_string_buffer_cache * | cache | ) |
Definition at line 191 of file vkd3d_shader_main.c.
Referenced by hlsl_ctx_cleanup(), msl_generator_cleanup(), msl_generator_init(), spirv_compiler_destroy(), and vkd3d_glsl_generator_cleanup().
| void vkd3d_string_buffer_cache_init | ( | struct vkd3d_string_buffer_cache * | cache | ) |
Definition at line 186 of file vkd3d_shader_main.c.
Referenced by hlsl_ctx_init(), msl_generator_init(), spirv_compiler_create(), vkd3d_glsl_generator_init(), and vkd3d_string_buffer_cache_cleanup().
| void vkd3d_string_buffer_cleanup | ( | struct vkd3d_string_buffer * | buffer | ) |
Definition at line 67 of file vkd3d_shader_main.c.
Referenced by d3d_asm_compile(), hlsl_dump_function(), hlsl_dump_var_default_values(), spirv_compiler_generate_spirv(), trace_signature(), vkd3d_shader_message_context_cleanup(), vkd3d_string_buffer_cache_cleanup(), and vsir_cfg_cleanup().
| void vkd3d_string_buffer_clear | ( | struct vkd3d_string_buffer * | buffer | ) |
Definition at line 72 of file vkd3d_shader_main.c.
Referenced by declare_predefined_types(), trace_signature(), vkd3d_string_buffer_get(), vsir_cfg_compute_dominators(), vsir_cfg_compute_loops(), and vsir_cfg_sort_nodes().
| struct vkd3d_string_buffer * vkd3d_string_buffer_get | ( | struct vkd3d_string_buffer_cache * | cache | ) |
Definition at line 204 of file vkd3d_shader_main.c.
Referenced by glsl_dst_init(), glsl_src_init(), hlsl_get_string_buffer(), msl_dst_init(), msl_generator_init(), msl_src_init(), shader_glsl_intrinsic(), shader_glsl_ld(), shader_glsl_load_uav_typed(), shader_glsl_print_src(), shader_glsl_sample(), shader_glsl_store_uav_typed(), vkd3d_glsl_generator_init(), and vkd3d_shader_register_range_string().
| void vkd3d_string_buffer_init | ( | struct vkd3d_string_buffer * | buffer | ) |
Definition at line 58 of file vkd3d_shader_main.c.
Referenced by d3d_asm_compile(), fx_parse(), hlsl_dump_function(), hlsl_dump_var_default_values(), spirv_compiler_generate_spirv(), trace_signature(), VKD3D_PRINTF_FUNC(), vkd3d_shader_message_context_init(), vkd3d_string_buffer_get(), and vsir_cfg_init().
| int vkd3d_string_buffer_print_f32 | ( | struct vkd3d_string_buffer * | buffer, |
| float | f | ||
| ) |
Definition at line 134 of file vkd3d_shader_main.c.
Referenced by shader_print_float_literal().
| int vkd3d_string_buffer_print_f64 | ( | struct vkd3d_string_buffer * | buffer, |
| double | d | ||
| ) |
Definition at line 149 of file vkd3d_shader_main.c.
Referenced by shader_print_double_literal().
| int vkd3d_string_buffer_printf | ( | struct vkd3d_string_buffer * | buffer, |
| const char * | format, | ||
| ... | |||
| ) |
Definition at line 122 of file vkd3d_shader_main.c.
Referenced by d3d_asm_compile(), declare_predefined_types(), dump_block(), dump_deref(), dump_dxbc_signature(), dump_dxbc_signatures(), dump_instr(), dump_ir_call(), dump_ir_compile(), dump_ir_constant(), dump_ir_expr(), dump_ir_if(), dump_ir_index(), dump_ir_jump(), dump_ir_loop(), dump_ir_resource_load(), dump_ir_resource_store(), dump_ir_sampler_state(), dump_ir_stateblock_constant(), dump_ir_store(), dump_ir_string(), dump_ir_switch(), dump_ir_swizzle(), dump_ir_var(), dump_src(), fx_4_parse_object_initializer(), fx_4_parse_objects(), fx_4_parse_shader_initializer(), fx_4_parse_state_object_initializer(), fx_4_parse_string_initializer(), fx_parse_buffers(), fx_parse_fx_4_annotations(), fx_parse_fx_4_numeric_variables(), fx_parse_fx_4_technique(), fx_parse_groups(), hlsl_compile_internal_function(), hlsl_component_to_string(), hlsl_dump_function(), hlsl_dump_var_default_values(), hlsl_fixme(), hlsl_modifiers_to_string(), hlsl_new_synthetic_var(), hlsl_type_to_string(), lower_combined_samples(), msl_generate_cbv_declaration(), msl_generate_descriptor_struct_declarations(), msl_generate_entrypoint(), msl_generate_entrypoint_epilogue(), msl_generate_entrypoint_prologue(), msl_generate_input_struct_declarations(), msl_generate_output_struct_declarations(), msl_generate_pixel_output_element_attribute(), msl_generate_vertex_output_element_attribute(), msl_generator_generate(), msl_print_indent(), msl_print_register_datatype(), msl_print_register_name(), msl_print_swizzle(), msl_print_write_mask(), msl_ret(), msl_unhandled(), parse_fx_4_numeric_value(), parse_fx_print_indent(), shader_dump_atomic_op_flags(), shader_dump_data_type(), shader_dump_global_flags(), shader_dump_icb(), shader_dump_ins_modifiers(), shader_dump_instruction(), shader_dump_instruction_flags(), shader_dump_precise_flags(), shader_dump_resource_data_type(), shader_dump_resource_type(), shader_dump_sync_flags(), shader_dump_uav_flags(), shader_glsl_begin_block(), shader_glsl_break(), shader_glsl_case(), shader_glsl_continue(), shader_glsl_dcl_indexable_temp(), shader_glsl_default(), shader_glsl_else(), shader_glsl_end_block(), shader_glsl_generate_cbv_declaration(), shader_glsl_generate_declarations(), shader_glsl_generate_descriptor_declarations(), shader_glsl_generate_input_declarations(), shader_glsl_generate_interface_block(), shader_glsl_generate_output_declarations(), shader_glsl_generate_sampler_declaration(), shader_glsl_generate_uav_declaration(), shader_glsl_handle_global_flags(), shader_glsl_if(), shader_glsl_intrinsic(), shader_glsl_ld(), shader_glsl_load_uav_typed(), shader_glsl_loop(), shader_glsl_print_bitcast(), shader_glsl_print_combined_sampler_name(), shader_glsl_print_image_name(), shader_glsl_print_indent(), shader_glsl_print_register_name(), shader_glsl_print_shadow_coord(), shader_glsl_print_src(), shader_glsl_print_subscript(), shader_glsl_print_swizzle(), shader_glsl_print_sysval_name(), shader_glsl_print_texel_offset(), shader_glsl_print_write_mask(), shader_glsl_ret(), shader_glsl_sample(), shader_glsl_shader_epilogue(), shader_glsl_shader_prologue(), shader_glsl_store_uav_typed(), shader_glsl_switch(), shader_glsl_unhandled(), shader_print_bool_literal(), shader_print_dcl_usage(), shader_print_double_literal(), shader_print_float_literal(), shader_print_hex_literal(), shader_print_input_sysval_semantic(), shader_print_int_literal(), shader_print_interpolation_mode(), shader_print_non_uniform(), shader_print_opcode(), shader_print_precision(), shader_print_primitive_type(), shader_print_reg_type(), shader_print_register(), shader_print_src_param(), shader_print_subscript_range(), shader_print_tessellator_domain(), shader_print_tessellator_output_primitive(), shader_print_tessellator_partitioning(), shader_print_uint64_literal(), shader_print_uint_literal(), shader_print_write_mask(), trace_signature(), vkd3d_glsl_generator_generate(), VKD3D_PRINTF_FUNC(), vkd3d_shader_register_range_string(), vkd3d_shader_verror(), vkd3d_shader_vnote(), vkd3d_shader_vwarning(), vkd3d_string_buffer_print_f32(), vkd3d_string_buffer_print_f64(), vsir_cfg_compute_dominators(), vsir_cfg_compute_loops(), vsir_cfg_sort_nodes(), and vsir_cfg_structure_list_dump().
| void vkd3d_string_buffer_release | ( | struct vkd3d_string_buffer_cache * | cache, |
| struct vkd3d_string_buffer * | buffer | ||
| ) |
Definition at line 227 of file vkd3d_shader_main.c.
Referenced by glsl_dst_cleanup(), glsl_src_cleanup(), hlsl_release_string_buffer(), msl_dst_cleanup(), msl_generator_cleanup(), msl_src_cleanup(), shader_glsl_intrinsic(), shader_glsl_ld(), shader_glsl_load_uav_typed(), shader_glsl_print_src(), shader_glsl_sample(), shader_glsl_store_uav_typed(), spirv_compiler_get_descriptor_binding(), and vkd3d_glsl_generator_cleanup().
|
static |
Definition at line 86 of file vkd3d_shader_main.c.
Referenced by vkd3d_string_buffer_vprintf().
| void vkd3d_string_buffer_trace_ | ( | const struct vkd3d_string_buffer * | buffer, |
| const char * | function | ||
| ) |
Definition at line 164 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_message_context_trace_messages_().
| void vkd3d_string_buffer_truncate | ( | struct vkd3d_string_buffer * | buffer, |
| size_t | size | ||
| ) |
Definition at line 77 of file vkd3d_shader_main.c.
Referenced by vkd3d_string_buffer_clear(), and vsir_cfg_structure_list_dump().
| int vkd3d_string_buffer_vprintf | ( | struct vkd3d_string_buffer * | buffer, |
| const char * | format, | ||
| va_list | args | ||
| ) |
Definition at line 99 of file vkd3d_shader_main.c.
Referenced by hlsl_fixme(), hlsl_sprintf_alloc(), VKD3D_PRINTF_FUNC(), vkd3d_shader_verror(), vkd3d_shader_vnote(), vkd3d_shader_vwarning(), and vkd3d_string_buffer_printf().
|
static |
Definition at line 681 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_compile(), and vkd3d_shader_scan().
| int vsir_program_compile | ( | struct vsir_program * | program, |
| uint64_t | config_flags, | ||
| const struct vkd3d_shader_compile_info * | compile_info, | ||
| struct vkd3d_shader_code * | out, | ||
| struct vkd3d_shader_message_context * | message_context | ||
| ) |
Definition at line 1640 of file vkd3d_shader_main.c.
Referenced by hlsl_compile_shader(), and vkd3d_shader_compile().
|
static |
Definition at line 1500 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_scan(), and vsir_program_compile().
|
static |
Definition at line 587 of file vkd3d_shader_main.c.
Referenced by vkd3d_shader_init_config_flags().