Ada计算机图形DirectX之D3DX11tex

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

with win32;              use win32;
with Win32.Windef;       use win32.windef;
with win32.Objbase;      use win32.Objbase;
with win32.Winerror;

with DXGIFormat;         use DXGIFormat;

with d3d10misc;          use d3d10misc;
with d3d11;              use d3d11;
with D3DX11core;         use D3DX11core;


package D3DX11tex is

   type LPHRESULT is access all HRESULT;

   function Shift_Left(A:dword;B:Natural) return dword with import,convention=>Intrinsic;
   function Lsh(A:dword;B:Natural) return dword is (Shift_Left(A,B));

   function Shift_Right(A:dword;B:Natural) return dword with import,convention=>Intrinsic;
   function Rsh(A:dword;B:Natural) return dword is (Shift_Right(A,B));

   type D3DX11_FILTER_FLAG is (D3DX11_FILTER_NONE,
                               D3DX11_FILTER_POINT,
                               D3DX11_FILTER_LINEAR,
                               D3DX11_FILTER_TRIANGLE,
                               D3DX11_FILTER_BOX,
                               D3DX11_FILTER_MIRROR_U,
                               D3DX11_FILTER_MIRROR_V,
                               D3DX11_FILTER_MIRROR_W,
                               D3DX11_FILTER_MIRROR,
                               D3DX11_FILTER_DITHER,
                               D3DX11_FILTER_DITHER_DIFFUSION,
                               D3DX11_FILTER_SRGB_IN,
                               D3DX11_FILTER_SRGB_OUT,
                               D3DX11_FILTER_SRGB);
   for D3DX11_FILTER_FLAG use (D3DX11_FILTER_NONE=>1,
                               D3DX11_FILTER_POINT=>(2),
                               D3DX11_FILTER_LINEAR=>(3),
                               D3DX11_FILTER_TRIANGLE=>(4),
                               D3DX11_FILTER_BOX=>(5),
                               D3DX11_FILTER_MIRROR_U=>16#10000#,
                               D3DX11_FILTER_MIRROR_V=>16#20000#,
                               D3DX11_FILTER_MIRROR_W=>16#40000#,
                               D3DX11_FILTER_MIRROR=>16#70000#,
                               D3DX11_FILTER_DITHER=>16#80000#,
                               D3DX11_FILTER_DITHER_DIFFUSION=>16#100000#,
                               D3DX11_FILTER_SRGB_IN=>16#200000#,
                               D3DX11_FILTER_SRGB_OUT=>16#400000#,
                               D3DX11_FILTER_SRGB=>16#600000#);


   type LPD3DX11_FILTER_FLAG is access D3DX11_FILTER_FLAG;

   type D3DX11_NORMALMAP_FLAG is (D3DX11_NORMALMAP_MIRROR_U,
                                  D3DX11_NORMALMAP_MIRROR_V,
                                  D3DX11_NORMALMAP_MIRROR,
                                  D3DX11_NORMALMAP_INVERTSIGN,
                                  D3DX11_NORMALMAP_COMPUTE_OCCLUSION);
   for D3DX11_NORMALMAP_FLAG use (D3DX11_NORMALMAP_MIRROR_U=>16#10000#,
                                  D3DX11_NORMALMAP_MIRROR_V=>16#20000#,
                                  D3DX11_NORMALMAP_MIRROR=>16#30000#,
                                  D3DX11_NORMALMAP_INVERTSIGN=>16#80000#,
                                  D3DX11_NORMALMAP_COMPUTE_OCCLUSION=>16#100000#);


   type LPD3DX11_NORMALMAP_FLAG is access D3DX11_NORMALMAP_FLAG;

   type D3DX11_CHANNEL_FLAG is (D3DX11_CHANNEL_RED,
                                D3DX11_CHANNEL_BLUE,
                                D3DX11_CHANNEL_GREEN,
                                D3DX11_CHANNEL_ALPHA,
                                D3DX11_CHANNEL_LUMINANCE);
   for D3DX11_CHANNEL_FLAG use (D3DX11_CHANNEL_RED=>1,
                                D3DX11_CHANNEL_BLUE=>2,
                                D3DX11_CHANNEL_GREEN=>4,
                                D3DX11_CHANNEL_ALPHA=>8,
                                D3DX11_CHANNEL_LUMINANCE=>16);


   type LPD3DX11_CHANNEL_FLAG is access D3DX11_CHANNEL_FLAG;

   type D3DX11_IMAGE_FILE_FORMAT is (D3DX11_IFF_BMP,
                                     D3DX11_IFF_JPG,
                                     D3DX11_IFF_PNG,
                                     D3DX11_IFF_DDS,
                                     D3DX11_IFF_TIFF,
                                     D3DX11_IFF_GIF,
                                     D3DX11_IFF_WMP,
                                     D3DX11_IFF_FORCE_DWORD);
   for D3DX11_IMAGE_FILE_FORMAT use (D3DX11_IFF_BMP=>0,
                                     D3DX11_IFF_JPG=>1,
                                     D3DX11_IFF_PNG=>3,
                                     D3DX11_IFF_DDS=>4,
                                     D3DX11_IFF_TIFF=>10,
                                     D3DX11_IFF_GIF=>11,
                                     D3DX11_IFF_WMP=>12,
                                     D3DX11_IFF_FORCE_DWORD=>16#7fffffff#);

   type LPD3DX11_IMAGE_FILE_FORMAT is access D3DX11_IMAGE_FILE_FORMAT;

   type D3DX11_SAVE_TEXTURE_FLAG is (D3DX11_STF_USEINPUTBLOB);
   for D3DX11_SAVE_TEXTURE_FLAG use (D3DX11_STF_USEINPUTBLOB=>16#0001#);


   type LPD3DX11_SAVE_TEXTURE_FLAG is access D3DX11_SAVE_TEXTURE_FLAG;

   type D3DX11_IMAGE_INFO is record
      Width: UINT;
      Height: UINT;
      Depth: UINT;
      ArraySize: UINT;
      MipLevels: UINT;
      MiscFlags: UINT;
      Format: DXGI_FORMAT;
      ResourceDimension: D3D11_RESOURCE_DIMENSION;
      ImageFileFormat: D3DX11_IMAGE_FILE_FORMAT;
   end record;

   type LPD3DX11_IMAGE_INFO is access all D3DX11_IMAGE_INFO;

   type D3DX11_IMAGE_LOAD_INFO is record
      Width: UINT;
      Height: UINT;
      Depth: UINT;
      FirstMipLevel: UINT;
      MipLevels: UINT;
      Usage: D3D11_USAGE;
      BindFlags: UINT;
      CpuAccessFlags: UINT;
      MiscFlags: UINT;
      Format: DXGI_FORMAT;
      Filter: UINT;
      MipFilter: UINT;
      pSrcInfo:LPD3DX11_IMAGE_INFO;
   end record;

   type LPD3DX11_IMAGE_LOAD_INFO is access all D3DX11_IMAGE_LOAD_INFO;

   function D3DX11GetImageInfoFromFileA(pSrcFile:LPCSTR;pPump:LPID3DX11ThreadPump;pSrcInfo:LPD3DX11_IMAGE_INFO;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11GetImageInfoFromFileA";
   function D3DX11GetImageInfoFromFile(pSrcFile:LPCSTR;pPump:LPID3DX11ThreadPump;pSrcInfo:LPD3DX11_IMAGE_INFO;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11GetImageInfoFromFileA";

   function D3DX11GetImageInfoFromFileW(pSrcFile:LPCWSTR;pPump:LPID3DX11ThreadPump;pSrcInfo:LPD3DX11_IMAGE_INFO;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11GetImageInfoFromFileW";



   function D3DX11GetImageInfoFromResourceA(hSrcModule:HMODULE;pSrcResource:LPCSTR;pPump:LPID3DX11ThreadPump;pSrcInfo:LPD3DX11_IMAGE_INFO;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11GetImageInfoFromResourceA";
   function D3DX11GetImageInfoFromResource(hSrcModule:HMODULE;pSrcResource:LPCSTR;pPump:LPID3DX11ThreadPump;pSrcInfo:LPD3DX11_IMAGE_INFO;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11GetImageInfoFromResourceA";

   function D3DX11GetImageInfoFromResourceW(hSrcModule:HMODULE;pSrcResource:LPCWSTR;pPump:LPID3DX11ThreadPump;pSrcInfo:LPD3DX11_IMAGE_INFO;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11GetImageInfoFromResourceW";


   function D3DX11GetImageInfoFromMemory(pSrcData:LPCVOID;SrcDataSize:SIZE_T;pPump:LPID3DX11ThreadPump;pSrcInfo:LPD3DX11_IMAGE_INFO;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11GetImageInfoFromMemory";

   function D3DX11CreateShaderResourceViewFromFileA(pDevice:LPID3D11Device;pSrcFile:LPCSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppShaderResourceView:LPLPID3D11ShaderResourceView;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateShaderResourceViewFromFileA";
   function D3DX11CreateShaderResourceViewFromFile(pDevice:LPID3D11Device;pSrcFile:LPCSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppShaderResourceView:LPLPID3D11ShaderResourceView;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateShaderResourceViewFromFileA";

   function D3DX11CreateShaderResourceViewFromFileW(pDevice:LPID3D11Device;pSrcFile:LPCWSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppShaderResourceView:LPLPID3D11ShaderResourceView;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateShaderResourceViewFromFileW";


   function D3DX11CreateTextureFromFileA(pDevice:LPID3D11Device;pSrcFile:LPCSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppTexture:LPLPID3D11Resource;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateTextureFromFileA";
   function D3DX11CreateTextureFromFile(pDevice:LPID3D11Device;pSrcFile:LPCSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppTexture:LPLPID3D11Resource;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateTextureFromFileA";

   function D3DX11CreateTextureFromFileW(pDevice:LPID3D11Device;pSrcFile:LPCWSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppTexture:LPLPID3D11Resource;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateTextureFromFileW";


   function D3DX11CreateShaderResourceViewFromResourceA(pDevice:LPID3D11Device;hSrcModule:HMODULE;pSrcResource:LPCSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppShaderResourceView:LPLPID3D11ShaderResourceView;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateShaderResourceViewFromResourceA";
   function D3DX11CreateShaderResourceViewFromResource(pDevice:LPID3D11Device;hSrcModule:HMODULE;pSrcResource:LPCSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppShaderResourceView:LPLPID3D11ShaderResourceView;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateShaderResourceViewFromResourceA";

   function D3DX11CreateShaderResourceViewFromResourceW(pDevice:LPID3D11Device;hSrcModule:HMODULE;pSrcResource:LPCWSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppShaderResourceView:LPLPID3D11ShaderResourceView;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateShaderResourceViewFromResourceW";


   function D3DX11CreateTextureFromResourceA(pDevice:LPID3D11Device;hSrcModule:HMODULE;pSrcResource:LPCSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppTexture:LPLPID3D11Resource;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateTextureFromResourceA";
   function D3DX11CreateTextureFromResource(pDevice:LPID3D11Device;hSrcModule:HMODULE;pSrcResource:LPCSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppTexture:LPLPID3D11Resource;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateTextureFromResourceA";

   function D3DX11CreateTextureFromResourceW(pDevice:LPID3D11Device;hSrcModule:HMODULE;pSrcResource:LPCWSTR;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppTexture:LPLPID3D11Resource;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateTextureFromResourceW";


   function D3DX11CreateShaderResourceViewFromMemory(pDevice:LPID3D11Device;pSrcData:LPCVOID;SrcDataSize:SIZE_T;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppShaderResourceView:LPLPID3D11ShaderResourceView;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateShaderResourceViewFromMemory";

   function D3DX11CreateTextureFromMemory(pDevice:LPID3D11Device;pSrcData:LPCVOID;SrcDataSize:SIZE_T;pLoadInfo:LPD3DX11_IMAGE_LOAD_INFO;pPump:LPID3DX11ThreadPump;ppTexture:LPLPID3D11Resource;pHResult:LPHRESULT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11CreateTextureFromMemory";

   type tagD3DX11_TEXTURE_LOAD_INFO is record
      pSrcBox:LPD3D11_BOX;
      pDstBox:LPD3D11_BOX;
      SrcFirstMip: UINT;
      DstFirstMip: UINT;
      NumMips: UINT;
      SrcFirstElement: UINT;
      DstFirstElement: UINT;
      NumElements: UINT;
      Filter: UINT;
      MipFilter: UINT;
   end record;

   subtype D3DX11_TEXTURE_LOAD_INFO is tagD3DX11_TEXTURE_LOAD_INFO;

   type LPD3DX11_TEXTURE_LOAD_INFO is access all tagD3DX11_TEXTURE_LOAD_INFO;

   function D3DX11LoadTextureFromTexture(pContext:LPID3D11DeviceContext;pSrcTexture:LPID3D11Resource;pLoadInfo:LPD3DX11_TEXTURE_LOAD_INFO;pDstTexture:LPID3D11Resource) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11LoadTextureFromTexture";

   function D3DX11FilterTexture(pContext:LPID3D11DeviceContext;pTexture:LPID3D11Resource;SrcLevel:UINT;MipFilter:UINT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11FilterTexture";

   function D3DX11SaveTextureToFileA(pContext:LPID3D11DeviceContext;pSrcTexture:LPID3D11Resource;DestFormat:D3DX11_IMAGE_FILE_FORMAT;pDestFile:LPCSTR) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11SaveTextureToFileA";
   function D3DX11SaveTextureToFile(pContext:LPID3D11DeviceContext;pSrcTexture:LPID3D11Resource;DestFormat:D3DX11_IMAGE_FILE_FORMAT;pDestFile:LPCSTR) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11SaveTextureToFileA";

   function D3DX11SaveTextureToFileW(pContext:LPID3D11DeviceContext;pSrcTexture:LPID3D11Resource;DestFormat:D3DX11_IMAGE_FILE_FORMAT;pDestFile:LPCWSTR) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11SaveTextureToFileW";


   function D3DX11SaveTextureToMemory(pContext:LPID3D11DeviceContext;pSrcTexture:LPID3D11Resource;DestFormat:D3DX11_IMAGE_FILE_FORMAT;ppDestBuf:LPLPID3D10Blob;Flags:UINT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11SaveTextureToMemory";

   function D3DX11ComputeNormalMap(pContext:LPID3D11DeviceContext;pSrcTexture:LPID3D11Texture2D;Flags:UINT;Channel:UINT;Amplitude:FLOAT;pDestTexture:LPID3D11Texture2D) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11ComputeNormalMap";

   function D3DX11SHProjectCubeMap(pContext:LPID3D11DeviceContext;Order:UINT;pCubeMap:LPID3D11Texture2D;pROut:LPFLOAT;pGOut:LPFLOAT;pBOut:LPFLOAT) return HRESULT with Import,Convention=>stdcall,external_name=>"D3DX11SHProjectCubeMap";




end D3DX11tex;













猜你喜欢

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