vkd3d 1.15
The vkd3d 3D Graphics Library
 
Loading...
Searching...
No Matches
vkd3d_shader.h File Reference

This file contains definitions for the vkd3d-shader library. More...

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <vkd3d_types.h>

Go to the source code of this file.

Data Structures

struct  vkd3d_shader_compile_option
 Various settings which may affect shader compilation or scanning, passed as part of struct vkd3d_shader_compile_info. More...
 
struct  vkd3d_shader_code
 A generic structure containing a GPU shader, in text or byte-code format. More...
 
struct  vkd3d_shader_descriptor_binding
 A common structure describing the bind point of a descriptor or descriptor array in the target environment. More...
 
struct  vkd3d_shader_parameter_immediate_constant
 The value of an immediate constant parameter, used in struct vkd3d_shader_parameter. More...
 
struct  vkd3d_shader_parameter_immediate_constant1
 The value of an immediate constant parameter, used in struct vkd3d_shader_parameter1. More...
 
struct  vkd3d_shader_parameter_specialization_constant
 The linkage of a specialization constant parameter, used in struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1. More...
 
struct  vkd3d_shader_parameter_buffer
 The linkage of a parameter specified through a uniform buffer, used in struct vkd3d_shader_parameter1. More...
 
struct  vkd3d_shader_parameter
 An individual shader parameter. More...
 
struct  vkd3d_shader_parameter1
 An individual shader parameter. More...
 
struct  vkd3d_shader_resource_binding
 Describes the mapping of a single resource or resource array to its binding point in the target environment. More...
 
