/*1* Copyright 2017-2019 Józef Kucia for CodeWeavers2*3* This library is free software; you can redistribute it and/or4* modify it under the terms of the GNU Lesser General Public5* License as published by the Free Software Foundation; either6* version 2.1 of the License, or (at your option) any later version.7*8* This library is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11* Lesser General Public License for more details.12*13* You should have received a copy of the GNU Lesser General Public14* License along with this library; if not, write to the Free Software15* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA16*/1718#ifndef __VKD3D_SHADER_H19#define __VKD3D_SHADER_H2021#include <stdbool.h>22#include <stdint.h>23#include <stddef.h>24#include <vkd3d_types.h>2526#ifdef __cplusplus27extern "C" {28#endif /* __cplusplus */2930/**31* \file vkd3d_shader.h32*33* This file contains definitions for the vkd3d-shader library.34*35* The vkd3d-shader library provides multiple utilities related to the36* compilation, transformation, and reflection of GPU shaders.37*38* \since 1.239*/4041/** \since 1.3 */42enum vkd3d_shader_api_version43{44VKD3D_SHADER_API_VERSION_1_0,45VKD3D_SHADER_API_VERSION_1_1,46VKD3D_SHADER_API_VERSION_1_2,47VKD3D_SHADER_API_VERSION_1_3,48VKD3D_SHADER_API_VERSION_1_4,49VKD3D_SHADER_API_VERSION_1_5,50VKD3D_SHADER_API_VERSION_1_6,51VKD3D_SHADER_API_VERSION_1_7,52VKD3D_SHADER_API_VERSION_1_8,53VKD3D_SHADER_API_VERSION_1_9,54VKD3D_SHADER_API_VERSION_1_10,55VKD3D_SHADER_API_VERSION_1_11,56VKD3D_SHADER_API_VERSION_1_12,57VKD3D_SHADER_API_VERSION_1_13,58VKD3D_SHADER_API_VERSION_1_14,59VKD3D_SHADER_API_VERSION_1_15,60VKD3D_SHADER_API_VERSION_1_16,61VKD3D_SHADER_API_VERSION_1_17,62VKD3D_SHADER_API_VERSION_1_18,6364VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_API_VERSION),65};6667/** The type of a chained structure. */68enum vkd3d_shader_structure_type69{70/** The structure is a vkd3d_shader_compile_info structure. */71VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_INFO,72/** The structure is a vkd3d_shader_interface_info structure. */73VKD3D_SHADER_STRUCTURE_TYPE_INTERFACE_INFO,74/** The structure is a vkd3d_shader_scan_descriptor_info structure. */75VKD3D_SHADER_STRUCTURE_TYPE_SCAN_DESCRIPTOR_INFO,76/** The structure is a vkd3d_shader_spirv_domain_shader_target_info structure. */77VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_DOMAIN_SHADER_TARGET_INFO,78/** The structure is a vkd3d_shader_spirv_target_info structure. */79VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_TARGET_INFO,80/** The structure is a vkd3d_shader_transform_feedback_info structure. */81VKD3D_SHADER_STRUCTURE_TYPE_TRANSFORM_FEEDBACK_INFO,8283/**84* The structure is a vkd3d_shader_hlsl_source_info structure.85* \since 1.386*/87VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFO,88/**89* The structure is a vkd3d_shader_preprocess_info structure.90* \since 1.391*/92VKD3D_SHADER_STRUCTURE_TYPE_PREPROCESS_INFO,93/**94* The structure is a vkd3d_shader_descriptor_offset_info structure.95* \since 1.396*/97VKD3D_SHADER_STRUCTURE_TYPE_DESCRIPTOR_OFFSET_INFO,98/**99* The structure is a vkd3d_shader_scan_signature_info structure.100* \since 1.9101*/102VKD3D_SHADER_STRUCTURE_TYPE_SCAN_SIGNATURE_INFO,103/**104* The structure is a vkd3d_shader_varying_map_info structure.105* \since 1.9106*/107VKD3D_SHADER_STRUCTURE_TYPE_VARYING_MAP_INFO,108/**109* The structure is a vkd3d_shader_scan_combined_resource_sampler_info structure.110* \since 1.10111*/112VKD3D_SHADER_STRUCTURE_TYPE_SCAN_COMBINED_RESOURCE_SAMPLER_INFO,113/**114* The structure is a vkd3d_shader_parameter_info structure.115* \since 1.13116*/117VKD3D_SHADER_STRUCTURE_TYPE_PARAMETER_INFO,118/**119* The structure is a vkd3d_shader_scan_hull_shader_tessellation_info structure.120* \since 1.15121*/122VKD3D_SHADER_STRUCTURE_TYPE_SCAN_HULL_SHADER_TESSELLATION_INFO,123/**124* The structure is a vkd3d_shader_scan_thread_group_size_info structure.125* \since 1.18126*/127VKD3D_SHADER_STRUCTURE_TYPE_SCAN_THREAD_GROUP_SIZE_INFO,128/**129* The structure is a vkd3d_shader_d3dbc_source_info structure.130* \since 1.18131*/132VKD3D_SHADER_STRUCTURE_TYPE_D3DBC_SOURCE_INFO,133134VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_STRUCTURE_TYPE),135};136137/**138* Determines how buffer UAVs are stored.139*140* This also affects UAV counters in Vulkan environments. In OpenGL141* environments, atomic counter buffers are always used for UAV counters.142*/143enum vkd3d_shader_compile_option_buffer_uav144{145/** Use buffer textures for buffer UAVs. This is the default value. */146VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV_STORAGE_TEXEL_BUFFER = 0x00000000,147/** Use storage buffers for buffer UAVs. */148VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV_STORAGE_BUFFER = 0x00000001,149150VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV),151};152153/**154* Determines how typed UAVs are declared.155* \since 1.5156*/157enum vkd3d_shader_compile_option_typed_uav158{159/** Use R32(u)i/R32f format for UAVs which are read from. This is the default value. */160VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_R32 = 0x00000000,161/**162* Use Unknown format for UAVs which are read from. This should only be set if163* shaderStorageImageReadWithoutFormat is enabled in the target environment.164*/165VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV_READ_FORMAT_UNKNOWN = 0x00000001,166167VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV),168};169170enum vkd3d_shader_compile_option_formatting_flags171{172VKD3D_SHADER_COMPILE_OPTION_FORMATTING_NONE = 0x00000000,173VKD3D_SHADER_COMPILE_OPTION_FORMATTING_COLOUR = 0x00000001,174VKD3D_SHADER_COMPILE_OPTION_FORMATTING_INDENT = 0x00000002,175VKD3D_SHADER_COMPILE_OPTION_FORMATTING_OFFSETS = 0x00000004,176VKD3D_SHADER_COMPILE_OPTION_FORMATTING_HEADER = 0x00000008,177VKD3D_SHADER_COMPILE_OPTION_FORMATTING_RAW_IDS = 0x00000010,178/**179* Emit the signatures when disassembling a shader.180*181* \since 1.12182*/183VKD3D_SHADER_COMPILE_OPTION_FORMATTING_IO_SIGNATURES = 0x00000020,184185VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FORMATTING_FLAGS),186};187188/** Determines how matrices are stored. \since 1.9 */189enum vkd3d_shader_compile_option_pack_matrix_order190{191VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ROW_MAJOR = 0x00000001,192VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_COLUMN_MAJOR = 0x00000002,193194VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER),195};196197/** Individual options to enable various backward compatibility features. \since 1.10 */198enum vkd3d_shader_compile_option_backward_compatibility199{200/**201* Causes compiler to convert SM1-3 semantics to corresponding System Value semantics,202* when compiling HLSL sources for SM4+ targets.203*204* This option does the following conversions:205*206* - POSITION to SV_Position for vertex shader outputs, pixel shader inputs,207* and geometry shader inputs and outputs;208* - COLORN to SV_TargetN for pixel shader outputs;209* - DEPTH to SV_Depth for pixel shader outputs.210*/211VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES = 0x00000001,212/**213* Causes 'double' to behave as an alias for 'float'. This option only214* applies to HLSL sources with shader model 1-3 target profiles. Without215* this option using the 'double' type produces compilation errors in216* these target profiles.217*218* This option is disabled by default.219*220* \since 1.14221*/222VKD3D_SHADER_COMPILE_OPTION_DOUBLE_AS_FLOAT_ALIAS = 0x00000002,223224VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY),225};226227/**228* Determines the origin of fragment coordinates.229*230* \since 1.10231*/232enum vkd3d_shader_compile_option_fragment_coordinate_origin233{234/** Fragment coordinates originate from the upper-left. This is the235* default; it's also the only value supported by Vulkan environments. */236VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_UPPER_LEFT = 0x00000000,237/** Fragment coordinates originate from the lower-left. This matches the238* traditional behaviour of OpenGL environments. */239VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_LOWER_LEFT = 0x00000001,240241VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN),242};243244/** Advertises feature availability. \since 1.11 */245enum vkd3d_shader_compile_option_feature_flags246{247/** The SPIR-V target environment supports 64-bit integer types. This248* corresponds to the "shaderInt64" feature in the Vulkan API, and the249* "GL_ARB_gpu_shader_int64" extension in the OpenGL API. */250VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 = 0x00000001,251/** The SPIR-V target environment supports 64-bit floating-point types.252* This corresponds to the "shaderFloat64" feature in the Vulkan API, and253* the "GL_ARB_gpu_shader_fp64" extension in the OpenGL API. */254VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64 = 0x00000002,255/** The SPIR-V target environment supports wave operations.256* This flag is valid only in VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_1257* or greater, and corresponds to the following minimum requirements in258* VkPhysicalDeviceSubgroupProperties:259* - subgroupSize >= 4.260* - supportedOperations has BASIC, VOTE, ARITHMETIC, BALLOT, SHUFFLE and261* QUAD bits set.262* - supportedStages include COMPUTE and FRAGMENT. \since 1.12 */263VKD3D_SHADER_COMPILE_OPTION_FEATURE_WAVE_OPS = 0x00000004,264/** The SPIR-V target environment supports zero-initializing workgroup265* memory. This corresponds to the "shaderZeroInitializeWorkgroupMemory"266* Vulkan feature. \since 1.16 */267VKD3D_SHADER_COMPILE_OPTION_FEATURE_ZERO_INITIALIZE_WORKGROUP_MEMORY = 0x00000008,268269VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLAGS),270};271272/**273* Flags for vkd3d_shader_parse_dxbc().274*275* \since 1.12276*/277enum vkd3d_shader_parse_dxbc_flags278{279/** Ignore the checksum and continue parsing even if it is280* incorrect. */281VKD3D_SHADER_PARSE_DXBC_IGNORE_CHECKSUM = 0x00000001,282283VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_PARSE_DXBC_FLAGS),284};285286enum vkd3d_shader_compile_option_name287{288/**289* If \a value is nonzero, do not include debug information in the290* compiled shader. The default value is zero.291*292* This option is supported by vkd3d_shader_compile(). However, not all293* compilers support generating debug information.294*/295VKD3D_SHADER_COMPILE_OPTION_STRIP_DEBUG = 0x00000001,296/** \a value is a member of enum vkd3d_shader_compile_option_buffer_uav. */297VKD3D_SHADER_COMPILE_OPTION_BUFFER_UAV = 0x00000002,298/** \a value is a member of enum vkd3d_shader_compile_option_formatting_flags. */299VKD3D_SHADER_COMPILE_OPTION_FORMATTING = 0x00000003,300/** \a value is a member of enum vkd3d_shader_api_version. \since 1.3 */301VKD3D_SHADER_COMPILE_OPTION_API_VERSION = 0x00000004,302/** \a value is a member of enum vkd3d_shader_compile_option_typed_uav. \since 1.5 */303VKD3D_SHADER_COMPILE_OPTION_TYPED_UAV = 0x00000005,304/**305* If \a value is nonzero, write the point size for Vulkan tessellation and306* geometry shaders. This option should be enabled if and only if the307* shaderTessellationAndGeometryPointSize feature is enabled. The default308* value is nonzero, i.e. write the point size.309*310* This option is supported by vkd3d_shader_compile() for the SPIR-V target311* type and Vulkan targets; it should not be enabled otherwise.312*313* \since 1.7314*/315VKD3D_SHADER_COMPILE_OPTION_WRITE_TESS_GEOM_POINT_SIZE = 0x00000006,316/**317* This option specifies default matrix packing order for HLSL sources.318* Explicit variable modifiers or pragmas will take precedence.319*320* \a value is a member of enum vkd3d_shader_compile_option_pack_matrix_order.321*322* \since 1.9323*/324VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER = 0x00000007,325/**326* This option is used to enable various backward compatibility features.327*328* \a value is a mask of values from enum vkd3d_shader_compile_option_backward_compatibility.329*330* \since 1.10331*/332VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY = 0x00000008,333/**334* This option specifies the origin of fragment coordinates for SPIR-V335* targets.336*337* \a value is a member of enum338* vkd3d_shader_compile_option_fragment_coordinate_origin.339*340* \since 1.10341*/342VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN = 0x00000009,343/**344* This option specifies the shader features available in the target345* environment. These are not extensions, i.e. they are always supported346* by the driver, but may not be supported by the available hardware.347*348* \a value is a member of enum vkd3d_shader_compile_option_feature_flags.349*350* \since 1.11351*/352VKD3D_SHADER_COMPILE_OPTION_FEATURE = 0x0000000a,353/**354* If \a value is non-zero compilation will produce a child effect using355* shared object descriptions, as instructed by the "shared" modifier.356* Child effects are supported with fx_4_0, and fx_4_1 profiles. This option357* and "shared" modifiers are ignored for the fx_5_0 profile and non-fx profiles.358* The fx_2_0 profile does not have a separate concept of child effects, variables359* marked with "shared" modifier will be marked as such in a binary.360*361* \since 1.12362*/363VKD3D_SHADER_COMPILE_OPTION_CHILD_EFFECT = 0x0000000b,364/**365* If \a value is nonzero, emit a compile warning warn when vectors or366* matrices are truncated in an implicit conversion.367* If warnings are disabled, this option has no effect.368* This option has no effects for targets other than HLSL.369*370* The default value is nonzero, i.e. enable implicit truncation warnings.371*372* \since 1.12373*/374VKD3D_SHADER_COMPILE_OPTION_WARN_IMPLICIT_TRUNCATION = 0x0000000c,375/**376* If \a value is nonzero, empty constant buffers descriptions are377* written out in the output effect binary. This option applies only378* to fx_4_0 and fx_4_1 profiles and is otherwise ignored.379*380* \since 1.12381*/382VKD3D_SHADER_COMPILE_OPTION_INCLUDE_EMPTY_BUFFERS_IN_EFFECTS = 0x0000000d,383384VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME),385};386387/**388* Various settings which may affect shader compilation or scanning, passed as389* part of struct vkd3d_shader_compile_info. For more details, see the390* documentation for individual options.391*/392struct vkd3d_shader_compile_option393{394/** Name of the option. */395enum vkd3d_shader_compile_option_name name;396/**397* A value associated with the option. The type and interpretation of the398* value depends on the option in question.399*/400unsigned int value;401};402403/** Describes which shader stages a resource is visible to. */404enum vkd3d_shader_visibility405{406/** The resource is visible to all shader stages. */407VKD3D_SHADER_VISIBILITY_ALL = 0,408/** The resource is visible only to the vertex shader. */409VKD3D_SHADER_VISIBILITY_VERTEX = 1,410/** The resource is visible only to the hull shader. */411VKD3D_SHADER_VISIBILITY_HULL = 2,412/** The resource is visible only to the domain shader. */413VKD3D_SHADER_VISIBILITY_DOMAIN = 3,414/** The resource is visible only to the geometry shader. */415VKD3D_SHADER_VISIBILITY_GEOMETRY = 4,416/** The resource is visible only to the pixel shader. */417VKD3D_SHADER_VISIBILITY_PIXEL = 5,418419/** The resource is visible only to the compute shader. */420VKD3D_SHADER_VISIBILITY_COMPUTE = 1000000000,421422VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_VISIBILITY),423};424425/** A generic structure containing a GPU shader, in text or byte-code format. */426struct vkd3d_shader_code427{428/**429* Pointer to the code. Note that textual formats are not null-terminated.430* Therefore \a size should not include a null terminator when this431* structure is passed as input to a vkd3d-shader function, and \a size432* will not include a null terminator when this structure is used as433* output.434*435* For convenience, vkd3d_shader_preprocess() and vkd3d_shader_compile()436* will append a null terminator past the end of their output when437* outputting textual formats like VKD3D_SHADER_TARGET_D3D_ASM. This makes438* it safe to call functions like strlen() on \a code for such output,439* although doing so will obviously not account for any embedded null440* characters that may be present.441*/442const void *code;443/** Size of \a code, in bytes. */444size_t size;445};446447/** The type of a shader resource descriptor. */448enum vkd3d_shader_descriptor_type449{450/**451* The descriptor is a shader resource view. In Direct3D assembly, this is452* bound to a t# register.453*/454VKD3D_SHADER_DESCRIPTOR_TYPE_SRV = 0x0,455/**456* The descriptor is an unordered access view. In Direct3D assembly, this is457* bound to a u# register.458*/459VKD3D_SHADER_DESCRIPTOR_TYPE_UAV = 0x1,460/**461* The descriptor is a constant buffer view. In Direct3D assembly, this is462* bound to a cb# register.463*/464VKD3D_SHADER_DESCRIPTOR_TYPE_CBV = 0x2,465/**466* The descriptor is a sampler. In Direct3D assembly, this is bound to an s#467* register.468*/469VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER = 0x3,470471VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_DESCRIPTOR_TYPE),472};473474/**475* A common structure describing the bind point of a descriptor or descriptor476* array in the target environment.477*/478struct vkd3d_shader_descriptor_binding479{480/**481* The set of the descriptor. If the target environment does not support482* descriptor sets, this value must be set to 0.483*/484unsigned int set;485/** The binding index of the descriptor. */486unsigned int binding;487/**488* The size of this descriptor array. If an offset is specified for this489* binding by the vkd3d_shader_descriptor_offset_info structure, counting490* starts at that offset.491*/492unsigned int count;493};494495enum vkd3d_shader_binding_flag496{497VKD3D_SHADER_BINDING_FLAG_BUFFER = 0x00000001,498VKD3D_SHADER_BINDING_FLAG_IMAGE = 0x00000002,499500VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_BINDING_FLAG),501};502503/**504* The factor used to interpolate the fragment output colour with fog.505*506* See VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE for specification of the507* interpolation factor as defined here.508*509* The following variables may be used to determine the interpolation factor:510*511* c = The fog coordinate value output from the vertex shader. This is an512* inter-stage varying with the semantic name "FOG" and semantic index 0.513* It may be modified by VKD3D_SHADER_PARAMETER_NAME_FOG_SOURCE.514* E = The value of VKD3D_SHADER_PARAMETER_NAME_FOG_END.515* k = The value of VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE.516*517* \since 1.15518*/519enum vkd3d_shader_fog_fragment_mode520{521/**522* No fog interpolation is applied;523* the output colour is passed through unmodified.524* Equivalently, the fog interpolation factor is 1.525*/526VKD3D_SHADER_FOG_FRAGMENT_NONE = 0x0,527/**528* The fog interpolation factor is 2^-(k * c).529*530* In order to implement traditional exponential fog, as present in531* Direct3D and OpenGL, i.e.532*533* e^-(density * c)534*535* set536*537* k = density * log₂(e)538*/539VKD3D_SHADER_FOG_FRAGMENT_EXP = 0x1,540/**541* The fog interpolation factor is 2^-((k * c)²).542*543* In order to implement traditional square-exponential fog, as present in544* Direct3D and OpenGL, i.e.545*546* e^-((density * c)²)547*548* set549*550* k = density * √log₂(e)551*/552VKD3D_SHADER_FOG_FRAGMENT_EXP2 = 0x2,553/**554* The fog interpolation factor is (E - c) * k.555*556* In order to implement traditional linear fog, as present in Direct3D and557* OpenGL, i.e.558*559* (end - c) / (end - start)560*561* set562*563* E = end564* k = 1 / (end - start)565*/566VKD3D_SHADER_FOG_FRAGMENT_LINEAR = 0x3,567568VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_FOG_FRAGMENT_MODE),569};570571/**572* The source of the fog varying output by a pre-rasterization shader.573* The fog varying is defined as the output varying with the semantic name "FOG"574* and semantic index 0.575*576* See VKD3D_SHADER_PARAMETER_NAME_FOG_SOURCE for further documentation of this577* parameter.578*579* \since 1.15580*/581enum vkd3d_shader_fog_source582{583/**584* The source shader is not modified. That is, the fog varying in the target585* shader is the original fog varying if and only if present.586*/587VKD3D_SHADER_FOG_SOURCE_FOG = 0x0,588/**589* If the source shader has a fog varying, it is not modified.590* Otherwise, if the source shader outputs a varying with semantic name591* "COLOR" and semantic index 1 whose index includes a W component,592* said W component is output as fog varying.593* Otherwise, no fog varying is output.594*/595VKD3D_SHADER_FOG_SOURCE_FOG_OR_SPECULAR_W = 0x1,596/**597* The fog source is the Z component of the position output by the vertex598* shader.599*/600VKD3D_SHADER_FOG_SOURCE_Z = 0x2,601/**602* The fog source is the W component of the position output by the vertex603* shader.604*/605VKD3D_SHADER_FOG_SOURCE_W = 0x3,606607VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_FOG_SOURCE),608};609610/**611* The manner in which a parameter value is provided to the shader, used in612* struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1.613*/614enum vkd3d_shader_parameter_type615{616VKD3D_SHADER_PARAMETER_TYPE_UNKNOWN,617/** The parameter value is embedded directly in the shader. */618VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT,619/**620* The parameter value is provided to the shader via specialization621* constants. This value is only supported for the SPIR-V target type.622*/623VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT,624/**625* The parameter value is provided to the shader as part of a uniform626* buffer.627*628* \since 1.13629*/630VKD3D_SHADER_PARAMETER_TYPE_BUFFER,631632VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_PARAMETER_TYPE),633};634635/**636* The format of data provided to the shader, used in637* struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1.638*/639enum vkd3d_shader_parameter_data_type640{641VKD3D_SHADER_PARAMETER_DATA_TYPE_UNKNOWN,642/** The parameter is provided as a 32-bit unsigned integer. */643VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32,644/** The parameter is provided as a 32-bit float. \since 1.13 */645VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32,646/**647* The parameter is provided as a 4-dimensional vector of 32-bit floats.648* This parameter must be used with struct vkd3d_shader_parameter1;649* it cannot be used with struct vkd3d_shader_parameter.650* \since 1.14651*/652VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4,653654VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_PARAMETER_DATA_TYPE),655};656657/**658* Names a specific shader parameter, used in659* struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1.660*/661enum vkd3d_shader_parameter_name662{663VKD3D_SHADER_PARAMETER_NAME_UNKNOWN,664/**665* The sample count of the framebuffer, as returned by the HLSL function666* GetRenderTargetSampleCount() or the GLSL builtin gl_NumSamples.667*668* This parameter should be specified when compiling to SPIR-V, which669* provides no builtin ability to query this information from the shader.670*671* The default value is 1.672*673* The data type for this parameter must be674* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.675*/676VKD3D_SHADER_PARAMETER_NAME_RASTERIZER_SAMPLE_COUNT,677/**678* Alpha test comparison function. When this parameter is provided, if the679* alpha component of the pixel shader colour output at location 0 fails the680* test, as defined by this function and the reference value provided by681* VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF, the fragment will be682* discarded.683*684* This parameter, along with VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF,685* can be used to implement fixed function alpha test, as present in686* Direct3D versions up to 9, if the target environment does not support687* alpha test as part of its own fixed-function API (as Vulkan and core688* OpenGL).689*690* The default value is VKD3D_SHADER_COMPARISON_FUNC_ALWAYS.691*692* The data type for this parameter must be693* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32. The value specified must be694* a member of enum vkd3d_shader_comparison_func.695*696* Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this697* version of vkd3d-shader.698*699* \since 1.13700*/701VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_FUNC,702/**703* Alpha test reference value.704* See VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_FUNC for documentation of705* alpha test.706*707* The default value is zero.708*709* \since 1.13710*/711VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF,712/**713* Whether to use flat interpolation for fragment shader colour inputs.714* If the value is nonzero, inputs whose semantic usage is COLOR will use715* flat interpolation instead of linear.716* This parameter is ignored if the shader model is 4 or greater, since only717* shader model 3 and below do not specify the interpolation mode in the718* shader bytecode.719*720* This parameter can be used to implement fixed function shade mode, as721* present in Direct3D versions up to 9, if the target environment does not722* support shade mode as part of its own fixed-function API (as Vulkan and723* core OpenGL).724*725* The data type for this parameter must be726* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.727*728* The default value is zero, i.e. use linear interpolation.729*730* Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this731* version of vkd3d-shader.732*733* \since 1.13734*/735VKD3D_SHADER_PARAMETER_NAME_FLAT_INTERPOLATION,736/**737* A mask of enabled clip planes.738*739* When this parameter is provided to a vertex shader, for each nonzero bit740* of this mask, a user clip distance will be generated from vertex position741* in clip space, and the clip plane defined by the indexed vector, taken742* from the VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_# parameter.743*744* Regardless of the specific clip planes which are enabled, the clip745* distances which are output are a contiguous array starting from clip746* distance 0. This affects the interface of OpenGL. For example, if only747* clip planes 1 and 3 are enabled (and so the value of the mask is 0xa),748* the user should enable only GL_CLIP_DISTANCE0 and GL_CLIP_DISTANCE1.749*750* The default value is zero, i.e. do not enable any clip planes.751*752* The data type for this parameter must be753* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.754*755* Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this756* version of vkd3d-shader.757*758* If the source shader writes clip distances and this parameter is nonzero,759* compilation fails.760*761* \since 1.14762*/763VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_MASK,764/**765* Clip plane values.766* See VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_MASK for documentation of767* clip planes.768*769* These enum values are contiguous and arithmetic may safely be performed770* on them. That is, VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_[n] is771* VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_0 plus n.772*773* The data type for each parameter must be774* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4.775*776* The default value for each plane is a (0, 0, 0, 0) vector.777*778* \since 1.14779*/780VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_0,781VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_1,782VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_2,783VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_3,784VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_4,785VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_5,786VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_6,787VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_7,788/**789* Point size.790*791* When this parameter is provided to a vertex, tessellation, or geometry792* shader, and the source shader does not write point size, it specifies a793* uniform value which will be written to point size.794* If the source shader writes point size, this parameter is ignored.795*796* This parameter can be used to implement fixed function point size, as797* present in Direct3D versions 8 and 9, if the target environment does not798* support point size as part of its own fixed-function API (as Vulkan and799* core OpenGL).800*801* The data type for this parameter must be802* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.803*804* \since 1.14805*/806VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE,807/**808* Minimum point size.809*810* When this parameter is provided to a vertex, tessellation, or geometry811* shader, and the source shader writes point size or uses the812* VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE parameter, the point size will813* be clamped to the provided minimum value.814* If point size is not written in one of these ways,815* this parameter is ignored.816* If this parameter is not provided, the point size will not be clamped817* to a minimum size by vkd3d-shader.818*819* This parameter can be used to implement fixed function point size, as820* present in Direct3D versions 8 and 9, if the target environment does not821* support point size as part of its own fixed-function API (as Vulkan and822* core OpenGL).823*824* The data type for this parameter must be825* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.826*827* \since 1.14828*/829VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN,830/**831* Maximum point size.832*833* This parameter has identical behaviour to834* VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN, except that it provides835* the maximum size rather than the minimum.836*837* \since 1.14838*/839VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MAX,840/**841* Whether texture coordinate inputs should take their values from the842* point coordinate.843*844* When this parameter is provided to a pixel shader, and the value is845* nonzero, any fragment shader input with the semantic name "TEXCOORD"846* takes its value from the point coordinates instead of from the previous847* shader. The point coordinates here are defined as a four-component vector848* whose X and Y components are the X and Y coordinates of the fragment849* within a point being rasterized, and whose Z and W components are zero.850*851* In GLSL, the X and Y components are drawn from gl_PointCoord; in SPIR-V,852* they are drawn from a variable with the BuiltinPointCoord decoration.853*854* This includes t# fragment shader inputs in shader model 2 shaders,855* as well as texture sampling in shader model 1 shaders.856*857* This parameter can be used to implement fixed function point sprite, as858* present in Direct3D versions 8 and 9, if the target environment does not859* support point sprite as part of its own fixed-function API (as Vulkan and860* core OpenGL).861*862* The data type for this parameter must be863* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.864*865* The default value is zero, i.e. use the original varyings.866*867* Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this868* version of vkd3d-shader.869*870* \since 1.14871*/872VKD3D_SHADER_PARAMETER_NAME_POINT_SPRITE,873/**874* Fog mode used in fragment shaders.875*876* The value specified by this parameter must be a member of877* enum vkd3d_shader_fog_fragment_mode.878*879* If not VKD3D_SHADER_FOG_FRAGMENT_NONE, the pixel shader colour output at880* location 0 is linearly interpolated with the fog colour defined by881* VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR. The interpolation factor is882* defined according to the enumerant selected by this parameter.883* The interpolated value is then outputted instead of the original value at884* location 0.885*886* An interpolation factor of 0 specifies to use the fog colour; a factor of887* 1 specifies to use the original colour output. The interpolation factor888* is clamped to the [0, 1] range before interpolating.889*890* The default value is VKD3D_SHADER_FOG_FRAGMENT_NONE.891*892* The data type for this parameter must be893* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.894*895* Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this896* version of vkd3d-shader.897*898* \since 1.15899*/900VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE,901/**902* Fog colour.903* See VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE for documentation of904* fog.905*906* The data type for this parameter must be907* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4.908*909* The default value is transparent black, i.e. the vector {0, 0, 0, 0}.910*911* \since 1.15912*/913VKD3D_SHADER_PARAMETER_NAME_FOG_COLOUR,914/**915* End coordinate for linear fog.916* See VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE for documentation of917* fog.918*919* The data type for this parameter must be920* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.921*922* The default value is 1.0.923*924* \since 1.15925*/926VKD3D_SHADER_PARAMETER_NAME_FOG_END,927/**928* Scale value for fog.929* See VKD3D_SHADER_PARAMETER_NAME_FOG_FRAGMENT_MODE for documentation of930* fog.931*932* The data type for this parameter must be933* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.934*935* The default value is 1.0.936*937* \since 1.15938*/939VKD3D_SHADER_PARAMETER_NAME_FOG_SCALE,940/**941* Fog source. The value specified by this parameter must be a member of942* enum vkd3d_shader_fog_source.943*944* This parameter replaces or suppletes the fog varying output by a945* pre-rasterization shader. The fog varying is defined as the output946* varying with the semantic name "FOG" and semantic index 0.947*948* Together with other fog parameters, this parameter can be used to949* implement fixed function fog, as present in Direct3D versions up to 9,950* if the target environment does not support fog as part of its own951* fixed-function API (as Vulkan and core OpenGL).952*953* The default value is VKD3D_SHADER_FOG_SOURCE_FOG.954*955* The data type for this parameter must be956* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.957*958* Only VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT is supported in this959* version of vkd3d-shader.960*961* \since 1.15962*/963VKD3D_SHADER_PARAMETER_NAME_FOG_SOURCE,964/**965* Bump-mapping matrix. This parameter is used in the evaluation of the966* Shader Model 1.x instructions BEM, TEXBEM, and TEXBEML.967*968* This parameter specifies a 2x2 matrix, packed into a vector in the order969* [00, 01, 10, 11], where "01" specifies the component at column 0 and row970* 1. These coordinates correspond to the Direct3D notation.971*972* To use this parameter to implement Direct3D bump mapping, pass the values973* of the texture stage states D3DTSS_BUMPENVMAT00, D3DTSS_BUMPENVMAT01,974* D3DTSS_BUMPENVMAT10, and D3DTSS_BUMPENVMAT11, in that order.975*976* These enum values are contiguous and arithmetic may safely be performed977* on them. That is, VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_[n] is978* VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_0 plus n.979*980* The data type for each parameter must be981* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4.982*983* The default value for each parameter is the zero matrix [0, 0; 0, 0].984*985* \since 1.18986*/987VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_0,988VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_1,989VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_2,990VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_3,991VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_4,992VKD3D_SHADER_PARAMETER_NAME_BUMP_MATRIX_5,993/**994* Bump-mapping luminance scale factor. This parameter is used in the995* evaluation of the Shader Model 1.x instruction TEXBEML.996*997* To use this parameter to implement Direct3D bump mapping, pass the value998* of the texture stage state D3DTSS_BUMPENVLSCALE.999*1000* These enum values are contiguous and arithmetic may safely be performed1001* on them. That is, VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_[n] is1002* VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_0 plus n.1003*1004* The data type for each parameter must be1005* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.1006*1007* The default value for each parameter is 0.0.1008*1009* \since 1.181010*/1011VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_0,1012VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_1,1013VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_2,1014VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_3,1015VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_4,1016VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_SCALE_5,1017/**1018* Bump-mapping luminance offset. This parameter is used in the1019* evaluation of the Shader Model 1.x instruction TEXBEML.1020*1021* To use this parameter to implement Direct3D bump mapping, pass the value1022* of the texture stage state D3DTSS_BUMPENVLOFFSET.1023*1024* These enum values are contiguous and arithmetic may safely be performed1025* on them. That is, VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_[n] is1026* VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_0 plus n.1027*1028* The data type for each parameter must be1029* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.1030*1031* The default value for each parameter is 0.0.1032*1033* \since 1.181034*/1035VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_0,1036VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_1,1037VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_2,1038VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_3,1039VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_4,1040VKD3D_SHADER_PARAMETER_NAME_BUMP_LUMINANCE_OFFSET_5,10411042VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_PARAMETER_NAME),1043};10441045/**1046* The value of an immediate constant parameter, used in1047* struct vkd3d_shader_parameter.1048*/1049struct vkd3d_shader_parameter_immediate_constant1050{1051union1052{1053/**1054* The value if the parameter's data type is1055* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.1056*/1057uint32_t u32;1058/**1059* The value if the parameter's data type is1060* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.1061*1062* \since 1.131063*/1064float f32;1065} u;1066};10671068/**1069* The value of an immediate constant parameter, used in1070* struct vkd3d_shader_parameter1.1071*1072* \since 1.131073*/1074struct vkd3d_shader_parameter_immediate_constant11075{1076union1077{1078/**1079* The value if the parameter's data type is1080* VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32.1081*/1082uint32_t u32;1083/**1084* The value if the parameter's data type is1085* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32.1086*/1087float f32;1088/**1089* A pointer to the value if the parameter's data type is1090* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4.1091*1092* \since 1.141093*/1094float f32_vec4[4];1095void *_pointer_pad;1096uint32_t _pad[4];1097} u;1098};10991100/**1101* The linkage of a specialization constant parameter, used in1102* struct vkd3d_shader_parameter and struct vkd3d_shader_parameter1.1103*/1104struct vkd3d_shader_parameter_specialization_constant1105{1106/**1107* The ID of the specialization constant.1108* If the type comprises more than one constant, such as1109* VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4, then a contiguous1110* array of specialization constants should be used, one for each component,1111* and this ID should point to the first component.1112*/1113uint32_t id;1114};11151116/**1117* The linkage of a parameter specified through a uniform buffer, used in1118* struct vkd3d_shader_parameter1.1119*/1120struct vkd3d_shader_parameter_buffer1121{1122/**1123* The set of the uniform buffer descriptor. If the target environment does1124* not support descriptor sets, this value must be set to 0.1125*/1126unsigned int set;1127/** The binding index of the uniform buffer descriptor. */1128unsigned int binding;1129/** The byte offset of the parameter within the buffer. */1130uint32_t offset;1131};11321133/**1134* An individual shader parameter.1135*1136* This structure is an earlier version of struct vkd3d_shader_parameter11137* which supports fewer parameter types;1138* refer to that structure for usage information.1139*1140* Only the following types may be used with this structure:1141*1142* - VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT1143* - VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT1144*/1145struct vkd3d_shader_parameter1146{1147enum vkd3d_shader_parameter_name name;1148enum vkd3d_shader_parameter_type type;1149enum vkd3d_shader_parameter_data_type data_type;1150union1151{1152struct vkd3d_shader_parameter_immediate_constant immediate_constant;1153struct vkd3d_shader_parameter_specialization_constant specialization_constant;1154} u;1155};11561157/**1158* An individual shader parameter.1159*1160* This structure is used in struct vkd3d_shader_parameter_info; see there for1161* explanation of shader parameters.1162*1163* For example, to specify the rasterizer sample count to the shader via an1164* unsigned integer specialization constant with ID 3,1165* set the following members:1166*1167* - \a name = VKD3D_SHADER_PARAMETER_NAME_RASTERIZER_SAMPLE_COUNT1168* - \a type = VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT1169* - \a data_type = VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT321170* - \a u.specialization_constant.id = 31171*1172* This structure is an extended version of struct vkd3d_shader_parameter.1173*/1174struct vkd3d_shader_parameter11175{1176/** The builtin parameter to be mapped. */1177enum vkd3d_shader_parameter_name name;1178/** How the parameter will be provided to the shader. */1179enum vkd3d_shader_parameter_type type;1180/**1181* The data type of the supplied parameter, which determines how it is to1182* be interpreted.1183*/1184enum vkd3d_shader_parameter_data_type data_type;1185union1186{1187/**1188* Additional information if \a type is1189* VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT.1190*/1191struct vkd3d_shader_parameter_immediate_constant1 immediate_constant;1192/**1193* Additional information if \a type is1194* VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT.1195*/1196struct vkd3d_shader_parameter_specialization_constant specialization_constant;1197/**1198* Additional information if \a type is1199* VKD3D_SHADER_PARAMETER_TYPE_BUFFER.1200*/1201struct vkd3d_shader_parameter_buffer buffer;1202void *_pointer_pad;1203uint32_t _pad[4];1204} u;1205};12061207/**1208* Symbolic register indices for mapping uniform constant register sets in1209* legacy Direct3D bytecode to constant buffer views in the target environment.1210*1211* Members of this enumeration are used in1212* \ref vkd3d_shader_resource_binding.register_index.1213*1214* \since 1.91215*/1216enum vkd3d_shader_d3dbc_constant_register1217{1218/** The float constant register set, c# in Direct3D assembly. */1219VKD3D_SHADER_D3DBC_FLOAT_CONSTANT_REGISTER = 0x0,1220/** The integer constant register set, i# in Direct3D assembly. */1221VKD3D_SHADER_D3DBC_INT_CONSTANT_REGISTER = 0x1,1222/** The boolean constant register set, b# in Direct3D assembly. */1223VKD3D_SHADER_D3DBC_BOOL_CONSTANT_REGISTER = 0x2,12241225VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_D3DBC_CONSTANT_REGISTER),1226};12271228/**1229* Describes the mapping of a single resource or resource array to its binding1230* point in the target environment.1231*1232* For example, to map a Direct3D SRV with register space 2, register "t3" to1233* a Vulkan descriptor in set 4 and with binding 5, set the following members:1234* - \a type = VKD3D_SHADER_DESCRIPTOR_TYPE_SRV1235* - \a register_space = 21236* - \a register_index = 31237* - \a binding.set = 41238* - \a binding.binding = 51239* - \a binding.count = 11240*1241* This structure is used in struct vkd3d_shader_interface_info.1242*/1243struct vkd3d_shader_resource_binding1244{1245/** The type of this descriptor. */1246enum vkd3d_shader_descriptor_type type;1247/**1248* Register space of the Direct3D resource. If the source format does not1249* support multiple register spaces, this parameter must be set to 0.1250*/1251unsigned int register_space;1252/**1253* Register index of the Direct3D resource.1254*1255* For legacy Direct3D shaders, vkd3d-shader maps each constant register1256* set to a single constant buffer view. This parameter names the register1257* set to map, and must be a member of1258* enum vkd3d_shader_d3dbc_constant_register.1259*/1260unsigned int register_index;1261/** Shader stage(s) to which the resource is visible. */1262enum vkd3d_shader_visibility shader_visibility;1263/** A combination of zero or more elements of vkd3d_shader_binding_flag. */1264unsigned int flags;12651266/** The binding in the target environment. */1267struct vkd3d_shader_descriptor_binding binding;1268};12691270#define VKD3D_SHADER_DUMMY_SAMPLER_INDEX ~0u12711272/**1273* Describes the mapping of a Direct3D resource-sampler pair to a combined1274* sampler (i.e. sampled image).1275*1276* This structure is used in struct vkd3d_shader_interface_info.1277*/1278struct vkd3d_shader_combined_resource_sampler1279{1280/**1281* Register space of the Direct3D resource. If the source format does not1282* support multiple register spaces, this parameter must be set to 0.1283*/1284unsigned int resource_space;1285/** Register index of the Direct3D resource. */1286unsigned int resource_index;1287/**1288* Register space of the Direct3D sampler. If the source format does not1289* support multiple register spaces, this parameter must be set to 0.1290*/1291unsigned int sampler_space;1292/** Register index of the Direct3D sampler. */1293unsigned int sampler_index;1294/** Shader stage(s) to which the resource is visible. */1295enum vkd3d_shader_visibility shader_visibility;1296/** A combination of zero or more elements of vkd3d_shader_binding_flag. */1297unsigned int flags;12981299/** The binding in the target environment. */1300struct vkd3d_shader_descriptor_binding binding;1301};13021303/**1304* Describes the mapping of a single Direct3D UAV counter.1305*1306* This structure is used in struct vkd3d_shader_interface_info.1307*/1308struct vkd3d_shader_uav_counter_binding1309{1310/**1311* Register space of the Direct3D UAV descriptor. If the source format does1312* not support multiple register spaces, this parameter must be set to 0.1313*/1314unsigned int register_space;1315/** Register index of the Direct3D UAV descriptor. */1316unsigned int register_index;1317/** Shader stage(s) to which the UAV counter is visible. */1318enum vkd3d_shader_visibility shader_visibility;13191320/** The binding in the target environment. */1321struct vkd3d_shader_descriptor_binding binding;1322unsigned int offset;1323};13241325/**1326* Describes the mapping of a Direct3D constant buffer to a range of push1327* constants in the target environment.1328*1329* This structure is used in struct vkd3d_shader_interface_info.1330*/1331struct vkd3d_shader_push_constant_buffer1332{1333/**1334* Register space of the Direct3D resource. If the source format does not1335* support multiple register spaces, this parameter must be set to 0.1336*/1337unsigned int register_space;1338/** Register index of the Direct3D resource. */1339unsigned int register_index;1340/** Shader stage(s) to which the resource is visible. */1341enum vkd3d_shader_visibility shader_visibility;13421343/** Offset, in bytes, of the target push constants. */1344unsigned int offset;1345/** Size, in bytes, of the target push constants. */1346unsigned int size;1347};13481349/**1350* A chained structure describing the interface between a compiled shader and1351* the target environment.1352*1353* For example, when compiling Direct3D shader byte code to SPIR-V, this1354* structure contains mappings from Direct3D descriptor registers to SPIR-V1355* descriptor bindings.1356*1357* This structure is optional. If omitted, vkd3d_shader_compile() will use a1358* default mapping, in which resources are mapped to sequential bindings in1359* register set 0.1360*1361* This structure extends vkd3d_shader_compile_info.1362*1363* This structure contains only input parameters.1364*/1365struct vkd3d_shader_interface_info1366{1367/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_INTERFACE_INFO. */1368enum vkd3d_shader_structure_type type;1369/** Optional pointer to a structure containing further parameters. */1370const void *next;13711372/** Pointer to an array of bindings for shader resource descriptors. */1373const struct vkd3d_shader_resource_binding *bindings;1374/** Size, in elements, of \ref bindings. */1375unsigned int binding_count;13761377/** Pointer to an array of bindings for push constant buffers. */1378const struct vkd3d_shader_push_constant_buffer *push_constant_buffers;1379/** Size, in elements, of \ref push_constant_buffers. */1380unsigned int push_constant_buffer_count;13811382/** Pointer to an array of bindings for combined samplers. */1383const struct vkd3d_shader_combined_resource_sampler *combined_samplers;1384/** Size, in elements, of \ref combined_samplers. */1385unsigned int combined_sampler_count;13861387/** Pointer to an array of bindings for UAV counters. */1388const struct vkd3d_shader_uav_counter_binding *uav_counters;1389/** Size, in elements, of \ref uav_counters. */1390unsigned int uav_counter_count;1391};13921393struct vkd3d_shader_transform_feedback_element1394{1395unsigned int stream_index;1396const char *semantic_name;1397unsigned int semantic_index;1398uint8_t component_index;1399uint8_t component_count;1400uint8_t output_slot;1401};14021403/* Extends vkd3d_shader_interface_info. */1404struct vkd3d_shader_transform_feedback_info1405{1406enum vkd3d_shader_structure_type type;1407const void *next;14081409const struct vkd3d_shader_transform_feedback_element *elements;1410unsigned int element_count;1411const unsigned int *buffer_strides;1412unsigned int buffer_stride_count;1413};14141415struct vkd3d_shader_descriptor_offset1416{1417unsigned int static_offset;1418unsigned int dynamic_offset_index;1419};14201421/**1422* A chained structure containing descriptor offsets.1423*1424* This structure is optional.1425*1426* This structure extends vkd3d_shader_interface_info.1427*1428* This structure contains only input parameters.1429*1430* \since 1.31431*/1432struct vkd3d_shader_descriptor_offset_info1433{1434/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_DESCRIPTOR_OFFSET_INFO. */1435enum vkd3d_shader_structure_type type;1436/** Optional pointer to a structure containing further parameters. */1437const void *next;14381439/**1440* Byte offset within the push constants of an array of 32-bit1441* descriptor array offsets. See the description of 'binding_offsets'1442* below.1443*/1444unsigned int descriptor_table_offset;1445/** Size, in elements, of the descriptor table push constant array. */1446unsigned int descriptor_table_count;14471448/**1449* Pointer to an array of struct vkd3d_shader_descriptor_offset objects.1450* The 'static_offset' field contains an offset into the descriptor arrays1451* referenced by the 'bindings' array in struct vkd3d_shader_interface_info.1452* This allows mapping multiple shader resource arrays to a single binding1453* point in the target environment.1454*1455* 'dynamic_offset_index' in struct vkd3d_shader_descriptor_offset allows1456* offsets to be set at runtime. The 32-bit descriptor table push constant1457* at this index will be added to 'static_offset' to calculate the final1458* binding offset.1459*1460* If runtime offsets are not required, set all 'dynamic_offset_index'1461* values to \c ~0u and 'descriptor_table_count' to zero.1462*1463* For example, to map Direct3D constant buffer registers 'cb0[0:3]' and1464* 'cb1[6:7]' to descriptors 8-12 and 4-5 in the Vulkan descriptor array in1465* descriptor set 3 and with binding 2, set the following values in the1466* 'bindings' array in struct vkd3d_shader_interface_info:1467*1468* \code1469* type = VKD3D_SHADER_DESCRIPTOR_TYPE_CBV1470* register_space = 01471* register_index = 01472* binding.set = 31473* binding.binding = 21474* binding.count = 41475*1476* type = VKD3D_SHADER_DESCRIPTOR_TYPE_CBV1477* register_space = 01478* register_index = 61479* binding.set = 31480* binding.binding = 21481* binding.count = 21482* \endcode1483*1484* and then pass \c {8, \c 4} as static binding offsets here.1485*1486* This field may be NULL, in which case the corresponding offsets are1487* specified to be 0.1488*/1489const struct vkd3d_shader_descriptor_offset *binding_offsets;14901491/**1492* Pointer to an array of offsets into the descriptor arrays referenced by1493* the 'uav_counters' array in struct vkd3d_shader_interface_info. This1494* works the same way as \ref binding_offsets above.1495*/1496const struct vkd3d_shader_descriptor_offset *uav_counter_offsets;1497};14981499/** The format of a shader to be compiled or scanned. */1500enum vkd3d_shader_source_type1501{1502/**1503* The shader has no type or is to be ignored. This is not a valid value1504* for vkd3d_shader_compile() or vkd3d_shader_scan().1505*/1506VKD3D_SHADER_SOURCE_NONE,1507/**1508* A 'Tokenized Program Format' shader embedded in a DXBC container. This is1509* the format used for Direct3D shader model 4 and 5 shaders.1510*/1511VKD3D_SHADER_SOURCE_DXBC_TPF,1512/** High-Level Shader Language source code. \since 1.3 */1513VKD3D_SHADER_SOURCE_HLSL,1514/**1515* Legacy Direct3D byte-code. This is the format used for Direct3D shader1516* model 1, 2, and 3 shaders. \since 1.31517*/1518VKD3D_SHADER_SOURCE_D3D_BYTECODE,1519/**1520* A 'DirectX Intermediate Language' shader embedded in a DXBC container. This is1521* the format used for Direct3D shader model 6 shaders. \since 1.91522*/1523VKD3D_SHADER_SOURCE_DXBC_DXIL,1524/**1525* Binary format used by Direct3D 9/10.x/11 effects.1526* Input is a raw FX section without container. \since 1.141527*/1528VKD3D_SHADER_SOURCE_FX,1529/**1530* A D3DX texture shader. This is the format used for the 'tx_1_0' HLSL1531* target profile. \since 1.171532*/1533VKD3D_SHADER_SOURCE_TX,15341535VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_SOURCE_TYPE),1536};15371538/** The output format of a compiled shader. */1539enum vkd3d_shader_target_type1540{1541/**1542* The shader has no type or is to be ignored. This is not a valid value1543* for vkd3d_shader_compile().1544*/1545VKD3D_SHADER_TARGET_NONE,1546/**1547* A SPIR-V shader in binary form. This is the format used for Vulkan1548* shaders.1549*/1550VKD3D_SHADER_TARGET_SPIRV_BINARY,1551VKD3D_SHADER_TARGET_SPIRV_TEXT,1552/**1553* Direct3D shader assembly. \since 1.31554*/1555VKD3D_SHADER_TARGET_D3D_ASM,1556/**1557* Legacy Direct3D byte-code. This is the format used for Direct3D shader1558* model 1, 2, and 3 shaders. \since 1.31559*/1560VKD3D_SHADER_TARGET_D3D_BYTECODE,1561/**1562* A 'Tokenized Program Format' shader embedded in a DXBC container. This is1563* the format used for Direct3D shader model 4 and 5 shaders. \since 1.31564*/1565VKD3D_SHADER_TARGET_DXBC_TPF,1566/**1567* An 'OpenGL Shading Language' shader. \since 1.31568*/1569VKD3D_SHADER_TARGET_GLSL,1570/**1571* Binary format used by Direct3D 9/10.x/11 effects profiles.1572* Output is a raw FX section without container. \since 1.111573*/1574VKD3D_SHADER_TARGET_FX,1575/**1576* A 'Metal Shading Language' shader. \since 1.141577*/1578VKD3D_SHADER_TARGET_MSL,15791580VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_TARGET_TYPE),1581};15821583/**1584* Describes the minimum severity of compilation messages returned by1585* vkd3d_shader_compile() and similar functions.1586*/1587enum vkd3d_shader_log_level1588{1589/** No messages will be returned. */1590VKD3D_SHADER_LOG_NONE,1591/** Only fatal errors which prevent successful compilation will be returned. */1592VKD3D_SHADER_LOG_ERROR,1593/** Non-fatal warnings and fatal errors will be returned. */1594VKD3D_SHADER_LOG_WARNING,1595/**1596* All messages, including general informational messages, will be returned.1597*/1598VKD3D_SHADER_LOG_INFO,15991600VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_LOG_LEVEL),1601};16021603/**1604* A chained structure containing compilation parameters.1605*/1606struct vkd3d_shader_compile_info1607{1608/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_INFO. */1609enum vkd3d_shader_structure_type type;1610/**1611* Optional pointer to a structure containing further parameters. For a list1612* of valid structures, refer to the respective function documentation. If1613* no further parameters are needed, this field should be set to NULL.1614*/1615const void *next;16161617/** Input source code or byte code. */1618struct vkd3d_shader_code source;16191620/** Format of the input code passed in \ref source. */1621enum vkd3d_shader_source_type source_type;1622/** Desired output format. */1623enum vkd3d_shader_target_type target_type;16241625/**1626* Pointer to an array of compilation options. This field is ignored if1627* \ref option_count is zero, but must be valid otherwise.1628*1629* If the same option is specified multiple times, only the last value is1630* used.1631*1632* Options not relevant to or not supported by a particular shader compiler1633* or scanner will be ignored.1634*/1635const struct vkd3d_shader_compile_option *options;1636/** Size, in elements, of \ref options. */1637unsigned int option_count;16381639/** Minimum severity of messages returned from the shader function. */1640enum vkd3d_shader_log_level log_level;1641/**1642* Name of the initial source file, which may be used in error messages or1643* debug information. This parameter is optional and may be NULL.1644*/1645const char *source_name;1646};16471648enum vkd3d_shader_spirv_environment1649{1650VKD3D_SHADER_SPIRV_ENVIRONMENT_NONE,1651VKD3D_SHADER_SPIRV_ENVIRONMENT_OPENGL_4_5,1652VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_0, /* default target */1653/** \since 1.12 */1654VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_1,16551656VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_SPIRV_ENVIRONMENT),1657};16581659enum vkd3d_shader_spirv_extension1660{1661VKD3D_SHADER_SPIRV_EXTENSION_NONE,1662VKD3D_SHADER_SPIRV_EXTENSION_EXT_DEMOTE_TO_HELPER_INVOCATION,1663/** \since 1.3 */1664VKD3D_SHADER_SPIRV_EXTENSION_EXT_DESCRIPTOR_INDEXING,1665/** \since 1.3 */1666VKD3D_SHADER_SPIRV_EXTENSION_EXT_STENCIL_EXPORT,1667/** \since 1.11 */1668VKD3D_SHADER_SPIRV_EXTENSION_EXT_VIEWPORT_INDEX_LAYER,1669/** \since 1.12 */1670VKD3D_SHADER_SPIRV_EXTENSION_EXT_FRAGMENT_SHADER_INTERLOCK,16711672VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_SPIRV_EXTENSION),1673};16741675/* Extends vkd3d_shader_compile_info. */1676struct vkd3d_shader_spirv_target_info1677{1678enum vkd3d_shader_structure_type type;1679const void *next;16801681const char *entry_point; /* "main" if NULL. */16821683enum vkd3d_shader_spirv_environment environment;16841685const enum vkd3d_shader_spirv_extension *extensions;1686unsigned int extension_count;16871688const struct vkd3d_shader_parameter *parameters;1689unsigned int parameter_count;16901691bool dual_source_blending;1692const unsigned int *output_swizzles;1693unsigned int output_swizzle_count;1694};16951696enum vkd3d_shader_tessellator_output_primitive1697{1698VKD3D_SHADER_TESSELLATOR_OUTPUT_POINT = 0x1,1699VKD3D_SHADER_TESSELLATOR_OUTPUT_LINE = 0x2,1700VKD3D_SHADER_TESSELLATOR_OUTPUT_TRIANGLE_CW = 0x3,1701VKD3D_SHADER_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 0x4,17021703VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_TESSELLATOR_OUTPUT_PRIMITIVE),1704};17051706enum vkd3d_shader_tessellator_partitioning1707{1708VKD3D_SHADER_TESSELLATOR_PARTITIONING_INTEGER = 0x1,1709VKD3D_SHADER_TESSELLATOR_PARTITIONING_POW2 = 0x2,1710VKD3D_SHADER_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 0x3,1711VKD3D_SHADER_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 0x4,17121713VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_TESSELLATOR_PARTITIONING),1714};17151716/* Extends vkd3d_shader_spirv_target_info. */1717struct vkd3d_shader_spirv_domain_shader_target_info1718{1719enum vkd3d_shader_structure_type type;1720const void *next;17211722enum vkd3d_shader_tessellator_output_primitive output_primitive;1723enum vkd3d_shader_tessellator_partitioning partitioning;1724};17251726/**1727* A single preprocessor macro, passed as part of struct1728* vkd3d_shader_preprocess_info.1729*/1730struct vkd3d_shader_macro1731{1732/**1733* Pointer to a null-terminated string containing the name of a macro. This1734* macro must not be a parameterized (i.e. function-like) macro. If this1735* field is not a valid macro identifier, this macro will be ignored.1736*/1737const char *name;1738/**1739* Optional pointer to a null-terminated string containing the expansion of1740* the macro. This field may be set to NULL, in which case the macro has an1741* empty expansion.1742*/1743const char *value;1744};17451746/**1747* Type of a callback function which will be used to open preprocessor includes.1748*1749* This callback function is passed as part of struct1750* vkd3d_shader_preprocess_info.1751*1752* If this function fails, vkd3d-shader will emit a compilation error, and the1753* \a pfn_close_include callback will not be called.1754*1755* \param filename Unquoted string used as an argument to the \#include1756* directive.1757*1758* \param local Whether the \#include directive is requesting a local (i.e.1759* double-quoted) or system (i.e. angle-bracketed) include.1760*1761* \param parent_data Unprocessed source code of the file in which this1762* \#include directive is evaluated. This parameter may be NULL.1763*1764* \param context The user-defined pointer passed to struct1765* vkd3d_shader_preprocess_info.1766*1767* \param out Output location for the full contents of the included file. The1768* code need not be allocated using standard vkd3d functions, but must remain1769* valid until the corresponding call to \a pfn_close_include. If this function1770* fails, the contents of this parameter are ignored.1771*1772* \return A member of \ref vkd3d_result.1773*/1774typedef int (*PFN_vkd3d_shader_open_include)(const char *filename, bool local,1775const char *parent_data, void *context, struct vkd3d_shader_code *out);1776/**1777* Type of a callback function which will be used to close preprocessor1778* includes.1779*1780* This callback function is passed as part of struct1781* vkd3d_shader_preprocess_info.1782*1783* \param code Contents of the included file, which were allocated by the1784* vkd3d_shader_preprocess_info.pfn_open_include callback.1785* The user must free them.1786*1787* \param context The user-defined pointer passed to struct1788* vkd3d_shader_preprocess_info.1789*/1790typedef void (*PFN_vkd3d_shader_close_include)(const struct vkd3d_shader_code *code, void *context);17911792/**1793* A chained structure containing preprocessing parameters.1794*1795* This structure is optional.1796*1797* This structure extends vkd3d_shader_compile_info.1798*1799* This structure contains only input parameters.1800*1801* \since 1.31802*/1803struct vkd3d_shader_preprocess_info1804{1805/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_PREPROCESS_INFO. */1806enum vkd3d_shader_structure_type type;1807/** Optional pointer to a structure containing further parameters. */1808const void *next;18091810/**1811* Pointer to an array of predefined macros. Each macro in this array will1812* be expanded as if a corresponding \#define statement were prepended to1813* the source code.1814*1815* If the same macro is specified multiple times, only the last value is1816* used.1817*/1818const struct vkd3d_shader_macro *macros;1819/** Size, in elements, of \ref macros. */1820unsigned int macro_count;18211822/**1823* Optional pointer to a callback function, which will be called in order to1824* evaluate \#include directives. The function receives parameters1825* corresponding to the directive's arguments, and should return the1826* complete text of the included file.1827*1828* If this field is set to NULL, or if this structure is omitted,1829* vkd3d-shader will attempt to open included files using POSIX file APIs.1830*1831* If this field is set to NULL, the \ref pfn_close_include field must also1832* be set to NULL.1833*/1834PFN_vkd3d_shader_open_include pfn_open_include;1835/**1836* Optional pointer to a callback function, which will be called whenever an1837* included file is closed. This function will be called exactly once for1838* each successful call to \ref pfn_open_include, and should be used to free1839* any resources allocated thereby.1840*1841* If this field is set to NULL, the \ref pfn_open_include field must also1842* be set to NULL.1843*/1844PFN_vkd3d_shader_close_include pfn_close_include;1845/**1846* User-defined pointer which will be passed unmodified to the1847* \ref pfn_open_include and \ref pfn_close_include callbacks.1848*/1849void *include_context;1850};18511852/**1853* A chained structure containing HLSL compilation parameters.1854*1855* This structure is optional.1856*1857* This structure extends vkd3d_shader_compile_info.1858*1859* This structure contains only input parameters.1860*1861* \since 1.31862*/1863struct vkd3d_shader_hlsl_source_info1864{1865/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_HLSL_SOURCE_INFO. */1866enum vkd3d_shader_structure_type type;1867/** Optional pointer to a structure containing further parameters. */1868const void *next;18691870/**1871* Optional pointer to a null-terminated string containing the shader entry1872* point.1873*1874* If this parameter is NULL, vkd3d-shader uses the entry point "main".1875*/1876const char *entry_point;1877struct vkd3d_shader_code secondary_code;1878/**1879* Pointer to a null-terminated string containing the target shader1880* profile.1881*/1882const char *profile;1883};18841885/* root signature 1.0 */1886enum vkd3d_shader_filter1887{1888VKD3D_SHADER_FILTER_MIN_MAG_MIP_POINT = 0x000,1889VKD3D_SHADER_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x001,1890VKD3D_SHADER_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x004,1891VKD3D_SHADER_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x005,1892VKD3D_SHADER_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x010,1893VKD3D_SHADER_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x011,1894VKD3D_SHADER_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x014,1895VKD3D_SHADER_FILTER_MIN_MAG_MIP_LINEAR = 0x015,1896VKD3D_SHADER_FILTER_ANISOTROPIC = 0x055,1897VKD3D_SHADER_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x080,1898VKD3D_SHADER_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x081,1899VKD3D_SHADER_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x084,1900VKD3D_SHADER_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x085,1901VKD3D_SHADER_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x090,1902VKD3D_SHADER_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x091,1903VKD3D_SHADER_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x094,1904VKD3D_SHADER_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x095,1905VKD3D_SHADER_FILTER_COMPARISON_ANISOTROPIC = 0x0d5,1906VKD3D_SHADER_FILTER_MINIMUM_MIN_MAG_MIP_POINT = 0x100,1907VKD3D_SHADER_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x101,1908VKD3D_SHADER_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x104,1909VKD3D_SHADER_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x105,1910VKD3D_SHADER_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x110,1911VKD3D_SHADER_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x111,1912VKD3D_SHADER_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x114,1913VKD3D_SHADER_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = 0x115,1914VKD3D_SHADER_FILTER_MINIMUM_ANISOTROPIC = 0x155,1915VKD3D_SHADER_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = 0x180,1916VKD3D_SHADER_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 0x181,1917VKD3D_SHADER_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x184,1918VKD3D_SHADER_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 0x185,1919VKD3D_SHADER_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 0x190,1920VKD3D_SHADER_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x191,1921VKD3D_SHADER_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 0x194,1922VKD3D_SHADER_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = 0x195,1923VKD3D_SHADER_FILTER_MAXIMUM_ANISOTROPIC = 0x1d5,19241925VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_FILTER),1926};19271928enum vkd3d_shader_texture_address_mode1929{1930VKD3D_SHADER_TEXTURE_ADDRESS_MODE_WRAP = 0x1,1931VKD3D_SHADER_TEXTURE_ADDRESS_MODE_MIRROR = 0x2,1932VKD3D_SHADER_TEXTURE_ADDRESS_MODE_CLAMP = 0x3,1933VKD3D_SHADER_TEXTURE_ADDRESS_MODE_BORDER = 0x4,1934VKD3D_SHADER_TEXTURE_ADDRESS_MODE_MIRROR_ONCE = 0x5,19351936VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_TEXTURE_ADDRESS_MODE),1937};19381939enum vkd3d_shader_comparison_func1940{1941VKD3D_SHADER_COMPARISON_FUNC_NEVER = 0x1,1942VKD3D_SHADER_COMPARISON_FUNC_LESS = 0x2,1943VKD3D_SHADER_COMPARISON_FUNC_EQUAL = 0x3,1944VKD3D_SHADER_COMPARISON_FUNC_LESS_EQUAL = 0x4,1945VKD3D_SHADER_COMPARISON_FUNC_GREATER = 0x5,1946VKD3D_SHADER_COMPARISON_FUNC_NOT_EQUAL = 0x6,1947VKD3D_SHADER_COMPARISON_FUNC_GREATER_EQUAL = 0x7,1948VKD3D_SHADER_COMPARISON_FUNC_ALWAYS = 0x8,19491950VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPARISON_FUNC),1951};19521953enum vkd3d_shader_static_border_colour1954{1955VKD3D_SHADER_STATIC_BORDER_COLOUR_TRANSPARENT_BLACK = 0x0,1956VKD3D_SHADER_STATIC_BORDER_COLOUR_OPAQUE_BLACK = 0x1,1957VKD3D_SHADER_STATIC_BORDER_COLOUR_OPAQUE_WHITE = 0x2,19581959VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_STATIC_BORDER_COLOUR),1960};19611962struct vkd3d_shader_static_sampler_desc1963{1964enum vkd3d_shader_filter filter;1965enum vkd3d_shader_texture_address_mode address_u;1966enum vkd3d_shader_texture_address_mode address_v;1967enum vkd3d_shader_texture_address_mode address_w;1968float mip_lod_bias;1969unsigned int max_anisotropy;1970enum vkd3d_shader_comparison_func comparison_func;1971enum vkd3d_shader_static_border_colour border_colour;1972float min_lod;1973float max_lod;1974unsigned int shader_register;1975unsigned int register_space;1976enum vkd3d_shader_visibility shader_visibility;1977};19781979struct vkd3d_shader_descriptor_range1980{1981enum vkd3d_shader_descriptor_type range_type;1982unsigned int descriptor_count;1983unsigned int base_shader_register;1984unsigned int register_space;1985unsigned int descriptor_table_offset;1986};19871988struct vkd3d_shader_root_descriptor_table1989{1990unsigned int descriptor_range_count;1991const struct vkd3d_shader_descriptor_range *descriptor_ranges;1992};19931994struct vkd3d_shader_root_constants1995{1996unsigned int shader_register;1997unsigned int register_space;1998unsigned int value_count;1999};20002001struct vkd3d_shader_root_descriptor2002{2003unsigned int shader_register;2004unsigned int register_space;2005};20062007enum vkd3d_shader_root_parameter_type2008{2009VKD3D_SHADER_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE = 0x0,2010VKD3D_SHADER_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS = 0x1,2011VKD3D_SHADER_ROOT_PARAMETER_TYPE_CBV = 0x2,2012VKD3D_SHADER_ROOT_PARAMETER_TYPE_SRV = 0x3,2013VKD3D_SHADER_ROOT_PARAMETER_TYPE_UAV = 0x4,20142015VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_ROOT_PARAMETER_TYPE),2016};20172018struct vkd3d_shader_root_parameter2019{2020enum vkd3d_shader_root_parameter_type parameter_type;2021union2022{2023struct vkd3d_shader_root_descriptor_table descriptor_table;2024struct vkd3d_shader_root_constants constants;2025struct vkd3d_shader_root_descriptor descriptor;2026} u;2027enum vkd3d_shader_visibility shader_visibility;2028};20292030enum vkd3d_shader_root_signature_flags2031{2032VKD3D_SHADER_ROOT_SIGNATURE_FLAG_NONE = 0x00,2033VKD3D_SHADER_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT = 0x01,2034VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS = 0x02,2035VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS = 0x04,2036VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS = 0x08,2037VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS = 0x10,2038VKD3D_SHADER_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS = 0x20,2039VKD3D_SHADER_ROOT_SIGNATURE_FLAG_ALLOW_STREAM_OUTPUT = 0x40,20402041VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_ROOT_SIGNATURE_FLAGS),2042};20432044struct vkd3d_shader_root_signature_desc2045{2046unsigned int parameter_count;2047const struct vkd3d_shader_root_parameter *parameters;2048unsigned int static_sampler_count;2049const struct vkd3d_shader_static_sampler_desc *static_samplers;2050enum vkd3d_shader_root_signature_flags flags;2051};20522053/* root signature 1.1 */2054enum vkd3d_shader_root_descriptor_flags2055{2056VKD3D_SHADER_ROOT_DESCRIPTOR_FLAG_NONE = 0x0,2057VKD3D_SHADER_ROOT_DESCRIPTOR_FLAG_DATA_VOLATILE = 0x2,2058VKD3D_SHADER_ROOT_DESCRIPTOR_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4,2059VKD3D_SHADER_ROOT_DESCRIPTOR_FLAG_DATA_STATIC = 0x8,20602061VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_ROOT_DESCRIPTOR_FLAGS),2062};20632064enum vkd3d_shader_descriptor_range_flags2065{2066VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_NONE = 0x0,2067VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE = 0x1,2068VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE = 0x2,2069VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4,2070VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC = 0x8,2071/** \since 1.11 */2072VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS = 0x10000,20732074VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_DESCRIPTOR_RANGE_FLAGS),2075};20762077struct vkd3d_shader_descriptor_range12078{2079enum vkd3d_shader_descriptor_type range_type;2080unsigned int descriptor_count;2081unsigned int base_shader_register;2082unsigned int register_space;2083enum vkd3d_shader_descriptor_range_flags flags;2084unsigned int descriptor_table_offset;2085};20862087struct vkd3d_shader_root_descriptor_table12088{2089unsigned int descriptor_range_count;2090const struct vkd3d_shader_descriptor_range1 *descriptor_ranges;2091};20922093struct vkd3d_shader_root_descriptor12094{2095unsigned int shader_register;2096unsigned int register_space;2097enum vkd3d_shader_root_descriptor_flags flags;2098};20992100struct vkd3d_shader_root_parameter12101{2102enum vkd3d_shader_root_parameter_type parameter_type;2103union2104{2105struct vkd3d_shader_root_descriptor_table1 descriptor_table;2106struct vkd3d_shader_root_constants constants;2107struct vkd3d_shader_root_descriptor1 descriptor;2108} u;2109enum vkd3d_shader_visibility shader_visibility;2110};21112112struct vkd3d_shader_root_signature_desc12113{2114unsigned int parameter_count;2115const struct vkd3d_shader_root_parameter1 *parameters;2116unsigned int static_sampler_count;2117const struct vkd3d_shader_static_sampler_desc *static_samplers;2118enum vkd3d_shader_root_signature_flags flags;2119};21202121enum vkd3d_shader_root_signature_version2122{2123VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_0 = 0x1,2124VKD3D_SHADER_ROOT_SIGNATURE_VERSION_1_1 = 0x2,21252126VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_ROOT_SIGNATURE_VERSION),2127};21282129struct vkd3d_shader_versioned_root_signature_desc2130{2131enum vkd3d_shader_root_signature_version version;2132union2133{2134struct vkd3d_shader_root_signature_desc v_1_0;2135struct vkd3d_shader_root_signature_desc1 v_1_1;2136} u;2137};21382139/**2140* The type of a shader resource, returned as part of struct2141* vkd3d_shader_descriptor_info.2142*/2143enum vkd3d_shader_resource_type2144{2145/**2146* The type is invalid or not applicable for this descriptor. This value is2147* returned for samplers.2148*/2149VKD3D_SHADER_RESOURCE_NONE = 0x0,2150/** Dimensionless buffer. */2151VKD3D_SHADER_RESOURCE_BUFFER = 0x1,2152/** 1-dimensional texture. */2153VKD3D_SHADER_RESOURCE_TEXTURE_1D = 0x2,2154/** 2-dimensional texture. */2155VKD3D_SHADER_RESOURCE_TEXTURE_2D = 0x3,2156/** Multisampled 2-dimensional texture. */2157VKD3D_SHADER_RESOURCE_TEXTURE_2DMS = 0x4,2158/** 3-dimensional texture. */2159VKD3D_SHADER_RESOURCE_TEXTURE_3D = 0x5,2160/** Cubemap texture. */2161VKD3D_SHADER_RESOURCE_TEXTURE_CUBE = 0x6,2162/** 1-dimensional array texture. */2163VKD3D_SHADER_RESOURCE_TEXTURE_1DARRAY = 0x7,2164/** 2-dimensional array texture. */2165VKD3D_SHADER_RESOURCE_TEXTURE_2DARRAY = 0x8,2166/** Multisampled 2-dimensional array texture. */2167VKD3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY = 0x9,2168/** Cubemap array texture. */2169VKD3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY = 0xa,21702171VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_RESOURCE_TYPE),2172};21732174/**2175* The type of the data contained in a shader resource, returned as part of2176* struct vkd3d_shader_descriptor_info. All formats are 32-bit.2177*/2178enum vkd3d_shader_resource_data_type2179{2180/**2181* The descriptor has no relevant data type. This value is returned for2182* samplers. \since 1.162183*/2184VKD3D_SHADER_RESOURCE_DATA_NONE = 0x0,2185/** Unsigned normalized integer. */2186VKD3D_SHADER_RESOURCE_DATA_UNORM = 0x1,2187/** Signed normalized integer. */2188VKD3D_SHADER_RESOURCE_DATA_SNORM = 0x2,2189/** Signed integer. */2190VKD3D_SHADER_RESOURCE_DATA_INT = 0x3,2191/** Unsigned integer. */2192VKD3D_SHADER_RESOURCE_DATA_UINT = 0x4,2193/** IEEE single-precision floating-point. */2194VKD3D_SHADER_RESOURCE_DATA_FLOAT = 0x5,2195/** Undefined/type-less. \since 1.3 */2196VKD3D_SHADER_RESOURCE_DATA_MIXED = 0x6,2197/** IEEE double-precision floating-point. \since 1.3 */2198VKD3D_SHADER_RESOURCE_DATA_DOUBLE = 0x7,2199/** Continuation of the previous component. For example, 64-bit2200* double-precision floating-point data may be returned as two 32-bit2201* components, with the first component (containing the LSB) specified as2202* VKD3D_SHADER_RESOURCE_DATA_DOUBLE, and the second component specified2203* as VKD3D_SHADER_RESOURCE_DATA_CONTINUED. \since 1.3 */2204VKD3D_SHADER_RESOURCE_DATA_CONTINUED = 0x8,22052206VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_RESOURCE_DATA_TYPE),2207};22082209/**2210* Additional flags describing a shader descriptor, returned as part of struct2211* vkd3d_shader_descriptor_info.2212*/2213enum vkd3d_shader_descriptor_info_flag2214{2215/**2216* The descriptor is a UAV resource, whose counter is read from or written2217* to by the shader.2218*/2219VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_COUNTER = 0x00000001,2220/** The descriptor is a UAV resource, which is read from by the shader. */2221VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_READ = 0x00000002,2222/** The descriptor is a comparison sampler. */2223VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_SAMPLER_COMPARISON_MODE = 0x00000004,2224/** The descriptor is a UAV resource, on which the shader performs2225* atomic ops. \since 1.6 */2226VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_UAV_ATOMICS = 0x00000008,2227/** The descriptor is a raw (byte-addressed) buffer. \since 1.9 */2228VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_RAW_BUFFER = 0x00000010,22292230VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_DESCRIPTOR_INFO_FLAG),2231};22322233/**2234* Describes a single shader descriptor; returned as part of2235* struct vkd3d_shader_scan_descriptor_info.2236*/2237struct vkd3d_shader_descriptor_info2238{2239/** Type of the descriptor (for example, SRV, CBV, UAV, or sampler). */2240enum vkd3d_shader_descriptor_type type;2241/**2242* Register space of the resource, or 0 if the shader does not2243* support multiple register spaces.2244*/2245unsigned int register_space;2246/** Register index of the descriptor. */2247unsigned int register_index;2248/** Resource type, if applicable, including its dimension. */2249enum vkd3d_shader_resource_type resource_type;2250/** Data type contained in the resource (for example, float or integer). */2251enum vkd3d_shader_resource_data_type resource_data_type;2252/**2253* Bitwise combination of zero or more members of2254* \ref vkd3d_shader_descriptor_info_flag.2255*/2256unsigned int flags;2257/**2258* Size of this descriptor array, or 1 if a single descriptor.2259* For an unbounded array this value is ~0u.2260*/2261unsigned int count;2262};22632264/**2265* A chained structure enumerating the descriptors declared by a shader.2266*2267* This structure extends vkd3d_shader_compile_info.2268*2269* When scanning a legacy Direct3D shader, vkd3d-shader enumerates descriptors2270* as follows:2271*2272* - Each constant register set used by the shader is scanned as a single2273* constant buffer descriptor.2274* There may therefore be up to three such descriptors, one for each register2275* set used by the shader: float, integer, and boolean.2276* The fields are set as follows:2277* * The \ref vkd3d_shader_descriptor_info.type field is set to2278* VKD3D_SHADER_DESCRIPTOR_TYPE_CBV.2279* * The \ref vkd3d_shader_descriptor_info.register_space field is set to zero.2280* * The \ref vkd3d_shader_descriptor_info.register_index field is set to a2281* member of enum vkd3d_shader_d3dbc_constant_register denoting which set2282* is used.2283* * The \ref vkd3d_shader_descriptor_info.count field is set to one.2284* - Each sampler used by the shader is scanned as two separate descriptors,2285* one representing the texture, and one representing the sampler state.2286* If desired, these may be mapped back into a single combined sampler using2287* struct vkd3d_shader_combined_resource_sampler.2288* The fields are set as follows:2289* * The \ref vkd3d_shader_descriptor_info.type field is set to2290* VKD3D_SHADER_DESCRIPTOR_TYPE_SRV and VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER2291* respectively.2292* * The \ref vkd3d_shader_descriptor_info.register_space field is set to zero.2293* * The \ref vkd3d_shader_descriptor_info.register_index field is set to the2294* binding index of the original sampler, for both descriptors.2295* * The \ref vkd3d_shader_descriptor_info.count field is set to one.2296*/2297struct vkd3d_shader_scan_descriptor_info2298{2299/**2300* Input; must be set to VKD3D_SHADER_STRUCTURE_TYPE_SCAN_DESCRIPTOR_INFO.2301*/2302enum vkd3d_shader_structure_type type;2303/** Input; optional pointer to a structure containing further parameters. */2304const void *next;23052306/** Output; returns a pointer to an array of descriptors. */2307struct vkd3d_shader_descriptor_info *descriptors;2308/** Output; size, in elements, of \ref descriptors. */2309unsigned int descriptor_count;2310};23112312/**2313* This structure describes a single resource-sampler pair. It is returned as2314* part of struct vkd3d_shader_scan_combined_resource_sampler_info.2315*2316* \since 1.102317*/2318struct vkd3d_shader_combined_resource_sampler_info2319{2320unsigned int resource_space;2321unsigned int resource_index;2322unsigned int sampler_space;2323unsigned int sampler_index;2324};23252326/**2327* A chained structure describing the resource-sampler pairs used by a shader.2328*2329* This structure extends vkd3d_shader_compile_info.2330*2331* The information returned in this structure can be used to populate the2332* \ref vkd3d_shader_interface_info.combined_samplers field. This is2333* particularly useful when targeting environments without separate binding2334* points for samplers and resources, like OpenGL.2335*2336* No resource-sampler pairs are returned for dynamic accesses to2337* resource/sampler descriptor arrays, as can occur in Direct3D shader model2338* 5.1 shaders.2339*2340* Members of this structure are allocated by vkd3d-shader and should be freed2341* with vkd3d_shader_free_scan_combined_resource_sampler_info() when no longer2342* needed.2343*2344* \since 1.102345*/2346struct vkd3d_shader_scan_combined_resource_sampler_info2347{2348/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_SCAN_COMBINED_RESOURCE_SAMPLER_INFO. */2349enum vkd3d_shader_structure_type type;2350/** Optional pointer to a structure containing further parameters. */2351const void *next;23522353/** Pointer to an array of resource-sampler pairs. */2354struct vkd3d_shader_combined_resource_sampler_info *combined_samplers;2355/** The number of resource-sampler pairs in \ref combined_samplers. */2356unsigned int combined_sampler_count;2357};23582359/**2360* A chained structure describing the tessellation information in a hull shader.2361*2362* This structure extends vkd3d_shader_compile_info.2363*2364* \since 1.152365*/2366struct vkd3d_shader_scan_hull_shader_tessellation_info2367{2368/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_SCAN_HULL_SHADER_TESSELLATION_INFO. */2369enum vkd3d_shader_structure_type type;2370/** Optional pointer to a structure containing further parameters. */2371const void *next;23722373/** The tessellation output primitive. */2374enum vkd3d_shader_tessellator_output_primitive output_primitive;2375/** The tessellation partitioning mode. */2376enum vkd3d_shader_tessellator_partitioning partitioning;2377};23782379/**2380* A chained structure describing the thread group size in a compute shader.2381*2382* This structure extends vkd3d_shader_compile_info.2383*2384* \since 1.182385*/2386struct vkd3d_shader_scan_thread_group_size_info2387{2388/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_SCAN_THREAD_GROUP_SIZE_INFO. */2389enum vkd3d_shader_structure_type type;2390/** Optional pointer to a structure containing further parameters. */2391const void *next;23922393/** The thread group size in the x/y/z direction. */2394unsigned int x, y, z;2395};23962397/**2398* A chained structure containing legacy Direct3D bytecode compilation parameters.2399* This structure specifies some information about the source environment that2400* is not specified in the source shader format, but may be necessary for the2401* target format.2402*2403* This structure is optional.2404*2405* This structure extends vkd3d_shader_compile_info.2406*2407* This structure contains only input parameters.2408*2409* \since 1.182410*/2411struct vkd3d_shader_d3dbc_source_info2412{2413/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_D3DBC_SOURCE_INFO. */2414enum vkd3d_shader_structure_type type;2415/** Optional pointer to a structure containing further parameters. */2416const void *next;24172418/**2419* The dimension of each texture bound to the shader.2420*2421* If this structure is not specified, the dimension for all textures will2422* be VKD3D_SHADER_RESOURCE_TEXTURE_2D.2423*2424* The dimension of textures in this array not used by the shader will be2425* ignored.2426*2427* This field is ignored for shader models 2 and higher.2428*/2429enum vkd3d_shader_resource_type texture_dimensions[6];24302431/**2432* A mask indicating which samplers should be shadow (i.e. comparison-mode)2433* samplers. When legacy Direct3D shaders are used with the Direct3D 8 and 92434* APIs, this is implied by the format of the sampled resource; e.g. a2435* D3DFMT_D24S8 texture implies shadow sampling, while a D3DFMT_A8R8G8B82436* or D3DFMT_INTZ texture does not.2437* This information is necessary when converting to other formats2438* (e.g. SPIR-V, GLSL) which specify this in the shader.2439*2440* For example, if bit 1 is set (so the value is 0x2), this indicates that2441* the sampler at bind point 1 (and no others) should be a shadow sampler.2442*2443* Bits in this mask corresponding to textures not used by the shader will2444* be ignored.2445*2446* If this structure is not specified, no samplers will be considered to2447* be shadow samplers.2448*/2449uint32_t shadow_samplers;2450};24512452/**2453* Data type of a shader varying, returned as part of struct2454* vkd3d_shader_signature_element.2455*/2456enum vkd3d_shader_component_type2457{2458/** The varying has no type. */2459VKD3D_SHADER_COMPONENT_VOID = 0x0,2460/** 32-bit unsigned integer. */2461VKD3D_SHADER_COMPONENT_UINT = 0x1,2462/** 32-bit signed integer. */2463VKD3D_SHADER_COMPONENT_INT = 0x2,2464/** 32-bit IEEE floating-point. */2465VKD3D_SHADER_COMPONENT_FLOAT = 0x3,2466/** Boolean. */2467VKD3D_SHADER_COMPONENT_BOOL = 0x4,2468/** 64-bit IEEE floating-point. */2469VKD3D_SHADER_COMPONENT_DOUBLE = 0x5,2470/** 64-bit unsigned integer. \since 1.11 */2471VKD3D_SHADER_COMPONENT_UINT64 = 0x6,2472/** 64-bit signed integer. \since 1.16 */2473VKD3D_SHADER_COMPONENT_INT64 = 0x7,2474/** 16-bit IEEE floating-point. \since 1.16 */2475VKD3D_SHADER_COMPONENT_FLOAT16 = 0x8,2476/** 16-bit unsigned integer. \since 1.16 */2477VKD3D_SHADER_COMPONENT_UINT16 = 0x9,2478/** 16-bit signed integer. \since 1.16 */2479VKD3D_SHADER_COMPONENT_INT16 = 0xa,24802481VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPONENT_TYPE),2482};24832484/** System value semantic, returned as part of struct vkd3d_shader_signature. */2485enum vkd3d_shader_sysval_semantic2486{2487/** No system value. */2488VKD3D_SHADER_SV_NONE = 0x00,2489/** Vertex position; SV_Position in Direct3D. */2490VKD3D_SHADER_SV_POSITION = 0x01,2491/** Clip distance; SV_ClipDistance in Direct3D. */2492VKD3D_SHADER_SV_CLIP_DISTANCE = 0x02,2493/** Cull distance; SV_CullDistance in Direct3D. */2494VKD3D_SHADER_SV_CULL_DISTANCE = 0x03,2495/** Render target layer; SV_RenderTargetArrayIndex in Direct3D. */2496VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX = 0x04,2497/** Viewport index; SV_ViewportArrayIndex in Direct3D. */2498VKD3D_SHADER_SV_VIEWPORT_ARRAY_INDEX = 0x05,2499/** Vertex ID; SV_VertexID in Direct3D. */2500VKD3D_SHADER_SV_VERTEX_ID = 0x06,2501/** Primitive ID; SV_PrimitiveID in Direct3D. */2502VKD3D_SHADER_SV_PRIMITIVE_ID = 0x07,2503/** Instance ID; SV_InstanceID in Direct3D. */2504VKD3D_SHADER_SV_INSTANCE_ID = 0x08,2505/** Whether the triangle is front-facing; SV_IsFrontFace in Direct3D. */2506VKD3D_SHADER_SV_IS_FRONT_FACE = 0x09,2507/** Sample index; SV_SampleIndex in Direct3D. */2508VKD3D_SHADER_SV_SAMPLE_INDEX = 0x0a,2509VKD3D_SHADER_SV_TESS_FACTOR_QUADEDGE = 0x0b,2510VKD3D_SHADER_SV_TESS_FACTOR_QUADINT = 0x0c,2511VKD3D_SHADER_SV_TESS_FACTOR_TRIEDGE = 0x0d,2512VKD3D_SHADER_SV_TESS_FACTOR_TRIINT = 0x0e,2513VKD3D_SHADER_SV_TESS_FACTOR_LINEDET = 0x0f,2514VKD3D_SHADER_SV_TESS_FACTOR_LINEDEN = 0x10,2515/** Render target; SV_Target in Direct3D. \since 1.9 */2516VKD3D_SHADER_SV_TARGET = 0x40,2517/** Depth; SV_Depth in Direct3D. \since 1.9 */2518VKD3D_SHADER_SV_DEPTH = 0x41,2519/** Sample mask; SV_Coverage in Direct3D. \since 1.9 */2520VKD3D_SHADER_SV_COVERAGE = 0x42,2521/**2522* Depth, which is guaranteed to be greater than or equal to the current2523* depth; SV_DepthGreaterEqual in Direct3D. \since 1.92524*/2525VKD3D_SHADER_SV_DEPTH_GREATER_EQUAL = 0x43,2526/**2527* Depth, which is guaranteed to be less than or equal to the current2528* depth; SV_DepthLessEqual in Direct3D. \since 1.92529*/2530VKD3D_SHADER_SV_DEPTH_LESS_EQUAL = 0x44,2531/** Stencil reference; SV_StencilRef in Direct3D. \since 1.9 */2532VKD3D_SHADER_SV_STENCIL_REF = 0x45,25332534VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_SYSVAL_SEMANTIC),2535};25362537/**2538* Minimum interpolation precision of a shader varying, returned as part of2539* struct vkd3d_shader_signature_element.2540*/2541enum vkd3d_shader_minimum_precision2542{2543VKD3D_SHADER_MINIMUM_PRECISION_NONE = 0,2544/** 16-bit floating-point. */2545VKD3D_SHADER_MINIMUM_PRECISION_FLOAT_16 = 1,2546/** 10-bit fixed point (2 integer and 8 fractional bits). */2547VKD3D_SHADER_MINIMUM_PRECISION_FIXED_8_2 = 2,2548/** 16-bit signed integer. */2549VKD3D_SHADER_MINIMUM_PRECISION_INT_16 = 4,2550/** 16-bit unsigned integer. */2551VKD3D_SHADER_MINIMUM_PRECISION_UINT_16 = 5,25522553VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_MINIMUM_PRECISION),2554};25552556/**2557* A single shader varying, returned as part of struct vkd3d_shader_signature.2558*/2559struct vkd3d_shader_signature_element2560{2561/** Semantic name. */2562const char *semantic_name;2563/** Semantic index, or 0 if the semantic is not indexed. */2564unsigned int semantic_index;2565/**2566* Stream index of a geometry shader output semantic. If the signature is2567* not a geometry shader output signature, this field will be set to 0.2568*/2569unsigned int stream_index;2570/**2571* System value semantic. If the varying is not a system value, this field2572* will be set to VKD3D_SHADER_SV_NONE.2573*/2574enum vkd3d_shader_sysval_semantic sysval_semantic;2575/** Data type. */2576enum vkd3d_shader_component_type component_type;2577/** Register index. */2578unsigned int register_index;2579/** Mask of the register components allocated to this varying. */2580unsigned int mask;2581/**2582* Subset of \ref mask which the shader reads from or writes to. Unlike2583* Direct3D shader bytecode, the mask for output and tessellation signatures2584* is not inverted, i.e. bits set in this field denote components which are2585* written to.2586*/2587unsigned int used_mask;2588/** Minimum interpolation precision. */2589enum vkd3d_shader_minimum_precision min_precision;2590};25912592/**2593* Description of a shader input or output signature. This structure is2594* populated by vkd3d_shader_parse_input_signature().2595*2596* The helper function vkd3d_shader_find_signature_element() will look up a2597* varying element by its semantic name, semantic index, and stream index.2598*/2599struct vkd3d_shader_signature2600{2601/** Pointer to an array of varyings. */2602struct vkd3d_shader_signature_element *elements;2603/** Size, in elements, of \ref elements. */2604unsigned int element_count;2605};26062607/** Possible values for a single component of a vkd3d-shader swizzle. */2608enum vkd3d_shader_swizzle_component2609{2610VKD3D_SHADER_SWIZZLE_X = 0x0,2611VKD3D_SHADER_SWIZZLE_Y = 0x1,2612VKD3D_SHADER_SWIZZLE_Z = 0x2,2613VKD3D_SHADER_SWIZZLE_W = 0x3,26142615VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_SWIZZLE_COMPONENT),2616};26172618/**2619* A description of a DXBC section.2620*2621* \since 1.72622*/2623struct vkd3d_shader_dxbc_section_desc2624{2625/** The section tag. */2626uint32_t tag;2627/** The contents of the section. */2628struct vkd3d_shader_code data;2629};26302631/**2632* A description of a DXBC blob, as returned by vkd3d_shader_parse_dxbc().2633*2634* \since 1.72635*/2636struct vkd3d_shader_dxbc_desc2637{2638/**2639* The DXBC tag. This will always be "DXBC" in structures returned by2640* this version of vkd3d-shader.2641*/2642uint32_t tag;2643/** A checksum of the DXBC contents. */2644uint32_t checksum[4];2645/**2646* The DXBC version. This will always be 1 in structures returned by this2647* version of vkd3d-shader.2648*/2649unsigned int version;2650/** The total size of the DXBC blob. */2651size_t size;2652/** The number of sections contained in the DXBC. */2653size_t section_count;2654/** Descriptions of the sections contained in the DXBC. */2655struct vkd3d_shader_dxbc_section_desc *sections;2656};26572658/**2659* A mask selecting one component from a vkd3d-shader swizzle. The component has2660* type \ref vkd3d_shader_swizzle_component.2661*/2662#define VKD3D_SHADER_SWIZZLE_MASK (0xffu)2663/** The offset, in bits, of the nth parameter of a vkd3d-shader swizzle. */2664#define VKD3D_SHADER_SWIZZLE_SHIFT(idx) (8u * (idx))26652666/**2667* A helper macro which returns a vkd3d-shader swizzle with the given2668* components. The components are specified as the suffixes to members of2669* \ref vkd3d_shader_swizzle_component. For example, the swizzle ".xwyy" can be2670* represented as:2671* \code2672* VKD3D_SHADER_SWIZZLE(X, W, Y, Y)2673* \endcode2674*/2675#define VKD3D_SHADER_SWIZZLE(x, y, z, w) \2676(VKD3D_SHADER_SWIZZLE_ ## x << VKD3D_SHADER_SWIZZLE_SHIFT(0) \2677| VKD3D_SHADER_SWIZZLE_ ## y << VKD3D_SHADER_SWIZZLE_SHIFT(1) \2678| VKD3D_SHADER_SWIZZLE_ ## z << VKD3D_SHADER_SWIZZLE_SHIFT(2) \2679| VKD3D_SHADER_SWIZZLE_ ## w << VKD3D_SHADER_SWIZZLE_SHIFT(3))26802681/** The identity swizzle ".xyzw". */2682#define VKD3D_SHADER_NO_SWIZZLE VKD3D_SHADER_SWIZZLE(X, Y, Z, W)26832684/** Build a vkd3d-shader swizzle with the given components. */2685static inline uint32_t vkd3d_shader_create_swizzle(enum vkd3d_shader_swizzle_component x,2686enum vkd3d_shader_swizzle_component y, enum vkd3d_shader_swizzle_component z,2687enum vkd3d_shader_swizzle_component w)2688{2689return ((x & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(0))2690| ((y & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(1))2691| ((z & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(2))2692| ((w & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(3));2693}26942695/**2696* A chained structure containing descriptions of shader inputs and outputs.2697*2698* This structure is currently implemented only for DXBC and legacy D3D bytecode2699* source types.2700* For DXBC shaders, the returned information is parsed directly from the2701* signatures embedded in the DXBC shader.2702* For legacy D3D shaders, the returned information is synthesized based on2703* registers declared or used by shader instructions.2704* For all other shader types, the structure is zeroed.2705*2706* All members (except for \ref type and \ref next) are output-only.2707*2708* This structure is passed to vkd3d_shader_scan() and extends2709* vkd3d_shader_compile_info.2710*2711* Members of this structure are allocated by vkd3d-shader and should be freed2712* with vkd3d_shader_free_scan_signature_info() when no longer needed.2713*2714* All signatures may contain pointers into the input shader, and should only2715* be accessed while the input shader remains valid.2716*2717* Signature elements are synthesized from legacy Direct3D bytecode as follows:2718* - The \ref vkd3d_shader_signature_element.semantic_name field is set to an2719* uppercase string corresponding to the HLSL name for the usage, e.g.2720* "POSITION", "BLENDWEIGHT", "COLOR", "PSIZE", etc.2721* - The \ref vkd3d_shader_signature_element.semantic_index field is set to the2722* usage index.2723* - The \ref vkd3d_shader_signature_element.stream_index is always 0.2724*2725* Signature elements are synthesized for any input or output register declared2726* or used in a legacy Direct3D bytecode shader, including the following:2727* - Shader model 1 and 2 colour and texture coordinate registers.2728* - The shader model 1 pixel shader output register.2729* - Shader model 1 and 2 vertex shader output registers (position, fog, and2730* point size).2731* - Shader model 3 pixel shader system value input registers (pixel position2732* and face).2733*2734* \since 1.92735*/2736struct vkd3d_shader_scan_signature_info2737{2738/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_SCAN_SIGNATURE_INFO. */2739enum vkd3d_shader_structure_type type;2740/** Optional pointer to a structure containing further parameters. */2741const void *next;27422743/** The shader input varyings. */2744struct vkd3d_shader_signature input;27452746/** The shader output varyings. */2747struct vkd3d_shader_signature output;27482749/** The shader patch constant varyings. */2750struct vkd3d_shader_signature patch_constant;2751};27522753/**2754* Describes the mapping of a output varying register in a shader stage,2755* to an input varying register in the following shader stage.2756*2757* This structure is used in struct vkd3d_shader_varying_map_info.2758*/2759struct vkd3d_shader_varying_map2760{2761/**2762* The signature index (in the output signature) of the output varying.2763* If greater than or equal to the number of elements in the output2764* signature, signifies that the varying is consumed by the next stage but2765* not written by this one.2766*/2767unsigned int output_signature_index;2768/** The register index of the input varying to map this register to. */2769unsigned int input_register_index;2770/** The mask consumed by the destination register. */2771unsigned int input_mask;2772};27732774/**2775* A chained structure which describes how output varyings in this shader stage2776* should be mapped to input varyings in the next stage.2777*2778* This structure is optional. It should not be provided if there is no shader2779* stage.2780* However, depending on the input and output formats, this structure may be2781* necessary in order to generate shaders which correctly match each other.2782*2783* If this structure is absent, vkd3d-shader will map varyings from one stage2784* to another based on their register index.2785* For Direct3D shader model 3.0, such a default mapping will be incorrect2786* unless the registers are allocated in the same order, and hence this2787* field is necessary to correctly match inter-stage varyings.2788* This mapping may also be necessary under other circumstances where the2789* varying interface does not match exactly.2790*2791* This structure is passed to vkd3d_shader_compile() and extends2792* vkd3d_shader_compile_info.2793*2794* This structure contains only input parameters.2795*2796* \since 1.92797*/2798struct vkd3d_shader_varying_map_info2799{2800/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_VARYING_MAP_INFO. */2801enum vkd3d_shader_structure_type type;2802/** Optional pointer to a structure containing further parameters. */2803const void *next;28042805/**2806* A mapping of output varyings in this shader stage to input varyings2807* in the next shader stage.2808*2809* This mapping should include exactly one element for each varying2810* consumed by the next shader stage.2811* If this shader stage outputs a varying that is not consumed by the next2812* shader stage, that varying should be absent from this array.2813*2814* This mapping may be constructed by vkd3d_shader_build_varying_map().2815*/2816const struct vkd3d_shader_varying_map *varying_map;2817/** The number of registers provided in \ref varying_map. */2818unsigned int varying_count;2819};28202821/**2822* Interface information regarding a builtin shader parameter.2823*2824* Like compile options specified with struct vkd3d_shader_compile_option,2825* parameters are used to specify certain values which are not part of the2826* source shader bytecode but which need to be specified in the shader bytecode2827* in the target format.2828* Unlike struct vkd3d_shader_compile_option, however, this structure allows2829* parameters to be specified in a variety of different ways, as described by2830* enum vkd3d_shader_parameter_type.2831*2832* This structure is an extended version of struct vkd3d_shader_parameter as2833* used in struct vkd3d_shader_spirv_target_info, which allows more parameter2834* types to be used, and also allows specifying parameters when compiling2835* shaders to target types other than SPIR-V. If this structure is chained2836* along with vkd3d_shader_spirv_target_info, any parameters specified in the2837* latter structure are ignored.2838*2839* This structure is passed to vkd3d_shader_compile() and extends2840* vkd3d_shader_compile_info.2841*2842* This structure contains only input parameters.2843*2844* \since 1.132845*/2846struct vkd3d_shader_parameter_info2847{2848/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_PARAMETER_INFO. */2849enum vkd3d_shader_structure_type type;2850/** Optional pointer to a structure containing further parameters. */2851const void *next;28522853/** Pointer to an array of dynamic parameters for this shader instance. */2854const struct vkd3d_shader_parameter1 *parameters;2855/** Size, in elements, of \ref parameters. */2856unsigned int parameter_count;2857};28582859#ifdef LIBVKD3D_SHADER_SOURCE2860# define VKD3D_SHADER_API VKD3D_EXPORT2861#else2862# define VKD3D_SHADER_API VKD3D_IMPORT2863#endif28642865#ifndef VKD3D_SHADER_NO_PROTOTYPES28662867/**2868* Returns the current version of this library.2869*2870* \param major Output location for the major version of this library.2871*2872* \param minor Output location for the minor version of this library.2873*2874* \return A human-readable string describing the library name and version. This2875* string is null-terminated and UTF-8 encoded. This may be a pointer to static2876* data in libvkd3d-shader; it should not be freed.2877*/2878VKD3D_SHADER_API const char *vkd3d_shader_get_version(unsigned int *major, unsigned int *minor);2879/**2880* Returns the source types supported, with any target type, by2881* vkd3d_shader_compile(). Future versions of the library may introduce2882* additional source types; callers should ignore unrecognised source types.2883*2884* Use vkd3d_shader_get_supported_target_types() to determine which target types2885* are supported for each source type.2886*2887* \param count Output location for the size, in elements, of the returned2888* array.2889*2890* \return Pointer to an array of source types supported by this version of2891* vkd3d-shader. This array may be a pointer to static data in libvkd3d-shader;2892* it should not be freed.2893*/2894VKD3D_SHADER_API const enum vkd3d_shader_source_type *vkd3d_shader_get_supported_source_types(unsigned int *count);2895/**2896* Returns the target types supported, with the given source type, by2897* vkd3d_shader_compile(). Future versions of the library may introduce2898* additional target types; callers should ignore unrecognised target types.2899*2900* \param source_type Source type for which to enumerate supported target types.2901*2902* \param count Output location for the size, in elements, of the returned2903* array.2904*2905* \return Pointer to an array of target types supported by this version of2906* vkd3d-shader. This array may be a pointer to static data in libvkd3d-shader;2907* it should not be freed.2908*/2909VKD3D_SHADER_API const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types(2910enum vkd3d_shader_source_type source_type, unsigned int *count);29112912/**2913* Transform a form of GPU shader source code or byte code into another form of2914* source code or byte code.2915*2916* This version of vkd3d-shader supports the following transformations:2917* - VKD3D_SHADER_SOURCE_DXBC_DXIL to VKD3D_SHADER_TARGET_SPIRV_BINARY2918* - VKD3D_SHADER_SOURCE_DXBC_DXIL to VKD3D_SHADER_TARGET_SPIRV_TEXT2919* (if vkd3d was compiled with SPIRV-Tools)2920* - VKD3D_SHADER_SOURCE_DXBC_DXIL to VKD3D_SHADER_TARGET_D3D_ASM2921* - VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_SPIRV_BINARY2922* - VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_SPIRV_TEXT2923* (if vkd3d was compiled with SPIRV-Tools)2924* - VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_D3D_ASM2925* - VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_SPIRV_BINARY2926* - VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_SPIRV_TEXT2927* (if vkd3d was compiled with SPIRV-Tools)2928* - VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_D3D_ASM2929* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_SPIRV_BINARY2930* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_SPIRV_TEXT2931* (if vkd3d was compiled with SPIRV-Tools)2932* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_D3D_ASM2933* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_D3D_BYTECODE2934* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_DXBC_TPF2935* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_FX2936* - VKD3D_SHADER_SOURCE_FX to VKD3D_SHADER_TARGET_D3D_ASM2937* - VKD3D_SHADER_SOURCE_TX to VKD3D_SHADER_TARGET_D3D_ASM2938*2939* Supported transformations can also be detected at runtime with the functions2940* vkd3d_shader_get_supported_source_types() and2941* vkd3d_shader_get_supported_target_types().2942*2943* Depending on the source and target types, this function may support the2944* following chained structures:2945* - vkd3d_shader_d3dbc_source_info2946* - vkd3d_shader_descriptor_offset_info2947* - vkd3d_shader_hlsl_source_info2948* - vkd3d_shader_interface_info2949* - vkd3d_shader_parameter_info2950* - vkd3d_shader_preprocess_info2951* - vkd3d_shader_scan_combined_resource_sampler_info2952* - vkd3d_shader_scan_descriptor_info2953* - vkd3d_shader_scan_hull_shader_tessellation_info2954* - vkd3d_shader_scan_signature_info2955* - vkd3d_shader_scan_thread_group_size_info2956* - vkd3d_shader_spirv_domain_shader_target_info2957* - vkd3d_shader_spirv_target_info2958* - vkd3d_shader_transform_feedback_info2959* - vkd3d_shader_varying_map_info2960*2961* \param compile_info A chained structure containing compilation parameters.2962*2963* \param out A pointer to a vkd3d_shader_code structure in which the compiled2964* code will be stored.2965* \n2966* The compiled shader is allocated by vkd3d-shader and should be freed with2967* vkd3d_shader_free_shader_code() when no longer needed.2968*2969* \param messages Optional output location for error or informational messages2970* produced by the compiler.2971* \n2972* This string is null-terminated and UTF-8 encoded.2973* \n2974* The messages are allocated by vkd3d-shader and should be freed with2975* vkd3d_shader_free_messages() when no longer needed.2976* \n2977* The messages returned can be regulated with the \a log_level member of struct2978* vkd3d_shader_compile_info. Regardless of the requested level, if this2979* parameter is NULL, no compilation messages will be returned.2980* \n2981* If no messages are produced by the compiler, this parameter may2982* receive NULL instead of a valid string pointer.2983*2984* \return A member of \ref vkd3d_result.2985*/2986VKD3D_SHADER_API int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info,2987struct vkd3d_shader_code *out, char **messages);2988/**2989* Free shader messages allocated by another vkd3d-shader function, such as2990* vkd3d_shader_compile().2991*2992* \param messages Messages to free. This pointer is optional and may be NULL,2993* in which case no action will be taken.2994*/2995VKD3D_SHADER_API void vkd3d_shader_free_messages(char *messages);2996/**2997* Free shader code allocated by another vkd3d-shader function, such as2998* vkd3d_shader_compile().2999*3000* This function frees the \ref vkd3d_shader_code.code member, but does not free3001* the structure itself.3002*3003* \param code Code to free.3004*/3005VKD3D_SHADER_API void vkd3d_shader_free_shader_code(struct vkd3d_shader_code *code);30063007/**3008* Convert a byte code description of a shader root signature to a structural3009* description which can be easily parsed by C code.3010*3011* This function corresponds to3012* ID3D12VersionedRootSignatureDeserializer::GetUnconvertedRootSignatureDesc().3013*3014* This function performs the reverse transformation of3015* vkd3d_shader_serialize_root_signature().3016*3017* This function parses a standalone root signature, and should not be confused3018* with vkd3d_shader_parse_input_signature().3019*3020* \param dxbc Compiled byte code, in DXBC format.3021*3022* \param root_signature Output location in which the decompiled root signature3023* will be stored.3024* \n3025* Members of \a root_signature may be allocated by vkd3d-shader. The signature3026* should be freed with vkd3d_shader_free_root_signature() when no longer3027* needed.3028*3029* \param messages Optional output location for error or informational messages3030* produced by the parser.3031* \n3032* This string is null-terminated and UTF-8 encoded.3033* \n3034* The messages are allocated by vkd3d-shader and should be freed with3035* vkd3d_shader_free_messages() when no longer needed.3036* \n3037* If no messages are produced by the parser, this parameter may3038* receive NULL instead of a valid string pointer.3039*3040* \return A member of \ref vkd3d_result.3041*/3042VKD3D_SHADER_API int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc,3043struct vkd3d_shader_versioned_root_signature_desc *root_signature, char **messages);3044/**3045* Free a structural representation of a shader root signature allocated by3046* vkd3d_shader_convert_root_signature() or vkd3d_shader_parse_root_signature().3047*3048* This function may free members of struct3049* vkd3d_shader_versioned_root_signature_desc, but does not free the structure3050* itself.3051*3052* \param root_signature Signature description to free.3053*/3054VKD3D_SHADER_API void vkd3d_shader_free_root_signature(3055struct vkd3d_shader_versioned_root_signature_desc *root_signature);30563057/**3058* Convert a structural description of a shader root signature to a byte code3059* format capable of being read by ID3D12Device::CreateRootSignature. The3060* compiled signature is compatible with Microsoft D3D 12.3061*3062* This function corresponds to D3D12SerializeVersionedRootSignature().3063*3064* \param root_signature Description of the root signature.3065*3066* \param dxbc A pointer to a vkd3d_shader_code structure in which the compiled3067* code will be stored.3068* \n3069* The compiled signature is allocated by vkd3d-shader and should be freed with3070* vkd3d_shader_free_shader_code() when no longer needed.3071*3072* \param messages Optional output location for error or informational messages3073* produced by the serializer.3074* \n3075* This string is null-terminated and UTF-8 encoded.3076* \n3077* The messages are allocated by vkd3d-shader and should be freed with3078* vkd3d_shader_free_messages() when no longer needed.3079* \n3080* If no messages are produced by the serializer, this parameter may3081* receive NULL instead of a valid string pointer.3082*3083* \return A member of \ref vkd3d_result.3084*/3085VKD3D_SHADER_API int vkd3d_shader_serialize_root_signature(3086const struct vkd3d_shader_versioned_root_signature_desc *root_signature,3087struct vkd3d_shader_code *dxbc, char **messages);3088/**3089* Convert a structural representation of a root signature to a different3090* version of structural representation.3091*3092* This function corresponds to3093* ID3D12VersionedRootSignatureDeserializer::GetRootSignatureDescAtVersion().3094*3095* \param dst A pointer to a vkd3d_shader_versioned_root_signature_desc3096* structure in which the converted signature will be stored.3097* \n3098* Members of \a dst may be allocated by vkd3d-shader. The signature should be3099* freed with vkd3d_shader_free_root_signature() when no longer needed.3100*3101* \param version The desired version to convert \a src to. This version must3102* not be equal to \a src->version.3103*3104* \param src Input root signature description.3105*3106* \return A member of \ref vkd3d_result.3107*/3108VKD3D_SHADER_API int vkd3d_shader_convert_root_signature(struct vkd3d_shader_versioned_root_signature_desc *dst,3109enum vkd3d_shader_root_signature_version version, const struct vkd3d_shader_versioned_root_signature_desc *src);31103111/**3112* Parse shader source code or byte code, returning various types of requested3113* information.3114*3115* The \a source_type member of \a compile_info must be set to the type of the3116* shader.3117*3118* The \a target_type member may be set to VKD3D_SHADER_TARGET_NONE, in which3119* case vkd3d_shader_scan() will return information about the shader in3120* isolation. Alternatively, it may be set to a valid compilation target for the3121* shader, in which case vkd3d_shader_scan() will return information that3122* reflects the interface for a shader as it will be compiled to that target.3123* In this case other chained structures may be appended to \a compile_info as3124* they would be passed to vkd3d_shader_compile(), and interpreted accordingly,3125* such as vkd3d_shader_spirv_target_info.3126*3127* (For a hypothetical example, suppose the source shader distinguishes float3128* and integer texture data, but the target environment does not support integer3129* textures. In this case vkd3d_shader_compile() might translate integer3130* operations to float. Accordingly using VKD3D_SHADER_TARGET_NONE would3131* accurately report whether the texture expects integer or float data, but3132* using the relevant specific target type would report3133* VKD3D_SHADER_RESOURCE_DATA_FLOAT.)3134*3135* Currently this function supports the following code types:3136* - VKD3D_SHADER_SOURCE_DXBC_DXIL3137* - VKD3D_SHADER_SOURCE_DXBC_TPF3138* - VKD3D_SHADER_SOURCE_D3D_BYTECODE3139* - VKD3D_SHADER_SOURCE_HLSL3140*3141* \param compile_info A chained structure containing scan parameters.3142* \n3143* The scanner supports the following chained structures:3144* - vkd3d_shader_d3dbc_source_info3145* - vkd3d_shader_descriptor_offset_info3146* - vkd3d_shader_hlsl_source_info3147* - vkd3d_shader_interface_info3148* - vkd3d_shader_parameter_info3149* - vkd3d_shader_preprocess_info3150* - vkd3d_shader_scan_combined_resource_sampler_info3151* - vkd3d_shader_scan_descriptor_info3152* - vkd3d_shader_scan_hull_shader_tessellation_info3153* - vkd3d_shader_scan_signature_info3154* - vkd3d_shader_scan_thread_group_size_info3155* - vkd3d_shader_spirv_domain_shader_target_info3156* - vkd3d_shader_spirv_target_info3157* - vkd3d_shader_transform_feedback_info3158* - vkd3d_shader_varying_map_info3159* \n3160* Although the \a compile_info parameter is read-only, chained structures3161* passed to this function need not be, and may serve as output parameters,3162* depending on their structure type.3163*3164* \param messages Optional output location for error or informational messages3165* produced by the parser.3166* \n3167* This string is null-terminated and UTF-8 encoded.3168* \n3169* The messages are allocated by vkd3d-shader and should be freed with3170* vkd3d_shader_free_messages() when no longer needed.3171* \n3172* The messages returned can be regulated with the \a log_level member of struct3173* vkd3d_shader_compile_info. Regardless of the requested level, if this3174* parameter is NULL, no compilation messages will be returned.3175* \n3176* If no messages are produced by the parser, this parameter may3177* receive NULL instead of a valid string pointer.3178*3179* \return A member of \ref vkd3d_result.3180*/3181VKD3D_SHADER_API int vkd3d_shader_scan(const struct vkd3d_shader_compile_info *compile_info, char **messages);3182/**3183* Free members of struct vkd3d_shader_scan_descriptor_info() allocated by3184* vkd3d_shader_scan().3185*3186* This function may free members of vkd3d_shader_scan_descriptor_info, but3187* does not free the structure itself.3188*3189* \param scan_descriptor_info Descriptor information to free.3190*/3191VKD3D_SHADER_API void vkd3d_shader_free_scan_descriptor_info(3192struct vkd3d_shader_scan_descriptor_info *scan_descriptor_info);31933194/**3195* Read the input signature of a compiled DXBC shader, returning a structural3196* description which can be easily parsed by C code.3197*3198* This function parses a compiled shader. To parse a standalone root signature,3199* use vkd3d_shader_parse_root_signature().3200*3201* This function only parses DXBC shaders, and only retrieves the input3202* signature. To retrieve signatures from other shader types, or other signature3203* types, use vkd3d_shader_scan() and struct vkd3d_shader_scan_signature_info.3204* This function returns the same input signature that is returned in3205* struct vkd3d_shader_scan_signature_info for dxbc-tpf shaders, but may return3206* different information for dxbc-dxil shaders.3207*3208* \param dxbc Compiled byte code, in DXBC format.3209*3210* \param signature Output location in which the parsed root signature will be3211* stored.3212* \n3213* Members of \a signature may be allocated by vkd3d-shader. The signature3214* should be freed with vkd3d_shader_free_shader_signature() when no longer3215* needed.3216* \n3217* The signature may contain pointers into the input shader, and should only be3218* accessed while the input shader remains valid.3219*3220* \param messages Optional output location for error or informational messages3221* produced by the parser.3222* \n3223* This string is null-terminated and UTF-8 encoded.3224* \n3225* The messages are allocated by vkd3d-shader and should be freed with3226* vkd3d_shader_free_messages() when no longer needed.3227* \n3228* If no messages are produced by the parser, this parameter may3229* receive NULL instead of a valid string pointer.3230*3231* \return A member of \ref vkd3d_result.3232*/3233VKD3D_SHADER_API int vkd3d_shader_parse_input_signature(const struct vkd3d_shader_code *dxbc,3234struct vkd3d_shader_signature *signature, char **messages);3235/**3236* Find a single element of a parsed input signature.3237*3238* \param signature The parsed input signature. This structure is normally3239* populated by vkd3d_shader_parse_input_signature().3240*3241* \param semantic_name Semantic name of the desired element. This function3242* performs a case-insensitive comparison with respect to the ASCII plane.3243*3244* \param semantic_index Semantic index of the desired element.3245*3246* \param stream_index Geometry shader stream index of the desired element. If3247* the signature is not a geometry shader output signature, this parameter must3248* be set to 0.3249*3250* \return A description of the element matching the requested parameters, or3251* NULL if no such element was found. If not NULL, the return value points into3252* the \a signature parameter and should not be explicitly freed.3253*/3254VKD3D_SHADER_API struct vkd3d_shader_signature_element *vkd3d_shader_find_signature_element(3255const struct vkd3d_shader_signature *signature, const char *semantic_name,3256unsigned int semantic_index, unsigned int stream_index);3257/**3258* Free a structural representation of a shader input signature allocated by3259* vkd3d_shader_parse_input_signature().3260*3261* This function may free members of struct vkd3d_shader_signature, but does not3262* free the structure itself.3263*3264* \param signature Signature description to free.3265*/3266VKD3D_SHADER_API void vkd3d_shader_free_shader_signature(struct vkd3d_shader_signature *signature);32673268/* 1.3 */32693270/**3271* Preprocess the given source code.3272*3273* This function supports the following chained structures:3274* - vkd3d_shader_preprocess_info3275*3276* \param compile_info A chained structure containing compilation parameters.3277*3278* \param out A pointer to a vkd3d_shader_code structure in which the3279* preprocessed code will be stored.3280* \n3281* The preprocessed shader is allocated by vkd3d-shader and should be freed with3282* vkd3d_shader_free_shader_code() when no longer needed.3283*3284* \param messages Optional output location for error or informational messages3285* produced by the preprocessor.3286* \n3287* This string is null-terminated and UTF-8 encoded.3288* \n3289* The messages are allocated by vkd3d-shader and should be freed with3290* vkd3d_shader_free_messages() when no longer needed.3291* \n3292* The messages returned can be regulated with the \a log_level member of struct3293* vkd3d_shader_compile_info. Regardless of the requested level, if this3294* parameter is NULL, no compilation messages will be returned.3295* \n3296* If no messages are produced by the preprocessor, this parameter may3297* receive NULL instead of a valid string pointer.3298*3299* \return A member of \ref vkd3d_result.3300*3301* \since 1.33302*/3303VKD3D_SHADER_API int vkd3d_shader_preprocess(const struct vkd3d_shader_compile_info *compile_info,3304struct vkd3d_shader_code *out, char **messages);33053306/**3307* Set a callback to be called when vkd3d-shader outputs debug logging.3308*3309* If NULL, or if this function has not been called, libvkd3d-shader will print3310* all enabled log output to stderr.3311*3312* \param callback Callback function to set.3313*3314* \since 1.43315*/3316VKD3D_SHADER_API void vkd3d_shader_set_log_callback(PFN_vkd3d_log callback);33173318/**3319* Free the contents of a vkd3d_shader_dxbc_desc structure allocated by3320* another vkd3d-shader function, such as vkd3d_shader_parse_dxbc().3321*3322* This function may free the \ref vkd3d_shader_dxbc_desc.sections member, but3323* does not free the structure itself.3324*3325* \param dxbc The vkd3d_shader_dxbc_desc structure to free.3326*3327* \since 1.73328*/3329VKD3D_SHADER_API void vkd3d_shader_free_dxbc(struct vkd3d_shader_dxbc_desc *dxbc);33303331/**3332* Parse a DXBC blob contained in a vkd3d_shader_code structure.3333*3334* \param dxbc A vkd3d_shader_code structure containing the DXBC blob to parse.3335*3336* \param flags A combination of zero or more elements of enum3337* vkd3d_shader_parse_dxbc_flags.3338*3339* \param desc A vkd3d_shader_dxbc_desc structure describing the contents of3340* the DXBC blob. Its vkd3d_shader_dxbc_section_desc structures will contain3341* pointers into the input blob; its contents are only valid while the input3342* blob is valid. The contents of this structure should be freed with3343* vkd3d_shader_free_dxbc() when no longer needed.3344*3345* \param messages Optional output location for error or informational messages3346* produced by the parser.3347* \n3348* This string is null-terminated and UTF-8 encoded.3349* \n3350* The messages are allocated by vkd3d-shader and should be freed with3351* vkd3d_shader_free_messages() when no longer needed.3352* \n3353* If no messages are produced by the parser, this parameter may3354* receive NULL instead of a valid string pointer.3355*3356* \return A member of \ref vkd3d_result.3357*3358* \since 1.73359*/3360VKD3D_SHADER_API int vkd3d_shader_parse_dxbc(const struct vkd3d_shader_code *dxbc,3361uint32_t flags, struct vkd3d_shader_dxbc_desc *desc, char **messages);33623363/**3364* Serialize a DXBC description into a blob stored in a vkd3d_shader_code3365* structure.3366*3367* \param section_count The number of DXBC sections to serialize.3368*3369* \param sections An array of vkd3d_shader_dxbc_section_desc structures3370* to serialize.3371*3372* \param dxbc A pointer to a vkd3d_shader_code structure in which the3373* serialized blob will be stored.3374* \n3375* The output blob is allocated by vkd3d-shader and should be freed with3376* vkd3d_shader_free_shader_code() when no longer needed.3377*3378* \param messages Optional output location for error or informational messages3379* produced by the serializer.3380* \n3381* This string is null-terminated and UTF-8 encoded.3382* \n3383* The messages are allocated by vkd3d-shader and should be freed with3384* vkd3d_shader_free_messages() when no longer needed.3385* \n3386* If no messages are produced by the serializer, this parameter may3387* receive NULL instead of a valid string pointer.3388*3389* \return A member of \ref vkd3d_result.3390*3391* \since 1.73392*/3393VKD3D_SHADER_API int vkd3d_shader_serialize_dxbc(size_t section_count,3394const struct vkd3d_shader_dxbc_section_desc *sections, struct vkd3d_shader_code *dxbc, char **messages);33953396/**3397* Free members of struct vkd3d_shader_scan_signature_info allocated by3398* vkd3d_shader_scan().3399*3400* This function may free members of vkd3d_shader_scan_signature_info, but3401* does not free the structure itself.3402*3403* \param info Scan information to free.3404*3405* \since 1.93406*/3407VKD3D_SHADER_API void vkd3d_shader_free_scan_signature_info(struct vkd3d_shader_scan_signature_info *info);34083409/**3410* Build a mapping of output varyings in a shader stage to input varyings in3411* the following shader stage.3412*3413* This mapping should be used in struct vkd3d_shader_varying_map_info to3414* compile the first shader.3415*3416* \param output_signature The output signature of the first shader.3417*3418* \param input_signature The input signature of the second shader.3419*3420* \param count On output, contains the number of entries written into3421* "varyings".3422*3423* \param varyings Pointer to an output array of varyings.3424* This must point to space for N varyings, where N is the number of elements3425* in the input signature.3426*3427* \remark Valid legacy Direct3D pixel shaders have at most 12 varying inputs:3428* 10 inter-stage varyings, face, and position.3429* Therefore, in practice, it is safe to call this function with a3430* pre-allocated array with a fixed size of 12.3431*3432* \since 1.93433*/3434VKD3D_SHADER_API void vkd3d_shader_build_varying_map(const struct vkd3d_shader_signature *output_signature,3435const struct vkd3d_shader_signature *input_signature,3436unsigned int *count, struct vkd3d_shader_varying_map *varyings);34373438/**3439* Free members of struct vkd3d_shader_scan_combined_resource_sampler_info3440* allocated by vkd3d_shader_scan().3441*3442* This function may free members of3443* vkd3d_shader_scan_combined_resource_sampler_info, but does not free the3444* structure itself.3445*3446* \param info Combined resource-sampler information to free.3447*3448* \since 1.103449*/3450VKD3D_SHADER_API void vkd3d_shader_free_scan_combined_resource_sampler_info(3451struct vkd3d_shader_scan_combined_resource_sampler_info *info);34523453#endif /* VKD3D_SHADER_NO_PROTOTYPES */34543455/** Type of vkd3d_shader_get_version(). */3456typedef const char *(*PFN_vkd3d_shader_get_version)(unsigned int *major, unsigned int *minor);3457/** Type of vkd3d_shader_get_supported_source_types(). */3458typedef const enum vkd3d_shader_source_type *(*PFN_vkd3d_shader_get_supported_source_types)(unsigned int *count);3459/** Type of vkd3d_shader_get_supported_target_types(). */3460typedef const enum vkd3d_shader_target_type *(*PFN_vkd3d_shader_get_supported_target_types)(3461enum vkd3d_shader_source_type source_type, unsigned int *count);34623463/** Type of vkd3d_shader_compile(). */3464typedef int (*PFN_vkd3d_shader_compile)(const struct vkd3d_shader_compile_info *compile_info,3465struct vkd3d_shader_code *out, char **messages);3466/** Type of vkd3d_shader_free_messages(). */3467typedef void (*PFN_vkd3d_shader_free_messages)(char *messages);3468/** Type of vkd3d_shader_free_shader_code(). */3469typedef void (*PFN_vkd3d_shader_free_shader_code)(struct vkd3d_shader_code *code);34703471/** Type of vkd3d_shader_parse_root_signature(). */3472typedef int (*PFN_vkd3d_shader_parse_root_signature)(const struct vkd3d_shader_code *dxbc,3473struct vkd3d_shader_versioned_root_signature_desc *root_signature, char **messages);3474/** Type of vkd3d_shader_free_root_signature(). */3475typedef void (*PFN_vkd3d_shader_free_root_signature)(struct vkd3d_shader_versioned_root_signature_desc *root_signature);34763477/** Type of vkd3d_shader_serialize_root_signature(). */3478typedef int (*PFN_vkd3d_shader_serialize_root_signature)(3479const struct vkd3d_shader_versioned_root_signature_desc *root_signature,3480struct vkd3d_shader_code *dxbc, char **messages);34813482/** Type of vkd3d_shader_convert_root_signature(). */3483typedef int (*PFN_vkd3d_shader_convert_root_signature)(struct vkd3d_shader_versioned_root_signature_desc *dst,3484enum vkd3d_shader_root_signature_version version, const struct vkd3d_shader_versioned_root_signature_desc *src);34853486/** Type of vkd3d_shader_scan(). */3487typedef int (*PFN_vkd3d_shader_scan)(const struct vkd3d_shader_compile_info *compile_info, char **messages);3488/** Type of vkd3d_shader_free_scan_descriptor_info(). */3489typedef void (*PFN_vkd3d_shader_free_scan_descriptor_info)(3490struct vkd3d_shader_scan_descriptor_info *scan_descriptor_info);34913492/** Type of vkd3d_shader_parse_input_signature(). */3493typedef int (*PFN_vkd3d_shader_parse_input_signature)(const struct vkd3d_shader_code *dxbc,3494struct vkd3d_shader_signature *signature, char **messages);3495/** Type of vkd3d_shader_find_signature_element(). */3496typedef struct vkd3d_shader_signature_element * (*PFN_vkd3d_shader_find_signature_element)(3497const struct vkd3d_shader_signature *signature, const char *semantic_name,3498unsigned int semantic_index, unsigned int stream_index);3499/** Type of vkd3d_shader_free_shader_signature(). */3500typedef void (*PFN_vkd3d_shader_free_shader_signature)(struct vkd3d_shader_signature *signature);35013502/** Type of vkd3d_shader_preprocess(). \since 1.3 */3503typedef void (*PFN_vkd3d_shader_preprocess)(struct vkd3d_shader_compile_info *compile_info,3504struct vkd3d_shader_code *out, char **messages);35053506/** Type of vkd3d_shader_set_log_callback(). \since 1.4 */3507typedef void (*PFN_vkd3d_shader_set_log_callback)(PFN_vkd3d_log callback);35083509/** Type of vkd3d_shader_free_dxbc(). \since 1.7 */3510typedef void (*PFN_vkd3d_shader_free_dxbc)(struct vkd3d_shader_dxbc_desc *dxbc);3511/** Type of vkd3d_shader_parse_dxbc(). \since 1.7 */3512typedef int (*PFN_vkd3d_shader_parse_dxbc)(const struct vkd3d_shader_code *dxbc,3513uint32_t flags, struct vkd3d_shader_dxbc_desc *desc, char **messages);3514/** Type of vkd3d_shader_serialize_dxbc(). \since 1.7 */3515typedef int (*PFN_vkd3d_shader_serialize_dxbc)(size_t section_count,3516const struct vkd3d_shader_dxbc_section_desc *sections, struct vkd3d_shader_code *dxbc, char **messages);35173518/** Type of vkd3d_shader_build_varying_map(). \since 1.9 */3519typedef void (*PFN_vkd3d_shader_build_varying_map)(const struct vkd3d_shader_signature *output_signature,3520const struct vkd3d_shader_signature *input_signature,3521unsigned int *count, struct vkd3d_shader_varying_map *varyings);3522/** Type of vkd3d_shader_free_scan_signature_info(). \since 1.9 */3523typedef void (*PFN_vkd3d_shader_free_scan_signature_info)(struct vkd3d_shader_scan_signature_info *info);35243525/** Type of vkd3d_shader_free_scan_combined_resource_sampler_info(). \since 1.10 */3526typedef void (*PFN_vkd3d_shader_free_scan_combined_resource_sampler_info)(3527struct vkd3d_shader_scan_combined_resource_sampler_info *info);35283529#ifdef __cplusplus3530}3531#endif /* __cplusplus */35323533#endif /* __VKD3D_SHADER_H */353435353536