· 6 years ago · Sep 17, 2019, 06:22 AM
1{******************************************************************************}
2{* *}
3{* Copyright (C) Microsoft Corporation. All Rights Reserved. *}
4{* *}
5{* Files: D3DX11.h *}
6{* Content: D3DX11 include files *}
7{* *}
8{* DirectX Delphi / FreePascal adaptation by Alexey Barkovoy *}
9{* E-Mail: directx@clootie.ru *}
10{* *}
11{* Latest version can be downloaded from: *}
12{* http://www.clootie.ru *}
13{* http://sourceforge.net/projects/delphi-dx9sdk *}
14{* *}
15{*----------------------------------------------------------------------------*}
16{* $Id: $ }
17{******************************************************************************}
18
19// Original source contained in "Winapi.D3DX11.par"
20
21unit Winapi.D3DX11;
22
23{$ALIGN ON}
24{$MINENUMSIZE 4}
25{$WEAKPACKAGEUNIT}
26{$WARN SYMBOL_PLATFORM OFF}
27
28interface
29
30{$HPPEMIT '#include "D3DX10.h"'}
31{$HPPEMIT '#include "D3DX11.h"'}
32{$HPPEMIT '#include "d3dtypes.h"'}
33{$HPPEMIT '#include "d3dcommon.h"'}
34{$HPPEMIT '#include "d3d11shader.h"'}
35
36uses
37 Winapi.Windows, Winapi.DxgiFormat, Winapi.D3D11, Winapi.D3DCommon, Winapi.D3D11Shader;
38
39type
40 PHResult = ^HRESULT; //Winapi.ActiveX
41
42 {$REGION 'DX11'}
43
44const
45 //////////// DLL export definitions ///////////////////////////////////////
46 d3dx11_retail_DLL = 'd3dx11_43.dll';
47 d3dx11_debug_DLL = 'd3dx11d_43.dll';
48 d3dx11dll = d3dx11_retail_DLL;
49
50//////////////////////////////////////////////////////////////////////////////
51//
52// Copyright (C) Microsoft Corporation. All Rights Reserved.
53//
54// File: d3dx11.h
55// Content: D3DX11 utility library
56//
57//////////////////////////////////////////////////////////////////////////////
58
59// Defines
60
61const
62 D3DX11_DEFAULT = -1;
63 {$EXTERNALSYM D3DX11_DEFAULT}
64 D3DX11_FROM_FILE = -3;
65 {$EXTERNALSYM D3DX11_FROM_FILE}
66 DXGI_FORMAT_FROM_FILE = DXGI_FORMAT(-3);
67 {$EXTERNALSYM DXGI_FORMAT_FROM_FILE}
68
69// Errors
70const
71 _FACDD = $876;
72 {$EXTERNALSYM _FACDD}
73
74// #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
75function MAKE_DDHRESULT(Code: DWord): DWord; inline;
76{$EXTERNALSYM MAKE_DDHRESULT}
77
78
79type
80 _D3DX11_ERR = DWORD;
81 {$EXTERNALSYM _D3DX11_ERR}
82
83const
84 MAKE_DDHRESULT_R = (1 shl 31) or (_FACDD shl 16);
85
86const
87 D3DX11_ERR_CANNOT_MODIFY_INDEX_BUFFER = HResult(MAKE_DDHRESULT_R or 2900);
88 {$EXTERNALSYM D3DX11_ERR_CANNOT_MODIFY_INDEX_BUFFER}
89 D3DX11_ERR_INVALID_MESH = HResult(MAKE_DDHRESULT_R or 2901);
90 {$EXTERNALSYM D3DX11_ERR_INVALID_MESH}
91 D3DX11_ERR_CANNOT_ATTR_SORT = HResult(MAKE_DDHRESULT_R or 2902);
92 {$EXTERNALSYM D3DX11_ERR_CANNOT_ATTR_SORT}
93 D3DX11_ERR_SKINNING_NOT_SUPPORTED = HResult(MAKE_DDHRESULT_R or 2903);
94 {$EXTERNALSYM D3DX11_ERR_SKINNING_NOT_SUPPORTED}
95 D3DX11_ERR_TOO_MANY_INFLUENCES = HResult(MAKE_DDHRESULT_R or 2904);
96 {$EXTERNALSYM D3DX11_ERR_TOO_MANY_INFLUENCES}
97 D3DX11_ERR_INVALID_DATA = HResult(MAKE_DDHRESULT_R or 2905);
98 {$EXTERNALSYM D3DX11_ERR_INVALID_DATA}
99 D3DX11_ERR_LOADED_MESH_HAS_NO_DATA = HResult(MAKE_DDHRESULT_R or 2906);
100 {$EXTERNALSYM D3DX11_ERR_LOADED_MESH_HAS_NO_DATA}
101 D3DX11_ERR_DUPLICATE_NAMED_FRAGMENT = HResult(MAKE_DDHRESULT_R or 2907);
102 {$EXTERNALSYM D3DX11_ERR_DUPLICATE_NAMED_FRAGMENT}
103 D3DX11_ERR_CANNOT_REMOVE_LAST_ITEM = HResult(MAKE_DDHRESULT_R or 2908);
104 {$EXTERNALSYM D3DX11_ERR_CANNOT_REMOVE_LAST_ITEM}
105
106
107///////////////////////////////////////////////////////////////////////////
108//
109// Copyright (C) Microsoft Corporation. All Rights Reserved.
110//
111// File: d3dx11core.h
112// Content: D3DX11 core types and functions
113//
114///////////////////////////////////////////////////////////////////////////
115
116// Current name of the DLL shipped in the same SDK as this header.
117const
118 D3DX11_DLL_W = d3dx11_retail_DLL;
119 {$EXTERNALSYM D3DX11_DLL_W}
120 D3DX11_DLL_A = d3dx11_retail_DLL;
121 {$EXTERNALSYM D3DX11_DLL_A}
122 D3DX11_DLL = d3dx11_retail_DLL;
123 {$EXTERNALSYM D3DX11_DLL}
124
125
126///////////////////////////////////////////////////////////////////////////
127// D3DX11_SDK_VERSION:
128// -----------------
129// This identifier is passed to D3DX11CheckVersion in order to ensure that an
130// application was built against the correct header files and lib files.
131// This number is incremented whenever a header (or other) change would
132// require applications to be rebuilt. If the version doesn't match,
133// D3DX11CreateVersion will return FALSE. (The number itself has no meaning.)
134///////////////////////////////////////////////////////////////////////////
135
136const
137 D3DX11_SDK_VERSION = 43;
138 {$EXTERNALSYM D3DX11_SDK_VERSION}
139
140function D3DX11CheckVersion(D3DSdkVersion: UINT; D3DX11SdkVersion: UINT): HResult; stdcall; external d3dx11dll delayed;
141{$EXTERNALSYM D3DX11CheckVersion}
142
143//////////////////////////////////////////////////////////////////////////////
144// ID3DX11ThreadPump:
145//////////////////////////////////////////////////////////////////////////////
146
147type
148 {$EXTERNALSYM ID3DX11DataLoader}
149
150 ID3DX11DataLoader = class
151 function Load(): HResult; virtual; stdcall; abstract;
152 function Decompress(ppData: PPointer; pcBytes: PSIZE_T): HResult; virtual; stdcall; abstract;
153 {$WARNINGS OFF}
154 function Destroy(): HResult; virtual; stdcall; abstract;
155 {$WARNINGS ON}
156 end;
157
158
159
160 {$EXTERNALSYM ID3DX11DataProcessor}
161
162 ID3DX11DataProcessor = class
163 function Process(pData: Pointer; cBytes: SIZE_T): HResult; virtual; stdcall; abstract;
164 function CreateDeviceObject(out ppDataObject: Pointer): HResult; virtual; stdcall; abstract;
165 {$WARNINGS OFF}
166 function Destroy(): HResult; virtual; stdcall; abstract;
167 {$WARNINGS ON}
168 end;
169
170
171
172 {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID3DX11ThreadPump);'}
173 {$EXTERNALSYM ID3DX11ThreadPump}
174 ID3DX11ThreadPump = interface (IUnknown)
175 ['{C93FECFA-6967-478a-ABBC-402D90621FCB}']
176 // ID3DX11ThreadPump
177 function AddWorkItem(const pDataLoader: ID3DX11DataLoader; const pDataProcessor: ID3DX11DataProcessor; pHResult: PHRESULT; ppDeviceObject: PPointer): HResult; stdcall;
178 function GetWorkItemCount(): UINT; stdcall;
179
180 function WaitForAllItems(): HResult; stdcall;
181 function ProcessDeviceWorkItems(iWorkItemCount: UINT): HResult; stdcall;
182
183
184 function PurgeAllItems(): HResult; stdcall;
185 function GetQueueStatus(pIoQueue: PUINT; pProcessQueue: PUINT; pDeviceQueue: PUINT): HResult; stdcall;
186 end;
187
188
189function D3DX11CreateThreadPump(cIoThreads: UINT; cProcThreads: UINT; out ppThreadPump: ID3DX11ThreadPump): HResult; stdcall; external d3dx11dll delayed;
190{$EXTERNALSYM D3DX11CreateThreadPump}
191
192
193const
194 _FACD3D = $876;
195 {$EXTERNALSYM _FACD3D}
196
197// #define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code )
198function MAKE_D3DHRESULT(Code: DWord): DWord;
199{$EXTERNALSYM MAKE_D3DHRESULT}
200// #define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code )
201function MAKE_D3DSTATUS(Code: DWord): DWord;
202{$EXTERNALSYM MAKE_D3DSTATUS}
203
204const
205 MAKE_D3DHRESULT_R = (1 shl 31) or (_FACD3D shl 16);
206 {$EXTERNALSYM MAKE_D3DHRESULT_R}
207
208const
209 D3DERR_INVALIDCALL = HResult(MAKE_D3DHRESULT_R or 2156);
210 {$EXTERNALSYM D3DERR_INVALIDCALL}
211 D3DERR_WASSTILLDRAWING = HResult(MAKE_D3DHRESULT_R or 540);
212 {$EXTERNALSYM D3DERR_WASSTILLDRAWING}
213
214
215//////////////////////////////////////////////////////////////////////////////
216//
217// Copyright (C) Microsoft Corporation. All Rights Reserved.
218//
219// File: d3dx11tex.h
220// Content: D3DX11 texturing APIs
221//
222//////////////////////////////////////////////////////////////////////////////
223
224//----------------------------------------------------------------------------
225// D3DX11_FILTER flags:
226// ------------------
227//
228// A valid filter must contain one of these values:
229//
230// D3DX11_FILTER_NONE
231// No scaling or filtering will take place. Pixels outside the bounds
232// of the source image are assumed to be transparent black.
233// D3DX11_FILTER_POINT
234// Each destination pixel is computed by sampling the nearest pixel
235// from the source image.
236// D3DX11_FILTER_LINEAR
237// Each destination pixel is computed by linearly interpolating between
238// the nearest pixels in the source image. This filter works best
239// when the scale on each axis is less than 2.
240// D3DX11_FILTER_TRIANGLE
241// Every pixel in the source image contributes equally to the
242// destination image. This is the slowest of all the filters.
243// D3DX11_FILTER_BOX
244// Each pixel is computed by averaging a 2x2(x2) box pixels from
245// the source image. Only works when the dimensions of the
246// destination are half those of the source. (as with mip maps)
247//
248// And can be OR'd with any of these optional flags:
249//
250// D3DX11_FILTER_MIRROR_U
251// Indicates that pixels off the edge of the texture on the U-axis
252// should be mirrored, not wraped.
253// D3DX11_FILTER_MIRROR_V
254// Indicates that pixels off the edge of the texture on the V-axis
255// should be mirrored, not wraped.
256// D3DX11_FILTER_MIRROR_W
257// Indicates that pixels off the edge of the texture on the W-axis
258// should be mirrored, not wraped.
259// D3DX11_FILTER_MIRROR
260// Same as specifying D3DX11_FILTER_MIRROR_U | D3DX11_FILTER_MIRROR_V |
261// D3DX11_FILTER_MIRROR_V
262// D3DX11_FILTER_DITHER
263// Dithers the resulting image using a 4x4 order dither pattern.
264// D3DX11_FILTER_SRGB_IN
265// Denotes that the input data is in sRGB (gamma 2.2) colorspace.
266// D3DX11_FILTER_SRGB_OUT
267// Denotes that the output data is in sRGB (gamma 2.2) colorspace.
268// D3DX11_FILTER_SRGB
269// Same as specifying D3DX11_FILTER_SRGB_IN | D3DX11_FILTER_SRGB_OUT
270//
271//----------------------------------------------------------------------------
272
273type
274 D3DX11_FILTER_FLAG = Cardinal;
275 {$EXTERNALSYM D3DX11_FILTER_FLAG}
276
277const
278 D3DX11_FILTER_NONE = (1 shl 0);
279 {$EXTERNALSYM D3DX11_FILTER_NONE}
280 D3DX11_FILTER_POINT = (2 shl 0);
281 {$EXTERNALSYM D3DX11_FILTER_POINT}
282 D3DX11_FILTER_LINEAR = (3 shl 0);
283 {$EXTERNALSYM D3DX11_FILTER_LINEAR}
284 D3DX11_FILTER_TRIANGLE = (4 shl 0);
285 {$EXTERNALSYM D3DX11_FILTER_TRIANGLE}
286 D3DX11_FILTER_BOX = (5 shl 0);
287 {$EXTERNALSYM D3DX11_FILTER_BOX}
288
289 D3DX11_FILTER_MIRROR_U = (1 shl 16);
290 {$EXTERNALSYM D3DX11_FILTER_MIRROR_U}
291 D3DX11_FILTER_MIRROR_V = (2 shl 16);
292 {$EXTERNALSYM D3DX11_FILTER_MIRROR_V}
293 D3DX11_FILTER_MIRROR_W = (4 shl 16);
294 {$EXTERNALSYM D3DX11_FILTER_MIRROR_W}
295 D3DX11_FILTER_MIRROR = (7 shl 16);
296 {$EXTERNALSYM D3DX11_FILTER_MIRROR}
297
298 D3DX11_FILTER_DITHER = (1 shl 19);
299 {$EXTERNALSYM D3DX11_FILTER_DITHER}
300 D3DX11_FILTER_DITHER_DIFFUSION= (2 shl 19);
301 {$EXTERNALSYM D3DX11_FILTER_DITHER_DIFFUSION}
302
303 D3DX11_FILTER_SRGB_IN = (1 shl 21);
304 {$EXTERNALSYM D3DX11_FILTER_SRGB_IN}
305 D3DX11_FILTER_SRGB_OUT = (2 shl 21);
306 {$EXTERNALSYM D3DX11_FILTER_SRGB_OUT}
307 D3DX11_FILTER_SRGB = (3 shl 21);
308 {$EXTERNALSYM D3DX11_FILTER_SRGB}
309
310//----------------------------------------------------------------------------
311// D3DX11_NORMALMAP flags:
312// ---------------------
313// These flags are used to control how D3DX11ComputeNormalMap generates normal
314// maps. Any number of these flags may be OR'd together in any combination.
315//
316// D3DX11_NORMALMAP_MIRROR_U
317// Indicates that pixels off the edge of the texture on the U-axis
318// should be mirrored, not wraped.
319// D3DX11_NORMALMAP_MIRROR_V
320// Indicates that pixels off the edge of the texture on the V-axis
321// should be mirrored, not wraped.
322// D3DX11_NORMALMAP_MIRROR
323// Same as specifying D3DX11_NORMALMAP_MIRROR_U | D3DX11_NORMALMAP_MIRROR_V
324// D3DX11_NORMALMAP_INVERTSIGN
325// Inverts the direction of each normal
326// D3DX11_NORMALMAP_COMPUTE_OCCLUSION
327// Compute the per pixel Occlusion term and encodes it into the alpha.
328// An Alpha of 1 means that the pixel is not obscured in anyway, and
329// an alpha of 0 would mean that the pixel is completly obscured.
330//
331//----------------------------------------------------------------------------
332
333type
334 D3DX11_NORMALMAP_FLAG = Cardinal;
335 {$EXTERNALSYM D3DX11_NORMALMAP_FLAG}
336
337const
338 D3DX11_NORMALMAP_MIRROR_U = (1 shl 16);
339 {$EXTERNALSYM D3DX11_NORMALMAP_MIRROR_U}
340 D3DX11_NORMALMAP_MIRROR_V = (2 shl 16);
341 {$EXTERNALSYM D3DX11_NORMALMAP_MIRROR_V}
342 D3DX11_NORMALMAP_MIRROR = (3 shl 16);
343 {$EXTERNALSYM D3DX11_NORMALMAP_MIRROR}
344 D3DX11_NORMALMAP_INVERTSIGN = (8 shl 16);
345 {$EXTERNALSYM D3DX11_NORMALMAP_INVERTSIGN}
346 D3DX11_NORMALMAP_COMPUTE_OCCLUSION = (16 shl 16);
347 {$EXTERNALSYM D3DX11_NORMALMAP_COMPUTE_OCCLUSION}
348
349
350//----------------------------------------------------------------------------
351// D3DX11_CHANNEL flags:
352// -------------------
353// These flags are used by functions which operate on or more channels
354// in a texture.
355//
356// D3DX11_CHANNEL_RED
357// Indicates the red channel should be used
358// D3DX11_CHANNEL_BLUE
359// Indicates the blue channel should be used
360// D3DX11_CHANNEL_GREEN
361// Indicates the green channel should be used
362// D3DX11_CHANNEL_ALPHA
363// Indicates the alpha channel should be used
364// D3DX11_CHANNEL_LUMINANCE
365// Indicates the luminaces of the red green and blue channels should be
366// used.
367//
368//----------------------------------------------------------------------------
369
370type
371 D3DX11_CHANNEL_FLAG = Cardinal;
372 {$EXTERNALSYM D3DX11_CHANNEL_FLAG}
373
374const
375 D3DX11_CHANNEL_RED = (1 shl 0);
376 {$EXTERNALSYM D3DX11_CHANNEL_RED}
377 D3DX11_CHANNEL_BLUE = (1 shl 1);
378 {$EXTERNALSYM D3DX11_CHANNEL_BLUE}
379 D3DX11_CHANNEL_GREEN = (1 shl 2);
380 {$EXTERNALSYM D3DX11_CHANNEL_GREEN}
381 D3DX11_CHANNEL_ALPHA = (1 shl 3);
382 {$EXTERNALSYM D3DX11_CHANNEL_ALPHA}
383 D3DX11_CHANNEL_LUMINANCE = (1 shl 4);
384 {$EXTERNALSYM D3DX11_CHANNEL_LUMINANCE}
385
386
387//----------------------------------------------------------------------------
388// D3DX11_IMAGE_FILE_FORMAT:
389// ---------------------
390// This enum is used to describe supported image file formats.
391//
392//----------------------------------------------------------------------------
393
394type
395 PD3DX11ImageFileFormat = ^TD3DX11ImageFileFormat;
396 D3DX11_IMAGE_FILE_FORMAT =
397 (
398 D3DX11_IFF_BMP = 0,
399 D3DX11_IFF_JPG = 1,
400 D3DX11_IFF_PNG = 3,
401 D3DX11_IFF_DDS = 4,
402 D3DX11_IFF_TIFF = 10,
403 D3DX11_IFF_GIF = 11,
404 D3DX11_IFF_WMP = 12,
405 D3DX11_IFF_FORCE_DWORD = $7fffffff
406 );
407 {$EXTERNALSYM D3DX11_IMAGE_FILE_FORMAT}
408 TD3DX11ImageFileFormat = D3DX11_IMAGE_FILE_FORMAT;
409
410
411//----------------------------------------------------------------------------
412// D3DX11_SAVE_TEXTURE_FLAG:
413// ---------------------
414// This enum is used to support texture saving options.
415//
416//----------------------------------------------------------------------------
417
418type
419 D3DX11_SAVE_TEXTURE_FLAG = Cardinal;
420 {$EXTERNALSYM D3DX11_SAVE_TEXTURE_FLAG}
421
422const
423 D3DX11_STF_USEINPUTBLOB = $0001;
424 {$EXTERNALSYM D3DX11_STF_USEINPUTBLOB}
425
426
427//----------------------------------------------------------------------------
428// D3DX11_IMAGE_INFO:
429// ---------------
430// This structure is used to return a rough description of what the
431// the original contents of an image file looked like.
432//
433// Width
434// Width of original image in pixels
435// Height
436// Height of original image in pixels
437// Depth
438// Depth of original image in pixels
439// ArraySize
440// Array size in textures
441// MipLevels
442// Number of mip levels in original image
443// MiscFlags
444// Miscellaneous flags
445// Format
446// D3D format which most closely describes the data in original image
447// ResourceDimension
448// D3D11_RESOURCE_DIMENSION representing the dimension of texture stored in the file.
449// D3D11_RESOURCE_DIMENSION_TEXTURE1D, 2D, 3D
450// ImageFileFormat
451// D3DX11_IMAGE_FILE_FORMAT representing the format of the image file.
452//----------------------------------------------------------------------------
453
454type
455 PD3DX11ImageInfo = ^TD3DX11ImageInfo;
456 D3DX11_IMAGE_INFO = record
457 Width: UINT;
458 Height: UINT;
459 Depth: UINT;
460 ArraySize: UINT;
461 MipLevels: UINT;
462 MiscFlags: UINT;
463 Format: DXGI_FORMAT;
464 ResourceDimension: D3D11_RESOURCE_DIMENSION;
465 ImageFileFormat: D3DX11_IMAGE_FILE_FORMAT;
466 end;
467 {$EXTERNALSYM D3DX11_IMAGE_INFO}
468 TD3DX11ImageInfo = D3DX11_IMAGE_INFO;
469
470
471
472//////////////////////////////////////////////////////////////////////////////
473// Image File APIs ///////////////////////////////////////////////////////////
474//////////////////////////////////////////////////////////////////////////////
475
476//----------------------------------------------------------------------------
477// D3DX11_IMAGE_LOAD_INFO:
478// ---------------
479// This structure can be optionally passed in to texture loader APIs to
480// control how textures get loaded. Pass in D3DX11_DEFAULT for any of these
481// to have D3DX automatically pick defaults based on the source file.
482//
483// Width
484// Rescale texture to Width texels wide
485// Height
486// Rescale texture to Height texels high
487// Depth
488// Rescale texture to Depth texels deep
489// FirstMipLevel
490// First mip level to load
491// MipLevels
492// Number of mip levels to load after the first level
493// Usage
494// D3D11_USAGE flag for the new texture
495// BindFlags
496// D3D11 Bind flags for the new texture
497// CpuAccessFlags
498// D3D11 CPU Access flags for the new texture
499// MiscFlags
500// Reserved. Must be 0
501// Format
502// Resample texture to the specified format
503// Filter
504// Filter the texture using the specified filter (only when resampling)
505// MipFilter
506// Filter the texture mip levels using the specified filter (only if
507// generating mips)
508// pSrcInfo
509// (optional) pointer to a D3DX11_IMAGE_INFO structure that will get
510// populated with source image information
511//----------------------------------------------------------------------------
512
513type
514 PD3DX11ImageLoadInfo = ^TD3DX11ImageLoadInfo;
515 D3DX11_IMAGE_LOAD_INFO = record
516 Width: UINT;
517 Height: UINT;
518 Depth: UINT;
519 FirstMipLevel: UINT;
520 MipLevels: UINT;
521 Usage: D3D11_USAGE;
522 BindFlags: UINT;
523 CpuAccessFlags: UINT;
524 MiscFlags: UINT;
525 Format: DXGI_FORMAT;
526 Filter: UINT;
527 MipFilter: UINT;
528 pSrcInfo: PD3DX11ImageInfo;
529 end;
530 {$EXTERNALSYM D3DX11_IMAGE_LOAD_INFO}
531 TD3DX11ImageLoadInfo = D3DX11_IMAGE_LOAD_INFO;
532
533const
534 D3DX11_IMAGE_LOAD_INFO_default : TD3DX11ImageLoadInfo =
535 (
536 Width : UINT(D3DX11_DEFAULT);
537 Height : UINT(D3DX11_DEFAULT);
538 Depth : UINT(D3DX11_DEFAULT);
539 FirstMipLevel : UINT(D3DX11_DEFAULT);
540 MipLevels : UINT(D3DX11_DEFAULT);
541 Usage : D3D11_USAGE(D3DX11_DEFAULT);
542 BindFlags : UINT(D3DX11_DEFAULT);
543 CpuAccessFlags: UINT(D3DX11_DEFAULT);
544 MiscFlags : UINT(D3DX11_DEFAULT);
545 Format : DXGI_FORMAT_FROM_FILE;
546 Filter : UINT(D3DX11_DEFAULT);
547 MipFilter : UINT(D3DX11_DEFAULT);
548 pSrcInfo : nil;
549 );
550
551
552//-------------------------------------------------------------------------------
553// GetImageInfoFromFile/Resource/Memory:
554// ------------------------------
555// Fills in a D3DX11_IMAGE_INFO struct with information about an image file.
556//
557// Parameters:
558// pSrcFile
559// File name of the source image.
560// pSrcModule
561// Module where resource is located, or NULL for module associated
562// with image the os used to create the current process.
563// pSrcResource
564// Resource name.
565// pSrcData
566// Pointer to file in memory.
567// SrcDataSize
568// Size in bytes of file in memory.
569// pPump
570// Optional pointer to a thread pump object to use.
571// pSrcInfo
572// Pointer to a D3DX11_IMAGE_INFO structure to be filled in with the
573// description of the data in the source image file.
574// pHResult
575// Pointer to a memory location to receive the return value upon completion.
576// Maybe NULL if not needed.
577// If pPump != NULL, pHResult must be a valid memory location until the
578// the asynchronous execution completes.
579//-------------------------------------------------------------------------------
580
581function D3DX11GetImageInfoFromFile(
582 pSrcFile: LPCWSTR;
583 pPump: ID3DX11ThreadPump;
584 pSrcInfo: PD3DX11ImageInfo;
585 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11GetImageInfoFromFileW' delayed;
586{$EXTERNALSYM D3DX11GetImageInfoFromFile}
587function D3DX11GetImageInfoFromFileA(
588 pSrcFile: LPCSTR;
589 pPump: ID3DX11ThreadPump;
590 pSrcInfo: PD3DX11ImageInfo;
591 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11GetImageInfoFromFileA' delayed;
592{$EXTERNALSYM D3DX11GetImageInfoFromFileA}
593function D3DX11GetImageInfoFromFileW(
594 pSrcFile: LPCWSTR;
595 pPump: ID3DX11ThreadPump;
596 pSrcInfo: PD3DX11ImageInfo;
597 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11GetImageInfoFromFileW' delayed;
598{$EXTERNALSYM D3DX11GetImageInfoFromFileW}
599
600function D3DX11GetImageInfoFromResource(
601 hSrcModule: HMODULE;
602 pSrcResource: LPCWSTR;
603 pPump: ID3DX11ThreadPump;
604 pSrcInfo: D3DX11_IMAGE_INFO;
605 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11GetImageInfoFromResourceW' delayed;
606{$EXTERNALSYM D3DX11GetImageInfoFromResource}
607function D3DX11GetImageInfoFromResourceA(
608 hSrcModule: HMODULE;
609 pSrcResource: LPCSTR;
610 pPump: ID3DX11ThreadPump;
611 pSrcInfo: D3DX11_IMAGE_INFO;
612 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11GetImageInfoFromResourceA' delayed;
613{$EXTERNALSYM D3DX11GetImageInfoFromResourceA}
614function D3DX11GetImageInfoFromResourceW(
615 hSrcModule: HMODULE;
616 pSrcResource: LPCWSTR;
617 pPump: ID3DX11ThreadPump;
618 pSrcInfo: D3DX11_IMAGE_INFO;
619 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11GetImageInfoFromResourceW' delayed;
620{$EXTERNALSYM D3DX11GetImageInfoFromResourceW}
621
622function D3DX11GetImageInfoFromMemory(
623 pSrcData: Pointer;
624 SrcDataSize: SIZE_T;
625 pPump: ID3DX11ThreadPump;
626 pSrcInfo: D3DX11_IMAGE_INFO;
627 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11GetImageInfoFromMemory' delayed;
628{$EXTERNALSYM D3DX11GetImageInfoFromMemory}
629
630//////////////////////////////////////////////////////////////////////////////
631// Create/Save Texture APIs //////////////////////////////////////////////////
632//////////////////////////////////////////////////////////////////////////////
633
634//----------------------------------------------------------------------------
635// D3DX11CreateTextureFromFile/Resource/Memory:
636// D3DX11CreateShaderResourceViewFromFile/Resource/Memory:
637// -----------------------------------
638// Create a texture object from a file or resource.
639//
640// Parameters:
641//
642// pDevice
643// The D3D device with which the texture is going to be used.
644// pSrcFile
645// File name.
646// hSrcModule
647// Module handle. if NULL, current module will be used.
648// pSrcResource
649// Resource name in module
650// pvSrcData
651// Pointer to file in memory.
652// SrcDataSize
653// Size in bytes of file in memory.
654// pLoadInfo
655// Optional pointer to a D3DX11_IMAGE_LOAD_INFO structure that
656// contains additional loader parameters.
657// pPump
658// Optional pointer to a thread pump object to use.
659// ppTexture
660// [out] Created texture object.
661// ppShaderResourceView
662// [out] Shader resource view object created.
663// pHResult
664// Pointer to a memory location to receive the return value upon completion.
665// Maybe NULL if not needed.
666// If pPump != NULL, pHResult must be a valid memory location until the
667// the asynchronous execution completes.
668//
669//----------------------------------------------------------------------------
670
671// FromFile
672
673function D3DX11CreateShaderResourceViewFromFile(
674 const pDevice: ID3D11Device;
675 pSrcFile: LPCWSTR;
676 pLoadInfo: PD3DX11ImageLoadInfo;
677 pPump: ID3DX11ThreadPump;
678 out ppShaderResourceView: ID3D11ShaderResourceView;
679 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateShaderResourceViewFromFileW' delayed;
680{$EXTERNALSYM D3DX11CreateShaderResourceViewFromFile}
681function D3DX11CreateShaderResourceViewFromFileA(
682 const pDevice: ID3D11Device;
683 pSrcFile: LPCSTR;
684 pLoadInfo: PD3DX11ImageLoadInfo;
685 pPump: ID3DX11ThreadPump;
686 out ppShaderResourceView: ID3D11ShaderResourceView;
687 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateShaderResourceViewFromFileA' delayed;
688{$EXTERNALSYM D3DX11CreateShaderResourceViewFromFileA}
689function D3DX11CreateShaderResourceViewFromFileW(
690 const pDevice: ID3D11Device;
691 pSrcFile: LPCWSTR;
692 pLoadInfo: PD3DX11ImageLoadInfo;
693 pPump: ID3DX11ThreadPump;
694 out ppShaderResourceView: ID3D11ShaderResourceView;
695 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateShaderResourceViewFromFileW' delayed;
696{$EXTERNALSYM D3DX11CreateShaderResourceViewFromFileW}
697
698function D3DX11CreateTextureFromFile(
699 const pDevice: ID3D11Device;
700 pSrcFile: LPCWSTR;
701 pLoadInfo: PD3DX11ImageLoadInfo;
702 pPump: ID3DX11ThreadPump;
703 out ppTexture: ID3D11Resource;
704 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateTextureFromFileW' delayed;
705{$EXTERNALSYM D3DX11CreateTextureFromFile}
706function D3DX11CreateTextureFromFileA(
707 const pDevice: ID3D11Device;
708 pSrcFile: LPCSTR;
709 pLoadInfo: PD3DX11ImageLoadInfo;
710 pPump: ID3DX11ThreadPump;
711 out ppTexture: ID3D11Resource;
712 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateTextureFromFileA' delayed;
713{$EXTERNALSYM D3DX11CreateTextureFromFileA}
714function D3DX11CreateTextureFromFileW(
715 const pDevice: ID3D11Device;
716 pSrcFile: LPCWSTR;
717 pLoadInfo: PD3DX11ImageLoadInfo;
718 pPump: ID3DX11ThreadPump;
719 out ppTexture: ID3D11Resource;
720 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateTextureFromFileW' delayed;
721{$EXTERNALSYM D3DX11CreateTextureFromFileW}
722
723// FromResource (resources in dll/exes)
724function D3DX11CreateShaderResourceViewFromResource(
725 const pDevice: ID3D11Device;
726 hSrcModule: HMODULE;
727 pSrcResource: LPCWSTR;
728 pLoadInfo: PD3DX11ImageLoadInfo;
729 pPump: ID3DX11ThreadPump;
730 out ppShaderResourceView: ID3D11ShaderResourceView;
731 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateShaderResourceViewFromResourceW' delayed;
732{$EXTERNALSYM D3DX11CreateShaderResourceViewFromResource}
733function D3DX11CreateShaderResourceViewFromResourceA(
734 const pDevice: ID3D11Device;
735 hSrcModule: HMODULE;
736 pSrcResource: LPCSTR;
737 pLoadInfo: PD3DX11ImageLoadInfo;
738 pPump: ID3DX11ThreadPump;
739 out ppShaderResourceView: ID3D11ShaderResourceView;
740 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateShaderResourceViewFromResourceA' delayed;
741{$EXTERNALSYM D3DX11CreateShaderResourceViewFromResourceA}
742function D3DX11CreateShaderResourceViewFromResourceW(
743 const pDevice: ID3D11Device;
744 hSrcModule: HMODULE;
745 pSrcResource: LPCWSTR;
746 pLoadInfo: PD3DX11ImageLoadInfo;
747 pPump: ID3DX11ThreadPump;
748 out ppShaderResourceView: ID3D11ShaderResourceView;
749 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateShaderResourceViewFromResourceW' delayed;
750{$EXTERNALSYM D3DX11CreateShaderResourceViewFromResourceW}
751
752function D3DX11CreateTextureFromResource(
753 const pDevice: ID3D11Device;
754 hSrcModule: HMODULE;
755 pSrcResource: LPCWSTR;
756 pLoadInfo: PD3DX11ImageLoadInfo;
757 pPump: ID3DX11ThreadPump;
758 out ppTexture: ID3D11Resource;
759 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateTextureFromResourceW' delayed;
760{$EXTERNALSYM D3DX11CreateTextureFromResource}
761function D3DX11CreateTextureFromResourceA(
762 const pDevice: ID3D11Device;
763 hSrcModule: HMODULE;
764 pSrcResource: LPCSTR;
765 pLoadInfo: PD3DX11ImageLoadInfo;
766 pPump: ID3DX11ThreadPump;
767 out ppTexture: ID3D11Resource;
768 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateTextureFromResourceA' delayed;
769{$EXTERNALSYM D3DX11CreateTextureFromResourceA}
770function D3DX11CreateTextureFromResourceW(
771 const pDevice: ID3D11Device;
772 hSrcModule: HMODULE;
773 pSrcResource: LPCWSTR;
774 pLoadInfo: PD3DX11ImageLoadInfo;
775 pPump: ID3DX11ThreadPump;
776 out ppTexture: ID3D11Resource;
777 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateTextureFromResourceW' delayed;
778{$EXTERNALSYM D3DX11CreateTextureFromResourceW}
779
780// FromFileInMemory
781
782function D3DX11CreateShaderResourceViewFromMemory(
783 const pDevice: ID3D11Device;
784 pSrcData: Pointer;
785 SrcDataSize: SIZE_T;
786 pLoadInfo: PD3DX11ImageLoadInfo;
787 pPump: ID3DX11ThreadPump;
788 out ppShaderResourceView: ID3D11ShaderResourceView;
789 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateShaderResourceViewFromMemory' delayed;
790{$EXTERNALSYM D3DX11CreateShaderResourceViewFromMemory}
791
792function D3DX11CreateTextureFromMemory(
793 const pDevice: ID3D11Device;
794 pSrcData: Pointer;
795 SrcDataSize: SIZE_T;
796 pLoadInfo: PD3DX11ImageLoadInfo;
797 pPump: ID3DX11ThreadPump;
798 out ppTexture: ID3D11Resource;
799 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CreateTextureFromMemory' delayed;
800{$EXTERNALSYM D3DX11CreateTextureFromMemory}
801
802//////////////////////////////////////////////////////////////////////////////
803// Misc Texture APIs /////////////////////////////////////////////////////////
804//////////////////////////////////////////////////////////////////////////////
805
806
807//----------------------------------------------------------------------------
808// D3DX11_TEXTURE_LOAD_INFO:
809// ------------------------
810//
811//----------------------------------------------------------------------------
812
813type
814 PD3DX11_TextureLoadInfo = ^TD3DX11_TextureLoadInfo;
815 _D3DX11_TEXTURE_LOAD_INFO = record
816 pSrcBox: PD3D11_Box;
817 pDstBox: PD3D11_Box;
818 SrcFirstMip: UINT;
819 DstFirstMip: UINT;
820 NumMips: UINT;
821 SrcFirstElement: UINT;
822 DstFirstElement: UINT;
823 NumElements: UINT;
824 Filter: UINT;
825 MipFilter: UINT;
826 end;
827 {$EXTERNALSYM _D3DX11_TEXTURE_LOAD_INFO}
828 D3DX11_TEXTURE_LOAD_INFO = _D3DX11_TEXTURE_LOAD_INFO;
829 {$EXTERNALSYM D3DX11_TEXTURE_LOAD_INFO}
830 TD3DX11_TextureLoadInfo = _D3DX11_TEXTURE_LOAD_INFO;
831
832const
833 D3DX11_TEXTURE_LOAD_INFO_default : TD3DX11_TextureLoadInfo =
834 (
835 pSrcBox : nil;
836 pDstBox : nil;
837 SrcFirstMip : 0;
838 DstFirstMip : 0;
839 NumMips : UINT(D3DX11_DEFAULT);
840 SrcFirstElement : 0;
841 DstFirstElement : 0;
842 NumElements : UINT(D3DX11_DEFAULT);
843 Filter : UINT(D3DX11_DEFAULT);
844 MipFilter : UINT(D3DX11_DEFAULT);
845 );
846
847
848//----------------------------------------------------------------------------
849// D3DX11LoadTextureFromTexture:
850// ----------------------------
851// Load a texture from a texture.
852//
853// Parameters:
854//
855//----------------------------------------------------------------------------
856
857function D3DX11LoadTextureFromTexture(
858 pContext: ID3D11DeviceContext;
859 pSrcTexture: ID3D11Resource;
860 pLoadInfo: PD3DX11_TextureLoadInfo;
861 pDstTexture: ID3D11Resource): HResult; stdcall; external d3dx11dll name 'D3DX11LoadTextureFromTexture' delayed;
862{$EXTERNALSYM D3DX11LoadTextureFromTexture}
863
864
865//----------------------------------------------------------------------------
866// D3DX11FilterTexture:
867// ------------------
868// Filters mipmaps levels of a texture.
869//
870// Parameters:
871// pBaseTexture
872// The texture object to be filtered
873// SrcLevel
874// The level whose image is used to generate the subsequent levels.
875// MipFilter
876// D3DX11_FILTER flags controlling how each miplevel is filtered.
877// Or D3DX11_DEFAULT for D3DX11_FILTER_BOX,
878//
879//----------------------------------------------------------------------------
880
881function D3DX11FilterTexture(
882 pContext: ID3D11DeviceContext;
883 pTexture: ID3D11Resource;
884 SrcLevel: UINT;
885 MipFilter: UINT): HResult; stdcall; external d3dx11dll name 'D3DX11FilterTexture' delayed;
886{$EXTERNALSYM D3DX11FilterTexture}
887
888
889//----------------------------------------------------------------------------
890// D3DX11SaveTextureToFile:
891// ----------------------
892// Save a texture to a file.
893//
894// Parameters:
895// pDestFile
896// File name of the destination file
897// DestFormat
898// D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving.
899// pSrcTexture
900// Source texture, containing the image to be saved
901//
902//----------------------------------------------------------------------------
903
904function D3DX11SaveTextureToFile(
905 pContext: ID3D11DeviceContext;
906 pSrcTexture: ID3D11Resource;
907 DestFormat: D3DX11_IMAGE_FILE_FORMAT;
908 pDestFile: LPCWSTR): HResult; stdcall; external d3dx11dll name 'D3DX11SaveTextureToFileW' delayed;
909{$EXTERNALSYM D3DX11SaveTextureToFile}
910function D3DX11SaveTextureToFileA(
911 pContext: ID3D11DeviceContext;
912 pSrcTexture: ID3D11Resource;
913 DestFormat: D3DX11_IMAGE_FILE_FORMAT;
914 pDestFile: LPCSTR): HResult; stdcall; external d3dx11dll name 'D3DX11SaveTextureToFileA' delayed;
915{$EXTERNALSYM D3DX11SaveTextureToFileA}
916function D3DX11SaveTextureToFileW(
917 pContext: ID3D11DeviceContext;
918 pSrcTexture: ID3D11Resource;
919 DestFormat: D3DX11_IMAGE_FILE_FORMAT;
920 pDestFile: LPCWSTR): HResult; stdcall; external d3dx11dll name 'D3DX11SaveTextureToFileW' delayed;
921{$EXTERNALSYM D3DX11SaveTextureToFileW}
922
923
924//----------------------------------------------------------------------------
925// D3DX11SaveTextureToMemory:
926// ----------------------
927// Save a texture to a blob.
928//
929// Parameters:
930// pSrcTexture
931// Source texture, containing the image to be saved
932// DestFormat
933// D3DX11_IMAGE_FILE_FORMAT specifying file format to use when saving.
934// ppDestBuf
935// address of a d3dxbuffer pointer to return the image data
936// Flags
937// optional flags
938//----------------------------------------------------------------------------
939
940function D3DX11SaveTextureToMemory(
941 pContext: ID3D11DeviceContext;
942 pSrcTexture: ID3D11Resource;
943 DestFormat: D3DX11_IMAGE_FILE_FORMAT;
944 out ppDestBuf: ID3DBlob;
945 Flags: UINT): HResult; stdcall; external d3dx11dll name 'D3DX11SaveTextureToMemory' delayed;
946{$EXTERNALSYM D3DX11SaveTextureToMemory}
947
948
949//----------------------------------------------------------------------------
950// D3DX11ComputeNormalMap:
951// ---------------------
952// Converts a height map into a normal map. The (x,y,z) components of each
953// normal are mapped to the (r,g,b) channels of the output texture.
954//
955// Parameters
956// pSrcTexture
957// Pointer to the source heightmap texture
958// Flags
959// D3DX11_NORMALMAP flags
960// Channel
961// D3DX11_CHANNEL specifying source of height information
962// Amplitude
963// The constant value which the height information is multiplied by.
964// pDestTexture
965// Pointer to the destination texture
966//---------------------------------------------------------------------------
967
968function D3DX11ComputeNormalMap(
969 pContext: ID3D11DeviceContext;
970 pSrcTexture: ID3D11Texture2D;
971 Flags: UINT;
972 Channel: UINT;
973 Amplitude: Single;
974 pDestTexture: ID3D11Texture2D): HResult; stdcall; external d3dx11dll name 'D3DX11ComputeNormalMap' delayed;
975{$EXTERNALSYM D3DX11ComputeNormalMap}
976
977
978//----------------------------------------------------------------------------
979// D3DX11SHProjectCubeMap:
980// ----------------------
981// Projects a function represented in a cube map into spherical harmonics.
982//
983// Parameters:
984// Order
985// Order of the SH evaluation, generates Order^2 coefs, degree is Order-1
986// pCubeMap
987// CubeMap that is going to be projected into spherical harmonics
988// pROut
989// Output SH vector for Red.
990// pGOut
991// Output SH vector for Green
992// pBOut
993// Output SH vector for Blue
994//
995//---------------------------------------------------------------------------
996
997function D3DX11SHProjectCubeMap(
998 pContext: ID3D11DeviceContext;
999 Order: UINT;
1000 pCubeMap: ID3D11Texture2D;
1001 pROut: PSingle;
1002 pGOut: PSingle;
1003 pBOut: PSingle): HResult; stdcall; external d3dx11dll delayed;
1004{$EXTERNALSYM D3DX11SHProjectCubeMap}
1005
1006
1007//////////////////////////////////////////////////////////////////////////////
1008//
1009// Copyright (c) Microsoft Corporation. All rights reserved.
1010//
1011// File: D3DX11Async.h
1012// Content: D3DX11 Asynchronous Shader loaders / compilers
1013//
1014//////////////////////////////////////////////////////////////////////////////
1015
1016//----------------------------------------------------------------------------
1017// D3DX11Compile:
1018// ------------------
1019// Compiles an effect or shader.
1020//
1021// Parameters:
1022// pSrcFile
1023// Source file name.
1024// hSrcModule
1025// Module handle. if NULL, current module will be used.
1026// pSrcResource
1027// Resource name in module.
1028// pSrcData
1029// Pointer to source code.
1030// SrcDataLen
1031// Size of source code, in bytes.
1032// pDefines
1033// Optional NULL-terminated array of preprocessor macro definitions.
1034// pInclude
1035// Optional interface pointer to use for handling #include directives.
1036// If this parameter is NULL, #includes will be honored when compiling
1037// from file, and will error when compiling from resource or memory.
1038// pFunctionName
1039// Name of the entrypoint function where execution should begin.
1040// pProfile
1041// Instruction set to be used when generating code. Currently supported
1042// profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "vs_3_0",
1043// "vs_3_sw", "vs_4_0", "vs_4_1",
1044// "ps_2_0", "ps_2_a", "ps_2_b", "ps_2_sw", "ps_3_0",
1045// "ps_3_sw", "ps_4_0", "ps_4_1",
1046// "gs_4_0", "gs_4_1",
1047// "tx_1_0",
1048// "fx_4_0", "fx_4_1"
1049// Note that this entrypoint does not compile fx_2_0 targets, for that
1050// you need to use the D3DX9 function.
1051// Flags1
1052// See D3D10_SHADER_xxx flags.
1053// Flags2
1054// See D3D10_EFFECT_xxx flags.
1055// ppShader
1056// Returns a buffer containing the created shader. This buffer contains
1057// the compiled shader code, as well as any embedded debug and symbol
1058// table info. (See D3D10GetShaderConstantTable)
1059// ppErrorMsgs
1060// Returns a buffer containing a listing of errors and warnings that were
1061// encountered during the compile. If you are running in a debugger,
1062// these are the same messages you will see in your debug output.
1063// pHResult
1064// Pointer to a memory location to receive the return value upon completion.
1065// Maybe NULL if not needed.
1066// If pPump != NULL, pHResult must be a valid memory location until the
1067// the asynchronous execution completes.
1068//----------------------------------------------------------------------------
1069
1070function D3DX11CompileFromFile(
1071 pSrcFile: LPCWSTR;
1072 pDefines: LPD3D_SHADER_MACRO;
1073 pInclude: ID3DInclude;
1074 pFunctionName: LPCSTR;
1075 pProfile: LPCSTR;
1076 Flags1, Flags2: UINT;
1077 pPump: ID3DX11ThreadPump;
1078 out ppShader: ID3DBlob;
1079 ppErrorMsgs: PID3DBlob;
1080 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CompileFromFileW' delayed;
1081{$EXTERNALSYM D3DX11CompileFromFile}
1082function D3DX11CompileFromFileA(
1083 pSrcFile: LPCSTR;
1084 pDefines: LPD3D_SHADER_MACRO;
1085 pInclude: ID3DInclude;
1086 pFunctionName: LPCSTR;
1087 pProfile: LPCSTR;
1088 Flags1, Flags2: UINT;
1089 pPump: ID3DX11ThreadPump;
1090 out ppShader: ID3DBlob;
1091 ppErrorMsgs: PID3DBlob;
1092 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CompileFromFileA' delayed;
1093{$EXTERNALSYM D3DX11CompileFromFileA}
1094function D3DX11CompileFromFileW(
1095 pSrcFile: LPCWSTR;
1096 pDefines: LPD3D_SHADER_MACRO;
1097 pInclude: ID3DInclude;
1098 pFunctionName: LPCSTR;
1099 pProfile: LPCSTR;
1100 Flags1, Flags2: UINT;
1101 pPump: ID3DX11ThreadPump;
1102 out ppShader: ID3DBlob;
1103 ppErrorMsgs: PID3DBlob;
1104 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CompileFromFileW' delayed;
1105{$EXTERNALSYM D3DX11CompileFromFileW}
1106
1107function D3DX11CompileFromResource(
1108 hSrcModule: HMODULE;
1109 pSrcResource: LPCWSTR;
1110 pSrcFileName: LPCWSTR;
1111 pDefines: LPD3D_SHADER_MACRO;
1112 pInclude: ID3DInclude;
1113 pFunctionName: LPCSTR;
1114 pProfile: LPCSTR;
1115 Flags1, Flags2: UINT;
1116 pPump: ID3DX11ThreadPump;
1117 out ppShader: ID3DBlob;
1118 ppErrorMsgs: PID3DBlob;
1119 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CompileFromResourceW' delayed;
1120{$EXTERNALSYM D3DX11CompileFromResource}
1121function D3DX11CompileFromResourceA(
1122 hSrcModule: HMODULE;
1123 pSrcResource: LPCSTR;
1124 pSrcFileName: LPCSTR;
1125 pDefines: LPD3D_SHADER_MACRO;
1126 pInclude: ID3DInclude;
1127 pFunctionName: LPCSTR;
1128 pProfile: LPCSTR;
1129 Flags1, Flags2: UINT;
1130 pPump: ID3DX11ThreadPump;
1131 out ppShader: ID3DBlob;
1132 ppErrorMsgs: PID3DBlob;
1133 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CompileFromResourceA' delayed;
1134{$EXTERNALSYM D3DX11CompileFromResourceA}
1135function D3DX11CompileFromResourceW(
1136 hSrcModule: HMODULE;
1137 pSrcResource: LPCWSTR;
1138 pSrcFileName: LPCWSTR;
1139 pDefines: LPD3D_SHADER_MACRO;
1140 pInclude: ID3DInclude;
1141 pFunctionName: LPCSTR;
1142 pProfile: LPCSTR;
1143 Flags1, Flags2: UINT;
1144 pPump: ID3DX11ThreadPump;
1145 out ppShader: ID3DBlob;
1146 ppErrorMsgs: PID3DBlob;
1147 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11CompileFromResourceW' delayed;
1148{$EXTERNALSYM D3DX11CompileFromResourceW}
1149
1150function D3DX11CompileFromMemory(
1151 pSrcData: LPCSTR;
1152 SrcDataLen: SIZE_T;
1153 pDefines: LPD3D_SHADER_MACRO;
1154 pInclude: ID3DInclude;
1155 pFunctionName: LPCSTR;
1156 pProfile: LPCSTR;
1157 Flags1, Flags2: UINT;
1158 pPump: ID3DX11ThreadPump;
1159 out ppShader: ID3DBlob;
1160 ppErrorMsgs: PID3DBlob;
1161 pHResult: PHResult): HResult; stdcall; external d3dx11dll delayed;
1162{$EXTERNALSYM D3DX11CompileFromMemory}
1163
1164
1165function D3DX11PreprocessShaderFromFile(
1166 pFileName: LPCWSTR;
1167 pDefines: LPD3D_SHADER_MACRO;
1168 pInclude: ID3DInclude;
1169 pPump: ID3DX11ThreadPump;
1170 out ppShaderText: ID3DBlob;
1171 ppErrors: PID3DBlob;
1172 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11PreprocessShaderFromFileW' delayed;
1173{$EXTERNALSYM D3DX11PreprocessShaderFromFile}
1174function D3DX11PreprocessShaderFromFileA(
1175 pFileName: LPCSTR;
1176 pDefines: LPD3D_SHADER_MACRO;
1177 pInclude: ID3DInclude;
1178 pPump: ID3DX11ThreadPump;
1179 out ppShaderText: ID3DBlob;
1180 ppErrors: PID3DBlob;
1181 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11PreprocessShaderFromFileA' delayed;
1182{$EXTERNALSYM D3DX11PreprocessShaderFromFileA}
1183function D3DX11PreprocessShaderFromFileW(
1184 pFileName: LPCWSTR;
1185 pDefines: LPD3D_SHADER_MACRO;
1186 pInclude: ID3DInclude;
1187 pPump: ID3DX11ThreadPump;
1188 out ppShaderText: ID3DBlob;
1189 ppErrors: PID3DBlob;
1190 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11PreprocessShaderFromFileW' delayed;
1191{$EXTERNALSYM D3DX11PreprocessShaderFromFileW}
1192
1193function D3DX11PreprocessShaderFromMemory(
1194 pSrcData: LPCSTR;
1195 SrcDataSize: SIZE_T;
1196 pFileName: LPCSTR;
1197 pDefines: LPD3D_SHADER_MACRO;
1198 pInclude: ID3DInclude;
1199 pPump: ID3DX11ThreadPump;
1200 out ppShaderText: ID3DBlob;
1201 ppErrors: PID3DBlob;
1202 pHResult: PHResult): HResult; stdcall; external d3dx11dll delayed;
1203{$EXTERNALSYM D3DX11PreprocessShaderFromMemory}
1204
1205function D3DX11PreprocessShaderFromResource(
1206 hModule: HMODULE;
1207 pResourceName: LPCWSTR;
1208 pSrcFileName: LPCWSTR;
1209 pDefines: LPD3D_SHADER_MACRO;
1210 pInclude: ID3DInclude;
1211 pPump: ID3DX11ThreadPump;
1212 out ppShaderText: ID3DBlob;
1213 ppErrors: PID3DBlob;
1214 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11PreprocessShaderFromResourceW' delayed;
1215{$EXTERNALSYM D3DX11PreprocessShaderFromResource}
1216function D3DX11PreprocessShaderFromResourceA(
1217 hModule: HMODULE;
1218 pResourceName: LPCSTR;
1219 pSrcFileName: LPCSTR;
1220 pDefines: LPD3D_SHADER_MACRO;
1221 pInclude: ID3DInclude;
1222 pPump: ID3DX11ThreadPump;
1223 out ppShaderText: ID3DBlob;
1224 ppErrors: PID3DBlob;
1225 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11PreprocessShaderFromResourceA' delayed;
1226{$EXTERNALSYM D3DX11PreprocessShaderFromResourceA}
1227function D3DX11PreprocessShaderFromResourceW(
1228 hModule: HMODULE;
1229 pResourceName: LPCWSTR;
1230 pSrcFileName: LPCWSTR;
1231 pDefines: LPD3D_SHADER_MACRO;
1232 pInclude: ID3DInclude;
1233 pPump: ID3DX11ThreadPump;
1234 out ppShaderText: ID3DBlob;
1235 ppErrors: PID3DBlob;
1236 pHResult: PHResult): HResult; stdcall; external d3dx11dll name 'D3DX11PreprocessShaderFromResourceW' delayed;
1237{$EXTERNALSYM D3DX11PreprocessShaderFromResourceW}
1238
1239//----------------------------------------------------------------------------
1240// Async processors
1241//----------------------------------------------------------------------------
1242
1243function D3DX11CreateAsyncCompilerProcessor(
1244 pFileName: LPCSTR;
1245 pDefines: LPD3D_SHADER_MACRO;
1246 pInclude: ID3DInclude;
1247 pFunctionName: LPCSTR;
1248 pProfile: LPCSTR;
1249 Flags1, Flags2: UINT;
1250 out ppCompiledShader: ID3DBlob;
1251 ppErrorBuffer: PID3DBlob;
1252 out ppProcessor: ID3DX11DataProcessor): HResult; stdcall; external d3dx11dll delayed;
1253{$EXTERNALSYM D3DX11CreateAsyncCompilerProcessor}
1254
1255function D3DX11CreateAsyncShaderPreprocessProcessor(
1256 pFileName: LPCSTR;
1257 pDefines: LPD3D_SHADER_MACRO;
1258 pInclude: ID3DInclude;
1259 out ppShaderText: ID3DBlob;
1260 ppErrorBuffer: PID3DBlob;
1261 out ppProcessor: ID3DX11DataProcessor): HResult; stdcall; external d3dx11dll delayed;
1262{$EXTERNALSYM D3DX11CreateAsyncShaderPreprocessProcessor}
1263
1264//----------------------------------------------------------------------------
1265// D3DX11 Asynchronous texture I/O (advanced mode)
1266//----------------------------------------------------------------------------
1267
1268function D3DX11CreateAsyncFileLoader(pFileName: LPCWSTR; out ppDataLoader: ID3DX11DataLoader): HResult; stdcall; external d3dx11dll name 'D3DX11CreateAsyncFileLoaderW' delayed;
1269{$EXTERNALSYM D3DX11CreateAsyncFileLoader}
1270function D3DX11CreateAsyncFileLoaderA(pFileName: LPCSTR; out ppDataLoader: ID3DX11DataLoader): HResult; stdcall; external d3dx11dll name 'D3DX11CreateAsyncFileLoaderA' delayed;
1271{$EXTERNALSYM D3DX11CreateAsyncFileLoaderA}
1272function D3DX11CreateAsyncFileLoaderW(pFileName: LPCWSTR; out ppDataLoader: ID3DX11DataLoader): HResult; stdcall; external d3dx11dll name 'D3DX11CreateAsyncFileLoaderW' delayed;
1273{$EXTERNALSYM D3DX11CreateAsyncFileLoaderW}
1274function D3DX11CreateAsyncMemoryLoader(pData: Pointer; cbData: SIZE_T; out ppDataLoader: ID3DX11DataLoader): HResult; stdcall; external d3dx11dll delayed;
1275{$EXTERNALSYM D3DX11CreateAsyncMemoryLoader}
1276function D3DX11CreateAsyncResourceLoader(hSrcModule: HMODULE; pSrcResource: LPCWSTR; out ppDataLoader: ID3DX11DataLoader): HResult; stdcall; external d3dx11dll name 'D3DX11CreateAsyncResourceLoaderW' delayed;
1277{$EXTERNALSYM D3DX11CreateAsyncResourceLoaderA}
1278function D3DX11CreateAsyncResourceLoaderA(hSrcModule: HMODULE; pSrcResource: LPCSTR; out ppDataLoader: ID3DX11DataLoader): HResult; stdcall; external d3dx11dll name 'D3DX11CreateAsyncResourceLoaderA' delayed;
1279{$EXTERNALSYM D3DX11CreateAsyncResourceLoaderA}
1280function D3DX11CreateAsyncResourceLoaderW(hSrcModule: HMODULE; pSrcResource: LPCWSTR; out ppDataLoader: ID3DX11DataLoader): HResult; stdcall; external d3dx11dll name 'D3DX11CreateAsyncResourceLoaderW' delayed;
1281{$EXTERNALSYM D3DX11CreateAsyncResourceLoaderA}
1282
1283function D3DX11CreateAsyncTextureProcessor(pDevice: ID3D11Device; pLoadInfo: PD3DX11ImageLoadInfo; out ppDataProcessor: ID3DX11DataProcessor): HResult; stdcall; external d3dx11dll delayed;
1284{$EXTERNALSYM D3DX11CreateAsyncTextureProcessor}
1285function D3DX11CreateAsyncTextureInfoProcessor(pImageInfo: PD3DX11ImageLoadInfo; out ppDataProcessor: ID3DX11DataProcessor): HResult; stdcall; external d3dx11dll delayed;
1286{$EXTERNALSYM D3DX11CreateAsyncTextureInfoProcessor}
1287function D3DX11CreateAsyncShaderResourceViewProcessor(pDevice: ID3D11Device; pLoadInfo: PD3DX11ImageLoadInfo; out ppDataProcessor: ID3DX11DataProcessor): HResult; stdcall; external d3dx11dll delayed;
1288{$EXTERNALSYM D3DX11CreateAsyncShaderResourceViewProcessor}
1289
1290 {$ENDREGION}
1291
1292 {$REGION 'FX11'}
1293
1294const
1295 //////////// DLL export definitions ///////////////////////////////////////
1296 d3fx11dll = 'd3fx11.dll';
1297
1298type
1299 PD3DX11_StateBlockMask = ^TD3DX11_StateBlockMask;
1300 D3DX11_STATE_BLOCK_MASK = record
1301 VS: Byte;
1302 VSSamplers: array[0..((D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT + 7) div 8) - 1] of Byte;
1303 VSShaderResources: array[0..((D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + 7) div 8) - 1] of Byte;
1304 VSConstantBuffers: array[0..((D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + 7) div 8) - 1] of Byte;
1305 VSInterfaces: array[0..((D3D11_SHADER_MAX_INTERFACES + 7) div 8) - 1] of Byte;
1306
1307 HS: Byte;
1308 HSSamplers: array[0..((D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT + 7) div 8) - 1] of Byte;
1309 HSShaderResources: array[0..((D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + 7) div 8) - 1] of Byte;
1310 HSConstantBuffers: array[0..((D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + 7) div 8) - 1] of Byte;
1311 HSInterfaces: array[0..((D3D11_SHADER_MAX_INTERFACES + 7) div 8) - 1] of Byte;
1312
1313 DS: Byte;
1314 DSSamplers: array[0..((D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT + 7) div 8) - 1] of Byte;
1315 DSShaderResources: array[0..((D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + 7) div 8) - 1] of Byte;
1316 DSConstantBuffers: array[0..((D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + 7) div 8) - 1] of Byte;
1317 DSInterfaces: array[0..((D3D11_SHADER_MAX_INTERFACES + 7) div 8) - 1] of Byte;
1318
1319 GS: Byte;
1320 GSSamplers: array[0..((D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT + 7) div 8) - 1] of Byte;
1321 GSShaderResources: array[0..((D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + 7) div 8) - 1] of Byte;
1322 GSConstantBuffers: array[0..((D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + 7) div 8) - 1] of Byte;
1323 GSInterfaces: array[0..((D3D11_SHADER_MAX_INTERFACES + 7) div 8) - 1] of Byte;
1324
1325 PS: Byte;
1326 PSSamplers: array[0..((D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT + 7) div 8) - 1] of Byte;
1327 PSShaderResources: array[0..((D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + 7) div 8) - 1] of Byte;
1328 PSConstantBuffers: array[0..((D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + 7) div 8) - 1] of Byte;
1329 PSInterfaces: array[0..((D3D11_SHADER_MAX_INTERFACES + 7) div 8) - 1] of Byte;
1330 PSUnorderedAccessViews: Byte;
1331
1332 CS: Byte;
1333 CSSamplers: array[0..((D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT + 7) div 8) - 1] of Byte;
1334 CSShaderResources: array[0..((D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT + 7) div 8) - 1] of Byte;
1335 CSConstantBuffers: array[0..((D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT + 7) div 8) - 1] of Byte;
1336 CSInterfaces: array[0..((D3D11_SHADER_MAX_INTERFACES + 7) div 8) - 1] of Byte;
1337 CSUnorderedAccessViews: Byte;
1338
1339 IAVertexBuffers: array[0..((D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT + 7) div 8) - 1] of Byte;
1340 IAIndexBuffer: Byte;
1341 IAInputLayout: Byte;
1342 IAPrimitiveTopology: Byte;
1343
1344 OMRenderTargets: Byte;
1345 OMDepthStencilState: Byte;
1346 OMBlendState: Byte;
1347
1348 RSViewports: Byte;
1349 RSScissorRects: Byte;
1350 RSRasterizerState: Byte;
1351
1352 SOBuffers: Byte;
1353
1354 Predication: Byte;
1355 end;
1356 {$EXTERNALSYM D3DX11_STATE_BLOCK_MASK}
1357 TD3DX11_StateBlockMask = D3DX11_STATE_BLOCK_MASK;
1358
1359//----------------------------------------------------------------------------
1360// D3DX11_EFFECT flags:
1361// -------------------------------------
1362//
1363// These flags are passed in when creating an effect, and affect
1364// the runtime effect behavior:
1365//
1366// (Currently none)
1367//
1368//
1369// These flags are set by the effect runtime:
1370//
1371// D3DX11_EFFECT_OPTIMIZED
1372// This effect has been optimized. Reflection functions that rely on
1373// names/semantics/strings should fail. This is set when Optimize() is
1374// called, but CEffect::IsOptimized() should be used to test for this.
1375//
1376// D3DX11_EFFECT_CLONE
1377// This effect is a clone of another effect. Single CBs will never be
1378// updated when internal variable values are changed.
1379// This flag is not set when the D3DX11_EFFECT_CLONE_FORCE_NONSINGLE flag
1380// is used in cloning.
1381//
1382//----------------------------------------------------------------------------
1383
1384const
1385 D3DX11_EFFECT_OPTIMIZED = (1 shl 21);
1386 {$EXTERNALSYM D3DX11_EFFECT_OPTIMIZED}
1387 D3DX11_EFFECT_CLONE = (1 shl 22);
1388 {$EXTERNALSYM D3DX11_EFFECT_CLONE}
1389
1390// Mask of valid D3DCOMPILE_EFFECT flags for D3DX11CreateEffect*
1391 D3DX11_EFFECT_RUNTIME_VALID_FLAGS = (0);
1392 {$EXTERNALSYM D3DX11_EFFECT_RUNTIME_VALID_FLAGS}
1393
1394
1395//----------------------------------------------------------------------------
1396// D3DX11_EFFECT_VARIABLE flags:
1397// ----------------------------
1398//
1399// These flags describe an effect variable (global or annotation),
1400// and are returned in D3DX11_EFFECT_VARIABLE_DESC::Flags.
1401//
1402// D3DX11_EFFECT_VARIABLE_ANNOTATION
1403// Indicates that this is an annotation on a technique, pass, or global
1404// variable. Otherwise, this is a global variable. Annotations cannot
1405// be shared.
1406//
1407// D3DX11_EFFECT_VARIABLE_EXPLICIT_BIND_POINT
1408// Indicates that the variable has been explicitly bound using the
1409// register keyword.
1410//----------------------------------------------------------------------------
1411
1412 D3DX11_EFFECT_VARIABLE_ANNOTATION = (1 shl 1);
1413 {$EXTERNALSYM D3DX11_EFFECT_VARIABLE_ANNOTATION}
1414 D3DX11_EFFECT_VARIABLE_EXPLICIT_BIND_POINT = (1 shl 2);
1415 {$EXTERNALSYM D3DX11_EFFECT_VARIABLE_EXPLICIT_BIND_POINT}
1416
1417
1418//----------------------------------------------------------------------------
1419// D3DX11_EFFECT_CLONE flags:
1420// ----------------------------
1421//
1422// These flags modify the effect cloning process and are passed into Clone.
1423//
1424// D3DX11_EFFECT_CLONE_FORCE_NONSINGLE
1425// Ignore all "single" qualifiers on cbuffers. All cbuffers will have their
1426// own ID3D11Buffer's created in the cloned effect.
1427//----------------------------------------------------------------------------
1428
1429 D3DX11_EFFECT_CLONE_FORCE_NONSINGLE = (1 shl 0);
1430
1431
1432//////////////////////////////////////////////////////////////////////////////
1433// ID3DX11EffectType //////////////////////////////////////////////////////////
1434//////////////////////////////////////////////////////////////////////////////
1435
1436//----------------------------------------------------------------------------
1437// D3DX11_EFFECT_TYPE_DESC:
1438//
1439// Retrieved by ID3DX11EffectType::GetDesc()
1440//----------------------------------------------------------------------------
1441
1442type
1443 PD3DX11_EffectTypeDesc = ^TD3DX11_EffectTypeDesc;
1444 D3DX11_EFFECT_TYPE_DESC = record
1445 TypeName: LPCSTR; // Name of the type
1446 // (e.g. "float4" or "MyStruct")
1447
1448 Class_: TD3D_SHADER_VARIABLE_CLASS; // (e.g. scalar, vector, object, etc.)
1449 Type_: TD3D_SHADER_VARIABLE_TYPE; // (e.g. float, texture, vertexshader, etc.)
1450
1451 Elements: UINT; // Number of elements in this type
1452 // (0 if not an array)
1453 Members: UINT; // Number of members
1454 // (0 if not a structure)
1455 Rows: UINT; // Number of rows in this type
1456 // (0 if not a numeric primitive)
1457 Columns: UINT; // Number of columns in this type
1458 // (0 if not a numeric primitive)
1459
1460 PackedSize: UINT; // Number of bytes required to represent
1461 // this data type, when tightly packed
1462 UnpackedSize: UINT; // Number of bytes occupied by this data
1463 // type, when laid out in a constant buffer
1464 Stride: UINT; // Number of bytes to seek between elements,
1465 // when laid out in a constant buffer
1466 end;
1467 {$EXTERNALSYM D3DX11_EFFECT_TYPE_DESC}
1468 TD3DX11_EffectTypeDesc = D3DX11_EFFECT_TYPE_DESC;
1469
1470const
1471 IID_ID3DX11EffectType: TGUID = '{4250D721-D5E5-491F-B62B-587C43186285}';
1472 {$EXTERNALSYM IID_ID3DX11EffectType}
1473
1474type
1475 {$EXTERNALSYM ID3DX11EffectType}
1476 ID3DX11EffectType = class
1477 function IsValid(): BOOL; virtual; stdcall; abstract;
1478 function GetDesc(out pDesc: TD3DX11_EffectTypeDesc): HResult; virtual; stdcall; abstract;
1479 function GetMemberTypeByIndex(Index: UINT): ID3DX11EffectType; virtual; stdcall; abstract;
1480 function GetMemberTypeByName(Name: LPCSTR): ID3DX11EffectType; virtual; stdcall; abstract;
1481 function GetMemberTypeBySemantic(Semantic: LPCSTR): ID3DX11EffectType; virtual; stdcall; abstract;
1482 function GetMemberName(Index: UINT): LPCSTR; virtual; stdcall; abstract;
1483 function GetMemberSemantic(Index: UINT): LPCSTR; virtual; stdcall; abstract;
1484 end;
1485
1486//////////////////////////////////////////////////////////////////////////////
1487// ID3DX11EffectVariable //////////////////////////////////////////////////////
1488//////////////////////////////////////////////////////////////////////////////
1489
1490//----------------------------------------------------------------------------
1491// D3DX11_EFFECT_VARIABLE_DESC:
1492//
1493// Retrieved by ID3DX11EffectVariable::GetDesc()
1494//----------------------------------------------------------------------------
1495
1496 PD3DX11_EffectVariableDesc = ^TD3DX11_EffectVariableDesc;
1497 D3DX11_EFFECT_VARIABLE_DESC = record
1498 Name: LPCSTR; // Name of this variable, annotation,
1499 // or structure member
1500 Semantic: LPCSTR; // Semantic string of this variable
1501 // or structure member (NULL for
1502 // annotations or if not present)
1503
1504 Flags: UINT; // D3DX11_EFFECT_VARIABLE_* flags
1505 Annotations: UINT; // Number of annotations on this variable
1506 // (always 0 for annotations)
1507
1508 BufferOffset: UINT; // Offset into containing cbuffer or tbuffer
1509 // (always 0 for annotations or variables
1510 // not in constant buffers)
1511
1512 ExplicitBindPoint: UINT; // Used if the variable has been explicitly bound
1513 // using the register keyword. Check Flags for
1514 // D3DX11_EFFECT_VARIABLE_EXPLICIT_BIND_POINT;
1515 end;
1516 {$EXTERNALSYM D3DX11_EFFECT_VARIABLE_DESC}
1517 TD3DX11_EffectVariableDesc = D3DX11_EFFECT_VARIABLE_DESC;
1518
1519const
1520 IID_ID3DX11EffectVariable: TGUID = '{036A777D-B56E-4B25-B313-CC3DDAB71873}';
1521 {$EXTERNALSYM IID_ID3DX11EffectVariable}
1522
1523type
1524 ID3DX11EffectScalarVariable = class;
1525 ID3DX11EffectVectorVariable = class;
1526 ID3DX11EffectMatrixVariable = class;
1527 ID3DX11EffectStringVariable = class;
1528 ID3DX11EffectClassInstanceVariable = class;
1529 ID3DX11EffectInterfaceVariable = class;
1530 ID3DX11EffectShaderResourceVariable = class;
1531 ID3DX11EffectUnorderedAccessViewVariable = class;
1532 ID3DX11EffectRenderTargetViewVariable = class;
1533 ID3DX11EffectDepthStencilViewVariable = class;
1534 ID3DX11EffectConstantBuffer = class;
1535 ID3DX11EffectShaderVariable = class;
1536 ID3DX11EffectBlendVariable = class;
1537 ID3DX11EffectDepthStencilVariable = class;
1538 ID3DX11EffectRasterizerVariable = class;
1539 ID3DX11EffectSamplerVariable = class;
1540
1541 {$EXTERNALSYM ID3DX11EffectVariable}
1542 ID3DX11EffectVariable = class
1543 function IsValid(): BOOL; virtual; stdcall; abstract;
1544 function GetType(): ID3DX11EffectType; virtual; stdcall; abstract;
1545 function GetDesc(out pDesc: TD3DX11_EffectVariableDesc): HResult; virtual; stdcall; abstract;
1546
1547 function GetAnnotationByIndex(Index: UINT): ID3DX11EffectVariable; virtual; stdcall; abstract;
1548 function GetAnnotationByName(Name: LPCSTR): ID3DX11EffectVariable; virtual; stdcall; abstract;
1549
1550 function GetMemberByIndex(Index: UINT): ID3DX11EffectVariable; virtual; stdcall; abstract;
1551 function GetMemberByName(Name: LPCSTR): ID3DX11EffectVariable; virtual; stdcall; abstract;
1552 function GetMemberBySemantic(Semantic: LPCSTR): ID3DX11EffectVariable; virtual; stdcall; abstract;
1553
1554 function GetElement(Index: UINT): ID3DX11EffectVariable; virtual; stdcall; abstract;
1555
1556 function GetParentConstantBuffer(): ID3DX11EffectConstantBuffer; virtual; stdcall; abstract;
1557
1558 function AsScalar(): ID3DX11EffectScalarVariable; virtual; stdcall; abstract;
1559 function AsVector(): ID3DX11EffectVectorVariable; virtual; stdcall; abstract;
1560 function AsMatrix(): ID3DX11EffectMatrixVariable; virtual; stdcall; abstract;
1561 function AsString(): ID3DX11EffectStringVariable; virtual; stdcall; abstract;
1562 function AsClassInstance(): ID3DX11EffectClassInstanceVariable; virtual; stdcall; abstract;
1563 function AsInterface(): ID3DX11EffectInterfaceVariable; virtual; stdcall; abstract;
1564 function AsShaderResource(): ID3DX11EffectShaderResourceVariable; virtual; stdcall; abstract;
1565 function AsUnorderedAccessView(): ID3DX11EffectShaderResourceVariable; virtual; stdcall; abstract;
1566 function AsRenderTargetView(): ID3DX11EffectRenderTargetViewVariable; virtual; stdcall; abstract;
1567 function AsDepthStencilView(): ID3DX11EffectDepthStencilViewVariable; virtual; stdcall; abstract;
1568 function AsConstantBuffer(): ID3DX11EffectConstantBuffer; virtual; stdcall; abstract;
1569 function AsShader(): ID3DX11EffectShaderVariable; virtual; stdcall; abstract;
1570 function AsBlend(): ID3DX11EffectBlendVariable; virtual; stdcall; abstract;
1571 function AsDepthStencil(): ID3DX11EffectDepthStencilVariable; virtual; stdcall; abstract;
1572 function AsRasterizer(): ID3DX11EffectRasterizerVariable; virtual; stdcall; abstract;
1573 function AsSampler(): ID3DX11EffectSamplerVariable; virtual; stdcall; abstract;
1574
1575 function SetRawValue(const pData: Pointer; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1576 function GetRawValue(pData: Pointer; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1577 end;
1578
1579//////////////////////////////////////////////////////////////////////////////
1580// ID3DX11EffectScalarVariable ////////////////////////////////////////////////
1581//////////////////////////////////////////////////////////////////////////////
1582
1583
1584// {921EF2E5-A65D-4E92-9FC6-4E9CC09A4ADE}
1585//DEFINE_GUID(IID_ID3DX11EffectScalarVariable,
1586//0x921ef2e5, 0xa65d, 0x4e92, 0x9f, 0xc6, 0x4e, 0x9c, 0xc0, 0x9a, 0x4a, 0xde);
1587
1588 {$EXTERNALSYM ID3DX11EffectScalarVariable}
1589 ID3DX11EffectScalarVariable = class(ID3DX11EffectVariable)
1590 function SetFloat(Value: Single): HResult; virtual; stdcall; abstract;
1591 function GetFloat(out pValue: Single): HResult; virtual; stdcall; abstract;
1592
1593 function SetFloatArray(const pData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1594 function GetFloatArray(pData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1595
1596 function SetInt(Value: Integer): HResult; virtual; stdcall; abstract;
1597 function GetInt(out pValue: Integer): HResult; virtual; stdcall; abstract;
1598
1599 function SetIntArray(const pData: PInteger; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1600 function GetIntArray(pData: PInteger; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1601
1602 function SetBool(Value: BOOL): HResult; virtual; stdcall; abstract;
1603 function GetBool(out pValue: BOOL): HResult; virtual; stdcall; abstract;
1604
1605 function SetBoolArray(const pData: PBOOL; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1606 function GetBoolArray(pData: PBOOL; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1607 end;
1608
1609//////////////////////////////////////////////////////////////////////////////
1610// ID3DX11EffectVectorVariable ////////////////////////////////////////////////
1611//////////////////////////////////////////////////////////////////////////////
1612
1613// {5E785D4A-D87B-48D8-B6E6-0F8CA7E7467A}
1614//DEFINE_GUID(IID_ID3DX11EffectVectorVariable,
1615//0x5e785d4a, 0xd87b, 0x48d8, 0xb6, 0xe6, 0x0f, 0x8c, 0xa7, 0xe7, 0x46, 0x7a);
1616
1617 {$EXTERNALSYM ID3DX11EffectVectorVariable}
1618 ID3DX11EffectVectorVariable = class(ID3DX11EffectVariable)
1619 procedure SetBoolVector(const pData: PBOOL); virtual; stdcall; abstract;
1620 procedure SetIntVector(const pData: PInteger); virtual; stdcall; abstract;
1621 function SetFloatVector(const pData: PSingle): HResult; virtual; stdcall; abstract;
1622
1623 procedure GetBoolVector(pData: PBOOL); virtual; stdcall; abstract;
1624 procedure GetIntVector(pData: PInteger); virtual; stdcall; abstract;
1625 function GetFloatVector(pData: PSingle): HResult; virtual; stdcall; abstract;
1626
1627 procedure SetBoolVectorArray(const pData: PBOOL; Offset, Count: UINT); virtual; stdcall; abstract;
1628 procedure SetIntVectorArray(const pData: PInteger; Offset, Count: UINT); virtual; stdcall; abstract;
1629 function SetFloatVectorArray(const pData: PSingle; Offset: UINT; Count: UINT): HResult; virtual; stdcall; abstract;
1630
1631 procedure GetBoolVectorArray(pData: PBOOL; Offset, Count: UINT); virtual; stdcall; abstract;
1632 procedure GetIntVectorArray(pData: PInteger; Offset, Count: UINT); virtual; stdcall; abstract;
1633 function GetFloatVectorArray(pData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1634 end;
1635
1636//////////////////////////////////////////////////////////////////////////////
1637// ID3DX11EffectMatrixVariable ////////////////////////////////////////////////
1638//////////////////////////////////////////////////////////////////////////////
1639
1640// {E1096CF4-C027-419A-8D86-D29173DC803E}
1641//DEFINE_GUID(IID_ID3DX11EffectMatrixVariable,
1642//0xe1096cf4, 0xc027, 0x419a, 0x8d, 0x86, 0xd2, 0x91, 0x73, 0xdc, 0x80, 0x3e);
1643
1644 {$EXTERNALSYM ID3DX11EffectMatrixVariable}
1645 ID3DX11EffectMatrixVariable = class(ID3DX11EffectVariable)
1646 function SetMatrix(const pData: PSingle): HResult; virtual; stdcall; abstract;
1647 function GetMatrix(pData: PSingle): HResult; virtual; stdcall; abstract;
1648
1649 function SetMatrixPointerArray(const ppData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract; //experimental; debug required
1650 function GetMatrixPointerArray(out ppData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract; //experimental; debug required
1651
1652 function SetMatrixArray(const pData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1653 function GetMatrixArray(pData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1654
1655 function SetMatrixTranspose(pData: PSingle): HResult; virtual; stdcall; abstract;
1656 function GetMatrixTranspose(pData: PSingle): HResult; virtual; stdcall; abstract;
1657
1658 function SetMatrixTransposeArray(const pData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1659 function GetMatrixTransposeArray(pData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1660
1661 function SetMatrixTransposePointerArray(const ppData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract; //experimental; debug required
1662 function GetMatrixTransposePointerArray(out ppData: PSingle; Offset, Count: UINT): HResult; virtual; stdcall; abstract; //experimental; debug required
1663 end experimental;
1664
1665//////////////////////////////////////////////////////////////////////////////
1666// ID3DX11EffectStringVariable ////////////////////////////////////////////////
1667//////////////////////////////////////////////////////////////////////////////
1668
1669// {F355C818-01BE-4653-A7CC-60FFFEDDC76D}
1670//DEFINE_GUID(IID_ID3DX11EffectStringVariable,
1671//0xf355c818, 0x01be, 0x4653, 0xa7, 0xcc, 0x60, 0xff, 0xfe, 0xdd, 0xc7, 0x6d);
1672
1673 {$EXTERNALSYM ID3DX11EffectStringVariable}
1674 ID3DX11EffectStringVariable = class(ID3DX11EffectVariable)
1675 function GetString(ppString: LPCSTR): HResult; virtual; stdcall; abstract;
1676 function GetStringArray(ppStrings: LPCSTR; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1677 end;
1678
1679//////////////////////////////////////////////////////////////////////////////
1680// ID3DX11EffectClassInstanceVariable ////////////////////////////////////////
1681//////////////////////////////////////////////////////////////////////////////
1682
1683// {926A8053-2A39-4DB4-9BDE-CF649ADEBDC1}
1684//DEFINE_GUID(IID_ID3DX11EffectClassInstanceVariable,
1685//0x926a8053, 0x2a39, 0x4db4, 0x9b, 0xde, 0xcf, 0x64, 0x9a, 0xde, 0xbd, 0xc1);
1686
1687 {$EXTERNALSYM ID3DX11EffectClassInstanceVariable}
1688 ID3DX11EffectClassInstanceVariable = class(ID3DX11EffectVariable)
1689 function GetClassInstance(out ppClassInstance: ID3D11ClassInstance): HResult; virtual; stdcall; abstract;
1690 end;
1691
1692//////////////////////////////////////////////////////////////////////////////
1693// ID3DX11EffectInterfaceVariable ////////////////////////////////////////
1694//////////////////////////////////////////////////////////////////////////////
1695
1696// {516C8CD8-1C80-40A4-B19B-0688792F11A5}
1697//DEFINE_GUID(IID_ID3DX11EffectInterfaceVariable,
1698//0x516c8cd8, 0x1c80, 0x40a4, 0xb1, 0x9b, 0x06, 0x88, 0x79, 0x2f, 0x11, 0xa5);
1699
1700 {$EXTERNALSYM ID3DX11EffectInterfaceVariable}
1701 ID3DX11EffectInterfaceVariable = class(ID3DX11EffectVariable)
1702 function SetClassInstance(pEffectClassInstance: ID3DX11EffectClassInstanceVariable): HResult; virtual; stdcall; abstract;
1703 function GetClassInstance(out ppEffectClassInstance: ID3DX11EffectClassInstanceVariable): HResult; virtual; stdcall; abstract;
1704 end;
1705
1706//////////////////////////////////////////////////////////////////////////////
1707// ID3DX11EffectShaderResourceVariable ////////////////////////////////////////
1708//////////////////////////////////////////////////////////////////////////////
1709
1710// {350DB233-BBE0-485C-9BFE-C0026B844F89}
1711//DEFINE_GUID(IID_ID3DX11EffectShaderResourceVariable,
1712//0x350db233, 0xbbe0, 0x485c, 0x9b, 0xfe, 0xc0, 0x02, 0x6b, 0x84, 0x4f, 0x89);
1713
1714 PID3D11ShaderResourceView = ^ID3D11ShaderResourceView;
1715 {$EXTERNALSYM ID3DX11EffectShaderResourceVariable}
1716 ID3DX11EffectShaderResourceVariable = class(ID3DX11EffectVariable)
1717 function SetResource(const pResource: ID3D11ShaderResourceView): HResult; virtual; stdcall; abstract;
1718 function GetResource(out ppResource: ID3D11ShaderResourceView): HResult; virtual; stdcall; abstract;
1719
1720 function SetResourceArray(const ppResources: PID3D11ShaderResourceView; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1721 function GetResourceArray(ppResources: PID3D11ShaderResourceView; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1722 end;
1723
1724//////////////////////////////////////////////////////////////////////////////
1725// ID3DX11EffectUnorderedAccessViewVariable ////////////////////////////////////////
1726//////////////////////////////////////////////////////////////////////////////
1727
1728// {79B4AC8C-870A-47D2-B05A-8BD5CC3EE6C9}
1729//DEFINE_GUID(IID_ID3DX11EffectUnorderedAccessViewVariable,
1730//0x79b4ac8c, 0x870a, 0x47d2, 0xb0, 0x5a, 0x8b, 0xd5, 0xcc, 0x3e, 0xe6, 0xc9);
1731
1732 PID3D11UnorderedAccessView = ^ID3D11UnorderedAccessView;
1733 {$EXTERNALSYM ID3DX11EffectUnorderedAccessViewVariable}
1734 ID3DX11EffectUnorderedAccessViewVariable = class(ID3DX11EffectVariable)
1735 function SetUnorderedAccessView(const pResource: ID3D11UnorderedAccessView): HResult; virtual; stdcall; abstract;
1736 function GetUnorderedAccessView(out ppResource: ID3D11UnorderedAccessView): HResult; virtual; stdcall; abstract;
1737
1738 function SetUnorderedAccessViewArray(const ppResources: PID3D11UnorderedAccessView; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1739 function GetUnorderedAccessViewArray(ppResources: PID3D11UnorderedAccessView; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1740 end;
1741
1742//////////////////////////////////////////////////////////////////////////////
1743// ID3DX11EffectRenderTargetViewVariable //////////////////////////////////////
1744//////////////////////////////////////////////////////////////////////////////
1745
1746// {D5066909-F40C-43F8-9DB5-057C2A208552}
1747//DEFINE_GUID(IID_ID3DX11EffectRenderTargetViewVariable,
1748//0xd5066909, 0xf40c, 0x43f8, 0x9d, 0xb5, 0x05, 0x7c, 0x2a, 0x20, 0x85, 0x52);
1749
1750 PID3D11RenderTargetView = ^ID3D11RenderTargetView;
1751 {$EXTERNALSYM ID3DX11EffectRenderTargetViewVariable}
1752 ID3DX11EffectRenderTargetViewVariable = class(ID3DX11EffectVariable)
1753 function SetRenderTarget(const pResource: ID3D11RenderTargetView): HResult; virtual; stdcall; abstract;
1754 function GetRenderTarget(out ppResource: ID3D11RenderTargetView): HResult; virtual; stdcall; abstract;
1755
1756 function SetRenderTargetArray(const ppResources: PID3D11RenderTargetView; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1757 function GetRenderTargetArray(ppResources: PID3D11RenderTargetView; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1758 end;
1759
1760//////////////////////////////////////////////////////////////////////////////
1761// ID3DX11EffectDepthStencilViewVariable //////////////////////////////////////
1762//////////////////////////////////////////////////////////////////////////////
1763
1764// {33C648AC-2E9E-4A2E-9CD6-DE31ACC5B347}
1765//DEFINE_GUID(IID_ID3DX11EffectDepthStencilViewVariable,
1766//0x33c648ac, 0x2e9e, 0x4a2e, 0x9c, 0xd6, 0xde, 0x31, 0xac, 0xc5, 0xb3, 0x47);
1767
1768 PID3D11DepthStencilView = ^ID3D11DepthStencilView;
1769 {$EXTERNALSYM ID3DX11EffectDepthStencilViewVariable}
1770 ID3DX11EffectDepthStencilViewVariable = class(ID3DX11EffectVariable)
1771 function SetDepthStencil(const pResource: ID3D11DepthStencilView): HResult; virtual; stdcall; abstract;
1772 function GetDepthStencil(out ppResource: ID3D11DepthStencilView): HResult; virtual; stdcall; abstract;
1773
1774 function SetDepthStencilArray(const ppResources: PID3D11DepthStencilView; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1775 function GetDepthStencilArray(ppResources: PID3D11DepthStencilView; Offset, Count: UINT): HResult; virtual; stdcall; abstract;
1776 end;
1777
1778//////////////////////////////////////////////////////////////////////////////
1779// ID3DX11EffectConstantBuffer ////////////////////////////////////////////////
1780//////////////////////////////////////////////////////////////////////////////
1781
1782// {2CB6C733-82D2-4000-B3DA-6219D9A99BF2}
1783//DEFINE_GUID(IID_ID3DX11EffectConstantBuffer,
1784//0x2cb6c733, 0x82d2, 0x4000, 0xb3, 0xda, 0x62, 0x19, 0xd9, 0xa9, 0x9b, 0xf2);
1785
1786 {$EXTERNALSYM ID3DX11EffectConstantBuffer}
1787 ID3DX11EffectConstantBuffer = class(ID3DX11EffectVariable)
1788 function SetConstantBuffer(const pConstantBuffer: ID3D11Buffer): HResult; virtual; stdcall; abstract;
1789 function UndoSetConstantBuffer: HResult; virtual; stdcall; abstract;
1790 function GetConstantBuffer(out ppConstantBuffer: ID3D11Buffer): HResult; virtual; stdcall; abstract;
1791
1792 function SetTextureBuffer(const pTextureBuffer: ID3D11ShaderResourceView): HResult; virtual; stdcall; abstract;
1793 function UndoSetTextureBuffer: HResult; virtual; stdcall; abstract;
1794 function GetTextureBuffer(out ppTextureBuffer: ID3D11ShaderResourceView): HResult; virtual; stdcall; abstract;
1795 end;
1796
1797//////////////////////////////////////////////////////////////////////////////
1798// ID3DX11EffectShaderVariable ////////////////////////////////////////////////
1799//////////////////////////////////////////////////////////////////////////////
1800
1801//----------------------------------------------------------------------------
1802// D3DX11_EFFECT_SHADER_DESC:
1803//
1804// Retrieved by ID3DX11EffectShaderVariable::GetShaderDesc()
1805//----------------------------------------------------------------------------
1806
1807 PD3DX11_EffectShaderDesc = ^TD3DX11_EffectShaderDesc;
1808 D3DX11_EFFECT_SHADER_DESC = record
1809 pInputSignature: PByte; // Passed into CreateInputLayout,
1810 // valid on VS and GS only
1811
1812 IsInline: BOOL; // Is this an anonymous shader variable
1813 // resulting from an inline shader assignment?
1814
1815
1816 // -- The following fields are not valid after Optimize() --
1817 pBytecode: PByte; // Shader bytecode
1818 BytecodeLength: UINT;
1819
1820 SODecls: array[0..D3D11_SO_STREAM_COUNT-1] of LPCSTR; // Stream out declaration string (for GS with SO)
1821 RasterizedStream: UINT;
1822
1823 NumInputSignatureEntries: UINT; // Number of entries in the input signature
1824 NumOutputSignatureEntries: UINT; // Number of entries in the output signature
1825 NumPatchConstantSignatureEntries: UINT; // Number of entries in the patch constant signature
1826 end;
1827 {$EXTERNALSYM D3DX11_EFFECT_SHADER_DESC}
1828 TD3DX11_EffectShaderDesc = D3DX11_EFFECT_SHADER_DESC;
1829
1830// {7508B344-020A-4EC7-9118-62CDD36C88D7}
1831//DEFINE_GUID(IID_ID3DX11EffectShaderVariable,
1832//0x7508b344, 0x020a, 0x4ec7, 0x91, 0x18, 0x62, 0xcd, 0xd3, 0x6c, 0x88, 0xd7);
1833
1834 {$EXTERNALSYM ID3DX11EffectShaderVariable}
1835 ID3DX11EffectShaderVariable = class(ID3DX11EffectVariable)
1836 function GetShaderDesc(ShaderIndex: UINT; out pDesc: TD3DX11_EffectShaderDesc): HResult; virtual; stdcall; abstract;
1837
1838 function GetVertexShader(ShaderIndex: UINT; out ppVS: ID3D11VertexShader): HResult; virtual; stdcall; abstract;
1839 function GetGeometryShader(ShaderIndex: UINT; out ppGS: ID3D11GeometryShader): HResult; virtual; stdcall; abstract;
1840 function GetPixelShader(ShaderIndex: UINT; out ppPS: ID3D11PixelShader): HResult; virtual; stdcall; abstract;
1841 function GetHullShader(ShaderIndex: UINT; out ppHS: ID3D11HullShader): HResult; virtual; stdcall; abstract;
1842 function GetDomainShader(ShaderIndex: UINT; out ppDS: ID3D11DomainShader): HResult; virtual; stdcall; abstract;
1843 function GetComputeShader(ShaderIndex: UINT; out ppCS: ID3D11ComputeShader): HResult; virtual; stdcall; abstract;
1844
1845 function GetInputSignatureElementDesc(ShaderIndex: UINT; Element: UINT; out pDesc: TD3D11SignatureParameterDesc): HResult; virtual; stdcall; abstract;
1846 function GetOutputSignatureElementDesc(ShaderIndex: UINT; Element: UINT; out pDesc: TD3D11SignatureParameterDesc): HResult; virtual; stdcall; abstract;
1847 function GetPatchConstantSignatureElementDesc(ShaderIndex: UINT; Element: UINT; out pDesc: TD3D11SignatureParameterDesc): HResult; virtual; stdcall; abstract;
1848 end;
1849
1850//////////////////////////////////////////////////////////////////////////////
1851// ID3DX11EffectBlendVariable /////////////////////////////////////////////////
1852//////////////////////////////////////////////////////////////////////////////
1853
1854// {D664F4D7-3B81-4805-B277-C1DF58C39F53}
1855//DEFINE_GUID(IID_ID3DX11EffectBlendVariable,
1856//0xd664f4d7, 0x3b81, 0x4805, 0xb2, 0x77, 0xc1, 0xdf, 0x58, 0xc3, 0x9f, 0x53);
1857
1858 {$EXTERNALSYM ID3DX11EffectBlendVariable}
1859 ID3DX11EffectBlendVariable = class(ID3DX11EffectVariable)
1860 function GetBlendState(Index: UINT; out ppBlendState: ID3D11BlendState): HResult; virtual; stdcall; abstract;
1861 function SetBlendState(Index: UINT; const pBlendState: ID3D11BlendState): HResult; virtual; stdcall; abstract;
1862 function UndoSetBlendState(Index: UINT): HResult; virtual; stdcall; abstract;
1863 function GetBackingStore(Index: UINT; out pBlendDesc: D3D11_BLEND_DESC): HResult; virtual; stdcall; abstract;
1864 end;
1865
1866//////////////////////////////////////////////////////////////////////////////
1867// ID3DX11EffectDepthStencilVariable //////////////////////////////////////////
1868//////////////////////////////////////////////////////////////////////////////
1869///
1870// {69B5751B-61A5-48E5-BD41-D93988111563}
1871//DEFINE_GUID(IID_ID3DX11EffectDepthStencilVariable,
1872//0x69b5751b, 0x61a5, 0x48e5, 0xbd, 0x41, 0xd9, 0x39, 0x88, 0x11, 0x15, 0x63);
1873
1874 {$EXTERNALSYM ID3DX11EffectDepthStencilVariable}
1875 ID3DX11EffectDepthStencilVariable = class(ID3DX11EffectVariable)
1876 function GetDepthStencilState(Index: UINT; out ppDepthStencilState: ID3D11DepthStencilState): HResult; virtual; stdcall; abstract;
1877 function SetDepthStencilState(Index: UINT; const ppDepthStencilState: ID3D11DepthStencilState): HResult; virtual; stdcall; abstract;
1878 function UndoSetDepthStencilState(Index: UINT): HResult; virtual; stdcall; abstract;
1879 function GetBackingStore(Index: UINT; out pDepthStencilDesc: D3D11_DEPTH_STENCIL_DESC): HResult; virtual; stdcall; abstract;
1880 end;
1881
1882//////////////////////////////////////////////////////////////////////////////
1883// ID3DX11EffectRasterizerVariable ////////////////////////////////////////////
1884//////////////////////////////////////////////////////////////////////////////
1885
1886// {53A262F6-5F74-4151-A132-E3DD19A62C9D}
1887//DEFINE_GUID(IID_ID3DX11EffectRasterizerVariable,
1888//0x53a262f6, 0x5f74, 0x4151, 0xa1, 0x32, 0xe3, 0xdd, 0x19, 0xa6, 0x2c, 0x9d);
1889
1890 {$EXTERNALSYM ID3DX11EffectRasterizerVariable}
1891 ID3DX11EffectRasterizerVariable = class(ID3DX11EffectVariable)
1892 function GetRasterizerState(Index: UINT; out ppRasterizerState: ID3D11RasterizerState): HResult; virtual; stdcall; abstract;
1893 function SetRasterizerState(Index: UINT; const pRasterizerState: ID3D11RasterizerState): HResult; virtual; stdcall; abstract;
1894 function UndoSetRasterizerState(Index: UINT): HResult; virtual; stdcall; abstract;
1895 function GetBackingStore(Index: UINT; out pRasterizerDesc: D3D11_RASTERIZER_DESC): HResult; virtual; stdcall; abstract;
1896 end;
1897
1898
1899//////////////////////////////////////////////////////////////////////////////
1900// ID3DX11EffectSamplerVariable ///////////////////////////////////////////////
1901//////////////////////////////////////////////////////////////////////////////
1902
1903// {C6402E55-1095-4D95-8931-F92660513DD9}
1904//DEFINE_GUID(IID_ID3DX11EffectSamplerVariable,
1905//0xc6402e55, 0x1095, 0x4d95, 0x89, 0x31, 0xf9, 0x26, 0x60, 0x51, 0x3d, 0xd9);
1906
1907 {$EXTERNALSYM ID3DX11EffectSamplerVariable}
1908 ID3DX11EffectSamplerVariable = class(ID3DX11EffectVariable)
1909 function GetSampler(Index: UINT; out ppSampler: ID3D11SamplerState): HResult; virtual; stdcall; abstract;
1910 function SetSampler(Index: UINT; const pSampler: ID3D11SamplerState): HResult; virtual; stdcall; abstract;
1911 function UndoSetSampler(Index: UINT): HResult; virtual; stdcall; abstract;
1912 function GetBackingStore(Index: UINT; out pSamplerDesc: D3D11_SAMPLER_DESC): HResult; virtual; stdcall; abstract;
1913 end;
1914
1915//////////////////////////////////////////////////////////////////////////////
1916// ID3DX11EffectPass //////////////////////////////////////////////////////////
1917//////////////////////////////////////////////////////////////////////////////
1918
1919//----------------------------------------------------------------------------
1920// D3DX11_PASS_DESC:
1921//
1922// Retrieved by ID3DX11EffectPass::GetDesc()
1923//----------------------------------------------------------------------------
1924
1925 PD3DX11_PassDesc = ^TD3DX11_PassDesc;
1926 D3DX11_PASS_DESC = record
1927 Name: LPCSTR; // Name of this pass (NULL if not anonymous)
1928 Annotations: UINT; // Number of annotations on this pass
1929
1930 pIAInputSignature: PByte; // Signature from VS or GS (if there is no VS)
1931 // or NULL if neither exists
1932 IAInputSignatureSize: SIZE_T; // Singature size in bytes
1933
1934 StencilRef: UINT; // Specified in SetDepthStencilState()
1935 SampleMask: UINT; // Specified in SetBlendState()
1936 BlendFactor: TFourSingleArray; // Specified in SetBlendState()
1937 end;
1938 {$EXTERNALSYM D3DX11_PASS_DESC}
1939 TD3DX11_PassDesc = D3DX11_PASS_DESC;
1940
1941//----------------------------------------------------------------------------
1942// D3DX11_PASS_SHADER_DESC:
1943//
1944// Retrieved by ID3DX11EffectPass::Get**ShaderDesc()
1945//----------------------------------------------------------------------------
1946
1947 PD3DX11_PassShaderDesc = ^TD3DX11_PassShaderDesc;
1948 D3DX11_PASS_SHADER_DESC = record
1949 pShaderVariable: ID3DX11EffectShaderVariable; // The variable that this shader came from.
1950 // If this is an inline shader assignment,
1951 // the returned interface will be an
1952 // anonymous shader variable, which is
1953 // not retrievable any other way. It's
1954 // name in the variable description will
1955 // be "$Anonymous".
1956 // If there is no assignment of this type in
1957 // the pass block, pShaderVariable != NULL,
1958 // but pShaderVariable->IsValid() == FALSE.
1959
1960 ShaderIndex: UINT; // The element of pShaderVariable (if an array)
1961 // or 0 if not applicable
1962 end;
1963 {$EXTERNALSYM D3DX11_PASS_SHADER_DESC}
1964 TD3DX11_PassShaderDesc = D3DX11_PASS_SHADER_DESC;
1965
1966// {3437CEC4-4AC1-4D87-8916-F4BD5A41380C}
1967//DEFINE_GUID(IID_ID3DX11EffectPass,
1968//0x3437cec4, 0x4ac1, 0x4d87, 0x89, 0x16, 0xf4, 0xbd, 0x5a, 0x41, 0x38, 0x0c);
1969
1970 {$EXTERNALSYM ID3DX11EffectPass}
1971 ID3DX11EffectPass = class
1972 function IsValid(): BOOL; virtual; stdcall; abstract;
1973 function GetDesc(out pDesc: TD3DX11_PassDesc): HResult; virtual; stdcall; abstract;
1974
1975 function GetVertexShaderDesc(out pDesc: TD3DX11_PassShaderDesc): HResult; virtual; stdcall; abstract;
1976 function GetGeometryShaderDesc(out pDesc: TD3DX11_PassShaderDesc): HResult; virtual; stdcall; abstract;
1977 function GetPixelShaderDesc(out pDesc: TD3DX11_PassShaderDesc): HResult; virtual; stdcall; abstract;
1978 function GetHullShaderDesc(out pDesc: TD3DX11_PassShaderDesc): HResult; virtual; stdcall; abstract;
1979 function GetDomainShaderDesc(out pDesc: TD3DX11_PassShaderDesc): HResult; virtual; stdcall; abstract;
1980 function GetComputeShaderDesc(out pDesc: TD3DX11_PassShaderDesc): HResult; virtual; stdcall; abstract;
1981
1982 function GetAnnotationByIndex(Index: UINT): ID3DX11EffectVariable; virtual; stdcall; abstract;
1983 function GetAnnotationByName(Name: LPCSTR): ID3DX11EffectVariable; virtual; stdcall; abstract;
1984
1985 function Apply(Flags: UINT; pContext: ID3D11DeviceContext): HResult; virtual; stdcall; abstract;
1986
1987 function ComputeStateBlockMask(out pStateBlockMask: TD3DX11_StateBlockMask): HResult; virtual; stdcall; abstract;
1988 end;
1989
1990//////////////////////////////////////////////////////////////////////////////
1991// ID3DX11EffectTechnique /////////////////////////////////////////////////////
1992//////////////////////////////////////////////////////////////////////////////
1993
1994//----------------------------------------------------------------------------
1995// D3DX11_TECHNIQUE_DESC:
1996//
1997// Retrieved by ID3DX11EffectTechnique::GetDesc()
1998//----------------------------------------------------------------------------
1999
2000 PD3DX11_TechniqueDesc = ^TD3DX11_TechniqueDesc;
2001 D3DX11_TECHNIQUE_DESC = record
2002 Name: LPCSTR; // Name of this technique (NULL if not anonymous)
2003 Passes: UINT; // Number of passes contained within
2004 Annotations: UINT; // Number of annotations on this technique
2005 end;
2006 {$EXTERNALSYM D3DX11_TECHNIQUE_DESC}
2007 TD3DX11_TechniqueDesc = D3DX11_TECHNIQUE_DESC;
2008
2009// {51198831-1F1D-4F47-BD76-41CB0835B1DE}
2010//DEFINE_GUID(IID_ID3DX11EffectTechnique,
2011//0x51198831, 0x1f1d, 0x4f47, 0xbd, 0x76, 0x41, 0xcb, 0x08, 0x35, 0xb1, 0xde);
2012
2013 {$EXTERNALSYM ID3DX11EffectTechnique}
2014 ID3DX11EffectTechnique = class
2015 function IsValid(): BOOL; virtual; stdcall; abstract;
2016 function GetDesc(out pDesc: TD3DX11_TechniqueDesc): HResult; virtual; stdcall; abstract;
2017
2018 function GetAnnotationByIndex(Index: UINT): ID3DX11EffectVariable; virtual; stdcall; abstract;
2019 function GetAnnotationByName(Name: LPCSTR): ID3DX11EffectVariable; virtual; stdcall; abstract;
2020
2021 function GetPassByIndex(Index: UINT): ID3DX11EffectPass; virtual; stdcall; abstract;
2022 function GetPassByName(Name: LPCSTR): ID3DX11EffectPass; virtual; stdcall; abstract;
2023
2024 function ComputeStateBlockMask(out pStateBlockMask: TD3DX11_StateBlockMask): HResult; virtual; stdcall; abstract;
2025 end;
2026
2027//////////////////////////////////////////////////////////////////////////////
2028// ID3DX11EffectTechnique /////////////////////////////////////////////////////
2029//////////////////////////////////////////////////////////////////////////////
2030
2031//----------------------------------------------------------------------------
2032// D3DX11_GROUP_DESC:
2033//
2034// Retrieved by ID3DX11EffectTechnique::GetDesc()
2035//----------------------------------------------------------------------------
2036
2037 PD3DX11_GroupDesc = ^TD3DX11_GroupDesc;
2038 D3DX11_GROUP_DESC = record
2039 Name: LPCSTR; // Name of this group (only nullptr if global
2040 Techniques: UINT; // Number of techniques contained within
2041 Annotations: UINT; // Number of annotations on this group
2042 end;
2043 {$EXTERNALSYM D3DX11_GROUP_DESC}
2044 TD3DX11_GroupDesc = D3DX11_GROUP_DESC;
2045
2046// {03074acf-97de-485f-b201-cb775264afd6}
2047//DEFINE_GUID(IID_ID3DX11EffectGroup,
2048//0x03074acf, 0x97de, 0x485f, 0xb2, 0x01, 0xcb, 0x77, 0x52, 0x64, 0xaf, 0xd6);
2049
2050 {$EXTERNALSYM ID3DX11EffectGroup}
2051 ID3DX11EffectGroup = class
2052 function IsValid(): BOOL; virtual; stdcall; abstract;
2053 function GetDesc(out pDesc: TD3DX11_GroupDesc): HResult; virtual; stdcall; abstract;
2054
2055 function GetAnnotationByIndex(Index: UINT): ID3DX11EffectVariable; virtual; stdcall; abstract;
2056 function GetAnnotationByName(Name: LPCSTR): ID3DX11EffectVariable; virtual; stdcall; abstract;
2057
2058 function GetTechniqueByIndex(Index: UINT): ID3DX11EffectPass; virtual; stdcall; abstract;
2059 function GetTechniqueByName(Name: LPCSTR): ID3DX11EffectPass; virtual; stdcall; abstract;
2060 end;
2061
2062//////////////////////////////////////////////////////////////////////////////
2063// ID3DX11Effect //////////////////////////////////////////////////////////////
2064//////////////////////////////////////////////////////////////////////////////
2065
2066//----------------------------------------------------------------------------
2067// D3DX11_EFFECT_DESC:
2068//
2069// Retrieved by ID3DX11Effect::GetDesc()
2070//----------------------------------------------------------------------------
2071
2072 PD3DX11_EffectDesc = ^TD3DX11_EffectDesc;
2073 D3DX11_EFFECT_DESC = record
2074 ConstantBuffers: UINT; // Number of constant buffers in this effect
2075 GlobalVariables: UINT; // Number of global variables in this effect
2076 InterfaceVariables: UINT; // Number of global interfaces in this effect
2077 Techniques: UINT; // Number of techniques in this effect
2078 Groups: UINT; // Number of groups in this effect
2079 end;
2080 {$EXTERNALSYM D3DX11_EFFECT_DESC}
2081 TD3DX11_EffectDesc = D3DX11_EFFECT_DESC;
2082
2083// {FA61CA24-E4BA-4262-9DB8-B132E8CAE319}
2084//DEFINE_GUID(IID_ID3DX11Effect,
2085//0xfa61ca24, 0xe4ba, 0x4262, 0x9d, 0xb8, 0xb1, 0x32, 0xe8, 0xca, 0xe3, 0x19);
2086
2087 {$EXTERNALSYM ID3DX11Effect}
2088 ID3DX11Effect = interface (IUnknown)
2089 ['{51B0CA8B-EC0B-4519-870D-8EE1CB5017C7}']
2090 function IsValid(): BOOL; stdcall;
2091 function IsPool(): BOOL; stdcall;
2092
2093 function GetDevice(out ppDevice: ID3D11Device): HResult; stdcall;
2094
2095 function GetDesc(out pDesc: TD3DX11_EffectDesc): HResult; stdcall;
2096
2097 function GetConstantBufferByIndex(Index: UINT): ID3DX11EffectConstantBuffer; stdcall;
2098 function GetConstantBufferByName(Name: LPCSTR): ID3DX11EffectConstantBuffer; stdcall;
2099
2100 function GetVariableByIndex(Index: UINT): ID3DX11EffectVariable; stdcall;
2101 function GetVariableByName(Name: LPCSTR): ID3DX11EffectVariable; stdcall;
2102 function GetVariableBySemantic(Semantic: LPCSTR): ID3DX11EffectVariable; stdcall;
2103
2104 function GetGroupByIndex(Index: UINT): ID3DX11EffectGroup; stdcall;
2105 function GetGroupByName(Name: LPCSTR): ID3DX11EffectGroup; stdcall;
2106
2107 function GetTechniqueByIndex(Index: UINT): ID3DX11EffectTechnique; stdcall;
2108 function GetTechniqueByName(Name: LPCSTR): ID3DX11EffectTechnique; stdcall;
2109
2110 function GetClassLinkage: ID3D11ClassLinkage; stdcall; experimental; //debug required
2111 function CloneEffect(Flags: UINT32; out ppClonedEffect: ID3DX11Effect): HResult; stdcall;
2112 function Optimize(): HResult; stdcall;
2113 function IsOptimized(): BOOL; stdcall;
2114 end;
2115
2116
2117//////////////////////////////////////////////////////////////////////////////
2118// APIs //////////////////////////////////////////////////////////////////////
2119//////////////////////////////////////////////////////////////////////////////
2120
2121//----------------------------------------------------------------------------
2122// D3DX11CreateEffectFromMemory
2123//
2124// Creates an effect instance from a compiled effect in memory
2125//
2126// Parameters:
2127//
2128// [in]
2129//
2130// pData
2131// Blob of compiled effect data
2132// DataLength
2133// Length of the data blob
2134// FXFlags
2135// Flags pertaining to Effect creation
2136// pDevice
2137// Pointer to the D3D11 device on which to create Effect resources
2138// srcName [optional]
2139// ASCII string to use for debug object naming
2140//
2141// [out]
2142//
2143// ppEffect
2144// Address of the newly created Effect interface
2145//
2146//----------------------------------------------------------------------------
2147
2148function D3DX11CreateEffectFromMemory(
2149 pData: Pointer;
2150 DataLength: SIZE_T;
2151 FXFlags: UINT;
2152 const pDevice: ID3D11Device;
2153 out ppEffect: ID3DX11Effect;
2154 srcName: LPCSTR = nil): HResult; stdcall; external d3fx11dll delayed;
2155{$EXTERNALSYM D3DX11CreateEffectFromMemory}
2156
2157//----------------------------------------------------------------------------
2158// D3DX11CreateEffectFromFile
2159//
2160// Creates an effect instance from a compiled effect data file
2161//
2162// Parameters:
2163//
2164// [in]
2165//
2166// pFileName
2167// Compiled effect file
2168// FXFlags
2169// Flags pertaining to Effect creation
2170// pDevice
2171// Pointer to the D3D11 device on which to create Effect resources
2172//
2173// [out]
2174//
2175// ppEffect
2176// Address of the newly created Effect interface
2177//
2178//----------------------------------------------------------------------------
2179
2180function D3DX11CreateEffectFromFile(
2181 pFileName: LPWSTR;
2182 FXFlags: UINT;
2183 const pDevice: ID3D11Device;
2184 out ppEffect: ID3DX11Effect): HResult; stdcall; external d3fx11dll delayed;
2185{$EXTERNALSYM D3DX11CreateEffectFromFile}
2186
2187//----------------------------------------------------------------------------
2188// D3DX11CompileEffectFromMemory
2189//
2190// Complies an effect shader source file in memory and then creates an effect instance
2191//
2192// Parameters:
2193//
2194// [in]
2195//
2196// pData
2197// Pointer to FX shader as an ASCII string
2198// DataLength
2199// Length of the FX shader ASCII string
2200// srcName [optional]
2201// ASCII string to use for debug object naming
2202// pDefines [optional]
2203// A NULL-terminated array of shader macros
2204// pInclude [optional]
2205// A pointer to an include interface
2206// HLSLFlags
2207// HLSL compile options (see D3DCOMPILE flags)
2208// FXFlags
2209// Flags pertaining to Effect compilation (see D3DCOMPILE_EFFECT flags)
2210// pDevice
2211// Pointer to the D3D11 device on which to create Effect resources
2212//
2213// [out]
2214//
2215// ppEffect
2216// Address of the newly created Effect interface
2217//
2218//----------------------------------------------------------------------------
2219
2220function D3DX11CompileEffectFromMemory(
2221 pData: Pointer;
2222 DataLength: SIZE_T;
2223 srcName: LPSTR;
2224 pDefines: LPD3D_SHADER_MACRO;
2225 pInclude: ID3DInclude;
2226 HLSLFlags, FXFlags: UINT;
2227 const pDevice: ID3D11Device;
2228 out ppEffect: ID3DX11Effect;
2229 ppErrors: PID3DBlob = nil): HResult; stdcall; external d3fx11dll delayed;
2230{$EXTERNALSYM D3DX11CreateEffectFromMemory}
2231
2232//----------------------------------------------------------------------------
2233// D3DX11CompileEffectFromFile
2234//
2235// Complies an effect shader source file and then creates an effect instance
2236//
2237// Parameters:
2238//
2239// [in]
2240//
2241// pFileName
2242// FX shader source file
2243// pDefines [optional]
2244// A NULL-terminated array of shader macros
2245// pInclude [optional]
2246// A pointer to an include interface
2247// HLSLFlags
2248// HLSL compile options (see D3DCOMPILE flags)
2249// FXFlags
2250// Flags pertaining to Effect compilation (see D3DCOMPILE_EFFECT flags)
2251// pDevice
2252// Pointer to the D3D11 device on which to create Effect resources
2253//
2254// [out]
2255//
2256// ppEffect
2257// Address of the newly created Effect interface
2258//
2259//----------------------------------------------------------------------------
2260
2261function D3DX11CompileEffectFromFile(
2262 pFileName: LPWSTR;
2263 pDefines: LPD3D_SHADER_MACRO;
2264 pInclude: ID3DInclude;
2265 HLSLFlags, FXFlags: UINT;
2266 const pDevice: ID3D11Device;
2267 out ppEffect: ID3DX11Effect;
2268 ppErrors: PID3DBlob = nil): HResult; stdcall; external d3fx11dll delayed;
2269{$EXTERNALSYM D3DX11CompileEffectFromFile}
2270
2271 {$ENDREGION}
2272
2273implementation
2274
2275//////////////////////////////////////////////////////////////////////////////
2276//
2277// Copyright (C) Microsoft Corporation. All Rights Reserved.
2278//
2279// File: d3dx11.h
2280// Content: D3DX11 utility library
2281//
2282//////////////////////////////////////////////////////////////////////////////
2283
2284// #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
2285function MAKE_DDHRESULT(Code: DWord): DWord;
2286begin
2287 Result:= DWord((1 shl 31) or (_FACDD shl 16)) or Code;
2288end;
2289
2290///////////////////////////////////////////////////////////////////////////
2291//
2292// Copyright (C) Microsoft Corporation. All Rights Reserved.
2293//
2294// File: d3dx11core.h
2295// Content: D3DX11 core types and functions
2296//
2297///////////////////////////////////////////////////////////////////////////
2298
2299// #define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code )
2300function MAKE_D3DHRESULT(Code: DWord): DWord;
2301begin
2302 Result:= DWord((1 shl 31) or (_FACD3D shl 16)) or Code;
2303end;
2304
2305// #define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code )
2306function MAKE_D3DSTATUS(Code: DWord): DWord;
2307begin
2308 Result:= DWord((0 shl 31) or (_FACD3D shl 16)) or Code;
2309end;
2310
2311end.