diff --git a/examples/reflection.hlsl b/examples/reflection.hlsl new file mode 100644 index 0000000..74f10b9 --- /dev/null +++ b/examples/reflection.hlsl @@ -0,0 +1,203 @@ +// This HLSL file is an example vertex/pixel shader pair for showing usage of DXC's reflection API +// +// It originates from the D3D12 Multithreading sample +// https://github.com/microsoft/DirectX-Graphics-Samples/blob/master/Samples/Desktop/D3D12Multithreading/src/shaders.hlsl +// +// Some modifications have been made. They are summarized here and have a "EDIT: ..." comment +// in the code below with the original line: +// - Added a ConstantBuffer that matches the original cbuffer +// - Modified a ternary into a select() to address DXC compile error +// - Modified a usage of the SceneConstantBuffer cbuffer to use SomeConstants +// instead so that SomeConstants isn't stripped from reflection due to being unused. + +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +Texture2D shadowMap : register(t0); +Texture2D diffuseMap : register(t1); +Texture2D normalMap : register(t2); + +SamplerState sampleWrap : register(s0); +SamplerState sampleClamp : register(s1); + +#define NUM_LIGHTS 3 +#define SHADOW_DEPTH_BIAS 0.00005f + +struct LightState +{ + float3 position; + float3 direction; + float4 color; + float4 falloff; + float4x4 view; + float4x4 projection; +}; + +//EDIT: Added a ConstantBuffer that mimics the original cbuffer +struct ConstantBufferContents { + float4x4 model; + float4x4 view; + float4x4 projection; + float4 ambientColor; + bool sampleShadowMap; + LightState lights[NUM_LIGHTS]; +}; + +ConstantBuffer SomeConstants : register(b1); +//EDIT: End additional code + +cbuffer SceneConstantBuffer : register(b0) +{ + float4x4 model; + float4x4 view; + float4x4 projection; + float4 ambientColor; + bool sampleShadowMap; + LightState lights[NUM_LIGHTS]; +}; + +struct PSInput +{ + float4 position : SV_POSITION; + float4 worldpos : POSITION; + float2 uv : TEXCOORD0; + float3 normal : NORMAL; + float3 tangent : TANGENT; +}; + + +//-------------------------------------------------------------------------------------- +// Sample normal map, convert to signed, apply tangent-to-world space transform. +//-------------------------------------------------------------------------------------- +float3 CalcPerPixelNormal(float2 vTexcoord, float3 vVertNormal, float3 vVertTangent) +{ + // Compute tangent frame. + vVertNormal = normalize(vVertNormal); + vVertTangent = normalize(vVertTangent); + + float3 vVertBinormal = normalize(cross(vVertTangent, vVertNormal)); + float3x3 mTangentSpaceToWorldSpace = float3x3(vVertTangent, vVertBinormal, vVertNormal); + + // Compute per-pixel normal. + float3 vBumpNormal = (float3)normalMap.Sample(sampleWrap, vTexcoord); + vBumpNormal = 2.0f * vBumpNormal - 1.0f; + + return mul(vBumpNormal, mTangentSpaceToWorldSpace); +} + +//-------------------------------------------------------------------------------------- +// Diffuse lighting calculation, with angle and distance falloff. +//-------------------------------------------------------------------------------------- +float4 CalcLightingColor(float3 vLightPos, float3 vLightDir, float4 vLightColor, float4 vFalloffs, float3 vPosWorld, float3 vPerPixelNormal) +{ + float3 vLightToPixelUnNormalized = vPosWorld - vLightPos; + + // Dist falloff = 0 at vFalloffs.x, 1 at vFalloffs.x - vFalloffs.y + float fDist = length(vLightToPixelUnNormalized); + + float fDistFalloff = saturate((vFalloffs.x - fDist) / vFalloffs.y); + + // Normalize from here on. + float3 vLightToPixelNormalized = vLightToPixelUnNormalized / fDist; + + // Angle falloff = 0 at vFalloffs.z, 1 at vFalloffs.z - vFalloffs.w + float fCosAngle = dot(vLightToPixelNormalized, vLightDir / length(vLightDir)); + float fAngleFalloff = saturate((fCosAngle - vFalloffs.z) / vFalloffs.w); + + // Diffuse contribution. + float fNDotL = saturate(-dot(vLightToPixelNormalized, vPerPixelNormal)); + + return vLightColor * fNDotL * fDistFalloff * fAngleFalloff; +} + +//-------------------------------------------------------------------------------------- +// Test how much pixel is in shadow, using 2x2 percentage-closer filtering. +//-------------------------------------------------------------------------------------- +float4 CalcUnshadowedAmountPCF2x2(int lightIndex, float4 vPosWorld) +{ + // Compute pixel position in light space. + float4 vLightSpacePos = vPosWorld; + vLightSpacePos = mul(vLightSpacePos, lights[lightIndex].view); + vLightSpacePos = mul(vLightSpacePos, lights[lightIndex].projection); + + vLightSpacePos.xyz /= vLightSpacePos.w; + + // Translate from homogeneous coords to texture coords. + float2 vShadowTexCoord = 0.5f * vLightSpacePos.xy + 0.5f; + vShadowTexCoord.y = 1.0f - vShadowTexCoord.y; + + // Depth bias to avoid pixel self-shadowing. + float vLightSpaceDepth = vLightSpacePos.z - SHADOW_DEPTH_BIAS; + + // Find sub-pixel weights. + float2 vShadowMapDims = float2(1280.0f, 720.0f); // need to keep in sync with .cpp file + float4 vSubPixelCoords = float4(1.0f, 1.0f, 1.0f, 1.0f); + vSubPixelCoords.xy = frac(vShadowMapDims * vShadowTexCoord); + vSubPixelCoords.zw = 1.0f - vSubPixelCoords.xy; + float4 vBilinearWeights = vSubPixelCoords.zxzx * vSubPixelCoords.wwyy; + + // 2x2 percentage closer filtering. + float2 vTexelUnits = 1.0f / vShadowMapDims; + float4 vShadowDepths; + vShadowDepths.x = shadowMap.Sample(sampleClamp, vShadowTexCoord); + vShadowDepths.y = shadowMap.Sample(sampleClamp, vShadowTexCoord + float2(vTexelUnits.x, 0.0f)); + vShadowDepths.z = shadowMap.Sample(sampleClamp, vShadowTexCoord + float2(0.0f, vTexelUnits.y)); + vShadowDepths.w = shadowMap.Sample(sampleClamp, vShadowTexCoord + vTexelUnits); + + // What weighted fraction of the 4 samples are nearer to the light than this pixel? + //EDIT: Fix compile error in dxc, original line below and commented out + //float4 vShadowTests = (vShadowDepths >= vLightSpaceDepth) ? 1.0f : 0.0f; + float4 vShadowTests = select((vShadowDepths >= vLightSpaceDepth), 1.0f, 0.0f); + return dot(vBilinearWeights, vShadowTests); +} + +PSInput VSMain(float3 position : POSITION, float3 normal : NORMAL, float2 uv : TEXCOORD0, float3 tangent : TANGENT) +{ + PSInput result; + + float4 newPosition = float4(position, 1.0f); + + normal.z *= -1.0f; + //EDIT: Use ConstantsBuffer so it isn't stripped by dxc, original line below and commented out + //newPosition = mul(newPosition, model); + newPosition = mul(newPosition, SomeConstants.model); + + result.worldpos = newPosition; + + newPosition = mul(newPosition, view); + newPosition = mul(newPosition, projection); + + result.position = newPosition; + result.uv = uv; + result.normal = normal; + result.tangent = tangent; + + return result; +} + +float4 PSMain(PSInput input) : SV_TARGET +{ + float4 diffuseColor = diffuseMap.Sample(sampleWrap, input.uv); + float3 pixelNormal = CalcPerPixelNormal(input.uv, input.normal, input.tangent); + float4 totalLight = ambientColor; + + for (int i = 0; i < NUM_LIGHTS; i++) + { + float4 lightPass = CalcLightingColor(lights[i].position, lights[i].direction, lights[i].color, lights[i].falloff, input.worldpos.xyz, pixelNormal); + if (sampleShadowMap && i == 0) + { + lightPass *= CalcUnshadowedAmountPCF2x2(i, input.worldpos); + } + totalLight += lightPass; + } + + return diffuseColor * saturate(totalLight); +} \ No newline at end of file diff --git a/examples/reflection.rs b/examples/reflection.rs new file mode 100644 index 0000000..29a7552 --- /dev/null +++ b/examples/reflection.rs @@ -0,0 +1,125 @@ +use std::ffi::CString; + +fn main() -> Result<(), Box> { + let source_copy = include_str!("copy.hlsl"); + let source_reflection = include_str!("reflection.hlsl"); + + let dxc = hassle_rs::Dxc::new(None)?; + + let compiler = dxc.create_compiler()?; + let library = dxc.create_library()?; + + let copy_blob = library.create_blob_with_encoding_from_str(source_copy)?; + let reflection_blob = library.create_blob_with_encoding_from_str(source_reflection)?; + + println!("====== COMPUTE SHADER EXAMPLE ======"); + + // Example with a compute shader + match compiler.compile( + ©_blob, + "copy.hlsl", + "copyCs", + "cs_6_0", + &["-Od"], // "-Zi" + Some(&mut hassle_rs::utils::DefaultIncludeHandler), + &[], + ) { + Ok(result) => { + let reflector = dxc.create_reflector()?; + let reflected = reflector.reflect(result.get_result()?)?; + + let thread_group_size = reflected.thread_group_size(); + println!("thread group size {:?}", thread_group_size); + + let shader_desc = reflected.get_desc()?; + println!("desc: {:?}", shader_desc); + } + Err((result, _hresult)) => { + println!("failed to compile shader"); + let error_blob = result.get_error_buffer()?; + let error_string = library.get_blob_as_string(&error_blob.into())?; + println!("{}", error_string); + } + } + + println!("====== VERTEX SHADER EXAMPLE ======"); + + // + match compiler.compile( + &reflection_blob, + "reflection.hlsl", + "VSMain", + "vs_6_0", + &["-Od"], // "-Zi" + Some(&mut hassle_rs::utils::DefaultIncludeHandler), + &[], + ) { + Ok(result) => { + let reflector = dxc.create_reflector()?; + let reflected = reflector.reflect(result.get_result()?)?; + + let shader_desc = reflected.get_desc()?; + println!("desc: {:?}", shader_desc); + + let cb = reflected + .get_constant_buffer_by_name(CString::new("SomeConstants").unwrap().as_ref()) + .get_desc()?; + println!("found constant buffer 'SomeConstants' by name {:?}", cb); + + println!("----- Resources"); + for i in 0..shader_desc.BoundResources { + let resource_binding = reflected.get_resource_binding_desc(i)?; + println!("resource {} {:?}", i, resource_binding); + } + + println!("----- Input Parameters"); + for i in 0..shader_desc.InputParameters { + let input_param = reflected.get_input_parameter_desc(i)?; + println!("input param {} {:?}", i, input_param) + } + + println!("----- Output Parameters"); + for i in 0..shader_desc.OutputParameters { + let output_param = reflected.get_output_parameter_desc(i)?; + println!("output param {} {:?}", i, output_param) + } + + for i in 0..shader_desc.ConstantBuffers { + println!("----- Constant Buffer {i}"); + + let constant_buffer = reflected.get_constant_buffer_by_index(i); + let constant_buffer_desc = constant_buffer.get_desc()?; + println!("constant buffer name {:?}", constant_buffer_desc.Name); + println!("constant buffer desc {:?}", constant_buffer_desc); + + for i in 0..constant_buffer_desc.Variables { + let variable = constant_buffer.get_variable_by_index(i)?; + let variable_desc = variable.get_desc()?; + println!( + "var {}: {:?} +{} {:?}", + i, variable_desc.Name, variable_desc.StartOffset, variable_desc + ); + + let variable_type = variable.get_type(); + let variable_type_desc = variable_type.get_desc()?; + println!(" type: {:?}", variable_type_desc); + + for i in 0..variable_type_desc.Members { + let member_name = variable_type.get_member_type_name(i); + let member_desc = variable_type.get_member_type_by_index(i).get_desc(); + + println!(" member {} {:?} {:?}", i, member_name, member_desc); + } + } + } + } + Err((result, _hresult)) => { + println!("failed to compile shader"); + let error_blob = result.get_error_buffer()?; + let error_string = library.get_blob_as_string(&error_blob.into())?; + println!("{}", error_string); + } + } + + Ok(()) +} diff --git a/src/ffi.rs b/src/ffi.rs index 345ddf2..029920a 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -5,6 +5,309 @@ use crate::os::{HRESULT, LPCWSTR, LPWSTR}; use com::{interfaces, interfaces::IUnknown, IID}; use std::ffi::c_void; +pub use crate::ffi_enums::*; + +pub fn shader_version_program_type(version: u32) -> D3D12_SHADER_VERSION_TYPE { + // see https://learn.microsoft.com/en-us/windows/win32/api/d3d12shader/ns-d3d12shader-d3d12_shader_desc + D3D12_SHADER_VERSION_TYPE(((version & 0xFFFF0000u32) >> 16) as i32) +} + +pub fn shader_version_major_version(version: u32) -> u32 { + // see https://learn.microsoft.com/en-us/windows/win32/api/d3d12shader/ns-d3d12shader-d3d12_shader_desc + (version & 0x000000F0) >> 4 +} + +pub fn shader_version_minor_version(version: u32) -> u32 { + // see https://learn.microsoft.com/en-us/windows/win32/api/d3d12shader/ns-d3d12shader-d3d12_shader_desc + version & 0x0000000F +} + +#[rustfmt::skip] +#[allow(non_camel_case_types, non_snake_case)] +#[repr(C)] +pub struct D3D12_SIGNATURE_PARAMETER_DESC +{ + pub SemanticName: *mut std::ffi::c_char, // Name of the semantic + pub SemanticIndex: u32, // Index of the semantic + pub Register: u32, // Number of member variables + pub SystemValueType: D3D_NAME, // A predefined system value, or D3D_NAME_UNDEFINED if not applicable + pub ComponentType: D3D_REGISTER_COMPONENT_TYPE, // Scalar type (e.g. uint, float, etc.) + pub Mask: u8, // Mask to indicate which components of the register + // are used (combination of D3D10_COMPONENT_MASK values) + pub ReadWriteMask: u8, // Mask to indicate whether a given component is + // never written (if this is an output signature) or + // always read (if this is an input signature). + // (combination of D3D_MASK_* values) + pub Stream: u32, // Stream index + pub MinPrecision: D3D_MIN_PRECISION, // Minimum desired interpolation precision +} + +#[rustfmt::skip] +#[allow(non_camel_case_types, non_snake_case)] +#[repr(C)] +pub struct D3D12_SHADER_BUFFER_DESC +{ + pub Name: *mut std::ffi::c_char, // Name of the constant buffer + pub Type: D3D_CBUFFER_TYPE, // Indicates type of buffer content + pub Variables: u32, // Number of member variables + pub Size: u32, // Size of CB (in bytes) + pub uFlags: u32, // Buffer description flags +} + +#[rustfmt::skip] +#[allow(non_camel_case_types, non_snake_case)] +#[repr(C)] +pub struct D3D12_SHADER_VARIABLE_DESC +{ + pub Name: *mut std::ffi::c_char, // Name of the variable + pub StartOffset: u32, // Offset in constant buffer's backing store + pub Size: u32, // Size of variable (in bytes) + pub uFlags: u32, // Variable flags + pub DefaultValue: *mut std::ffi::c_void, // Raw pointer to default value + pub StartTexture: u32, // First texture index (or -1 if no textures used) + pub TextureSize: u32, // Number of texture slots possibly used. + pub StartSampler: u32, // First sampler index (or -1 if no textures used) + pub SamplerSize: u32, // Number of sampler slots possibly used. +} + +#[rustfmt::skip] +#[allow(non_camel_case_types, non_snake_case)] +#[repr(C)] +pub struct D3D12_SHADER_TYPE_DESC +{ + pub Class: D3D_SHADER_VARIABLE_CLASS, // Variable class (e.g. object, matrix, etc.) + pub Type: D3D_SHADER_VARIABLE_TYPE, // Variable type (e.g. float, sampler, etc.) + pub Rows: u32, // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) + pub Columns: u32, // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) + pub Elements: u32, // Number of elements (0 if not an array) + pub Members: u32, // Number of members (0 if not a structure) + pub Offset: u32, // Offset from the start of structure (0 if not a structure member) + pub Name: *mut std::ffi::c_char, // Name of type, can be NULL +} + +#[rustfmt::skip] +#[allow(non_camel_case_types, non_snake_case)] +#[repr(C)] +pub struct D3D12_SHADER_DESC +{ + pub Version: u32, // Shader version + pub Creator: *mut std::ffi::c_char, // Creator string + pub Flags: u32, // Shader compilation/parse flags + pub ConstantBuffers: u32, // Number of constant buffers + pub BoundResources: u32, // Number of bound resources + pub InputParameters: u32, // Number of parameters in the input signature + pub OutputParameters: u32, // Number of parameters in the output signature + pub InstructionCount: u32, // Number of emitted instructions + pub TempRegisterCount: u32, // Number of temporary registers used + pub TempArrayCount: u32, // Number of temporary arrays used + pub DefCount: u32, // Number of constant defines + pub DclCount: u32, // Number of declarations (input + output) + pub TextureNormalInstructions: u32, // Number of non-categorized texture instructions + pub TextureLoadInstructions: u32, // Number of texture load instructions + pub TextureCompInstructions: u32, // Number of texture comparison instructions + pub TextureBiasInstructions: u32, // Number of texture bias instructions + pub TextureGradientInstructions: u32, // Number of texture gradient instructions + pub FloatInstructionCount: u32, // Number of floating point arithmetic instructions used + pub IntInstructionCount: u32, // Number of signed integer arithmetic instructions used + pub UintInstructionCount: u32, // Number of unsigned integer arithmetic instructions used + pub StaticFlowControlCount: u32, // Number of static flow control instructions used + pub DynamicFlowControlCount: u32, // Number of dynamic flow control instructions used + pub MacroInstructionCount: u32, // Number of macro instructions used + pub ArrayInstructionCount: u32, // Number of array instructions used + pub CutInstructionCount: u32, // Number of cut instructions used + pub EmitInstructionCount: u32, // Number of emit instructions used + pub GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, // Geometry shader output topology + pub GSMaxOutputVertexCount: u32, // Geometry shader maximum output vertex count + pub InputPrimitive: D3D_PRIMITIVE_TOPOLOGY, // GS/HS input primitive + pub PatchConstantParameters: u32, // Number of parameters in the patch constant signature + pub cGSInstanceCount: u32, // Number of Geometry shader instances + pub cControlPoints: u32, // Number of control points in the HS->DS stage + pub HSOutputPrimitive: D3D_TESSELLATOR_OUTPUT_PRIMITIVE, // Primitive output by the tessellator + pub HSPartitioning: D3D_TESSELLATOR_PARTITIONING, // Partitioning mode of the tessellator + pub TessellatorDomain: D3D_TESSELLATOR_DOMAIN, // Domain of the tessellator (quad, tri, isoline) + pub cBarrierInstructions: u32, // Number of barrier instructions in a compute shader + pub cInterlockedInstructions: u32, // Number of interlocked instructions + pub cTextureStoreInstructions: u32, // Number of texture writes +} + +#[rustfmt::skip] +#[allow(non_camel_case_types, non_snake_case)] +#[repr(C)] +pub struct D3D12_SHADER_INPUT_BIND_DESC +{ + pub Name: *mut std::ffi::c_char, // Name of the resource + pub Type: D3D_SHADER_INPUT_TYPE, // Type of resource (e.g. texture, cbuffer, etc.) + pub BindPoint: u32, // Starting bind point + pub BindCount: u32, // Number of contiguous bind points (for arrays) + pub uFlags: u32, // Input binding flags + pub ReturnType: D3D_RESOURCE_RETURN_TYPE, // Return type (if texture) + pub Dimension: D3D_SRV_DIMENSION, // Dimension (if texture) + pub NumSamples: u32, // Number of samples (0 if not MS texture) + pub Space: u32, // Register space + pub uID: u32, // Range ID in the bytecode +} + +// +// The following structs are psuedo-com objects that have no QueryInterface, AddRef, or RemoveRef +// calls. So we have to manually specify them. They are not reference counted and are only valid +// as long as the underlying "owning" reflection object remains available. The safe wrappers hold +// onto both one of these structs and a ref-counted pointer to the owning COM object. +// +#[rustfmt::skip] +#[allow(non_snake_case)] +#[repr(C)] +pub(crate) struct ID3D12ShaderReflectionTypeVTable { + pub GetDesc: unsafe extern "system" fn(::core::ptr::NonNull, *mut D3D12_SHADER_TYPE_DESC) -> HRESULT, + pub GetMemberTypeByIndex: unsafe extern "system" fn(::core::ptr::NonNull, index: u32) -> ID3D12ShaderReflectionType, + pub GetMemberTypeByName: unsafe extern "system" fn(::core::ptr::NonNull, name: *const std::ffi::c_char) -> ID3D12ShaderReflectionType, + pub GetMemberTypeName: unsafe extern "system" fn(::core::ptr::NonNull, index: u32) -> *const std::ffi::c_char, + pub IsEqual: unsafe extern "system" fn(::core::ptr::NonNull, ty: ID3D12ShaderReflectionType) -> HRESULT, + pub GetSubType: unsafe extern "system" fn(::core::ptr::NonNull) -> ID3D12ShaderReflectionType, + pub GetBaseClass: unsafe extern "system" fn(::core::ptr::NonNull) -> ID3D12ShaderReflectionType, + pub GetNumInterfaces: unsafe extern "system" fn(::core::ptr::NonNull) -> u32, + pub GetInterfaceByIndex: unsafe extern "system" fn(::core::ptr::NonNull, index: u32) -> ID3D12ShaderReflectionType, + pub IsOfType: unsafe extern "system" fn(::core::ptr::NonNull, other: ID3D12ShaderReflectionType) -> HRESULT, + pub ImplementsInterface: unsafe extern "system" fn(::core::ptr::NonNull, other: ID3D12ShaderReflectionType) -> HRESULT, +} + +pub(crate) type ID3D12ShaderReflectionTypeVPtr = + ::core::ptr::NonNull; + +#[repr(transparent)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) struct ID3D12ShaderReflectionType { + inner: ::core::ptr::NonNull, +} + +impl ID3D12ShaderReflectionType { + pub(crate) unsafe fn get_desc(&self, desc: impl Into<*mut D3D12_SHADER_TYPE_DESC>) -> HRESULT { + (self.inner.as_ref().as_ref().GetDesc)(self.inner, desc.into()) + } + + pub(crate) unsafe fn get_member_type_by_index(&self, index: u32) -> ID3D12ShaderReflectionType { + (self.inner.as_ref().as_ref().GetMemberTypeByIndex)(self.inner, index) + } + + pub(crate) unsafe fn get_member_type_by_name( + &self, + name: *const std::ffi::c_char, + ) -> ID3D12ShaderReflectionType { + (self.inner.as_ref().as_ref().GetMemberTypeByName)(self.inner, name) + } + + pub(crate) unsafe fn get_member_type_name(&self, index: u32) -> *const std::ffi::c_char { + (self.inner.as_ref().as_ref().GetMemberTypeName)(self.inner, index) + } + + pub(crate) unsafe fn is_equal(&self, ty: ID3D12ShaderReflectionType) -> HRESULT { + (self.inner.as_ref().as_ref().IsEqual)(self.inner, ty) + } + + pub(crate) unsafe fn get_sub_type(&self) -> ID3D12ShaderReflectionType { + (self.inner.as_ref().as_ref().GetSubType)(self.inner) + } + + pub(crate) unsafe fn get_base_class(&self) -> ID3D12ShaderReflectionType { + (self.inner.as_ref().as_ref().GetBaseClass)(self.inner) + } + + pub(crate) unsafe fn get_num_interfaces(&self) -> u32 { + (self.inner.as_ref().as_ref().GetNumInterfaces)(self.inner) + } + + pub(crate) unsafe fn get_interface_by_index(&self, index: u32) -> ID3D12ShaderReflectionType { + (self.inner.as_ref().as_ref().GetInterfaceByIndex)(self.inner, index) + } + + pub(crate) unsafe fn is_of_type(&self, ty: ID3D12ShaderReflectionType) -> HRESULT { + (self.inner.as_ref().as_ref().IsOfType)(self.inner, ty) + } + + pub(crate) unsafe fn implements_interface(&self, ty: ID3D12ShaderReflectionType) -> HRESULT { + (self.inner.as_ref().as_ref().ImplementsInterface)(self.inner, ty) + } +} + +#[rustfmt::skip] +#[allow(non_snake_case)] +#[repr(C)] +pub(crate) struct ID3D12ShaderReflectionVariableVTable { + pub GetDesc: unsafe extern "system" fn(::core::ptr::NonNull, *mut D3D12_SHADER_VARIABLE_DESC) -> HRESULT, + pub GetType: unsafe extern "system" fn(::core::ptr::NonNull ) -> ID3D12ShaderReflectionType, + pub GetBuffer: unsafe extern "system" fn(::core::ptr::NonNull) -> ID3D12ShaderReflectionConstantBuffer, + pub GetInterfaceSlot: unsafe extern "system" fn(::core::ptr::NonNull, u32) -> u32, +} + +pub(crate) type ID3D12ShaderReflectionVariableVPtr = + ::core::ptr::NonNull; + +#[repr(transparent)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) struct ID3D12ShaderReflectionVariable { + inner: ::core::ptr::NonNull, +} +impl ID3D12ShaderReflectionVariable { + pub(crate) unsafe fn get_desc( + &self, + p_desc: impl Into<*mut D3D12_SHADER_VARIABLE_DESC>, + ) -> HRESULT { + (self.inner.as_ref().as_ref().GetDesc)(self.inner, p_desc.into()) + } + + pub(crate) unsafe fn get_type(&self) -> ID3D12ShaderReflectionType { + (self.inner.as_ref().as_ref().GetType)(self.inner) + } + + pub(crate) unsafe fn get_buffer(&self) -> ID3D12ShaderReflectionConstantBuffer { + (self.inner.as_ref().as_ref().GetBuffer)(self.inner) + } + + pub(crate) unsafe fn get_interface_slot(&self, array_index: u32) -> u32 { + (self.inner.as_ref().as_ref().GetInterfaceSlot)(self.inner, array_index) + } +} + +#[rustfmt::skip] +#[allow(non_snake_case)] +#[repr(C)] +pub(crate) struct ID3D12ShaderReflectionConstantBufferVTable { + pub GetDesc: unsafe extern "system" fn(::core::ptr::NonNull, *mut D3D12_SHADER_BUFFER_DESC) -> HRESULT, + pub GetVariableByIndex: unsafe extern "system" fn(::core::ptr::NonNull, u32) -> ID3D12ShaderReflectionVariable, + pub GetVariableByName: unsafe extern "system" fn(::core::ptr::NonNull, *const std::ffi::c_char) -> ID3D12ShaderReflectionVariable, +} + +pub(crate) type ID3D12ShaderReflectionConstantBufferVPtr = + ::core::ptr::NonNull; + +#[repr(transparent)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) struct ID3D12ShaderReflectionConstantBuffer { + inner: ::core::ptr::NonNull, +} + +impl ID3D12ShaderReflectionConstantBuffer { + pub(crate) unsafe fn get_desc( + &self, + p_desc: impl Into<*mut D3D12_SHADER_BUFFER_DESC>, + ) -> HRESULT { + (self.inner.as_ref().as_ref().GetDesc)(self.inner, p_desc.into()) + } + + pub(crate) unsafe fn get_variable_by_index( + &self, + index: u32, + ) -> ID3D12ShaderReflectionVariable { + (self.inner.as_ref().as_ref().GetVariableByIndex)(self.inner, index) + } + + pub(crate) unsafe fn get_variable_by_name( + &self, + name: impl Into<*const std::ffi::c_char>, + ) -> ID3D12ShaderReflectionVariable { + (self.inner.as_ref().as_ref().GetVariableByName)(self.inner, name.into()) + } +} + pub type DxcCreateInstanceProc = extern "system" fn(rclsid: &IID, riid: &IID, ppv: *mut Option) -> HRESULT; @@ -183,6 +486,7 @@ interfaces! { } } +// From dxcapi.h for use with IDxcValidator pub const DXC_VALIDATOR_FLAGS_DEFAULT: u32 = 0; pub const DXC_VALIDATOR_FLAGS_IN_PLACE_EDIT: u32 = 1; // Validator is allowed to update shader blob in-place. pub const DXC_VALIDATOR_FLAGS_ROOT_SIGNATURE_ONLY: u32 = 2; @@ -235,45 +539,50 @@ interfaces! { ) -> HRESULT; } + //NOTE: Unlike the other interfaces which are coming from dxcapi.h, this comes from + // d3d12shader.h. Some of the returned values are COM-like objects that have a vtable similar + // to COM with QueryInterface, AddRef and RemoveRef, but don't have IUnknown as a base. The + // COM helper library doesn't deal well with this, so we have to manually implement interfaces + // for those types. #[uuid("5a58797d-a72c-478d-8ba2-efc6b0efe88e")] pub(crate) unsafe interface ID3D12ShaderReflection: IUnknown { - pub(crate) fn get_desc(&self, p_desc: *mut c_void) -> HRESULT; - pub(crate) fn get_constant_buffer_by_index(&self, index: u32) -> *mut c_void; - pub(crate) fn get_constant_buffer_by_name(&self, name: *const c_void) -> *mut c_void; + pub(crate) fn get_desc(&self, p_desc: *mut D3D12_SHADER_DESC) -> HRESULT; + pub(crate) fn get_constant_buffer_by_index(&self, index: u32) -> ID3D12ShaderReflectionConstantBuffer; + pub(crate) fn get_constant_buffer_by_name(&self, name: *const std::ffi::c_char) -> ID3D12ShaderReflectionConstantBuffer; pub(crate) fn get_resource_binding_desc( &self, resource_index: u32, - p_desc: *mut c_void, + p_desc: *mut D3D12_SHADER_INPUT_BIND_DESC, ) -> HRESULT; pub(crate) fn get_input_parameter_desc( &self, parameter_index: u32, - p_desc: *mut c_void, + p_desc: *mut D3D12_SIGNATURE_PARAMETER_DESC, ) -> HRESULT; pub(crate) fn get_output_parameter_desc( &self, parameter_index: u32, - p_desc: *mut c_void, + p_desc: *mut D3D12_SIGNATURE_PARAMETER_DESC, ) -> HRESULT; pub(crate) fn get_patch_constant_parameter_desc( &self, parameter_index: u32, - p_desc: *mut c_void, + p_desc: *mut D3D12_SIGNATURE_PARAMETER_DESC, ) -> HRESULT; - pub(crate) fn get_variable_by_name(&self, name: *const c_void) -> *mut c_void; + pub(crate) fn get_variable_by_name(&self, name: *const std::ffi::c_char) -> ID3D12ShaderReflectionVariable; pub(crate) fn get_resource_binding_desc_by_name( &self, - name: *const c_void, - p_desc: *mut c_void, + name: *const std::ffi::c_char, + p_desc: *mut D3D12_SIGNATURE_PARAMETER_DESC, ) -> HRESULT; pub(crate) fn get_mov_instruction_count(&self) -> u32; pub(crate) fn get_movc_instruction_count(&self) -> u32; pub(crate) fn get_conversion_instruction_count(&self) -> u32; pub(crate) fn get_bitwise_instruction_count(&self) -> u32; - pub(crate) fn get_gs_input_primitive(&self) -> u32; + pub(crate) fn get_gs_input_primitive(&self) -> D3D_PRIMITIVE; pub(crate) fn is_sample_frequency_shader(&self) -> bool; pub(crate) fn get_num_interface_slots(&self) -> u32; - pub(crate) fn get_min_feature_level(&self, p_level: *mut c_void) -> HRESULT; + pub(crate) fn get_min_feature_level(&self, p_level: *mut D3D_FEATURE_LEVEL) -> HRESULT; pub(crate) fn get_thread_group_size( &self, size_x: *mut u32, @@ -315,6 +624,7 @@ interfaces! { } } +// From dxcapi.h for use with IDxcVersionInfo pub const DXC_VERSION_INFO_FLAGS_NONE: u32 = 0; pub const DXC_VERSION_INFO_FLAGS_DEBUG: u32 = 1; // Matches VS_FF_DEBUG pub const DXC_VERSION_INFO_FLAGS_INTERNAL: u32 = 2; // Internal Validator (non-signing) diff --git a/src/ffi_enums.rs b/src/ffi_enums.rs new file mode 100644 index 0000000..5c1dcba --- /dev/null +++ b/src/ffi_enums.rs @@ -0,0 +1,620 @@ +// NOTE: These enums are a subset of enums defined in the windows crate with a human cleanup pass, +// since the source material is machine-generated. Optionally, we could use the windows crate +// directly and re-export them. However, don't want to add unnecessary dependencies. + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_CBUFFER_TYPE(pub i32); +pub const D3D_CT_CBUFFER: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(0i32); +pub const D3D_CT_TBUFFER: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(1i32); +pub const D3D_CT_INTERFACE_POINTERS: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(2i32); +pub const D3D_CT_RESOURCE_BIND_INFO: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(3i32); +pub const D3D10_CT_CBUFFER: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(0i32); +pub const D3D10_CT_TBUFFER: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(1i32); +pub const D3D11_CT_CBUFFER: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(0i32); +pub const D3D11_CT_TBUFFER: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(1i32); +pub const D3D11_CT_INTERFACE_POINTERS: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(2i32); +pub const D3D11_CT_RESOURCE_BIND_INFO: D3D_CBUFFER_TYPE = D3D_CBUFFER_TYPE(3i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_MIN_PRECISION(pub i32); +pub const D3D_MIN_PRECISION_DEFAULT: D3D_MIN_PRECISION = D3D_MIN_PRECISION(0i32); +pub const D3D_MIN_PRECISION_FLOAT_16: D3D_MIN_PRECISION = D3D_MIN_PRECISION(1i32); +pub const D3D_MIN_PRECISION_FLOAT_2_8: D3D_MIN_PRECISION = D3D_MIN_PRECISION(2i32); +pub const D3D_MIN_PRECISION_RESERVED: D3D_MIN_PRECISION = D3D_MIN_PRECISION(3i32); +pub const D3D_MIN_PRECISION_SINT_16: D3D_MIN_PRECISION = D3D_MIN_PRECISION(4i32); +pub const D3D_MIN_PRECISION_UINT_16: D3D_MIN_PRECISION = D3D_MIN_PRECISION(5i32); +pub const D3D_MIN_PRECISION_ANY_16: D3D_MIN_PRECISION = D3D_MIN_PRECISION(240i32); +pub const D3D_MIN_PRECISION_ANY_10: D3D_MIN_PRECISION = D3D_MIN_PRECISION(241i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_REGISTER_COMPONENT_TYPE(pub i32); +pub const D3D_REGISTER_COMPONENT_UNKNOWN: D3D_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE(0i32); +pub const D3D_REGISTER_COMPONENT_UINT32: D3D_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE(1i32); +pub const D3D_REGISTER_COMPONENT_SINT32: D3D_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE(2i32); +pub const D3D_REGISTER_COMPONENT_FLOAT32: D3D_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE(3i32); +pub const D3D10_REGISTER_COMPONENT_UNKNOWN: D3D_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE(0i32); +pub const D3D10_REGISTER_COMPONENT_UINT32: D3D_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE(1i32); +pub const D3D10_REGISTER_COMPONENT_SINT32: D3D_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE(2i32); +pub const D3D10_REGISTER_COMPONENT_FLOAT32: D3D_REGISTER_COMPONENT_TYPE = D3D_REGISTER_COMPONENT_TYPE(3i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_FEATURE_LEVEL(pub i32); +pub const D3D_FEATURE_LEVEL_1_0_CORE: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(4096i32); +pub const D3D_FEATURE_LEVEL_9_1: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(37120i32); +pub const D3D_FEATURE_LEVEL_9_2: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(37376i32); +pub const D3D_FEATURE_LEVEL_9_3: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(37632i32); +pub const D3D_FEATURE_LEVEL_10_0: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(40960i32); +pub const D3D_FEATURE_LEVEL_10_1: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(41216i32); +pub const D3D_FEATURE_LEVEL_11_0: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(45056i32); +pub const D3D_FEATURE_LEVEL_11_1: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(45312i32); +pub const D3D_FEATURE_LEVEL_12_0: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(49152i32); +pub const D3D_FEATURE_LEVEL_12_1: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(49408i32); +pub const D3D_FEATURE_LEVEL_12_2: D3D_FEATURE_LEVEL = D3D_FEATURE_LEVEL(49664i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_NAME(pub i32); +pub const D3D_NAME_UNDEFINED: D3D_NAME = D3D_NAME(0i32); +pub const D3D_NAME_POSITION: D3D_NAME = D3D_NAME(1i32); +pub const D3D_NAME_CLIP_DISTANCE: D3D_NAME = D3D_NAME(2i32); +pub const D3D_NAME_CULL_DISTANCE: D3D_NAME = D3D_NAME(3i32); +pub const D3D_NAME_RENDER_TARGET_ARRAY_INDEX: D3D_NAME = D3D_NAME(4i32); +pub const D3D_NAME_VIEWPORT_ARRAY_INDEX: D3D_NAME = D3D_NAME(5i32); +pub const D3D_NAME_VERTEX_ID: D3D_NAME = D3D_NAME(6i32); +pub const D3D_NAME_PRIMITIVE_ID: D3D_NAME = D3D_NAME(7i32); +pub const D3D_NAME_INSTANCE_ID: D3D_NAME = D3D_NAME(8i32); +pub const D3D_NAME_IS_FRONT_FACE: D3D_NAME = D3D_NAME(9i32); +pub const D3D_NAME_SAMPLE_INDEX: D3D_NAME = D3D_NAME(10i32); +pub const D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME(11i32); +pub const D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME(12i32); +pub const D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME(13i32); +pub const D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME(14i32); +pub const D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR: D3D_NAME = D3D_NAME(15i32); +pub const D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR: D3D_NAME = D3D_NAME(16i32); +pub const D3D_NAME_BARYCENTRICS: D3D_NAME = D3D_NAME(23i32); +pub const D3D_NAME_SHADINGRATE: D3D_NAME = D3D_NAME(24i32); +pub const D3D_NAME_CULLPRIMITIVE: D3D_NAME = D3D_NAME(25i32); +pub const D3D_NAME_TARGET: D3D_NAME = D3D_NAME(64i32); +pub const D3D_NAME_DEPTH: D3D_NAME = D3D_NAME(65i32); +pub const D3D_NAME_COVERAGE: D3D_NAME = D3D_NAME(66i32); +pub const D3D_NAME_DEPTH_GREATER_EQUAL: D3D_NAME = D3D_NAME(67i32); +pub const D3D_NAME_DEPTH_LESS_EQUAL: D3D_NAME = D3D_NAME(68i32); +pub const D3D_NAME_STENCIL_REF: D3D_NAME = D3D_NAME(69i32); +pub const D3D_NAME_INNER_COVERAGE: D3D_NAME = D3D_NAME(70i32); +pub const D3D10_NAME_UNDEFINED: D3D_NAME = D3D_NAME(0i32); +pub const D3D10_NAME_POSITION: D3D_NAME = D3D_NAME(1i32); +pub const D3D10_NAME_CLIP_DISTANCE: D3D_NAME = D3D_NAME(2i32); +pub const D3D10_NAME_CULL_DISTANCE: D3D_NAME = D3D_NAME(3i32); +pub const D3D10_NAME_RENDER_TARGET_ARRAY_INDEX: D3D_NAME = D3D_NAME(4i32); +pub const D3D10_NAME_VIEWPORT_ARRAY_INDEX: D3D_NAME = D3D_NAME(5i32); +pub const D3D10_NAME_VERTEX_ID: D3D_NAME = D3D_NAME(6i32); +pub const D3D10_NAME_PRIMITIVE_ID: D3D_NAME = D3D_NAME(7i32); +pub const D3D10_NAME_INSTANCE_ID: D3D_NAME = D3D_NAME(8i32); +pub const D3D10_NAME_IS_FRONT_FACE: D3D_NAME = D3D_NAME(9i32); +pub const D3D10_NAME_SAMPLE_INDEX: D3D_NAME = D3D_NAME(10i32); +pub const D3D10_NAME_TARGET: D3D_NAME = D3D_NAME(64i32); +pub const D3D10_NAME_DEPTH: D3D_NAME = D3D_NAME(65i32); +pub const D3D10_NAME_COVERAGE: D3D_NAME = D3D_NAME(66i32); +pub const D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME(11i32); +pub const D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME(12i32); +pub const D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR: D3D_NAME = D3D_NAME(13i32); +pub const D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR: D3D_NAME = D3D_NAME(14i32); +pub const D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR: D3D_NAME = D3D_NAME(15i32); +pub const D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR: D3D_NAME = D3D_NAME(16i32); +pub const D3D11_NAME_DEPTH_GREATER_EQUAL: D3D_NAME = D3D_NAME(67i32); +pub const D3D11_NAME_DEPTH_LESS_EQUAL: D3D_NAME = D3D_NAME(68i32); +pub const D3D11_NAME_STENCIL_REF: D3D_NAME = D3D_NAME(69i32); +pub const D3D11_NAME_INNER_COVERAGE: D3D_NAME = D3D_NAME(70i32); +pub const D3D12_NAME_BARYCENTRICS: D3D_NAME = D3D_NAME(23i32); +pub const D3D12_NAME_SHADINGRATE: D3D_NAME = D3D_NAME(24i32); +pub const D3D12_NAME_CULLPRIMITIVE: D3D_NAME = D3D_NAME(25i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_SRV_DIMENSION(pub i32); +pub const D3D_SRV_DIMENSION_UNKNOWN: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(0i32); +pub const D3D_SRV_DIMENSION_BUFFER: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(1i32); +pub const D3D_SRV_DIMENSION_TEXTURE1D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(2i32); +pub const D3D_SRV_DIMENSION_TEXTURE1DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(3i32); +pub const D3D_SRV_DIMENSION_TEXTURE2D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(4i32); +pub const D3D_SRV_DIMENSION_TEXTURE2DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(5i32); +pub const D3D_SRV_DIMENSION_TEXTURE2DMS: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(6i32); +pub const D3D_SRV_DIMENSION_TEXTURE2DMSARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(7i32); +pub const D3D_SRV_DIMENSION_TEXTURE3D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(8i32); +pub const D3D_SRV_DIMENSION_TEXTURECUBE: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(9i32); +pub const D3D_SRV_DIMENSION_TEXTURECUBEARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(10i32); +pub const D3D_SRV_DIMENSION_BUFFEREX: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(11i32); +pub const D3D10_SRV_DIMENSION_UNKNOWN: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(0i32); +pub const D3D10_SRV_DIMENSION_BUFFER: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(1i32); +pub const D3D10_SRV_DIMENSION_TEXTURE1D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(2i32); +pub const D3D10_SRV_DIMENSION_TEXTURE1DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(3i32); +pub const D3D10_SRV_DIMENSION_TEXTURE2D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(4i32); +pub const D3D10_SRV_DIMENSION_TEXTURE2DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(5i32); +pub const D3D10_SRV_DIMENSION_TEXTURE2DMS: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(6i32); +pub const D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(7i32); +pub const D3D10_SRV_DIMENSION_TEXTURE3D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(8i32); +pub const D3D10_SRV_DIMENSION_TEXTURECUBE: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(9i32); +pub const D3D10_1_SRV_DIMENSION_UNKNOWN: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(0i32); +pub const D3D10_1_SRV_DIMENSION_BUFFER: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(1i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURE1D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(2i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(3i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURE2D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(4i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(5i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMS: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(6i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(7i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURE3D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(8i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURECUBE: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(9i32); +pub const D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(10i32); +pub const D3D11_SRV_DIMENSION_UNKNOWN: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(0i32); +pub const D3D11_SRV_DIMENSION_BUFFER: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(1i32); +pub const D3D11_SRV_DIMENSION_TEXTURE1D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(2i32); +pub const D3D11_SRV_DIMENSION_TEXTURE1DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(3i32); +pub const D3D11_SRV_DIMENSION_TEXTURE2D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(4i32); +pub const D3D11_SRV_DIMENSION_TEXTURE2DARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(5i32); +pub const D3D11_SRV_DIMENSION_TEXTURE2DMS: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(6i32); +pub const D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(7i32); +pub const D3D11_SRV_DIMENSION_TEXTURE3D: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(8i32); +pub const D3D11_SRV_DIMENSION_TEXTURECUBE: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(9i32); +pub const D3D11_SRV_DIMENSION_TEXTURECUBEARRAY: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(10i32); +pub const D3D11_SRV_DIMENSION_BUFFEREX: D3D_SRV_DIMENSION = D3D_SRV_DIMENSION(11i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_RESOURCE_RETURN_TYPE(pub i32); +pub const D3D_RETURN_TYPE_UNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(1i32); +pub const D3D_RETURN_TYPE_SNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(2i32); +pub const D3D_RETURN_TYPE_SINT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(3i32); +pub const D3D_RETURN_TYPE_UINT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(4i32); +pub const D3D_RETURN_TYPE_FLOAT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(5i32); +pub const D3D_RETURN_TYPE_MIXED: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(6i32); +pub const D3D_RETURN_TYPE_DOUBLE: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(7i32); +pub const D3D_RETURN_TYPE_CONTINUED: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(8i32); +pub const D3D10_RETURN_TYPE_UNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(1i32); +pub const D3D10_RETURN_TYPE_SNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(2i32); +pub const D3D10_RETURN_TYPE_SINT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(3i32); +pub const D3D10_RETURN_TYPE_UINT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(4i32); +pub const D3D10_RETURN_TYPE_FLOAT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(5i32); +pub const D3D10_RETURN_TYPE_MIXED: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(6i32); +pub const D3D11_RETURN_TYPE_UNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(1i32); +pub const D3D11_RETURN_TYPE_SNORM: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(2i32); +pub const D3D11_RETURN_TYPE_SINT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(3i32); +pub const D3D11_RETURN_TYPE_UINT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(4i32); +pub const D3D11_RETURN_TYPE_FLOAT: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(5i32); +pub const D3D11_RETURN_TYPE_MIXED: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(6i32); +pub const D3D11_RETURN_TYPE_DOUBLE: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(7i32); +pub const D3D11_RETURN_TYPE_CONTINUED: D3D_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE(8i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_SHADER_INPUT_TYPE(pub i32); +pub const D3D_SIT_CBUFFER: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(0i32); +pub const D3D_SIT_TBUFFER: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(1i32); +pub const D3D_SIT_TEXTURE: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(2i32); +pub const D3D_SIT_SAMPLER: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(3i32); +pub const D3D_SIT_UAV_RWTYPED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(4i32); +pub const D3D_SIT_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(5i32); +pub const D3D_SIT_UAV_RWSTRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(6i32); +pub const D3D_SIT_BYTEADDRESS: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(7i32); +pub const D3D_SIT_UAV_RWBYTEADDRESS: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(8i32); +pub const D3D_SIT_UAV_APPEND_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(9i32); +pub const D3D_SIT_UAV_CONSUME_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(10i32); +pub const D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(11i32); +pub const D3D_SIT_RTACCELERATIONSTRUCTURE: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(12i32); +pub const D3D_SIT_UAV_FEEDBACKTEXTURE: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(13i32); +pub const D3D10_SIT_CBUFFER: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(0i32); +pub const D3D10_SIT_TBUFFER: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(1i32); +pub const D3D10_SIT_TEXTURE: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(2i32); +pub const D3D10_SIT_SAMPLER: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(3i32); +pub const D3D11_SIT_UAV_RWTYPED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(4i32); +pub const D3D11_SIT_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(5i32); +pub const D3D11_SIT_UAV_RWSTRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(6i32); +pub const D3D11_SIT_BYTEADDRESS: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(7i32); +pub const D3D11_SIT_UAV_RWBYTEADDRESS: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(8i32); +pub const D3D11_SIT_UAV_APPEND_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(9i32); +pub const D3D11_SIT_UAV_CONSUME_STRUCTURED: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(10i32); +pub const D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER: D3D_SHADER_INPUT_TYPE = D3D_SHADER_INPUT_TYPE(11i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_PRIMITIVE(pub i32); +pub const D3D_PRIMITIVE_UNDEFINED: D3D_PRIMITIVE = D3D_PRIMITIVE(0i32); +pub const D3D_PRIMITIVE_POINT: D3D_PRIMITIVE = D3D_PRIMITIVE(1i32); +pub const D3D_PRIMITIVE_LINE: D3D_PRIMITIVE = D3D_PRIMITIVE(2i32); +pub const D3D_PRIMITIVE_TRIANGLE: D3D_PRIMITIVE = D3D_PRIMITIVE(3i32); +pub const D3D_PRIMITIVE_LINE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE(6i32); +pub const D3D_PRIMITIVE_TRIANGLE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE(7i32); +pub const D3D_PRIMITIVE_1_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(8i32); +pub const D3D_PRIMITIVE_2_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(9i32); +pub const D3D_PRIMITIVE_3_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(10i32); +pub const D3D_PRIMITIVE_4_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(11i32); +pub const D3D_PRIMITIVE_5_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(12i32); +pub const D3D_PRIMITIVE_6_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(13i32); +pub const D3D_PRIMITIVE_7_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(14i32); +pub const D3D_PRIMITIVE_8_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(15i32); +pub const D3D_PRIMITIVE_9_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(16i32); +pub const D3D_PRIMITIVE_10_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(17i32); +pub const D3D_PRIMITIVE_11_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(18i32); +pub const D3D_PRIMITIVE_12_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(19i32); +pub const D3D_PRIMITIVE_13_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(20i32); +pub const D3D_PRIMITIVE_14_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(21i32); +pub const D3D_PRIMITIVE_15_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(22i32); +pub const D3D_PRIMITIVE_16_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(23i32); +pub const D3D_PRIMITIVE_17_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(24i32); +pub const D3D_PRIMITIVE_18_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(25i32); +pub const D3D_PRIMITIVE_19_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(26i32); +pub const D3D_PRIMITIVE_20_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(27i32); +pub const D3D_PRIMITIVE_21_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(28i32); +pub const D3D_PRIMITIVE_22_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(29i32); +pub const D3D_PRIMITIVE_23_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(30i32); +pub const D3D_PRIMITIVE_24_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(31i32); +pub const D3D_PRIMITIVE_25_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(32i32); +pub const D3D_PRIMITIVE_26_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(33i32); +pub const D3D_PRIMITIVE_27_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(34i32); +pub const D3D_PRIMITIVE_28_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(35i32); +pub const D3D_PRIMITIVE_29_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(36i32); +pub const D3D_PRIMITIVE_30_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(37i32); +pub const D3D_PRIMITIVE_31_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(38i32); +pub const D3D_PRIMITIVE_32_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(39i32); +pub const D3D10_PRIMITIVE_UNDEFINED: D3D_PRIMITIVE = D3D_PRIMITIVE(0i32); +pub const D3D10_PRIMITIVE_POINT: D3D_PRIMITIVE = D3D_PRIMITIVE(1i32); +pub const D3D10_PRIMITIVE_LINE: D3D_PRIMITIVE = D3D_PRIMITIVE(2i32); +pub const D3D10_PRIMITIVE_TRIANGLE: D3D_PRIMITIVE = D3D_PRIMITIVE(3i32); +pub const D3D10_PRIMITIVE_LINE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE(6i32); +pub const D3D10_PRIMITIVE_TRIANGLE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE(7i32); +pub const D3D11_PRIMITIVE_UNDEFINED: D3D_PRIMITIVE = D3D_PRIMITIVE(0i32); +pub const D3D11_PRIMITIVE_POINT: D3D_PRIMITIVE = D3D_PRIMITIVE(1i32); +pub const D3D11_PRIMITIVE_LINE: D3D_PRIMITIVE = D3D_PRIMITIVE(2i32); +pub const D3D11_PRIMITIVE_TRIANGLE: D3D_PRIMITIVE = D3D_PRIMITIVE(3i32); +pub const D3D11_PRIMITIVE_LINE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE(6i32); +pub const D3D11_PRIMITIVE_TRIANGLE_ADJ: D3D_PRIMITIVE = D3D_PRIMITIVE(7i32); +pub const D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(8i32); +pub const D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(9i32); +pub const D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(10i32); +pub const D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(11i32); +pub const D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(12i32); +pub const D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(13i32); +pub const D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(14i32); +pub const D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(15i32); +pub const D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(16i32); +pub const D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(17i32); +pub const D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(18i32); +pub const D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(19i32); +pub const D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(20i32); +pub const D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(21i32); +pub const D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(22i32); +pub const D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(23i32); +pub const D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(24i32); +pub const D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(25i32); +pub const D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(26i32); +pub const D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(27i32); +pub const D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(28i32); +pub const D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(29i32); +pub const D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(30i32); +pub const D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(31i32); +pub const D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(32i32); +pub const D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(33i32); +pub const D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(34i32); +pub const D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(35i32); +pub const D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(36i32); +pub const D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(37i32); +pub const D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(38i32); +pub const D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH: D3D_PRIMITIVE = D3D_PRIMITIVE(39i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_PRIMITIVE_TOPOLOGY(pub i32); +pub const D3D_PRIMITIVE_TOPOLOGY_UNDEFINED: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(0i32); +pub const D3D_PRIMITIVE_TOPOLOGY_POINTLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(1i32); +pub const D3D_PRIMITIVE_TOPOLOGY_LINELIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(2i32); +pub const D3D_PRIMITIVE_TOPOLOGY_LINESTRIP: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(3i32); +pub const D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(4i32); +pub const D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(5i32); +pub const D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(10i32); +pub const D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(11i32); +pub const D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(12i32); +pub const D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(13i32); +pub const D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(33i32); +pub const D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(34i32); +pub const D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(35i32); +pub const D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(36i32); +pub const D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(37i32); +pub const D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(38i32); +pub const D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(39i32); +pub const D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(40i32); +pub const D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(41i32); +pub const D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(42i32); +pub const D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(43i32); +pub const D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(44i32); +pub const D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(45i32); +pub const D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(46i32); +pub const D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(47i32); +pub const D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(48i32); +pub const D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(49i32); +pub const D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(50i32); +pub const D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(51i32); +pub const D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(52i32); +pub const D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(53i32); +pub const D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(54i32); +pub const D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(55i32); +pub const D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(56i32); +pub const D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(57i32); +pub const D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(58i32); +pub const D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(59i32); +pub const D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(60i32); +pub const D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(61i32); +pub const D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(62i32); +pub const D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(63i32); +pub const D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(64i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(0i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_POINTLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(1i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(2i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(3i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(4i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(5i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(10i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(11i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(12i32); +pub const D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(13i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(0i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_POINTLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(1i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(2i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(3i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(4i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(5i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(10i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(11i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(12i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(13i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(33i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(34i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(35i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(36i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(37i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(38i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(39i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(40i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(41i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(42i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(43i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(44i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(45i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(46i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(47i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(48i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(49i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(50i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(51i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(52i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(53i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(54i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(55i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(56i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(57i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(58i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(59i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(60i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(61i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(62i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(63i32); +pub const D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST: D3D_PRIMITIVE_TOPOLOGY = D3D_PRIMITIVE_TOPOLOGY(64i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_TESSELLATOR_DOMAIN(pub i32); +pub const D3D_TESSELLATOR_DOMAIN_UNDEFINED: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN(0i32); +pub const D3D_TESSELLATOR_DOMAIN_ISOLINE: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN(1i32); +pub const D3D_TESSELLATOR_DOMAIN_TRI: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN(2i32); +pub const D3D_TESSELLATOR_DOMAIN_QUAD: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN(3i32); +pub const D3D11_TESSELLATOR_DOMAIN_UNDEFINED: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN(0i32); +pub const D3D11_TESSELLATOR_DOMAIN_ISOLINE: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN(1i32); +pub const D3D11_TESSELLATOR_DOMAIN_TRI: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN(2i32); +pub const D3D11_TESSELLATOR_DOMAIN_QUAD: D3D_TESSELLATOR_DOMAIN = D3D_TESSELLATOR_DOMAIN(3i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_TESSELLATOR_OUTPUT_PRIMITIVE(pub i32); +pub const D3D_TESSELLATOR_OUTPUT_UNDEFINED: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(0i32); +pub const D3D_TESSELLATOR_OUTPUT_POINT: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(1i32); +pub const D3D_TESSELLATOR_OUTPUT_LINE: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(2i32); +pub const D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(3i32); +pub const D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(4i32); +pub const D3D11_TESSELLATOR_OUTPUT_UNDEFINED: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(0i32); +pub const D3D11_TESSELLATOR_OUTPUT_POINT: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(1i32); +pub const D3D11_TESSELLATOR_OUTPUT_LINE: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(2i32); +pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(3i32); +pub const D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW: D3D_TESSELLATOR_OUTPUT_PRIMITIVE = D3D_TESSELLATOR_OUTPUT_PRIMITIVE(4i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_TESSELLATOR_PARTITIONING(pub i32); +pub const D3D_TESSELLATOR_PARTITIONING_UNDEFINED: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(0i32); +pub const D3D_TESSELLATOR_PARTITIONING_INTEGER: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(1i32); +pub const D3D_TESSELLATOR_PARTITIONING_POW2: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(2i32); +pub const D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(3i32); +pub const D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(4i32); +pub const D3D11_TESSELLATOR_PARTITIONING_UNDEFINED: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(0i32); +pub const D3D11_TESSELLATOR_PARTITIONING_INTEGER: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(1i32); +pub const D3D11_TESSELLATOR_PARTITIONING_POW2: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(2i32); +pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(3i32); +pub const D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN: D3D_TESSELLATOR_PARTITIONING = D3D_TESSELLATOR_PARTITIONING(4i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_SHADER_VARIABLE_TYPE(pub i32); +pub const D3D_SVT_VOID: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(0i32); +pub const D3D_SVT_BOOL: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(1i32); +pub const D3D_SVT_INT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(2i32); +pub const D3D_SVT_FLOAT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(3i32); +pub const D3D_SVT_STRING: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(4i32); +pub const D3D_SVT_TEXTURE: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(5i32); +pub const D3D_SVT_TEXTURE1D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(6i32); +pub const D3D_SVT_TEXTURE2D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(7i32); +pub const D3D_SVT_TEXTURE3D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(8i32); +pub const D3D_SVT_TEXTURECUBE: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(9i32); +pub const D3D_SVT_SAMPLER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(10i32); +pub const D3D_SVT_SAMPLER1D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(11i32); +pub const D3D_SVT_SAMPLER2D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(12i32); +pub const D3D_SVT_SAMPLER3D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(13i32); +pub const D3D_SVT_SAMPLERCUBE: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(14i32); +pub const D3D_SVT_PIXELSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(15i32); +pub const D3D_SVT_VERTEXSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(16i32); +pub const D3D_SVT_PIXELFRAGMENT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(17i32); +pub const D3D_SVT_VERTEXFRAGMENT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(18i32); +pub const D3D_SVT_UINT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(19i32); +pub const D3D_SVT_UINT8: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(20i32); +pub const D3D_SVT_GEOMETRYSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(21i32); +pub const D3D_SVT_RASTERIZER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(22i32); +pub const D3D_SVT_DEPTHSTENCIL: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(23i32); +pub const D3D_SVT_BLEND: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(24i32); +pub const D3D_SVT_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(25i32); +pub const D3D_SVT_CBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(26i32); +pub const D3D_SVT_TBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(27i32); +pub const D3D_SVT_TEXTURE1DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(28i32); +pub const D3D_SVT_TEXTURE2DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(29i32); +pub const D3D_SVT_RENDERTARGETVIEW: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(30i32); +pub const D3D_SVT_DEPTHSTENCILVIEW: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(31i32); +pub const D3D_SVT_TEXTURE2DMS: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(32i32); +pub const D3D_SVT_TEXTURE2DMSARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(33i32); +pub const D3D_SVT_TEXTURECUBEARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(34i32); +pub const D3D_SVT_HULLSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(35i32); +pub const D3D_SVT_DOMAINSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(36i32); +pub const D3D_SVT_INTERFACE_POINTER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(37i32); +pub const D3D_SVT_COMPUTESHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(38i32); +pub const D3D_SVT_DOUBLE: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(39i32); +pub const D3D_SVT_RWTEXTURE1D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(40i32); +pub const D3D_SVT_RWTEXTURE1DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(41i32); +pub const D3D_SVT_RWTEXTURE2D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(42i32); +pub const D3D_SVT_RWTEXTURE2DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(43i32); +pub const D3D_SVT_RWTEXTURE3D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(44i32); +pub const D3D_SVT_RWBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(45i32); +pub const D3D_SVT_BYTEADDRESS_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(46i32); +pub const D3D_SVT_RWBYTEADDRESS_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(47i32); +pub const D3D_SVT_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(48i32); +pub const D3D_SVT_RWSTRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(49i32); +pub const D3D_SVT_APPEND_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(50i32); +pub const D3D_SVT_CONSUME_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(51i32); +pub const D3D_SVT_MIN8FLOAT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(52i32); +pub const D3D_SVT_MIN10FLOAT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(53i32); +pub const D3D_SVT_MIN16FLOAT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(54i32); +pub const D3D_SVT_MIN12INT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(55i32); +pub const D3D_SVT_MIN16INT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(56i32); +pub const D3D_SVT_MIN16UINT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(57i32); +pub const D3D_SVT_INT16: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(58i32); +pub const D3D_SVT_UINT16: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(59i32); +pub const D3D_SVT_FLOAT16: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(60i32); +pub const D3D_SVT_INT64: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(61i32); +pub const D3D_SVT_UINT64: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(62i32); +pub const D3D10_SVT_VOID: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(0i32); +pub const D3D10_SVT_BOOL: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(1i32); +pub const D3D10_SVT_INT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(2i32); +pub const D3D10_SVT_FLOAT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(3i32); +pub const D3D10_SVT_STRING: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(4i32); +pub const D3D10_SVT_TEXTURE: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(5i32); +pub const D3D10_SVT_TEXTURE1D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(6i32); +pub const D3D10_SVT_TEXTURE2D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(7i32); +pub const D3D10_SVT_TEXTURE3D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(8i32); +pub const D3D10_SVT_TEXTURECUBE: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(9i32); +pub const D3D10_SVT_SAMPLER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(10i32); +pub const D3D10_SVT_SAMPLER1D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(11i32); +pub const D3D10_SVT_SAMPLER2D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(12i32); +pub const D3D10_SVT_SAMPLER3D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(13i32); +pub const D3D10_SVT_SAMPLERCUBE: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(14i32); +pub const D3D10_SVT_PIXELSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(15i32); +pub const D3D10_SVT_VERTEXSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(16i32); +pub const D3D10_SVT_PIXELFRAGMENT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(17i32); +pub const D3D10_SVT_VERTEXFRAGMENT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(18i32); +pub const D3D10_SVT_UINT: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(19i32); +pub const D3D10_SVT_UINT8: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(20i32); +pub const D3D10_SVT_GEOMETRYSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(21i32); +pub const D3D10_SVT_RASTERIZER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(22i32); +pub const D3D10_SVT_DEPTHSTENCIL: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(23i32); +pub const D3D10_SVT_BLEND: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(24i32); +pub const D3D10_SVT_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(25i32); +pub const D3D10_SVT_CBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(26i32); +pub const D3D10_SVT_TBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(27i32); +pub const D3D10_SVT_TEXTURE1DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(28i32); +pub const D3D10_SVT_TEXTURE2DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(29i32); +pub const D3D10_SVT_RENDERTARGETVIEW: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(30i32); +pub const D3D10_SVT_DEPTHSTENCILVIEW: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(31i32); +pub const D3D10_SVT_TEXTURE2DMS: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(32i32); +pub const D3D10_SVT_TEXTURE2DMSARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(33i32); +pub const D3D10_SVT_TEXTURECUBEARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(34i32); +pub const D3D11_SVT_HULLSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(35i32); +pub const D3D11_SVT_DOMAINSHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(36i32); +pub const D3D11_SVT_INTERFACE_POINTER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(37i32); +pub const D3D11_SVT_COMPUTESHADER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(38i32); +pub const D3D11_SVT_DOUBLE: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(39i32); +pub const D3D11_SVT_RWTEXTURE1D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(40i32); +pub const D3D11_SVT_RWTEXTURE1DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(41i32); +pub const D3D11_SVT_RWTEXTURE2D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(42i32); +pub const D3D11_SVT_RWTEXTURE2DARRAY: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(43i32); +pub const D3D11_SVT_RWTEXTURE3D: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(44i32); +pub const D3D11_SVT_RWBUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(45i32); +pub const D3D11_SVT_BYTEADDRESS_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(46i32); +pub const D3D11_SVT_RWBYTEADDRESS_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(47i32); +pub const D3D11_SVT_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(48i32); +pub const D3D11_SVT_RWSTRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(49i32); +pub const D3D11_SVT_APPEND_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(50i32); +pub const D3D11_SVT_CONSUME_STRUCTURED_BUFFER: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(51i32); +pub const D3D_SVT_FORCE_DWORD: D3D_SHADER_VARIABLE_TYPE = D3D_SHADER_VARIABLE_TYPE(2147483647i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D_SHADER_VARIABLE_CLASS(pub i32); +pub const D3D_SVC_SCALAR: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(0i32); +pub const D3D_SVC_VECTOR: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(1i32); +pub const D3D_SVC_MATRIX_ROWS: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(2i32); +pub const D3D_SVC_MATRIX_COLUMNS: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(3i32); +pub const D3D_SVC_OBJECT: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(4i32); +pub const D3D_SVC_STRUCT: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(5i32); +pub const D3D_SVC_INTERFACE_CLASS: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(6i32); +pub const D3D_SVC_INTERFACE_POINTER: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(7i32); +pub const D3D10_SVC_SCALAR: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(0i32); +pub const D3D10_SVC_VECTOR: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(1i32); +pub const D3D10_SVC_MATRIX_ROWS: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(2i32); +pub const D3D10_SVC_MATRIX_COLUMNS: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(3i32); +pub const D3D10_SVC_OBJECT: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(4i32); +pub const D3D10_SVC_STRUCT: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(5i32); +pub const D3D11_SVC_INTERFACE_CLASS: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(6i32); +pub const D3D11_SVC_INTERFACE_POINTER: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(7i32); +pub const D3D_SVC_FORCE_DWORD: D3D_SHADER_VARIABLE_CLASS = D3D_SHADER_VARIABLE_CLASS(2147483647i32); + +#[allow(non_camel_case_types)] +#[repr(transparent)] +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub struct D3D12_SHADER_VERSION_TYPE(pub i32); +pub const D3D12_SHVER_PIXEL_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(0i32); +pub const D3D12_SHVER_VERTEX_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(1i32); +pub const D3D12_SHVER_GEOMETRY_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(2i32); +pub const D3D12_SHVER_HULL_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(3i32); +pub const D3D12_SHVER_DOMAIN_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(4i32); +pub const D3D12_SHVER_COMPUTE_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(5i32); +pub const D3D12_SHVER_LIBRARY: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(6i32); +pub const D3D12_SHVER_RAY_GENERATION_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(7i32); +pub const D3D12_SHVER_INTERSECTION_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(8i32); +pub const D3D12_SHVER_ANY_HIT_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(9i32); +pub const D3D12_SHVER_CLOSEST_HIT_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(10i32); +pub const D3D12_SHVER_MISS_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(11i32); +pub const D3D12_SHVER_CALLABLE_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(12i32); +pub const D3D12_SHVER_MESH_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(13i32); +pub const D3D12_SHVER_AMPLIFICATION_SHADER: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(14i32); +pub const D3D12_SHVER_RESERVED0: D3D12_SHADER_VERSION_TYPE = D3D12_SHADER_VERSION_TYPE(0xFFF0i32); diff --git a/src/lib.rs b/src/lib.rs index 713a845..92c7013 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,6 +40,8 @@ pub mod fake_sign; pub mod ffi; +#[rustfmt::skip] +mod ffi_enums; pub mod os; pub mod utils; pub mod wrapper; diff --git a/src/utils.rs b/src/utils.rs index b86caab..d5895c0 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -35,7 +35,8 @@ pub(crate) fn from_lpstr(string: LPCSTR) -> String { .to_owned() } -struct DefaultIncludeHandler {} +#[derive(Default)] +pub struct DefaultIncludeHandler; impl DxcIncludeHandler for DefaultIncludeHandler { fn load_source(&mut self, filename: String) -> Option { diff --git a/src/wrapper.rs b/src/wrapper.rs index 7ff8fee..0fe667d 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -10,6 +10,8 @@ use crate::utils::{from_wide, to_wide, HassleError, Result}; use com::{class, interfaces::IUnknown, production::Class, production::ClassAllocation, Interface}; use libloading::{Library, Symbol}; use std::cell::RefCell; +use std::ffi::{CStr, CString}; +use std::mem::MaybeUninit; use std::ops::Deref; use std::path::{Path, PathBuf}; use std::pin::Pin; @@ -609,6 +611,477 @@ impl DxcValidator { } } +unsafe fn ffi_char_ptr_to_cstring(s: *mut std::ffi::c_char) -> CString { + if s.is_null() { + // Empty string seems like a reasonable way to deal with a null pointer here + CString::default() + } else { + CString::from(CStr::from_ptr(s)) + } +} + +#[rustfmt::skip] +#[allow(non_camel_case_types, non_snake_case)] +#[derive(Clone, Debug)] +pub struct D3D12SignatureParameterDesc +{ + pub SemanticName: CString, // Name of the semantic + pub SemanticIndex: u32, // Index of the semantic + pub Register: u32, // Number of member variables + pub SystemValueType: D3D_NAME, // A predefined system value, or D3D_NAME_UNDEFINED if not applicable + pub ComponentType: D3D_REGISTER_COMPONENT_TYPE, // Scalar type (e.g. uint, float, etc.) + pub Mask: u8, // Mask to indicate which components of the register + // are used (combination of D3D10_COMPONENT_MASK values) + pub ReadWriteMask: u8, // Mask to indicate whether a given component is + // never written (if this is an output signature) or + // always read (if this is an input signature). + // (combination of D3D_MASK_* values) + pub Stream: u32, // Stream index + pub MinPrecision: D3D_MIN_PRECISION, // Minimum desired interpolation precision +} + +impl D3D12SignatureParameterDesc { + pub unsafe fn from_ffi(signature_parameter_desc_ffi: &D3D12_SIGNATURE_PARAMETER_DESC) -> Self { + D3D12SignatureParameterDesc { + SemanticName: ffi_char_ptr_to_cstring(signature_parameter_desc_ffi.SemanticName), + SemanticIndex: signature_parameter_desc_ffi.SemanticIndex, + Register: signature_parameter_desc_ffi.Register, + SystemValueType: signature_parameter_desc_ffi.SystemValueType, + ComponentType: signature_parameter_desc_ffi.ComponentType, + Mask: signature_parameter_desc_ffi.Mask, + ReadWriteMask: signature_parameter_desc_ffi.ReadWriteMask, + Stream: signature_parameter_desc_ffi.Stream, + MinPrecision: signature_parameter_desc_ffi.MinPrecision, + } + } +} + +#[rustfmt::skip] +#[allow(non_snake_case)] +#[derive(Clone, Debug)] +pub struct D3D12ShaderBufferDesc +{ + pub Name: CString, // Name of the constant buffer + pub Type: D3D_CBUFFER_TYPE, // Indicates type of buffer content + pub Variables: u32, // Number of member variables + pub Size: u32, // Size of CB (in bytes) + pub uFlags: u32, // Buffer description flags +} + +impl D3D12ShaderBufferDesc { + pub unsafe fn from_ffi(shader_buffer_desc_ffi: &D3D12_SHADER_BUFFER_DESC) -> Self { + D3D12ShaderBufferDesc { + Name: ffi_char_ptr_to_cstring(shader_buffer_desc_ffi.Name), + Type: shader_buffer_desc_ffi.Type, + Variables: shader_buffer_desc_ffi.Variables, + Size: shader_buffer_desc_ffi.Size, + uFlags: shader_buffer_desc_ffi.uFlags, + } + } +} + +#[rustfmt::skip] +#[allow(non_snake_case)] +#[derive(Clone, Debug)] +pub struct D3D12ShaderVariableDesc +{ + pub Name: CString, // Name of the variable + pub StartOffset: u32, // Offset in constant buffer's backing store + pub Size: u32, // Size of variable (in bytes) + pub uFlags: u32, // Variable flags + pub DefaultValue: *mut std::ffi::c_void, // Raw pointer to default value + pub StartTexture: u32, // First texture index (or -1 if no textures used) + pub TextureSize: u32, // Number of texture slots possibly used. + pub StartSampler: u32, // First sampler index (or -1 if no textures used) + pub SamplerSize: u32, // Number of sampler slots possibly used. +} + +impl D3D12ShaderVariableDesc { + pub unsafe fn from_ffi(shader_variable_desc_ffi: &D3D12_SHADER_VARIABLE_DESC) -> Self { + D3D12ShaderVariableDesc { + Name: ffi_char_ptr_to_cstring(shader_variable_desc_ffi.Name), + StartOffset: shader_variable_desc_ffi.StartOffset, + Size: shader_variable_desc_ffi.Size, + uFlags: shader_variable_desc_ffi.uFlags, + DefaultValue: shader_variable_desc_ffi.DefaultValue, + StartTexture: shader_variable_desc_ffi.StartTexture, + TextureSize: shader_variable_desc_ffi.TextureSize, + StartSampler: shader_variable_desc_ffi.StartSampler, + SamplerSize: shader_variable_desc_ffi.SamplerSize, + } + } +} + +#[rustfmt::skip] +#[allow(non_snake_case)] +#[derive(Clone, Debug)] +pub struct D3D12ShaderTypeDesc +{ + pub Class: D3D_SHADER_VARIABLE_CLASS, // Variable class (e.g. object, matrix, etc.) + pub Type: D3D_SHADER_VARIABLE_TYPE, // Variable type (e.g. float, sampler, etc.) + pub Rows: u32, // Number of rows (for matrices, 1 for other numeric, 0 if not applicable) + pub Columns: u32, // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable) + pub Elements: u32, // Number of elements (0 if not an array) + pub Members: u32, // Number of members (0 if not a structure) + pub Offset: u32, // Offset from the start of structure (0 if not a structure member) + pub Name: CString, // Name of type, can be NULL +} + +impl D3D12ShaderTypeDesc { + pub unsafe fn from_ffi(shader_type_desc_ffi: &D3D12_SHADER_TYPE_DESC) -> Self { + D3D12ShaderTypeDesc { + Class: shader_type_desc_ffi.Class, + Type: shader_type_desc_ffi.Type, + Rows: shader_type_desc_ffi.Rows, + Columns: shader_type_desc_ffi.Columns, + Elements: shader_type_desc_ffi.Elements, + Members: shader_type_desc_ffi.Members, + Offset: shader_type_desc_ffi.Offset, + Name: ffi_char_ptr_to_cstring(shader_type_desc_ffi.Name), + } + } +} + +#[rustfmt::skip] +#[allow(non_snake_case)] +#[derive(Clone, Debug)] +pub struct D3D12ShaderDesc +{ + pub Version: u32, // Shader version + pub Creator: CString, // Creator string + pub Flags: u32, // Shader compilation/parse flags + pub ConstantBuffers: u32, // Number of constant buffers + pub BoundResources: u32, // Number of bound resources + pub InputParameters: u32, // Number of parameters in the input signature + pub OutputParameters: u32, // Number of parameters in the output signature + pub InstructionCount: u32, // Number of emitted instructions + pub TempRegisterCount: u32, // Number of temporary registers used + pub TempArrayCount: u32, // Number of temporary arrays used + pub DefCount: u32, // Number of constant defines + pub DclCount: u32, // Number of declarations (input + output) + pub TextureNormalInstructions: u32, // Number of non-categorized texture instructions + pub TextureLoadInstructions: u32, // Number of texture load instructions + pub TextureCompInstructions: u32, // Number of texture comparison instructions + pub TextureBiasInstructions: u32, // Number of texture bias instructions + pub TextureGradientInstructions: u32, // Number of texture gradient instructions + pub FloatInstructionCount: u32, // Number of floating point arithmetic instructions used + pub IntInstructionCount: u32, // Number of signed integer arithmetic instructions used + pub UintInstructionCount: u32, // Number of unsigned integer arithmetic instructions used + pub StaticFlowControlCount: u32, // Number of static flow control instructions used + pub DynamicFlowControlCount: u32, // Number of dynamic flow control instructions used + pub MacroInstructionCount: u32, // Number of macro instructions used + pub ArrayInstructionCount: u32, // Number of array instructions used + pub CutInstructionCount: u32, // Number of cut instructions used + pub EmitInstructionCount: u32, // Number of emit instructions used + pub GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, // Geometry shader output topology + pub GSMaxOutputVertexCount: u32, // Geometry shader maximum output vertex count + pub InputPrimitive: D3D_PRIMITIVE_TOPOLOGY, // GS/HS input primitive + pub PatchConstantParameters: u32, // Number of parameters in the patch constant signature + pub cGSInstanceCount: u32, // Number of Geometry shader instances + pub cControlPoints: u32, // Number of control points in the HS->DS stage + pub HSOutputPrimitive: D3D_TESSELLATOR_OUTPUT_PRIMITIVE, // Primitive output by the tessellator + pub HSPartitioning: D3D_TESSELLATOR_PARTITIONING, // Partitioning mode of the tessellator + pub TessellatorDomain: D3D_TESSELLATOR_DOMAIN, // Domain of the tessellator (quad, tri, isoline) + pub cBarrierInstructions: u32, // Number of barrier instructions in a compute shader + pub cInterlockedInstructions: u32, // Number of interlocked instructions + pub cTextureStoreInstructions: u32, // Number of texture writes +} + +impl D3D12ShaderDesc { + pub unsafe fn from_ffi(shader_desc_ffi: &D3D12_SHADER_DESC) -> Self { + D3D12ShaderDesc { + Version: shader_desc_ffi.Version, + Creator: ffi_char_ptr_to_cstring(shader_desc_ffi.Creator), + Flags: shader_desc_ffi.Flags, + ConstantBuffers: shader_desc_ffi.ConstantBuffers, + BoundResources: shader_desc_ffi.BoundResources, + InputParameters: shader_desc_ffi.InputParameters, + OutputParameters: shader_desc_ffi.OutputParameters, + InstructionCount: shader_desc_ffi.InstructionCount, + TempRegisterCount: shader_desc_ffi.TempRegisterCount, + TempArrayCount: shader_desc_ffi.TempArrayCount, + DefCount: shader_desc_ffi.DefCount, + DclCount: shader_desc_ffi.DclCount, + TextureNormalInstructions: shader_desc_ffi.TextureNormalInstructions, + TextureLoadInstructions: shader_desc_ffi.TextureLoadInstructions, + TextureCompInstructions: shader_desc_ffi.TextureCompInstructions, + TextureBiasInstructions: shader_desc_ffi.TextureBiasInstructions, + TextureGradientInstructions: shader_desc_ffi.TextureGradientInstructions, + FloatInstructionCount: shader_desc_ffi.FloatInstructionCount, + IntInstructionCount: shader_desc_ffi.IntInstructionCount, + UintInstructionCount: shader_desc_ffi.UintInstructionCount, + StaticFlowControlCount: shader_desc_ffi.StaticFlowControlCount, + DynamicFlowControlCount: shader_desc_ffi.DynamicFlowControlCount, + MacroInstructionCount: shader_desc_ffi.MacroInstructionCount, + ArrayInstructionCount: shader_desc_ffi.ArrayInstructionCount, + CutInstructionCount: shader_desc_ffi.CutInstructionCount, + EmitInstructionCount: shader_desc_ffi.EmitInstructionCount, + GSOutputTopology: shader_desc_ffi.GSOutputTopology, + GSMaxOutputVertexCount: shader_desc_ffi.GSMaxOutputVertexCount, + InputPrimitive: shader_desc_ffi.InputPrimitive, + PatchConstantParameters: shader_desc_ffi.PatchConstantParameters, + cGSInstanceCount: shader_desc_ffi.cGSInstanceCount, + cControlPoints: shader_desc_ffi.cControlPoints, + HSOutputPrimitive: shader_desc_ffi.HSOutputPrimitive, + HSPartitioning: shader_desc_ffi.HSPartitioning, + TessellatorDomain: shader_desc_ffi.TessellatorDomain, + cBarrierInstructions: shader_desc_ffi.cBarrierInstructions, + cInterlockedInstructions: shader_desc_ffi.cInterlockedInstructions, + cTextureStoreInstructions: shader_desc_ffi.cTextureStoreInstructions, + } + } +} + +#[rustfmt::skip] +#[allow(non_camel_case_types, non_snake_case)] +#[repr(C)] +#[derive(Clone, Debug)] +pub struct D3D12ShaderInputBindDesc +{ + pub Name: CString, // Name of the resource + pub Type: D3D_SHADER_INPUT_TYPE, // Type of resource (e.g. texture, cbuffer, etc.) + pub BindPoint: u32, // Starting bind point + pub BindCount: u32, // Number of contiguous bind points (for arrays) + pub uFlags: u32, // Input binding flags + pub ReturnType: D3D_RESOURCE_RETURN_TYPE, // Return type (if texture) + pub Dimension: D3D_SRV_DIMENSION, // Dimension (if texture) + pub NumSamples: u32, // Number of samples (0 if not MS texture) + pub Space: u32, // Register space + pub uID: u32, // Range ID in the bytecode +} + +impl D3D12ShaderInputBindDesc { + pub unsafe fn from_ffi(shader_input_bind_desc_ffi: &D3D12_SHADER_INPUT_BIND_DESC) -> Self { + D3D12ShaderInputBindDesc { + Name: ffi_char_ptr_to_cstring(shader_input_bind_desc_ffi.Name), + Type: shader_input_bind_desc_ffi.Type, + BindPoint: shader_input_bind_desc_ffi.BindPoint, + BindCount: shader_input_bind_desc_ffi.BindCount, + uFlags: shader_input_bind_desc_ffi.uFlags, + ReturnType: shader_input_bind_desc_ffi.ReturnType, + Dimension: shader_input_bind_desc_ffi.Dimension, + NumSamples: shader_input_bind_desc_ffi.NumSamples, + Space: shader_input_bind_desc_ffi.Space, + uID: shader_input_bind_desc_ffi.uID, + } + } +} + +pub struct D3D12ShaderReflectionType { + inner: ID3D12ShaderReflectionType, + owner: ID3D12ShaderReflection, +} + +impl D3D12ShaderReflectionType { + pub fn get_desc(&self) -> Result { + unsafe { + let mut shader_type_desc_ffi: D3D12_SHADER_TYPE_DESC = + MaybeUninit::zeroed().assume_init(); + let result = self + .inner + .get_desc(&mut shader_type_desc_ffi as *mut D3D12_SHADER_TYPE_DESC); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12ShaderTypeDesc::from_ffi(&shader_type_desc_ffi)) + } + } + + pub fn get_member_type_by_index(&self, index: u32) -> D3D12ShaderReflectionType { + unsafe { + let ty = self.inner.get_member_type_by_index(index); + D3D12ShaderReflectionType { + inner: ty, + owner: self.owner.clone(), + } + } + } + + pub fn get_member_type_by_name<'a>( + &self, + name: impl Into<&'a CStr>, + ) -> D3D12ShaderReflectionType { + unsafe { + let ty = self.inner.get_member_type_by_name(name.into().as_ptr()); + D3D12ShaderReflectionType { + inner: ty, + owner: self.owner.clone(), + } + } + } + pub fn get_member_type_name(&self, index: u32) -> CString { + unsafe { + let type_name = self.inner.get_member_type_name(index); + CString::from(CStr::from_ptr(type_name)) + } + } + + pub fn is_equal(&self, other: &D3D12ShaderReflectionType) -> Result { + unsafe { + let result = self.inner.is_equal(other.inner); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(result.0 != 0) + } + } + + pub fn get_sub_type(&self) -> D3D12ShaderReflectionType { + unsafe { + let ty = self.inner.get_sub_type(); + D3D12ShaderReflectionType { + inner: ty, + owner: self.owner.clone(), + } + } + } + + pub fn get_base_class(&self) -> D3D12ShaderReflectionType { + unsafe { + let ty = self.inner.get_base_class(); + D3D12ShaderReflectionType { + inner: ty, + owner: self.owner.clone(), + } + } + } + + pub fn get_num_interfaces(&self) -> u32 { + unsafe { self.inner.get_num_interfaces() } + } + + pub fn get_interface_by_index(&self, index: u32) -> D3D12ShaderReflectionType { + unsafe { + let ty = self.inner.get_interface_by_index(index); + D3D12ShaderReflectionType { + inner: ty, + owner: self.owner.clone(), + } + } + } + + pub fn is_of_type(&self, other: &D3D12ShaderReflectionType) -> Result { + unsafe { + let result = self.inner.is_of_type(other.inner); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(result.0 != 0) + } + } + + pub fn implements_interface(&self, other: &D3D12ShaderReflectionType) -> Result { + unsafe { + let result = self.inner.implements_interface(other.inner); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(result.0 != 0) + } + } +} + +pub struct D3D12ShaderReflectionVariable { + inner: ID3D12ShaderReflectionVariable, + owner: ID3D12ShaderReflection, +} + +impl D3D12ShaderReflectionVariable { + pub fn get_desc(&self) -> Result { + unsafe { + let mut shader_variable_desc_ffi: D3D12_SHADER_VARIABLE_DESC = + MaybeUninit::zeroed().assume_init(); + let result = self + .inner + .get_desc(&mut shader_variable_desc_ffi as *mut D3D12_SHADER_VARIABLE_DESC); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12ShaderVariableDesc::from_ffi(&shader_variable_desc_ffi)) + } + } + + pub fn get_type(&self) -> D3D12ShaderReflectionType { + unsafe { + D3D12ShaderReflectionType { + inner: self.inner.get_type(), + owner: self.owner.clone(), + } + } + } + + pub fn get_buffer(&self) -> D3D12ShaderReflectionConstantBuffer { + unsafe { + D3D12ShaderReflectionConstantBuffer { + inner: self.inner.get_buffer(), + owner: self.owner.clone(), + } + } + } + + pub fn get_interface_slot(&self, array_index: u32) -> u32 { + unsafe { self.inner.get_interface_slot(array_index) } + } +} + +pub struct D3D12ShaderReflectionConstantBuffer { + inner: ID3D12ShaderReflectionConstantBuffer, + owner: ID3D12ShaderReflection, +} + +impl D3D12ShaderReflectionConstantBuffer { + pub fn get_desc(&self) -> Result { + unsafe { + let mut shader_buffer_desc_ffi: D3D12_SHADER_BUFFER_DESC = + MaybeUninit::zeroed().assume_init(); + let result = self + .inner + .get_desc(&mut shader_buffer_desc_ffi as *mut D3D12_SHADER_BUFFER_DESC); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12ShaderBufferDesc::from_ffi(&shader_buffer_desc_ffi)) + } + } + + pub fn get_variable_by_index(&self, index: u32) -> Result { + unsafe { + let variable_ffi = self.inner.get_variable_by_index(index); + + Ok(D3D12ShaderReflectionVariable { + inner: variable_ffi, + owner: self.owner.clone(), + }) + } + } + + pub fn get_variable_by_name<'a>( + &self, + name: impl Into<&'a CStr>, + ) -> Result { + unsafe { + let variable_ffi = self.inner.get_variable_by_name(name.into().as_ptr()); + + Ok(D3D12ShaderReflectionVariable { + inner: variable_ffi, + owner: self.owner.clone(), + }) + } + } +} + pub struct Reflection { inner: ID3D12ShaderReflection, } @@ -617,6 +1090,188 @@ impl Reflection { Self { inner } } + pub fn get_desc(&self) -> Result { + unsafe { + let mut shader_desc_ffi: D3D12_SHADER_DESC = MaybeUninit::zeroed().assume_init(); + let result = self + .inner + .get_desc(&mut shader_desc_ffi as *mut D3D12_SHADER_DESC); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12ShaderDesc::from_ffi(&shader_desc_ffi)) + } + } + + pub fn get_constant_buffer_by_index(&self, index: u32) -> D3D12ShaderReflectionConstantBuffer { + unsafe { + let constant_buffer = self.inner.get_constant_buffer_by_index(index); + D3D12ShaderReflectionConstantBuffer { + inner: constant_buffer, + owner: self.inner.clone(), + } + } + } + + pub fn get_constant_buffer_by_name<'a>( + &self, + name: impl Into<&'a CStr>, + ) -> D3D12ShaderReflectionConstantBuffer { + unsafe { + let constant_buffer = self.inner.get_constant_buffer_by_name(name.into().as_ptr()); + D3D12ShaderReflectionConstantBuffer { + inner: constant_buffer, + owner: self.inner.clone(), + } + } + } + + pub fn get_resource_binding_desc( + &self, + resource_index: u32, + ) -> Result { + unsafe { + let mut shader_input_bind_desc_ffi: D3D12_SHADER_INPUT_BIND_DESC = + MaybeUninit::zeroed().assume_init(); + let result = self.inner.get_resource_binding_desc( + resource_index, + &mut shader_input_bind_desc_ffi as *mut D3D12_SHADER_INPUT_BIND_DESC, + ); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12ShaderInputBindDesc::from_ffi( + &shader_input_bind_desc_ffi, + )) + } + } + + pub fn get_input_parameter_desc( + &self, + parameter_index: u32, + ) -> Result { + unsafe { + let mut signature_parameter_desc_ffi: D3D12_SIGNATURE_PARAMETER_DESC = + MaybeUninit::zeroed().assume_init(); + let result = self.inner.get_input_parameter_desc( + parameter_index, + &mut signature_parameter_desc_ffi as *mut D3D12_SIGNATURE_PARAMETER_DESC, + ); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12SignatureParameterDesc::from_ffi( + &signature_parameter_desc_ffi, + )) + } + } + + pub fn get_output_parameter_desc( + &self, + parameter_index: u32, + ) -> Result { + unsafe { + let mut signature_parameter_desc_ffi: D3D12_SIGNATURE_PARAMETER_DESC = + MaybeUninit::zeroed().assume_init(); + let result = self.inner.get_output_parameter_desc( + parameter_index, + &mut signature_parameter_desc_ffi as *mut D3D12_SIGNATURE_PARAMETER_DESC, + ); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12SignatureParameterDesc::from_ffi( + &signature_parameter_desc_ffi, + )) + } + } + + pub fn get_patch_constant_parameter_desc( + &self, + parameter_index: u32, + ) -> Result { + unsafe { + let mut signature_parameter_desc_ffi: D3D12_SIGNATURE_PARAMETER_DESC = + MaybeUninit::zeroed().assume_init(); + let result = self.inner.get_patch_constant_parameter_desc( + parameter_index, + &mut signature_parameter_desc_ffi as *mut D3D12_SIGNATURE_PARAMETER_DESC, + ); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12SignatureParameterDesc::from_ffi( + &signature_parameter_desc_ffi, + )) + } + } + + pub fn get_variable_by_name<'a>( + &self, + name: impl Into<&'a CStr>, + ) -> D3D12ShaderReflectionVariable { + unsafe { + let variable = self.inner.get_variable_by_name(name.into().as_ptr()); + D3D12ShaderReflectionVariable { + inner: variable, + owner: self.inner.clone(), + } + } + } + + pub fn get_resource_binding_desc_by_name<'a>( + &self, + name: impl Into<&'a CStr>, + ) -> Result { + unsafe { + let mut signature_parameter_desc_ffi: D3D12_SIGNATURE_PARAMETER_DESC = + MaybeUninit::zeroed().assume_init(); + let result = self.inner.get_resource_binding_desc_by_name( + name.into().as_ptr(), + &mut signature_parameter_desc_ffi as *mut D3D12_SIGNATURE_PARAMETER_DESC, + ); + + if result.is_err() { + return Err(HassleError::Win32Error(result)); + } + + Ok(D3D12SignatureParameterDesc::from_ffi( + &signature_parameter_desc_ffi, + )) + } + } + pub(crate) fn get_mov_instruction_count(&self) -> u32 { + unsafe { self.inner.get_mov_instruction_count() } + } + pub(crate) fn get_movc_instruction_count(&self) -> u32 { + unsafe { self.inner.get_movc_instruction_count() } + } + pub(crate) fn get_conversion_instruction_count(&self) -> u32 { + unsafe { self.inner.get_conversion_instruction_count() } + } + pub(crate) fn get_bitwise_instruction_count(&self) -> u32 { + unsafe { self.inner.get_bitwise_instruction_count() } + } + pub(crate) fn get_gs_input_primitive(&self) -> D3D_PRIMITIVE { + unsafe { self.inner.get_gs_input_primitive() } + } + pub(crate) fn is_sample_frequency_shader(&self) -> bool { + unsafe { self.inner.is_sample_frequency_shader() } + } + pub(crate) fn get_num_interface_slots(&self) -> u32 { + unsafe { self.inner.get_num_interface_slots() } + } + pub fn thread_group_size(&self) -> [u32; 3] { let (mut size_x, mut size_y, mut size_z) = (0u32, 0u32, 0u32); unsafe { @@ -625,6 +1280,10 @@ impl Reflection { }; [size_x, size_y, size_z] } + + pub(crate) fn get_requires_flags(&self) -> u64 { + unsafe { self.inner.get_requires_flags() } + } } pub struct DxcReflector {