Ada计算机图形DirectX之D3D11shader

----------------------------------------
-- File : D3DX11shader.ads            --
-- Translator:Dongfeng.Gu,2018/10/25  --
-- Mail: [email protected]                --
-- Progress:100%                      --
----------------------------------------

with Interfaces.C;

with win32;                           use win32;
with win32.windef;                    use win32.windef;
with win32.objbase;                   use win32.objbase;
with win32.rpcdce;                    use win32.rpcdce;

with d3dcommon;                       use d3dcommon;
with d3d10;                           use d3d10;
with D3D10shader;                     use D3D10shader;

with d3d11;                           use d3d11;


package D3D11Shader is

   type D3D11_SHADER_VERSION_TYPE is (D3D11_SHVER_PIXEL_SHADER,
                                      D3D11_SHVER_VERTEX_SHADER,
                                      D3D11_SHVER_GEOMETRY_SHADER,
                                      D3D11_SHVER_HULL_SHADER,
                                      D3D11_SHVER_DOMAIN_SHADER,
                                      D3D11_SHVER_COMPUTE_SHADER);
   for D3D11_SHADER_VERSION_TYPE use (D3D11_SHVER_PIXEL_SHADER=>0,
                                      D3D11_SHVER_VERTEX_SHADER=>1,
                                      D3D11_SHVER_GEOMETRY_SHADER=>2,
                                      D3D11_SHVER_HULL_SHADER=>3,
                                      D3D11_SHVER_DOMAIN_SHADER=>4,
                                      D3D11_SHVER_COMPUTE_SHADER=>5);


   type LPD3D11_SHADER_VERSION_TYPE is access D3D11_SHADER_VERSION_TYPE;


   -- three macro function

   use type Interfaces.C.unsigned_long;

   function D3D11_SHVER_GET_TYPE(Version:dword)  return dword is (d3d11.Rsh(Version,16) and 16#ffff#);

   function D3D11_SHVER_GET_MAJOR(Version:dword) return dword is (d3d11.Rsh(Version,04) and 16#f#);

   function D3D11_SHVER_GET_MINOR(Version:dword) return dword is (d3d11.Rsh(Version,00) and 16#f#);



   type D3D11_RESOURCE_RETURN_TYPE is (D3D11_RETURN_TYPE_UNORM,
                                       D3D11_RETURN_TYPE_SNORM,
                                       D3D11_RETURN_TYPE_SINT,
                                       D3D11_RETURN_TYPE_UINT,
                                       D3D11_RETURN_TYPE_FLOAT,
                                       D3D11_RETURN_TYPE_MIXED,
                                       D3D11_RETURN_TYPE_DOUBLE,
                                       D3D11_RETURN_TYPE_CONTINUED);
   for D3D11_RESOURCE_RETURN_TYPE use (D3D11_RETURN_TYPE_UNORM=>1,
                                       D3D11_RETURN_TYPE_SNORM=>2,
                                       D3D11_RETURN_TYPE_SINT=>3,
                                       D3D11_RETURN_TYPE_UINT=>4,
                                       D3D11_RETURN_TYPE_FLOAT=>5,
                                       D3D11_RETURN_TYPE_MIXED=>6,
                                       D3D11_RETURN_TYPE_DOUBLE=>7,
                                       D3D11_RETURN_TYPE_CONTINUED=>8);



   type LPD3D11_RESOURCE_RETURN_TYPE is access D3D11_RESOURCE_RETURN_TYPE;

   type tagD3D11_CBUFFER_TYPE is (D3D11_CT_CBUFFER,
                                  D3D11_CT_TBUFFER,
                                  D3D11_CT_INTERFACE_POINTERS,
                                  D3D11_CT_RESOURCE_BIND_INFO);

   subtype D3D11_CBUFFER_TYPE is tagD3D11_CBUFFER_TYPE;

   type LPD3D11_CBUFFER_TYPE is access tagD3D11_CBUFFER_TYPE;

   type tagD3D11_SIGNATURE_PARAMETER_DESC is record
      SemanticName: LPCSTR;
      SemanticIndex: UINT;
      Register: UINT;
      SystemValueType: D3D10_NAME;
      ComponentType: D3D10_REGISTER_COMPONENT_TYPE;
      Mask: BYTE;
      ReadWriteMask: BYTE;
      Stream: UINT;
   end record;

   subtype D3D11_SIGNATURE_PARAMETER_DESC is tagD3D11_SIGNATURE_PARAMETER_DESC;

   type LPD3D11_SIGNATURE_PARAMETER_DESC is access all tagD3D11_SIGNATURE_PARAMETER_DESC;

   type tagD3D11_SHADER_BUFFER_DESC is record
      Name: LPCSTR;
      Typ: D3D11_CBUFFER_TYPE;
      Variables: UINT;
      Size: UINT;
      uFlags: UINT;
   end record;

   subtype D3D11_SHADER_BUFFER_DESC is tagD3D11_SHADER_BUFFER_DESC;

   type LPD3D11_SHADER_BUFFER_DESC is access all tagD3D11_SHADER_BUFFER_DESC;

   type tagD3D11_SHADER_VARIABLE_DESC is record
      Name: LPCSTR;
      StartOffset: UINT;
      Size: UINT;
      uFlags: UINT;
      DefaultValue: LPVOID;
      StartTexture: UINT;
      TextureSize: UINT;
      StartSampler: UINT;
      SamplerSize: UINT;
   end record;

   subtype D3D11_SHADER_VARIABLE_DESC is tagD3D11_SHADER_VARIABLE_DESC;

   type LPD3D11_SHADER_VARIABLE_DESC is access all tagD3D11_SHADER_VARIABLE_DESC;

   type tagD3D11_SHADER_TYPE_DESC is record
      Class: D3D10_SHADER_VARIABLE_CLASS;
      Typ: D3D10_SHADER_VARIABLE_TYPE;
      Rows: UINT;
      Columns: UINT;
      Elements: UINT;
      Members: UINT;
      Offset: UINT;
      Name: LPCSTR;
   end record;

   subtype D3D11_SHADER_TYPE_DESC is tagD3D11_SHADER_TYPE_DESC;

   type LPD3D11_SHADER_TYPE_DESC is access all tagD3D11_SHADER_TYPE_DESC;

   type D3D11_TESSELLATOR_DOMAIN is (D3D11_TESSELLATOR_DOMAIN_UNDEFINED,
                                     D3D11_TESSELLATOR_DOMAIN_ISOLINE,
                                     D3D11_TESSELLATOR_DOMAIN_TRI,
                                     D3D11_TESSELLATOR_DOMAIN_QUAD);
   for D3D11_TESSELLATOR_DOMAIN use (D3D11_TESSELLATOR_DOMAIN_UNDEFINED=>0,
                                     D3D11_TESSELLATOR_DOMAIN_ISOLINE=>1,
                                     D3D11_TESSELLATOR_DOMAIN_TRI=>2,
                                     D3D11_TESSELLATOR_DOMAIN_QUAD=>3);

   type LPD3D11_TESSELLATOR_DOMAIN is access D3D11_TESSELLATOR_DOMAIN;

   type D3D11_TESSELLATOR_PARTITIONING is (D3D11_TESSELLATOR_PARTITIONING_UNDEFINED,
                                           D3D11_TESSELLATOR_PARTITIONING_INTEGER,
                                           D3D11_TESSELLATOR_PARTITIONING_POW2,
                                           D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD,
                                           D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN);
   for D3D11_TESSELLATOR_PARTITIONING use (D3D11_TESSELLATOR_PARTITIONING_UNDEFINED=>0,
                                           D3D11_TESSELLATOR_PARTITIONING_INTEGER=>1,
                                           D3D11_TESSELLATOR_PARTITIONING_POW2=>2,
                                           D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD=>3,
                                           D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN=>4);

   type LPD3D11_TESSELLATOR_PARTITIONING is access D3D11_TESSELLATOR_PARTITIONING;

   type D3D11_TESSELLATOR_OUTPUT_PRIMITIVE is (D3D11_TESSELLATOR_OUTPUT_UNDEFINED,
                                               D3D11_TESSELLATOR_OUTPUT_POINT,
                                               D3D11_TESSELLATOR_OUTPUT_LINE,
                                               D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW,
                                               D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW);
   for D3D11_TESSELLATOR_OUTPUT_PRIMITIVE use (D3D11_TESSELLATOR_OUTPUT_UNDEFINED=>0,
                                               D3D11_TESSELLATOR_OUTPUT_POINT=>1,
                                               D3D11_TESSELLATOR_OUTPUT_LINE=>2,
                                               D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW=>3,
                                               D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW=>4);

   type LPD3D11_TESSELLATOR_OUTPUT_PRIMITIVE is access D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;

   type tagD3D11_SHADER_DESC is record
      Version: UINT;
      Creator: LPCSTR;
      Flags: UINT;
      ConstantBuffers: UINT;
      BoundResources: UINT;
      InputParameters: UINT;
      OutputParameters: UINT;
      InstructionCount: UINT;
      TempRegisterCount: UINT;
      TempArrayCount: UINT;
      DefCount: UINT;
      DclCount: UINT;
      TextureNormalInstructions: UINT;
      TextureLoadInstructions: UINT;
      TextureCompInstructions: UINT;
      TextureBiasInstructions: UINT;
      TextureGradientInstructions: UINT;
      FloatInstructionCount: UINT;
      IntInstructionCount: UINT;
      UintInstructionCount: UINT;
      StaticFlowControlCount: UINT;
      DynamicFlowControlCount: UINT;
      MacroInstructionCount: UINT;
      ArrayInstructionCount: UINT;
      CutInstructionCount: UINT;
      EmitInstructionCount: UINT;
      GSOutputTopology: D3D10_PRIMITIVE_TOPOLOGY;
      GSMaxOutputVertexCount: UINT;
      InputPrimitive: D3D11_PRIMITIVE;
      PatchConstantParameters: UINT;
      cGSInstanceCount: UINT;
      cControlPoints: UINT;
      HSOutputPrimitive: D3D11_TESSELLATOR_OUTPUT_PRIMITIVE;
      HSPartitioning: D3D11_TESSELLATOR_PARTITIONING;
      TessellatorDomain: D3D11_TESSELLATOR_DOMAIN;
      cBarrierInstructions: UINT;
      cInterlockedInstructions: UINT;
      cTextureStoreInstructions: UINT;
   end record;

   subtype D3D11_SHADER_DESC is tagD3D11_SHADER_DESC;

   type LPD3D11_SHADER_DESC is access all tagD3D11_SHADER_DESC;

   type tagD3D11_SHADER_INPUT_BIND_DESC is record
      Name: LPCSTR;
      Typ: D3D10_SHADER_INPUT_TYPE;
      BindPoint: UINT;
      BindCount: UINT;
      uFlags: UINT;
      ReturnType: D3D11_RESOURCE_RETURN_TYPE;
      Dimension: D3D10_SRV_DIMENSION;
      NumSamples: UINT;
   end record;

   subtype D3D11_SHADER_INPUT_BIND_DESC is tagD3D11_SHADER_INPUT_BIND_DESC;

   type LPD3D11_SHADER_INPUT_BIND_DESC is access all tagD3D11_SHADER_INPUT_BIND_DESC;


   type ID3D11ShaderReflectionType;
   type LPID3D11ShaderReflectionType is access all ID3D11ShaderReflectionType;
   type LPLPID3D11ShaderReflectionType is access all LPID3D11ShaderReflectionType;
   subtype LPD3D11ShaderReflectionType is LPID3D11ShaderReflectionType;
   subtype LPLPD3D11ShaderReflectionType is LPLPID3D11ShaderReflectionType;

   type ID3D11ShaderReflectionVariable;
   type LPID3D11ShaderReflectionVariable is access all ID3D11ShaderReflectionVariable;
   type LPLPID3D11ShaderReflectionVariable is access all LPID3D11ShaderReflectionVariable;
   subtype LPD3D11ShaderReflectionVariable is LPID3D11ShaderReflectionVariable;
   subtype LPLPD3D11ShaderReflectionVariable is LPLPID3D11ShaderReflectionVariable;

   type ID3D11ShaderReflectionConstantBuffer;
   type LPID3D11ShaderReflectionConstantBuffer is access all ID3D11ShaderReflectionConstantBuffer;
   type LPLPID3D11ShaderReflectionConstantBuffer is access all LPID3D11ShaderReflectionConstantBuffer;
   subtype LPD3D11ShaderReflectionConstantBuffer is LPID3D11ShaderReflectionConstantBuffer;
   subtype LPLPD3D11ShaderReflectionConstantBuffer is LPLPID3D11ShaderReflectionConstantBuffer;

   type ID3D11ShaderReflection;
   type LPID3D11ShaderReflection is access all ID3D11ShaderReflection;
   type LPLPID3D11ShaderReflection is access all LPID3D11ShaderReflection;
   subtype LPD3D11ShaderReflection is LPID3D11ShaderReflection;
   subtype LPLPD3D11ShaderReflection is LPLPID3D11ShaderReflection;





   IID_ID3D11ShaderReflectionType:constant win32.rpcdce.GUID:=(16#6e6ffa6a#,16#9bae#,16#4613#,(16#a5#,16#1e#,16#91#,16#65#,16#2d#,16#50#,16#8c#,16#21#));
   type ID3D11ShaderReflectionType is record
      GetDesc:access procedure(THIS:LPID3D11ShaderReflectionType;pDesc:LPD3D11_SHADER_TYPE_DESC) with Convention=>Stdcall;
      GetMemberTypeByIndex:access function(THIS:LPID3D11ShaderReflectionType;Index:UINT) return LPID3D11ShaderReflectionType with Convention=>Stdcall;
      GetMemberTypeByName:access function(THIS:LPID3D11ShaderReflectionType;Name:LPCSTR) return LPID3D11ShaderReflectionType with Convention=>Stdcall;
      GetMemberTypeName:access function(THIS:LPID3D11ShaderReflectionType;Index:UINT) return LPCSTR with Convention=>Stdcall;
      IsEqual:access procedure(THIS:LPID3D11ShaderReflectionType;pType:LPID3D11ShaderReflectionType) with Convention=>Stdcall;
      GetSubType:access function(THIS:LPID3D11ShaderReflectionType) return LPID3D11ShaderReflectionType with Convention=>Stdcall;
      GetBaseClass:access function(THIS:LPID3D11ShaderReflectionType) return LPID3D11ShaderReflectionType with Convention=>Stdcall;
      GetNumInterfaces:access function(THIS:LPID3D11ShaderReflectionType) return UINT with Convention=>Stdcall;
      GetInterfaceByIndex:access function(THIS:LPID3D11ShaderReflectionType;uIndex:UINT) return LPID3D11ShaderReflectionType with Convention=>Stdcall;
      IsOfType:access procedure(THIS:LPID3D11ShaderReflectionType;pType:LPID3D11ShaderReflectionType) with Convention=>Stdcall;
      ImplementsInterface:access procedure(THIS:LPID3D11ShaderReflectionType;pBase:LPID3D11ShaderReflectionType) with Convention=>Stdcall;
   end record;

   IID_ID3D11ShaderReflectionVariable:constant win32.rpcdce.GUID:=(16#51f23923#,16#f3e5#,16#4bd1#,(16#91#,16#cb#,16#60#,16#61#,16#77#,16#d8#,16#db#,16#4c#));
   type ID3D11ShaderReflectionVariable is record
      GetDesc:access procedure(THIS:LPID3D11ShaderReflectionVariable;pDesc:LPD3D11_SHADER_VARIABLE_DESC) with Convention=>Stdcall;
      GetType:access function(THIS:LPID3D11ShaderReflectionVariable) return LPID3D11ShaderReflectionType with Convention=>Stdcall;
      GetBuffer:access function(THIS:LPID3D11ShaderReflectionVariable) return LPID3D11ShaderReflectionConstantBuffer with Convention=>Stdcall;
      GetInterfaceSlot:access function(THIS:LPID3D11ShaderReflectionVariable;uArrayIndex:UINT) return UINT with Convention=>Stdcall;
   end record;

   IID_ID3D11ShaderReflectionConstantBuffer:constant win32.rpcdce.GUID:=(16#eb62d63d#,16#93dd#,16#4318#,(16#8a#,16#e8#,16#c6#,16#f8#,16#3a#,16#d3#,16#71#,16#b8#));
   type ID3D11ShaderReflectionConstantBuffer is record
      GetDesc:access procedure(THIS:LPID3D11ShaderReflectionConstantBuffer;pDesc:LPD3D11_SHADER_BUFFER_DESC) with Convention=>Stdcall;
      GetVariableByIndex:access function(THIS:LPID3D11ShaderReflectionConstantBuffer;Index:UINT) return LPID3D11ShaderReflectionVariable with Convention=>Stdcall;
      GetVariableByName:access function(THIS:LPID3D11ShaderReflectionConstantBuffer;Name:LPCSTR) return LPID3D11ShaderReflectionVariable with Convention=>Stdcall;
   end record;

   IID_ID3D11ShaderReflection:constant win32.rpcdce.GUID:=(16#17f27486#,16#a342#,16#4d10#,(16#88#,16#42#,16#ab#,16#08#,16#74#,16#e7#,16#f6#,16#70#));
   type ID3D11ShaderReflection is record
      QueryInterface:access procedure(THIS:LPID3D11ShaderReflection;iid:REFIID;ppv:LPLPVOID) with Convention=>Stdcall;
      AddRef:access function(THIS:LPID3D11ShaderReflection) return ULONG with Convention=>Stdcall;
      Release:access function(THIS:LPID3D11ShaderReflection) return ULONG with Convention=>Stdcall;
      GetDesc:access procedure(THIS:LPID3D11ShaderReflection;pDesc:LPD3D11_SHADER_DESC) with Convention=>Stdcall;
      GetConstantBufferByIndex:access function(THIS:LPID3D11ShaderReflection;Index:UINT) return LPID3D11ShaderReflectionConstantBuffer with Convention=>Stdcall;
      GetConstantBufferByName:access function(THIS:LPID3D11ShaderReflection;Name:LPCSTR) return LPID3D11ShaderReflectionConstantBuffer with Convention=>Stdcall;
      GetResourceBindingDesc:access procedure(THIS:LPID3D11ShaderReflection;ResourceIndex:UINT;pDesc:LPD3D11_SHADER_INPUT_BIND_DESC) with Convention=>Stdcall;
      GetInputParameterDesc:access procedure(THIS:LPID3D11ShaderReflection;ParameterIndex:UINT;pDesc:LPD3D11_SIGNATURE_PARAMETER_DESC) with Convention=>Stdcall;
      GetOutputParameterDesc:access procedure(THIS:LPID3D11ShaderReflection;ParameterIndex:UINT;pDesc:LPD3D11_SIGNATURE_PARAMETER_DESC) with Convention=>Stdcall;
      GetPatchConstantParameterDesc:access procedure(THIS:LPID3D11ShaderReflection;ParameterIndex:UINT;pDesc:LPD3D11_SIGNATURE_PARAMETER_DESC) with Convention=>Stdcall;
      GetVariableByName:access function(THIS:LPID3D11ShaderReflection;Name:LPCSTR) return LPID3D11ShaderReflectionVariable with Convention=>Stdcall;
      GetResourceBindingDescByName:access procedure(THIS:LPID3D11ShaderReflection;Name:LPCSTR;pDesc:LPD3D11_SHADER_INPUT_BIND_DESC) with Convention=>Stdcall;
      GetMovInstructionCount:access function(THIS:LPID3D11ShaderReflection) return UINT with Convention=>Stdcall;
      GetMovcInstructionCount:access function(THIS:LPID3D11ShaderReflection) return UINT with Convention=>Stdcall;
      GetConversionInstructionCount:access function(THIS:LPID3D11ShaderReflection) return UINT with Convention=>Stdcall;
      GetBitwiseInstructionCount:access function(THIS:LPID3D11ShaderReflection) return UINT with Convention=>Stdcall;
      GetGSInputPrimitive:access function(THIS:LPID3D11ShaderReflection) return D3D10_PRIMITIVE with Convention=>Stdcall;
      IsSampleFrequencyShader:access function(THIS:LPID3D11ShaderReflection) return BOOL with Convention=>Stdcall;
      GetNumInterfaceSlots:access function(THIS:LPID3D11ShaderReflection) return UINT with Convention=>Stdcall;
      GetMinFeatureLevel:access procedure(THIS:LPID3D11ShaderReflection;pLevel:LPD3D_FEATURE_LEVEL) with Convention=>Stdcall;
   end record;




end D3D11Shader;

猜你喜欢

转载自blog.csdn.net/adacore/article/details/83379211
今日推荐