struct  vkd3d_shader_combined_resource_sampler
 Describes the mapping of a Direct3D resource-sampler pair to a combined sampler (i.e. More...
 
struct  vkd3d_shader_uav_counter_binding
 Describes the mapping of a single Direct3D UAV counter. More...
 
struct  vkd3d_shader_push_constant_buffer
 Describes the mapping of a Direct3D constant buffer to a range of push constants in the target environment. More...
 
struct  vkd3d_shader_interface_info
 A chained structure describing the interface between a compiled shader and the target environment. More...
 
struct  vkd3d_shader_transform_feedback_element
 
struct  vkd3d_shader_transform_feedback_info
 
struct  vkd3d_shader_descriptor_offset
 
struct  vkd3d_shader_descriptor_offset_info
 A chained structure containing descriptor offsets. More...
 
struct  vkd3d_shader_compile_info
 A chained structure containing compilation parameters. More...
 
struct  vkd3d_shader_spirv_target_info
 
struct  vkd3d_shader_spirv_domain_shader_target_info
 
struct  vkd3d_shader_macro
 A single preprocessor macro, passed as part of struct vkd3d_shader_preprocess_info. More...
 
struct  vkd3d_shader_preprocess_info
 A chained structure containing preprocessing parameters. More...
 
struct  vkd3d_shader_hlsl_source_info
 A chained structure containing HLSL compilation parameters. More...
 
struct  vkd3d_shader_static_sampler_desc
 
struct  vkd3d_shader_descriptor_range
 
struct  vkd3d_shader_root_descriptor_table
 
struct  vkd3d_shader_root_constants
 
struct  vkd3d_shader_root_descriptor
 
struct  vkd3d_shader_root_parameter
 
struct  vkd3d_shader_root_signature_desc
 
struct  vkd3d_shader_descriptor_range1
 
struct  vkd3d_shader_root_descriptor_table1
 
struct  vkd3d_shader_root_descriptor1
 
struct  vkd3d_shader_root_parameter1
 
struct  vkd3d_shader_root_signature_desc1
 
struct  vkd3d_shader_versioned_root_signature_desc
 
struct  vkd3d_shader_descriptor_info
 Describes a single shader descriptor; returned as part of struct vkd3d_shader_scan_descriptor_info. More...
 
struct  vkd3d_shader_scan_descriptor_info
 A chained structure enumerating the descriptors declared by a shader. More...
 
struct  vkd3d_shader_combined_resource_sampler_info
 This structure describes a single resource-sampler pair. More...
 
struct  vkd3d_shader_scan_combined_resource_sampler_info
 A chained structure describing the resource-sampler pairs used by a shader. More...
 
struct  vkd3d_shader_scan_hull_shader_tessellation_info
 A chained structure describing the tessellation information in a hull shader. More...
 
struct  vkd3d_shader_signature_element
 A single shader varying, returned as part of struct vkd3d_shader_signature. More...
 
struct  vkd3d_shader_signature
 Description of a shader input or output signature. More...
 
struct  vkd3d_shader_dxbc_section_desc
 A description of a DXBC section. More...
 
struct  vkd3d_shader_dxbc_desc
 A description of a DXBC blob, as returned by vkd3d_shader_parse_dxbc(). More...
 
struct  vkd3d_shader_scan_signature_info
 A chained structure containing descriptions of shader inputs and outputs. More...
 
struct  vkd3d_shader_varying_map
 Describes the mapping of a output varying register in a shader stage, to an input varying register in the following shader stage. More...
 
struct  vkd3d_shader_varying_map_info
 A chained structure which describes how output varyings in this shader stage should be mapped to input varyings in the next stage. More...
 
struct  vkd3d_shader_parameter_info
 Interface information regarding a builtin shader parameter. More...
 

Macros

#define VKD3D_SHADER_DUMMY_SAMPLER_INDEX   ~0u
 
#define VKD3D_SHADER_SWIZZLE_MASK   (0xffu)
 A mask selecting one component from a vkd3d-shader swizzle.
 
#define VKD3D_SHADER_SWIZZLE_SHIFT(idx)
 The offset, in bits, of the nth parameter of a vkd3d-shader swizzle.
 
#define VKD3D_SHADER_SWIZZLE(x, y, z, w)
 A helper macro which returns a vkd3d-shader swizzle with the given components.
 
#define VKD3D_SHADER_NO_SWIZZLE   VKD3D_SHADER_SWIZZLE(X, Y, Z, W)
 The identity swizzle ".xyzw".
 
#define VKD3D_SHADER_API   VKD3D_IMPORT
 

Typedefs

typedef int(* PFN_vkd3d_shader_open_include) (const char *filename, bool local, const char *parent_data, void *context, struct vkd3d_shader_code *out)
 Type of a callback function which will be used to open preprocessor includes.
 
typedef void(* PFN_vkd3d_shader_close_include) (const struct vkd3d_shader_code *code, void *context)
 Type of a callback function which will be used to close preprocessor includes.
 
typedef const char *(* PFN_vkd3d_shader_get_version) (unsigned int *major, unsigned int *minor)
 Type of vkd3d_shader_get_version().
 
typedef enum vkd3d_shader_source_type *(* PFN_vkd3d_shader_get_supported_source_types) (unsigned int *count)
 Type of vkd3d_shader_get_supported_source_types().
 
typedef enum vkd3d_shader_target_type *(* PFN_vkd3d_shader_get_supported_target_types) (enum vkd3d_shader_source_type source_type, unsigned int *count)
 Type of vkd3d_shader_get_supported_target_types().
 
typedef int(* PFN_vkd3d_shader_compile) (const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out, char **messages)
 Type of vkd3d_shader_compile().
 
typedef void(* PFN_vkd3d_shader_free_messages) (char *messages)
 Type of vkd3d_shader_free_messages().
 
typedef void(* PFN_vkd3d_shader_free_shader_code) (struct vkd3d_shader_code *code)
 Type of vkd3d_shader_free_shader_code().
 
typedef int(* PFN_vkd3d_shader_parse_root_signature) (const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_versioned_root_signature_desc *root_signature, char **messages)
 Type of vkd3d_shader_parse_root_signature().
 
typedef void(* PFN_vkd3d_shader_free_root_signature) (struct vkd3d_shader_versioned_root_signature_desc *root_signature)
 Type of vkd3d_shader_free_root_signature().
 
typedef int(* PFN_vkd3d_shader_serialize_root_signature) (const struct vkd3d_shader_versioned_root_signature_desc *root_signature, struct vkd3d_shader_code *dxbc, char **messages)
 Type of vkd3d_shader_serialize_root_signature().
 
typedef int(* PFN_vkd3d_shader_convert_root_signature) (struct vkd3d_shader_versioned_root_signature_desc *dst, enum vkd3d_shader_root_signature_version version, const struct vkd3d_shader_versioned_root_signature_desc *src)
 Type of vkd3d_shader_convert_root_signature().
 
typedef int(* PFN_vkd3d_shader_scan) (const struct vkd3d_shader_compile_info *compile_info, char **messages)
 Type of vkd3d_shader_scan().
 
typedef void(* PFN_vkd3d_shader_free_scan_descriptor_info) (struct vkd3d_shader_scan_descriptor_info *scan_descriptor_info)
 Type of vkd3d_shader_free_scan_descriptor_info().
 
typedef int(* PFN_vkd3d_shader_parse_input_signature) (const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_signature *signature, char **messages)
 Type of vkd3d_shader_parse_input_signature().
 
typedef struct vkd3d_shader_signature_element *(* PFN_vkd3d_shader_find_signature_element) (const struct vkd3d_shader_signature *signature, const char *semantic_name, unsigned int semantic_index, unsigned int stream_index)
 Type of vkd3d_shader_find_signature_element().
 
typedef void(* PFN_vkd3d_shader_free_shader_signature) (struct vkd3d_shader_signature *signature)
 Type of vkd3d_shader_free_shader_signature().
 
typedef void(* PFN_vkd3d_shader_preprocess) (struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out, char **messages)
 Type of vkd3d_shader_preprocess().
 
typedef void(* PFN_vkd3d_shader_set_log_callback) (PFN_vkd3d_log callback)
 Type of vkd3d_shader_set_log_callback().
 
typedef void(* PFN_vkd3d_shader_free_dxbc) (struct vkd3d_shader_dxbc_desc *dxbc)
 Type of vkd3d_shader_free_dxbc().
 
typedef int(* PFN_vkd3d_shader_parse_dxbc) (const struct vkd3d_shader_code *dxbc, uint32_t flags, struct vkd3d_shader_dxbc_desc *desc, char **messages)
 Type of vkd3d_shader_parse_dxbc().
 
typedef int(* PFN_vkd3d_shader_serialize_dxbc) (size_t section_count, const struct vkd3d_shader_dxbc_section_desc *sections, struct vkd3d_shader_code *dxbc, char **messages)
 Type of vkd3d_shader_serialize_dxbc().
 
typedef void(* PFN_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)
 Type of vkd3d_shader_build_varying_map().
 
typedef void(* PFN_vkd3d_shader_free_scan_signature_info) (struct vkd3d_shader_scan_signature_info *info)
 Type of vkd3d_shader_free_scan_signature_info().
 
typedef void(* PFN_vkd3d_shader_free_scan_combined_resource_sampler_info) (struct vkd3d_shader_scan_combined_resource_sampler_info *info)
 Type of vkd3d_shader_free_scan_combined_resource_sampler_info().
 

Enumerations

enum  vkd3d_shader_api_version {
  VKD3D_SHADER_API_VERSION_1_0 , VKD3D_SHADER_API_VERSION_1_1 , VKD3D_SHADER_API_VERSION_1_2 , VKD3D_SHADER_API_VERSION_1_3 ,
  VKD3D_SHADER_API_VERSION_1_4 , VKD3D_SHADER_API_VERSION_1_5 , VKD3D_SHADER_API_VERSION_1_6 , VKD3D_SHADER_API_VERSION_1_7 ,
  VKD3D_SHADER_API_VERSION_1_8 , VKD3D_SHADER_API_VERSION_1_9 , VKD3D_SHADER_API_VERSION_1_10 , VKD3D_SHADER_API_VERSION_1_11 ,
  VKD3D_SHADER_API_VERSION_1_12 , VKD3D_SHADER_API_VERSION_1_13 , VKD3D_SHADER_API_VERSION_1_14 , VKD3D_SHADER_API_VERSION_1_15 ,
  VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_structure_type {
  VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_INFO , VKD3D_SHADER_STRUCTURE_TYPE_INTERFACE_INFO , VKD3D_SHADER_STRUCTURE_TYPE_SCAN_DESCRIPTOR_INFO , VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_DOMAIN_SHADER_TARGET_INFO ,
  VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_TARGET_INFO , VKD3D_SHADER_STRUCTURE_TYPE_TRANSFORM_FEEDBACK_INFO , VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFO , VKD3D_SHADER_STRUCTURE_TYPE_PREPROCESS_INFO ,
  VKD3D_SHADER_STRUCTURE_TYPE_DESCRIPTOR_OFFSET_INFO , VKD3D_SHADER_STRUCTURE_TYPE_SCAN_SIGNATURE_INFO , VKD3D_SHADER_STRUCTURE_TYPE_VARYING_MAP_INFO , VKD3D_SHADER_STRUCTURE_TYPE_SCAN_COMBINED_RESOURCE_SAMPLER_INFO ,
  VKD3D_SHADER_STRUCTURE_TYPE_PARAMETER_INFO , VKD3D_SHADER_STRUCTURE_TYPE_SCAN_HULL_SHADER_TESSELLATION_INFO , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 The type of a chained structure. More...
 
enum  vkd3d_shader_compile_option_buffer_uav { VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV_STORAGE_TEXEL_BUFFER = 0x00000000 , VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV_STORAGE_BUFFER = 0x00000001 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Determines how buffer UAVs are stored. More...
 
enum  vkd3d_shader_compile_option_typed_uav { VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32 = 0x00000000 , VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_UNKNOWN = 0x00000001 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Determines how typed UAVs are declared. More...
 
enum  vkd3d_shader_compile_option_formatting_flags {
  VKD3D_SHADER_COMPILE_OPTION_FORMATTING_NONE = 0x00000000 , VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR = 0x00000001 , VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT = 0x00000002 , VKD3D_SHADER_COMPILE_OPTION_FORMATTING_OFFSETS = 0x00000004 ,
  VKD3D_SHADER_COMPILE_OPTION_FORMATTING_HEADER = 0x00000008 , VKD3D_SHADER_COMPILE_OPTION_FORMATTING_RAW_IDS = 0x00000010 , VKD3D_SHADER_COMPILE_OPTION_FORMATTING_IO_SIGNATURES = 0x00000020 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_compile_option_pack_matrix_order { VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ROW_MAJOR = 0x00000001 , VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_COLUMN_MAJOR = 0x00000002 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Determines how matrices are stored. More...
 
enum  vkd3d_shader_compile_option_backward_compatibility { VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES = 0x00000001 , VKD3D_SHADER_COMPILE_OPTION_DOUBLE_AS_FLOAT_ALIAS = 0x00000002 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Individual options to enable various backward compatibility features. More...
 
enum  vkd3d_shader_compile_option_fragment_coordinate_origin { VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_UPPER_LEFT = 0x00000000 , VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_LOWER_LEFT = 0x00000001 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Determines the origin of fragment coordinates. More...
 
enum  vkd3d_shader_compile_option_feature_flags { VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 = 0x00000001 , VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64 = 0x00000002 , VKD3D_SHADER_COMPILE_OPTION_FEATURE_WAVE_OPS = 0x00000004 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Advertises feature availability. More...
 
enum  vkd3d_shader_parse_dxbc_flags { VKD3D_SHADER_PARSE_DXBC_IGNORE_CHECKSUM = 0x00000001 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Flags for vkd3d_shader_parse_dxbc(). More...
 
enum  vkd3d_shader_compile_option_name {
  VKD3D_SHADER_COMPILE_OPTION_STRIP_DEBUG = 0x00000001 , VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV = 0x00000002 , VKD3D_SHADER_COMPILE_OPTION_FORMATTING = 0x00000003 , VKD3D_SHADER_COMPILE_OPTION_API_VERSION = 0x00000004 ,
  VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV = 0x00000005 , VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE = 0x00000006 , VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER = 0x00000007 , VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY = 0x00000008 ,
  VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN = 0x00000009 , VKD3D_SHADER_COMPILE_OPTION_FEATURE = 0x0000000a , VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT = 0x0000000b , VKD3D_SHADER_COMPILE_OPTION_WARN_IMPLICIT_TRUNCATION = 0x0000000c ,
  VKD3D_SHADER_COMPILE_OPTION_INCLUDE_EMPTY_BUFFERS_IN_EFFECTS = 0x0000000d , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_visibility {
  VKD3D_SHADER_VISIBILITY_ALL = 0 , VKD3D_SHADER_VISIBILITY_VERTEX = 1 , VKD3D_SHADER_VISIBILITY_HULL = 2 , VKD3D_SHADER_VISIBILITY_DOMAIN = 3 ,
  VKD3D_SHADER_VISIBILITY_GEOMETRY = 4 , VKD3D_SHADER_VISIBILITY_PIXEL = 5 , VKD3D_SHADER_VISIBILITY_COMPUTE = 1000000000 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 Describes which shader stages a resource is visible to. More...
 
enum  vkd3d_shader_descriptor_type { VKD3D_SHADER_DESCRIPTOR_TYPE_SRV = 0x0 , VKD3D_SHADER_DESCRIPTOR_TYPE_UAV = 0x1 , VKD3D_SHADER_DESCRIPTOR_TYPE_CBV = 0x2 , VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER = 0x3 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 The type of a shader resource descriptor. More...
 
enum  vkd3d_shader_binding_flag { VKD3D_SHADER_BINDING_FLAG_BUFFER = 0x00000001 , VKD3D_SHADER_BINDING_FLAG_IMAGE = 0x00000002 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 
enum  vkd3d_shader_fog_fragment_mode { VKD3D_SHADER_FOG_FRAGMENT_NONE = 0x0 , VKD3D_SHADER_FOG_FRAGMENT_EXP = 0x1 , VKD3D_SHADER_FOG_FRAGMENT_EXP2 = 0x2 , VKD3D_SHADER_FOG_FRAGMENT_LINEAR = 0x3 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 The factor used to interpolate the fragment output colour with fog. More...
 
enum  vkd3d_shader_fog_source { VKD3D_SHADER_FOG_SOURCE_FOG = 0x0 , VKD3D_SHADER_FOG_SOURCE_FOG_OR_SPECULAR_W = 0x1 , VKD3D_SHADER_FOG_SOURCE_Z = 0x2 , VKD3D_SHADER_FOG_SOURCE_W = 0x3 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 The source of the fog varying output by a pre-rasterization shader. More...
 
enum  vkd3d_shader_parameter_type { VKD3D_SHADER_PARAMETER_TYPE_UNKNOWN , VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT , VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT , VKD3D_SHADER_PARAMETER_TYPE_BUFFER , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 The manner in which a parameter value is provided to the shader, used in struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1. More...
 
enum  vkd3d_shader_parameter_data_type { VKD3D_SHADER_PARAMETER_DATA_TYPE_UNKNOWN , VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32 , VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32 , VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 The format of data provided to the shader, used in struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1. More...
 
enum  vkd3d_shader_parameter_name {
  VKD3D_SHADER_PARAMETER_NAME_UNKNOWN , VKD3D_SHADER_PARAMETER_NAME_RASTERIZER_SAMPLE_COUNT , VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_FUNC , VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF ,
  VKD3D_SHADER_PARAMETER_NAME_FLAT_INTERPOLATION , VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_MASK , VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_0 , VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_1 ,
  VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_2 , VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_3 , VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_4 , VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_5 ,
  VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_6 , VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_7 , VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE , VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN ,
  VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MAX , VKD3D_SHADER_PARAMETER_NAME_POINT_SPRITE , VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE , VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR ,
  VKD3D_SHADER_PARAMETER_NAME_FOG_END , VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE , VKD3D_SHADER_PARAMETER_NAME_FOG_SOURCE , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 Names a specific shader parameter, used in struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1. More...
 
enum  vkd3d_shader_d3dbc_constant_register { VKD3D_SHADER_D3DBC_FLOAT_CONSTANT_REGISTER = 0x0 , VKD3D_SHADER_D3DBC_INT_CONSTANT_REGISTER = 0x1 , VKD3D_SHADER_D3DBC_BOOL_CONSTANT_REGISTER = 0x2 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Symbolic register indices for mapping uniform constant register sets in legacy Direct3D bytecode to constant buffer views in the target environment. More...
 
enum  vkd3d_shader_source_type {
  VKD3D_SHADER_SOURCE_NONE , VKD3D_SHADER_SOURCE_DXBC_TPF , VKD3D_SHADER_SOURCE_HLSL , VKD3D_SHADER_SOURCE_D3D_BYTECODE ,
  VKD3D_SHADER_SOURCE_DXBC_DXIL , VKD3D_SHADER_SOURCE_FX , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 The format of a shader to be compiled or scanned. More...
 
enum  vkd3d_shader_target_type {
  VKD3D_SHADER_TARGET_NONE , VKD3D_SHADER_TARGET_SPIRV_BINARY , VKD3D_SHADER_TARGET_SPIRV_TEXT , VKD3D_SHADER_TARGET_D3D_ASM ,
  VKD3D_SHADER_TARGET_D3D_BYTECODE , VKD3D_SHADER_TARGET_DXBC_TPF , VKD3D_SHADER_TARGET_GLSL , VKD3D_SHADER_TARGET_FX ,
  VKD3D_SHADER_TARGET_MSL , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 The output format of a compiled shader. More...
 
enum  vkd3d_shader_log_level { VKD3D_SHADER_LOG_NONE , VKD3D_SHADER_LOG_ERROR , VKD3D_SHADER_LOG_WARNING , VKD3D_SHADER_LOG_INFO , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Describes the minimum severity of compilation messages returned by vkd3d_shader_compile() and similar functions. More...
 
enum  vkd3d_shader_spirv_environment { VKD3D_SHADER_SPIRV_ENVIRONMENT_NONE , VKD3D_SHADER_SPIRV_ENVIRONMENT_OPENGL_4_5 , VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_0 , VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_1 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 
enum  vkd3d_shader_spirv_extension {
  VKD3D_SHADER_SPIRV_EXTENSION_NONE , VKD3D_SHADER_SPIRV_EXTENSION_EXT_DEMOTE_TO_HELPER_INVOCATION , VKD3D_SHADER_SPIRV_EXTENSION_EXT_DESCRIPTOR_INDEXING , VKD3D_SHADER_SPIRV_EXTENSION_EXT_STENCIL_EXPORT ,
  VKD3D_SHADER_SPIRV_EXTENSION_EXT_VIEWPORT_INDEX_LAYER , VKD3D_SHADER_SPIRV_EXTENSION_EXT_FRAGMENT_SHADER_INTERLOCK , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_tessellator_output_primitive { VKD3D_SHADER_TESSELLATOR_OUTPUT_POINT = 0x1 , VKD3D_SHADER_TESSELLATOR_OUTPUT_LINE = 0x2 , VKD3D_SHADER_TESSELLATOR_OUTPUT_TRIANGLE_CW = 0x3 , VKD3D_SHADER_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 0x4 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 
enum  vkd3d_shader_tessellator_partitioning { VKD3D_SHADER_TESSELLATOR_PARTITIONING_INTEGER = 0x1 , VKD3D_SHADER_TESSELLATOR_PARTITIONING_POW2 = 0x2 , VKD3D_SHADER_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 0x3 , VKD3D_SHADER_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 0x4 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 
enum  vkd3d_shader_filter {
  VKD3D_SHADER_FILTER_MIN_MAG_MIP_POINT = 0x000 , VKD3D_SHADER_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x001 , VKD3D_SHADER_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x004 , VKD3D_SHADER_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x005 ,
  VKD3D_SHADER_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x010 , VKD3D_SHADER_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x011 , VKD3D_SHADER_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x014 , VKD3D_SHADER_FILTER_MIN_MAG_MIP_LINEAR = 0x015 ,
  VKD3D_SHADER_FILTER_ANISOTROPIC = 0x055 , VKD3D_SHADER_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x080 , VKD3D_SHADER_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x081 , VKD3D_SHADER_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x084 ,
  VKD3D_SHADER_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x085 , VKD3D_SHADER_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x090 , VKD3D_SHADER_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x091 , VKD3D_SHADER_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x094 ,
  VKD3D_SHADER_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x095 , VKD3D_SHADER_FILTER_COMPARISON_ANISOTROPIC = 0x0d5 , VKD3D_SHADER_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100 , VKD3D_SHADER_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101 ,
  VKD3D_SHADER_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104 , VKD3D_SHADER_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105 , VKD3D_SHADER_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110 , VKD3D_SHADER_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111 ,
  VKD3D_SHADER_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114 , VKD3D_SHADER_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115 , VKD3D_SHADER_FILTER_MINIMUM_ANISOTROPIC = 0x155 , VKD3D_SHADER_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180 ,
  VKD3D_SHADER_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181 , VKD3D_SHADER_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184 , VKD3D_SHADER_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185 , VKD3D_SHADER_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190 ,
  VKD3D_SHADER_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191 , VKD3D_SHADER_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194 , VKD3D_SHADER_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195 , VKD3D_SHADER_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5 ,
  VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_texture_address_mode {
  VKD3D_SHADER_TEXTURE_ADDRESS_MODE_WRAP = 0x1 , VKD3D_SHADER_TEXTURE_ADDRESS_MODE_MIRROR = 0x2 , VKD3D_SHADER_TEXTURE_ADDRESS_MODE_CLAMP = 0x3 , VKD3D_SHADER_TEXTURE_ADDRESS_MODE_BORDER = 0x4 ,
  VKD3D_SHADER_TEXTURE_ADDRESS_MODE_MIRROR_ONCE = 0x5 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_comparison_func {
  VKD3D_SHADER_COMPARISON_FUNC_NEVER = 0x1 , VKD3D_SHADER_COMPARISON_FUNC_LESS = 0x2 , VKD3D_SHADER_COMPARISON_FUNC_EQUAL = 0x3 , VKD3D_SHADER_COMPARISON_FUNC_LESS_EQUAL = 0x4 ,
  VKD3D_SHADER_COMPARISON_FUNC_GREATER = 0x5 , VKD3D_SHADER_COMPARISON_FUNC_NOT_EQUAL = 0x6 , VKD3D_SHADER_COMPARISON_FUNC_GREATER_EQUAL = 0x7 , VKD3D_SHADER_COMPARISON_FUNC_ALWAYS = 0x8 ,
  VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_static_border_colour { VKD3D_SHADER_STATIC_BORDER_COLOUR_TRANSPARENT_BLACK = 0x0 , VKD3D_SHADER_STATIC_BORDER_COLOUR_OPAQUE_BLACK = 0x1 , VKD3D_SHADER_STATIC_BORDER_COLOUR_OPAQUE_WHITE = 0x2 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 
enum  vkd3d_shader_root_parameter_type {
  VKD3D_SHADER_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0x0 , VKD3D_SHADER_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 0x1 , VKD3D_SHADER_ROOT_PARAMETER_TYPE_CBV = 0x2 , VKD3D_SHADER_ROOT_PARAMETER_TYPE_SRV = 0x3 ,
  VKD3D_SHADER_ROOT_PARAMETER_TYPE_UAV = 0x4 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_root_signature_flags {
  VKD3D_SHADER_ROOT_SIGNATURE_FLAG_NONE = 0x00 , VKD3D_SHADER_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT = 0x01 , VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS = 0x02 , VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS = 0x04 ,
  VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS = 0x08 , VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS = 0x10 , VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS = 0x20 , VKD3D_SHADER_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT = 0x40 ,
  VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_root_descriptor_flags { VKD3D_SHADER_ROOT_DESCRIPTOR_FLAG_NONE = 0x0 , VKD3D_SHADER_ROOT_DESCRIPTOR_FLAG_DATA_VOLATILE = 0x2 , VKD3D_SHADER_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4 , VKD3D_SHADER_ROOT_DESCRIPTOR_FLAG_DATA_STATIC = 0x8 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 
enum  vkd3d_shader_descriptor_range_flags {
  VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_NONE = 0x0 , VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE = 0x1 , VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE = 0x2 , VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4 ,
  VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC = 0x8 , VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS = 0x10000 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 
enum  vkd3d_shader_root_signature_version { VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0 = 0x1 , VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1 = 0x2 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 
enum  vkd3d_shader_resource_type {
  VKD3D_SHADER_RESOURCE_NONE = 0x0 , VKD3D_SHADER_RESOURCE_BUFFER = 0x1 , VKD3D_SHADER_RESOURCE_TEXTURE_1D = 0x2 , VKD3D_SHADER_RESOURCE_TEXTURE_2D = 0x3 ,
  VKD3D_SHADER_RESOURCE_TEXTURE_2DMS = 0x4 , VKD3D_SHADER_RESOURCE_TEXTURE_3D = 0x5 , VKD3D_SHADER_RESOURCE_TEXTURE_CUBE = 0x6 , VKD3D_SHADER_RESOURCE_TEXTURE_1DARRAY = 0x7 ,
  VKD3D_SHADER_RESOURCE_TEXTURE_2DARRAY = 0x8 , VKD3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY = 0x9 , VKD3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY = 0xa , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 The type of a shader resource, returned as part of struct vkd3d_shader_descriptor_info. More...
 
enum  vkd3d_shader_resource_data_type {
  VKD3D_SHADER_RESOURCE_DATA_UNORM = 0x1 , VKD3D_SHADER_RESOURCE_DATA_SNORM = 0x2 , VKD3D_SHADER_RESOURCE_DATA_INT = 0x3 , VKD3D_SHADER_RESOURCE_DATA_UINT = 0x4 ,
  VKD3D_SHADER_RESOURCE_DATA_FLOAT = 0x5 , VKD3D_SHADER_RESOURCE_DATA_MIXED = 0x6 , VKD3D_SHADER_RESOURCE_DATA_DOUBLE = 0x7 , VKD3D_SHADER_RESOURCE_DATA_CONTINUED = 0x8 ,
  VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 The type of the data contained in a shader resource, returned as part of struct vkd3d_shader_descriptor_info. More...
 
enum  vkd3d_shader_descriptor_info_flag {
  VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_COUNTER = 0x00000001 , VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_READ = 0x00000002 , VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_SAMPLER_COMPARISON_MODE = 0x00000004 , VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_ATOMICS = 0x00000008 ,
  VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_RAW_BUFFER = 0x00000010 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 Additional flags describing a shader descriptor, returned as part of struct vkd3d_shader_descriptor_info. More...
 
enum  vkd3d_shader_component_type {
  VKD3D_SHADER_COMPONENT_VOID = 0x0 , VKD3D_SHADER_COMPONENT_UINT = 0x1 , VKD3D_SHADER_COMPONENT_INT = 0x2 , VKD3D_SHADER_COMPONENT_FLOAT = 0x3 ,
  VKD3D_SHADER_COMPONENT_BOOL = 0x4 , VKD3D_SHADER_COMPONENT_DOUBLE = 0x5 , VKD3D_SHADER_COMPONENT_UINT64 = 0x6 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 Data type of a shader varying, returned as part of struct vkd3d_shader_signature_element. More...
 
enum  vkd3d_shader_sysval_semantic {
  VKD3D_SHADER_SV_NONE = 0x00 , VKD3D_SHADER_SV_POSITION = 0x01 , VKD3D_SHADER_SV_CLIP_DISTANCE = 0x02 , VKD3D_SHADER_SV_CULL_DISTANCE = 0x03 ,
  VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX = 0x04 , VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX = 0x05 , VKD3D_SHADER_SV_VERTEX_ID = 0x06 , VKD3D_SHADER_SV_PRIMITIVE_ID = 0x07 ,
  VKD3D_SHADER_SV_INSTANCE_ID = 0x08 , VKD3D_SHADER_SV_IS_FRONT_FACE = 0x09 , VKD3D_SHADER_SV_SAMPLE_INDEX = 0x0a , VKD3D_SHADER_SV_TESS_FACTOR_QUADEDGE = 0x0b ,
  VKD3D_SHADER_SV_TESS_FACTOR_QUADINT = 0x0c , VKD3D_SHADER_SV_TESS_FACTOR_TRIEDGE = 0x0d , VKD3D_SHADER_SV_TESS_FACTOR_TRIINT = 0x0e , VKD3D_SHADER_SV_TESS_FACTOR_LINEDET = 0x0f ,
  VKD3D_SHADER_SV_TESS_FACTOR_LINEDEN = 0x10 , VKD3D_SHADER_SV_TARGET = 0x40 , VKD3D_SHADER_SV_DEPTH = 0x41 , VKD3D_SHADER_SV_COVERAGE = 0x42 ,
  VKD3D_SHADER_SV_DEPTH_GREATER_EQUAL = 0x43 , VKD3D_SHADER_SV_DEPTH_LESS_EQUAL = 0x44 , VKD3D_SHADER_SV_STENCIL_REF = 0x45 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 System value semantic, returned as part of struct vkd3d_shader_signature. More...
 
enum  vkd3d_shader_minimum_precision {
  VKD3D_SHADER_MINIMUM_PRECISION_NONE = 0 , VKD3D_SHADER_MINIMUM_PRECISION_FLOAT_16 = 1 , VKD3D_SHADER_MINIMUM_PRECISION_FIXED_8_2 = 2 , VKD3D_SHADER_MINIMUM_PRECISION_INT_16 = 4 ,
  VKD3D_SHADER_MINIMUM_PRECISION_UINT_16 = 5 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION)
}
 Minimum interpolation precision of a shader varying, returned as part of struct vkd3d_shader_signature_element. More...
 
enum  vkd3d_shader_swizzle_component { VKD3D_SHADER_SWIZZLE_X = 0x0 , VKD3D_SHADER_SWIZZLE_Y = 0x1 , VKD3D_SHADER_SWIZZLE_Z = 0x2 , VKD3D_SHADER_SWIZZLE_W = 0x3 , VKD3D_FORCE_32_BIT_ENUM =(VKD3D_SHADER_API_VERSION) }
 Possible values for a single component of a vkd3d-shader swizzle.
 

Functions

static uint32_t vkd3d_shader_create_swizzle (enum vkd3d_shader_swizzle_component x, enum vkd3d_shader_swizzle_component y, enum vkd3d_shader_swizzle_component z, enum vkd3d_shader_swizzle_component w)
 Build a vkd3d-shader swizzle with the given components.
 
VKD3D_SHADER_API const char * vkd3d_shader_get_version (unsigned int *major, unsigned int *minor)
 Returns the current version of this library.
 
VKD3D_SHADER_API enum vkd3d_shader_source_typevkd3d_shader_get_supported_source_types (unsigned int *count)
 Returns the source types supported, with any target type, by vkd3d_shader_compile().
 
VKD3D_SHADER_API enum vkd3d_shader_target_typevkd3d_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().
 
VKD3D_SHADER_API 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.
 
VKD3D_SHADER_API void vkd3d_shader_free_messages (char *messages)
 Free shader messages allocated by another vkd3d-shader function, such as vkd3d_shader_compile().
 
VKD3D_SHADER_API 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().
 
VKD3D_SHADER_API int vkd3d_shader_parse_root_signature (const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_versioned_root_signature_desc *root_signature, char **messages)
 Convert a byte code description of a shader root signature to a structural description which can be easily parsed by C code.
 
VKD3D_SHADER_API 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().
 
VKD3D_SHADER_API int vkd3d_shader_serialize_root_signature (const struct vkd3d_shader_versioned_root_signature_desc *root_signature, struct vkd3d_shader_code *dxbc, char **messages)
 Convert a structural description of a shader root signature to a byte code format capable of being read by ID3D12Device::CreateRootSignature.
 
VKD3D_SHADER_API int vkd3d_shader_convert_root_signature (struct vkd3d_shader_versioned_root_signature_desc *dst, enum vkd3d_shader_root_signature_version version, const struct vkd3d_shader_versioned_root_signature_desc *src)
 Convert a structural representation of a root signature to a different version of structural representation.
 
VKD3D_SHADER_API 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.
 
VKD3D_SHADER_API 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().
 
VKD3D_SHADER_API 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.
 
VKD3D_SHADER_API struct vkd3d_shader_signature_elementvkd3d_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.
 
VKD3D_SHADER_API 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().
 
VKD3D_SHADER_API int vkd3d_shader_preprocess (const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out, char **messages)
 Preprocess the given source code.
 
VKD3D_SHADER_API void vkd3d_shader_set_log_callback (PFN_vkd3d_log callback)
 Set a callback to be called when vkd3d-shader outputs debug logging.
 
VKD3D_SHADER_API void vkd3d_shader_free_dxbc (struct vkd3d_shader_dxbc_desc *dxbc)
 Free the contents of a vkd3d_shader_dxbc_desc structure allocated by another vkd3d-shader function, such as vkd3d_shader_parse_dxbc().
 
VKD3D_SHADER_API int vkd3d_shader_parse_dxbc (const struct vkd3d_shader_code *dxbc, uint32_t flags, struct vkd3d_shader_dxbc_desc *desc, char **messages)
 Parse a DXBC blob contained in a vkd3d_shader_code structure.
 
VKD3D_SHADER_API int vkd3d_shader_serialize_dxbc (size_t section_count, const struct vkd3d_shader_dxbc_section_desc *sections, struct vkd3d_shader_code *dxbc, char **messages)
 Serialize a DXBC description into a blob stored in a vkd3d_shader_code structure.
 
VKD3D_SHADER_API 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().
 
VKD3D_SHADER_API 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.
 
VKD3D_SHADER_API 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().
 

Detailed Description

This file contains definitions for the vkd3d-shader library.

The vkd3d-shader library provides multiple utilities related to the compilation, transformation, and reflection of GPU shaders.

Since
1.2

Macro Definition Documentation

◆ VKD3D_SHADER_SWIZZLE

#define VKD3D_SHADER_SWIZZLE ( x,
y,
z,
w )
Value:
(VKD3D_SHADER_SWIZZLE_ ## x << VKD3D_SHADER_SWIZZLE_SHIFT(0) \
| VKD3D_SHADER_SWIZZLE_ ## y << VKD3D_SHADER_SWIZZLE_SHIFT(1) \
| VKD3D_SHADER_SWIZZLE_ ## z << VKD3D_SHADER_SWIZZLE_SHIFT(2) \
| VKD3D_SHADER_SWIZZLE_ ## w << VKD3D_SHADER_SWIZZLE_SHIFT(3))
#define VKD3D_SHADER_SWIZZLE_SHIFT(idx)
The offset, in bits, of the nth parameter of a vkd3d-shader swizzle.
Definition vkd3d_shader.h:2473

A helper macro which returns a vkd3d-shader swizzle with the given components.

The components are specified as the suffixes to members of vkd3d_shader_swizzle_component. For example, the swizzle ".xwyy" can be represented as:

#define VKD3D_SHADER_SWIZZLE(x, y, z, w)
A helper macro which returns a vkd3d-shader swizzle with the given components.
Definition vkd3d_shader.h:2484

◆ VKD3D_SHADER_SWIZZLE_MASK

#define VKD3D_SHADER_SWIZZLE_MASK   (0xffu)

A mask selecting one component from a vkd3d-shader swizzle.

The component has type vkd3d_shader_swizzle_component.

◆ VKD3D_SHADER_SWIZZLE_SHIFT

#define VKD3D_SHADER_SWIZZLE_SHIFT ( idx)
Value:
(8u * (idx))

The offset, in bits, of the nth parameter of a vkd3d-shader swizzle.

Typedef Documentation

◆ PFN_vkd3d_shader_build_varying_map

typedef void(* PFN_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)

◆ PFN_vkd3d_shader_close_include

typedef void(* PFN_vkd3d_shader_close_include) (const struct vkd3d_shader_code *code, void *context)

Type of a callback function which will be used to close preprocessor includes.

This callback function is passed as part of struct vkd3d_shader_preprocess_info.

Parameters
codeContents of the included file, which were allocated by the vkd3d_shader_preprocess_info.pfn_open_include callback. The user must free them.
contextThe user-defined pointer passed to struct vkd3d_shader_preprocess_info.

◆ PFN_vkd3d_shader_free_dxbc

typedef void(* PFN_vkd3d_shader_free_dxbc) (struct vkd3d_shader_dxbc_desc *dxbc)

Type of vkd3d_shader_free_dxbc().

Since
1.7

◆ PFN_vkd3d_shader_free_scan_combined_resource_sampler_info

typedef void(* PFN_vkd3d_shader_free_scan_combined_resource_sampler_info) (struct vkd3d_shader_scan_combined_resource_sampler_info *info)

◆ PFN_vkd3d_shader_free_scan_signature_info

typedef void(* PFN_vkd3d_shader_free_scan_signature_info) (struct vkd3d_shader_scan_signature_info *info)

◆ PFN_vkd3d_shader_open_include

typedef int(* PFN_vkd3d_shader_open_include) (const char *filename, bool local, const char *parent_data, void *context, struct vkd3d_shader_code *out)

Type of a callback function which will be used to open preprocessor includes.

This callback function is passed as part of struct vkd3d_shader_preprocess_info.

If this function fails, vkd3d-shader will emit a compilation error, and the pfn_close_include callback will not be called.

Parameters
filenameUnquoted string used as an argument to the #include directive.
localWhether the #include directive is requesting a local (i.e. double-quoted) or system (i.e. angle-bracketed) include.
parent_dataUnprocessed source code of the file in which this #include directive is evaluated. This parameter may be NULL.
contextThe user-defined pointer passed to struct vkd3d_shader_preprocess_info.
outOutput location for the full contents of the included file. The code need not be allocated using standard vkd3d functions, but must remain valid until the corresponding call to pfn_close_include. If this function fails, the contents of this parameter are ignored.
Returns
A member of vkd3d_result.

◆ PFN_vkd3d_shader_parse_dxbc

typedef int(* PFN_vkd3d_shader_parse_dxbc) (const struct vkd3d_shader_code *dxbc, uint32_t flags, struct vkd3d_shader_dxbc_desc *desc, char **messages)

Type of vkd3d_shader_parse_dxbc().

Since
1.7

◆ PFN_vkd3d_shader_preprocess

typedef void(* PFN_vkd3d_shader_preprocess) (struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out, char **messages)

Type of vkd3d_shader_preprocess().

Since
1.3

◆ PFN_vkd3d_shader_serialize_dxbc

typedef int(* PFN_vkd3d_shader_serialize_dxbc) (size_t section_count, const struct vkd3d_shader_dxbc_section_desc *sections, struct vkd3d_shader_code *dxbc, char **messages)

Type of vkd3d_shader_serialize_dxbc().

Since
1.7

◆ PFN_vkd3d_shader_set_log_callback

typedef void(* PFN_vkd3d_shader_set_log_callback) (PFN_vkd3d_log callback)

Enumeration Type Documentation

◆ vkd3d_shader_api_version

Since
1.3

◆ vkd3d_shader_compile_option_backward_compatibility

Individual options to enable various backward compatibility features.

Since
1.10
Enumerator
VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES 

Causes compiler to convert SM1-3 semantics to corresponding System Value semantics, when compiling HLSL sources for SM4+ targets.

This option does the following conversions:

  • POSITION to SV_Position for vertex shader outputs, pixel shader inputs, and geometry shader inputs and outputs;
  • COLORN to SV_TargetN for pixel shader outputs;
  • DEPTH to SV_Depth for pixel shader outputs.
VKD3D_SHADER_COMPILE_OPTION_DOUBLE_AS_FLOAT_ALIAS 

Causes 'double' to behave as an alias for 'float'.

This option only applies to HLSL sources with shader model 1-3 target profiles. Without this option using the 'double' type produces compilation errors in these target profiles.

This option is disabled by default.

Since
1.14

◆ vkd3d_shader_compile_option_buffer_uav

Determines how buffer UAVs are stored.

This also affects UAV counters in Vulkan environments. In OpenGL environments, atomic counter buffers are always used for UAV counters.

Enumerator
VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV_STORAGE_TEXEL_BUFFER 

Use buffer textures for buffer UAVs.

This is the default value.

VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV_STORAGE_BUFFER 

Use storage buffers for buffer UAVs.

◆ vkd3d_shader_compile_option_feature_flags

Advertises feature availability.

Since
1.11
Enumerator
VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 

The SPIR-V target environment supports 64-bit integer types.

This corresponds to the "shaderInt64" feature in the Vulkan API, and the "GL_ARB_gpu_shader_int64" extension in the OpenGL API.

VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64 

The SPIR-V target environment supports 64-bit floating-point types.

This corresponds to the "shaderFloat64" feature in the Vulkan API, and the "GL_ARB_gpu_shader_fp64" extension in the OpenGL API.

VKD3D_SHADER_COMPILE_OPTION_FEATURE_WAVE_OPS 

The SPIR-V target environment supports wave operations.

This flag is valid only in VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_1 or greater, and corresponds to the following minimum requirements in VkPhysicalDeviceSubgroupProperties:

  • subgroupSize >= 4.
  • supportedOperations has BASIC, VOTE, ARITHMETIC, BALLOT, SHUFFLE and QUAD bits set.
  • supportedStages include COMPUTE and FRAGMENT.
    Since
    1.12

◆ vkd3d_shader_compile_option_formatting_flags

Enumerator
VKD3D_SHADER_COMPILE_OPTION_FORMATTING_IO_SIGNATURES 

Emit the signatures when disassembling a shader.

Since
1.12

◆ vkd3d_shader_compile_option_fragment_coordinate_origin

Determines the origin of fragment coordinates.

Since
1.10
Enumerator
VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_UPPER_LEFT 

Fragment coordinates originate from the upper-left.

This is the default; it's also the only value supported by Vulkan environments.

VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_LOWER_LEFT 

Fragment coordinates originate from the lower-left.

This matches the traditional behaviour of OpenGL environments.

◆ vkd3d_shader_compile_option_name

Enumerator
VKD3D_SHADER_COMPILE_OPTION_STRIP_DEBUG 

If value is nonzero, do not include debug information in the compiled shader.

The default value is zero.

This option is supported by vkd3d_shader_compile(). However, not all compilers support generating debug information.

VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV 

value is a member of enum vkd3d_shader_compile_option_buffer_uav.

VKD3D_SHADER_COMPILE_OPTION_FORMATTING 

value is a member of enum vkd3d_shader_compile_option_formatting_flags.

VKD3D_SHADER_COMPILE_OPTION_API_VERSION 

value is a member of enum vkd3d_shader_api_version.

Since
1.3
VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV 

value is a member of enum vkd3d_shader_compile_option_typed_uav.

Since
1.5
VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE 

If value is nonzero, write the point size for Vulkan tessellation and geometry shaders.

This option should be enabled if and only if the shaderTessellationAndGeometryPointSize feature is enabled. The default value is nonzero, i.e. write the point size.

This option is supported by vkd3d_shader_compile() for the SPIR-V target type and Vulkan targets; it should not be enabled otherwise.

Since
1.7
VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER 

This option specifies default matrix packing order for HLSL sources.

Explicit variable modifiers or pragmas will take precedence.

value is a member of enum vkd3d_shader_compile_option_pack_matrix_order.

Since
1.9
VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY 

This option is used to enable various backward compatibility features.

value is a mask of values from enum vkd3d_shader_compile_option_backward_compatibility.

Since
1.10
VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN 

This option specifies the origin of fragment coordinates for SPIR-V targets.

value is a member of enum vkd3d_shader_compile_option_fragment_coordinate_origin.

Since
1.10
VKD3D_SHADER_COMPILE_OPTION_FEATURE 

This option specifies the shader features available in the target environment.

These are not extensions, i.e. they are always supported by the driver, but may not be supported by the available hardware.

value is a member of enum vkd3d_shader_compile_option_feature_flags.

Since
1.11
VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT 

If value is non-zero compilation will produce a child effect using shared object descriptions, as instructed by the "shared" modifier.

Child effects are supported with fx_4_0, and fx_4_1 profiles. This option and "shared" modifiers are ignored for the fx_5_0 profile and non-fx profiles. The fx_2_0 profile does not have a separate concept of child effects, variables marked with "shared" modifier will be marked as such in a binary.

Since
1.12
VKD3D_SHADER_COMPILE_OPTION_WARN_IMPLICIT_TRUNCATION 

If value is nonzero, emit a compile warning warn when vectors or matrices are truncated in an implicit conversion.

If warnings are disabled, this option has no effect. This option has no effects for targets other than HLSL.

The default value is nonzero, i.e. enable implicit truncation warnings.

Since
1.12
VKD3D_SHADER_COMPILE_OPTION_INCLUDE_EMPTY_BUFFERS_IN_EFFECTS 

If value is nonzero, empty constant buffers descriptions are written out in the output effect binary.

This option applies only to fx_4_0 and fx_4_1 profiles and is otherwise ignored.

Since
1.12

◆ vkd3d_shader_compile_option_pack_matrix_order

Determines how matrices are stored.

Since
1.9

◆ vkd3d_shader_compile_option_typed_uav

Determines how typed UAVs are declared.

Since
1.5
Enumerator
VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32 

Use R32(u)i/R32f format for UAVs which are read from.

This is the default value.

VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_UNKNOWN 

Use Unknown format for UAVs which are read from.

This should only be set if shaderStorageImageReadWithoutFormat is enabled in the target environment.

◆ vkd3d_shader_component_type

Data type of a shader varying, returned as part of struct vkd3d_shader_signature_element.

Enumerator
VKD3D_SHADER_COMPONENT_VOID 

The varying has no type.

VKD3D_SHADER_COMPONENT_UINT 

32-bit unsigned integer.

VKD3D_SHADER_COMPONENT_INT 

32-bit signed integer.

VKD3D_SHADER_COMPONENT_FLOAT 

32-bit IEEE floating-point.

VKD3D_SHADER_COMPONENT_BOOL 

Boolean.

VKD3D_SHADER_COMPONENT_DOUBLE 

64-bit IEEE floating-point.

VKD3D_SHADER_COMPONENT_UINT64 

64-bit unsigned integer.

Since
1.11

◆ vkd3d_shader_d3dbc_constant_register

Symbolic register indices for mapping uniform constant register sets in legacy Direct3D bytecode to constant buffer views in the target environment.

Members of this enumeration are used in vkd3d_shader_resource_binding::register_index.

Since
1.9
Enumerator
VKD3D_SHADER_D3DBC_FLOAT_CONSTANT_REGISTER 

The float constant register set, c# in Direct3D assembly.

VKD3D_SHADER_D3DBC_INT_CONSTANT_REGISTER 

The integer constant register set, i# in Direct3D assembly.

VKD3D_SHADER_D3DBC_BOOL_CONSTANT_REGISTER 

The boolean constant register set, b# in Direct3D assembly.

◆ vkd3d_shader_descriptor_info_flag

Additional flags describing a shader descriptor, returned as part of struct vkd3d_shader_descriptor_info.

Enumerator
VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_COUNTER 

The descriptor is a UAV resource, whose counter is read from or written to by the shader.

VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_READ 

The descriptor is a UAV resource, which is read from by the shader.

VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_SAMPLER_COMPARISON_MODE 

The descriptor is a comparison sampler.

VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_ATOMICS 

The descriptor is a UAV resource, on which the shader performs atomic ops.

Since
1.6
VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_RAW_BUFFER 

The descriptor is a raw (byte-addressed) buffer.

Since
1.9

◆ vkd3d_shader_descriptor_range_flags

Enumerator
VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS 
Since
1.11

◆ vkd3d_shader_descriptor_type

The type of a shader resource descriptor.

Enumerator
VKD3D_SHADER_DESCRIPTOR_TYPE_SRV 

The descriptor is a shader resource view.

In Direct3D assembly, this is bound to a t# register.

VKD3D_SHADER_DESCRIPTOR_TYPE_UAV 

The descriptor is an unordered access view.

In Direct3D assembly, this is bound to a u# register.

VKD3D_SHADER_DESCRIPTOR_TYPE_CBV 

The descriptor is a constant buffer view.

In Direct3D assembly, this is bound to a cb# register.

VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER 

The descriptor is a sampler.

In Direct3D assembly, this is bound to an s# register.

◆ vkd3d_shader_fog_fragment_mode

The factor used to interpolate the fragment output colour with fog.

See VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE for specification of the interpolation factor as defined here.

The following variables may be used to determine the interpolation factor:

c = The fog coordinate value output from the vertex shader. This is an inter-stage varying with the semantic name "FOG" and semantic index 0. It may be modified by VKD3D_SHADER_PARAMETER_NAME_FOG_SOURCE. E = The value of VKD3D_SHADER_PARAMETER_NAME_FOG_END. k = The value of VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE.

Since
1.15
Enumerator
VKD3D_SHADER_FOG_FRAGMENT_NONE 

No fog interpolation is applied; the output colour is passed through unmodified.

Equivalently, the fog interpolation factor is 1.

VKD3D_SHADER_FOG_FRAGMENT_EXP 

The fog interpolation factor is 2^-(k * c).

In order to implement traditional exponential fog, as present in Direct3D and OpenGL, i.e.

e^-(density * c)

set

k = density * logâ‚‚(e)
VKD3D_SHADER_FOG_FRAGMENT_EXP2 

The fog interpolation factor is 2^-((k * c)²).

In order to implement traditional square-exponential fog, as present in Direct3D and OpenGL, i.e.

e^-((density * c)²)

set

k = density * √log₂(e)
VKD3D_SHADER_FOG_FRAGMENT_LINEAR 

The fog interpolation factor is (E - c) * k.

In order to implement traditional linear fog, as present in Direct3D and OpenGL, i.e.

(end - c) / (end - start)

set

E = end
k = 1 / (end - start)

◆ vkd3d_shader_fog_source

The source of the fog varying output by a pre-rasterization shader.

The fog varying is defined as the output varying with the semantic name "FOG" and semantic index 0.

See VKD3D_SHADER_PARAMETER_NAME_FOG_SOURCE for further documentation of this parameter.

Since
1.15
Enumerator
VKD3D_SHADER_FOG_SOURCE_FOG 

The source shader is not modified.

That is, the fog varying in the target shader is the original fog varying if and only if present.

VKD3D_SHADER_FOG_SOURCE_FOG_OR_SPECULAR_W 

If the source shader has a fog varying, it is not modified.

Otherwise, if the source shader outputs a varying with semantic name "COLOR" and semantic index 1 whose index includes a W component, said W component is output as fog varying. Otherwise, no fog varying is output.

VKD3D_SHADER_FOG_SOURCE_Z 

The fog source is the Z component of the position output by the vertex shader.

VKD3D_SHADER_FOG_SOURCE_W 

The fog source is the W component of the position output by the vertex shader.

◆ vkd3d_shader_log_level

Describes the minimum severity of compilation messages returned by vkd3d_shader_compile() and similar functions.

Enumerator
VKD3D_SHADER_LOG_NONE 

No messages will be returned.

VKD3D_SHADER_LOG_ERROR 

Only fatal errors which prevent successful compilation will be returned.

VKD3D_SHADER_LOG_WARNING 

Non-fatal warnings and fatal errors will be returned.

VKD3D_SHADER_LOG_INFO 

All messages, including general informational messages, will be returned.

◆ vkd3d_shader_minimum_precision

Minimum interpolation precision of a shader varying, returned as part of struct vkd3d_shader_signature_element.

Enumerator
VKD3D_SHADER_MINIMUM_PRECISION_FLOAT_16 

16-bit floating-point.

VKD3D_SHADER_MINIMUM_PRECISION_FIXED_8_2 

10-bit fixed point (2 integer and 8 fractional bits).

VKD3D_SHADER_MINIMUM_PRECISION_INT_16 

16-bit signed integer.

VKD3D_SHADER_MINIMUM_PRECISION_UINT_16 

16-bit unsigned integer.

◆ vkd3d_shader_parameter_data_type

The format of data provided to the shader, used in struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1.

Enumerator
VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32 

The parameter is provided as a 32-bit unsigned integer.

VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32 

The parameter is provided as a 32-bit float.

Since
1.13
VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4 

The parameter is provided as a 4-dimensional vector of 32-bit floats.

This parameter must be used with struct vkd3d_shader_parameter1; it cannot be used with struct vkd3d_shader_parameter.

Since
1.14

◆ vkd3d_shader_parameter_name

Names a specific shader parameter, used in struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1.

Enumerator
VKD3D_SHADER_PARAMETER_NAME_RASTERIZER_SAMPLE_COUNT 

The sample count of the framebuffer, as returned by the HLSL function GetRenderTargetSampleCount() or the GLSL builtin gl_NumSamples.

This parameter should be specified when compiling to SPIR-V, which provides no builtin ability to query this information from the shader.

The default value is 1.

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.

VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_FUNC 

Alpha test comparison function.

When this parameter is provided, if the alpha component of the pixel shader colour output at location 0 fails the test, as defined by this function and the reference value provided by VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF, the fragment will be discarded.

This parameter, along with VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF, can be used to implement fixed function alpha test, as present in Direct3D versions up to 9, if the target environment does not support alpha test as part of its own fixed-function API (as Vulkan and core OpenGL).

The default value is VKD3D_SHADER_COMPARISON_FUNC_ALWAYS.

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32. The value specified must be a member of enum vkd3d_shader_comparison_func.

Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this version of vkd3d-shader.

Since
1.13
VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF 

Alpha test reference value.

See VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_FUNC for documentation of alpha test.

The default value is zero.

Since
1.13
VKD3D_SHADER_PARAMETER_NAME_FLAT_INTERPOLATION 

Whether to use flat interpolation for fragment shader colour inputs.

If the value is nonzero, inputs whose semantic usage is COLOR will use flat interpolation instead of linear. This parameter is ignored if the shader model is 4 or greater, since only shader model 3 and below do not specify the interpolation mode in the shader bytecode.

This parameter can be used to implement fixed function shade mode, as present in Direct3D versions up to 9, if the target environment does not support shade mode as part of its own fixed-function API (as Vulkan and core OpenGL).

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.

The default value is zero, i.e. use linear interpolation.

Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this version of vkd3d-shader.

Since
1.13
VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_MASK 

A mask of enabled clip planes.

When this parameter is provided to a vertex shader, for each nonzero bit of this mask, a user clip distance will be generated from vertex position in clip space, and the clip plane defined by the indexed vector, taken from the VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_# parameter.

Regardless of the specific clip planes which are enabled, the clip distances which are output are a contiguous array starting from clip distance 0. This affects the interface of OpenGL. For example, if only clip planes 1 and 3 are enabled (and so the value of the mask is 0xa), the user should enable only GL_CLIP_DISTANCE0 and GL_CLIP_DISTANCE1.

The default value is zero, i.e. do not enable any clip planes.

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.

Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this version of vkd3d-shader.

If the source shader writes clip distances and this parameter is nonzero, compilation fails.

Since
1.14
VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_0 

Clip plane values.

See VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_MASK for documentation of clip planes.

These enum values are contiguous and arithmetic may safely be performed on them. That is, VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_[n] is VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_0 plus n.

The data type for each parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4.

The default value for each plane is a (0, 0, 0, 0) vector.

Since
1.14
VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE 

Point size.

When this parameter is provided to a vertex, tessellation, or geometry shader, and the source shader does not write point size, it specifies a uniform value which will be written to point size. If the source shader writes point size, this parameter is ignored.

This parameter can be used to implement fixed function point size, as present in Direct3D versions 8 and 9, if the target environment does not support point size as part of its own fixed-function API (as Vulkan and core OpenGL).

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.

Since
1.14
VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN 

Minimum point size.

When this parameter is provided to a vertex, tessellation, or geometry shader, and the source shader writes point size or uses the VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE parameter, the point size will be clamped to the provided minimum value. If point size is not written in one of these ways, this parameter is ignored. If this parameter is not provided, the point size will not be clamped to a minimum size by vkd3d-shader.

This parameter can be used to implement fixed function point size, as present in Direct3D versions 8 and 9, if the target environment does not support point size as part of its own fixed-function API (as Vulkan and core OpenGL).

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.

Since
1.14
VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MAX 

Maximum point size.

This parameter has identical behaviour to VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN, except that it provides the maximum size rather than the minimum.

Since
1.14
VKD3D_SHADER_PARAMETER_NAME_POINT_SPRITE 

Whether texture coordinate inputs should take their values from the point coordinate.

When this parameter is provided to a pixel shader, and the value is nonzero, any fragment shader input with the semantic name "TEXCOORD" takes its value from the point coordinates instead of from the previous shader. The point coordinates here are defined as a four-component vector whose X and Y components are the X and Y coordinates of the fragment within a point being rasterized, and whose Z and W components are zero.

In GLSL, the X and Y components are drawn from gl_PointCoord; in SPIR-V, they are drawn from a variable with the BuiltinPointCoord decoration.

This includes t# fragment shader inputs in shader model 2 shaders, as well as texture sampling in shader model 1 shaders.

This parameter can be used to implement fixed function point sprite, as present in Direct3D versions 8 and 9, if the target environment does not support point sprite as part of its own fixed-function API (as Vulkan and core OpenGL).

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.

The default value is zero, i.e. use the original varyings.

Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this version of vkd3d-shader.

Since
1.14
VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE 

Fog mode used in fragment shaders.

The value specified by this parameter must be a member of enum vkd3d_shader_fog_fragment_mode.

If not VKD3D_SHADER_FOG_FRAGMENT_NONE, the pixel shader colour output at location 0 is linearly interpolated with the fog colour defined by VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR. The interpolation factor is defined according to the enumerant selected by this parameter. The interpolated value is then outputted instead of the original value at location 0.

An interpolation factor of 0 specifies to use the fog colour; a factor of 1 specifies to use the original colour output. The interpolation factor is clamped to the [0, 1] range before interpolating.

The default value is VKD3D_SHADER_FOG_FRAGMENT_NONE.

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.

Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this version of vkd3d-shader.

Since
1.15
VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR 

Fog colour.

See VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE for documentation of fog.

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4.

The default value is transparent black, i.e. the vector {0, 0, 0, 0}.

Since
1.15
VKD3D_SHADER_PARAMETER_NAME_FOG_END 

End coordinate for linear fog.

See VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE for documentation of fog.

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.

The default value is 1.0.

Since
1.15
VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE 

Scale value for fog.

See VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE for documentation of fog.

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.

The default value is 1.0.

Since
1.15
VKD3D_SHADER_PARAMETER_NAME_FOG_SOURCE 

Fog source.

The value specified by this parameter must be a member of enum vkd3d_shader_fog_source.

This parameter replaces or suppletes the fog varying output by a pre-rasterization shader. The fog varying is defined as the output varying with the semantic name "FOG" and semantic index 0.

Together with other fog parameters, this parameter can be used to implement fixed function fog, as present in Direct3D versions up to 9, if the target environment does not support fog as part of its own fixed-function API (as Vulkan and core OpenGL).

The default value is VKD3D_SHADER_FOG_SOURCE_FOG.

The data type for this parameter must be VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.

Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this version of vkd3d-shader.

Since
1.15

◆ vkd3d_shader_parameter_type

The manner in which a parameter value is provided to the shader, used in struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1.

Enumerator
VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT 

The parameter value is embedded directly in the shader.

VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT 

The parameter value is provided to the shader via specialization constants.

This value is only supported for the SPIR-V target type.

VKD3D_SHADER_PARAMETER_TYPE_BUFFER 

The parameter value is provided to the shader as part of a uniform buffer.

Since
1.13

◆ vkd3d_shader_parse_dxbc_flags

Flags for vkd3d_shader_parse_dxbc().

Since
1.12
Enumerator
VKD3D_SHADER_PARSE_DXBC_IGNORE_CHECKSUM 

Ignore the checksum and continue parsing even if it is incorrect.

◆ vkd3d_shader_resource_data_type

The type of the data contained in a shader resource, returned as part of struct vkd3d_shader_descriptor_info.

All formats are 32-bit.

Enumerator
VKD3D_SHADER_RESOURCE_DATA_UNORM 

Unsigned normalized integer.

VKD3D_SHADER_RESOURCE_DATA_SNORM 

Signed normalized integer.

VKD3D_SHADER_RESOURCE_DATA_INT 

Signed integer.

VKD3D_SHADER_RESOURCE_DATA_UINT 

Unsigned integer.

VKD3D_SHADER_RESOURCE_DATA_FLOAT 

IEEE single-precision floating-point.

VKD3D_SHADER_RESOURCE_DATA_MIXED 

Undefined/type-less.

Since
1.3
VKD3D_SHADER_RESOURCE_DATA_DOUBLE 

IEEE double-precision floating-point.

Since
1.3
VKD3D_SHADER_RESOURCE_DATA_CONTINUED 

Continuation of the previous component.

For example, 64-bit double-precision floating-point data may be returned as two 32-bit components, with the first component (containing the LSB) specified as VKD3D_SHADER_RESOURCE_DATA_DOUBLE, and the second component specified as VKD3D_SHADER_RESOURCE_DATA_CONTINUED.

Since
1.3

◆ vkd3d_shader_resource_type

The type of a shader resource, returned as part of struct vkd3d_shader_descriptor_info.

Enumerator
VKD3D_SHADER_RESOURCE_NONE 

The type is invalid or not applicable for this descriptor.

This value is returned for samplers.

VKD3D_SHADER_RESOURCE_BUFFER 

Dimensionless buffer.

VKD3D_SHADER_RESOURCE_TEXTURE_1D 

1-dimensional texture.

VKD3D_SHADER_RESOURCE_TEXTURE_2D 

2-dimensional texture.

VKD3D_SHADER_RESOURCE_TEXTURE_2DMS 

Multisampled 2-dimensional texture.

VKD3D_SHADER_RESOURCE_TEXTURE_3D 

3-dimensional texture.

VKD3D_SHADER_RESOURCE_TEXTURE_CUBE 

Cubemap texture.

VKD3D_SHADER_RESOURCE_TEXTURE_1DARRAY 

1-dimensional array texture.

VKD3D_SHADER_RESOURCE_TEXTURE_2DARRAY 

2-dimensional array texture.

VKD3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY 

Multisampled 2-dimensional array texture.

VKD3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY 

Cubemap array texture.

◆ vkd3d_shader_source_type

The format of a shader to be compiled or scanned.

Enumerator
VKD3D_SHADER_SOURCE_NONE 

The shader has no type or is to be ignored.

This is not a valid value for vkd3d_shader_compile() or vkd3d_shader_scan().

VKD3D_SHADER_SOURCE_DXBC_TPF 

A 'Tokenized Program Format' shader embedded in a DXBC container.

This is the format used for Direct3D shader model 4 and 5 shaders.

VKD3D_SHADER_SOURCE_HLSL 

High-Level Shader Language source code.

Since
1.3
VKD3D_SHADER_SOURCE_D3D_BYTECODE 

Legacy Direct3D byte-code.

This is the format used for Direct3D shader model 1, 2, and 3 shaders.

Since
1.3
VKD3D_SHADER_SOURCE_DXBC_DXIL 

A 'DirectX Intermediate Language' shader embedded in a DXBC container.

This is the format used for Direct3D shader model 6 shaders.

Since
1.9
VKD3D_SHADER_SOURCE_FX 

Binary format used by Direct3D 9/10.x/11 effects.

Input is a raw FX section without container.

Since
1.14

◆ vkd3d_shader_spirv_environment

Enumerator
VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_1 
Since
1.12

◆ vkd3d_shader_spirv_extension

Enumerator
VKD3D_SHADER_SPIRV_EXTENSION_EXT_DESCRIPTOR_INDEXING 
Since
1.3
VKD3D_SHADER_SPIRV_EXTENSION_EXT_STENCIL_EXPORT 
Since
1.3
VKD3D_SHADER_SPIRV_EXTENSION_EXT_VIEWPORT_INDEX_LAYER 
Since
1.11
VKD3D_SHADER_SPIRV_EXTENSION_EXT_FRAGMENT_SHADER_INTERLOCK 
Since
1.12

◆ vkd3d_shader_structure_type

The type of a chained structure.

Enumerator
VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_INFO 

The structure is a vkd3d_shader_compile_info structure.

VKD3D_SHADER_STRUCTURE_TYPE_INTERFACE_INFO 

The structure is a vkd3d_shader_interface_info structure.

VKD3D_SHADER_STRUCTURE_TYPE_SCAN_DESCRIPTOR_INFO 

The structure is a vkd3d_shader_scan_descriptor_info structure.

VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_DOMAIN_SHADER_TARGET_INFO 

The structure is a vkd3d_shader_spirv_domain_shader_target_info structure.

VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_TARGET_INFO 

The structure is a vkd3d_shader_spirv_target_info structure.

VKD3D_SHADER_STRUCTURE_TYPE_TRANSFORM_FEEDBACK_INFO 

The structure is a vkd3d_shader_transform_feedback_info structure.

VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFO 

The structure is a vkd3d_shader_hlsl_source_info structure.

Since
1.3
VKD3D_SHADER_STRUCTURE_TYPE_PREPROCESS_INFO 

The structure is a vkd3d_shader_preprocess_info structure.

Since
1.3
VKD3D_SHADER_STRUCTURE_TYPE_DESCRIPTOR_OFFSET_INFO 

The structure is a vkd3d_shader_descriptor_offset_info structure.

Since
1.3
VKD3D_SHADER_STRUCTURE_TYPE_SCAN_SIGNATURE_INFO 

The structure is a vkd3d_shader_scan_signature_info structure.

Since
1.9
VKD3D_SHADER_STRUCTURE_TYPE_VARYING_MAP_INFO 

The structure is a vkd3d_shader_varying_map_info structure.

Since
1.9
VKD3D_SHADER_STRUCTURE_TYPE_SCAN_COMBINED_RESOURCE_SAMPLER_INFO 

The structure is a vkd3d_shader_scan_combined_resource_sampler_info structure.

Since
1.10
VKD3D_SHADER_STRUCTURE_TYPE_PARAMETER_INFO 

The structure is a vkd3d_shader_parameter_info structure.

Since
1.13
VKD3D_SHADER_STRUCTURE_TYPE_SCAN_HULL_SHADER_TESSELLATION_INFO 

The structure is a vkd3d_shader_scan_hull_shader_tessellation_info structure.

Since
1.15

◆ vkd3d_shader_sysval_semantic

System value semantic, returned as part of struct vkd3d_shader_signature.

Enumerator
VKD3D_SHADER_SV_NONE 

No system value.

VKD3D_SHADER_SV_POSITION 

Vertex position; SV_Position in Direct3D.

VKD3D_SHADER_SV_CLIP_DISTANCE 

Clip distance; SV_ClipDistance in Direct3D.

VKD3D_SHADER_SV_CULL_DISTANCE 

Cull distance; SV_CullDistance in Direct3D.

VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX 

Render target layer; SV_RenderTargetArrayIndex in Direct3D.

VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX 

Viewport index; SV_ViewportArrayIndex in Direct3D.

VKD3D_SHADER_SV_VERTEX_ID 

Vertex ID; SV_VertexID in Direct3D.

VKD3D_SHADER_SV_PRIMITIVE_ID 

Primitive ID; SV_PrimitiveID in Direct3D.

VKD3D_SHADER_SV_INSTANCE_ID 

Instance ID; SV_InstanceID in Direct3D.

VKD3D_SHADER_SV_IS_FRONT_FACE 

Whether the triangle is front-facing; SV_IsFrontFace in Direct3D.

VKD3D_SHADER_SV_SAMPLE_INDEX 

Sample index; SV_SampleIndex in Direct3D.

VKD3D_SHADER_SV_TARGET 

Render target; SV_Target in Direct3D.

Since
1.9
VKD3D_SHADER_SV_DEPTH 

Depth; SV_Depth in Direct3D.

Since
1.9
VKD3D_SHADER_SV_COVERAGE 

Sample mask; SV_Coverage in Direct3D.

Since
1.9
VKD3D_SHADER_SV_DEPTH_GREATER_EQUAL 

Depth, which is guaranteed to be greater than or equal to the current depth; SV_DepthGreaterEqual in Direct3D.

Since
1.9
VKD3D_SHADER_SV_DEPTH_LESS_EQUAL 

Depth, which is guaranteed to be less than or equal to the current depth; SV_DepthLessEqual in Direct3D.

Since
1.9
VKD3D_SHADER_SV_STENCIL_REF 

Stencil reference; SV_StencilRef in Direct3D.

Since
1.9

◆ vkd3d_shader_target_type

The output format of a compiled shader.

Enumerator
VKD3D_SHADER_TARGET_NONE 

The shader has no type or is to be ignored.

This is not a valid value for vkd3d_shader_compile().

VKD3D_SHADER_TARGET_SPIRV_BINARY 

A SPIR-V shader in binary form.

This is the format used for Vulkan shaders.

VKD3D_SHADER_TARGET_D3D_ASM 

Direct3D shader assembly.

Since
1.3
VKD3D_SHADER_TARGET_D3D_BYTECODE 

Legacy Direct3D byte-code.

This is the format used for Direct3D shader model 1, 2, and 3 shaders.

Since
1.3
VKD3D_SHADER_TARGET_DXBC_TPF 

A 'Tokenized Program Format' shader embedded in a DXBC container.

This is the format used for Direct3D shader model 4 and 5 shaders.

Since
1.3
VKD3D_SHADER_TARGET_GLSL 

An 'OpenGL Shading Language' shader.

Since
1.3
VKD3D_SHADER_TARGET_FX 

Binary format used by Direct3D 9/10.x/11 effects profiles.

Output is a raw FX section without container.

Since
1.11
VKD3D_SHADER_TARGET_MSL 

A 'Metal Shading Language' shader.

Since
1.14

◆ vkd3d_shader_visibility

Describes which shader stages a resource is visible to.

Enumerator
VKD3D_SHADER_VISIBILITY_ALL 

The resource is visible to all shader stages.

VKD3D_SHADER_VISIBILITY_VERTEX 

The resource is visible only to the vertex shader.

VKD3D_SHADER_VISIBILITY_HULL 

The resource is visible only to the hull shader.

VKD3D_SHADER_VISIBILITY_DOMAIN 

The resource is visible only to the domain shader.

VKD3D_SHADER_VISIBILITY_GEOMETRY 

The resource is visible only to the geometry shader.

VKD3D_SHADER_VISIBILITY_PIXEL 

The resource is visible only to the pixel shader.

VKD3D_SHADER_VISIBILITY_COMPUTE 

The resource is visible only to the compute shader.

Function Documentation

◆ vkd3d_shader_build_varying_map()

VKD3D_SHADER_API 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.

Parameters
output_signatureThe output signature of the first shader.
input_signatureThe input signature of the second shader.
countOn output, contains the number of entries written into "varyings".
varyingsPointer 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.
Remarks
Valid legacy Direct3D pixel shaders have at most 12 varying inputs: 10 inter-stage varyings, face, and position. Therefore, in practice, it is safe to call this function with a pre-allocated array with a fixed size of 12.
Since
1.9

◆ vkd3d_shader_compile()

VKD3D_SHADER_API 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:

  • VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_SPIRV_BINARY
  • VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_SPIRV_TEXT (if vkd3d was compiled with SPIRV-Tools)
  • VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_D3D_ASM
  • VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_SPIRV_BINARY
  • VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_SPIRV_TEXT (if vkd3d was compiled with SPIRV-Tools)
  • VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_D3D_ASM
  • VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_SPIRV_BINARY
  • VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_SPIRV_TEXT (if vkd3d was compiled with SPIRV-Tools)
  • VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_D3D_ASM
  • VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_D3D_BYTECODE
  • VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_DXBC_TPF
  • VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_FX
  • VKD3D_SHADER_SOURCE_FX to VKD3D_SHADER_TARGET_D3D_ASM

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:

Parameters
compile_infoA chained structure containing compilation parameters.
outA 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.
messagesOptional 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.
Returns
A member of vkd3d_result.

◆ vkd3d_shader_convert_root_signature()

VKD3D_SHADER_API int vkd3d_shader_convert_root_signature ( struct vkd3d_shader_versioned_root_signature_desc * dst,
enum vkd3d_shader_root_signature_version version,
const struct vkd3d_shader_versioned_root_signature_desc * src )

Convert a structural representation of a root signature to a different version of structural representation.

This function corresponds to ID3D12VersionedRootSignatureDeserializer::GetRootSignatureDescAtVersion().

Parameters
dstA pointer to a vkd3d_shader_versioned_root_signature_desc structure in which the converted signature will be stored.
Members of dst may be allocated by vkd3d-shader. The signature should be freed with vkd3d_shader_free_root_signature() when no longer needed.
versionThe desired version to convert src to. This version must not be equal to src->version.
srcInput root signature description.
Returns
A member of vkd3d_result.

◆ vkd3d_shader_find_signature_element()

VKD3D_SHADER_API 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.

Parameters
signatureThe parsed input signature. This structure is normally populated by vkd3d_shader_parse_input_signature().
semantic_nameSemantic name of the desired element. This function performs a case-insensitive comparison with respect to the ASCII plane.
semantic_indexSemantic index of the desired element.
stream_indexGeometry shader stream index of the desired element. If the signature is not a geometry shader output signature, this parameter must be set to 0.
Returns
A description of the element matching the requested parameters, or NULL if no such element was found. If not NULL, the return value points into the signature parameter and should not be explicitly freed.

◆ vkd3d_shader_free_dxbc()

VKD3D_SHADER_API void vkd3d_shader_free_dxbc ( struct vkd3d_shader_dxbc_desc * dxbc)

Free the contents of a vkd3d_shader_dxbc_desc structure allocated by another vkd3d-shader function, such as vkd3d_shader_parse_dxbc().

This function may free the vkd3d_shader_dxbc_desc::sections member, but does not free the structure itself.

Parameters
dxbcThe vkd3d_shader_dxbc_desc structure to free.
Since
1.7

◆ vkd3d_shader_free_messages()

VKD3D_SHADER_API void vkd3d_shader_free_messages ( char * messages)

Free shader messages allocated by another vkd3d-shader function, such as vkd3d_shader_compile().

Parameters
messagesMessages to free. This pointer is optional and may be NULL, in which case no action will be taken.

◆ vkd3d_shader_free_root_signature()

VKD3D_SHADER_API 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.

Parameters
root_signatureSignature description to free.

◆ vkd3d_shader_free_scan_combined_resource_sampler_info()

VKD3D_SHADER_API 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.

Parameters
infoCombined resource-sampler information to free.
Since
1.10

◆ vkd3d_shader_free_scan_descriptor_info()

VKD3D_SHADER_API 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.

Parameters
scan_descriptor_infoDescriptor information to free.

◆ vkd3d_shader_free_scan_signature_info()

VKD3D_SHADER_API 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.

Parameters
infoScan information to free.
Since
1.9

◆ vkd3d_shader_free_shader_code()

VKD3D_SHADER_API 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.

Parameters
codeCode to free.

◆ vkd3d_shader_free_shader_signature()

VKD3D_SHADER_API 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.

Parameters
signatureSignature description to free.

◆ vkd3d_shader_get_supported_source_types()

VKD3D_SHADER_API 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.

Parameters
countOutput location for the size, in elements, of the returned array.
Returns
Pointer to an array of source types supported by this version of vkd3d-shader. This array may be a pointer to static data in libvkd3d-shader; it should not be freed.

◆ vkd3d_shader_get_supported_target_types()

VKD3D_SHADER_API 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.

Parameters
source_typeSource type for which to enumerate supported target types.
countOutput location for the size, in elements, of the returned array.
Returns
Pointer to an array of target types supported by this version of vkd3d-shader. This array may be a pointer to static data in libvkd3d-shader; it should not be freed.

◆ vkd3d_shader_get_version()

VKD3D_SHADER_API const char * vkd3d_shader_get_version ( unsigned int * major,
unsigned int * minor )

Returns the current version of this library.

Parameters
majorOutput location for the major version of this library.
minorOutput location for the minor version of this library.
Returns
A human-readable string describing the library name and version. This string is null-terminated and UTF-8 encoded. This may be a pointer to static data in libvkd3d-shader; it should not be freed.

◆ vkd3d_shader_parse_dxbc()

VKD3D_SHADER_API int vkd3d_shader_parse_dxbc ( const struct vkd3d_shader_code * dxbc,
uint32_t flags,
struct vkd3d_shader_dxbc_desc * desc,
char ** messages )

Parse a DXBC blob contained in a vkd3d_shader_code structure.

Parameters
dxbcA vkd3d_shader_code structure containing the DXBC blob to parse.
flagsA combination of zero or more elements of enum vkd3d_shader_parse_dxbc_flags.
descA vkd3d_shader_dxbc_desc structure describing the contents of the DXBC blob. Its vkd3d_shader_dxbc_section_desc structures will contain pointers into the input blob; its contents are only valid while the input blob is valid. The contents of this structure should be freed with vkd3d_shader_free_dxbc() when no longer needed.
messagesOptional 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.
Returns
A member of vkd3d_result.
Since
1.7

◆ vkd3d_shader_parse_input_signature()

VKD3D_SHADER_API 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.

Parameters
dxbcCompiled byte code, in DXBC format.
signatureOutput 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.
messagesOptional 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.
Returns
A member of vkd3d_result.

◆ vkd3d_shader_parse_root_signature()

VKD3D_SHADER_API int vkd3d_shader_parse_root_signature ( const struct vkd3d_shader_code * dxbc,
struct vkd3d_shader_versioned_root_signature_desc * root_signature,
char ** messages )

Convert a byte code description of a shader root signature to a structural description which can be easily parsed by C code.

This function corresponds to ID3D12VersionedRootSignatureDeserializer::GetUnconvertedRootSignatureDesc().

This function performs the reverse transformation of vkd3d_shader_serialize_root_signature().

This function parses a standalone root signature, and should not be confused with vkd3d_shader_parse_input_signature().

Parameters
dxbcCompiled byte code, in DXBC format.
root_signatureOutput location in which the decompiled root signature will be stored.
Members of root_signature may be allocated by vkd3d-shader. The signature should be freed with vkd3d_shader_free_root_signature() when no longer needed.
messagesOptional 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.
Returns
A member of vkd3d_result.

◆ vkd3d_shader_preprocess()

VKD3D_SHADER_API 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:

Parameters
compile_infoA chained structure containing compilation parameters.
outA 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.
messagesOptional 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.
Returns
A member of vkd3d_result.
Since
1.3

◆ vkd3d_shader_scan()

VKD3D_SHADER_API 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:

  • VKD3D_SHADER_SOURCE_DXBC_TPF
  • VKD3D_SHADER_SOURCE_D3D_BYTECODE
Parameters
compile_infoA chained structure containing scan parameters.
The scanner supports the following chained structures:
messagesOptional 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.
Returns
A member of vkd3d_result.

◆ vkd3d_shader_serialize_dxbc()

VKD3D_SHADER_API int vkd3d_shader_serialize_dxbc ( size_t section_count,
const struct vkd3d_shader_dxbc_section_desc * sections,
struct vkd3d_shader_code * dxbc,
char ** messages )

Serialize a DXBC description into a blob stored in a vkd3d_shader_code structure.

Parameters
section_countThe number of DXBC sections to serialize.
sectionsAn array of vkd3d_shader_dxbc_section_desc structures to serialize.
dxbcA pointer to a vkd3d_shader_code structure in which the serialized blob will be stored.
The output blob is allocated by vkd3d-shader and should be freed with vkd3d_shader_free_shader_code() when no longer needed.
messagesOptional output location for error or informational messages produced by the serializer.
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 serializer, this parameter may receive NULL instead of a valid string pointer.
Returns
A member of vkd3d_result.
Since
1.7

◆ vkd3d_shader_serialize_root_signature()

VKD3D_SHADER_API int vkd3d_shader_serialize_root_signature ( const struct vkd3d_shader_versioned_root_signature_desc * root_signature,
struct vkd3d_shader_code * dxbc,
char ** messages )

Convert a structural description of a shader root signature to a byte code format capable of being read by ID3D12Device::CreateRootSignature.

The compiled signature is compatible with Microsoft D3D 12.

This function corresponds to D3D12SerializeVersionedRootSignature().

Parameters
root_signatureDescription of the root signature.
dxbcA pointer to a vkd3d_shader_code structure in which the compiled code will be stored.
The compiled signature is allocated by vkd3d-shader and should be freed with vkd3d_shader_free_shader_code() when no longer needed.
messagesOptional output location for error or informational messages produced by the serializer.
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 serializer, this parameter may receive NULL instead of a valid string pointer.
Returns
A member of vkd3d_result.

◆ vkd3d_shader_set_log_callback()

VKD3D_SHADER_API 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.

Parameters
callbackCallback function to set.
Since
1.4