Contains information identifying the adapter.
The following pseudocode example illustrates the version format encoded in the DriverVersion, DriverVersionLowPart, and DriverVersionHighPart members.
Product = HIWORD(DriverVersion.HighPart) Version = LOWORD(DriverVersion.HighPart) SubVersion = HIWORD(DriverVersion.LowPart) Build = LOWORD(DriverVersion.LowPart)
See the Platform SDK for more information about the HIWORD macro, the LOWORD macro, and the
MAX_DEVICE_IDENTIFIER_STRING is a constant with the following definition.
#define MAX_DEVICE_IDENTIFIER_STRING 512
The VendorId, DeviceId, SubSysId, and Revision members can be used in tandem to identify particular chip sets. However, use these members with caution.
Used for presentation to the user. This should not be used to identify particular drivers, because many different strings might be associated with the same device and driver from different vendors.
Used for presentation to the user.
Device name for GDI.
Identify the version of the Direct3D driver. It is legal to do less than and greater than comparisons on the 64-bit signed integer value. However, exercise caution if you use this element to identify problematic drivers. Instead, you should use DeviceIdentifier. See Remarks.
Can be used to help identify a particular chip set. Query this member to identify the manufacturer. The value can be zero if unknown.
Can be used to help identify a particular chip set. Query this member to identify the type of chip set. The value can be zero if unknown.
Can be used to help identify a particular chip set. Query this member to identify the subsystem, typically the particular board. The value can be zero if unknown.
Can be used to help identify a particular chip set. Query this member to identify the revision level of the chip set. The value can be zero if unknown.
Can be queried to check changes in the driver and chip set. This
Used to determine the Windows Hardware Quality Labs (WHQL) validation level for this driver and device pair. The DWORD is a packed date structure defining the date of the release of the most recent WHQL test passed by the driver. It is legal to perform < and > operations on this value. The following illustrates the date format.
Bits | |
31-16 | The year, a decimal number from 1999 upwards. |
15-8 | The month, a decimal number from 1 to 12. |
7-0 | The day, a decimal number from 1 to 31. |
?
The following values are also used.
0 | Not certified. |
1 | WHQL validated, but no date information is available. |
?
Differences between Direct3D 9 and Direct3D 9Ex:
For Direct3D9Ex running on Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2 (or more current operating system),
Gets the effect description.
Gets the effect description.
Returns a description of the effect. See
If the method succeeds, the return value is
Gets a parameter or annotation description.
Parameter or annotation handle. See Handles (Direct3D 9).
Returns a description of the specified parameter or annotation. See
Gets a technique description.
Technique handle. See Handles (Direct3D 9).
Returns a description of the technique. See
Gets a pass description.
Pass handle. See Handles (Direct3D 9).
Returns a description of the specified pass. See
Note??If an effect is created with
Gets a function description.
Function handle. See Handles (Direct3D 9).
Returns a description of the function. See
Gets the handle of a top-level parameter or a structure member parameter.
Handle of the parameter, or
Parameter index.
Returns the handle of the specified parameter, or
Gets the handle of a top-level parameter or a structure member parameter by looking up its name.
Handle of the parameter, or
String containing the parameter name.
Returns the handle of the specified parameter, or
Gets the handle of a top-level parameter or a structure member parameter by looking up its semantic with a case-insensitive search.
Handle of the parameter, or
String containing the semantic name.
Returns the handle of the first parameter that matches the specified semantic, or
Get the handle of an array element parameter.
Handle of the array. See Handles (Direct3D 9).
Array element index.
Returns the handle of the specified parameter, or
This method is used to get an element of a parameter that is an array.
Gets the handle of a technique.
Technique index.
Returns the handle of the specified technique, or
Gets the handle of a technique by looking up its name.
String containing the technique name.
Returns the handle of the first technique that has the specified name, or
Gets the handle of a pass.
Handle of the parent technique. See Handles (Direct3D 9).
Index for the pass.
Returns the handle of the specified pass inside the specified technique, or
Gets the handle of a pass by looking up its name.
Handle of the parent technique. See Handles (Direct3D 9).
String containing the pass name.
Returns the handle of the first pass inside the specified technique that has the specified name, or
Gets the handle of a function.
Function index.
Returns the handle of the specified function, or
Gets the handle of a function by looking up its name.
String containing the function name.
Returns the handle of the specified function, or
Gets the handle of an annotation.
Handle of a technique, pass, or top-level parameter. See Handles (Direct3D 9).
Annotation index.
Returns the handle of the specified annotation, or
Annotations are user-specific data that can be attached to any technique, pass, or parameter. See Handles (Direct3D 9).
Gets the handle of an annotation by looking up its name.
Handle of a technique, pass, or top-level parameter. See Handles (Direct3D 9).
String containing the annotation name.
Returns the handle of the specified annotation, or
Set the value of an arbitrary parameter or annotation, including simple types, structs, arrays, strings, shaders and textures.
Unique identifier. See Handles (Direct3D 9).
Pointer to a buffer containing data.
[in] Number of bytes in the buffer. Pass in D3DX_DEFAULT if you know your buffer is large enough to contain the entire parameter, and you want to skip size validation.
If the method succeeds, the return value is
This method can be used in place of nearly all the effect set API calls.
Get the value of an arbitrary parameter or annotation, including simple types, structs, arrays, strings, shaders and textures. This method can be used in place of nearly all the Getxxx calls in
If the method succeeds, the return value is
Sets a
Unique identifier. See Handles (Direct3D 9).
Boolean value.
If the method succeeds, the return value is
Gets a
Unique identifier. See Handles (Direct3D 9).
Returns a Boolean value.
If the method succeeds, the return value is
Sets an array of Boolean values.
Unique identifier. See Handles (Direct3D 9).
Array of Boolean values.
Number of Boolean values in the array.
If the method succeeds, the return value is
Gets an array of
Unique identifier. See Handles (Direct3D 9).
Returns an array of Boolean values.
Number of Boolean values in the array.
If the method succeeds, the return value is
Sets an integer.
Unique identifier. See Handles (Direct3D 9).
Integer value.
If the method succeeds, the return value is
Gets an integer.
Unique identifier. See Handles (Direct3D 9).
Returns an integer.
If the method succeeds, the return value is
Sets an array of integers.
Unique identifier. See Handles (Direct3D 9).
Array of integers.
Number of integers in the array.
If the method succeeds, the return value is
Gets an array of integers.
Unique identifier. See Handles (Direct3D 9).
Returns an array of integers.
Number of integers in the array.
If the method succeeds, the return value is
Sets a floating point value.
Unique identifier. See Handles (Direct3D 9).
Floating point value.
If the method succeeds, the return value is
Gets a floating point value.
Unique identifier. See Handles (Direct3D 9).
Returns a floating point value.
If the method succeeds, the return value is
Sets an array of floating point values.
Unique identifier. See Handles (Direct3D 9).
Array of floating point values.
Number of floating point values in the array.
If the method succeeds, the return value is
Gets an array of floating point values.
Unique identifier. See Handles (Direct3D 9).
Returns an array of floating point values.
Number of floating point values in the array.
If the method succeeds, the return value is
Sets a vector.
Unique identifier. See Handles (Direct3D 9).
Pointer to a 4D vector.
If the method succeeds, the return value is
If the destination vector is smaller than the source vector, the additional components of the source vector will be ignored.
Gets a vector.
Unique identifier. See Handles (Direct3D 9).
Returns a 4D vector.
If the method succeeds, the return value is
If the destination vector is larger than the source vector, only the initial components of the destination vector will be filled, and the remaining components will be set to zero.
Sets an array of vectors.
Unique identifier. See Handles (Direct3D 9).
Array of 4D floating point vectors.
Number of vectors in the array.
If the method succeeds, the return value is
If the destination vectors are smaller than the source vectors, the additional components of the source vectors will be ignored.
Gets an array of vectors.
Unique identifier. See Handles (Direct3D 9).
Returns an array of 4D floating point vectors.
Number of vectors in the array.
If the method succeeds, the return value is
If the destination vectors are larger than the source vectors, only the initial components of each destination vector will be filled, and the remaining destination vector components will be set to zero.
Sets a non-transposed matrix.
Unique identifier. See Handles (Direct3D 9).
Pointer to a nontransposed matrix. See
If the method succeeds, the return value is
A non-transposed matrix contains row-major data. In other words, each vector is contained in a row.
If the destination matrix is smaller than the source matrix, the additional components of the source matrix will be ignored.
Gets a nontransposed matrix.
Unique identifier. See Handles (Direct3D 9).
Returns a nontransposed matrix. See
If the method succeeds, the return value is
A nontransposed matrix contains row-major data; that is, each vector is contained in a row.
If the destination matrix is larger than the source matrix, only the upper-left components of the destination matrix will be filled, and the remaining components will be set to zero.
Sets an array of nontransposed matrices.
Unique identifier. See Handles (Direct3D 9).
Array of nontransposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A nontransposed matrix contains row-major data; that is, each vector is contained in a row.
If the destination matrices are smaller than the source matrices, the additional components of the source matrices will be ignored.
Gets an array of nontransposed matrices.
Unique identifier. See Handles (Direct3D 9).
Returns an array of nontransposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A nontransposed matrix contains row-major data; that is, each vector is contained in a row.
If the destination matrices are larger than the source matrices, only the upper-left components of each destination matrix will be filled, and the remaining destination matrix components will be set to zero.
Sets an array of references to nontransposed matrices.
Unique identifier. See Handles (Direct3D 9).
Array of references to nontransposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A nontransposed matrix contains row-major data; that is, each vector is contained in a row.
If the destination matrices are smaller than the source matrices, the additional components of the source matrices will be ignored.
Gets an array of references to nontransposed matrices.
Unique identifier. See Handles (Direct3D 9).
Array of references to nontransposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A nontransposed matrix contains row-major data; that is, each vector is contained in a row.
If the destination matrices are larger than the source matrices, only the upper-left components of each destination matrix will be filled, and the remaining destination matrix components will be set to zero.
Sets a transposed matrix.
Unique identifier. See Handles (Direct3D 9).
Pointer to a transposed matrix. See
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
If the destination matrix is smaller than the source matrix, the additional components of the source matrix will be ignored.
Gets a transposed matrix.
Unique identifier. See Handles (Direct3D 9).
Returns a transposed matrix. See
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
If the destination matrix is larger than the source matrix, only the upper-left elements of the destination matrix will be filled, and the remaining destination matrix components will be set to zero.
Sets an array of transposed matrices.
Unique identifier. See Handles (Direct3D 9).
Array of transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
If the destination matrices are smaller than the source matrices, the additional components of the source matrices will be ignored.
Gets an array of transposed matrices.
Unique identifier. See Handles (Direct3D 9).
Returns an array of transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
If the destination matrices are larger than the source matrices, only the upper-left components of each destination matrix will be filled, and the remaining destination matrix components will be set to zero.
Sets an array of references to transposed matrices.
Unique identifier. See Handles (Direct3D 9).
Array of references to transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
If the destination matrices are smaller than the source matrices, the additional components of the source matrices will be ignored.
Gets an array of references to transposed matrices.
Unique identifier. See Handles (Direct3D 9).
Array of references to transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
If the destination matrices are larger than the source matrices, only the upper-left components of each destination matrix will be filled, and the remaining destination matrix components will be set to zero.
Sets a string.
Unique identifier. See Handles (Direct3D 9).
String to set.
If the method succeeds, the return value is
Gets a string.
Unique identifier. See Handles (Direct3D 9).
Returns a string identified by hParameter.
Sets a texture.
Unique identifier. See Handles (Direct3D 9).
Texture object. See
If the method succeeds, the return value is
Gets a texture.
Unique identifier. See Handles (Direct3D 9).
Returns a texture object. See
Gets a pixel shader.
Unique identifier. See Handles (Direct3D 9).
Returns a pixel shader object. See
Gets a vertex shader.
Unique identifier. See Handles (Direct3D 9).
Returns a vertex shader object. See
Set the range of an array to pass to the device.
Unique identifier. See Handles (Direct3D 9).
Start index.
Stop index.
If the method succeeds, the return value is
Applications use the methods of the
The
The LPDIRECT3DBASETEXTURE9 and PDIRECT3DBASETEXTURE9 types are defined as references to the
typedef struct*LPDIRECT3DBASETEXTURE9, *PDIRECT3DBASETEXTURE9;
Returns the number of texture levels in a multilevel texture.
Warning??If you create a texture with
This method applies to the following interfaces, which inherit from
Get or sets the filter type that is used for automatically generated mipmap sublevels.
Changing the filter type "dirties" the mipmap sublevels and causes them to be regenerated.
The (default) filter type set at texture creation time is
This method has no effect if the texture is not created with
Sets the most detailed level-of-detail for a managed texture.
Most detailed level-of-detail value to set for the mipmap chain.
A DWORD value, clamped to the maximum level-of-detail value (one less than the total number of levels). Subsequent calls to this method will return the clamped value, not the level-of-detail value that was previously set.
This method applies to the following interfaces, which inherit from
SetLOD is used for level-of-detail control of managed textures. This method returns 0 on nonmanaged textures.
SetLOD communicates to the Direct3D texture manager the most detailed mipmap in the chain that should be loaded into local video memory. For example, in a five-level mipmap chain, setting LODNew to 2 indicates that the texture manager should load only mipmap levels 2 through 4 into local video memory at any given time.
More specifically, if the texture was created with the dimensions of 256x256, setting the most detailed level to 0 indicates that 256 x 256 is the largest mipmap available, setting the most detailed level to 1 indicates that 128 x 128 is the largest mipmap available, and so on, up to the most detailed mip level (the smallest texture size) for the chain.
Returns a value clamped to the maximum level-of-detail set for a managed texture (this method is not supported for an unmanaged texture).
A DWORD value, clamped to the maximum level-of-detail value (one less than the total number of levels). Calling GetLOD on an unmanaged texture is not supported and will result in a D3DERR error code being returned.
Returns the number of texture levels in a multilevel texture.
A DWORD value that indicates the number of texture levels in a multilevel texture.
Warning??If you create a texture with
This method applies to the following interfaces, which inherit from
Set the filter type that is used for automatically generated mipmap sublevels.
Filter type. See
If the method succeeds, the return value is
Changing the filter type "dirties" the mipmap sublevels and causes them to be regenerated.
The (default) filter type set at texture creation time is
This method has no effect if the texture is not created with
Get the filter type that is used for automatically generated mipmap sublevels.
Filter type. See
Changing the filter type "dirties" the mipmap sublevels and causes them to be regenerated.
The (default) filter type set at texture creation time is
This method has no effect if the texture is not created with
Generate mipmap sublevels.
An application can generate mipmap sublevels at any time by calling GenerateMipSubLevels. To have mipmap sublevels generated automatically at texture creation time (see Automatic Generation of Mipmaps (Direct3D 9)), specify
Represents the capabilities of the hardware exposed through the Direct3D object.
The MaxTextureBlendStages and MaxSimultaneousTextures members might seem similar, but they contain different information. The MaxTextureBlendStages member contains the total number of texture-blending stages supported by the current device, and the MaxSimultaneousTextures member describes how many of those stages can have textures bound to them by using the SetTexture method.
When the driver fills this structure, it can set values for execute-buffer capabilities, even when the interface being used to retrieve the capabilities (such as
In general, performance problems may occur if you use a texture and then modify it during a scene. Ensure that no texture used in the current BeginScene and EndScene block is evicted unless absolutely necessary. In the case of extremely high texture usage within a scene, the results are undefined. This occurs when you modify a texture that you have used in the scene and there is no spare texture memory available. For such systems, the contents of the z-buffer become invalid at EndScene. Applications should not call UpdateSurface to or from the back buffer on this type of hardware inside a BeginScene/EndScene pair. In addition, applications should not try to access the z-buffer if the
The following flags concerning mipmapped textures are not supported in Direct3D 9.
Member of the
Adapter on which this Direct3D device was created. This ordinal is valid only to pass to methods of the
The following driver-specific capability.
Value | Meaning |
---|---|
Display hardware is capable of returning the current scan line. | |
The display driver supports an overlay DDI that allows for verification of overlay capabilities. For more information about the overlay DDI, see Overlay DDI. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? |
?
Driver-specific capabilities identified in
Driver-specific capabilities identified in
Bit mask of values representing what presentation swap intervals are available.
Value | Meaning |
---|---|
The driver supports an immediate presentation swap interval. | |
The driver supports a presentation swap interval of every screen refresh. | |
The driver supports a presentation swap interval of every second screen refresh. | |
The driver supports a presentation swap interval of every third screen refresh. | |
The driver supports a presentation swap interval of every fourth screen refresh. |
?
Bit mask indicating what hardware support is available for cursors. Direct3D 9 does not define alpha-blending cursor capabilities.
Value | Meaning |
---|---|
A full-color cursor is supported in hardware. Specifically, this flag indicates that the driver supports at least a hardware color cursor in high-resolution modes (with scan lines greater than or equal to 400). | |
A full-color cursor is supported in hardware. Specifically, this flag indicates that the driver supports a hardware color cursor in both high-resolution and low-resolution modes (with scan lines less than 400). |
?
Flags identifying the capabilities of the device.
Value | Meaning |
---|---|
Device supports blits from system-memory textures to nonlocal video-memory textures. | |
Device can queue rendering commands after a page flip. Applications do not change their behavior if this flag is set; this capability means that the device is relatively fast. | |
Device can support at least a DirectX 5-compliant driver. | |
Device can support at least a DirectX 7-compliant driver. | |
Device exports an | |
Device can use execute buffers from system memory. | |
Device can use execute buffers from video memory. | |
Device has hardware acceleration for scene rasterization. | |
Device can support transformation and lighting in hardware. | |
Device supports N patches. | |
Device can support rasterization, transform, lighting, and shading in hardware. | |
Device supports quintic B?zier curves and B-splines. | |
Device supports rectangular and triangular patches. | |
When this device capability is set, the hardware architecture does not require caching of any information, and uncached patches (handle zero) will be drawn as efficiently as cached ones. Note that setting | |
Device is texturing from separate memory pools. | |
Device can retrieve textures from non-local video memory. | |
Device can retrieve textures from system memory. | |
Device can retrieve textures from device memory. | |
Device can use buffers from system memory for transformed and lit vertices. | |
Device can use buffers from video memory for transformed and lit vertices. |
?
Miscellaneous driver primitive capabilities. See
Information on raster-drawing capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device supports anisotropic filtering. | |
Device iterates colors perspective correctly. | |
Device can dither to improve color resolution. | |
Device supports legacy depth bias. For true depth bias, see | |
Device supports range-based fog. In range-based fog, the distance of an object from the viewer is used to compute fog effects, not the depth of the object (that is, the z-coordinate) in the scene. | |
Device calculates the fog value by referring to a lookup table containing fog values that are indexed to the depth of a given pixel. | |
Device calculates the fog value during the lighting operation and interpolates the fog value during rasterization. | |
Device supports level-of-detail bias adjustments. These bias adjustments enable an application to make a mipmap appear crisper or less sharp than it normally would. For more information about level-of-detail bias in mipmaps, see | |
Device supports toggling multisampling on and off between | |
Device supports scissor test. See Scissor Test (Direct3D 9). | |
Device performs true slope-scale based depth bias. This is in contrast to the legacy style depth bias. | |
Device supports depth buffering using w. | |
Device supports w-based fog. W-based fog is used when a perspective projection matrix is specified, but affine projections still use z-based fog. The system considers a projection matrix that contains a nonzero value in the [3][4] element to be a perspective projection matrix. | |
Device can perform hidden-surface removal (HSR) without requiring the application to sort polygons and without requiring the allocation of a depth-buffer. This leaves more video memory for textures. The method used to perform HSR is hardware-dependent and is transparent to the application. Z-bufferless HSR is performed if no depth-buffer surface is associated with the rendering-target surface and the depth-buffer comparison test is enabled (that is, when the state value associated with the | |
Device supports z-based fog. | |
Device can perform z-test operations. This effectively renders a primitive and indicates whether any z pixels have been rendered. |
?
Z-buffer comparison capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Always pass the z-test. | |
Pass the z-test if the new z equals the current z. | |
Pass the z-test if the new z is greater than the current z. | |
Pass the z-test if the new z is greater than or equal to the current z. | |
Pass the z-test if the new z is less than the current z. | |
Pass the z-test if the new z is less than or equal to the current z. | |
Always fail the z-test. | |
Pass the z-test if the new z does not equal the current z. |
?
Source-blending capabilities. This member can be one or more of the following flags. (The RGBA values of the source and destination are indicated by the subscripts s and d.)
Value | Meaning |
---|---|
The driver supports both | |
Source blend factor is (1 - As, 1 - As, 1 - As, 1 - As) and destination blend factor is (As, As, As, As); the destination blend selection is overridden. | |
The driver supports the | |
Blend factor is (Ad, Ad, Ad, Ad). | |
Blend factor is (Rd, Gd, Bd, Ad). | |
Blend factor is (1 - Ad, 1 - Ad, 1 - Ad, 1 - Ad). | |
Blend factor is (1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad). | |
Blend factor is (1 - As, 1 - As, 1 - As, 1 - As). | |
Blend factor is (1 - Rs, 1 - Gs, 1 - Bs, 1 - As). | |
Blend factor is (1 - PSOutColor[1]r, 1 - PSOutColor[1]g, 1 - PSOutColor[1]b, not used)). See Render Target Blending. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? | |
Blend factor is (1, 1, 1, 1). | |
Blend factor is (As, As, As, As). | |
Blend factor is (f, f, f, 1); f = min(As, 1 - Ad). | |
Blend factor is (Rs, Gs, Bs, As). | |
Blend factor is (PSOutColor[1]r, PSOutColor[1]g, PSOutColor[1]b, not used). See Render Target Blending. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? | |
Blend factor is (0, 0, 0, 0). |
?
Destination-blending capabilities. This member can be the same capabilities that are defined for the SrcBlendCaps member.
Alpha-test comparison capabilities. This member can include the same capability flags defined for the ZCmpCaps member. If this member contains only the
Shading operations capabilities. It is assumed, in general, that if a device supports a given command at all, it supports the
The color, specular highlights, fog, and alpha interpolants of a triangle each have capability flags that an application can use to find out how they are implemented by the device driver.
This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device can support an alpha component for Gouraud-blended transparency (the | |
Device can support colored Gouraud shading. In this mode, the per-vertex color components (red, green, and blue) are interpolated across a triangle face. | |
Device can support fog in the Gouraud shading mode. | |
Device supports Gouraud shading of specular highlights. |
?
Miscellaneous texture-mapping capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Alpha in texture pixels is supported. | |
Device can draw alpha from texture palettes. | |
Supports cube textures. | |
Device requires that cube texture maps have dimensions specified as powers of two. | |
Device supports mipmapped cube textures. | |
Device supports mipmapped textures. | |
Device supports mipmapped volume textures. | |
If this flag is not set, and A texture that is not a power of two cannot be set at a stage that will be read based on a shader computation (such as the bem - ps and texm3x3 - ps instructions in pixel shaders versions 1_0 to 1_3). For example, these textures can be used to store bumps that will be fed into texture reads, but not the environment maps that are used in texbem - ps, texbeml - ps, and texm3x3spec - ps. This means that a texture with dimensions that are not powers of two cannot be addressed or sampled using texture coordinates computed within the shader. This type of operation is known as a dependent read and cannot be performed on these types of textures. | |
Device does not support a projected bump-environment loopkup operation in programmable and fixed function shaders. | |
Perspective correction texturing is supported. | |
If If If this flag is not set, and | |
Supports the | |
All textures must be square. | |
Texture indices are not scaled by the texture size prior to interpolation. | |
Device supports volume textures. | |
Device requires that volume texture maps have dimensions specified as powers of two. |
?
Texture-filtering capabilities for a texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-filtering capabilities for a cube texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-filtering capabilities for a volume texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-addressing capabilities for texture objects. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device supports setting coordinates outside the range [0.0, 1.0] to the border color, as specified by the | |
Device can clamp textures to addresses. | |
Device can separate the texture-addressing modes of the u and v coordinates of the texture. This ability corresponds to the | |
Device can mirror textures to addresses. | |
Device can take the absolute value of the texture coordinate (thus, mirroring around 0) and then clamp to the maximum value. | |
Device can wrap textures to addresses. |
?
Texture-addressing capabilities for a volume texture. This member can be one or more of the flags defined for the TextureAddressCaps member.
Defines the capabilities for line-drawing primitives.
Value | Meaning |
---|---|
Supports alpha-test comparisons. | |
Antialiased lines are supported. | |
Supports source-blending. | |
Supports fog. | |
Supports texture-mapping. | |
Supports z-buffer comparisons. |
?
Maximum texture width for this device.
Maximum texture height for this device.
Maximum value for any of the three dimensions (width, height, and depth) of a volume texture.
This number represents the maximum range of the integer bits of the post-normalized texture coordinates. A texture coordinate is stored as a 32-bit signed integer using 27 bits to store the integer part and 5 bits for the floating point fraction. The maximum integer index, 227, is used to determine the maximum texture coordinate, depending on how the hardware does texture-coordinate scaling.
Some hardware reports the cap
Less desirably, on some hardware
For example, assume that MaxTextureRepeat is equal to 32k and the size of the texture is 4k. If the hardware sets
Maximum texture aspect ratio supported by the hardware, typically a power of 2.
Maximum valid value for the
Maximum W-based depth value that the device supports.
Screen-space coordinate of the guard-band clipping region. Coordinates inside this rectangle but outside the viewport rectangle are automatically clipped.
Screen-space coordinate of the guard-band clipping region. Coordinates inside this rectangle but outside the viewport rectangle are automatically clipped.
Screen-space coordinate of the guard-band clipping region. Coordinates inside this rectangle but outside the viewport rectangle are automatically clipped.
Screen-space coordinate of the guard-band clipping region. Coordinates inside this rectangle but outside the viewport rectangle are automatically clipped.
Number of pixels to adjust the extents rectangle outward to accommodate antialiasing kernels.
Flags specifying supported stencil-buffer operations. Stencil operations are assumed to be valid for all three stencil-buffer operation render states (
For more information, see
Flexible vertex format capabilities.
Value | Meaning |
---|---|
It is preferable that vertex elements not be stripped. That is, if the vertex format contains elements that are not used with the current render states, there is no need to regenerate the vertices. If this capability flag is not present, stripping extraneous elements from the vertex format provides better performance. | |
Point size is determined by either the render state or the vertex data. If an FVF is used, point size can come from point size data in the vertex declaration. Otherwise, point size is determined by the render state | |
Masks the low WORD of FVFCaps. These bits, cast to the WORD data type, describe the total number of texture coordinate sets that the device can simultaneously use for multiple texture blending. (You can use up to eight texture coordinate sets for any vertex, but the device can blend using only the specified number of texture coordinate sets.) |
?
Combination of flags describing the texture operations supported by this device. The following flags are defined.
Value | Meaning |
---|---|
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The | |
The |
?
Maximum number of texture-blending stages supported in the fixed function pipeline. This value is the number of blenders available. In the programmable pixel pipeline, this corresponds to the number of unique texture registers used by pixel shader instructions.
Maximum number of textures that can be simultaneously bound to the fixed-function pipeline sampler stages. If the same texture is bound to two sampler stages, it counts as two textures.
This value has no meaning in the programmable pipeline where the number of sampler stages is determined by each pixel shader version. Each pixel shader version also determines the number of texture declaration instructions. See Pixel Shaders.
Vertex processing capabilities. For a given physical device, this capability might vary across Direct3D devices depending on the parameters supplied to CreateDevice. See
Maximum number of lights that can be active simultaneously. For a given physical device, this capability might vary across Direct3D devices depending on the parameters supplied to CreateDevice.
Maximum number of user-defined clipping planes supported. This member can be 0. For a given physical device, this capability may vary across Direct3D devices depending on the parameters supplied to CreateDevice.
Maximum number of matrices that this device can apply when performing multimatrix vertex blending. For a given physical device, this capability may vary across Direct3D devices depending on the parameters supplied to CreateDevice.
DWORD value that specifies the maximum matrix index that can be indexed into using the per-vertex indices. The number of matrices is MaxVertexBlendMatrixIndex + 1, which is the size of the matrix palette. If normals are present in the vertex data that needs to be blended for lighting, then the number of matrices is half the number specified by this capability flag. If MaxVertexBlendMatrixIndex is set to zero, the driver does not support indexed vertex blending. If this value is not zero then the valid range of indices is zero through MaxVertexBlendMatrixIndex.
A zero value for MaxVertexBlendMatrixIndex indicates that the driver does not support indexed matrices.
When software vertex processing is used, 256 matrices could be used for indexed vertex blending, with or without normal blending.
For a given physical device, this capability may vary across Direct3D devices depending on the parameters supplied to CreateDevice.
Maximum size of a point primitive. If set to 1.0f then device does not support point size control. The range is greater than or equal to 1.0f.
Maximum number of primitives for each DrawPrimitive call. There are two cases:
Maximum size of indices supported for hardware vertex processing. It is possible to create 32-bit index buffers; however, you will not be able to render with the index buffer unless this value is greater than 0x0000FFFF.
Maximum number of concurrent data streams for SetStreamSource. The valid range is 1 to 16. Note that if this value is 0, then the driver is not a Direct3D 9 driver.
Maximum stride for SetStreamSource.
Two numbers that represent the vertex shader main and sub versions. For more information about the instructions supported for each vertex shader version, see Version 1_x, Version 2_0, Version 2_0 Extended, or Version 3_0.
The number of vertex shader Vertex Shader Registers that are reserved for constants.
Two numbers that represent the pixel shader main and sub versions. For more information about the instructions supported for each pixel shader version, see Version 1_x, Version 2_0, Version 2_0 Extended, or Version 3_0.
Maximum value of pixel shader arithmetic component. This value indicates the internal range of values supported for pixel color blending operations. Within the range that they report to, implementations must allow data to pass through pixel processing unmodified (unclamped). Normally, the value of this member is an absolute value. For example, a 1.0 indicates that the range is -1.0 to 1, and an 8.0 indicates that the range is -8.0 to 8.0. The value must be >= 1.0 for any hardware that supports pixel shaders.
Device driver capabilities for adaptive tessellation. For more information, see
This number indicates which device is the master for this subordinate. This number is taken from the same space as the adapter values.
For multihead support, one head will be denoted the master head, and all other heads on the same card will be denoted subordinate heads. If more than one multihead adapter is present in a system, the master and its subordinates from one multihead adapter are called a group.
This number indicates the order in which heads are referenced by the API. The value for the master adapter is always 0. These values do not correspond to the adapter ordinals. They apply only to heads within a group.
This number indicates which device is the master for this subordinate. This number is taken from the same space as the adapter values.
For multihead support, one head will be denoted the master head, and all other heads on the same card will be denoted subordinate heads. If more than one multihead adapter is present in a system, the master and its subordinates from one multihead adapter are called a group.
This number indicates the order in which heads are referenced by the API. The value for the master adapter is always 0. These values do not correspond to the adapter ordinals. They apply only to heads within a group.
Number of adapters in this adapter group (only if master). This will be 1 for conventional adapters. The value will be greater than 1 for the master adapter of a multihead card. The value will be 0 for a subordinate adapter of a multihead card. Each card can have at most one master, but may have many subordinates.
A combination of one or more data types contained in a vertex declaration. See
Number of simultaneous render targets. This number must be at least one.
Combination of constants that describe the operations supported by StretchRect. The flags that may be set in this field are:
Constant | Description |
---|---|
Device supports point-sample filtering for minifying rectangles. This filter type is requested by calling StretchRect using | |
Device supports point-sample filtering for magnifying rectangles. This filter type is requested by calling StretchRect using | |
Device supports bilinear interpolation filtering for minifying rectangles. This filter type is requested by calling StretchRect using | |
Device supports bilinear interpolation filtering for magnifying rectangles. This filter type is requested by calling StretchRect using |
?
For more information, see
Device supports vertex shader version 2_0 extended capability. See
Device supports pixel shader version 2_0 extended capability. See
Device supports vertex shader texture filter capability. See
Maximum number of vertex shader instructions that can be run when using flow control. The maximum number of instructions that can be programmed is MaxVertexShader30InstructionSlots.
Maximum number of pixel shader instructions that can be run when using flow control. The maximum number of instructions that can be programmed is MaxPixelShader30InstructionSlots.
Maximum number of vertex shader instruction slots supported. The maximum value that can be set on this cap is 32768. Devices that support vs_3_0 are required to support at least 512 instruction slots.
Maximum number of pixel shader instruction slots supported. The maximum value that can be set on this cap is 32768. Devices that support ps_3_0 are required to support at least 512 instruction slots.
The
The LPD3DXCONSTANTTABLE type is defined as a reference to the
typedef interface; typedef interface *LPD3DXCONSTANTTABLE;
Gets a reference to the buffer that contains the constant table.
Gets the buffer size of the constant table.
Gets a description of the constant table.
Gets a reference to the buffer that contains the constant table.
Returns a reference the buffer.
Gets the buffer size of the constant table.
Returns the size of the buffer, in bytes.
Gets a description of the constant table.
Description of the constant table. See
If the method succeeds, the return value is
Gets a reference to an array of constant descriptions in the constant table.
Unique identifier to a constant. See
Returns a reference to an array of descriptions. See
The input supplied must be the maximum size of the array. The output is the number of elements that are filled in the array when the function returns.
If the method succeeds, the return value is
Because a sampler can appear more than once in a constant table, this method can return an array of descriptions, each one with a different register index.
Returns the sampler index.
The sampler handle.
Returns the sampler index number from the constant table.
Gets a constant by looking up its index.
Unique identifier to the parent data structure. If the constant is a top-level parameter (there is no parent data structure), use
Zero-based index of the constant.
Returns a unique identifier to the constant.
To get a constant from an array of constants, use
Gets a constant by looking up its name.
Unique identifier to the parent data structure. If the constant is a top-level parameter (there is no parent data structure), use
Name of the constant.
Returns a unique identifier to the constant.
Gets a constant from an array of constants. An array is made up of elements.
Unique identifier to the array of constants. This value may not be
Zero-based index of the element in the array.
Returns a unique identifier to the element constant.
To get a constant that is not part of an array, use
Sets the constants to their default values. The default values are declared in the variable declarations in the shader.
Pointer to an
If the method succeeds, the return value is
Sets the contents of the buffer to the constant table.
Pointer to an
Unique identifier to a constant. See
Buffer containing data.
Size of the buffer, in bytes.
If the method succeeds, the return value is
Sets a Boolean value.
Pointer to an
Unique identifier to the constant. See
Boolean value.
If the method succeeds, the return value is
Sets an array of Boolean values.
Pointer to an
Unique identifier to the array of constants. See
Array of Boolean values.
Number of Boolean values in the array.
If the method succeeds, the return value is
Sets an integer value.
Pointer to an
Unique identifier to the constant. See
Integer.
If the method succeeds, the return value is
Sets an array of integers.
Pointer to an
Unique identifier to the array of constants. See
Array of integers.
Number of integers in the array.
If the method succeeds, the return value is
Sets a floating-point number.
Pointer to an
Unique identifier to the constant. See
Floating-point number.
If the method succeeds, the return value is
Sets an array of floating-point numbers.
Pointer to an
Unique identifier to the array of constants. See
Array of floating-point numbers.
Number of floating-point values in the array.
If the method succeeds, the return value is
Sets a 4D vector.
Pointer to an
Unique identifier to the vector constant. See
Pointer to a 4D vector.
If the method succeeds, the return value is
Sets an array of 4D vectors.
Pointer to an
Unique identifier to the array of vector constants. See
Array of 4D vectors.
Number of vectors in the array.
If the method succeeds, the return value is
Sets a nontransposed matrix.
Pointer to an
Unique identifier to the matrix of constants. See
Pointer to a nontransposed matrix. See
If the method succeeds, the return value is
Sets an array of nontransposed matrices.
Pointer to an
Unique identifier to the array of constant matrices. See
Array of nontransposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
Sets an array of references to nontransposed matrices.
Pointer to an
Unique identifier to an array of constant matrices. See
Array of references to nontransposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A nontransposed matrix contains row-major data; that is, each vector is contained in a row.
Sets a transposed matrix.
Pointer to an
Unique identifier to the matrix of constants. See
Pointer to a transposed matrix. See
If the method succeeds, the return value is
Sets an array of transposed matrices.
Pointer to an
Unique identifier to the array of matrix constants. See
Array of transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
Sets an array of references to transposed matrices.
Pointer to an
Unique identifier to the array of matrix constants. See
Array of references to transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
Applications use the methods of the
The
This interface inherits additional functionality from the
This interface, like all COM interfaces, inherits additional functionality from the
The LPDIRECT3DCUBETEXTURE9 and PDIRECT3DCubeTexture9 types are defined as references to the
typedef struct*LPDIRECT3DCUBETEXTURE9, *PDIRECT3DCubeTexture9;
Retrieves a description of one face of the specified cube texture level.
Specifies a level of a mipmapped cube texture.
Pointer to a
The
Retrieves a cube texture map surface.
Member of the
Specifies a level of a mipmapped cube texture.
Address of a reference to an
Calling this method will increase the internal reference count on the
Locks a rectangle on a cube texture resource.
Member of the
Specifies a level of a mipmapped cube texture.
Pointer to a
Pointer to a rectangle to lock. Specified by a reference to a
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
You may not specify a subrect when using
If the method succeeds, the return value is
For performance reasons, dirty regions are only recorded for level zero of a texture. Dirty regions are automatically recorded when
Cube textures created with
The only lockable format for a depth-stencil texture is
Unlocks a rectangle on a cube texture resource.
Member of the
Specifies a level of a mipmapped cube texture.
If the method succeeds, the return value is
Adds a dirty region to a cube texture resource.
Member of the
Pointer to a
If the method succeeds, the return value is
For performance reasons, dirty regions are only recorded for level zero of a texture. For sublevels, it is assumed that the corresponding (scaled) rectangle or box is also dirty. Dirty regions are automatically recorded when
Using
Applications use the methods of the
The
This interface, like all COM interfaces, inherits the
The LPDIRECT3DDEVICE9 and PDIRECT3DDEVICE9 types are defined as references to the
typedef struct*LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9;
Returns an interface to the instance of the Direct3D object that created the device.
Calling
Retrieves the capabilities of the rendering device.
Retrieves the creation parameters of the device.
You can query the AdapterOrdinal member of the returned
Gets the number of implicit swap chains.
Implicit swap chains are created by the device during
An application may create additional swap chains using
This method allows the use of GDI dialog boxes in full-screen mode applications.
The GDI dialog boxes must be created as child to the device window. They should also be created within the same thread that created the device because this enables the parent window to manage redrawing the child window.
The method has no effect for windowed mode applications, but this setting will be respected if the application resets the device into full-screen mode. If SetDialogBoxMode succeeds in a windowed mode application, any subsequent reset to full-screen mode will be checked against the restrictions listed above. Also, SetDialogBoxMode causes all back buffers on the swap chain to be discarded, so an application is expected to refresh its content for all back buffers after this call.
Gets or sets the depth-stencil surface owned by the Direct3DDevice object.
Calling this method will increase the internal reference count on the
Retrieves or sets the viewport parameters currently set for the device.
Typically, methods that return state will not work on a device that is created using
Retrieves or sets the current material properties for the device.
This method will not return device state for a device that is created using
Retrieves or sets the clip status.
When clipping is enabled during vertex processing (by
Clip status is not updated by
Clip status is used during software vertex processing. Therefore, this method is not supported on pure or nonpure hardware processing devices. For more information about pure devices, see
Retrieves or sets the current texture palette.
Gets or sets the scissor rectangle.
The scissor rectangle is used as a rectangular clipping region.
See Rectangles (Direct3D 9) for further information on the use of rectangles in DirectX.
Gets or sets the vertex processing (hardware or software) mode.
An application can create a mixed-mode device to use both the software vertex processing and the hardware vertex processing. To switch between the two vertex processing modes in DirectX 8.x, use
In Direct3D 9, use
Gets or sets the N-patch mode segments.
Gets or sets a vertex shader declaration.
Gets or sets the fixed vertex function declaration.
The fixed vertex function declaration is a set of FVF flags that determine how vertices processed by the fixed function pipeline will be used.
Retrieves or sets the currently set vertex shader.
Typically, methods that return state will not work on a device that is created using
Retrieves or sets index data.
Calling this method will increase the internal reference count on the
Retrieves or sets the currently set pixel shader.
This method will not work on a device that is created using
Reports the current cooperative-level status of the Direct3D device for a windowed or full-screen application.
If the method succeeds, the return value is
If the device is lost but cannot be restored at the current time,
A call to
Returns an estimate of the amount of available texture memory.
The function returns an estimate of the available texture memory.
The returned value is rounded to the nearest MB. This is done to reflect the fact that video memory estimates are never precise due to alignment and other issues that affect consumption by certain resources. Applications can use this value to make gross estimates of memory availability to make large-scale resource decisions such as how many levels of a mipmap to attempt to allocate, but applications cannot use this value to make small-scale decisions such as if there is enough memory left to allocate another resource.
Evicts all managed resources, including both Direct3D and driver-managed resources.
If the method succeeds, the return value is
This function causes only the
Returns an interface to the instance of the Direct3D object that created the device.
Address of a reference to an
If the method succeeds, the return value is
Calling
Retrieves the capabilities of the rendering device.
Pointer to a
If the method succeeds, the return value is
Retrieves the display mode's spatial resolution, color resolution, and refresh frequency.
An unsigned integer specifying the swap chain.
Pointer to a
Retrieves the creation parameters of the device.
Pointer to a
If the method succeeds, the return value is
You can query the AdapterOrdinal member of the returned
Sets properties for the cursor.
X-coordinate offset (in pixels) that marks the center of the cursor. The offset is relative to the upper-left corner of the cursor. When the cursor is given a new position, the image is drawn at an offset from this new position determined by subtracting the hot spot coordinates from the position.
Y-coordinate offset (in pixels) that marks the center of the cursor. The offset is relative to the upper-left corner of the cursor. When the cursor is given a new position, the image is drawn at an offset from this new position determined by subtracting the hot spot coordinates from the position.
Pointer to an
If the method succeeds, the return value is
An operating system cursor is created and used under either of these conditions:
Otherwise, DirectX uses an emulated cursor. An application uses
It is recommended for applications to always trap WM_MOUSEMOVE events and call DXSetCursorPosition.
Direct3D cursor functions use either GDI cursor or software emulation, depending on the hardware. Users typically want to respond to a WM_SETCURSOR message. For example, they might want to write the message handler as follows:
case WM_SETCURSOR: // Turn off window cursor. SetCursor(null ); m_pd3dDevice->ShowCursor( TRUE ); return TRUE; // Prevent Windows from setting cursor to window class cursor. break;
Or, users might want to call the
The application can determine what hardware support is available for cursors by examining appropriate members of the
The cursor does not survive when the device is lost. This method must be called after the device is reset.
Sets the cursor position and update options.
The new X-position of the cursor in virtual desktop coordinates. See Remarks.
The new Y-position of the cursor in virtual desktop coordinates. See Remarks.
Specifies the update options for the cursor. Currently, only one flag is defined.
Value | Meaning |
---|---|
| Update cursor at the refresh rate. If this flag is specified, the system guarantees that the cursor will be updated at a minimum of half the display refresh rate, but never more frequently than the display refresh rate. Otherwise, the method delays cursor updates until the next |
?
When running in full-screen mode, screen space coordinates are the back buffer coordinates appropriately scaled to the current display mode. When running in windowed mode, screen space coordinates are the desktop coordinates. The cursor image is drawn at the specified position minus the hotspot-offset specified by the SetCursorProperties method.
If the cursor has been hidden by ShowCursor, the cursor is not drawn.
Displays or hides the cursor.
If bShow is TRUE, the cursor is shown. If bShow is
Value indicating whether the cursor was previously visible. TRUE if the cursor was previously visible, or
Direct3D cursor functions use either GDI cursor or software emulation, depending on the hardware. Users usually want to respond to a WM_SETCURSOR message. For example, the users might want to write the message handler like this:
case WM_SETCURSOR: // Turn off window cursor SetCursor(null ); m_pd3dDevice->ShowCursor( TRUE ); return TRUE; // prevent Windows from setting cursor to window class cursor break;
Or users might want to call the
Creates an additional swap chain for rendering multiple views.
Pointer to a
Calling this method changes the value of members of the
Address of a reference to an
If the method succeeds, the return value is
There is always at least one swap chain (the implicit swap chain) for each device because Direct3D 9 has one swap chain as a property of the device.
Note that any given device can support only one full-screen swap chain.
Gets a reference to a swap chain.
The swap chain ordinal value. For more information, see NumberOfAdaptersInGroup in
Pointer to an
Gets the number of implicit swap chains.
Number of implicit swap chains. See Remarks.
Implicit swap chains are created by the device during
An application may create additional swap chains using
Resets the type, size, and format of the swap chain.
Pointer to a
When switching to full-screen mode, Direct3D will try to find a desktop format that matches the back buffer format, so that back buffer and front buffer formats will be identical (to eliminate the need for color conversion).
When this method returns:
Possible return values include:
If a call to
Calling
There are two different types of swap chains: full-screen or windowed. If the new swap chain is full-screen, the adapter will be placed in the display mode that matches the new size.
Direct3D 9 applications can expect messages to be sent to them during this call (for example, before this call is returned); applications should take precautions not to call into Direct3D at this time. In addition, when
A call to
Pixel shaders and vertex shaders survive
When trying to reset more than one display adapter in a group, set pPresentationParameters to point to an array of
If a multihead device was created with
Presents the contents of the next buffer in the sequence of back buffers owned by the device.
Pointer to a value that must be
Pointer to a value that must be
Pointer to a destination window whose client area is taken as the target for this presentation. If this value is
Value must be
Possible return values include:
If necessary, a stretch operation is applied to transfer the pixels within the source rectangle to the destination rectangle in the client area of the target window.
Present will fail, returning
Retrieves a back buffer from the device's swap chain.
An unsigned integer specifying the swap chain.
Index of the back buffer object to return. Back buffers are numbered from 0 to the total number of back buffers minus one. A value of 0 returns the first back buffer, not the front buffer. The front buffer is not accessible through this method. Use
Stereo view is not supported in Direct3D 9, so the only valid value for this parameter is
Address of a reference to an
Calling this method will increase the internal reference count on the
Returns information describing the raster of the monitor on which the swap chain is presented.
An unsigned integer specifying the swap chain.
Pointer to a
This method allows the use of GDI dialog boxes in full-screen mode applications.
TRUE to enable GDI dialog boxes, and
If the method succeeds, the return value is
The GDI dialog boxes must be created as child to the device window. They should also be created within the same thread that created the device because this enables the parent window to manage redrawing the child window.
The method has no effect for windowed mode applications, but this setting will be respected if the application resets the device into full-screen mode. If SetDialogBoxMode succeeds in a windowed mode application, any subsequent reset to full-screen mode will be checked against the restrictions listed above. Also, SetDialogBoxMode causes all back buffers on the swap chain to be discarded, so an application is expected to refresh its content for all back buffers after this call.
Sets the gamma correction ramp for the implicit swap chain. This method will affect the entire screen (not just the active window if you are running in windowed mode).
Unsigned integer specifying the swap chain.
Indicates whether correction should be applied. Gamma correction results in a more consistent display, but can incur processing overhead and should not be used frequently. Short-duration effects, such as flashing the whole screen red, should not be calibrated, but long-duration gamma changes should be calibrated. One of the following values can be set:
Item | Description |
---|---|
D3DSGR_CALIBRATE | If a gamma calibrator is installed, the ramp will be modified before being sent to the device to account for the system and monitor response curves. If a calibrator is not installed, the ramp will be passed directly to the device. |
D3DSGR_NO_CALIBRATION | No gamma correction is applied. The supplied gamma table is transferred directly to the device. |
?
Pointer to a
There is always at least one swap chain (the implicit swap chain) for each device, because Direct3D 9 has one swap chain as a property of the device. The gamma ramp takes effect immediately; there is no wait for a vertical sync.
If the device does not support gamma ramps in the swap chain's current presentation mode (full-screen or windowed), no error return is given. Applications can check the
For windowed gamma correction presentation, use
Retrieves the gamma correction ramp for the swap chain.
An unsigned integer specifying the swap chain.
Creates a texture resource.
Width of the top-level of the texture, in pixels. The pixel dimensions of subsequent levels will be the truncated value of half of the previous level's pixel dimension (independently). Each dimension clamps at a size of 1 pixel. Thus, if the division by 2 results in 0, 1 will be taken instead.
Height of the top-level of the texture, in pixels. The pixel dimensions of subsequent levels will be the truncated value of half of the previous level's pixel dimension (independently). Each dimension clamps at a size of 1 pixel. Thus, if the division by 2 results in 0, 1 will be taken instead.
Number of levels in the texture. If this is zero, Direct3D will generate all texture sublevels down to 1 by 1 pixels for hardware that supports mipmapped textures. Call
Usage can be 0, which indicates no usage value. However, if usage is desired, use a combination of one or more
Member of the
Member of the
Pointer to an
Reserved. Set this parameter to
If the method succeeds, the return value is
An application can discover support for Automatic Generation of Mipmaps (Direct3D 9) in a particular format by calling
In Windows Vista CreateTexture can create a texture from a system memory reference allowing the application more flexibility over the use, allocation and deletion of the system memory. For example, an application could pass a GDI system memory bitmap reference and get a Direct3D texture interface around it. Using a system memory reference with CreateTexture has the following restrictions.
Creates a volume texture resource.
Width of the top-level of the volume texture, in pixels. This value must be a power of two if the
Height of the top-level of the volume texture, in pixels. This value must be a power of two if the
Depth of the top-level of the volume texture, in pixels. This value must be a power of two if the
Number of levels in the texture. If this is zero, Direct3D will generate all texture sublevels down to 1x1 pixels for hardware that supports mipmapped volume textures. Call
Usage can be 0, which indicates no usage value. If usage is desired, use
Member of the
Member of the
Address of a reference to an
Reserved. Set this parameter to
If the method succeeds, the return value is
Creates a cube texture resource.
Size of the edges of all the top-level faces of the cube texture. The pixel dimensions of subsequent levels of each face will be the truncated value of half of the previous level's pixel dimension (independently). Each dimension clamps at a size of 1 pixel. Thus, if the division by 2 results in 0 (zero), 1 will be taken instead.
Number of levels in each face of the cube texture. If this is zero, Direct3D will generate all cube texture sublevels down to 1x1 pixels for each face for hardware that supports mipmapped cube textures. Call
Usage can be 0, which indicates no usage value. However, if usage is desired, use a combination of one or more
Member of the
Member of the
Address of a reference to an
Reserved. Set this parameter to
If the method succeeds, the return value is
A mipmap (texture) is a collection of successively downsampled (mipmapped) surfaces. On the other hand, a cube texture (created by
An application can discover support for Automatic Generation of Mipmaps (Direct3D 9) in a particular format by calling
Creates a vertex buffer.
Size of the vertex buffer, in bytes. For FVF vertex buffers, Length must be large enough to contain at least one vertex, but it need not be a multiple of the vertex size. Length is not validated for non-FVF buffers. See Remarks.
Usage can be 0, which indicates no usage value. However, if usage is desired, use a combination of one or more
Combination of
Member of the
Address of a reference to an
Reserved. Set this parameter to
If the method succeeds, the return value is
A vertex buffer can be used with either hardware or software vertex processing. This is determined by how the device and the vertex buffer are created.
When a device is created, CreateDevice uses the behavior flag to determine whether to process vertices in hardware or software. There are three possibilities:
Mixed-mode devices might need to switch between software and hardware processing (using
When a vertex buffer is created, CreateVertexBuffer uses the usage parameter to decide whether to process vertices in hardware or software.
To use a vertex buffer with a mixed mode device, create a single vertex buffer which can be used for both hardware or software processing. Use
The
When set to a nonzero value, which must be a valid FVF code, the FVF parameter indicates that the buffer content is to be characterized by an FVF code. A vertex buffer that is created with an FVF code is referred to as an FVF vertex buffer. For more information, see FVF Vertex Buffers (Direct3D 9).
Non-FVF buffers can be used to interleave data during multipass rendering or multitexture rendering in a single pass. To do this, one buffer contains geometry data and the others contain texture coordinates for each texture to be rendered. When rendering, the buffer containing the geometry data is interleaved with each of the buffers containing the texture coordinates. If FVF buffers were used instead, each of them would need to contain identical geometry data in addition to the texture coordinate data specific to each texture rendered. This would result in either a speed or memory penalty, depending on the strategy used. For more information about texture coordinates, see Texture Coordinates (Direct3D 9).
Creates an index buffer.
Size of the index buffer, in bytes.
Usage can be 0, which indicates no usage value. However, if usage is desired, use a combination of one or more
Member of the
Item | Description |
---|---|
| Indices are 16 bits each. |
| Indices are 32 bits each. |
?
Member of the
Address of a reference to an
This parameter can be used in Direct3D?9 for Windows?Vista to share resources; set it to
If the method succeeds, the return value is
Index buffers are memory resources used to hold indices, they are similar to both surfaces and vertex buffers. The use of index buffers enables Direct3D to avoid unnecessary data copying and to place the buffer in the optimal memory type for the expected usage.
To use index buffers, create an index buffer, lock it, fill it with indices, unlock it, pass it to
The MaxVertexIndex member of the
Creates a render-target surface.
Width of the render-target surface, in pixels.
Height of the render-target surface, in pixels.
Member of the
Member of the
Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by
Render targets are not lockable unless the application specifies TRUE for Lockable.
Note that lockable render targets reduce performance on some graphics hardware. The readback performance (moving data from video memory to system memory) depends on the type of hardware used (AGP vs. PCI Express) and is usually far lower than upload performance (moving data from system to video memory). If you need read access to render targets, use GetRenderTargetData instead of lockable render targets.
Reserved. Set this parameter to
Address of a reference to an
Render-target surfaces are placed in the
The creation of lockable, multisampled render targets is not supported.
Creates a depth-stencil resource.
Width of the depth-stencil surface, in pixels.
Height of the depth-stencil surface, in pixels.
Member of the
Member of the
Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by
Set this flag to TRUE to enable z-buffer discarding, and
This flag has the same behavior as the constant,
Reserved. Set this parameter to
Address of a reference to an
The memory class of the depth-stencil buffer is always
Copies rectangular subsets of pixels from one surface to another.
Pointer to an
Pointer to a rectangle on the source surface. Specifying
Pointer to an
Pointer to the upper left corner of the destination rectangle. Specifying
If the method succeeds, the return value is
This method is similar to CopyRects in DirectX 8.
This function has the following restrictions.
The following table shows the supported combinations.
Dest formats | |||||
---|---|---|---|---|---|
Texture | RT texture | RT | Off-screen plain | ||
Src formats | Texture | Yes | Yes | Yes* | Yes |
RT texture | No | No | No | No | |
RT | No | No | No | No | |
Off-screen plain | Yes | Yes | Yes | Yes |
?
* If the driver does not support the requested copy, it will be emulated using lock and copy.
If the application needs to copy data from a
Updates the dirty portions of a texture.
Pointer to an
Pointer to an
If the method succeeds, the return value is
You can dirty a portion of a texture by locking it, or by calling one of the following methods.
For performance reasons, dirty regions are only recorded for level zero of a texture. For sublevels, it is assumed that the corresponding (scaled) rectangle or box is also dirty. Dirty regions are automatically recorded when LockRect or
This method fails if the textures are of different types, if their bottom-level buffers are of different sizes, or if their matching levels do not match. For example, consider a six-level source texture with the following dimensions.
32x16, 16x8, 8x4, 4x2, 2x1, 1x1
This six-level source texture could be the source for the following one-level destination.
1x1
For the following two-level destination.
2x1, 1x1
Or, for the following three-level destination.
4x2, 2x1, 1x1
In addition, this method will fail if the textures are of different formats. If the destination texture has fewer levels than the source, only the matching levels are copied. If the source texture has fewer levels than the destination, the method will fail.
If the source texture has dirty regions, the copy can be optimized by restricting the copy to only those regions. It is not guaranteed that only those bytes marked dirty will be copied.
Here are the possibilities for source and destination surface combinations:
Copies the render-target data from device memory to system memory.
Pointer to an
Pointer to an
If the method succeeds, the return value is
The destination surface must be either an off-screen plain surface or a level of a texture (mipmap or cube texture) created with
The source surface must be a regular render target or a level of a render-target texture (mipmap or cube texture) created with POOL_DEFAULT.
This method will fail if:
Generates a copy of the device's front buffer and places that copy in a system memory buffer provided by the application.
An unsigned integer specifying the swap chain.
Pointer to an
For windowed mode, the size of the destination surface should be the size of the desktop. For full-screen mode, the size of the destination surface should be the screen size.
If the method succeeds, the return value is
The buffer pointed to by pDestSurface will be filled with a representation of the front buffer, converted to the standard 32 bits per pixel format
This method is the only way to capture an antialiased screen shot.
This function is very slow, by design, and should not be used in any performance-critical path.
For more information, see Lost Devices and Retrieved Data.
Copy the contents of the source rectangle to the destination rectangle. The source rectangle can be stretched and filtered by the copy. This function is often used to change the aspect ratio of a video stream.
Pointer to the source surface. See
Pointer to the source rectangle. A
Pointer to the destination surface. See
Pointer to the destination rectangle. A
Filter type. Allowable values are
If the method succeeds, the return value is
StretchRect Restrictions
Additional Restrictions for Depth and Stencil Surfaces
Using StretchRect to downsample a Multisample Rendertarget
You can use StretchRect to copy from one rendertarget to another. If the source rendertarget is multisampled, this results in downsampling the source rendertarget. For instance you could:
Note that use of the extra surface involved in using StretchRect to downsample a Multisample Rendertarget will result in a performance hit.
Driver Support
There are many restrictions as to which surface combinations are valid for StretchRect. Factors include whether the driver is a Direct3D 9 driver or older, and whether the operation will result in stretching/shrinking. Since applications are not expected to recognize if the driver is a Direct3D 9 driver or not, the runtime will automatically set a new cap,
DirectX 8 Driver (no stretching) | |||||
---|---|---|---|---|---|
Dest formats | |||||
Texture | RT texture | RT | Off-screen plain | ||
Src formats | Texture | No | No | No | No |
RT texture | No | Yes | Yes | No | |
RT | No | Yes | Yes | No | |
Off-screen plain | Yes | Yes | Yes | Yes |
?
DirectX 8 Driver (stretching) | |||||
---|---|---|---|---|---|
Dest formats | |||||
Texture | RT texture | RT | Off-screen plain | ||
Src formats | Texture | No | No | No | No |
RT texture | No | No | No | No | |
RT | No | Yes | Yes | No | |
Off-screen plain | No | Yes | Yes | No |
?
Direct3D 9 Driver (no stretching) | |||||
---|---|---|---|---|---|
Dest formats | |||||
Texture | RT texture | RT | Off-screen plain | ||
Src formats | Texture | No | Yes | Yes | No |
RT texture | No | Yes | Yes | No | |
RT | No | Yes | Yes | No | |
Off-screen plain | No | Yes | Yes | Yes |
?
Direct3D 9 Driver (stretching) | |||||
---|---|---|---|---|---|
Dest formats | |||||
Texture | RT texture | RT | Off-screen plain | ||
Src formats | Texture | No | Yes | Yes | No |
RT texture | No | Yes | Yes | No | |
RT | No | Yes | Yes | No | |
Off-screen plain | No | Yes | Yes | No |
?
Allows an application to fill a rectangular area of a
Pointer to the surface to be filled.
Pointer to the source rectangle. Using
Color used for filling.
If the method succeeds, the return value is
This method can only be applied to a render target, a render-target texture surface, or an off-screen plain surface with a pool type of
When using a DirectX 7 or DirectX 8.x driver, the only YUV formats supported are
Create an off-screen surface.
Width of the surface.
Height of the surface.
Format of the surface. See
Surface pool type. See
Reserved. Set this parameter to
Pointer to the
Off-screen plain surfaces are always lockable, regardless of their pool types.
Sets a new color buffer for the device.
Index of the render target. See Remarks.
Pointer to a new color buffer. If
If the method succeeds, the return value is
The device can support multiple render targets. The number of render targets supported by a device is contained in the NumSimultaneousRTs member of
Setting a new render target will cause the viewport (see Viewports and Clipping (Direct3D 9)) to be set to the full size of the new render target.
Some hardware tests the compatibility of the depth stencil buffer with the color buffer. If this is done, it is only done in a debug build.
Restrictions for using this method include the following:
These restrictions are validated only when using the debug runtime when any of the
Cube textures differ from other surfaces in that they are collections of surfaces. To call
Retrieves a render-target surface.
Index of the render target. See Remarks.
Address of a reference to an
Typically, methods that return state will not work on a device that is created using
The device can now support multiple render targets. The number of render targets supported by a device is contained in the NumSimultaneousRTs member of
Calling this method will increase the internal reference count on the
Sets the depth stencil surface.
Address of a reference to an
If the method succeeds, the return value is
Restrictions for using this method include the following:
These restrictions are validated only when using the debug runtime when any of the
Cube textures differ from other surfaces in that they are collections of surfaces. To call
Gets the depth-stencil surface owned by the Direct3DDevice object.
Address of a reference to an
If the method succeeds, the return value is
Calling this method will increase the internal reference count on the
Begins a scene.
If the method succeeds, the return value is
Applications must call
If
There should be one
Ends a scene that was begun by calling
If the method succeeds, the return value is
When this method succeeds, the scene has been queued up for rendering by the driver. This is not a synchronous method, so the scene is not guaranteed to have completed rendering when this method returns.
Applications must call
If
There should be at most one
Clears one or more surfaces such as a render target, multiple render targets, a stencil buffer, and a depth buffer.
If the method succeeds, the return value is
Use this method to clear a surface including: a render target, all render targets in an MRT, a stencil buffer, or a depth buffer. Flags determines how many surfaces are cleared. Use pRects to clear a subset of a surface defined by an array of rectangles.
Sets a single device transformation-related state.
Device-state variable that is being modified. This parameter can be any member of the
Pointer to a
If the method succeeds, the return value is
Retrieves a matrix describing a transformation state.
Device state variable that is being modified. This parameter can be any member of the
Pointer to a
This method will not return device state for a device that is created using
Multiplies a device's world, view, or projection matrices by a specified matrix.
Member of the
Pointer to a
If the method succeeds, the return value is
The multiplication order is pMatrix times State.
An application might use the
shoulder_transformation upper_arm geometry elbow transformation lower_arm geometry wrist transformation hand geometry
An application might use the following series of calls to render this hierarchy. Not all the parameters are shown in this pseudocode.
(D3DTS_WORLDMATRIX(0), shoulder_transform) (upper_arm) (D3DTS_WORLDMATRIX(0), elbow_transform) (lower_arm) (D3DTS_WORLDMATRIX(0), wrist_transform) (hand)
Sets the viewport parameters for the device.
Pointer to a
If the method succeeds, the return value is
Direct3D sets the following default values for the viewport.
vp; vp.X = 0; vp.Y = 0; vp.Width = RenderTarget.Width; vp.Height = RenderTarget.Height; vp.MinZ = 0.0f; vp.MaxZ = 1.0f;
To draw multiple views within a scene, repeat the
Retrieves the viewport parameters currently set for the device.
Pointer to a
If the method succeeds, the return value is
Typically, methods that return state will not work on a device that is created using
Sets the material properties for the device.
Pointer to a
If the method succeeds, the return value is
Retrieves the current material properties for the device.
Pointer to a
If the method succeeds, the return value is
This method will not return device state for a device that is created using
Assigns a set of lighting properties for this device.
Zero-based index of the set of lighting properties to set. If a set of lighting properties exists at this index, it is overwritten by the new properties specified in pLight.
Pointer to a
If the method succeeds, the return value is
Set light properties by preparing a
The system allocates memory to accommodate a set of lighting properties each time you call the
The following example prepares and sets properties for a white point-light whose emitted light will not attenuate over distance.
// Assume d3dDevice is a valid reference to aninterface. d3dLight; hr; // Initialize the structure. ZeroMemory(&d3dLight, sizeof(d3dLight)); // Set up a white point light. d3dLight.Type = ; d3dLight.Diffuse.r = 1.0f; d3dLight.Diffuse.g = 1.0f; d3dLight.Diffuse.b = 1.0f; d3dLight.Ambient.r = 1.0f; d3dLight.Ambient.g = 1.0f; d3dLight.Ambient.b = 1.0f; d3dLight.Specular.r = 1.0f; d3dLight.Specular.g = 1.0f; d3dLight.Specular.b = 1.0f; // Position it high in the scene and behind the user. // Remember, these coordinates are in world space, so // the user could be anywhere in world space, too. // For the purposes of this example, assume the user // is at the origin of world space. d3dLight.Position.x = 0.0f; d3dLight.Position.y = 1000.0f; d3dLight.Position.z = -100.0f; // Don't attenuate. d3dLight.Attenuation0 = 1.0f; d3dLight.Range = 1000.0f; // Set the property information for the first light. hr = d3dDevice->SetLight(0, &d3dLight); if (SUCCEEDED(hr)) // Handle Success else // Handle failure
Enable a light source by calling the
Retrieves a set of lighting properties that this device uses.
Zero-based index of the lighting property set to retrieve. This method will fail if a lighting property has not been set for this index by calling the
Pointer to a
This method will not return device state for a device that is created using
Retrieve all the properties for an existing light source by calling the
// Assume d3dDevice is a valid reference to aninterface. hr; D3DLight9 light; // Get the property information for the first light. hr = pd3dDevice->GetLight(0, &light); if (SUCCEEDED(hr)) // Handle Success else // Handle failure
If you supply an index outside the range of the light sources assigned in the device, the
When you assign a set of light properties for a light source in a scene, the light source can be activated by calling the
// Assume d3dDevice is a valid reference to aninterface. hr; hr = pd3dDevice->LightEnable(0, TRUE); if (SUCCEEDED(hr)) // Handle Success else // Handle failure
Check the MaxActiveLights member of the
If you enable or disable a light that has no properties that are set with
Enables or disables a set of lighting parameters within a device.
Zero-based index of the set of lighting parameters that are the target of this method.
Value that indicates if the set of lighting parameters are being enabled or disabled. Set this parameter to TRUE to enable lighting with the parameters at the specified index, or
If the method succeeds, the return value is
If a value for LightIndex is outside the range of the light property sets assigned within the device, the
Member | Default |
---|---|
Type | |
Diffuse | (R:1, G:1, B:1, A:0) |
Specular | (R:0, G:0, B:0, A:0) |
Ambient | (R:0, G:0, B:0, A:0) |
Position | (0, 0, 0) |
Direction | (0, 0, 1) |
Range | 0 |
Falloff | 0 |
Attenuation0 | 0 |
Attenuation1 | 0 |
Attenuation2 | 0 |
Theta | 0 |
Phi | 0 |
?
Retrieves the activity status - enabled or disabled - for a set of lighting parameters within a device.
Zero-based index of the set of lighting parameters that are the target of this method.
Pointer to a variable to fill with the status of the specified lighting parameters. After the call, a nonzero value at this address indicates that the specified lighting parameters are enabled; a value of 0 indicates that they are disabled.
This method will not return device state for a device that is created using
Sets the coefficients of a user-defined clipping plane for the device.
Index of the clipping plane for which the plane equation coefficients are to be set.
Pointer to an address of a four-element array of values that represent the clipping plane coefficients to be set, in the form of the general plane equation. See Remarks.
If the method succeeds, the return value is
The coefficients that this method sets take the form of the general plane equation. If the values in the array at pPlane were labeled A, B, C, and D in the order that they appear in the array, they would fit into the general plane equation so that Ax + By + Cz + Dw = 0. A point with homogeneous coordinates (x, y, z, w) is visible in the half space of the plane if Ax + By + Cz + Dw >= 0. Points that exist behind the clipping plane are clipped from the scene.
When the fixed function pipeline is used the plane equations are assumed to be in world space. When the programmable pipeline is used the plane equations are assumed to be in the clipping space (the same space as output vertices).
This method does not enable the clipping plane equation being set. To enable a clipping plane, set the corresponding bit in the DWORD value applied to the
Retrieves the coefficients of a user-defined clipping plane for the device.
Index of the clipping plane for which the plane equation coefficients are retrieved.
Pointer to a four-element array of values that represent the coefficients of the clipping plane in the form of the general plane equation. See Remarks.
This method will not return device state for a device that is created using
The coefficients that this method reports take the form of the general plane equation. If the values in the array at pPlane were labeled A, B, C, and D in the order that they appear in the array, they would fit into the general plane equation so that Ax + By + Cz + Dw = 0. A point with homogeneous coordinates (x, y, z, w) is visible in the half space of the plane if Ax + By + Cz + Dw >= 0. Points that exist on or behind the clipping plane are clipped from the scene.
The plane equation used by this method exists in world space and is set by a previous call to the
Sets a single device render-state parameter.
Device state variable that is being modified. This parameter can be any member of the
New value for the device render state to be set. The meaning of this parameter is dependent on the value specified for State. For example, if State were
If the method succeeds, the return value is
Retrieves a render-state value for a device.
Device state variable that is being queried. This parameter can be any member of the
Pointer to a variable that receives the value of the queried render state variable when the method returns.
If the method succeeds, the return value is
This method will not return device state for a device that is created using
Creates a new state block that contains the values for all device states, vertex-related states, or pixel-related states.
Type of state data that the method should capture. This parameter can be set to a value defined in the
Pointer to a state block interface. See
If the method succeeds, the return value is
Vertex-related device states typically refer to those states that affect how the system processes vertices. Pixel-related states generally refer to device states that affect how the system processes pixel or depth-buffer data during rasterization. Some states are contained in both groups.
Differences between Direct3D 9 and Direct3D 10: In Direct3D 9, a state block contains state data, for the states it was requested to capture, when the object is created. To change the value of the state block, call |
?
Signals Direct3D to begin recording a device-state block.
If the method succeeds, the return value is
Applications can ensure that all recorded states are valid by calling the
The following methods can be recorded in a state block, after calling
The ordering of state changes in a state block is not guaranteed. If the same state is specified multiple times in a state block, only the last value is used.
Signals Direct3D to stop recording a device-state block and retrieve a reference to the state block interface.
Pointer to a state block interface. See
Sets the clip status.
Pointer to a
If the method succeeds, the return value is
Clip status is used during software vertex processing. Therefore, this method is not supported on pure or nonpure hardware processing devices. For more information about pure devices, see
When clipping is enabled during vertex processing (by
Clip status is not updated by
Retrieves the clip status.
Pointer to a
If the method succeeds, the return value is
When clipping is enabled during vertex processing (by
Clip status is not updated by
Clip status is used during software vertex processing. Therefore, this method is not supported on pure or nonpure hardware processing devices. For more information about pure devices, see
Retrieves a texture assigned to a stage for a device.
Stage identifier of the texture to retrieve. Stage identifiers are zero-based.
Address of a reference to an
Typically, methods that return state will not work on a device that is created using
Calling this method will increase the internal reference count on the
Assigns a texture to a stage for a device.
Zero based sampler number. Textures are bound to samplers; samplers define sampling state such as the filtering mode and the address wrapping mode. Textures are referenced differently by the programmable and the fixed function pipeline:
There are two other special cases for stage/sampler numbers.
Pointer to an
If the method succeeds, the return value is
SetTexture is not allowed if the texture is created with a pool type of
Retrieves a state value for an assigned texture.
Stage identifier of the texture for which the state is retrieved. Stage identifiers are zero-based. Devices can have up to eight set textures, so the maximum value allowed for Stage is 7.
Texture state to retrieve. This parameter can be any member of the
Pointer a variable to fill with the retrieved state value. The meaning of the retrieved value is determined by the Type parameter.
If the method succeeds, the return value is
This method will not return device state for a device that is created using
Sets the state value for the currently assigned texture.
Stage identifier of the texture for which the state value is set. Stage identifiers are zero-based. Devices can have up to eight set textures, so the maximum value allowed for Stage is 7.
Texture state to set. This parameter can be any member of the
State value to set. The meaning of this value is determined by the Type parameter.
If the method succeeds, the return value is
Gets the sampler state value.
The sampler stage index.
This parameter can be any member of the
State value to get. The meaning of this value is determined by the Type parameter.
If the method succeeds, the return value is
This method will not return device state for a device that is created using
Sets the sampler state value.
The sampler stage index. For more info about sampler stage, see Sampling Stage Registers in vs_3_0 (DirectX HLSL).
This parameter can be any member of the
State value to set. The meaning of this value is determined by the Type parameter.
If the method succeeds, the return value is
Reports the device's ability to render the current texture-blending operations and arguments in a single pass.
Pointer to a DWORD value to fill with the number of rendering passes needed to complete the desired effect through multipass rendering.
If the method succeeds, the return value is
The
Current hardware does not necessarily implement all possible combinations of operations and arguments. You can determine whether a particular blending operation can be performed with given arguments by setting the desired blending operation, and then calling the
The
For best performance, call
Using diffuse iterated values, either as an argument or as an operation (D3DTA_DIFFUSED3DTOP_BLENDDIFFUSEALPHA) is rarely supported on current hardware. Most hardware can introduce iterated color data only at the last texture operation stage.
Try to specify the texture (
Many cards do not support use of diffuse or scalar values at arbitrary texture stages. Often, these are available only at the first or last texture-blending stage.
Many cards do not have a blending unit associated with the first texture that is capable of more than replicating alpha to color channels or inverting the input. Therefore, your application might need to use only the second texture stage, if possible. On such hardware, the first unit is presumed to be in its default state, which has the first color argument set to
Operations on the output alpha that are more intricate than or substantially different from the color operations are less likely to be supported.
Some hardware does not support simultaneous use of
Many cards do not support simultaneous use of multiple textures and mipmapped trilinear filtering. If trilinear filtering has been requested for a texture involved in multitexture blending operations and validation fails, turn off trilinear filtering and revalidate. In this case, you might want to perform multipass rendering instead.
Sets palette entries.
An ordinal value identifying the particular palette upon which the operation is to be performed.
Pointer to a
If the method succeeds, the return value is
For Direct3D 9 applications, any palette sent to this method must conform to the
A single logical palette is associated with the device, and is shared by all texture stages.
Retrieves palette entries.
An ordinal value identifying the particular palette to retrieve.
Pointer to a
If the method succeeds, the return value is
For more information about
Note??As of Direct3D 9, the peFlags member of the
Sets the current texture palette.
Value that specifies the texture palette to set as the current texture palette.
If the method succeeds, the return value is
A single logical palette is associated with the device, and is shared by all texture stages.
Retrieves the current texture palette.
Pointer to a returned value that identifies the current texture palette.
If the method succeeds, the return value is
Sets the scissor rectangle.
Pointer to a
If the method succeeds, the return value is
The scissor rectangle is used as a rectangular clipping region.
See Rectangles (Direct3D 9) for further information on the use of rectangles in DirectX.
Gets the scissor rectangle.
Returns a reference to a
If the method succeeds, the return value is
The scissor rectangle is used as a rectangular clipping region.
See Rectangles (Direct3D 9) for further information on the use of rectangles in DirectX.
Use this method to switch between software and hardware vertex processing.
TRUE to specify software vertex processing;
If the method succeeds, the return value is
The restrictions for changing modes are as follows:
An application can create a mixed-mode device to use both the software vertex processing and the hardware vertex processing. To switch between the two vertex processing modes in DirectX 8.x, use IDirect3DDevice8::SetRenderState with the render state D3DRS_SOFTWAREVERTEXPROCESSING and the appropriate DWORD argument. The drawback of the render state approach was the difficulty in defining the semantics for state blocks. Applications and the runtime had to do extra work and be careful while recording and playing back state blocks.
In Direct3D 9, use SetSoftwareVertexProcessing instead. This new API is not recorded by StateBlocks.
Gets the vertex processing (hardware or software) mode.
Returns TRUE if software vertex processing is set. Otherwise, it returns
An application can create a mixed-mode device to use both the software vertex processing and the hardware vertex processing. To switch between the two vertex processing modes in DirectX 8.x, use
In Direct3D 9, use
Enable or disable N-patches.
Specifies the number of subdivision segments. If the number of segments is less than 1.0, N-patches are disabled. The default value is 0.0.
If the method succeeds, the return value is
Gets the N-patch mode segments.
Specifies the number of subdivision segments. If the number of segments is less than 1.0, N-patches are disabled. The default value is 0.0.
Renders a sequence of nonindexed, geometric primitives of the specified type from the current set of data input streams.
Member of the
Index of the first vertex to load. Beginning at StartVertex the correct number of vertices will be read out of the vertex buffer.
Number of primitives to render. The maximum number of primitives allowed is determined by checking the MaxPrimitiveCount member of the
If the method succeeds, the return value is
When converting a legacy application to Direct3D 9, you must add a call to either
Based on indexing, renders the specified geometric primitive into an array of vertices.
Member of the
Offset from the start of the vertex buffer to the first vertex. See Scenario 4.
Minimum vertex index for vertices used during this call. This is a zero based index relative to BaseVertexIndex.
Number of vertices used during this call. The first vertex is located at index: BaseVertexIndex + MinIndex.
Index of the first index to use when accesssing the vertex buffer. Beginning at StartIndex to index vertices from the vertex buffer.
Number of primitives to render. The number of vertices used is a function of the primitive count and the primitive type. The maximum number of primitives allowed is determined by checking the MaxPrimitiveCount member of the
If the method succeeds, the return value is
This method draws indexed primitives from the current set of data input streams. MinIndex and all the indices in the index stream are relative to the BaseVertexIndex.
The MinIndex and NumVertices parameters specify the range of vertex indices used for each
The
When converting a legacy application to Direct3D 9, you must add a call to either
Renders data specified by a user memory reference as a sequence of geometric primitives of the specified type.
Member of the
Number of primitives to render. The maximum number of primitives allowed is determined by checking the MaxPrimitiveCount member of the
User memory reference to the vertex data.
The number of bytes of data for each vertex. This value may not be 0.
If the method succeeds, the return value is
This method is intended for use in applications that are unable to store their vertex data in vertex buffers. This method supports only a single vertex stream. The effect of this call is to use the provided vertex data reference and stride for vertex stream 0. It is invalid to have the declaration of the current vertex shader refer to vertex streams other than stream 0.
Following any
The vertex data passed to
When converting a legacy application to Direct3D 9, you must add a call to either
Renders the specified geometric primitive with data specified by a user memory reference.
Member of the
Minimum vertex index. This is a zero-based index.
Number of vertices used during this call. The first vertex is located at index: MinVertexIndex.
Number of primitives to render. The maximum number of primitives allowed is determined by checking the MaxPrimitiveCount member of the
User memory reference to the index data.
Member of the
User memory reference to the vertex data. The vertex data must be in stream 0.
The number of bytes of data for each vertex. This value may not be 0.
If the method succeeds, the return value is
This method is intended for use in applications that are unable to store their vertex data in vertex buffers. This method supports only a single vertex stream, which must be declared as stream 0.
Following any
The vertex data passed to
When converting a legacy application to Direct3D 9, you must add a call to either
Applies the vertex processing defined by the vertex shader to the set of input data streams, generating a single stream of interleaved vertex data to the destination vertex buffer.
Index of first vertex to load.
Index of first vertex in the destination vertex buffer into which the results are placed.
Number of vertices to process.
Pointer to an
Pointer to an
Processing options. Set this parameter to 0 for default processing. Set to D3DPV_DONOTCOPYDATA to prevent the system from copying vertex data not affected by the vertex operation into the destination buffer. The D3DPV_DONOTCOPYDATA value may be combined with one or more
If the method succeeds, the return value is
The order of operations for this method is as follows:
The destination vertex buffer, pDestBuffer, must be created with a nonzero FVF parameter in
When Direct3D generates texture coordinates, or copies or transforms input texture coordinates, and the output texture coordinate format defines more texture coordinate components than Direct3D generates, Direct3D does not change these extra components.
Create a vertex shader declaration from the device and the vertex elements.
An array of
Pointer to an
If the method succeeds, the return value is
See the Vertex Declaration (Direct3D 9) page for a detailed description of how to map vertex declarations between different versions of DirectX.
Sets a Vertex Declaration (Direct3D 9).
If the method succeeds, the return value is
A vertex declaration is an
Gets a vertex shader declaration.
Pointer to an
If the method succeeds, the return value is
Sets the current vertex stream declaration.
DWORD containing the fixed function vertex type. For more information, see
If the method succeeds, the return value is
Here are the steps necessary to initialize and use vertices that have a position, diffuse and specular color, and texture coordinates:
struct LVertex { FLOAT x, y, z;specular, diffuse; FLOAT tu, tv; }; const DWORD VertexFVF = ( | | | );
g_d3dDevice->CreateVertexBuffer( 4*sizeof(LVertex),, VertexFVF, , &pBigSquareVB, null );
LVertex * v; pBigSquareVB->Lock( 0, 0, (BYTE**)&v, 0 ); v[0].x = 0.0f; v[0].y = 10.0; v[0].z = 10.0f; v[0].diffuse = 0xffff0000; v[0].specular = 0xff00ff00; v[0].tu = 0.0f; v[0].tv = 0.0f; v[1].x = 0.0f; v[1].y = 0.0f; v[1].z = 10.0f; v[1].diffuse = 0xff00ff00; v[1].specular = 0xff00ffff; v[1].tu = 0.0f; v[1].tv = 0.0f; v[2].x = 10.0f; v[2].y = 10.0f; v[2].z = 10.0f; v[2].diffuse = 0xffff00ff; v[2].specular = 0xff000000; v[2].tu = 0.0f; v[2].tv = 0.0f; v[3].x = 0.0f; v[3].y = 10.0f; v[3].z = 10.0f; v[3].diffuse = 0xffffff00; v[3].specular = 0xffff0000; v[3].tu = 0.0f; v[3].tv = 0.0f; pBigSquareVB->Unlock();
g_d3dDevice->SetFVF(VertexFVF); g_d3dDevice->SetStreamSource(0, pBigSquareVB, 0, sizeof(LVertex)); g_d3dDevice->DrawPrimitive(, 0 ,2);
Here are the steps necessary to initialize and use vertices that have a position, a normal, and texture coordinates:
struct Vertex { FLOAT x, y, z; FLOAT nx, ny, nz; FLOAT tu, tv; }; const DWORD VertexFVF = (| | );
Vertex * v; pBigSquareVB->Lock(0, 0, (BYTE**)&v, 0); v[0].x = 0.0f; v[0].y = 10.0; v[0].z = 10.0f; v[0].nx = 0.0f; v[0].ny = 1.0f; v[0].nz = 0.0f; v[0].tu = 0.0f; v[0].tv = 0.0f; v[1].x = 0.0f; v[1].y = 0.0f; v[1].z = 10.0f; v[1].nx = 0.0f; v[1].ny = 1.0f; v[1].nz = 0.0f; v[1].tu = 0.0f; v[1].tv = 0.0f; v[2].x = 10.0f; v[2].y = 10.0f; v[2].z = 10.0f; v[2].nx = 0.0f; v[2].ny = 1.0f; v[2].nz = 0.0f; v[2].tu = 0.0f; v[2].tv = 0.0f; v[3].x = 0.0f; v[3].y = 10.0f; v[3].z = 10.0f; v[3].nx = 0.0f; v[3].ny = 1.0f; v[3].nz = 0.0f; v[3].tu = 0.0f; v[3].tv = 0.0f; pBigSquareVB->Unlock();
Gets the fixed vertex function declaration.
A DWORD reference to the fixed function vertex type. For more information, see
If the method succeeds, the return value is
The fixed vertex function declaration is a set of FVF flags that determine how vertices processed by the fixed function pipeline will be used.
Creates a vertex shader.
Pointer to an array of tokens that represents the vertex shader, including any embedded debug and symbol table information.
Pointer to the returned vertex shader interface (see
If the method succeeds, the return value is
When a device is created,
For an example using
Sets the vertex shader.
Vertex shader interface. For more information, see
If the method succeeds, the return value is
To set a fixed-function vertex shader (after having set a programmable vertex shader), call
Retrieves the currently set vertex shader.
Pointer to a vertex shader interface.
If the method succeeds, the return value is
Typically, methods that return state will not work on a device that is created using
Sets a floating-point vertex shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of four float vectors in the array of constants.
If the method succeeds, the return value is
Gets a floating-point vertex shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of four float vectors in the array of constants.
If the method succeeds, the return value is
Sets an integer vertex shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of four integer vectors in the array of constants.
If the method succeeds, the return value is
Gets an integer vertex shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of four integer vectors in the array of constants.
If the method succeeds, the return value is
Sets a Boolean vertex shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of boolean values in the array of constants.
If the method succeeds, the return value is
Gets a Boolean vertex shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of Boolean values in the array of constants.
If the method succeeds, the return value is
Binds a vertex buffer to a device data stream. For more information, see Setting the Stream Source (Direct3D 9).
If the method succeeds, the return value is
When a FVF vertex shader is used, the stride of the vertex stream must match the vertex size, computed from the FVF. When a declaration is used, the stride should be greater than or equal to the stream size computed from the declaration.
When calling SetStreamSource, the stride is normally required to be equal to the vertex size. However, there are times when you may want to draw multiple instances of the same or similar geometry (such as when using instancing to draw). For this case, use a zero stride to tell the runtime not to increment the vertex buffer offset (ie: use the same vertex data for all instances). For more information about instancing, see Efficiently Drawing Multiple Instances of Geometry (Direct3D 9).
Retrieves a vertex buffer bound to the specified data stream.
Specifies the data stream, in the range from 0 to the maximum number of streams minus one.
Address of a reference to an
Pointer containing the offset from the beginning of the stream to the beginning of the vertex data. The offset is measured in bytes. See Remarks.
Pointer to a returned stride of the component, in bytes. See Remarks.
If the method succeeds, the return value is
A stream is defined as a uniform array of component data, where each component consists of one or more elements representing a single entity such as position, normal, color, and so on.
When a FVF vertex shader is used, the stride of the vertex stream must match the vertex size, computed from the FVF. When a declaration is used, the stride should be greater than or equal to the stream size computed from the declaration.
Calling this method will increase the internal reference count on the
Sets the stream source frequency divider value. This may be used to draw several instances of geometry.
Stream source number.
This parameter may have two different values. See remarks.
If the method succeeds, the return value is
There are two constants defined in d3d9types.h that are designed to use with SetStreamSourceFreq:
Gets the stream source frequency divider value.
Stream source number.
Returns the frequency divider value.
If the method succeeds, the return value is
Vertex shaders can now be invoked more than once per vertex. See Drawing Non-Indexed Geometry.
Sets index data.
Pointer to an
If the method succeeds, the return value is
When an application no longer holds a references to this interface, the interface will automatically be freed.
The
Retrieves index data.
Address of a reference to an
If the method succeeds, the return value is
Calling this method will increase the internal reference count on the
Creates a pixel shader.
Pointer to the pixel shader function token array, specifying the blending operations. This value cannot be
Pointer to the returned pixel shader interface. See
If the method succeeds, the return value is
Sets the current pixel shader to a previously created pixel shader.
Pixel shader interface.
If the method succeeds, the return value is
Retrieves the currently set pixel shader.
Pointer to a pixel shader interface.
If the method succeeds, the return value is
This method will not work on a device that is created using
Sets a floating-point shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of four float vectors in the array of constants.
If the method succeeds, the return value is
Gets a floating-point shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of four float vectors in the array of constants.
If the method succeeds, the return value is
Sets an integer shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of four integer vectors in the array of constants.
If the method succeeds, the return value is
Gets an integer shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of four integer vectors in the array of constants.
If the method succeeds, the return value is
Sets a Boolean shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of boolean values in the array of constants.
If the method succeeds, the return value is
Gets a Boolean shader constant.
Register number that will contain the first constant value.
Pointer to an array of constants.
Number of Boolean values in the array of constants.
If the method succeeds, the return value is
Draws a rectangular patch using the currently set streams.
Handle to the rectangular patch to draw.
Pointer to an array of four floating-point values that identify the number of segments each edge of the rectangle patch should be divided into when tessellated. See
Pointer to a
If the method succeeds, the return value is
For static patches: Set the vertex shader, set the appropriate streams, supply patch information in the pRectPatchInfo parameter, and specify a handle so that Direct3D can capture and cache information. Call
Calling
For dynamic patches, the patch data changes for every rendering of the patch, so it is not efficient to cache information. The application can convey this to Direct3D by setting Handle to 0. In this case, Direct3D draws the patch using the currently set streams and the pNumSegs values, and does not cache any information. It is not valid to simultaneously set Handle to 0 and pRectPatchInfo to
Draws a triangular patch using the currently set streams.
Handle to the triangular patch to draw.
Pointer to an array of three floating-point values that identify the number of segments each edge of the triangle patch should be divided into when tessellated. See
Pointer to a
If the method succeeds, the return value is
For static patches: Set the vertex shader, set the appropriate streams, supply patch information in the pTriPatchInfo parameter, and specify a handle so that Direct3D can capture and cache information. To efficiently draw the patch, call
Calling
For dynamic patches, the patch data changes for every rendering of the patch so it is not efficient to cache information. The application can convey this to Direct3D by setting Handle to 0. In this case, Direct3D draws the patch using the currently set streams and the pNumSegs values, and does not cache any information. It is not valid to simultaneously set Handle to 0 and pTriPatchInfo to
Frees a cached high-order patch.
Handle of the cached high-order patch to delete.
If the method succeeds, the return value is
Creates a status query.
Identifies the query type. For more information, see
Returns a reference to the query interface that manages the query object. See
This parameter can be set to
If the method succeeds, the return value is
This method is provided for both synchronous and asynchronous queries. It takes the place of GetInfo, which is no longer supported in Direct3D 9.
Synchronous and asynchronous queries are created with
Applications use the methods of the
The
The LPDIRECT3DDEVICE9EX and PDIRECT3DDEVICE9EX types are defined as references to the
typedef struct*LPDIRECT3DDEVICE9EX, *PDIRECT3DDEVICE9EX;
Get or sets the priority of the GPU thread.
Use
This method will retrieve the priority of the thread stored with the Direct3D device even if it was created with the
Retrieves or sets the number of frames of data that the system is allowed to queue.
Frame latency is the number of frames that are allowed to be stored in a queue, before submission for rendering. Latency is often used to control how the CPU chooses between responding to user input and frames that are in the render queue.
It is often beneficial for applications that have no user input (for example, video playback) to queue more than 3 frames of data.
Prepare the texture sampler for monochrome convolution filtering on a single-color texture.
The width of the filter kernel; ranging from 1 - D3DCONVOLUTIONMONO_MAXWIDTH. The default value is 1.
The height of the filter kernel; ranging from 1 - D3DCONVOLUTIONMONO_MAXHEIGHT. The default value is 1.
An array of weights, one weight for each kernel sub-element in the width. This parameter must be
An array of weights, one weight for each kernel sub-element in the height. This parameter must be
If the method succeeds, the return value is
This method is designed to filter a single color texture. A monochrome convolution filter is a 2D box filter with all of the weights set to 1.0; the filter kernel resolution ranges from 1 x 1 to 7 x 7. When monochrome texture filtering is set to a texture sampler and texture sampling is performed at location, then Direct3D performs convolution.
Restrictions include:
Copy a text string to one surface using an alphabet of glyphs on another surface. Composition is done by the GPU using bitwise operations.
A reference to a source surface (prepared by
A reference to the destination surface (prepared by
A reference to a vertex buffer (see
The number of rectangles or glyphs that are used in the operation. The number applies to both the source and destination surfaces. The range is 0 to D3DCOMPOSERECTS_MAXNUMRECTS.
A reference to a vertex buffer (see
Specifies how to combine the source and destination surfaces. See
A value added to the x coordinates of all destination rectangles. This value can be negative, which may cause the glyph to be rejected or clipped if the result is beyond the bounds of the surface.
A value added to the y coordinates of all destination rectangles. This value can be negative, which may cause the glyph to be rejected or clipped if the result is beyond the bounds of the surface.
If the method succeeds, the return value is
Glyphs from a one-bit source surface are put together into another one-bit texture surface with this method. The destination surface can then be used as the source for a normal texturing operation that will filter and scale the strings of text onto some other non-monochrome surface.
This method has several constraints (which are similar to StretchRect):
The method is not recorded in state blocks.
Swap the swapchain's next buffer with the front buffer.
Pointer to a
Pointer to
Pointer to a destination window whose client area is taken as the target for this presentation. If this value is
Note??If you create a swap chain with
Pointer to a
If this value is non-
Allows the application to request that the method return immediately when the driver reports that it cannot schedule a presentation. Valid values are 0, or any combination of
Possible return values include:
Differences between Direct3D 9 and Direct3D 9Ex: |
?
Similar to the
When the swapchain is created with
Get the priority of the GPU thread.
Current GPU priority. Valid values range from -7 to 7.
Possible return values include:
Use
This method will retrieve the priority of the thread stored with the Direct3D device even if it was created with the
Set the priority on the GPU thread.
The thread priority, ranging from -7 to 7.
Possible return values include:
GPU thread priority is not reset when a device is lost. The effects of calls to this method are not recorded in state blocks.
Suspend execution of the calling thread until the next vertical blank signal.
Swap chain index. This is an optional, zero-based index used to specify a swap chain on a multihead card.
This method will always return
This method allows applications to efficiently throttle their frame rate to that of the monitor associated with the device. Following a vertical blank, the amount of time it takes for the thread to wake up is typically very short.
In some scenarios the hardware may stop generating vertical blank signals when nothing is being displayed on the monitor. In this case, the method will wait approximately 100ms and return with
Checks an array of resources to determine if it is likely that they will cause a large stall at Draw time because the system must make the resources GPU-accessible.
An array of
A value indicating the number of resources passed into the pResourceArray parameter up to a maximum of 65535.
If all the resources are in GPU-accessible memory, the method will return
If no allocation that comprises the resources is on disk, but at least one allocation is not in GPU-accessible memory, the method will return
If at least one allocation that comprises the resources is on disk, this method will return S_NOT_RESIDENT. The system may need to perform a copy to promote the resource.
This API is no more than a reasonable guess at residency, since resources may have been demoted by the time the application uses them.
The expected usage pattern is as follows. If the application determines that a set of resources are not resident, then the application will substitute a lower-LOD version of the resource and continue with rendering. The video memory manager API, offers a feature to allow the application to express that it would like these lower-LOD resources to be made more likely to stay resident in GPU-accessible memory. It is the app's responsibility to create, fill and destroy these lower-LOD versions, if it so chooses.
The application also needs to begin promotion of the higher-LOD versions when the residency check indicates that the resource is not resident in GPU-accessible memory. Since a per-process lock exists in kernel mode, a performant implementation will spawn a separate process whose sole job is to promote resources. The application communicates resource identity between the two process by means of the Sharing Resources shared surfaces API and promotes them by means of the SetPriority.
Checks an array of resources to determine if it is likely that they will cause a large stall at Draw time because the system must make the resources GPU-accessible.
An array of
A value indicating the number of resources passed into the pResourceArray parameter up to a maximum of 65535.
If all the resources are in GPU-accessible memory, the method will return
If no allocation that comprises the resources is on disk, but at least one allocation is not in GPU-accessible memory, the method will return
If at least one allocation that comprises the resources is on disk, this method will return S_NOT_RESIDENT. The system may need to perform a copy to promote the resource.
This API is no more than a reasonable guess at residency, since resources may have been demoted by the time the application uses them.
The expected usage pattern is as follows. If the application determines that a set of resources are not resident, then the application will substitute a lower-LOD version of the resource and continue with rendering. The video memory manager API, offers a feature to allow the application to express that it would like these lower-LOD resources to be made more likely to stay resident in GPU-accessible memory. It is the app's responsibility to create, fill and destroy these lower-LOD versions, if it so chooses.
The application also needs to begin promotion of the higher-LOD versions when the residency check indicates that the resource is not resident in GPU-accessible memory. Since a per-process lock exists in kernel mode, a performant implementation will spawn a separate process whose sole job is to promote resources. The application communicates resource identity between the two process by means of the Sharing Resources shared surfaces API and promotes them by means of the SetPriority.
Checks an array of resources to determine if it is likely that they will cause a large stall at Draw time because the system must make the resources GPU-accessible.
An array of
A value indicating the number of resources passed into the pResourceArray parameter up to a maximum of 65535.
If all the resources are in GPU-accessible memory, the method will return
If no allocation that comprises the resources is on disk, but at least one allocation is not in GPU-accessible memory, the method will return
If at least one allocation that comprises the resources is on disk, this method will return S_NOT_RESIDENT. The system may need to perform a copy to promote the resource.
This API is no more than a reasonable guess at residency, since resources may have been demoted by the time the application uses them.
The expected usage pattern is as follows. If the application determines that a set of resources are not resident, then the application will substitute a lower-LOD version of the resource and continue with rendering. The video memory manager API, offers a feature to allow the application to express that it would like these lower-LOD resources to be made more likely to stay resident in GPU-accessible memory. It is the app's responsibility to create, fill and destroy these lower-LOD versions, if it so chooses.
The application also needs to begin promotion of the higher-LOD versions when the residency check indicates that the resource is not resident in GPU-accessible memory. Since a per-process lock exists in kernel mode, a performant implementation will spawn a separate process whose sole job is to promote resources. The application communicates resource identity between the two process by means of the Sharing Resources shared surfaces API and promotes them by means of the SetPriority.
Set the number of frames that the system is allowed to queue for rendering.
The maximum number of back buffer frames that a driver can queue. The value is typically 3, but can range from 1 to 20. A value of 0 will reset latency to the default. For multi-head devices, MaxLatency is specified per-head.
Possible return values include:
Frame latency is the number of frames that are allowed to be stored in a queue, before submission for rendering. Latency is often used to control how the CPU chooses between responding to user input and frames that are in the render queue.
It is often beneficial for applications that have no user input (for example, video playback) to queue more than 3 frames of data.
Retrieves the number of frames of data that the system is allowed to queue.
Returns the number of frames that can be queued for render. The value is typically 3, but can range from 1 to 20.
Possible return values include:
Frame latency is the number of frames that are allowed to be stored in a queue, before submission for rendering. Latency is often used to control how the CPU chooses between responding to user input and frames that are in the render queue.
It is often beneficial for applications that have no user input (for example, video playback) to queue more than 3 frames of data.
Reports the current cooperative-level status of the Direct3D device for a windowed or full-screen application.
The destination window handle to check for occlusion. When this parameter is
Possible return values include:
This method replaces
We recommend not to call CheckDeviceState every frame. Instead, call CheckDeviceState only if the
See Lost Device Behavior Changes for more information about lost, hung, and removed devices.
Creates a render-target surface.
Width of the render-target surface, in pixels.
Height of the render-target surface, in pixels.
Member of the
Member of the
Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by
Render targets are not lockable unless the application specifies TRUE for Lockable.
Note that lockable render targets reduce performance on some graphics hardware. The readback performance (moving data from video memory to system memory) depends on the type of hardware used (AGP vs. PCI Express) and is usually far lower than upload performance (moving data from system to video memory). If you need read access to render targets, use GetRenderTargetData instead of lockable render targets.
Reserved. Set this parameter to
Combination of one or more
Address of a reference to an
Render-target surfaces are placed in the
The creation of lockable, multisampled render targets is not supported.
Create an off-screen surface.
Width of the surface.
Height of the surface.
Format of the surface. See
Surface pool type. See
Reserved. Set this parameter to
Combination of one or more
Pointer to the
Off-screen plain surfaces are always lockable, regardless of their pool types.
Creates a depth-stencil surface.
Width of the depth-stencil surface, in pixels.
Height of the depth-stencil surface, in pixels.
Member of the
Member of the
Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by
Set this flag to TRUE to enable z-buffer discarding, and
This flag has the same behavior as the constant,
Reserved. Set this parameter to
Combination of one or more
Address of a reference to an
The memory class of the depth-stencil buffer is always
Resets the type, size, and format of the swap chain with all other surfaces persistent.
Pointer to a
When switching to full-screen mode, Direct3D will try to find a desktop format that matches the back buffer format, so that back buffer and front buffer formats will be identical (to eliminate the need for color conversion).
When this method returns:
Pointer to a
The method can return:
If this method returns
If a call to
Unlike previous versions of DirectX, calling
Pixel shaders and vertex shaders survive
There are two different types of swap chains: full-screen or windowed. If the new swap chain is full-screen, the adapter will be placed in the display mode that matches the new size.
Applications can expect messages to be sent to them during this call (for example, before this call is returned); applications should take precautions not to call into Direct3D at this time.
A call to
When trying to reset more than one display adapter in a group, set pPresentationParameters to point to an array of
If a multihead device was created with
Retrieves the display mode's spatial resolution, color resolution, refresh frequency, and rotation settings.
An unsigned integer specifying the swap chain.
Pointer to a
Pointer to a
Applications use the methods of the
The
The LPDIRECT3D9 and PDIRECT3D9 types are defined as references to the
typedef struct*LPDIRECT3D9, *PDIRECT3D9;
LPDIRECT3D9 g_pD3D = NULL; if( NULL == (g_pD3D = Direct3DCreate9(D3D_SDK_VERSION))) return E_FAIL;
The IDirect3D9 interface supports enumeration of active display adapters and allows the creation of Returns the number of adapters on the system.
Registers a pluggable software device. Software devices provide software rasterization enabling applications to access a variety of software rasterizers.
Pointer to the initialization function for the software device to be registered.
If the method succeeds, the return value is
If the user's computer provides no special hardware acceleration for 3D operations, your application might emulate 3D hardware in software. Software rasterization devices emulate the functions of color 3D hardware in software. A software device runs more slowly than a hal. However, software devices take advantage of any special instructions supported by the CPU to increase performance. Instruction sets include the AMD 3DNow! instruction set on some AMD processors and the MMX instruction set supported by many Intel processors. Direct3D uses the 3D-Now! instruction set to accelerate transformation and lighting operations and the MMX instruction set to accelerate rasterization.
Software devices communicate with Direct3D through an interface similar to the hardware device driver interface (DDI).
Software devices are loaded by the application and registered with the
The Direct3D Driver Development Kit (DDK) provides the documentation and headers for developing pluggable software devices.
Returns the number of adapters on the system.
A UINT value that denotes the number of adapters on the system at the time this
Describes the physical display adapters present in the system when the
Returns the number of display modes available on this adapter.
Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.
Identifies the format of the surface type using
This method returns the number of display modes on this adapter or zero if Adapter is greater than or equal to the number of adapters on the system.
Queries the device to determine whether the specified adapter supports the requested format and display mode. This method could be used in a loop to enumerate all the available adapter modes.
Ordinal number denoting the display adapter to enumerate. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns
Allowable pixel formats. See Remarks.
Represents the display-mode index which is an unsigned integer between zero and the value returned by GetAdapterModeCount minus one.
A reference to the available display mode of type
An application supplies a display mode and a format to EnumAdapterModes which returns a display mode. This method could be used in a loop to enumerate all available display modes.
The application specifies a format and the enumeration is restricted to those display modes that exactly match the format (alpha is ignored). Allowed formats (which are members of
In addition, EnumAdapterModes treats pixel formats 565 and 555 as equivalent, and returns the correct version. The difference comes into play only when the application locks the back buffer and there is an explicit flag that the application must set in order to accomplish this.
Retrieves the current display mode of the adapter.
Ordinal number that denotes the display adapter to query. D3DADAPTER_DEFAULT is always the primary display adapter.
Pointer to a
GetAdapterDisplayMode will not return the correct format when the display is in an extended format, such as 2:10:10:10. Instead, it returns the format X8R8G8B8.
Verifies whether a hardware accelerated device type can be used on this adapter.
Ordinal number denoting the display adapter to enumerate. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns
Member of the
Member of the
Back buffer format. For more information about formats, see
Value indicating whether the device type will be used in full-screen or windowed mode. If set to TRUE, the query is performed for windowed applications; otherwise, this value should be set
If the device can be used on this adapter,
A hal device type requires hardware acceleration. Applications can use CheckDeviceType to determine if the needed hardware and drivers are present to support a hal device.
Full-screen applications should not specify a DisplayFormat that contains an alpha channel. This will result in a failed call. Note that an alpha channel can be present in the back buffer but the two display formats must be identical in all other respects. For example, if DisplayFormat =
The following code fragment shows how you could use CheckDeviceType to test whether a certain device type can be used on this adapter.
if(SUCCEEDED(pD3Device->CheckDeviceType(D3DADAPTER_DEFAULT,, DisplayFormat, BackBufferFormat, bIsWindowed))) return ; // There is no HAL on this adapter using this render-target format. // Try again, using another format.
This code returns
Using CheckDeviceType to test for compatibility between a back buffer that differs from the display format will return appropriate values. This means that the call will reflect device capabilities. If the device cannot render to the requested back-buffer format, the call will still return
Determines whether a surface format is available as a specified resource type and can be used as a texture, depth-stencil buffer, or render target, or any combination of the three, on a device representing this adapter.
Ordinal number denoting the display adapter to query. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns
Member of the
Member of the
Requested usage options for the surface. Usage options are any combination of
Resource type requested for use with the queried format. Member of
Format of the surfaces which may be used, as defined by Usage. Member of
If the format is compatible with the specified device for the requested usage, this method returns
Here are some examples using CheckDeviceFormat to check for hardware support of:
IsDepthFormatExisting( DepthFormat, AdapterFormat ) { hr = pD3D->CheckDeviceFormat( D3DADAPTER_DEFAULT, , AdapterFormat, , , DepthFormat); return SUCCEEDED( hr ); }
See Selecting a Device (Direct3D 9) for more detail on the enumeration process.
IsTextureFormatOk( TextureFormat, AdapterFormat ) { hr = pD3D->CheckDeviceFormat( D3DADAPTER_DEFAULT, , AdapterFormat, 0, , TextureFormat); return SUCCEEDED( hr ); }
When migrating code from Direct3D 9 to Direct3D 10, the Direct3D 10 equivalent to CheckDeviceFormat is CheckFormatSupport.
Determines if a multisampling technique is available on this device.
Ordinal number denoting the display adapter to query. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns
Member of the
Member of the
bool value. Specify TRUE to inquire about windowed multisampling, and specify
Member of the
pQualityLevels returns the number of device-specific sampling variations available with the given sample type. For example, if the returned value is 3, then quality levels 0, 1 and 2 can be used when creating resources with the given sample count. The meanings of these quality levels are defined by the device manufacturer and cannot be queried through D3D. For example, for a particular device different quality levels at a fixed sample count might refer to different spatial layouts of the sample locations or different methods of resolving. This can be
If the device can perform the specified multisampling method, this method returns
This method is intended for use with both render-target and depth-stencil surfaces because you must create both surfaces multisampled if you want to use them together.
The following code fragment shows how you could use CheckDeviceMultiSampleType to test for devices that support a specific multisampling method.
if( SUCCEEDED(pD3D->CheckDeviceMultiSampleType( pCaps->AdapterOrdinal, pCaps->DeviceType, BackBufferFormat,, , null ) ) && SUCCEEDED(pD3D->CheckDeviceMultiSampleType( pCaps->AdapterOrdinal, pCaps->DeviceType, DepthBufferFormat,, , null ) ) ) return;
The preceding code will return
See the remarks in
Determines whether a depth-stencil format is compatible with a render-target format in a particular display mode.
Ordinal number denoting the display adapter to query. D3DADAPTER_DEFAULT is always the primary display adapter.
Member of the
Member of the
Member of the
Member of the
If the depth-stencil format is compatible with the render-target format in the display mode, this method returns
This method is provided to enable applications to work with hardware requiring that certain depth formats can only work with certain render-target formats.
The behavior of this method has been changed for DirectX 8.1. This method now pays attention to the D24x8 and D32 depth-stencil formats. The previous version assumed that these formats would always be usable with 32- or 16-bit render targets. This method will now return
The following code fragment shows how you could use CheckDeviceFormat to validate a depth stencil format.
IsDepthFormatOk( DepthFormat, AdapterFormat, BackBufferFormat) { // Verify that the depth format exists hr = pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, , AdapterFormat, , , DepthFormat); if(FAILED(hr)) return ; // Verify that the depth format is compatible hr = pD3D->CheckDepthStencilMatch(D3DADAPTER_DEFAULT, , AdapterFormat, BackBufferFormat, DepthFormat); return SUCCEEDED(hr); }
The preceding call will return
Tests the device to see if it supports conversion from one display format to another.
Display adapter ordinal number. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns
Device type. Member of the
Source adapter format. Member of the
Target adapter format. Member of the
If the method succeeds, the return value is
Using CheckDeviceType to test for compatibility between a back buffer that differs from the display format will return appropriate values. This means that the call will reflect device capabilities. If the device cannot render to the requested back buffer format, the call will still return
CheckDeviceFormatConversion can also be used to determine which combinations of source surface formats and destination surface formats are permissible in calls to StretchRect.
Color conversion is restricted to the following source and target formats.
?
Retrieves device-specific information about a device.
Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.
Member of the
Pointer to a
The application should not assume the persistence of vertex processing capabilities across Direct3D device objects. The particular capabilities that a physical device exposes may depend on parameters supplied to CreateDevice. For example, the capabilities may yield different vertex processing capabilities before and after creating a Direct3D Device Object with hardware vertex processing enabled. For more information see the description of
Returns the handle of the monitor associated with the Direct3D object.
Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.
Handle of the monitor associated with the Direct3D object.
As shown in the following code fragment, which illustrates how to obtain a handle to the monitor associated with a given device, use GetDirect3D to return the Direct3D enumerator from the device and use GetCreationParameters to retrieve the value for Adapter.
if( FAILED( pDevice->GetCreationParameters( &Parameters ) ) ) return; if( FAILED( pDevice->GetDirect3D(&pD3D) ) ) return ; hMonitor = pD3D->GetAdapterMonitor(Parameters.AdapterOrdinal); pD3D->Release();
Creates a device to represent the display adapter.
Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.
Member of the
The focus window alerts Direct3D when an application switches from foreground mode to background mode. See Remarks.
Combination of one or more options that control device creation. For more information, see
Pointer to a
For Windows 2000 and Windows XP, the full-screen device display refresh rate is set in the following order:
An unsupported refresh rate will default to the closest supported refresh rate below it. For example, if the application specifies 63 hertz, 60 hertz will be used. There are no supported refresh rates below 57 hertz.
pPresentationParameters is both an input and an output parameter. Calling this method may change several members including:
Address of a reference to the returned
If the method succeeds, the return value is
This method returns a fully working device interface, set to the required display mode (or windowed), and allocated with the appropriate back buffers. To begin rendering, the application needs only to create and set a depth buffer (assuming EnableAutoDepthStencil is
When you create a Direct3D device, you supply two different window parameters: a focus window (hFocusWindow) and a device window (the hDeviceWindow in
This method should not be run during the handling of WM_CREATE. An application should never pass a window handle to Direct3D while handling WM_CREATE. Any call to create, release, or reset the device must be done using the same thread as the window procedure of the focus window.
Note that
Back buffers created as part of the device are only lockable if
The methods Reset,
If you attempt to create a device on a 0x0 sized window, CreateDevice will fail.
Applications use the methods of the
The
The LPDIRECT3D9EX and PDIRECT3D9EX types are defined as references to the
typedef struct*LPDIRECT3D9EX, *PDIRECT3D9EX;
Returns the number of display modes available.
Ordinal number denoting the display adapter from which to retrieve the display mode count.
Specifies the characteristics of the desired display mode. See
The number of display modes available. A return of value zero from this method is an indication that no such display mode is supported or simply this monitor is no longer available.
Events such as display mode changes on other heads of the same hardware, monitor change or its connection status change, and desktop extension/unextension could all affect the number of display mode available.
To fullscreen applications,
To increase the chance of setting a currently available display mode successfully, fullscreen applications should try to requery the available display mode list upon receiving
This method returns the actual display mode info based on the given mode index.
Ordinal number denoting the display adapter to enumerate. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns
See
Represents the display-mode index which is an unsigned integer between zero and the value returned by GetAdapterModeCount minus one.
A reference to the available display mode of type
Retrieves the current display mode and rotation settings of the adapter.
Ordinal number that denotes the display adapter to query. D3DADAPTER_DEFAULT is always the primary display adapter.
Pointer to a
Pointer to a
GetAdapterDisplayModeEx does not return the correct format when the display is in an extended format, such as 2:10:10:10. Instead, it returns the format X8R8G8B8.
To windowed applications, a value of
Creates a device to represent the display adapter.
Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.
Specifies the type of device. See
The focus window alerts Direct3D when an application switches from foreground mode to background mode. For full-screen mode, the window specified must be a top-level window. For windowed mode, this parameter may be
Combination of one or more options (see
Pointer to a
This parameter is both an input and an output parameter. Calling this method may change several members including:
The display mode for when the device is set to fullscreen. See
Address of a reference to the returned
This method returns
This method returns a unique identifier for the adapter that is specific to the adapter hardware. Applications can use this identifier to define robust mappings across various APIs (Direct3D 9, DXGI).
Ordinal number denoting the display adapter from which to retrieve the
A unique identifier for the given adapter.
Describes the display mode.
Screen width, in pixels.
Screen height, in pixels.
Refresh rate. The value of 0 indicates an adapter default.
Member of the
Information about the properties of a display mode.
This structure is used in various methods to create and manage Direct3D 9Ex devices (
The size of this structure. This should always be set to sizeof(
Width of the display mode.
Height of the display mode.
Refresh rate of the display mode.
Format of the display mode. See
Indicates whether the scanline order is progressive or interlaced. See
Used to set and query effects, and to choose techniques. An effect object can contain multiple techniques to render the same effect.
The
The LPD3DXEFFECT type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXEFFECT;
Gets a reference to the pool of shared parameters.
Pools contain shared parameters between effects. See Cloning and Sharing (Direct3D 9).
Retrieves the device associated with the effect.
Calling this method will increase the internal reference count for the
Get or sets the effect state manager.
The
Gets a reference to the pool of shared parameters.
Pointer to a
This method always returns the value
Pools contain shared parameters between effects. See Cloning and Sharing (Direct3D 9).
Sets the active technique.
Unique handle to the technique. See Handles (Direct3D 9).
If the method succeeds, the return value is
Gets the current technique.
A unique identifier to the current technique. See Handles (Direct3D 9).
Validate a technique.
Unique identifier. See Handles (Direct3D 9).
If the method succeeds, the return value is
Searches for the next valid technique, starting at the technique after the specified technique.
Unique identifier to a technique. See Handles (Direct3D 9). Specify
Pointer to an identifier for the next technique.
Determines if a parameter is used by the technique.
Unique identifier for the parameter. See Handles (Direct3D 9).
Unique identifier for the technique. See Handles (Direct3D 9).
Returns TRUE if the parameter is being used and returns
Starts an active technique.
DWORD that determines if state modified by an effect is saved and restored. The default value 0 specifies that
Pointer to a value returned that indicates the number of passes needed to render the current technique.
An application sets one active technique in the effect system by calling
Within the
Begins a pass, within the active technique.
A zero-based integer index into the technique.
If the method succeeds, the return value is
An application sets one active pass (within one active technique) in the effect system by calling
If the application changes any effect state using any of the Effect::Setx methods inside of a
Propagate state changes that occur inside of an active pass to the device before rendering.
If the method succeeds, the return value is
If the application changes any effect state using any of the ID3DXEffect::Setx methods inside of an
This is slightly different for any shared parameters in a cloned effect. When a technique is active on a cloned effect (that is, when
End an active pass.
This method always returns the value
An application signals the end of rendering an active pass by calling
Each matching pair of
If the application changes any effect state using any of the Effect::Setx methods inside of a
Ends an active technique.
This method always returns the value
All rendering in an effect is done within a matching pair of
By default, the effect system takes care of saving state prior to a technique, and restoring state after a technique. If you choose to disable this save and restore functionality, see
Retrieves the device associated with the effect.
Address of a reference to an
If the method succeeds, the return value is
Calling this method will increase the internal reference count for the
Use this method to release all references to video memory resources and delete all stateblocks. This method should be called whenever a device is lost, or before resetting a device.
If the method succeeds, the return value is
This method should be called whenever the device is lost or before the user calls
Use this method to re-acquire resources and save initial state.
If the method succeeds, the return value is
Set the effect state manager.
A reference to the state manager. See
If the method succeeds, the return value is
The
Get the effect state manager.
Returns a reference to the state manager. See
If the method succeeds, the return value is
The
Start capturing state changes in a parameter block.
If the method succeeds, the return value is
Capture effect parameter state changes until EndParameterBlock is called. Effect parameters include any state changes outside of a pass. Delete parameter blocks if they are no longer needed by calling DeleteParameterBlock.
Stop capturing effect parameter state changes.
Returns a handle to the parameter state block.
All effect parameters that change state (after calling BeginParameterBlock and before calling EndParameterBlock) will be saved in an effect parameter state block. Use ApplyParameterBlock to apply this block of state changes to the effect system. Once you are finished with a state block use DeleteParameterBlock to free the memory.
Apply the values in a state block to the current effect system state.
A handle to the parameter block. This is the handle returned by
If the method succeeds, the return value is
Capture effect parameter state changes in a parameter block by calling BeginParameterBlock; stop capturing state changes by calling EndParameterBlock. These state changes include any effect parameter changes that occur inside of a technique (including those outside of a pass). Once you are done with the parameter block, call DeleteParameterBlock to recover memory.
Delete a parameter block.
A handle to the parameter block. This is the handle returned by
If the method succeeds, the return value is
Parameter blocks are blocks of effect states. Use a parameter block to record state changes so that they can be applied later on with a single API call. When no longer needed, delete the parameter block to reduce memory usage.
Creates a copy of an effect.
Pointer to an
Pointer to an
Note??This function will not clone an effect if the user specifies
To update shared and non-shared parameters in an active technique of a cloned effect, see
Set a contiguous range of shader constants with a memory copy.
Handle to the value to set, or the name of the value passed in as a string. Passing in a handle is more efficient. See Handles (Direct3D 9).
Pointer to a buffer containing the data to be set. SetRawValue checks for valid memory, but does not do any checking for valid data.
Number of bytes between the beginning of the effect data and the beginning of the effect constants you are going to set.
The size of the buffer to be set, in bytes.
If the method succeeds, the return value is
SetRawValue is a very fast way to set effect constants since it performs a memory copy without performing validation or any data conversion (like converting a row-major matrix to a column-major matrix). Use SetRawValue to set a series of contiguous effect constants. For instance, you could set an array of twenty matrices with 20 calls to
All values are expected to be either matrix4x4s or float4s and all matrices are expected to be in column-major order. Int or float values are cast into a float4; therefore, it is highly recommended that you use SetRawValue with only float4 or matrix4x4 data.
The
The
The LPD3DXEFFECTCOMPILER type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXEFFECTCOMPILER;
Toggles the literal status of a parameter. A literal parameter has a value that doesn't change during the lifetime of an effect.
Unique identifier to a parameter. See Handles (Direct3D 9).
Set to TRUE to make the parameter a literal, and
If the method succeeds, the return value is
This methods only changes whether the parameter is a literal or not. To change the value of a parameter, use a method like
This function must be called before the effect is compiled. Here is an example of how one might use this function:
LPD3DXEFFECTCOMPILER pEffectCompiler; char errors[1000];hr; hr = ("shader.fx", null ,null , 0, &pEffectCompiler, &errors); //In the fx file, literalInt is declared as an int. //By calling this function, the compiler will treat //it as a literal (i.e. #define) hr = pEffectCompiler->SetLiteral("literalInt", TRUE); //create ten different variations of the same effect LPD3DXBUFFER pEffects[10]; LPD3DXBUFFER pErrors; for(int i = 0; i < 10; ++i) { hr = pEffectCompiler->SetInt("literalInt", i); hr = pEffectCompiler->CompileEffect(0, &pEffects[i], &pErrors); }
Gets a literal status of a parameter. A literal parameter has a value that doesn't change during the lifetime of an effect.
Unique identifier to a parameter. See Handles (Direct3D 9).
Returns True if the parameter is a literal, and False otherwise.
This methods only changes whether the parameter is a literal or not. To change the value of a parameter, use a method like
Compile an effect.
Compile options identified by various flags. The Direct3D 10 HLSL compiler is now the default. See
Buffer containing the compiled effect. For more information about accessing the buffer, see
Buffer containing at least the first compile error message that occurred. This includes effect compiler errors and high-level language compile errors. For more information about accessing the buffer, see
If the method succeeds, the return value is
If the arguments are invalid, the method will return
If the method fails, the return value will be E_FAIL.
Compiles a shader from an effect that contains one or more functions.
Unique identifier to the function to be compiled. This value must not be
Pointer to a shader profile which determines the shader instruction set. See
Compile options identified by various flags. The Direct3D 10 HLSL compiler is now the default. See
Buffer containing the compiled shader. The compiler shader is an array of DWORDs. For more information about accessing the buffer, see
Buffer containing at least the first compile error message that occurred. This includes effect compiler errors and high-level language compile errors. For more information about accessing the buffer, see
Returns an
If the method succeeds, the return value is
If the arguments are invalid, the method will return
If the method fails, the return value will be E_FAIL.
Targets can be specified for vertex shaders, pixel shaders, and texture fill functions.
Vertex shader targets | vs_1_1, vs_2_0, vs_2_sw, vs_3_0 |
Pixel shader targets | ps_1_1, ps_1_2, ps_1_3, ps_1_4, ps_2_0, ps_2_sw, ps_3_0 |
Texture fill targets | tx_0, tx_1 |
?
This method compiles a shader from a function that is written in a C-like language. For more information, see HLSL.
Data type for managing a set of default effect parameters.
Name of the effect file.
Number of default parameters.
Pointer to an array of
Applications use the
The
The LPD3DXEFFECTPOOL type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXEFFECTPOOL;
The
The
The LPD3DXFONT type is defined as a reference to the
typedef interface; typedef interface *LPD3DXFONT;
Retrieves the Direct3D device associated with the font object.
Note??Calling this method will increase the internal reference count on the
Gets a description of the current font object. GetDescW and GetDescA are identical to this method, except that a reference is returned to a
This method describes Unicode font objects if UNICODE is defined. Otherwise GetDescA is called, which returns a reference to the D3DXFONT_DESCA structure.
Returns a handle to a display device context (DC) that has the font set.
Retrieves the Direct3D device associated with the font object.
Address of a reference to an
If the method succeeds, the return value is
Note??Calling this method will increase the internal reference count on the
Gets a description of the current font object. GetDescW and GetDescA are identical to this method, except that a reference is returned to a
If the method succeeds, the return value is
This method describes Unicode font objects if UNICODE is defined. Otherwise GetDescA is called, which returns a reference to the D3DXFONT_DESCA structure.
Retrieves font characteristics that are identified in a
Nonzero if the function is successful; otherwise 0.
The compiler setting also determines the structure type. If Unicode is defined, the function returns a
Returns a handle to a display device context (DC) that has the font set.
Handle to a display DC.
Returns information about the placement and orientation of a glyph in a character cell.
Glyph identifier.
Address of a reference to a
Pointer to the smallest rectangle object that completely encloses the glyph.
Pointer to the two-dimensional vector that connects the origin of the current character cell to the origin of the next character cell. See
If the method succeeds, the return value is
Loads a series of characters into video memory to improve the efficiency of rendering to the device.
ID of the first character to be loaded into video memory.
ID of the last character to be loaded into video memory.
If the method succeeds, the return value is
This method generates textures containing glyphs that represent the input characters. The glyphs are drawn as a series of triangles.
Characters will not be rendered to the device; DrawText must still be called to render the characters. However, by pre-loading characters into video memory, DrawText will use substantially fewer CPU resources.
This method internally converts characters to glyphs using the GDI function GetCharacterPlacement.
Loads a series of glyphs into video memory to improve the efficiency of rendering to the device.
ID of the first glyph to be loaded into video memory.
ID of the last glyph to be loaded into video memory.
If the method succeeds, the return value is
This method generates textures that contain the input glyphs. The glyphs are drawn as a series of triangles.
Glyphs will not be rendered to the device; DrawText must still be called to render the glyphs. However, by pre-loading glyphs into video memory, DrawText will use substantially fewer CPU resources.
Loads formatted text into video memory to improve the efficiency of rendering to the device. This method supports ANSI and Unicode strings.
Pointer to a string of characters to be loaded into video memory. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR; otherwise, the data type resolves to LPCSTR. See Remarks.
Number of characters in the text string.
If the method succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to PreloadTextW. Otherwise, the function call resolves to PreloadTextA because ANSI strings are being used.
This method generates textures that contain glyphs that represent the input text. The glyphs are drawn as a series of triangles.
Text will not be rendered to the device; DrawText must still be called to render the text. However, by preloading text into video memory, DrawText will use substantially fewer CPU resources.
This method internally converts characters to glyphs using the GDI function GetCharacterPlacement.
Draws formatted text. This method supports ANSI and Unicode strings.
Pointer to an
Pointer to a string to draw. If the Count parameter is -1, the string must be null-terminated.
Specifies the number of characters in the string. If Count is -1, then the pString parameter is assumed to be a reference to a null-terminated string and DrawText computes the character count automatically.
Pointer to a
Specifies the method of formatting the text. It can be any combination of the following values:
Value | Meaning |
---|---|
| Justifies the text to the bottom of the rectangle. This value must be combined with DT_SINGLELINE. |
| Determines the width and height of the rectangle. If there are multiple lines of text, DrawText uses the width of the rectangle pointed to by the pRect parameter and extends the base of the rectangle to bound the last line of text. If there is only one line of text, DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, DrawText returns the height of the formatted text but does not draw the text. |
| Centers text horizontally in the rectangle. |
| Expands tab characters. The default number of characters per tab is eight. |
| Aligns text to the left. |
| Draws without clipping. DrawText is somewhat faster when DT_NOCLIP is used. |
| Aligns text to the right. |
| Displays text in right-to-left reading order for bidirectional text when a Hebrew or Arabic font is selected. The default reading order for all text is left-to-right. |
| Displays text on a single line only. Carriage returns and line feeds do not break the line. |
| Top-justifies text. |
| Centers text vertically (single line only). |
| Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the pRect parameter. A carriage return/line feed sequence also breaks the line. |
?
Color of the text. For more information, see
If the function succeeds, the return value is the height of the text in logical units. If DT_VCENTER or DT_BOTTOM is specified, the return value is the offset from pRect (top to the bottom) of the drawn text. If the function fails, the return value is zero.
The parameters of this method are very similar to those of the GDI DrawText function.
This method supports both ANSI and Unicode strings.
This method must be called inside a BeginScene ... EndScene block. The only exception is when an application calls DrawText with DT_CALCRECT to calculate the size of a given block of text.
Unless the DT_NOCLIP format is used, this method clips the text so that it does not appear outside the specified rectangle. All formatting is assumed to have multiple lines unless the DT_SINGLELINE format is specified.
If the selected font is too large for the rectangle, this method does not attempt to substitute a smaller font.
This method supports only fonts whose escapement and orientation are both zero.
Use this method to release all references to video memory resources and delete all stateblocks. This method should be called whenever a device is lost, or before resetting a device.
If the method succeeds, the return value is
This method should be called whenever the device is lost or before the user calls Reset. Even if the device was not actually lost, OnLostDevice is responsible for freeing stateblocks and other resources that may need to be released before resetting the device. As a result, the font object cannot be used again before calling Reset and then OnResetDevice.
Use this method to re-acquire resources and save initial state.
If the method succeeds, the return value is
OnResetDevice should be called each time the device is reset (using Reset), before any other methods are called. This is a good place to re-acquire video-memory resources and capture state blocks.
Defines constants that describe the type of back buffer.
Direct3D 9 does not support stereo view, so Direct3D does not use the
Specifies a nonstereo swap chain.
Specifies the left side of a stereo pair in a swap chain.
Specifies the right side of a stereo pair in a swap chain.
Defines the basis type of a high-order patch surface.
The members of
Input vertices are treated as a series of B?zier patches. The number of vertices specified must be divisible by 4. Portions of the mesh beyond this criterion will not be rendered. Full continuity is assumed between sub-patches in the interior of the surface rendered by each call. Only the vertices at the corners of each sub-patch are guaranteed to lie on the resulting surface.
Input vertices are treated as control points of a B-spline surface. The number of apertures rendered is two fewer than the number of apertures in that direction. In general, the generated surface does not contain the control vertices specified.
An interpolating basis defines the surface so that the surface goes through all the input vertices specified. In DirectX 8, this was D3DBASIS_INTERPOLATE.
Defines the supported blend mode.
In the preceding member descriptions, the RGBA values of the source and destination are indicated by the s and d subscripts.
The values in this enumerated type are used by the following render states:
See
Blend factor is (0, 0, 0, 0).
Blend factor is (1, 1, 1, 1).
Blend factor is (Rs, Gs, Bs, As).
Blend factor is (1 - Rs, 1 - Gs, 1 - Bs, 1 - As).
Blend factor is (As, As, As, As).
Blend factor is ( 1 - As, 1 - As, 1 - As, 1 - As).
Blend factor is (Ad Ad Ad Ad).
Blend factor is (1 - Ad 1 - Ad 1 - Ad 1 - Ad).
Blend factor is (Rd, Gd, Bd, Ad).
Blend factor is (1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad).
Blend factor is (f, f, f, 1); where f = min(As, 1 - Ad).
Obsolete. Starting with DirectX 6, you can achieve the same effect by setting the source and destination blend factors to
Obsolete. Source blend factor is (1 - As, 1 - As, 1 - As, 1 - As), and destination blend factor is (As, As, As, As); the destination blend selection is overridden. This blend mode is supported only for the
Constant color blending factor used by the frame-buffer blender. This blend mode is supported only if
Inverted constant color-blending factor used by the frame-buffer blender. This blend mode is supported only if the
Blend factor is (PSOutColor[1]r, PSOutColor[1]g, PSOutColor[1]b, not used). See Render.
Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. |
?
Blend factor is (1 - PSOutColor[1]r, 1 - PSOutColor[1]g, 1 - PSOutColor[1]b, not used)). See Render.
Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. |
?
Represents the capabilities of the hardware exposed through the Direct3D object.
The MaxTextureBlendStages and MaxSimultaneousTextures members might seem similar, but they contain different information. The MaxTextureBlendStages member contains the total number of texture-blending stages supported by the current device, and the MaxSimultaneousTextures member describes how many of those stages can have textures bound to them by using the SetTexture method.
When the driver fills this structure, it can set values for execute-buffer capabilities, even when the interface being used to retrieve the capabilities (such as
In general, performance problems may occur if you use a texture and then modify it during a scene. Ensure that no texture used in the current BeginScene and EndScene block is evicted unless absolutely necessary. In the case of extremely high texture usage within a scene, the results are undefined. This occurs when you modify a texture that you have used in the scene and there is no spare texture memory available. For such systems, the contents of the z-buffer become invalid at EndScene. Applications should not call UpdateSurface to or from the back buffer on this type of hardware inside a BeginScene/EndScene pair. In addition, applications should not try to access the z-buffer if the
The following flags concerning mipmapped textures are not supported in Direct3D 9.
Member of the
Adapter on which this Direct3D device was created. This ordinal is valid only to pass to methods of the
The following driver-specific capability.
Value | Meaning |
---|---|
Display hardware is capable of returning the current scan line. | |
The display driver supports an overlay DDI that allows for verification of overlay capabilities. For more information about the overlay DDI, see Overlay DDI. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? |
?
Driver-specific capabilities identified in
Driver-specific capabilities identified in
Bit mask of values representing what presentation swap intervals are available.
Value | Meaning |
---|---|
The driver supports an immediate presentation swap interval. | |
The driver supports a presentation swap interval of every screen refresh. | |
The driver supports a presentation swap interval of every second screen refresh. | |
The driver supports a presentation swap interval of every third screen refresh. | |
The driver supports a presentation swap interval of every fourth screen refresh. |
?
Bit mask indicating what hardware support is available for cursors. Direct3D 9 does not define alpha-blending cursor capabilities.
Value | Meaning |
---|---|
A full-color cursor is supported in hardware. Specifically, this flag indicates that the driver supports at least a hardware color cursor in high-resolution modes (with scan lines greater than or equal to 400). | |
A full-color cursor is supported in hardware. Specifically, this flag indicates that the driver supports a hardware color cursor in both high-resolution and low-resolution modes (with scan lines less than 400). |
?
Flags identifying the capabilities of the device.
Value | Meaning |
---|---|
Device supports blits from system-memory textures to nonlocal video-memory textures. | |
Device can queue rendering commands after a page flip. Applications do not change their behavior if this flag is set; this capability means that the device is relatively fast. | |
Device can support at least a DirectX 5-compliant driver. | |
Device can support at least a DirectX 7-compliant driver. | |
Device exports an | |
Device can use execute buffers from system memory. | |
Device can use execute buffers from video memory. | |
Device has hardware acceleration for scene rasterization. | |
Device can support transformation and lighting in hardware. | |
Device supports N patches. | |
Device can support rasterization, transform, lighting, and shading in hardware. | |
Device supports quintic B?zier curves and B-splines. | |
Device supports rectangular and triangular patches. | |
When this device capability is set, the hardware architecture does not require caching of any information, and uncached patches (handle zero) will be drawn as efficiently as cached ones. Note that setting | |
Device is texturing from separate memory pools. | |
Device can retrieve textures from non-local video memory. | |
Device can retrieve textures from system memory. | |
Device can retrieve textures from device memory. | |
Device can use buffers from system memory for transformed and lit vertices. | |
Device can use buffers from video memory for transformed and lit vertices. |
?
Miscellaneous driver primitive capabilities. See
Information on raster-drawing capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device supports anisotropic filtering. | |
Device iterates colors perspective correctly. | |
Device can dither to improve color resolution. | |
Device supports legacy depth bias. For true depth bias, see | |
Device supports range-based fog. In range-based fog, the distance of an object from the viewer is used to compute fog effects, not the depth of the object (that is, the z-coordinate) in the scene. | |
Device calculates the fog value by referring to a lookup table containing fog values that are indexed to the depth of a given pixel. | |
Device calculates the fog value during the lighting operation and interpolates the fog value during rasterization. | |
Device supports level-of-detail bias adjustments. These bias adjustments enable an application to make a mipmap appear crisper or less sharp than it normally would. For more information about level-of-detail bias in mipmaps, see | |
Device supports toggling multisampling on and off between | |
Device supports scissor test. See Scissor Test (Direct3D 9). | |
Device performs true slope-scale based depth bias. This is in contrast to the legacy style depth bias. | |
Device supports depth buffering using w. | |
Device supports w-based fog. W-based fog is used when a perspective projection matrix is specified, but affine projections still use z-based fog. The system considers a projection matrix that contains a nonzero value in the [3][4] element to be a perspective projection matrix. | |
Device can perform hidden-surface removal (HSR) without requiring the application to sort polygons and without requiring the allocation of a depth-buffer. This leaves more video memory for textures. The method used to perform HSR is hardware-dependent and is transparent to the application. Z-bufferless HSR is performed if no depth-buffer surface is associated with the rendering-target surface and the depth-buffer comparison test is enabled (that is, when the state value associated with the | |
Device supports z-based fog. | |
Device can perform z-test operations. This effectively renders a primitive and indicates whether any z pixels have been rendered. |
?
Z-buffer comparison capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Always pass the z-test. | |
Pass the z-test if the new z equals the current z. | |
Pass the z-test if the new z is greater than the current z. | |
Pass the z-test if the new z is greater than or equal to the current z. | |
Pass the z-test if the new z is less than the current z. | |
Pass the z-test if the new z is less than or equal to the current z. | |
Always fail the z-test. | |
Pass the z-test if the new z does not equal the current z. |
?
Source-blending capabilities. This member can be one or more of the following flags. (The RGBA values of the source and destination are indicated by the subscripts s and d.)
Value | Meaning |
---|---|
The driver supports both | |
Source blend factor is (1 - As, 1 - As, 1 - As, 1 - As) and destination blend factor is (As, As, As, As); the destination blend selection is overridden. | |
The driver supports the | |
Blend factor is (Ad, Ad, Ad, Ad). | |
Blend factor is (Rd, Gd, Bd, Ad). | |
Blend factor is (1 - Ad, 1 - Ad, 1 - Ad, 1 - Ad). | |
Blend factor is (1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad). | |
Blend factor is (1 - As, 1 - As, 1 - As, 1 - As). | |
Blend factor is (1 - Rs, 1 - Gs, 1 - Bs, 1 - As). | |
Blend factor is (1 - PSOutColor[1]r, 1 - PSOutColor[1]g, 1 - PSOutColor[1]b, not used)). See Render Target Blending. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? | |
Blend factor is (1, 1, 1, 1). | |
Blend factor is (As, As, As, As). | |
Blend factor is (f, f, f, 1); f = min(As, 1 - Ad). | |
Blend factor is (Rs, Gs, Bs, As). | |
Blend factor is (PSOutColor[1]r, PSOutColor[1]g, PSOutColor[1]b, not used). See Render Target Blending. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? | |
Blend factor is (0, 0, 0, 0). |
?
Destination-blending capabilities. This member can be the same capabilities that are defined for the SrcBlendCaps member.
Alpha-test comparison capabilities. This member can include the same capability flags defined for the ZCmpCaps member. If this member contains only the
Shading operations capabilities. It is assumed, in general, that if a device supports a given command at all, it supports the
The color, specular highlights, fog, and alpha interpolants of a triangle each have capability flags that an application can use to find out how they are implemented by the device driver.
This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device can support an alpha component for Gouraud-blended transparency (the | |
Device can support colored Gouraud shading. In this mode, the per-vertex color components (red, green, and blue) are interpolated across a triangle face. | |
Device can support fog in the Gouraud shading mode. | |
Device supports Gouraud shading of specular highlights. |
?
Miscellaneous texture-mapping capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Alpha in texture pixels is supported. | |
Device can draw alpha from texture palettes. | |
Supports cube textures. | |
Device requires that cube texture maps have dimensions specified as powers of two. | |
Device supports mipmapped cube textures. | |
Device supports mipmapped textures. | |
Device supports mipmapped volume textures. | |
If this flag is not set, and A texture that is not a power of two cannot be set at a stage that will be read based on a shader computation (such as the bem - ps and texm3x3 - ps instructions in pixel shaders versions 1_0 to 1_3). For example, these textures can be used to store bumps that will be fed into texture reads, but not the environment maps that are used in texbem - ps, texbeml - ps, and texm3x3spec - ps. This means that a texture with dimensions that are not powers of two cannot be addressed or sampled using texture coordinates computed within the shader. This type of operation is known as a dependent read and cannot be performed on these types of textures. | |
Device does not support a projected bump-environment loopkup operation in programmable and fixed function shaders. | |
Perspective correction texturing is supported. | |
If If If this flag is not set, and | |
Supports the | |
All textures must be square. | |
Texture indices are not scaled by the texture size prior to interpolation. | |
Device supports volume textures. | |
Device requires that volume texture maps have dimensions specified as powers of two. |
?
Defines the supported blend operations. See Remarks for definitions of terms.
Source, Destination, and Result are defined as:
Term | Type | Description |
---|---|---|
Source | Input | Color of the source pixel before the operation. |
Destination | Input | Color of the pixel in the destination buffer before the operation. |
Result | Output | Returned value that is the blended color resulting from the operation. |
?
This enumerated type defines values used by the following render states:
The result is the destination added to the source. Result = Source + Destination
The result is the destination subtracted from to the source. Result = Source - Destination
The result is the source subtracted from the destination. Result = Destination - Source
The result is the minimum of the source and destination. Result = MIN(Source, Destination)
The result is the maximum of the source and destination. Result = MAX(Source, Destination)
Flags used to obtain callback information.
Exclude callbacks located at the initial position from the search.
Reverse the callback search direction.
Obsolete in DirectX 8.0 and later versions; see Remarks.
The D3DLIGHTINGCAPS structure describes the lighting capabilities of a device.
This structure has been replaced by D3DCAPS8 (see the DirectX 8.0 SDK documentation) for DirectX 8.0 and later runtimes, but is required for DirectX 7.0 and earlier runtime compatibility. See Reporting DirectX 8.0 Style Direct3D Capabilities for details.
This structure is a member of the D3DDEVICEDESC_V1 structure.
Specifies the size, in bytes, of the D3DLIGHTINGCAPS structure.
Specifies flags describing the capabilities of the lighting module. The following flags are defined:
Value | Meaning |
---|---|
D3DLIGHTCAPS_DIRECTIONAL | Directional lights are supported. |
D3DLIGHTCAPS_GLSPOT | OpenGL-style spotlights are supported. |
D3DLIGHTCAPS_PARALLELPOINT | Parallel-point lights are supported. |
D3DLIGHTCAPS_POINT | Point lights are supported. |
D3DLIGHTCAPS_SPOT | Spotlights are supported. |
?
Driver capability flags.
Driver capability flags.
The following flags are used to specify which channels in a texture to operate on.
Defines operations to perform on vertices in preparation for mesh cleaning.
Merge triangles that share the same vertex indices but have face normals pointing in opposite directions (back-facing triangles). Unless the triangles are not split by adding a replicated vertex, mesh adjacency data from the two triangles may conflict.
If a vertex is the apex of two triangle fans (a bowtie) and mesh operations will affect one of the fans, then split the shared vertex into two new vertices. Bowties can cause problems for operations such as mesh simplification that remove vertices, because removing one vertex affects two distinct sets of triangles.
Use this flag to prevent infinite loops during skinning setup mesh operations.
Use this flag to prevent infinite loops during mesh optimization operations.
Use this flag to prevent infinite loops during mesh simplification operations.
These flags identify a surface to reset when calling Clear.
Describes the current clip status.
When clipping is enabled during vertex processing (by ProcessVertices, DrawPrimitive, or other drawing functions), Direct3D computes a clip code for every vertex. The clip code is a combination of D3DCS_* bits. When a vertex is outside a particular clipping plane, the corresponding bit is set in the clipping code. Direct3D maintains the clip status using
Clip status is not updated by DrawRectPatch and DrawTriPatch because there is no software emulation for them.
Clip union flags that describe the current clip status. This member can be one or more of the following flags:
Value | Meaning |
---|---|
Combination of all clip flags. | |
All vertices are clipped by the left plane of the viewing frustum. | |
All vertices are clipped by the right plane of the viewing frustum. | |
All vertices are clipped by the top plane of the viewing frustum. | |
All vertices are clipped by the bottom plane of the viewing frustum. | |
All vertices are clipped by the front plane of the viewing frustum. | |
All vertices are clipped by the back plane of the viewing frustum. | |
Application-defined clipping planes. | |
Application-defined clipping planes. | |
Application-defined clipping planes. | |
Application-defined clipping planes. | |
Application-defined clipping planes. | |
Application-defined clipping planes. |
?
Clip intersection flags that describe the current clip status. This member can take the same flags as ClipUnion.
Render states define set-up states for all kinds of vertex and pixel processing. Some render states set up vertex processing, and some set up pixel processing (see Render States (Direct3D 9)). Render states can be saved and restored using stateblocks (see State Blocks Save and Restore State (Direct3D 9)).
Render States | |
---|---|
ps_1_1 to ps_1_3 | 4 texture samplers |
?
Direct3D defines the D3DRENDERSTATE_WRAPBIAS constant as a convenience for applications to enable or disable texture wrapping, based on the zero-based integer of a texture coordinate set (rather than explicitly using one of the D3DRS_WRAP n state values). Add the D3DRENDERSTATE_WRAPBIAS value to the zero-based index of a texture coordinate set to calculate the D3DRS_WRAP n value that corresponds to that index, as shown in the following example.
// Enable U/V wrapping for textures that use the texture // coordinate set at the index within the dwIndex variablehr = pd3dDevice->SetRenderState( dwIndex + D3DRENDERSTATE_WRAPBIAS, | ); // If dwIndex is 3, the value that results from // the addition equals (131)
Defines the supported compare functions.
The values in this enumerated type define the supported compare functions for the
Always fail the test.
Accept the new pixel if its value is less than the value of the current pixel.
Accept the new pixel if its value equals the value of the current pixel.
Accept the new pixel if its value is less than or equal to the value of the current pixel.
Accept the new pixel if its value is greater than the value of the current pixel.
Accept the new pixel if its value does not equal the value of the current pixel.
Accept the new pixel if its value is greater than or equal to the value of the current pixel.
Always pass the test.
C++ applications can use alpha testing to control when pixels are written to the render-target surface. By using the
The most common use for alpha testing is to improve performance when rasterizing objects that are nearly transparent. If the color data being rasterized is more opaque than the color at a given pixel (
// This code example assumes that pCaps is a //structure that was filled with a // previous call to . if (pCaps.AlphaCmpCaps & ) { dev->SetRenderState( , (DWORD)0x00000001); dev->SetRenderState( , TRUE); dev->SetRenderState( , ); } // If the comparison is not supported, render anyway. // The only drawback is no performance gain.
Not all hardware supports all alpha-testing features. You can check the device capabilities by calling the
?
?
Specifies how to combine the glyph data from the source and destination surfaces in a call to ComposeRects.
Defines the compression mode used for storing compressed animation set data.
Implements fast compression.
A combination of one or more flags that control the device create behavior.
Defines the faces of a cubemap.
Positive x-face of the cubemap.
Negative x-face of the cubemap.
Positive y-face of the cubemap.
Negative y-face of the cubemap.
Positive z-face of the cubemap.
Negative z-face of the cubemap.
Defines the supported culling modes.
The values in this enumerated type are used by the
Do not cull back faces.
Cull back faces with clockwise vertices.
Cull back faces with counterclockwise vertices.
Driver cursor capability flags.
Defines the vertex declaration method which is a predefined operation performed by the tessellator (or any procedural geometry routine on the vertex data during tessellation).
The tessellator looks at the method to determine what data to calculate from the vertex data during tessellation. Mesh data should use the default value. Patches can use any of the other implemented types.
Vertex data is declared with an array of
In addition to using
Default value. The tessellator copies the vertex data (spline data for patches) as is, with no additional calculations. When the tessellator is used, this element is interpolated. Otherwise vertex data is copied into the input register. The input and output type can be any value, but are always the same type.
Computes the tangent at a point on the rectangle or triangle patch in the U direction. The input type can be one of the following:
The output type is always
Computes the tangent at a point on the rectangle or triangle patch in the V direction. The input type can be one of the following:
The output type is always
Computes the normal at a point on the rectangle or triangle patch by taking the cross product of two tangents. The input type can be one of the following:
The output type is always
Copy out the U, V values at a point on the rectangle or triangle patch. This results in a 2D float. The input type must be set to
Look up a displacement map. The input type can be one of the following:
Only the .x and .y components are used for the texture map lookup. The output type is always
Look up a presampled displacement map. The input type must be set to
Defines a vertex declaration data type.
Vertex data is declared with an array of
Use the DirectX Caps Viewer Tool tool to see which types are supported on your device.
One-component float expanded to (float, 0, 0, 1).
Two-component float expanded to (float, float, 0, 1).
Three-component float expanded to (float, float, float, 1).
Four-component float expanded to (float, float, float, float).
Four-component, packed, unsigned bytes mapped to 0 to 1 range. Input is a
Four-component, unsigned byte.
Two-component, signed short expanded to (value, value, 0, 1).
Four-component, signed short expanded to (value, value, value, value).
Four-component byte with each byte normalized by dividing with 255.0f.
Normalized, two-component, signed short, expanded to (first short/32767.0, second short/32767.0, 0, 1).
Normalized, four-component, signed short, expanded to (first short/32767.0, second short/32767.0, third short/32767.0, fourth short/32767.0).
Normalized, two-component, unsigned short, expanded to (first short/65535.0, short short/65535.0, 0, 1).
Normalized, four-component, unsigned short, expanded to (first short/65535.0, second short/65535.0, third short/65535.0, fourth short/65535.0).
Three-component, unsigned, 10 10 10 format expanded to (value, value, value, 1).
Three-component, signed, 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1).
Two-component, 16-bit, floating point expanded to (value, value, 0, 1).
Four-component, 16-bit, floating point expanded to (value, value, value, value).
Type field in the declaration is unused. This is designed for use with
Constants describing the vertex data types supported by a device.
Identifies the intended use of vertex data.
Vertex data is declared with an array of
For more information about vertex declarations, see Vertex Declaration (Direct3D 9).
Position data ranging from (-1,-1) to (1,1). Use
Blending weight data. Use
Blending indices data. Use
Vertex normal data. Use
Point size data. Use
Texture coordinate data. Use
Vertex tangent data.
Vertex binormal data.
Single positive floating point value. Use
Vertex data contains transformed position data ranging from (0,0) to (viewport width, viewport height). Use
Vertex data contains diffuse or specular color. Use
Vertex data contains fog data. Use
Vertex data contains depth data.
Vertex data contains sampler data. Use
Defines the degree of the variables in the equation that describes a curve.
The values in this enumeration are used to describe the curves used by rectangle and triangle patches. For more information, see
Curve is described by variables of first order.
Curve is described by variables of second order.
Curve is described by variables of third order.
Curve is described by variables of fourth order.
Represents the capabilities of the hardware exposed through the Direct3D object.
The MaxTextureBlendStages and MaxSimultaneousTextures members might seem similar, but they contain different information. The MaxTextureBlendStages member contains the total number of texture-blending stages supported by the current device, and the MaxSimultaneousTextures member describes how many of those stages can have textures bound to them by using the SetTexture method.
When the driver fills this structure, it can set values for execute-buffer capabilities, even when the interface being used to retrieve the capabilities (such as
In general, performance problems may occur if you use a texture and then modify it during a scene. Ensure that no texture used in the current BeginScene and EndScene block is evicted unless absolutely necessary. In the case of extremely high texture usage within a scene, the results are undefined. This occurs when you modify a texture that you have used in the scene and there is no spare texture memory available. For such systems, the contents of the z-buffer become invalid at EndScene. Applications should not call UpdateSurface to or from the back buffer on this type of hardware inside a BeginScene/EndScene pair. In addition, applications should not try to access the z-buffer if the
The following flags concerning mipmapped textures are not supported in Direct3D 9.
Member of the
Adapter on which this Direct3D device was created. This ordinal is valid only to pass to methods of the
The following driver-specific capability.
Value | Meaning |
---|---|
Display hardware is capable of returning the current scan line. | |
The display driver supports an overlay DDI that allows for verification of overlay capabilities. For more information about the overlay DDI, see Overlay DDI. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? |
?
Driver-specific capabilities identified in
Driver-specific capabilities identified in
Bit mask of values representing what presentation swap intervals are available.
Value | Meaning |
---|---|
The driver supports an immediate presentation swap interval. | |
The driver supports a presentation swap interval of every screen refresh. | |
The driver supports a presentation swap interval of every second screen refresh. | |
The driver supports a presentation swap interval of every third screen refresh. | |
The driver supports a presentation swap interval of every fourth screen refresh. |
?
Bit mask indicating what hardware support is available for cursors. Direct3D 9 does not define alpha-blending cursor capabilities.
Value | Meaning |
---|---|
A full-color cursor is supported in hardware. Specifically, this flag indicates that the driver supports at least a hardware color cursor in high-resolution modes (with scan lines greater than or equal to 400). | |
A full-color cursor is supported in hardware. Specifically, this flag indicates that the driver supports a hardware color cursor in both high-resolution and low-resolution modes (with scan lines less than 400). |
?
Flags identifying the capabilities of the device.
Value | Meaning |
---|---|
Device supports blits from system-memory textures to nonlocal video-memory textures. | |
Device can queue rendering commands after a page flip. Applications do not change their behavior if this flag is set; this capability means that the device is relatively fast. | |
Device can support at least a DirectX 5-compliant driver. | |
Device can support at least a DirectX 7-compliant driver. | |
Device exports an | |
Device can use execute buffers from system memory. | |
Device can use execute buffers from video memory. | |
Device has hardware acceleration for scene rasterization. | |
Device can support transformation and lighting in hardware. | |
Device supports N patches. | |
Device can support rasterization, transform, lighting, and shading in hardware. | |
Device supports quintic B?zier curves and B-splines. | |
Device supports rectangular and triangular patches. | |
When this device capability is set, the hardware architecture does not require caching of any information, and uncached patches (handle zero) will be drawn as efficiently as cached ones. Note that setting | |
Device is texturing from separate memory pools. | |
Device can retrieve textures from non-local video memory. | |
Device can retrieve textures from system memory. | |
Device can retrieve textures from device memory. | |
Device can use buffers from system memory for transformed and lit vertices. | |
Device can use buffers from video memory for transformed and lit vertices. |
?
Miscellaneous driver primitive capabilities. See
Information on raster-drawing capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device supports anisotropic filtering. | |
Device iterates colors perspective correctly. | |
Device can dither to improve color resolution. | |
Device supports legacy depth bias. For true depth bias, see | |
Device supports range-based fog. In range-based fog, the distance of an object from the viewer is used to compute fog effects, not the depth of the object (that is, the z-coordinate) in the scene. | |
Device calculates the fog value by referring to a lookup table containing fog values that are indexed to the depth of a given pixel. | |
Device calculates the fog value during the lighting operation and interpolates the fog value during rasterization. | |
Device supports level-of-detail bias adjustments. These bias adjustments enable an application to make a mipmap appear crisper or less sharp than it normally would. For more information about level-of-detail bias in mipmaps, see | |
Device supports toggling multisampling on and off between | |
Device supports scissor test. See Scissor Test (Direct3D 9). | |
Device performs true slope-scale based depth bias. This is in contrast to the legacy style depth bias. | |
Device supports depth buffering using w. | |
Device supports w-based fog. W-based fog is used when a perspective projection matrix is specified, but affine projections still use z-based fog. The system considers a projection matrix that contains a nonzero value in the [3][4] element to be a perspective projection matrix. | |
Device can perform hidden-surface removal (HSR) without requiring the application to sort polygons and without requiring the allocation of a depth-buffer. This leaves more video memory for textures. The method used to perform HSR is hardware-dependent and is transparent to the application. Z-bufferless HSR is performed if no depth-buffer surface is associated with the rendering-target surface and the depth-buffer comparison test is enabled (that is, when the state value associated with the | |
Device supports z-based fog. | |
Device can perform z-test operations. This effectively renders a primitive and indicates whether any z pixels have been rendered. |
?
Z-buffer comparison capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Always pass the z-test. | |
Pass the z-test if the new z equals the current z. | |
Pass the z-test if the new z is greater than the current z. | |
Pass the z-test if the new z is greater than or equal to the current z. | |
Pass the z-test if the new z is less than the current z. | |
Pass the z-test if the new z is less than or equal to the current z. | |
Always fail the z-test. | |
Pass the z-test if the new z does not equal the current z. |
?
Source-blending capabilities. This member can be one or more of the following flags. (The RGBA values of the source and destination are indicated by the subscripts s and d.)
Value | Meaning |
---|---|
The driver supports both | |
Source blend factor is (1 - As, 1 - As, 1 - As, 1 - As) and destination blend factor is (As, As, As, As); the destination blend selection is overridden. | |
The driver supports the | |
Blend factor is (Ad, Ad, Ad, Ad). | |
Blend factor is (Rd, Gd, Bd, Ad). | |
Blend factor is (1 - Ad, 1 - Ad, 1 - Ad, 1 - Ad). | |
Blend factor is (1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad). | |
Blend factor is (1 - As, 1 - As, 1 - As, 1 - As). | |
Blend factor is (1 - Rs, 1 - Gs, 1 - Bs, 1 - As). | |
Blend factor is (1 - PSOutColor[1]r, 1 - PSOutColor[1]g, 1 - PSOutColor[1]b, not used)). See Render Target Blending. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? | |
Blend factor is (1, 1, 1, 1). | |
Blend factor is (As, As, As, As). | |
Blend factor is (f, f, f, 1); f = min(As, 1 - Ad). | |
Blend factor is (Rs, Gs, Bs, As). | |
Blend factor is (PSOutColor[1]r, PSOutColor[1]g, PSOutColor[1]b, not used). See Render Target Blending. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? | |
Blend factor is (0, 0, 0, 0). |
?
Destination-blending capabilities. This member can be the same capabilities that are defined for the SrcBlendCaps member.
Alpha-test comparison capabilities. This member can include the same capability flags defined for the ZCmpCaps member. If this member contains only the
Shading operations capabilities. It is assumed, in general, that if a device supports a given command at all, it supports the
The color, specular highlights, fog, and alpha interpolants of a triangle each have capability flags that an application can use to find out how they are implemented by the device driver.
This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device can support an alpha component for Gouraud-blended transparency (the | |
Device can support colored Gouraud shading. In this mode, the per-vertex color components (red, green, and blue) are interpolated across a triangle face. | |
Device can support fog in the Gouraud shading mode. | |
Device supports Gouraud shading of specular highlights. |
?
Miscellaneous texture-mapping capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Alpha in texture pixels is supported. | |
Device can draw alpha from texture palettes. | |
Supports cube textures. | |
Device requires that cube texture maps have dimensions specified as powers of two. | |
Device supports mipmapped cube textures. | |
Device supports mipmapped textures. | |
Device supports mipmapped volume textures. | |
If this flag is not set, and A texture that is not a power of two cannot be set at a stage that will be read based on a shader computation (such as the bem - ps and texm3x3 - ps instructions in pixel shaders versions 1_0 to 1_3). For example, these textures can be used to store bumps that will be fed into texture reads, but not the environment maps that are used in texbem - ps, texbeml - ps, and texm3x3spec - ps. This means that a texture with dimensions that are not powers of two cannot be addressed or sampled using texture coordinates computed within the shader. This type of operation is known as a dependent read and cannot be performed on these types of textures. | |
Device does not support a projected bump-environment loopkup operation in programmable and fixed function shaders. | |
Perspective correction texturing is supported. | |
If If If this flag is not set, and | |
Supports the | |
All textures must be square. | |
Texture indices are not scaled by the texture size prior to interpolation. | |
Device supports volume textures. | |
Device requires that volume texture maps have dimensions specified as powers of two. |
?
Texture-filtering capabilities for a texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-filtering capabilities for a cube texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-filtering capabilities for a volume texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-addressing capabilities for texture objects. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device supports setting coordinates outside the range [0.0, 1.0] to the border color, as specified by the | |
Device can clamp textures to addresses. | |
Device can separate the texture-addressing modes of the u and v coordinates of the texture. This ability corresponds to the | |
Device can mirror textures to addresses. | |
Device can take the absolute value of the texture coordinate (thus, mirroring around 0) and then clamp to the maximum value. | |
Device can wrap textures to addresses. |
?
Defines device types.
All methods of the
A
If D3dref9.dll is installed, Direct3D will use the reference rasterizer to create a
Hardware rasterization. Shading is done with software, hardware, or mixed transform and lighting.
Direct3D features are implemented in software; however, the reference rasterizer does make use of special CPU instructions whenever it can.
The reference device is installed by the Windows SDK 8.0 or later and is intended as an aid in debugging for development only.
A pluggable software device that has been registered with
Initialize Direct3D on a computer that has neither hardware nor reference rasterization available, and enable resources for 3D content creation. See Remarks.
Specifies how the monitor being used to display a full-screen application is rotated.
This enumeration is used in
Applications may choose to handle monitor rotation themselves by using the
Display is not rotated.
Display is rotated 90 degrees.
Display is rotated 180 degrees.
Display is rotated 270 degrees.
Effect data types. The data is contained in the pValue member of
Describes the type of events that can be keyed by the animation controller.
Track speed.
Track weight.
Track position.
Enable flag.
Priority blend value.
Defines constants describing the fill mode.
The values in this enumerated type are used by the
Fill points.
Fill wireframes.
Fill solids.
The following flags are used to specify which channels in a texture to operate on.
Texture filtering constants.
Defines constants that describe the fog mode.
The values in this enumerated type are used by the
Fog can be considered a measure of visibility: the lower the fog value produced by a fog equation, the less visible an object is.
No fog effect.
Fog effect intensifies exponentially, according to the following formula.
Fog effect intensifies exponentially with the square of the distance, according to the following formula.
Fog effect intensifies linearly between the start and end points, according to the following formula.
This is the only fog mode currently supported.
Defines the various types of surface formats.
typedef enum _D3DFORMAT {There are several types of formats:
All formats are listed from left to right, most-significant bit to least-significant bit. For example, D3DFORMAT_ARGB is ordered from the most-significant bit channel A (alpha), to the least-significant bit channel B (blue). When traversing surface data, the data is stored in memory from least-significant bit to most-significant bit, which means that the channel order in memory is from least-significant bit (blue) to most-significant bit (alpha).
The default value for formats that contain undefined channels (G16R16, A8, and so on) is 1. The only exception is the A8 format, which is initialized to 000 for the three color channels.
The order of the bits is from the most significant byte first, so
Pixel formats have been chosen to enable the expression of hardware-vendor-defined extension formats, as well as to include the well-established FOURCC method. The set of formats understood by the Direct3D runtime is defined by
Note that formats are supplied by independent hardware vendors (IHVs) and many FOURCC codes are not listed. The formats in this enumeration are unique in that they are sanctioned by the runtime, meaning that the reference rasterizer will operate on all these types. IHV-supplied formats will be supported by the individual IHVs on a card-by-card basis.
Options for saving and creating effects.
The constants in the following table are defined in d3dx9effect.h.
Describes the supported image file formats. See Remarks for descriptions of these formats.
Functions that begin with D3DXLoadxxx support all of the formats listed. Functions that begin with D3DXSavexxx support all of the formats listed except the Truevision (.tga) and portable pixmap (.ppm) formats.
The following table lists the available input and output formats.
File Extension | Description |
---|---|
.bmp | Windows bitmap format. Contains a header that describes the resolution of the device on which the rectangle of pixels was created, the dimensions of the rectangle, the size of the array of bits, a logical palette, and an array of bits that defines the relationship between pixels in the bitmapped image and entries in the logical palette. |
.dds | DirectDraw Surface file format. Stores textures, volume textures, and cubic environment maps, with or without mipmap levels, and with or without pixel compression. See DDS. |
.dib | Windows DIB. Contains an array of bits combined with structures that specify width and height of the bitmapped image, color format of the device where the image was created, and resolution of the device used to create that image. |
.hdr | HDR format. Encodes each pixel as an RGBE 32-bit color, with 8 bits of mantissa for red, green, and blue, and a shared 8-bit exponent. Each channel is separately compressed with run-length encoding (RLE). |
.jpg | JPEG standard. Specifies variable compression of 24-bit RGB color and 8-bit gray-scale Tagged Image File Format (TIFF) image document files. |
.pfm | Portable float map format. A raw floating point image format, without any compression. The file header specifies image width, height, monochrome or color, and machine word order. Pixel data is stored as 32-bit floating point values, with 3 values per pixel for color, and one value per pixel for monochrome. |
.png | PNG format. A non-proprietary bitmap format using lossless compression. |
.ppm | Portable Pixmap format. A binary or ASCII file format for color images that includes image height and width and the maximum color component value. |
.tga | Targa or Truevision Graphics Adapter format. Supports depths of 8, 15, 16, 24, and 32 bits, including 8-bit gray scale, and contains optional color palette data, image (x, y) origin and size data, and pixel data. |
?
See Types of Bitmaps for more information on some of these formats.
Windows bitmap (BMP) file format.
Joint Photographics Experts Group (JPEG) compressed file format.
Truevision (Targa, or TGA) image file format.
Portable Network Graphics (PNG) file format.
DirectDraw surface (DDS) file format.
Portable pixmap (PPM) file format.
Windows device-independent bitmap (DIB) file format.
High dynamic range (HDR) file format.
Portable float map file format.
Describes the location for the include file.
Look in the local project for the include file.
Look in the system path for the include file.
This macro creates a value used by Issue to issue a query end.
#defineThis macro changes the query state to nonsignaled.
Defines the light type.
Directional lights are slightly faster than point light sources, but point lights look a little better. Spotlights offer interesting visual effects but are computationally time-consuming.
Light is a point source. The light has a position in space and radiates light in all directions.
Light is a spotlight source. This light is like a point light, except that the illumination is limited to a cone. This light type has a direction and several other parameters that determine the shape of the cone it produces. For information about these parameters, see the
Light is a directional light source. This is equivalent to using a point light source at an infinite distance.
A combination of zero or more locking options that describe the type of lock to perform.
Defines the type of mesh data present in
Flags used to specify creation options for a mesh.
A 32-bit mesh (
The mesh has 32-bit indices instead of 16-bit indices. See Remarks.
Use the
Use the
Use the
Specifying this flag causes the vertex and index buffer of the mesh to be created with
Use the
Use the
Use the
Use the
Use the
Use the
Use the
Use the
Use the
Use the
Forces the cloned meshes to share vertex buffers.
Use hardware processing only. For mixed-mode device, this flag will cause the system to use hardware (if supported in hardware) or will default to software processing.
Equivalent to specifying both
Equivalent to specifying both
Equivalent to specifying both
Equivalent to specifying both
Equivalent to specifying both
Specifies the type of mesh optimization to be performed.
The
The D3DXMESHOPT_SHAREVB flag has been removed from this enumeration. Use
Reorders faces to remove unused vertices and faces.
Reorders faces to optimize for fewer attribute bundle state changes and enhanced
Reorders faces to increase the cache hit rate of vertex caches.
Reorders faces to maximize length of adjacent triangles.
Optimize the faces only; do not optimize the vertices.
While attribute sorting, do not split vertices that are shared between attribute groups.
Affects the vertex cache size. Using this flag specifies a default vertex cache size that works well on legacy hardware.
Specifies simplification options for a mesh.
The mesh will be simplified by the number of vertices specified in the MinValue parameter.
The mesh will be simplified by the number of faces specified in the MinValue parameter.
Defines the levels of full-scene multisampling that the device can apply.
In addition to enabling full-scene multisampling at
Multisampling is valid only on a swap chain that is being created or reset with the
The multisample antialiasing value can be set with the parameters (or sub-parameters) in the following methods.
Method | Parameters | Sub-parameters |
---|---|---|
| MultiSampleType and pQualityLevels | |
| pPresentationParameters | MultiSampleType and pQualityLevels |
| pPresentationParameters | MultiSampleType and pQualityLevels |
| MultiSampleType and pQualityLevels | |
| MultiSampleType and pQualityLevels | |
| pPresentationParameters | MultiSampleType and pQualityLevels |
?
It is not good practice to switch from one multisample type to another to raise the quality of the antialiasing.
Whether the display device supports maskable multisampling (more than one sample for a multiple-sample render-target format plus antialias support) or just non-maskable multisampling (only antialias support), the driver for the device provides the number of quality levels for the
The quality levels supported by the device can be obtained with the pQualityLevels parameter of
See
No level of full-scene multisampling is available.
Enables the multisample quality value. See Remarks.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Level of full-scene multisampling available.
Normal maps generation constants.
The type of object.
Constant is a scalar.
Constant is a vector.
Constant is a row major matrix.
Constant is a column major matrix.
Constant is either a texture, shader, or a string.
Constant is a structure.
These flags provide additional information about effect parameters.
Effect parameter constants are used by
Describes the data contained by the enumeration.
Parameter is a void reference.
Parameter is a Boolean. Any non-zero value passed into
Parameter is an integer. Any floating-point values passed into
Parameter is a floating-point number.
Parameter is a string.
Parameter is a texture.
Parameter is a 1D texture.
Parameter is a 2D texture.
Parameter is a 3D texture.
Parameter is a cube texture.
Parameter is a sampler.
Parameter is a 1D sampler.
Parameter is a 2D sampler.
Parameter is a 3D sampler.
Parameter is a cube sampler.
Parameter is a pixel shader.
Parameter is a vertex shader.
Parameter is a pixel shader fragment.
Parameter is a vertex shader fragment.
Parameter is not supported.
Defines whether the current tessellation mode is discrete or continuous.
Note that continuous tessellation produces a completely different tessellation pattern from the discrete one for the same tessellation values (this is more apparent in wireframe mode). Thus, 4.0 continuous is not the same as 4 discrete.
Discrete edge style. In discrete mode, you can specify float tessellation but it will be truncated to integers.
Continuous edge style. In continuous mode, tessellation is specified as float values that can be smoothly varied to reduce "popping" artifacts.
Mesh patch types.
Triangle patches have three sides and are described in
Rectangle patch mesh type.
Triangle patch mesh type.
N-patch mesh type.
Defines the type of animation set looping modes used for playback.
The animation repeats endlessly.
The animation plays once, and then it stops on the last frame.
The animation alternates endlessly between playing forward and playing backward.
Defines the memory class that holds the buffers for a resource.
All pool types are valid with all resources including: vertex buffers, index buffers, textures, and surfaces.
The following tables indicate restrictions on pool types for render targets, depth stencils, and dynamic and mipmap usages. An x indicates a compatible combination; lack of an x indicates incompatibility.
Pool | ||
---|---|---|
x | x | |
?
Pool | ||
---|---|---|
x | x | |
x | ||
x |
?
For more information about usage types, see
Pools cannot be mixed for different objects contained within one resource (mip levels in a mipmap) and, when a pool is chosen, it cannot be changed.
Applications should use
For dynamic textures, it is sometimes desirable to use a pair of video memory and system memory textures, allocating the video memory using
Resources are placed in the memory pool most appropriate for the set of usages requested for the given resource. This is usually video memory, including both local video memory and AGP memory. The
When creating resources with
Resources are copied automatically to device-accessible memory as needed. Managed resources are backed by system memory and do not need to be recreated when a device is lost. See Managing Resources (Direct3D 9) for more information. Managed resources can be locked. Only the system-memory copy is directly modified. Direct3D copies your changes to driver-accessible memory as needed.
Differences between Direct3D 9 and Direct3D 9Ex: |
?
Resources are placed in memory that is not typically accessible by the Direct3D device. This memory allocation consumes system RAM but does not reduce pageable RAM. These resources do not need to be recreated when a device is lost. Resources in this pool can be locked and can be used as the source for a
Resources are placed in system RAM and do not need to be recreated when a device is lost. These resources are not bound by device size or format restrictions. Because of this, these resources cannot be accessed by the Direct3D device nor set as textures or render targets. However, these resources can always be created, locked, and copied.
Describes the relationship between the adapter refresh rate and the rate at which Present or Present operations are completed. These values also serve as flag values for the PresentationIntervals field of
Windowed mode supports
Full-screen mode supports similar usage as windowed mode by supporting
Constants used by
Describes the relationship between the adapter refresh rate and the rate at which Present or Present operations are completed. These values also serve as flag values for the PresentationIntervals field of
Windowed mode supports
Full-screen mode supports similar usage as windowed mode by supporting
Miscellaneous driver primitive capability flags.
Defines the primitives supported by Direct3D.
Using Triangle Strips or Triangle Fans (Direct3D 9) is often more efficient than using triangle lists because fewer vertices are duplicated.
Renders the vertices as a collection of isolated points. This value is unsupported for indexed primitives.
Renders the vertices as a list of isolated straight line segments.
Renders the vertices as a single polyline.
Renders the specified vertices as a sequence of isolated triangles. Each group of three vertices defines a separate triangle.
Back-face culling is affected by the current winding-order render state.
Renders the vertices as a triangle strip. The backface-culling flag is automatically flipped on even-numbered triangles.
Renders the vertices as a triangle fan.
Identifies the query type. For information about queries, see Queries (Direct3D 9)
A programmable pixel shader is made up of a set of instructions that operate on pixel data. Registers transfer data in and out of the ALU. Additional control can be applied to modify the instruction, the results, or what data gets written out.
Data type of the register.
Boolean value.
4D integer number.
4D floating-point number.
The register contains 4D sampler data.
The
#define D3DRENDERSTATE_EVICTMANAGEDTEXTURES 61 #define D3DRENDERSTATE_SCENECAPTURE 62 #define D3DRS_DELETERTPATCH 169 #define D3DRS_MAXVERTEXSHADERINST 196 #define D3DRS_MAXPIXELSHADERINST 197
Enumerators
Determines whether textures are evicted from memory.
The driver uses a
This render state determines whether the driver evicts textures that it manages (as opposed to textures managed by the Direct3D runtime) from video memory. If the render state value is TRUE, the driver evicts the textures. Otherwise, the driver does not evict those textures.
Specifies either begin scene information or end scene information for geometric data captured within a frame.
The driver uses a
The driver responds to D3DRENDERSTATE_SCENECAPTURE first with TRUE for begin scene information and next with
Care must be taken in updating a driver that implements the legacy D3DHALCallbacks->D3dSceneCapture callback routine to one using the D3DRENDERSTATE_SCENECAPTURE render state. The D3dSceneCapture callback routine uses the constants D3DHAL_SCENE_CAPTURE_START and D3DHAL_SCENE_CAPTURE_END to indicate, respectively, the beginning and end of a scene. The values of these constants are, respectively, 0 and 1. If you use these constants in place of TRUE and
DirectX 8.0 and later versions only.
Deletes either a rectangular or triangular patch from memory. The driver uses a DWORD data type without a default value to detect the patch to delete.
This render state notifies the driver that a patch is to be deleted. The value of this render state is the handle to the patch affected. All cached information should be freed and the handle should be removed from the driver's patch handle table. This render state is not visible to applications but is generated internally when an application calls the DeletePatch function. This render state is sent to the driver only when patches are deleted by DeletePatch explicitly. All other patches should be cleaned up when the device is destroyed.
DirectX 9.0 and later versions only.
Determines the maximum number of instructions that the vertex shader assembler can execute.
The driver uses a DWORD data type with a default value of D3DINFINITEINSTRUCTIONS (0xffffffff) to report the maximum number of vertex-shader instructions. This maximum number depends on the version of the vertex shader that the display device supports as shown in the following table.
Version | Maximum number |
---|---|
earlier than 2_0 | 0 |
2_0 and later | From 216 (0x0000ffff) to D3DINFINITEINSTRUCTIONS |
?
D3DINFINITEINSTRUCTIONS represents a virtually unlimited amount.
Valid values for this render state are numbers that are powers of 2; if the driver sets any other integer, the runtime uses the next nearest power of 2 number.
The runtime sets the MaxVShaderInstructionsExecuted member of the
DirectX 9.0 and later versions only.
Determines the maximum number of instructions that the pixel shader assembler can execute.
The driver uses a DWORD data type with a default value of D3DINFINITEINSTRUCTIONS (0xffffffff) to report the maximum number of pixel-shader instructions. This maximum number depends on the version of the pixel shader that the display device supports as shown in the following table.
Version | Maximum number |
---|---|
earlier than 2_0 | 0 |
2_0 | From 96 to D3DINFINITEINSTRUCTIONS |
3_0 and later | From 216 (0x0000ffff) to D3DINFINITEINSTRUCTIONS |
?
D3DINFINITEINSTRUCTIONS represents a virtually unlimited amount.
Valid values for this render state are numbers that are powers of 2; if the driver sets any other integer, the runtime uses the next nearest power of 2 number.
The runtime sets the MaxVShaderInstructionsExecuted member of the
The driver uses these render states when it performs graphics rendering. Only render states that are specific to drivers are included in the Windows Driver Kit (WDK) documentation. The render states accessible to DirectX applications are included in the DirectX SDK documentation. These application-level render states include such characteristics as whether alpha blending is enabled, whether dithering is enabled, whether Direct3D lighting is used, and the type of shading to be used.
To update a particular render state, Direct3D stores information about the render state, and then calls the driver's D3dDrawPrimitives2 callback routine. The information provided to the driver enables it to:
Determine that it should update one or more render states.
Identify which render states to update, and what the new render state values should be.
Note that for certain render states to be honored, the driver must have previously set capability flags in the relevant member of the D3DPRIMCAPS structure.
In order to indicate a specific render state update, Direct3D inserts a D3DHAL_DP2COMMAND structure into the command buffer, setting the bCommand member of this structure to D3DDP2OP_RENDERSTATE (see the description for D3DDP2OP_RENDERSTATE in D3DHAL_DP2OPERATION), and setting the wStateCount member of the same structure to the number of render states to be updated.
Immediately following the D3DHAL_DP2COMMAND structure, Direct3D inserts one D3DHAL_DP2RENDERSTATE structure into the command buffer for each render state to be updated. The RenderState member of this structure identifies the render state to be changed; the new value of this render state is specified in either the dwState member (for DWORD values) or the fState member (for D3DVALUE values).
The following figure shows a portion of the command buffer containing a D3DDP2OP_RENDERSTATE command and two D3DHAL_DP2RENDERSTATE structures. The first of the three structures indicates that two render states are to be updated. The second structure indicates that the D3DRENDERSTATE_FILLMODE render state is to be changed to
Additional Notes
See the
Some changes have been made to the
Multitexture macro ops and D3DRENDERSTATE_TEXTUREFACTOR override all of the per-texture stage blending controls (COLOR{OP,ARG1,ARG2} & ALPHA{OP,ARG1,ARG2}).
Determines whether textures are evicted from memory.
The driver uses a
This render state determines whether the driver evicts textures that it manages (as opposed to textures managed by the Direct3D runtime) from video memory. If the render state value is TRUE, the driver evicts the textures. Otherwise, the driver does not evict those textures.
Specifies either begin scene information or end scene information for geometric data captured within a frame.
The driver uses a
The driver responds to D3DRENDERSTATE_SCENECAPTURE first with TRUE for begin scene information and next with
Care must be taken in updating a driver that implements the legacy D3DHALCallbacks->D3dSceneCapture callback routine to one using the D3DRENDERSTATE_SCENECAPTURE render state. The D3dSceneCapture callback routine uses the constants D3DHAL_SCENE_CAPTURE_START and D3DHAL_SCENE_CAPTURE_END to indicate, respectively, the beginning and end of a scene. The values of these constants are, respectively, 0 and 1. If you use these constants in place of TRUE and
DirectX 8.0 and later versions only.
Deletes either a rectangular or triangular patch from memory. The driver uses a DWORD data type without a default value to detect the patch to delete.
This render state notifies the driver that a patch is to be deleted. The value of this render state is the handle to the patch affected. All cached information should be freed and the handle should be removed from the driver's patch handle table. This render state is not visible to applications but is generated internally when an application calls the DeletePatch function. This render state is sent to the driver only when patches are deleted by DeletePatch explicitly. All other patches should be cleaned up when the device is destroyed.
DirectX 9.0 and later versions only.
Determines the maximum number of instructions that the vertex shader assembler can execute.
The driver uses a DWORD data type with a default value of D3DINFINITEINSTRUCTIONS (0xffffffff) to report the maximum number of vertex-shader instructions. This maximum number depends on the version of the vertex shader that the display device supports as shown in the following table.
Version | Maximum number |
---|---|
earlier than 2_0 | 0 |
2_0 and later | From 216 (0x0000ffff) to D3DINFINITEINSTRUCTIONS |
?
D3DINFINITEINSTRUCTIONS represents a virtually unlimited amount.
Valid values for this render state are numbers that are powers of 2; if the driver sets any other integer, the runtime uses the next nearest power of 2 number.
The runtime sets the MaxVShaderInstructionsExecuted member of the
DirectX 9.0 and later versions only.
Determines the maximum number of instructions that the pixel shader assembler can execute.
The driver uses a DWORD data type with a default value of D3DINFINITEINSTRUCTIONS (0xffffffff) to report the maximum number of pixel-shader instructions. This maximum number depends on the version of the pixel shader that the display device supports as shown in the following table.
Version | Maximum number |
---|---|
earlier than 2_0 | 0 |
2_0 | From 96 to D3DINFINITEINSTRUCTIONS |
3_0 and later | From 216 (0x0000ffff) to D3DINFINITEINSTRUCTIONS |
?
D3DINFINITEINSTRUCTIONS represents a virtually unlimited amount.
Valid values for this render state are numbers that are powers of 2; if the driver sets any other integer, the runtime uses the next nearest power of 2 number.
The runtime sets the MaxVShaderInstructionsExecuted member of the
Sampler states define texture sampling operations such as texture addressing and texture filtering. Some sampler states set-up vertex processing, and some set-up pixel processing. Sampler states can be saved and restored using stateblocks (see State Blocks Save and Restore State (Direct3D 9)).
Defines the sampler texture types for vertex shaders.
Uninitialized value. The value of this element is D3DSP_TEXTURETYPE_SHIFT.
Declaring a 2D texture. The value of this element is D3DSP_TEXTURETYPE_SHIFT * 4.
Declaring a cube texture. The value of this element is D3DSP_TEXTURETYPE_SHIFT * 8.
Declaring a volume texture. The value of this element is D3DSP_TEXTURETYPE_SHIFT * 16.
Flags indicating the method the rasterizer uses to create an image on a surface.
This enumeration is used as a member in
The image is created from the first scanline to the last without skipping any.
The image is created using the interlaced method in which odd-numbered lines are drawn on odd-numbered passes and even lines are drawn on even-numbered passes.
The image is created using the interlaced method in which odd-numbered lines are drawn on odd-numbered passes and even lines are drawn on even-numbered passes.
The following page provides a basic outline of key differences between Direct3D 9 and Direct3D 10. The outline below provides some insight to assist developers with Direct3D 9 experience to explore and relate to Direct3D 10.
Although the info in this topic compares Direct3D 9 with Direct3D 10, because Direct3D 11 builds on the improvements made in Direct3D 10 and 10.1, you also need this info to migrate from Direct3D 9 to Direct3D 11. For info about moving beyond Direct3D 10 to Direct3D 11, see Migrating to Direct3D 11.
Defines constants that describe the supported shading modes.
The first vertex of a triangle for flat shading mode is defined in the following manner.
The members of this enumerated type define the vales for the
Flat shading mode. The color and specular component of the first vertex in the triangle are used to determine the color and specular component of the face. These colors remain constant across the triangle; that is, they are not interpolated. The specular alpha is interpolated. See Remarks.
Gouraud shading mode. The color and specular components of the face are determined by a linear interpolation between all three of the triangle's vertices.
Not supported.
The
Parser flags
Parse time flags are only used by the effect system (before effect compilation) when you create an effect compiler. For example, you could create a compiler object with
The effect system will use parser flags when called by the following functions:
The effect system will use compiler flags when called by the following functions:
In addition, you can use compiler flags when creating an effect by calling
The effect system will use assembler flags when called by the following functions:
Applying compiler flags or assembler flags to the incorrect API will fail shader validation. Check the Direct3D error code return value from the function (with the DirectX Error Lookup Tool) to help track down this error.
The following flags are used to specify sprite rendering options to the flags parameter in the Begin method:
Predefined sets of pipeline state used by state blocks (see State Blocks Save and Restore State (Direct3D 9)).
As the following diagram shows, vertex and pixel state are both subsets of device state.
There are only a few states that are considered both vertex and pixel state. These states are:
Driver stencil capability flags.
Defines stencil-buffer operations.
Stencil-buffer entries are integer values ranging from 0 through 2n - 1, where n is the bit depth of the stencil buffer.
Do not update the entry in the stencil buffer. This is the default value.
Set the stencil-buffer entry to 0.
Replace the stencil-buffer entry with a reference value.
Increment the stencil-buffer entry, clamping to the maximum value.
Decrement the stencil-buffer entry, clamping to zero.
Invert the bits in the stencil-buffer entry.
Increment the stencil-buffer entry, wrapping to zero if the new value exceeds the maximum value.
Decrement the stencil-buffer entry, wrapping to the maximum value if the new value is less than zero.
Given a scene that contains many objects that use the same geometry, you can draw many instances of that geometry at different orientations, sizes, colors, and so on with dramatically better performance by reducing the amount of data you need to supply to the renderer.
This can be accomplished through the use of two techniques: the first for drawing indexed geometry and the second for non-indexed geometry. Both techniques use two vertex buffers: one to supply geometry data and one to supply per-object instance data. The instance data can be a wide variety of information such as a transform, color data, or lighting data - basically anything that you can describe in a vertex declaration. Drawing many instances of geometry with these techniques can dramatically reduce the amount of data sent to the renderer.
Defines swap effects.
The state of the back buffer after a call to Present is well-defined by each of these swap effects, and whether the Direct3D device was created with a full-screen swap chain or a windowed swap chain has no effect on this state. In particular, the
Applications that use
An invisible window cannot receive user-mode events; furthermore, an invisible-fullscreen window will interfere with the presentation of another applications' windowed-mode window. Therefore, each application needs to ensure that a device window is visible when a swapchain is presented in fullscreen mode.
When a swap chain is created with a swap effect of
Like a swap chain that uses
An application that uses this swap effect cannot make any assumptions about the contents of a discarded back buffer and should therefore update an entire back buffer before invoking a Present operation that would display it. Although this is not enforced, the debug version of the runtime will overwrite the contents of discarded back buffers with random data to enable developers to verify that their applications are updating the entire back buffer surfaces correctly.
The swap chain might include multiple back buffers and is best envisaged as a circular queue that includes the front buffer. Within this queue, the back buffers are always numbered sequentially from 0 to (n - 1), where n is the number of back buffers, so that 0 denotes the least recently presented buffer. When Present is invoked, the queue is "rotated" so that the front buffer becomes back buffer (n - 1), while the back buffer 0 becomes the new front buffer.
This swap effect may be specified only for a swap chain comprising a single back buffer. Whether the swap chain is windowed or full-screen, the runtime will guarantee the semantics implied by a copy-based Present operation, namely that the operation leaves the content of the back buffer unchanged, instead of replacing it with the content of the front buffer as a flip-based Present operation would.
For a full-screen swap chain, the runtime uses a combination of flip operations and copy operations, supported if necessary by hidden back buffers, to accomplish the Present operation. Accordingly, the presentation is synchronized with the display adapter's vertical retrace and its rate is constrained by the chosen presentation interval. A swap chain specified with the
Use a dedicated area of video memory that can be overlayed on the primary surface. No copy is performed when the overlay is displayed. The overlay operation is performed in hardware, without modifying the data in the primary surface.
Differences between Direct3D 9 and Direct3D 9Ex: |
?
Designates when an application is adopting flip mode, during which time an application's frame is passed instead of copied to the Desktop Window Manager(DWM) for composition when the application is presenting in windowed mode. Flip mode allows an application to more efficiently use memory bandwidth as well as enabling an application to take advantage of full-screen-present statistics. Flip mode does not affect full-screen behavior. A sample application that uses
Note??If you create a swap chain with
Differences between Direct3D 9 and Direct3D 9Ex: |
?
Defines settings used for mesh tangent frame computations.
Texture coordinate values in the u direction are between 0 and 1. In this case a texture coordinate set will be chosen that minimizes the perimeter of the triangle. See Texture Wrapping (Direct3D 9).
Texture coordinate values in the v direction are between 0 and 1. In this case a texture coordinate set will be chosen that minimizes the perimeter of the triangle. See Texture Wrapping (Direct3D 9).
Texture coordinate values in both u and v directions are between 0 and 1. In this case a texture coordinate set will be chosen that minimizes the perimeter of the triangle. See Texture Wrapping (Direct3D 9).
Do not normalize partial derivatives with respect to texture coordinates. If not normalized, the scale of the partial derivatives is proportional to the scale of the 3D model divided by the scale of the triangle in (u, v) space. This scale value provides a measure of how much the texture is stretched in a given direction. The resulting vector length is a weighted sum of the lengths of the partial derivatives.
Do not transform texture coordinates to orthogonal Cartesian coordinates. Mutually exclusive with
Compute the partial derivative with respect to texture coordinate v independently for each vertex, and then compute the partial derivative with respect to u as the cross product of the partial derivative with respect to v and the normal vector. Mutually exclusive with
Compute the partial derivative with respect to texture coordinate u independently for each vertex, and then compute the partial derivative with respect to v as the cross product of the normal vector and the partial derivative with respect to u. Mutually exclusive with
Weight the direction of the computed per-vertex normal or partial derivative vector according to the areas of triangles attached to that vertex. Mutually exclusive with
Compute a unit-length normal vector for each triangle of the input mesh. Mutually exclusive with
Vertices are ordered in a clockwise direction around each triangle. The computed normal vector direction is therefore inverted 180 degrees from the direction computed using counterclockwise vertex ordering.
Compute the per-vertex normal vector for each triangle of the input mesh, and ignore any normal vectors already in the input mesh.
The results are stored in the original input mesh, and the output mesh is not used.
Defines constants that describe the supported texture-addressing modes.
Tile the texture at every integer junction. For example, for u values between 0 and 3, the texture is repeated three times; no mirroring is performed.
Similar to
Texture coordinates outside the range [0.0, 1.0] are set to the texture color at 0.0 or 1.0, respectively.
Texture coordinates outside the range [0.0, 1.0] are set to the border color.
Similar to
A programmable pixel shader is made up of a set of instructions that operate on pixel data. Registers transfer data in and out of the ALU. Additional control can be applied to modify the instruction, the results, or what data gets written out.
Texture argument constants are used as values for the following members of the
Set and retrieve texture arguments by calling the SetTextureStageState and GetTextureStageState methods.
Argument flags
You can combine an argument flag with a modifier, but two argument flags cannot be combined.
A programmable pixel shader is made up of a set of instructions that operate on pixel data. Registers transfer data in and out of the ALU. Additional control can be applied to modify the instruction, the results, or what data gets written out.
Driver texture coordinate capability flags.
Defines texture filtering modes for a texture stage.
To check if a format supports texture filter types other than
Set a texture stage's magnification filter by calling
Set a texture stage's minification filter by calling
Set the texture filter to use between-mipmap levels by calling
Not all valid filtering modes for a device will apply to volume maps. In general,
When used with
When used with D3DSAMP_ MAGFILTER or
When used with D3DSAMP_ MAGFILTER or
When used with D3DSAMP_ MAGFILTER or
A 4-sample tent filter used as a texture magnification or minification filter. Use with
A 4-sample Gaussian filter used as a texture magnification or minification filter. Use with
Convolution filter for monochrome textures. See
Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. |
?
Use with
Defines per-stage texture-blending operations.
The members of this type are used when setting color or alpha operations by using the
In the above formulas, SRGBA is the RGBA color produced by a texture operation, and Arg1, Arg2, and Arg3 represent the complete RGBA color of the texture arguments. Individual components of an argument are shown with subscripts. For example, the alpha component for argument 1 would be shown as Arg1A.
Disables output from this texture stage and all stages with a higher index. To disable texture mapping, set this as the color operation for the first texture stage (stage 0). Alpha operations cannot be disabled when color operations are enabled. Setting the alpha operation to
Use this texture stage's first color or alpha argument, unmodified, as the output. This operation affects the color argument when used with the
Use this texture stage's second color or alpha argument, unmodified, as the output. This operation affects the color argument when used with the
Multiply the components of the arguments.
Multiply the components of the arguments, and shift the products to the left 1 bit (effectively multiplying them by 2) for brightening.
Multiply the components of the arguments, and shift the products to the left 2 bits (effectively multiplying them by 4) for brightening.
Add the components of the arguments.
Add the components of the arguments with a - 0.5 bias, making the effective range of values from - 0.5 through 0.5.
Add the components of the arguments with a - 0.5 bias, and shift the products to the left 1 bit.
Subtract the components of the second argument from those of the first argument.
Add the first and second arguments; then subtract their product from the sum.
Linearly blend this texture stage, using the interpolated alpha from each vertex.
Linearly blend this texture stage, using the alpha from this stage's texture.
Linearly blend this texture stage, using a scalar alpha set with the
Linearly blend a texture stage that uses a premultiplied alpha.
Linearly blend this texture stage, using the alpha taken from the previous texture stage.
Modulate the color of the second argument, using the alpha of the first argument; then add the result to argument one. This operation is supported only for color operations (
Modulate the arguments; then add the alpha of the first argument. This operation is supported only for color operations (
Similar to
Similar to
Perform per-pixel bump mapping, using the environment map in the next texture stage, without luminance. This operation is supported only for color operations (
Perform per-pixel bump mapping, using the environment map in the next texture stage, with luminance. This operation is supported only for color operations (
Modulate the components of each argument as signed components, add their products; then replicate the sum to all color channels, including alpha. This operation is supported for color and alpha operations.
In DirectX 6 and DirectX 7, multitexture operations the above inputs are all shifted down by half (y = x - 0.5) before use to simulate signed data, and the scalar result is automatically clamped to positive values and replicated to all three output channels. Also, note that as a color operation this does not updated the alpha it just updates the RGB components.
However, in DirectX 8.1 shaders you can specify that the output be routed to the .rgb or the .a components or both (the default). You can also specify a separate scalar operation on the alpha channel.
Performs a multiply-accumulate operation. It takes the last two arguments, multiplies them together, and adds them to the remaining input/source argument, and places that into the result.
SRGBA = Arg1 + Arg2 * Arg3
Linearly interpolates between the second and third source arguments by a proportion specified in the first source argument.
SRGBA = (Arg1) * Arg2 + (1- Arg1) * Arg3.
Represents the capabilities of the hardware exposed through the Direct3D object.
The MaxTextureBlendStages and MaxSimultaneousTextures members might seem similar, but they contain different information. The MaxTextureBlendStages member contains the total number of texture-blending stages supported by the current device, and the MaxSimultaneousTextures member describes how many of those stages can have textures bound to them by using the SetTexture method.
When the driver fills this structure, it can set values for execute-buffer capabilities, even when the interface being used to retrieve the capabilities (such as
In general, performance problems may occur if you use a texture and then modify it during a scene. Ensure that no texture used in the current BeginScene and EndScene block is evicted unless absolutely necessary. In the case of extremely high texture usage within a scene, the results are undefined. This occurs when you modify a texture that you have used in the scene and there is no spare texture memory available. For such systems, the contents of the z-buffer become invalid at EndScene. Applications should not call UpdateSurface to or from the back buffer on this type of hardware inside a BeginScene/EndScene pair. In addition, applications should not try to access the z-buffer if the
The following flags concerning mipmapped textures are not supported in Direct3D 9.
Member of the
Adapter on which this Direct3D device was created. This ordinal is valid only to pass to methods of the
The following driver-specific capability.
Value | Meaning |
---|---|
Display hardware is capable of returning the current scan line. | |
The display driver supports an overlay DDI that allows for verification of overlay capabilities. For more information about the overlay DDI, see Overlay DDI. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? |
?
Driver-specific capabilities identified in
Driver-specific capabilities identified in
Bit mask of values representing what presentation swap intervals are available.
Value | Meaning |
---|---|
The driver supports an immediate presentation swap interval. | |
The driver supports a presentation swap interval of every screen refresh. | |
The driver supports a presentation swap interval of every second screen refresh. | |
The driver supports a presentation swap interval of every third screen refresh. | |
The driver supports a presentation swap interval of every fourth screen refresh. |
?
Bit mask indicating what hardware support is available for cursors. Direct3D 9 does not define alpha-blending cursor capabilities.
Value | Meaning |
---|---|
A full-color cursor is supported in hardware. Specifically, this flag indicates that the driver supports at least a hardware color cursor in high-resolution modes (with scan lines greater than or equal to 400). | |
A full-color cursor is supported in hardware. Specifically, this flag indicates that the driver supports a hardware color cursor in both high-resolution and low-resolution modes (with scan lines less than 400). |
?
Flags identifying the capabilities of the device.
Value | Meaning |
---|---|
Device supports blits from system-memory textures to nonlocal video-memory textures. | |
Device can queue rendering commands after a page flip. Applications do not change their behavior if this flag is set; this capability means that the device is relatively fast. | |
Device can support at least a DirectX 5-compliant driver. | |
Device can support at least a DirectX 7-compliant driver. | |
Device exports an | |
Device can use execute buffers from system memory. | |
Device can use execute buffers from video memory. | |
Device has hardware acceleration for scene rasterization. | |
Device can support transformation and lighting in hardware. | |
Device supports N patches. | |
Device can support rasterization, transform, lighting, and shading in hardware. | |
Device supports quintic B?zier curves and B-splines. | |
Device supports rectangular and triangular patches. | |
When this device capability is set, the hardware architecture does not require caching of any information, and uncached patches (handle zero) will be drawn as efficiently as cached ones. Note that setting | |
Device is texturing from separate memory pools. | |
Device can retrieve textures from non-local video memory. | |
Device can retrieve textures from system memory. | |
Device can retrieve textures from device memory. | |
Device can use buffers from system memory for transformed and lit vertices. | |
Device can use buffers from video memory for transformed and lit vertices. |
?
Miscellaneous driver primitive capabilities. See
Information on raster-drawing capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device supports anisotropic filtering. | |
Device iterates colors perspective correctly. | |
Device can dither to improve color resolution. | |
Device supports legacy depth bias. For true depth bias, see | |
Device supports range-based fog. In range-based fog, the distance of an object from the viewer is used to compute fog effects, not the depth of the object (that is, the z-coordinate) in the scene. | |
Device calculates the fog value by referring to a lookup table containing fog values that are indexed to the depth of a given pixel. | |
Device calculates the fog value during the lighting operation and interpolates the fog value during rasterization. | |
Device supports level-of-detail bias adjustments. These bias adjustments enable an application to make a mipmap appear crisper or less sharp than it normally would. For more information about level-of-detail bias in mipmaps, see | |
Device supports toggling multisampling on and off between | |
Device supports scissor test. See Scissor Test (Direct3D 9). | |
Device performs true slope-scale based depth bias. This is in contrast to the legacy style depth bias. | |
Device supports depth buffering using w. | |
Device supports w-based fog. W-based fog is used when a perspective projection matrix is specified, but affine projections still use z-based fog. The system considers a projection matrix that contains a nonzero value in the [3][4] element to be a perspective projection matrix. | |
Device can perform hidden-surface removal (HSR) without requiring the application to sort polygons and without requiring the allocation of a depth-buffer. This leaves more video memory for textures. The method used to perform HSR is hardware-dependent and is transparent to the application. Z-bufferless HSR is performed if no depth-buffer surface is associated with the rendering-target surface and the depth-buffer comparison test is enabled (that is, when the state value associated with the | |
Device supports z-based fog. | |
Device can perform z-test operations. This effectively renders a primitive and indicates whether any z pixels have been rendered. |
?
Z-buffer comparison capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Always pass the z-test. | |
Pass the z-test if the new z equals the current z. | |
Pass the z-test if the new z is greater than the current z. | |
Pass the z-test if the new z is greater than or equal to the current z. | |
Pass the z-test if the new z is less than the current z. | |
Pass the z-test if the new z is less than or equal to the current z. | |
Always fail the z-test. | |
Pass the z-test if the new z does not equal the current z. |
?
Source-blending capabilities. This member can be one or more of the following flags. (The RGBA values of the source and destination are indicated by the subscripts s and d.)
Value | Meaning |
---|---|
The driver supports both | |
Source blend factor is (1 - As, 1 - As, 1 - As, 1 - As) and destination blend factor is (As, As, As, As); the destination blend selection is overridden. | |
The driver supports the | |
Blend factor is (Ad, Ad, Ad, Ad). | |
Blend factor is (Rd, Gd, Bd, Ad). | |
Blend factor is (1 - Ad, 1 - Ad, 1 - Ad, 1 - Ad). | |
Blend factor is (1 - Rd, 1 - Gd, 1 - Bd, 1 - Ad). | |
Blend factor is (1 - As, 1 - As, 1 - As, 1 - As). | |
Blend factor is (1 - Rs, 1 - Gs, 1 - Bs, 1 - As). | |
Blend factor is (1 - PSOutColor[1]r, 1 - PSOutColor[1]g, 1 - PSOutColor[1]b, not used)). See Render Target Blending. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? | |
Blend factor is (1, 1, 1, 1). | |
Blend factor is (As, As, As, As). | |
Blend factor is (f, f, f, 1); f = min(As, 1 - Ad). | |
Blend factor is (Rs, Gs, Bs, As). | |
Blend factor is (PSOutColor[1]r, PSOutColor[1]g, PSOutColor[1]b, not used). See Render Target Blending. Differences between Direct3D 9 and Direct3D 9Ex: This flag is available in Direct3D 9Ex only. ? | |
Blend factor is (0, 0, 0, 0). |
?
Destination-blending capabilities. This member can be the same capabilities that are defined for the SrcBlendCaps member.
Alpha-test comparison capabilities. This member can include the same capability flags defined for the ZCmpCaps member. If this member contains only the
Shading operations capabilities. It is assumed, in general, that if a device supports a given command at all, it supports the
The color, specular highlights, fog, and alpha interpolants of a triangle each have capability flags that an application can use to find out how they are implemented by the device driver.
This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device can support an alpha component for Gouraud-blended transparency (the | |
Device can support colored Gouraud shading. In this mode, the per-vertex color components (red, green, and blue) are interpolated across a triangle face. | |
Device can support fog in the Gouraud shading mode. | |
Device supports Gouraud shading of specular highlights. |
?
Miscellaneous texture-mapping capabilities. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Alpha in texture pixels is supported. | |
Device can draw alpha from texture palettes. | |
Supports cube textures. | |
Device requires that cube texture maps have dimensions specified as powers of two. | |
Device supports mipmapped cube textures. | |
Device supports mipmapped textures. | |
Device supports mipmapped volume textures. | |
If this flag is not set, and A texture that is not a power of two cannot be set at a stage that will be read based on a shader computation (such as the bem - ps and texm3x3 - ps instructions in pixel shaders versions 1_0 to 1_3). For example, these textures can be used to store bumps that will be fed into texture reads, but not the environment maps that are used in texbem - ps, texbeml - ps, and texm3x3spec - ps. This means that a texture with dimensions that are not powers of two cannot be addressed or sampled using texture coordinates computed within the shader. This type of operation is known as a dependent read and cannot be performed on these types of textures. | |
Device does not support a projected bump-environment loopkup operation in programmable and fixed function shaders. | |
Perspective correction texturing is supported. | |
If If If this flag is not set, and | |
Supports the | |
All textures must be square. | |
Texture indices are not scaled by the texture size prior to interpolation. | |
Device supports volume textures. | |
Device requires that volume texture maps have dimensions specified as powers of two. |
?
Texture-filtering capabilities for a texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-filtering capabilities for a cube texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-filtering capabilities for a volume texture. Per-stage filtering capabilities reflect which filtering modes are supported for texture stages when performing multiple-texture blending. This member can be any combination of the per-stage texture-filtering flags defined in
Texture-addressing capabilities for texture objects. This member can be one or more of the following flags.
Value | Meaning |
---|---|
Device supports setting coordinates outside the range [0.0, 1.0] to the border color, as specified by the | |
Device can clamp textures to addresses. | |
Device can separate the texture-addressing modes of the u and v coordinates of the texture. This ability corresponds to the | |
Device can mirror textures to addresses. | |
Device can take the absolute value of the texture coordinate (thus, mirroring around 0) and then clamp to the maximum value. | |
Device can wrap textures to addresses. |
?
Texture-addressing capabilities for a volume texture. This member can be one or more of the flags defined for the TextureAddressCaps member.
Defines the capabilities for line-drawing primitives.
Value | Meaning |
---|---|
Supports alpha-test comparisons. | |
Antialiased lines are supported. | |
Supports source-blending. | |
Supports fog. | |
Supports texture-mapping. | |
Supports z-buffer comparisons. |
?
Maximum texture width for this device.
Maximum texture height for this device.
Maximum value for any of the three dimensions (width, height, and depth) of a volume texture.
This number represents the maximum range of the integer bits of the post-normalized texture coordinates. A texture coordinate is stored as a 32-bit signed integer using 27 bits to store the integer part and 5 bits for the floating point fraction. The maximum integer index, 227, is used to determine the maximum texture coordinate, depending on how the hardware does texture-coordinate scaling.
Some hardware reports the cap
Less desirably, on some hardware
For example, assume that MaxTextureRepeat is equal to 32k and the size of the texture is 4k. If the hardware sets
Texture stage states define multi-blender texture operations. Some sampler states set up vertex processing, and some set up pixel processing. Texture stage states can be saved and restored using stateblocks (see State Blocks Save and Restore State (Direct3D 9)).
Members of this enumerated type are used with the
The valid range of values for the
Defines texture coordinate transformation values.
Texture coordinates can be transformed using a 4 x 4 matrix before the results are passed to the rasterizer. The texture coordinate transforms are set by calling
Texture coordinates are passed directly to the rasterizer.
The rasterizer should expect 1D texture coordinates. This value is used by fixed function vertex processing; it should be set to 0 when using a programmable vertex shader.
The rasterizer should expect 2D texture coordinates. This value is used by fixed function vertex processing; it should be set to 0 when using a programmable vertex shader.
The rasterizer should expect 3D texture coordinates. This value is used by fixed function vertex processing; it should be set to 0 when using a programmable vertex shader.
The rasterizer should expect 4D texture coordinates. This value is used by fixed function vertex processing; it should be set to 0 when using a programmable vertex shader.
This flag is honored by the fixed function pixel pipeline, as well as the programmable pixel pipeline in versions ps_1_1 to ps_1_3. When texture projection is enabled for a texture stage, all four floating point values must be written to the corresponding texture register. Each texture coordinate is divided by the last element before being passed to the rasterizer. For example, if this flag is specified with the
In short, texture wrapping changes the basic way that Direct3D rasterizes textured polygons using the texture coordinates specified for each vertex. While rasterizing a polygon, the system interpolates between the texture coordinates at each of the polygon's vertices to determine the texels that should be used for every pixel of the polygon. Normally, the system treats the texture as a 2D plane, interpolating new texels by taking the shortest route from point A within a texture to point B. If point A represents the u, v position (0.8, 0.1), and point B is at (0.1,0.1), the line of interpolation looks like the following diagram.
Note that the shortest distance between A and B in this illustration runs roughly through the middle of the texture. Enabling u-texture or v-texture coordinate wrapping changes how Direct3D perceives the shortest route between texture coordinates in the u-direction and v-direction. By definition, texture wrapping causes the rasterizer to take the shortest route between texture coordinate sets, assuming that 0.0 and 1.0 are coincident. The last bit is the tricky part: You can imagine that enabling texture wrapping in one direction causes the system to treat a texture as though it were wrapped around a cylinder. For example, consider the following diagram.
The preceding illustration shows how wrapping in the u - direction affects how the system interpolates texture coordinates. Using the same points as in the example for normal, or nonwrapped, textures, you can see that the shortest route between points A and B is no longer across the middle of the texture; it's now across the border where 0.0 and 1.0 exist together. Wrapping in the v-direction is similar, except that it wraps the texture around a cylinder that is lying on its side. Wrapping in both the u-direction and v-direction is more complex. In this situation, you can envision the texture as a torus, or doughnut.
The most common practical application for texture wrapping is to perform environment mapping. Usually, an object textured with an environment map appears very reflective, showing a mirrored image of the object's surroundings in the scene. For the sake of this discussion, picture a room with four walls, each one painted with a letter R, G, B, Y and the corresponding colors: red, green, blue, and yellow. The environment map for such a simple room might look like the following illustration.
Imagine that the room's ceiling is held up by a perfectly reflective, four-sided, pillar. Mapping the environment map texture to the pillar is simple; making the pillar look as though it is reflecting the letters and colors is not as easy. The following diagram shows a wire frame of the pillar with the applicable texture coordinates listed near the top vertices. The seam where wrapping will cross the edges of the texture is shown with a dotted line.
With wrapping enabled in the u-direction, the textured pillar shows the colors and symbols from the environment map appropriately and, at the seam in the front of the texture, the rasterizer properly chooses the shortest route between the texture coordinates, assuming that u-coordinates 0.0 and 1.0 share the same location. The textured pillar looks like the following illustration.
If texture wrapping isn't enabled, the rasterizer does not interpolate in the direction needed to generate a believable, reflected image. Rather, the area at the front of the pillar contains a horizontally compressed version of the texels between u-coordinates 0.175 and 0.875, as they pass through the center of the texture. The wrap effect is ruined.
Defines the priority type to which an animation track is assigned.
Tracks with the same priority are blended together, and the two resulting values are then blended using the priority blend factor.
Track should be blended with all the low-priority tracks before the low-priority blend is mixed with the high-priority blend.
Track should be blended with all the high-priority tracks before the high-priority blend is mixed with the low-priority blend.
Defines the transition style between values of a mesh animation.
The calculation for the ramp from ease in to ease out is calculated as follows:
where the ramp is a function Q(t) with the following properties:
Mathematically, this translates into:
Solving for A, B, C, D:
Therefore:
Linear transition between values.
Ease-in, ease-out spline transition between values.
Usage options that identify how resources are to be used.
The following table summarizes the available usage options.
Texture wrapping options for IMT computation APIs.
The texture wraps in the U direction.
The texture wraps in the V direction.
The texture wraps in both the U and V direction.
Defines flags used to control the number or matrices that the system applies when performing multimatrix vertex blending.
Members of this type are used with the
Geometry blending (multimatrix vertex blending) requires that your application use a vertex format that has blending (beta) weights for each vertex.
Disable vertex blending; apply only the world matrix set by the D3DTS_WORLDMATRIX macro, where the index value for the transformation state is 0.
Enable vertex blending between the two matrices set by the D3DTS_WORLDMATRIX macro, where the index value for the transformation states are 0 and 1.
Enable vertex blending between the three matrices set by the D3DTS_WORLDMATRIX macro, where the index value for the transformation states are 0, 1, and 2.
Enable vertex blending between the four matrices set by the D3DTS_WORLDMATRIX macro, where the index value for the transformation states are 0, 1, 2, and 3.
Vertex blending is done by using the value assigned to
Use a single matrix with a weight of 1.0.
Flexible Vertex Format Constants, or FVF codes, are used to describe the contents of vertices interleaved in a single data stream that will be processed by the fixed-function pipeline.
This constant is the maximum number of vertex declarators for a mesh.
MAXD3DDECLLENGTH is defined as a maximum of 64 (see d3d9types.h). This does not include the "end" marker vertex element.
The maximum number of elements in the vertex declaration. The additional (+1) is for D3DDECL_END.
A combination of one or more flags that control the device create behavior.
Vertex shader caps constants. These constants are used by the VS20Caps member of
Vertex texture sampler constants.
These constants identify the texture samplers used by vertex shaders.
Specifies the type of I/O bus used by the graphics adapter.
As many as three flags can be set. Flags in the range 0x00 through 0x04 (D3DBUSTYPE_Xxx) provide the basic bus type. Flags in the range 0x10000 through 0x50000 (D3DBUSIMPL_MODIFIER_Xxx) modify the basic description. The driver sets one bus-type flag, and can set zero or one modifier flag. If the driver sets a modifier flag, it also sets the
Indicates a type of bus other than the types listed here.
PCI bus.
PCI-X bus.
PCI Express bus.
Accelerated Graphics Port (AGP) bus.
The implementation for the graphics adapter is in a motherboard chipset's north bridge. This flag implies that data never goes over an expansion bus (such as PCI or AGP) when it is transferred from main memory to the graphics adapter.
Indicates that the graphics adapter is connected to a motherboard chipset's north bridge by tracks on the motherboard and all of the graphics adapter's chips are soldered to the motherboard. This flag implies that data never goes over an expansion bus (such as PCI or AGP) when it is transferred from main memory to the graphics adapter.
The graphics adapter is connected to a motherboard chipset's north bridge by tracks on the motherboard, and all of the graphics adapter's chips are connected through sockets to the motherboard.
The graphics adapter is connected to the motherboard through a daughterboard connector.
The graphics adapter is connected to the motherboard through a daughterboard connector, and the graphics adapter is inside an enclosure that is not user accessible.
One of the D3DBUSIMPL_MODIFIER_MODIFIER_Xxx flags is set.
Options for welding together vertices.
Weld together all vertices that are at the same location. Using this flag avoids an epsilon comparison between vertex components.
If a given vertex component is within epsilon, modify partially matched vertices so that both components are identical. If all components are equal, remove one of the vertices.
Instructs the weld to allow only modifications to vertices and not removal. This flag is valid only if
Instructs the weld not to split vertices that are in separate attribute groups. When the
Creates an
The
The
Pass the
Note??Direct3DCreate9Ex is supported only in Windows Vista, Windows Server 2008, and Windows 7. Earlier versions of the D3D9.dll library do not include Direct3D9Ex and Direct3DCreate9Ex.
Create an
The value of this parameter should be
If successful, this function returns a reference to an
The Direct3D object is the first Direct3D COM object that your graphical application needs to create and the last object that your application needs to release. Functions for enumerating and retrieving capabilities of a device are accessible through the Direct3D object. This enables applications to select devices without creating them.
Create an
LPDIRECT3D9 g_pD3D =null ; if(null == (g_pD3D = Direct3DCreate9())) return E_FAIL;
The
For an example, see Creating a Device (Direct3D 9).
Marks the beginning of a section of event code.
A
Returns the number of previous calls to BeginEvent that have not yet been finalized by calls to the ID3DUserDefinedAnnotation::EndEvent method.
The return value is ?1 if the calling application is not running under a Direct3D profiling tool.
You call the EndEvent method to mark the end of the section of event code.
A user can visualize the event when the calling application is running under an enabled Direct3D profiling tool such as Microsoft Visual Studio Ultimate?2012.
BeginEvent has no effect if the calling application is not running under an enabled Direct3D profiling tool.
Adds a child frame to a frame.
Pointer to the parent node.
Pointer to the child node.
If the function succeeds, the return value is
Loads the first frame hierarchy from a .x file.
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Combination of one or more flags from the D3DXMESH enumeration that specify creation options for the mesh.
Pointer to an
Pointer to an
Application provided interface that allows loading of user data. See
Returns a reference to the loaded frame hierarchy. See
Returns a reference to the animation controller corresponding to animation in the .x file. This is created with default tracks and events. See
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
All the meshes in the file will be collapsed into one output mesh. If the file contains a frame hierarchy, all the transformations will be applied to the mesh.
During the load, CreateFrame and LoadFrameChildData are called back on each frame to control loading and allocation of the frame. The application defines these methods to control how frames are stored. CreateMeshContainer and LoadMeshChildData are called back on each mesh object to control loading and allocation of mesh objects. LoadTopLevelData is called back for each top level object that doesn't get loaded by the other methods.
To free this data, call ID3DXAnimationController::Release to free the animation sets, and D3DXFRAMEDestroy, passing in the root node of the frame hierarchy and an object of your derived
Given a frame hierarchy, registers all the named matrices in the animation mixer.
The top level node in the frame hierarchy.
Pointer to the animation controller object.
If the function succeeds, the return value is
Loads the first frame hierarchy from a .x file.
Pointer to a buffer that contains the mesh hierarchy.
Size of the pMemory buffer, in bytes.
Combination of one or more flags from the D3DXMESH enumeration that specify creation options for the mesh.
Pointer to an
Pointer to an
Application provided interface that allows loading of user data. See
Returns a reference to the loaded frame hierarchy. See
Returns a reference to the animation controller corresponding to animation in the .x file. This is created with default tracks and events. See
If the function succeeds, the return value is
All the meshes in the file will be collapsed into one output mesh. If the file contains a frame hierarchy, all the transformations will be applied to the mesh.
Creates a
If the function succeeds, the return value is
Creates a .x file and saves the mesh hierarchy and corresponding animations in it.
Pointer to a string that specifies the name of the .x file identifying the saved mesh. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Format of the .x file (text or binary, compressed or not). See
Root node of the hierarchy to be saved. See
Animation controller that has animation sets to be stored. See
Application-provided interface that allows saving of user data. See
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function does not save compressed animation sets.
Computes the bounding sphere of all the meshes in the frame hierarchy.
Pointer to the root node.
Returns the center of the bounding sphere.
Returns the radius of the bounding sphere.
If the function succeeds, the return value is
Creates an animation controller object.
Maximum number of animation outputs the controller can support.
Maximum number of animation sets that can be mixed.
Maximum number of animation sets that can be mixed simultaneously.
Maximum number of outstanding events that the controller will support.
Pointer to the animation controller object created. See
If the function succeeds, the return value is
An animation controller controls an animation mixer. The controller adds methods to modify blending parameters over time to enable smooth transitions.
Finds the child frame of a root frame.
Pointer to the root frame. See
Name of the child frame to find.
Returns the child frame if it is found, or
Creates a
If the function succeeds, the return value is
Destroys the subtree of frames under the root, including the root.
Pointer to the root node.
Allocation interface used to deallocate nodes of the frame hierarchy.
If the function succeeds, the return value is
Counts number of frames in a subtree that have non-null names.
Pointer to the root node of the subtree.
Returns the frame count.
Creates a render environment map.
Pointer to an
Size of the render surface.
The number of mipmap levels.
Member of the
If TRUE, the render surface supports a depth-stencil surface. Otherwise, this member is set to
If DepthStencil is set to TRUE, this parameter is a member of the
Address of a reference to an
If the function succeeds, the return value is
Returns the driver level.
Pointer to an
The driver level. See remarks.
This method returns the driver version, which is one of the following:
Creates a font object for a device and font.
Pointer to an
The height of the characters in logical units.
The width of the characters in logical units.
Typeface weight. One example is bold.
The number of mipmap levels.
True for italic font, false otherwise.
The character set of the font.
Specifies how Windows should attempt to match the desired font sizes and characteristics with actual fonts. Use OUT_TT_ONLY_PRECIS for instance, to ensure that you always get a TrueType font.
Specifies how Windows should match the desired font with a real font. It applies to raster fonts only and should not affect TrueType fonts.
Pitch and family index.
String containing the typeface name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Returns a reference to an
If the function succeeds, the return value is
The creation of an
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
If you want more information about font parameters, see The Logical Font.
Creates a render surface.
Pointer to an
Width of the render surface, in pixels.
Height of the render surface, in pixels.
Member of the
If TRUE, the render surface supports a depth-stencil surface. Otherwise, this member is set to
If DepthStencil is set to TRUE, this parameter is a member of the
Address of a reference to an
If the function succeeds, the return value is
Creates a sprite object which is associated with a particular device. Sprite objects are used to draw 2D images to the screen.
Pointer to an
Address of a reference to an
If the function succeeds, the return value is
This interface can be used to draw two dimensional images in screen space of the associated device.
Creates a font object indirectly for both a device and a font.
Pointer to an
Pointer to a
Returns a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Uses a left-handed coordinate system to create a line.
Pointer to an
Pointer to an
If the function succeeds, the return value is
This function creates a mesh with the
Turns on or off all D3DX debug output.
If TRUE, debugger output is halted; if
Returns the previous value of Mute.
Verify that the version of D3DX you compiled with is the version that you are running.
Use
Use
Returns TRUE if the version of D3DX you compiled against is the version you are running with; otherwise,
Use this function during the initialization of your application like this:
CD3DXMyApplication::Initialize( hInstance, LPCSTR szWindowName, LPCSTR szClassName, UINT uWidth, UINT uHeight) { hr; if (! ( , )) return E_FAIL; ... }
Use Direct3DCreate9 to verify that the correct runtime is installed.
Create an effect from an ASCII or binary effect description.
Pointer to the device that will create the effect. See
Pointer to a buffer containing an effect description.
Length of the effect data, in bytes.
An optional
Optional interface reference,
If pSrcData contains a text effect, flags can be a combination of
Pointer to a
Returns a reference to an
Returns a buffer containing a listing of compile errors.
If the function succeeds, the return value is
Disassemble an effect.
Pointer to an
Enable color coding to make the disassembly easier to read.
Returns a buffer containing the disassembled shader. See
If the function succeeds, the return value is
Create an effect from an ASCII or binary effect description. This is an extended version of
If the function succeeds, the return value is
This function is an extended version of
This function checks each constant in pSkipConstants to see that:
If a constant is named in the string that is not present in the effect, it is ignored.
If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the LPCTSTR data type resolves to LPCSTR.
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Create an effect from an ASCII or binary effect description.
Pointer to the device.
Handle to a module containing the effect description. If this parameter is
Pointer to the resource. This parameter supports both Unicode and ANSI strings. See Remarks.
An optional
Optional interface reference,
If hSrcModule contains a text effect, flags can be a combination of
Pointer to a
Returns a buffer containing the compiled effect.
Returns a buffer containing a listing of compile errors.
If the function succeeds, the return value is
If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the LPCTSTR data type resolves to LPCSTR.
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Creates an effect compiler from an ASCII effect description.
Pointer to a buffer containing an effect description.
Length, in bytes, of the effect data.
An optional
Optional interface reference,
Compile options identified by various flags (see
Address of a reference to an
Address of a reference to an
If the function succeeds, the return value is
Create an effect from an ASCII or binary effect description. This function is an extended version of
If the function succeeds, the return value is
This function is an extended version of
This function checks each constant in pSkipConstants to see that:
If a constant is named in the string that is not present in the effect, it is ignored.
If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the LPCTSTR data type resolves to LPCSTR.
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Creates an effect compiler from an ASCII effect description.
Pointer to the filename. This parameter supports both Unicode and ANSI strings. See Remarks.
An optional
Optional interface reference,
Compile options identified by various flags (see
Address of a reference to an
Address of a reference to an
If the function succeeds, the return value is
If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the LPCTSTR data type resolves to LPCSTR.
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Creates an
If the function succeeds, the return value is
If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the LPCTSTR data type resolves to LPCSTR.
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Create an effect from an ASCII or binary effect description.
Pointer to the device that will create the effect. See
Pointer to the filename. This parameter supports both Unicode and ANSI strings. See Remarks.
Optional
Optional interface reference,
If pSrcFile contains a text effect, flags can be a combination of
Pointer to a
Returns a reference to a buffer containing the compiled effect. See
Returns a reference to a buffer containing a listing of compile errors. See
If the function succeeds, the return value is
If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the LPCTSTR data type resolves to LPCSTR.
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Create an effect pool. A pool is used to share parameters between effects.
Returns a reference to the created pool.
If the method succeeds, the return value is
If the arguments are invalid, the method will return
If the method fails, the return value will be E_FAIL.
For effects within a pool, shared parameters with the same name share values.
Creates an effect from an ASCII or binary effect description. This function is an extended version of
If the function succeeds, the return value is
This function is an extended version of
This function checks each constant in pSkipConstants to see that:
If a constant is named in the string that is not present in the effect, it is ignored.
Saves a mesh to a .x file.
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Pointer to an
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh. This parameter may be
Pointer to an array of
Pointer to an array of effect instances, one per attribute group in the mesh. This parameter may be
Number of
A combination of file format and save options when saving an .x file. See D3DX X File Constants.
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
The default file format is binary; however, if a file is specified as both a binary and a text file, it will be saved as a text file. Regardless of the file format, you may also use the compressed format to reduce the file size.
The following is a typical code example of how to use this function.
* m_pMesh; // Mesh object to be saved to a .x file * m_pMaterials; // Array of material structs in the mesh DWORD m_dwNumMaterials; // Number of material structs in the mesh DWORD dwFormat = ; // Binary-format .x file (default) // DWORD dwFormat = ; // Text-format .x file // Load mesh into m_pMesh and determine values of m_pMaterials and // m_dwNumMaterials with calls to D3DXLoadMeshxxx or other D3DX functions // ... ( L"outputxfilename.x", m_pMesh, null , m_pMaterials,null , m_dwNumMaterials, dwFormat );
Creates an N-patch mesh from a triangle mesh.
Address of a reference to an
Address of a reference to an
If the function succeeds, the return value is
Returns a declarator from a flexible vertex format (FVF) code.
Combination of
An array of
If the function succeeds, the return value is
Compute tangent, binormal, and normal vectors for a mesh.
Pointer to an input
Combination of one or more
Use
If the function succeeds, the return value is
This function simply calls
(pMesh, , 0, , 0, , 0, , 0, dwOptions | , null , 0.01f, 0.25f, 0.01f,null ,null );
Singularities are handled as required by grouping edges and splitting vertices. If any vertices need to be split, the function will fail. The computed normal vector at each vertex is always normalized to have unit length.
The most robust solution for computing orthogonal Cartesian coordinates is to not set flags
Generates an optimized face remapping for a triangle list.
Pointer to triangle list indices to use for ordering vertices.
Number of faces in the triangle list. For 16-bit meshes, this is limited to 2^16 - 1 (65535) or fewer faces.
Number of vertices referenced by the triangle list.
Flag indicating index type: TRUE if indices are 32-bit (more than 65535 indices),
Pointer to the original mesh face that was split to generate the current face.
If the function succeeds, the return value is
This function's optimization procedure is functionally equivalent to calling
Welds together replicated vertices that have equal attributes. This method uses specified epsilon values for equality comparisons.
Pointer to an
Combination of one or more flags from D3DXWELDEPSILONSFLAGS.
Pointer to a D3DXWeldEpsilons structure, specifying the epsilon values to be used for this method. Use
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the source mesh. If the edge has no adjacent faces, the value is 0xffffffff. If this parameter is set to
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the optimized mesh. If the edge has no adjacent faces, the value is 0xffffffff.
An array of DWORDs, one per face, that identifies the original mesh face that corresponds to each face in the welded mesh.
Address of a reference to an
If the function succeeds, the return value is
This function uses supplied adjacency information to determine the points that are replicated. Vertices are merged based on an epsilon comparison. Vertices with equal position must already have been calculated and represented by point-representative data.
This function combines logically-welded vertices that have similar components, such as normals or texture coordinates within pEpsilons.
The following example code calls this function with welding enabled. Vertices are compared using epsilon values for normal vector and vertex position. A reference is returned to a face remapping array (pFaceRemap).
TCHAR strMediaPath[512]; // X-file path LPD3DXBUFFER pAdjacencyBuffer =null ; // adjacency data buffer LPD3DXBUFFER pD3DXMtrlBuffer =null ; // material buffer LPD3DXMESH pMesh =null ; // mesh object DWORD m_dwNumMaterials; // number of materialsEpsilons; // structure with epsilon values DWORD *pFaceRemap[65536]; // face remapping array DWORD i; // internal variable // Load the mesh from the specified file hr = ( strMediaPath, , m_pd3dDevice, &pAdjacencyBuffer, &pD3DXMtrlBuffer, null , &m_dwNumMaterials, &pMesh ) ) if( FAILED( hr ) ) goto End; // Go to error handling // Set epsilon values Epsilons.Normal = 0.001; Epsilons.Position = 0.1; // Weld the vertices for( i=0; i < 65536; i++ ) { pFaceRemap[i] = 0; } hr =( pMesh, , &Epsilons, (DWORD*)pAdjacencyBuffer->GetBufferPointer(), (DWORD*)pAdjacencyBuffer->GetBufferPointer(), (DWORD*)pFaceRemap, null ) if( FAILED( hr ) ) goto End; // Go to error handling
Generates an output vertex declaration from the input declaration. The output declaration is intended for use by the mesh tessellation functions.
Pointer to the output vertex declaration. See
Pointer to the input vertex declaration. See
If the function succeeds, the return value is
Creates a buffer object.
Size of the buffer to create, in bytes.
Address of a reference to an
If the function succeeds, the return value is
Loads a patch mesh from an
If the function succeeds, the return value is
For mesh files that do not contain effect instance information, default effect instances will be generated from the material information in the .x file. A default effect instance will have default values that correspond to the members of the
The default texture name is also filled in, but is handled differently. The name will be Texture0@Name, which corresponds to an effect variable by the name of "Texture0" with an annotation called "Name." This will contain the string file name for the texture.
Tessellates the given mesh using the N-patch tessellation scheme.
Pointer to an
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the source mesh. This parameter may be
Number of segments per edge to tessellate.
Set to TRUE to use quadratic interpolation for normals; set to
Address of a reference to an
Address of a reference to an
If the function succeeds, the return value is
This function tessellates by using the N-patch algorithm.
Calculates per-triangle IMT's from a custom application-specified signal that varies over the surface of the mesh (generally at a higher frequency than vertex data). The signal is evaluated via a user-specified callback function.
A reference to an input mesh (see
Zero-based texture coordinate index that identifies which set of texture coordinates to use.
The number of components in each data point in the signal.
The maximum distance between vertices; the algorithm continues subdividing until the distance between all vertices is less than or equal to fMaxUVDistance.
Texture wrap options. This is a combination of one or more
A reference to a user-provided evaluator function, which will be used to compute the signal value at arbitrary U,V coordinates. The function follows the prototype of LPD3DXIMTSIGNALCALLBACK.
A reference to a user-defined value which is passed to the signal callback function. Typically used by an application to pass a reference to a data structure that provides context information for the callback function.
A reference to a callback function to monitor IMT computation progress.
A reference to a user-defined variable which is passed to the status callback function. Typically used by an application to pass a reference to a data structure that provides context information for the callback function.
A reference to the buffer (see
If the function succeeds, the return value is
This function requires that the input mesh contain a signal-to-mesh texture mapping (ie. texture coordinates). It allows the user to define a signal arbitrarily over the surface of the mesh.
Validates a patch mesh, returning the number of degenerate vertices and patches.
Pointer to an
Returns the number of degenerate vertices in the patch mesh.
Returns the number of degenerate patches in the patch mesh.
Returns a reference to a buffer containing a string of errors and warnings that explain the problems found in the patch mesh.
If the function succeeds, the return value is
This method validates the mesh by checking for invalid indices. Error information is available from the debugger output.
Validates a mesh.
Pointer to an
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh to be tested.
Returns a buffer containing a string of errors and warnings, which explain the problems found in the mesh.
If the function succeeds, the return value is
This method validates the mesh by checking for invalid indices. Error information is available from the debugger output.
Splits a mesh into meshes smaller than the specified size.
Pointer to an
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh to be simplified.
Maximum number of vertices in the resulting mesh.
Option flags for the new meshes.
Number of meshes returned.
Buffer containing an array of
Buffer containing an array of adjacency arrays (DWORDs) for the new meshes. See
Buffer containing an array of face remap arrays (DWORDs) for the new meshes. See
Buffer containing an array of vertex remap arrays for the new meshes. See
If the function succeeds, the return value is
A common use of this function is to split a mesh with 32-bit indices (more than 65535 vertices) into more than one mesh, each of which has 16-bit indices.
The adjacency, vertex remap and face remap arrays are arrays are DWORDs where each array contains n DWORD references, followed by the DWORD data referenced by the references. For example, to obtain the face remap information for face 3 in mesh 2, the following code could be used, assuming the face remap data was returned in a variable named ppFaceRemapArrayOut.
const DWORD **face_remaps = static_cast<DWORD **>(ppFaceRemapArrayOut->GetBufferPointer()); const DWORD remap = face_remaps[2][3];
Computes the tangent vectors for the texture coordinates given in the texture stage. Provided to support legacy applications. Use
If the function succeeds, the return value is
If the mesh vertex declaration specifies tangent or binormal fields,
This function simply calls
( Mesh, , TexStageIndex, ( BinormIndex == D3DX_DEFAULT ) ? D3DX_DEFAULT : , // provides backward function compatibility BinormIndex, ( TangentIndex == D3DX_DEFAULT ) ? D3DX_DEFAULT : , TangentIndex, D3DX_DEFAULT, // do not store normals 0, ( Wrap ? : 0 ) | | , pAdjacency, -1.01f, -0.01f, -1.01f, null ,null );
Determines if a ray intersects with a mesh.
Pointer to an
Pointer to a
Pointer to a
Pointer to a
Pointer to an index value of the face closest to the ray origin, if pHit is TRUE.
Pointer to a barycentric hit coordinate, U.
Pointer to a barycentric hit coordinate, V.
Pointer to a ray intersection parameter distance.
Pointer to an
Pointer to a DWORD that contains the number of entries in the ppAllHits array.
If the function succeeds, the return value is
The
Any point in the plane V1V2V3 can be represented by the barycentric coordinate (U,V). The parameter U controls how much V2 gets weighted into the result, and the parameter V controls how much V3 gets weighted into the result. Lastly, the value of [1 - (U + V)] controls how much V1 gets weighted into the result.
Barycentric coordinates are a form of general coordinates. In this context, using barycentric coordinates represents a change in coordinate systems. What holds true for Cartesian coordinates holds true for barycentric coordinates.
Barycentric coordinates define a point inside a triangle in terms of the triangle's vertices. For a more in-depth description of barycentric coordinates, see Mathworld's Barycentric Coordinates Description.
Pack mesh partitioning data into an atlas.
Pointer to an input mesh (see
Texture width.
Texture height.
The minimum distance, in texels, between two charts on the atlas. The gutter is always scaled by the width; so, if a gutter of 2.5 is used on a 512x512 texture, then the minimum distance between two charts is 2.5 / 512.0 texels.
Zero-based texture coordinate index that identifies which set of texture coordinates to use.
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh. It should be derived from the ppPartitionResultAdjacency returned from
A reference to a callback function (see LPD3DXUVATLASCB) that is useful for monitoring progress.
Specify how often D3DX will call the callback; a reasonable default value is 0.0001f.
A void reference to be passed back to the callback function.
This options parameter is currently reserved.
A reference to an
If the function succeeds, the return value is
Loads a skin mesh from a DirectX .x file data object.
Pointer to an
Combination of one or more flags, from the D3DXMESH enumeration, specifying creation options for the mesh.
Pointer to an
Address of a reference to an
Address of a reference to an
Pointer to a buffer containing an array of effect instances, one per attribute group in the returned mesh. An effect instance is a particular instance of state information used to initialize an effect. See
Pointer to the number of
Address of a reference to an
Address of a reference to an
If the function succeeds, the return value is
This method takes a reference to an internal object in the .x file, enabling you to load the frame hierarchy.
For mesh files that do not contain effect instance information, default effect instances will be generated from the material information in the .x file. A default effect instance will have default values that correspond to the members of the
The default texture name is also filled in, but is handled differently. The name will be Texture0@Name, which corresponds to an effect variable by the name of "Texture0" with an annotation called "Name." This will contain the string file name for the texture.
Creates a mesh object using a declarator.
Number of faces for the mesh. The valid range for this number is greater than 0, and one less than the maximum DWORD (typically 65534), because the last index is reserved.
Number of vertices for the mesh. This parameter must be greater than 0.
Combination of one or more flags from the D3DXMESH enumeration, specifying options for the mesh.
Array of
Pointer to an
Address of a reference to an
If the function succeeds, the return value is
Creates an empty skin mesh object using a flexible vertex format (FVF) code.
Number of vertices for the skin mesh.
Combination of
Number of bones for the skin mesh.
Address of a reference to an
If the function succeeds, the return value is
Use SetBoneInfluence to populate the empty skin mesh object returned by this method.
Intersects the specified ray with the given mesh subset. This provides similar functionality to
If the function succeeds, the return value is
The
Any point in the plane V1V2V3 can be represented by the barycentric coordinate (U,V). The parameter U controls how much V2 gets weighted into the result and the parameter V controls how much V3 gets weighted into the result. Lastly, the value of [1 - (U + V)] controls how much V1 gets weighted into the result.
Barycentric coordinates are a form of general coordinates. In this context, using barycentric coordinates represents a change in coordinate systems. What holds true for Cartesian coordinates holds true for barycentric coordinates.
Barycentric coordinates define a point inside a triangle in terms of the triangle's vertices. For a more in-depth description of barycentric coordinates, see Mathworld's Barycentric Coordinates Description.
Returns the size of a vertex for a flexible vertex format (FVF).
FVF to be queried. A combination of
The FVF vertex size, in bytes.
Returns the number of elements in the vertex declaration.
A reference to the vertex declaration. See
The number of elements in the vertex declaration.
Cleans a mesh, preparing it for simplification.
Vertex operations to perform in preparation for mesh cleaning. See
Pointer to an
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh to be cleaned.
Address of a reference to an
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the output mesh.
Returns a buffer containing a string of errors and warnings, which explain the problems found in the mesh.
If the function succeeds, the return value is
This function cleans a mesh using the cleaning method and options specified in the CleanType parameter. See the
Computes the intersection of a ray and a triangle.
Pointer to a
Pointer to a
Pointer to a
Pointer to a
Pointer to a
Barycentric hit coordinates, U.
Barycentric hit coordinates, V.
Ray-intersection parameter distance.
Returns TRUE if the ray intersects the area of the triangle. Otherwise, returns
Any point in the plane V1V2V3 can be represented by the barycentric coordinate (U,V). The parameter U controls how much V2 gets weighted into the result, and the parameter V controls how much V3 gets weighted into the result. Lastly, the value of [1 - (U + V)] controls how much V1 gets weighted into the result.
Barycentric coordinates are a form of general coordinates. In this context, using barycentric coordinates represents a change in coordinate systems. What holds true for Cartesian coordinates holds true for barycentric coordinates.
Barycentric coordinates define a point inside a triangle in terms of the triangle's vertices. For a more in-depth description of barycentric coordinates, see Mathworld's Barycentric Coordinates Description.
Converts the specified mesh subset into a single triangle strip.
Pointer to an
Attribute ID of the mesh subset to convert to strips.
Combination of one or more flags from the D3DXMESH enumeration, specifying options for creating the index buffer. Cannot be
Pointer to an
Number of indices in the buffer returned in the ppIndexBuffer parameter.
If the function succeeds, the return value is
Before running this function, call Optimize or
Creates an empty skin mesh object using a declarator.
Number of vertices for the skin mesh.
Array of
Number of bones for the skin mesh.
Address of a reference to an
If the function succeeds, the return value is
Use SetBoneInfluence to populate the empty skin mesh object returned by this method.
Returns the size of a vertex from the vertex declaration.
A reference to the vertex declaration. See
The zero-based stream index.
The vertex declaration size, in bytes.
Tessellates a rectangular higher-order surface patch into a triangle mesh.
Vertex buffer containing the patch data.
Pointer to an array of four floating-point values that identify the number of segments into which each edge of the rectangle patch should be divided when tessellated. See
Vertex declaration structure that defines the vertex data. See
Describes a rectangular patch. See
Pointer to the created mesh. See
If the function succeeds, the return value is
Use
Returns a flexible vertex format (FVF) code from a declarator.
Array of
Pointer to a DWORD value, representing the returned combination of
This function will fail for any declarator that does not map directly to an FVF.
Computes a coordinate-axis oriented bounding box.
Pointer to the first position.
Number of vertices.
Count or number of bytes between vertices.
Pointer to a
Pointer to a
If the function succeeds, the return value is
Creates a skin mesh from another mesh.
Pointer to an
The length of the array attached to the BoneId. See
Pointer to an array of bone combinations. See
Address of a reference to an
If the function succeeds, the return value is
Performs tangent frame computations on a mesh. Tangent, binormal, and optionally normal vectors are generated. Singularities are handled as required by grouping edges and splitting vertices.
Pointer to an input
Specifies the texture coordinate input semantic. If D3DX_DEFAULT, the function assumes that there are no texture coordinates, and the function will fail unless normal vector calculation is specified.
If a mesh has multiple texture coordinates, specifies the texture coordinate to use for the tangent frame computations. If zero, the mesh has only a single texture coordinate.
Specifies the output semantic for the type, typically
Specifies the semantic index at which to store the partial derivative with respect to the U texture coordinate.
Specifies the
Specifies the semantic index at which to store the partial derivative with respect to the V texture coordinate.
Specifies the output normal semantic, typically
Specifies the semantic index at which to store the normal vector at each vertex.
Combination of one or more
Description | |
---|---|
Weight the normal vector length by the angle, in radians, subtended by the two edges leaving the vertex. | & !( |
Compute orthogonal Cartesian coordinates from texture coordinates (u, v). See Remarks. | & !( |
Textures are not wrapped in either u or v directions | & !( |
Partial derivatives with respect to texture coordinates are normalized. | & !( |
Vertices are ordered in a counterclockwise direction around each triangle. | & !( |
Use per-vertex normal vectors already present in the input mesh. | & !( |
?
If
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh. The number of bytes in this array must be at least 3 * GetNumFaces * sizeof(DWORD).
Specifies the maximum cosine of the angle at which two partial derivatives are deemed to be incompatible with each other. If the dot product of the direction of the two partial derivatives in adjacent triangles is less than or equal to this threshold, then the vertices shared between these triangles will be split.
Specifies the maximum magnitude of a partial derivative at which a vertex will be deemed singular. As multiple triangles are incident on a point that have nearby tangent frames, but altogether cancel each other out (such as at the top of a sphere), the magnitude of the partial derivative will decrease. If the magnitude is less than or equal to this threshold, then the vertex will be split for every triangle that contains it.
Similar to fPartialEdgeThreshold, specifies the maximum cosine of the angle between two normals that is a threshold beyond which vertices shared between triangles will be split. If the dot product of the two normals is less than the threshold, the shared vertices will be split, forming a hard edge between neighboring triangles. If the dot product is more than the threshold, neighboring triangles will have their normals interpolated.
Address of a reference to an output
Address of a reference to an output
If the function succeeds, the return value is
A simplified version of this function is available as
The computed normal vector at each vertex is always normalized to have unit length.
The most robust solution for computing orthogonal Cartesian coordinates is to not set flags
Determines if a ray intersects the volume of a sphere's bounding box.
Pointer to a
Radius of the sphere.
Pointer to a
Pointer to a
Returns TRUE if the ray intersects the volume of the sphere's bounding box. Otherwise, returns
Create a UV atlas for a mesh.
Pointer to an input mesh (see
The maximum number of charts to partition the mesh into. See remarks about the partitioning modes. Use 0 to tell D3DX that the atlas should be parameterized based on stretch.
The amount of stretching allowed. 0 means no stretching is allowed, 1 means any amount of stretching can be used.
Texture width.
Texture height.
The minimum distance, in texels, between two charts on the atlas. The gutter is always scaled by the width; so, if a gutter of 2.5 is used on a 512x512 texture, then the minimum distance between two charts is 2.5 / 512.0 texels.
Zero-based texture coordinate index that identifies which set of texture coordinates to use.
A reference to an array of adjacency data. with 3 DWORDs per face, indicating which triangles are adjacent to each other (see
An array with 3 DWORDS per face. Each face indicates if an edge is false or not. A non-false edge is indicated by -1, a false edge is indicated by any other value. This enables the parameterization of a mesh of quads where the edges down the middle of each quad will not be cut.
A reference to an array of integrated metric tensors that describes how to stretch a triangle (see IntegratedMetricTensor).
A reference to a callback function (see LPD3DXUVATLASCB) that is useful for monitoring progress.
Specify how often D3DX will call the callback; a reasonable default value is 0.0001f.
Pointer to a user-defined value which is passed to the callback function; typically used by an application to pass a reference to a data structure that provides context information for the callback function.
Specify the quality of the charts generated. See D3DXUVATLAS.
Pointer to the created mesh with the atlas (see
A reference to an array of the final face-partitioning data. Each element contains one DWORD per face (see
A reference to an array of remapped vertices. Each array element identifies the original vertex that each final vertex came from (if the vertex was split during remapping). Each array element contains one DWORD per vertex.
A reference to the maximum stretch value generated by the atlas algorithm. The range is between 0.0 and 1.0.
A reference to the number of charts created by the atlas algorithm. If dwMaxChartNumber is too low, this parameter will return the minimum number of charts required to create an atlas.
If the function succeeds, the return value is
Create a UV atlas for a mesh.
Pointer to an input mesh (see
The maximum number of charts to partition the mesh into. See remarks about the partitioning modes. Use 0 to tell D3DX that the atlas should be parameterized based on stretch.
The amount of stretching allowed. 0 means no stretching is allowed, 1 means any amount of stretching can be used.
Zero-based texture coordinate index that identifies which set of texture coordinates to use.
A reference to an array of adjacency data with 3 DWORDs per face, indicating which triangles are adjacent to each other (see
An array with 3 DWORDS per face. Each face indicates if an edge is false or not. A non-false edge is indicated by -1, a false edge is indicated by any other value. This enables the parameterization of a mesh of quads where the edges down the middle of each quad will not be cut.
A reference to an array of integrated metric tensors that describes how to stretch a triangle (see IntegratedMetricTensor).
A reference to a callback function (see LPD3DXUVATLASCB) that is useful for monitoring progress.
Specify how often D3DX will call the callback; a reasonable default value is 0.0001f.
Pointer to a user-defined value that is passed to the callback function; typically used by an application to pass a reference to a data structure that provides context information for the callback function.
Specify the quality of the charts generated by combining one or more D3DXUVATLAS flags.
Pointer to the created mesh with the atlas (see
A reference to an array of the final face-partitioning data. Each element contains one DWORD per face (see
A reference to an array of remapped vertices. Each array element identifies the original vertex each final vertex came from (if the vertex was split during remapping). Each array element contains one DWORD per vertex.
Address of a reference to an
A reference to the maximum stretch value generated by the atlas algorithm. The range is between 0.0 and 1.0.
A reference to the number of charts created by the atlas algorithm. If dwMaxChartNumber is too low, this parameter will return the minimum number of charts required to create an atlas.
If the function succeeds, the return value is
Calculates per-triangle IMT's from a texture mapped onto a mesh, to be used optionally as input to the D3DX UVAtlas Functions.
If the function succeeds, the return value is
Given a texture that maps over the surface of the mesh, the algorithm computes the IMT for each face. This will cause triangles containing lower-frequency signal data to take up less space in the final texture atlas when parameterized with the UVAtlas functions. The texture is assumed to be interpolated over the mesh bilinearly.
Concatenates a group of meshes into one common mesh. This method can optionally apply a matrix transformation to each input mesh and its texture coordinates.
Array of input mesh references (see
Number of input meshes to concatenate.
Mesh creation options; this is a combination of one or more D3DXMESH flags. The mesh creation options are equivalent to the options parameter required by
Optional array of geometry transforms. The number of elements in the array is NumMeshes; each element is a transformation matrix (see
Optional array of texture transforms. The number of elements in the array is NumMeshes; each element is a transformation matrix (see
Optional reference to a vertex declaration (see
Pointer to a
Address of a reference to the mesh created (see
If the function succeeds, the return value is
If no vertex declaration is given as part of the Options mesh creation parameter, the method will generate a union of all of the vertex declarations of the submeshes, promoting channels and types if necessary. The method will create an attribute table from attribute tables of the input meshes. To ensure creation of an attribute table, call Optimize with Flags set to
Determines whether a ray intersects the volume of a box's bounding box.
Pointer to a
Pointer to a
Pointer to a
Pointer to a
Returns TRUE if the ray intersects the volume of the box's bounding box. Otherwise, returns
The values passed to
xmax, ymax, zmax xmax, ymax, zmin xmax, ymin, zmax xmax, ymin, zmin xmin, ymax, zmax xmin, ymax, zmin xmin, ymin, zmax xmin, ymin, zmin
The depth of the bounding box in the z direction is zmax - zmin, in the y direction is ymax - ymin, and in the x direction is xmax - xmin. For example, with the following minimum and maximum vectors, min (-1, -1, -1) and max (1, 1, 1), the bounding box is defined in the following manner.
1, 1, 1 1, 1, -1 1, -1, 1 1, -1, -1 -1, 1, 1 -1, 1, -1 -1, -1, 1 -1, -1, -l
Loads a mesh from a resource.
Handle to the module where the resource is located, or
Pointer to a string that specifies the resource to create the mesh from. See remarks.
Pointer to a string that specifies the resource type. See remarks.
Combination of one or more flags from the D3DXMESH enumeration that specify creation options for the mesh.
Pointer to an
Address of a reference to an
Address of a reference to an
Pointer to a buffer containing an array of effect instances, one per attribute group in the returned mesh. An effect instance is a particular instance of state information used to initialize an effect. See
Pointer to the number of
Address of a reference to an
If the function succeeds, the return value is
See FindResource to find out more about the Module, Name and Type parameters.
All the meshes in the file will be collapsed into one output mesh. If the file contains a frame hierarchy, all the transformations will be applied to the mesh.
For mesh files that do not contain effect instance information, default effect instances will be generated from the material information in the .x file. A default effect instance will have default values that correspond to the members of the
The default texture name is also filled in, but is handled differently. The name will be Texture0@Name, which corresponds to an effect variable by the name of "Texture0" with an annotation called "Name." This will contain the string file name for the texture.
Generates a simplified mesh using the provided weights that come as close as possible to the given MinValue.
Pointer to an
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh to be simplified.
Pointer to a
Pointer to an array of vertex weights. If this parameter is set to
Number of vertices or faces, depending on the flag set in the Options parameter, by which to simplify the source mesh.
Specifies simplification options for the mesh. One of the flags in D3DXMESHSIMP can be set.
Address of a reference to an
If the function succeeds, the return value is
This function generates a mesh that has MinValue vertices or faces.
If the simplification process cannot reduce the mesh to MinValue, the call still succeeds because MinValue is a desired minimum, not an absolute minimum.
If pVertexAttributeWeights is set to
AttributeWeights; AttributeWeights.Position = 1.0; AttributeWeights.Boundary = 1.0; AttributeWeights.Normal = 1.0; AttributeWeights.Diffuse = 0.0; AttributeWeights.Specular = 0.0; AttributeWeights.Tex[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
This default structure is what most applications should use because it considers only geometric and normal adjustment. Only in special cases will the other member fields need to be modified.
Creates a mesh object using a flexible vertex format (FVF) code.
Number of faces for the mesh. The valid range for this number is greater than 0, and one less than the max DWORD value, typically 232 - 1, because the last index is reserved.
Number of vertices for the mesh. This parameter must be greater than 0.
Combination of one or more flags from the D3DXMESH enumeration, specifying creation options for the mesh.
Combination of
Pointer to an
Address of a reference to an
If the function succeeds, the return value is
Calculate per-triangle IMT's from from per-vertex data. This function allows you to calculate the IMT based off of any value in a mesh (color, normal, etc).
A reference to an input mesh (see
A reference to an array of per-vertex data from which IMT will be computed. The array size is uSignalStride * v, where v is the number of vertices in the mesh.
The number of floats per vertex.
The number of bytes per vertex in the array. This must be a multiple of sizeof(float)
Texture wrap options. This is a combination of one or more
A reference to a callback function to monitor IMT computation progress.
A reference to a user-defined variable which is passed to the status callback function. Typically used by an application to pass a reference to a data structure that provides context information for the callback function.
A reference to the buffer (see
If the function succeeds, the return value is
Generates an optimized vertex remapping for a triangle list. This function is commonly used after applying the face remapping generated by
If the function succeeds, the return value is
By default, a mesh uses 16 bit indices when it is created unless the application specifies otherwise. To check whether an existing mesh uses 16-bit or 32-bit indices, call
Loads a mesh from a DirectX .x file.
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Combination of one or more flags from the D3DXMESH enumeration, which specifies creation options for the mesh.
Pointer to an
Pointer to a buffer that contains adjacency data. The adjacency data contains an array of three DWORDs per face that specify the three neighbors for each face in the mesh. For more information about accessing the buffer, see
Pointer to a buffer containing materials data. The buffer contains an array of
Pointer to a buffer containing an array of effect instances, one per attribute group in the returned mesh. An effect instance is a particular instance of state information used to initialize an effect. See
Pointer to the number of
Address of a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
All the meshes in the file will be collapsed into one output mesh. If the file contains a frame hierarchy, all the transformations will be applied to the mesh.
For mesh files that do not contain effect instance information, default effect instances will be generated from the material information in the .x file. A default effect instance will have default values that correspond to the members of the
The default texture name is also filled in, but is handled differently. The name will be Texture0@Name, which corresponds to an effect variable by the name of "Texture0" with an annotation called "Name." This will contain the string file name for the texture.
Creates a mesh from a control-patch mesh.
Patch information structure. For more information, see
Number of patches.
Number of control vertices in the patch.
Unused. Reserved for later use.
Array of
Pointer the device that creates the patch mesh. See
Pointer to the
If the function succeeds, the return value is
This method takes an input patch mesh and converts it to a tessellated mesh. Patch meshes use 16-bit index buffers. Therefore, indices to LockIndexBuffer are 16 bits.
Gets the size of the rectangle patch.
Number of segments per edge to tessellate.
Pointer to a DWORD that contains the number of triangles in the patch.
Pointer to a DWORD that contains the number of vertices in the patch.
If the function succeeds, the return value is
Tessellates a triangular higher-order surface patch into a triangle mesh.
Vertex buffer containing the patch data.
Pointer to an array of three floating-point values that identify the number of segments into which each edge of the triangle patch should be divided when tessellated. See
Vertex declaration structure that defines the vertex data. See
Describes a triangle patch. See
Pointer to the created mesh. See
If the function succeeds, the return value is
Use
Computes a bounding sphere for the mesh.
Pointer to first position.
Number of vertices.
Number of bytes between position vectors. Use GetNumBytesPerVertex,
Radius of the returned bounding sphere.
If the function succeeds, the return value is
Loads a mesh from a DirectX .x file.
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Combination of one or more flags from the D3DXMESH enumeration, which specifies creation options for the mesh.
Pointer to an
Pointer to a buffer that contains adjacency data. The adjacency data contains an array of three DWORDs per face that specify the three neighbors for each face in the mesh. For more information about accessing the buffer, see
Pointer to a buffer containing materials data. The buffer contains an array of
Pointer to a buffer containing an array of effect instances, one per attribute group in the returned mesh. An effect instance is a particular instance of state information used to initialize an effect. See
Pointer to the number of
Address of a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
All the meshes in the file will be collapsed into one output mesh. If the file contains a frame hierarchy, all the transformations will be applied to the mesh.
For mesh files that do not contain effect instance information, default effect instances will be generated from the material information in the .x file. A default effect instance will have default values that correspond to the members of the
The default texture name is also filled in, but is handled differently. The name will be Texture0@Name, which corresponds to an effect variable by the name of "Texture0" with an annotation called "Name." This will contain the string file name for the texture.
Loads a mesh from memory.
Pointer to the memory buffer which contains the mesh data.
Size of the file in memory, in bytes.
Combination of one or more flags from the D3DXMESH enumeration, specifying creation options for the mesh.
Pointer to an
Address of a reference to an
Address of a reference to an
Pointer to a buffer containing an array of effect instances, one per attribute group in the returned mesh. An effect instance is a particular instance of state information used to initialize an effect. See
Pointer to the number of
Address of a reference to an
If the function succeeds, the return value is
All the meshes in the file will be collapsed into one output mesh. If the file contains a frame hierarchy, all the transformations will be applied to the mesh.
For mesh files that do not contain effect instance information, default effect instances will be generated from the material information in the .x file. A default effect instance will have default values that correspond to the members of the
The default texture name is also filled in, but is handled differently. The name will be Texture0@Name, which corresponds to an effect variable by the name of "Texture0" with an annotation called "Name." This will contain the string file name for the texture.
Convert the specified mesh subset into a series of strips.
Pointer to an
Attribute ID of the mesh subset to convert to strips.
Combination of one or more flags from the D3DXMESH enumeration, specifying options for creating the index buffer. Cannot be
Pointer to an
Number of indices in the buffer returned in the ppIndexBuffer parameter.
Buffer containing an array of one DWORD per strip, which specifies the number of triangles in the that strip.
Number of individual strips in the index buffer and corresponding strip length array.
If the function succeeds, the return value is
Before running this function, call Optimize or
Calculate per-triangle IMT's from per-texel data. This function is similar to
If the function succeeds, the return value is
Gets the size of the triangle patch.
Number of segments per edge to tessellate.
Pointer to a DWORD that contains the number of triangles in the patch.
Pointer to a DWORD that contains the number of vertices in the triangle patch.
If the function succeeds, the return value is
Computes unit normals for each vertex in a mesh. Provided to support legacy applications. Use
If the function succeeds, the return value is
The input mesh must have the
A normal for a vertex is generated by averaging the normals of all faces that share that vertex.
If adjacency is provided, replicated vertices are ignored and "smoothed" over. If adjacency is not provided, replicated vertices will have normals averaged in from only the faces explicitly referencing them.
This function simply calls
( pMesh, D3DX_DEFAULT, 0, D3DX_DEFAULT, 0, D3DX_DEFAULT, 0, , 0, | , pAdjacency, -1.01f, -0.01f, -1.01f, null ,null );
Disassemble a shader.
Note??Instead of using this legacy function, we recommend that you use the
If the function succeeds, the return value is
Preprocesses a shader without performing compilation. This resolves all #defines and #includes, providing a self-contained shader for subsequent compilation.
Note??Instead of using this legacy function, we recommend that you use the
If the function succeeds, the return value is
Compile a shader file.
Note??Instead of using this legacy function, we recommend that you compile offline by using the Fxc.exe command-line compiler or use the
If the function succeeds, the return value is
E_NOTIMPL is returned if you're using 1.1 shaders (vs_1_1and ps_1_1).
Creates a texture shader object from the compiled shader.
Pointer to the function DWORD stream.
Returns an
If the function succeeds, the return value is
Get the semantics for all shader output elements.
Pointer to the shader function DWORD stream.
Pointer to an array of
Returns the number of elements in pSemantics.
If the function succeeds, the return value is
Gets the semantics for the shader inputs. Use this method to determine the input vertex format.
Pointer to the shader function DWORD stream.
Pointer to an array of
Returns the number of elements in pSemantics.
If the function succeeds, the return value is
Use
Returns the name of the highest high-level shader language (HLSL) profile supported by a given device.
Pointer to the device. See
The HLSL profile name.
If the device does not support pixel shaders then the function returns
A shader profile specifies the assembly shader version to use and the capabilities available to the HLSL compiler when compiling a shader. The following table lists the pixel shader profiles that are supported.
Shader Profile | Description |
---|---|
ps_1_1 | Compile to ps_1_1 version. |
ps_1_2 | Compile to ps_1_2 version. |
ps_1_3 | Compile to ps_1_3 version. |
ps_1_4 | Compile to ps_1_4 version. |
ps_2_0 | Compile to ps_2_0 version. |
ps_2_a | Same as the ps_2_0 profile, with the following additional capabilities available for the compiler to target:
|
ps_2_b | Same as the ps_2_0 profile, with the following additional capabilities available for the compiler to target:
|
ps_3_0 | Compile to ps_3_0 version. |
?
For more information about the differences between shader versions, see Pixel Shader Differences.
Searches through a shader for a particular comment. The comment is identified by a four-character code (FOURCC) in the first DWORD of the comment.
Pointer to the shader function DWORD stream.
FOURCC code that identifies the comment block. See FourCC Formats.
Returns a reference to the comment data (not including the comment token and FOURCC code). This value can be
Returns the size of the comment data in bytes. This value can be
If the function succeeds, the return value is
Assemble a shader.
Handle to a module containing the effect description. If this parameter is
Pointer to a string that specifies the resource name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
An optional
Optional interface reference,
Compile options identified by various flags. The Direct3D 10 HLSL compiler is now the default. See
Returns a buffer containing the created shader. This buffer contains the compiled shader code, as well as any embedded debug and symbol table information.
Returns a buffer containing a listing of errors and warnings that were encountered during the compile. These are the same messages the debugger displays when running in debug mode. This value may be
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Assemble a shader.
Pointer to a memory buffer that contains the shader data.
Length of the effect data, in bytes.
An optional
Optional interface reference,
Compile options identified by various flags. The Direct3D 10 HLSL compiler is now the default. See
Returns a buffer containing the created shader. This buffer contains the compiled shader code, as well as any embedded debug and symbol table information.
Returns a buffer containing a listing of errors and warnings that were encountered during the compile. These are the same messages the debugger displays when running in debug mode. This value may be
If the function succeeds, the return value is
Compile a shader file.
Note??Instead of using this legacy function, we recommend that you compile offline by using the Fxc.exe command-line compiler or use the
If the function succeeds, the return value is
Get the sampler names referenced in a shader.
Pointer to the shader function DWORD stream.
Pointer to an array of LPCSTRs. The function will fill this array with references to the sampler names contained within pFunction. The maximum array size is the maximum number of sampler registers (16 for vs_3_0 and ps_3_0).
To find the number of samplers used, check pCount after calling
Returns the number of samplers referenced by the shader.
If the function succeeds, the return value is
Gets the shader-constant table embedded inside a shader.
Pointer to the function DWORD stream.
Returns the constant table interface (see
A constant table is generated by
Assemble a shader.
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
An optional
Optional interface reference,
Compile options identified by various flags. The Direct3D 10 HLSL compiler is now the default. See
Returns a buffer containing the created shader. This buffer contains the compiled shader code, as well as any embedded debug and symbol table information.
Returns a buffer containing a listing of errors and warnings that were encountered during the compile. These are the same messages the debugger displays when running in debug mode. This value may be
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Gets the shader-constant table embedded inside a shader.
Pointer to the function DWORD stream.
Use the D3DXCONSTTABLE_LARGEADDRESSAWARE flag to access up to 4 GB of virtual address space (instead of the default of 2 GB). If you do not need the additional virtual address space, use
Returns the constant table interface (see
If the function succeeds, the return value is
A constant table is generated by
Returns the name of the highest high-level shader language (HLSL) profile supported by a given device.
Pointer to the device. See
The HLSL profile name.
If the device does not support vertex shaders then the function returns
A shader profile specifies the assembly shader version to use and the capabilities available to the HLSL compiler when compiling a shader. The following table lists the vertex shader profiles that are supported.
Shader Profile | Description |
---|---|
vs_1_1 | Compile to vs_1_1 version. |
vs_2_0 | Compile to vs_2_0 version. |
vs_2_a | Same as the vs_2_0 profile, with the following additional capabilities available for the compiler to target:
|
vs_3_0 | Compile to vs_3_0 version. |
?
For more information about the differences between shader versions, see Vertex Shader Differences.
Preprocesses a shader resource without performing compilation. This resolves all #defines and #includes, providing a self-contained shader for subsequent compilation.
Note??Instead of using this legacy function, we recommend that you use the
If the function succeeds, the return value is
Compile a shader file.
Note??Instead of using this legacy function, we recommend that you compile offline by using the Fxc.exe command-line compiler or use the
If the function succeeds, the return value is
Preprocesses a shader file without performing compilation. This resolves all #defines and #includes, providing a self-contained shader for subsequent compilation.
Note??Instead of using this legacy function, we recommend that you use the
If the function succeeds, the return value is
Returns the size of the shader byte code, in bytes.
Pointer to the function DWORD stream.
Returns the size of the shader byte code, in bytes.
Returns the shader version of the compiled shader.
Pointer to the function DWORD stream.
Returns the shader version of the given shader, or zero if the shader function is
Uses a left-handed coordinate system to create a mesh containing a cylinder.
Pointer to an
Radius at the negative Z end. Value should be greater than or equal to 0.0f.
Radius at the positive Z end. Value should be greater than or equal to 0.0f.
Length of the cylinder along the z-axis.
Number of slices about the main axis.
Number of stacks along the main axis.
Address of a reference to the output shape, an
Address of a reference to an
If the function succeeds, the return value is
The created cylinder is centered at the origin, and its axis is aligned with the z-axis.
This function creates a mesh with the
Uses a left-handed coordinate system to create a mesh containing a torus.
Pointer to an
Inner-radius of the torus. Value should be greater than or equal to 0.0f.
Outer-radius of the torus. Value should be greater than or equal to 0.0f.
Number of sides in a cross-section. Value must be greater than or equal to 3.
Number of rings making up the torus. Value must be greater than or equal to 3.
Address of a reference to the output shape, an
Address of a reference to an
If the function succeeds, the return value is
The created torus is centered at the origin, and its axis is aligned with the z-axis. The inner radius of the torus is the radius of the cross-section (the minor radius), and the outer radius of the torus is the radius of the central hole.
This function returns a mesh that can be used later for drawing or manipulation by the application.
This function creates a mesh with the
Uses a left-handed coordinate system to create a mesh containing a sphere.
Pointer to an
Radius of the sphere. This value should be greater than or equal to 0.0f.
Number of slices about the main axis.
Number of stacks along the main axis.
Address of a reference to the output shape, an
Address of a reference to an
If the function succeeds, the return value is
The created sphere is centered at the origin, and its axis is aligned with the z-axis.
This function creates a mesh with the
Uses a left-handed coordinate system to create a mesh containing a teapot.
Pointer to an
Address of a reference to the output shape, an
Address of a reference to an
If the function succeeds, the return value is
This function creates a mesh with the
Uses a left-handed coordinate system to create a mesh containing an axis-aligned box.
Pointer to an
Width of the box, along the x-axis.
Height of the box, along the y-axis.
Depth of the box, along the z-axis.
Address of a reference to the output shape, an
Address of a reference to an
If the function succeeds, the return value is
The created box is centered at the origin.
This function creates a mesh with the
Uses a left-handed coordinate system to create a mesh containing an n-sided polygon.
Pointer to an
Length of each side.
Number of sides for the polygon. Value must be greater than or equal to 3.
Address of a reference to the output shape, an
Address of a reference to an
If the function succeeds, the return value is
The created polygon is centered at the origin.
This function creates a mesh with the
Creates a mesh containing the specified text, using the font associated with the device context.
Pointer to the device that created the mesh.
Device context, containing the font for output. The font selected by the device context must be a TrueType font.
Pointer to a string that specifies the text to generate. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Maximum chordal deviation from TrueType font outlines.
Amount to extrude text in the negative z-direction.
Pointer to the returned mesh.
Pointer to a buffer containing adjacency information. May be
Pointer to an array of GLYPHMETRICSFLOAT structures that contain the glyph metric data. Each element contains information about the position and orientation of the corresponding glyph in the string. The number of elements in the array should be equal to the number of characters in the string. Note that the origin in each structure is not relative to the entire string, but rather is relative to that character cell. To compute the entire bounding box, add the increment for each glyph while traversing the string. If you are not concerned with the glyph sizes, set this parameter to
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function creates a mesh with the
Retrieves information about a given image file in memory.
VOID reference to the source file in memory.
Size of file in memory, in bytes. .
Pointer to a
Uses a compiled high-level shader language (HLSL) function to fill each texel of each mipmap level of a texture.
Pointer to an
Pointer to a
If the function succeeds, the return value is
The texture target must be an HLSL function that takes contains the following semantics:
The input parameters can be in any order. For an example, see
Creates an empty cube texture, adjusting the calling parameters as needed.
Pointer to an
Width and height of the cube texture, in pixels. For example, if the cube texture is an 8-pixel by 8-pixel cube, the value for this parameter should be 8.
Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created.
0,
Member of the
Member of the
Address of a reference to an
If the function succeeds, the return value is
Cube textures differ from other surfaces in that they are collections of surfaces.
Internally,
Creates a volume texture from a file. This is a more advanced function than
If the function succeeds, the return value is
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
When skipping mipmap levels while loading a .dds file, use the D3DX_SKIP_DDS_MIP_LEVELS macro to generate the MipFilter value. This macro takes the number of levels to skip and the filter type and returns the filter value, which would then be passed into the MipFilter parameter.
Uses a compiled high-level shader language (HLSL) function to fill each texel of each mipmap level of a texture.
Pointer to an
Pointer to a
If the function succeeds, the return value is
The texture target must be an HLSL function that takes contains the following semantics:
The following is an example of such an HLSL function:
float4 TextureGradientFill( float2 vTexCoord : POSITION, float2 vTexelSize : PSIZE) : COLOR { float r,g, b, xSq,ySq, a; xSq = 2.f*vTexCoord.x-1.f; xSq *= xSq; ySq = 2.f*vTexCoord.y-1.f; ySq *= ySq; a = sqrt(xSq+ySq); if (a > 1.0f) { a = 1.0f-(a-1.0f); } else if (a < 0.2f) { a = 0.2f; } r = 1-vTexCoord.x; g = 1-vTexCoord.y; b = vTexCoord.x; return float4(r, g, b, a); };
Note that the input parameters can be in any order, but both input semantics must be represented.
Checks cube-texture-creation parameters.
Pointer to an
Pointer to the requested width and height in pixels, or
Pointer to the number of requested mipmap levels, or
0 or
Pointer to a member of the
Member of the
If the function succeeds, the return value is
If parameters to this function are invalid, this function returns corrected parameters.
Cube textures differ from other surfaces in that they are collections of surfaces. To call SetRenderTarget with a cube texture, you must select an individual face using GetCubeMapSurface and pass the resulting surface to SetRenderTarget.
Creates a texture from a file.
Pointer to an
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Address of a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
The function is equivalent to
Mipmapped textures automatically have each level filled with the loaded texture.
When loading images into mipmapped textures, some devices are unable to go to a 1x1 image and this function will fail. If this happens, the images need to be loaded manually.
Note that a resource created with this function will be placed in the memory class denoted by
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
For the best performance when using
Loads a surface from a file.
Pointer to an
Pointer to a
Pointer to a
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Pointer to a
Combination of one or more
Pointer to a
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function handles conversion to and from compressed texture formats and supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Writing to a non-level-zero surface will not cause the dirty rectangle to be updated. If
Uses a user-provided function to fill each texel of each mip level of a given cube texture.
Pointer to an
Pointer to a user-provided evaluator function, which will be used to compute the value of each texel. The function follows the prototype of LPD3DXFILL3D.
Pointer to an arbitrary block of user-defined data. This reference will be passed to the function provided in pFunction.
If the function succeeds, the return value is
Here is an example that creates a function called ColorCubeFill, which relies on
// Define a function that matches the prototype of LPD3DXFILL3D VOID WINAPI ColorCubeFill (* pOut, const * pTexCoord, const * pTexelSize, LPVOID pData) { *pOut = (pTexCoord->x, pTexCoord->y, pTexCoord->z, 0.0f); } // Fill the texture using if (FAILED (hr = (m_pTexture, ColorCubeFill, null ))) { return hr; }
Creates an empty volume texture, adjusting the calling parameters as needed.
Pointer to an
Width in pixels. This value must be nonzero. The maximum dimension that a driver supports (for width, height, and depth) can be found in MaxVolumeExtent in
Height in pixels. This value must be nonzero. The maximum dimension that a driver supports (for width, height, and depth) can be found in MaxVolumeExtent in
Depth in pixels. This value must be nonzero. The maximum dimension that a driver supports (for width, height, and depth) can be found in MaxVolumeExtent in
Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created.
0 or
Member of the
Member of the
Address of a reference to an
If the function succeeds, the return value is
Internally,
Loads a volume from a file.
Pointer to an
Pointer to a
Pointer to a
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Pointer to a
Combination of one or more
Pointer to a
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function handles conversion to and from compressed texture formats and supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Writing to a non-level-zero surface of the volume texture will not cause the dirty rectangle to be updated. If
Creates a texture from a file. This is a more advanced function than
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Use
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Mipmapped textures automatically have each level filled with the loaded texture. When loading images into mipmapped textures, some devices are unable to go to a 1x1 image and this function will fail. If this happens, then the images need to be loaded manually.
For the best performance when using
When skipping mipmap levels while loading a .dds file, use the D3DX_SKIP_DDS_MIP_LEVELS macro to generate the MipFilter value. This macro takes the number of levels to skip and the filter type and returns the filter value, which would then be passed into the MipFilter parameter.
Converts a height map into a normal map. The (x,y,z) components of each normal are mapped to the (r,g,b) channels of the output texture.
Pointer to an
Pointer to an
Pointer to a
One or more
One
Constant value multiplier that increases (or decreases) the values in the normal map. Higher values usually make bumps more visible, lower values usually make bumps less visible.
If the function succeeds, the return value is
This method computes the normal by using the central difference with a kernel size of 3x3. The central differencing denominator used is 2.0. RGB channels in the destination contain biased (x,y,z) components of the normal.
Checks volume-texture-creation parameters.
Pointer to an
Pointer to the requested width in pixels, or
Pointer to the requested height in pixels, or
Pointer to the requested depth in pixels, or
Pointer to the number of requested mipmap levels, or
Currently not used, set to 0.
Pointer to a member of the
Member of the
If the function succeeds, the return value is
If parameters to this function are invalid, this function returns corrected parameters.
Creates a texture from a file in memory.
Pointer to an
Pointer to the file in memory from which to create the texture.
Size in bytes of the file in memory.
Address of a reference to an
If the function succeeds, the return value is
The function is equivalent to
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Note that a resource created with this function when called from a
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
Creates a cube texture from a resource specified by a string. This is a more advanced function than
If the function succeeds, the return value is
The compiler setting determines the function version. If Unicode is defined, the function call resolves to
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Cube textures differ from other surfaces in that they are collections of surfaces. To call SetRenderTarget with a cube texture, you must select an individual face using GetCubeMapSurface and pass the resulting surface to SetRenderTarget.
Creates a volume texture from a file in memory.
Pointer to an
Pointer to the file in memory from which to create the volume texture.
Size of the file in memory, in bytes.
Address of a reference to an
If the function succeeds, the return value is
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
The function is equivalent to
Note that a resource created with this function when called from a
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
Loads a volume from another volume.
Pointer to an
Pointer to a
Pointer to a
A Pointer to an
Pointer to a
Pointer to a
A combination of one or more
If the function succeeds, the return value is
Writing to a non-level-zero surface of the volume texture will not cause the dirty rectangle to be updated. If
Saves a texture to a file.
Pointer to a string that specifies the file name of the destination image. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Pointer to
Pointer to a
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function handles conversion to and from compressed texture formats.
If the volume is nondynamic (because of a usage parameter set to 0 at the creation) and located in video memory (the memory pool set to
Creates a texture from a file.
Pointer to an
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Address of a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
The function is equivalent to
Mipmapped textures automatically have each level filled with the loaded texture.
When loading images into mipmapped textures, some devices are unable to go to a 1x1 image and this function will fail. If this happens, the images need to be loaded manually.
Note that a resource created with this function will be placed in the memory class denoted by
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
For the best performance when using
Creates a cube texture from a file in memory. This is a more advanced function than
If the function succeeds, the return value is
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Cube textures differ from other surfaces in that they are collections of surfaces. To call SetRenderTarget with a cube texture, you must select an individual face using GetCubeMapSurface and pass the resulting surface to SetRenderTarget .
This method is designed to be used for loading image files stored as RT_RCDATA, which is an application-defined resource (raw data). Otherwise this method will fail.
For details on
When skipping mipmap levels while loading a .dds file, use the D3DX_SKIP_DDS_MIP_LEVELS macro to generate the MipFilter value. This macro takes the number of levels to skip and the filter type and returns the filter value, which would then be passed into the MipFilter parameter.
Creates a texture from a resource. This is a more advanced function than
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
The resource being loaded must be of type RT_BITMAP or RT_RCDATA. Resource type RT_RCDATA is used to load formats other than bitmaps (such as .tga, .jpg, and .dds).
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Retrieves information about a given image file.
File name of image to retrieve information about. If UNICODE or _UNICODE are defined, this parameter type is LPCWSTR, otherwise, the type is LPCSTR.
Pointer to a
This function supports both Unicode and ANSI strings.
Loads a surface from memory.
Pointer to an
Pointer to a
Pointer to a
Pointer to the upper left corner of the source image in memory.
Member of the
Pitch of source image, in bytes. For DXT formats, this number should represent the width of one row of cells, in bytes.
Pointer to a
Pointer to a
Combination of one or more
If the function succeeds, the return value is
This function handles conversion to and from compressed texture formats.
Writing to a non-level-zero surface will not cause the dirty rectangle to be updated. If
Saves a texture to an image file.
Pointer to
Pointer to a
Address of a reference to an
This function handles conversion to and from compressed texture formats.
Checks texture-creation parameters.
Pointer to an
Pointer to the requested width in pixels, or
Pointer to the requested height in pixels, or
Pointer to number of requested mipmap levels, or
0 or
Pointer to a member of the
Member of the
If the function succeeds, the return value is
If parameters to this function are invalid, this function returns corrected parameters.
This function uses the following heuristics when comparing the requested requirements against available formats:
Saves a volume to a file on disk.
Pointer to a string that specifies the file name of the destination image. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Pointer to
Pointer to a
Pointer to a
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function handles conversion to and from compressed texture formats.
If the volume is nondynamic (because of a usage parameter set to 0 at the creation) and located in video memory (the memory pool set to
Loads a volume from a resource.
Pointer to an
Pointer to a
Pointer to a
Handle to the module where the resource is located, or
Pointer to a string that specifies the file name of the source image. If UNICODE or _UNICODE are defined, this parameter type is LPCWSTR, otherwise, the type is LPCSTR.
Pointer to a
Combination of one or more
Pointer to a
If the function succeeds, the return value is
The resource being loaded must be a bitmap resource(RT_BITMAP).
This function handles conversion to and from compressed texture formats.
Writing to a non-level-zero surface of the volume texture will not cause the dirty rectangle to be updated. If
This function supports both Unicode and ANSI strings.
Creates a volume texture from a resource specified by a string. This is a more advanced function than
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
The resource being loaded must be an application-defined resource (RT_RCDATA).
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Creates a cube texture from a resource.
Pointer to an
Handle to the module where the resource is located, or
Pointer to a string that specifies the resource name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Address of a reference to an
If the function succeeds, the return value is
The compiler setting determines the function version. If Unicode is defined, the function call resolves to
The function is equivalent to
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Note that a resource created with this function when called from a
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
Saves a surface to a file.
Pointer to a string that specifies the file name of the destination image. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Pointer to
Pointer to a
Pointer to a
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function handles conversion to and from compressed texture formats.
Creates a cube texture from a file in memory.
Pointer to an
Pointer to the file in memory from which to create the cubemap. See Remarks.
Size of the file in memory, in bytes.
Address of a reference to an
If the function succeeds, the return value is
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
The function is equivalent to
Note that a resource created with this function when called from a
This method is designed to be used for loading image files stored as RT_RCDATA, which is an application-defined resource (raw data). Otherwise this method will fail.
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
Creates a cube texture from a file. This is a more advanced function than
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Cube textures differ from other surfaces in that they are collections of surfaces. To call SetRenderTarget with a cube texture, you must select an individual face using GetCubeMapSurface and pass the resulting surface to SetRenderTarget.
When skipping mipmap levels while loading a .dds file, use the D3DX_SKIP_DDS_MIP_LEVELS macro to generate the MipFilter value. This macro takes the number of levels to skip and the filter type and returns the filter value, which would then be passed into the MipFilter parameter.
Retrieves information about a given image in a resource.
Module where the resource is loaded. Set this parameter to
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Pointer to a
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
Uses a compiled high-level shader language (HLSL) function to fill each texel of each mipmap level of a texture.
Pointer to an
Pointer to a
If the function succeeds, the return value is
The texture target must be an HLSL function that takes contains the following semantics:
The input parameters can be in any order. For an example, see
Uses a user-provided function to fill each texel of each mip level of a given texture.
Pointer to an
Pointer to a user-provided evaluator function, which will be used to compute the value of each texel. The function follows the prototype of LPD3DXFILL2D.
Pointer to an arbitrary block of user-defined data. This reference will be passed to the function provided in pFunction.
If the function succeeds, the return value is
Here is an example that creates a function called ColorFill, which relies on
// Define a function that matches the prototype of LPD3DXFILL3D VOID WINAPI ColorFill (* pOut, const * pTexCoord, const * pTexelSize, LPVOID pData) { *pOut = (pTexCoord->x, pTexCoord->y, 0.0f, 0.0f); } // Fill the texture using if (FAILED (hr = (m_pTexture, ColorFill, null ))) { return hr; }
Saves a surface to an image file.
Address of a reference to an
Pointer to
Pointer to a
Pointer to a
If the function succeeds, the return value is
This function handles conversion to and from compressed texture formats.
Creates a volume texture from a file.
Pointer to an
Pointer to a string that specifies the file name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Address of a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
The function is equivalent to
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Mipmapped textures automatically have each level filled with the loaded texture.
When loading images into mipmapped textures, some devices are unable to go to a 1x1 image and this function will fail. If this happens, then the images need to be loaded manually.
Note that a resource created with this function when called from a
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
Creates a texture from a resource.
Pointer to an
Handle to the module where the resource is located, or
Pointer to a string that specifies the resource name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Address of a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
The function is equivalent to
The resource being loaded must be of type RT_BITMAP or RT_RCDATA. Resource type RT_RCDATA is used to load formats other than bitmaps (such as .tga, .jpg, and .dds).
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Note that a resource created with this function when called from a
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
Loads a volume from memory.
Pointer to an
Pointer to a
Pointer to a
Pointer to the top-left corner of the source volume in memory.
Member of the
Pitch of source image, in bytes. For DXT formats (compressed texture formats), this number should represent the size of one row of cells, in bytes.
Pitch of source image, in bytes. For DXT formats (compressed texture formats), this number should represent the size of one slice of cells, in bytes.
Pointer to a
Pointer to a
A combination of one or more
If the function succeeds, the return value is
Writing to a non-level-zero surface of the volume texture will not cause the dirty rectangle to be updated. If
Creates a volume texture from a file.
Pointer to an
Pointer to a string that specifies the filename. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Width in pixels. If this value is zero or D3DX_DEFAULT, the dimensions are taken from the file. The maximum dimension that a driver supports (for width, height, and depth) can be found in MaxVolumeExtent in
Height, in pixels. If this value is zero or D3DX_DEFAULT, the dimensions are taken from the file. The maximum dimension that a driver supports (for width, height, and depth) can be found in MaxVolumeExtent in
Depth, in pixels. If this value is zero or D3DX_DEFAULT, the dimensions are taken from the file. The maximum dimension that a driver supports (for width, height, and depth) can be found in MaxVolumeExtent in
Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created.
0,
Member of the
Member of the
A combination of one or more
A combination of one or more
Pointer to a
Pointer to a
Address of a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Mipmapped textures automatically have each level filled with the loaded volume texture. When loading images into mipmapped textures, some devices are unable to go to a 1x1 image and this function will fail. If this happens, then the images need to be loaded manually.
When skipping mipmap levels while loading a .dds file, use the D3DX_SKIP_DDS_MIP_LEVELS macro to generate the MipFilter value. This macro takes the number of levels to skip and the filter type and returns the filter value, which would then be passed into the MipFilter parameter.
Creates a texture from a file in memory. This is a more advanced function than
If the function succeeds, the return value is
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
For details about
When skipping mipmap levels while loading a .dds file, use the D3DX_SKIP_DDS_MIP_LEVELS macro to generate the MipFilter value. This macro takes the number of levels to skip and the filter type and returns the filter value, which would then be passed into the MipFilter parameter.
Saves a volume to a buffer. The method creates an
If the function succeeds, the return value is
Creates a volume texture from a resource.
Pointer to an
Handle to the module where the resource is located, or
Pointer to a string that specifies the resource name. If the compiler settings require Unicode, the data type LPCTSTR resolves to LPCWSTR. Otherwise, the string data type resolves to LPCSTR. See Remarks.
Address of a reference to an
If the function succeeds, the return value is
The compiler setting also determines the function version. If Unicode is defined, the function call resolves to
The function is equivalent to
The resource being loaded must be an application-defined resource (RT_RCDATA).
This function supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Note that a resource created with this function when called from a
Filtering is automatically applied to a texture created using this method. The filtering is equivalent to
Creates an empty texture, adjusting the calling parameters as needed.
Pointer to an
Width in pixels. If this value is 0, a value of 1 is used. See Remarks.
Height in pixels. If this value is 0, a value of 1 is used. See Remarks.
Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created.
0,
Member of the
Member of the
Address of a reference to an
If the function succeeds, the return value is
Internally,
If both Height and Width are set to D3DX_DEFAULT, a value of 256 is used for both parameters. If either Height or Width is set to D3DX_DEFAULT And the other parameter is set to a numeric value, the texture will be square with both the height and width equal to the numeric value.
Uses a user-provided function to fill each texel of each mip level of a given volume texture.
Pointer to an
Pointer to a user-provided evaluator function, which will be used to compute the value of each texel. The function follows the prototype of LPD3DXFILL3D.
Pointer to an arbitrary block of user-defined data. This reference will be passed to the function provided in pFunction.
If the function succeeds, the return value is
If the volume is non-dynamic (because usage is set to 0 when it is created), and located in video memory (the memory pool set to
This example creates a function called ColorVolumeFill, which relies on
// Define a function that matches the prototype of LPD3DXFILL3D VOID WINAPI ColorVolumeFill (* pOut, const * pTexCoord, const * pTexelSize, LPVOID pData) { *pOut = (pTexCoord->x, pTexCoord->y, pTexCoord->z, 0.0f); } // Fill volume texture if (FAILED (hr = (m_pTexture, ColorVolumeFill, null ))) { return hr; }
Loads a surface from another surface with color conversion.
Pointer to an
Pointer to a
Pointer to a
Pointer to an
Pointer to a
Pointer to a
A combination of one or more
If the function succeeds, the return value is
This function handles conversion to and from compressed texture formats.
Writing to a non-level-zero surface will not cause the dirty rectangle to be updated. If
Loads a volume from a file in memory.
Pointer to an
Pointer to a
Pointer to a
Pointer to the file in memory from which to load the volume.
Size in bytes of the file in memory.
Pointer to a
Combination of one or more
Pointer to a
If the function succeeds, the return value is
This function handles conversion to and from compressed texture formats and supports the following file formats: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga. See
Writing to a non-level-zero surface of the volume texture will not cause the dirty rectangle to be updated. If
Creates an instance of an
If the function succeeds, the return value is
After using this function, use RegisterTemplates or RegisterEnumTemplates to register templates, CreateEnumObject to create an enumerator object, or CreateSaveObject to create a save object.
An application implements this interface to handle callbacks in animation sets generated by calls to
The LPD3DXANIMATIONCALLBACKHANDLER type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXANIMATIONCALLBACKHANDLER;
The application implements this method. This method is called when a callback occurs for an animation set in one of the tracks during a call to
The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return
This interface is used to control animation functionality, connecting animation sets with the transformation frames that are being animated. The interface has methods to mix multiple animations and to modify blending parameters over time to enable smooth transitions and other effects.
Create an animation controller object with
The LPD3DXANIMATIONCONTROLLER type is defined as a reference to the
typedef interface; typedef interface *LPD3DXANIMATIONCONTROLLER;
The D3DXEVENTHANDLE type is defined as an event handle to animation controller events.
typedef DWORD D3DXEVENTHANDLE;
The LPD3DXEVENTHANDLE type is defined as a reference to an event handle to animation controller events.
typedef D3DXEVENTHANDLE *LPD3DXEVENTHANDLE;
Get the maximum number of animation outputs the animation controller can support.
Gets the maximum number of animation sets the animation controller can support.
Gets the maximum number of tracks in the animation controller.
The maximum number of tracks the controller can manage.
Gets the maximum number of events the animation controller can support.
Returns the number of animation sets currently registered in the animation controller.
The controller contains any number of animations sets and tracks. Animation sets can be registered with RegisterAnimationOutput. An animation controller created by a call to
Gets the global animation time.
Animations are designed using a local animation time and mixed into global time with AdvanceTime.
Gets or sets the current priority blending weight used by the animation controller.
The priority blending weight is used to blend high and low priority tracks together.
Returns an event handle to a priority blend event that is currently running.
Get the maximum number of animation outputs the animation controller can support.
The maximum number of animation outputs the controller can manage.
Gets the maximum number of animation sets the animation controller can support.
The maximum number of animation sets the controller can manage.
Gets the maximum number of tracks in the animation controller.
Number of tracks.
The maximum number of tracks the controller can manage.
Gets the maximum number of events the animation controller can support.
The maximum number of events the controller can manage.
Adds an animation output to the animation controller and registers references for scale, rotate, and translate (SRT) transformations.
Name of the animation output.
Pointer to a
Pointer to a
Pointer to a
Pointer to a
If the method succeeds, the return value is
If the animation output is already registered, pMatrix will be filled with the input transformation data.
Animation sets created with
Adds an animation set to the animation controller.
Pointer to the
If the method succeeds, the return value is
Removes an animation set from the animation controller.
Pointer to the
If the method succeeds, the return value is
Returns the number of animation sets currently registered in the animation controller.
Number of animation sets.
The controller contains any number of animations sets and tracks. Animation sets can be registered with RegisterAnimationOutput. An animation controller created by a call to
Gets an animation set.
Index of the animation set.
Pointer to the
If the method succeeds, the return value is
The animation controller contains an array of animation sets. This method returns one of them at the given index.
Gets an animation set, given its name.
String containing the name of the animation set.
Pointer to the
If the method succeeds, the return value is
The animation controller contains an array of animation sets. This method returns an animation set that has the given name.
Animates the mesh and advances the global animation time by a specified amount.
Amount, in seconds, by which to advance the global animation time. TimeDelta value must be non-negative or zero.
Pointer to a user-defined animation callback handler interface,
If the method succeeds, the return value is
Resets the global animation time to zero. Any pending events will retain their original schedules, but in the new timeframe.
If the method succeeds, the return value is
This method is typically used when the global animation time value is nearing the maximum precision of DOUBLE storage, or 264 - 1.
Gets the global animation time.
Returns the global animation time.
Animations are designed using a local animation time and mixed into global time with AdvanceTime.
Applies the animation set to the specified track.
Identifier of the track to which the animation set is applied.
Pointer to the
If the method succeeds, the return value is
This method sets the animation set to the specified track for mixing. The animation set for each track is blended according to the track weight and speed when AdvanceTime is called.
Gets the animation set for the given track.
Track identifier.
Pointer to the
If the method succeeds, the return value is
Sets the priority blending weight for the specified animation track.
Track identifier.
Track priority. This parameter should be set to one of the constants from
If the method succeeds, the return value is
Sets the track speed. The track speed is similar to a multiplier that is used to speed up or slow down the playback of the track.
Identifier of the track to set the speed on.
New speed.
If the method succeeds, the return value is
Sets the track weight. The weight is used to determine how to blend multiple tracks together.
Identifier of the track to set the weight on.
Weight value.
If the method succeeds, the return value is
Sets the track to the specified local animation time.
Track identifier.
Local animation time value to assign to the track.
If the method succeeds, the return value is
Enables or disables a track in the animation controller.
Identifier of the track to be mixed.
Enable value. Set to TRUE to enable this track in the controller, or to
If the method succeeds, the return value is
To mix a track with other tracks, the Enable flag must be set to TRUE. Conversely, setting the flag to
Sets the track description.
Identifier of the track to modify.
Description of the track.
If the method succeeds, the return value is
Gets the track description.
Track identifier.
Pointer to the track description. See
If the method succeeds, the return value is
Sets the priority blending weight used by the animation controller.
Priority blending weight used by the animation controller.
If the method succeeds, the return value is
The blend weight is used to blend high and low priority tracks together.
Gets the current priority blending weight used by the animation controller.
Returns the current priority blending weight.
The priority blending weight is used to blend high and low priority tracks together.
Sets an event key that changes the rate of play of an animation track.
Identifier of the track to modify.
New speed of the animation track.
Global time key. Specifies the global time when the change will take place.
Transition time, which specifies how long the smooth transition will take to complete.
Specifies the transition type used for transitioning between speeds. See
Event handle to the priority blend event.
Sets an event key that changes the weight of an animation track. The weight is used as a multiplier when combining multiple tracks together.
Identifier of the track to modify.
New weight of the track.
Global time key. Specifies the global time when the change will take place.
Transition time, which specifies how long the smooth transition will take to complete.
Specifies the transition type used for transitioning between weights. See
Event handle to the priority blend event.
The weight is used like a multiplier to determine how much of this track to blend together with other tracks.
Sets an event key that changes the local time of an animation track.
Identifier of the track to modify.
New local time of the animation track.
Global time key. Specifies the global time when the change will take place.
Event handle to the priority blend event.
Sets an event key that enables or disables an animation track.
Identifier of the animation track to modify.
Enable flag. Set this to TRUE to enable the animation track, or to
Global time key. Specifies the global time when the change will take place.
Event handle to the priority blend event.
Sets blending event keys for the specified animation track.
Number between 0 and 1 that is used to blend tracks together.
Global time to start the blend.
Global time duration of the blend.
Specifies the transition type used for the duration of the blend. See
Event handle to the priority blend event.
The animation controller blends in three phases: low priority tracks are blended first, high priority tracks are blended second, and then the results of both are blended.
Removes a specified event from an animation track, preventing the execution of the event.
Event handle to the event to be removed from the animation track.
If the method succeeds, the return value is
Removes all events from a specified animation track.
Identifier of the track on which all events should be removed.
If the method succeeds, the return value is
This method prevents the execution of all events previously scheduled on the track, and discards all data associated with those events.
Removes all scheduled priority blend events from the animation controller.
If the method succeeds, the return value is
Returns an event handle to the event currently running on the specified animation track.
Track identifier.
Type of event to query.
Event handle to the event currently running on the specified track.
Returns an event handle to a priority blend event that is currently running.
Event handle to the currently running priority blend event.
Returns an event handle to the next event scheduled to occur after a specified event on an animation track.
Track identifier.
Event handle to a specified event after which to search for a following event. If set to
Event handle to the next event scheduled to run on the specified track.
This method can be used iteratively to locate a desired event by repeatedly passing in
Note??Do not iterate further after the method has returned
Returns an event handle to the next priority blend event scheduled to occur after a specified event.
Event handle to a specified event after which to search for a following priority blend event. If set to
Event handle to the next scheduled priority blend event.
This method can be used iteratively to locate a desired priority blend event by repeatedly passing in
Note??Do not iterate further after the method has returned
Checks whether a specified event handle is valid and the animation event has not yet completed.
Event handle to an animation event.
Returns
Returns E_FAIL if the event handle is invalid and/or the event has completed.
The method will indicate that an event handle is valid even if the event is running but has not yet completed.
Gets a description of a specified animation event.
Event handle to an animation event to describe.
Pointer to a
If the method succeeds, the return value is
Clones, or copies, an animation controller.
Maximum number of animation outputs the controller can support.
Maximum number of animation sets the controller can support.
Maximum number of tracks the controller can support.
Maximum number of events the controller can support.
Address of a reference to the cloned
If the method succeeds, the return value is
This interface encapsulates the minimum functionality required of an animation set by an animation controller. Advanced users might want to implement this interface themselves to suit their specialized needs; for most users, however, the derived
An animation set consists of animations for many nodes for the same animation.
The LPD3DXANIMATIONSET type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXANIMATIONSET;
Gets the animation set name.
Gets the period of the animation set.
The period is the range of time that the animation key frames are valid. For looping animations, this is the period of the loop. The time units that the key frames are specified in (for example, seconds) is determined by the application.
Gets the number of animations in the animation set.
Gets the animation set name.
Name of the animation set.
Gets the period of the animation set.
Period of the animation set.
The period is the range of time that the animation key frames are valid. For looping animations, this is the period of the loop. The time units that the key frames are specified in (for example, seconds) is determined by the application.
Returns time position in the local timeframe of an animation set.
Local time of the animation set.
Time position as measured in the timeframe of the animation set. This value will be bounded by the period of the animation set.
The time position returned by this method can be used as the PeriodicPosition parameter of
Gets the number of animations in the animation set.
Number of animations in the animation set.
Gets the name of an animation, given its index.
Index of the animation.
Address of a reference to a string that receives the animation name.
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
Gets the index of an animation, given its name.
Name of the animation.
Pointer to the animation index.
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
Gets the scale, rotation, and translation values of the animation set.
Position of the animation set. The position can be obtained by calling
Animation index.
Pointer to the
Pointer to the
Pointer to the
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
Gets information about a specific callback in the animation set.
Position from which to find callbacks.
Callback search flags. This parameter can be set to a combination of one or more flags from
Pointer to the position of the callback.
Address of the callback data reference.
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
Locks a vertex buffer and obtains a reference to the vertex buffer memory.
When working with vertex buffers, you are allowed to make multiple lock calls; however, you must ensure that the number of lock calls match the number of unlock calls. DrawPrimitive calls will not succeed with any outstanding lock count on any currently set vertex buffer.
Gets the fixed function vertex value.
This method can return 0 if the vertex format cannot be mapped directly to an FVF code. This will occur for a mesh created from a vertex declaration that doesn't have the same order and elements supported by the FVF codes.
Gets the number of bytes per vertex.
Retrieves the mesh options enabled for this mesh at creation time.
Retrieves the device associated with the mesh.
Calling this method will increase the internal reference count on the
Retrieves the vertex buffer associated with the mesh.
Retrieves the data in an index buffer.
Draws a subset of a mesh.
DWORD that specifies which subset of the mesh to draw. This value is used to differentiate faces in a mesh as belonging to one or more attribute groups.
If the method succeeds, the return value is
The subset that is specified by AttribId will be rendered by the
An attribute table is used to identify areas of the mesh that need to be drawn with different textures, render states, materials, and so on. In addition, the application can use the attribute table to hide portions of a mesh by not drawing a given attribute identifier (AttribId) when drawing the frame.
Retrieves the number of faces in the mesh.
Returns the number of faces in the mesh.
Retrieves the number of vertices in the mesh.
Returns the number of vertices in the mesh.
Gets the fixed function vertex value.
Returns the flexible vertex format (FVF) codes.
This method can return 0 if the vertex format cannot be mapped directly to an FVF code. This will occur for a mesh created from a vertex declaration that doesn't have the same order and elements supported by the FVF codes.
Retrieves a declaration describing the vertices in the mesh.
Array of
If the method succeeds, the return value is
The array of elements includes the D3DDECL_END macro, which ends the declaration.
Gets the number of bytes per vertex.
Returns the number of bytes per vertex.
Retrieves the mesh options enabled for this mesh at creation time.
Returns a combination of one or more of the following flags, indicating the options enabled for this mesh at creation time.
Value | Description |
---|---|
Use 32-bit indices. | |
Use the | |
Equivalent to specifying both | |
Use the | |
Specifying this flag causes the vertex and index buffer of the mesh to be created with | |
Equivalent to specifying both | |
Use the | |
Use the | |
Use the | |
Use the | |
Use the | |
Equivalent to specifying both | |
Use the | |
Use the | |
Use the | |
Use the | |
Equivalent to specifying both |
?
Retrieves the device associated with the mesh.
Address of a reference to an
If the method succeeds, the return value is
Calling this method will increase the internal reference count on the
Clones a mesh using a flexible vertex format (FVF) code.
A combination of one or more D3DXMESH flags specifying creation options for the mesh.
Combination of FVF codes, which specifies the vertex format for the vertices in the output mesh. For the values of the codes, see
Pointer to an
Address of a reference to an
If the method succeeds, the return value is
Clones a mesh using a declarator.
A combination of one or more D3DXMESH flags specifying creation options for the mesh.
An array of
Pointer to an
Address of a reference to an
If the method succeeds, the return value is
Retrieves the vertex buffer associated with the mesh.
Address of a reference to an
If the method succeeds, the return value is
Retrieves the data in an index buffer.
Address of a reference to an
If the method succeeds, the return value is
Locks a vertex buffer and obtains a reference to the vertex buffer memory.
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
VOID* reference to a buffer containing the vertex data.
If the method succeeds, the return value is
When working with vertex buffers, you are allowed to make multiple lock calls; however, you must ensure that the number of lock calls match the number of unlock calls. DrawPrimitive calls will not succeed with any outstanding lock count on any currently set vertex buffer.
Unlocks a vertex buffer.
If the method succeeds, the return value is
Locks an index buffer and obtains a reference to the index buffer memory.
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
VOID* reference to a buffer containing the index data. The count of indices in this buffer will be equal to
If the method succeeds, the return value is
When working with index buffers, you are allowed to make multiple lock calls. However, you must ensure that the number of lock calls match the number of unlock calls. DrawPrimitive calls will not succeed with any outstanding lock count on any currently set index buffer.
Unlocks an index buffer.
If the method succeeds, the return value is
Retrieves either an attribute table for a mesh, or the number of entries stored in an attribute table for a mesh.
Pointer to an array of
Pointer to either the number of entries stored in pAttribTable or a value to be filled in with the number of entries stored in the attribute table for the mesh.
If the method succeeds, the return value is
An attribute table is created by
An attribute table is used to identify areas of the mesh that need to be drawn with different textures, render states, materials, and so on. In addition, the application can use the attribute table to hide portions of a mesh by not drawing a given attribute identifier when drawing the frame.
Converts point representative data to mesh adjacency information.
Pointer to an array of one DWORD per vertex of the mesh that contains point representative data. This parameter is optional. Supplying a
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh. The number of bytes in this array must be at least 3 *
If the method succeeds, the return value is
Converts mesh adjacency information to an array of point representatives.
Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh. The number of bytes in this array must be at least 3 *
Pointer to an array of one DWORD per vertex of the mesh that will be filled with point representative data.
If the method succeeds, the return value is
Generate a list of mesh edges, as well as a list of faces that share each edge.
Specifies that vertices that differ in position by less than epsilon should be treated as coincident.
Pointer to an array of three DWORDs per face to be filled with the indices of adjacent faces. The number of bytes in this array must be at least 3 *
If the method succeeds, the return value is
After an application generates adjacency information for a mesh, the mesh data can be optimized for better drawing performance.
The order of the entries in the adjacency buffer is determined by the order of the vertex indices in the index buffer. The adjacent triangle 0 always corresponds to the edge between the indices of the corners 0 and 1. The adjacent triangle 1 always corresponds to the edge between the indices of the corners 1 and 2 while the adjacent triangle 2 corresponds to the edge between the indices of the corners 2 and 0.
This method allows the user to change the mesh declaration without changing the data layout of the vertex buffer. The call is valid only if the old and new declaration formats have the same vertex size.
An array of
If the method succeeds, the return value is
An application uses the methods of this interface to implement a key frame animation set stored in a compressed data format.
Create a compressed-format key frame animation set with
The LPD3DXCOMPRESSEDANIMATIONSET type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXCOMPRESSEDANIMATIONSET;
Gets the type of the animation set playback loop.
Gets the number of animation key frame ticks that occur per second.
Gets the data buffer that stores compressed key frame animation data.
Gets the number of callback keys in the animation set.
Gets the type of the animation set playback loop.
Type of the animation set playback loop. See
Gets the number of animation key frame ticks that occur per second.
Number of animation key frame ticks that occur per second.
Gets the data buffer that stores compressed key frame animation data.
Address of a reference to the
If the method succeeds, the return value is
Gets the number of callback keys in the animation set.
Number of callback keys in the animation set.
Fills an array with callback key data used for key frame animation.
Pointer to a user-allocated array of
If the method succeeds, the return value is
This is a user-implemented interface that allows a user to set the device state from an effect. Each of the methods in this interface must be implemented by the user and will then be used as callbacks to the application when either of the following occur:
When an application uses the state manager to implement custom callbacks, an effect no longer automatically saves and restores state when calling
A user creates an
The LPD3DXEFFECTSTATEMANAGER type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXEFFECTSTATEMANAGER;
A callback function that must be implemented by a user to set material state.
A callback function that must be implemented by a user to set the number of subdivision segments for N-patches.
A callback function that must be implemented by a user to set a FVF code.
A callback function that must be implemented by a user to set a vertex shader.
A callback function that must be implemented by a user to set a pixel shader.
A callback function that must be implemented by a user to set a transform.
The type of transform to apply the matrix to. See
A transformation matrix. See
The user-implemented method should return
A callback function that must be implemented by a user to set material state.
A reference to the material state. See
The user-implemented method should return
A callback function that must be implemented by a user to set a light.
The zero-based index of the light. This is the same index in
The light object. See
The user-implemented method should return
A callback function that must be implemented by a user to enable/disable a light.
The zero-based index of the light. This is the same index in
True to enable the light, false otherwise.
The user-implemented method should return
A callback function that must be implemented by a user to set render state.
The render state to set.
The render state value. See Effect States (Direct3D 9).
The user-implemented method should return
A callback function that must be implemented by a user to set a texture.
The stage to which the texture is assigned. This is the index value in
A reference to the texture object. This can be any of the Direct3D texture types (cube, volume, etc.). See
The user-implemented method should return
A callback function that must be implemented by a user to set the texture stage state.
The stage that the texture is assigned to. This is the index value in
Defines the type of operation that a texture stage will perform. See
Can be either an operation (
The user-implemented method should return
A callback function that must be implemented by a user to set a sampler.
The zero-based sampler number.
Identifies sampler state, which can specify the filtering, addressing, or the border color. See
A value from one of the sampler state types in Type.
The user-implemented method should return
A callback function that must be implemented by a user to set the number of subdivision segments for N-patches.
Break the surface into this number of subdivisions. This is the same as the number used by
The user-implemented method should return
A callback function that must be implemented by a user to set a FVF code.
The FVF constant, that determines how to interpret vertex data. See
The user-implemented method should return
A callback function that must be implemented by a user to set a vertex shader.
A reference to a vertex shader object. See
The user-implemented method should return
A callback function that must be implemented by a user to set an array of vertex shader floating-point constants.
The zero-based index of the first constant register.
An array of floating-point constants.
The number of registers in pConstantData.
The user-implemented method should return
A callback function that must be implemented by a user to set an array of vertex shader integer constants.
The zero-based index of the first constant register.
An array of integer constants.
The number of registers in pConstantData.
The user-implemented method should return
A callback function that must be implemented by a user to set an array of vertex shader Boolean constants.
The zero-based index of the first constant register.
An array of Boolean constants.
The number of registers in pConstantData.
The user-implemented method should return
A callback function that must be implemented by a user to set a pixel shader.
A reference to a pixel shader object. See
The user-implemented method should return
A callback function that must be implemented by a user to set an array of vertex shader floating-point constants.
The zero-based index of the first constant register.
An array of floating-point constants.
The number of registers in pConstantData.
The user-implemented method should return
A callback function that must be implemented by a user to set an array of vertex shader integer constants.
The zero-based index of the first constant register.
An array of integer constants.
The number of registers in pConstantData.
The user-implemented method should return
A callback function that must be implemented by a user to set an array of vertex shader Boolean constants.
The zero-based index of the first constant register.
An array of Boolean constants.
The number of registers in pConstantData.
The user-implemented method should return
This interface is implemented by the application to allocate or free frame and mesh container objects. Methods on this are called during loading and destroying frame hierarchies.
The LPD3DXALLOCATEHIERARCHY type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXALLOCATEHIERARCHY;
Requests allocation of a frame object.
Name of the frame to be created.
Returns the created frame object.
The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return
Requests allocation of a mesh container object.
Name of the mesh.
Pointer to the mesh data structure. See
Array of materials used in the mesh.
Array of effect instances used in the mesh. See
Number of materials in the materials array.
Adjacency array for the mesh.
Pointer to the skin mesh object if skin data is found. See
Returns the created mesh container. See
The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return
Requests deallocation of a frame object.
Pointer to the frame to be deallocated.
The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return
Requests deallocation of a mesh container object.
Pointer to the mesh container object to be deallocated.
The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return
This interface is implemented by the application to save any additional user data embedded in .x files. An instance of this interface is passed to
The LPD3DXLOADUSERDATA type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXLOADUSERDATA;
Load top level data from a .x file.
Pointer to a .x file data structure. This is defined in Dxfile.h.
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
Load frame child data from a .x file.
Pointer to a mesh container. See
Pointer to a .x file data structure. This is defined in Dxfile.h.
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
Load mesh child data from a .x file.
Pointer to a mesh container. See
Pointer to a .x file data structure. This is defined in Dxfile.h.
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
A user creates an
The LPD3DXINCLUDE type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXINCLUDE;
Applications use the methods of the
The
This interface inherits additional functionality from the
This interface, like all COM interfaces, inherits from the
The LPDIRECT3DINDEXBUFFER9 and PDIRECT3DINDEXBUFFER9 types are defined as references to the
typedef struct*LPDIRECT3DINDEXBUFFER9, *PDIRECT3DINDEXBUFFER9;
Retrieves a description of the index buffer resource.
Locks a range of index data and obtains a reference to the index buffer memory.
Offset into the index data to lock, in bytes. Lock the entire index buffer by specifying 0 for both parameters, SizeToLock and OffsetToLock.
Size of the index data to lock, in bytes. Lock the entire index buffer by specifying 0 for both parameters, SizeToLock and OffsetToLock.
VOID* reference to a memory buffer containing the returned index data.
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
If the method succeeds, the return value is
As a general rule, do not hold a lock across more than one frame. When working with index buffers, you are allowed to make multiple lock calls. However, you must ensure that the number of lock calls match the number of unlock calls.
The
See Programming Tips (Direct3D 9) for information about using
Unlocks index data.
If the method succeeds, the return value is
Retrieves a description of the index buffer resource.
Pointer to a
If the method succeeds, the return value is
This interface is implemented by the application to save any additional user data embedded in .x files. An instance of this interface is passed to
The LPD3DXSAVEUSERDATA type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXSAVEUSERDATA;
Add child data to the frame.
Pointer to a mesh container. See
Pointer to a .x file save object. Use the reference to call
Pointer to a .x file data node. Use the reference to call
The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return
Add child data to the mesh.
Pointer to a mesh container. See
Pointer to a .x file save object. Use the reference to call
Pointer to a .x file data node. Use the reference to call
The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return
Add a top level object before the frame hierarchy.
Pointer to a .x file save object. Use this reference to call IDirectXFileSaveObject::CreateDataObject to create the data object to be saved. Then call IDirectXFileSaveObject::SaveData to save the data.
The return values of this method are implemented by an application programmer. In general, if no error occurs, program the method to return
Add a top level object after the frame hierarchy.
Pointer to a .x file save object. Use this reference to call IDirectXFileSaveObject::CreateDataObject to create the data object to be saved. Then call IDirectXFileSaveObject::SaveData to save the data.
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
A callback for the user to register a .x file template.
Use this reference to register user-defined .x file templates. See
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
A callback for the user to save a .x file template.
Pointer to a .x file save object. Do not use this parameter to add data objects. See
The return values of this method are implemented by an application programmer.In general, if no error occurs, program the method to return
An application uses the methods of this interface to implement a key frame animation set.
Create a keyframed animation set with
The LPD3DXKEYFRAMEDANIMATIONSET type is defined as a reference to this interface.
typedef interface; typedef interface *LPD3DXKEYFRAMEDANIMATIONSET;
Gets the type of the animation set playback loop.
Gets the number of animation key frame ticks that occur per second.
Gets the number of callback keys in the animation set.
Gets the type of the animation set playback loop.
Type of the animation set playback loop. See
Gets the number of animation key frame ticks that occur per second.
Number of animation key frame ticks that occur per second.
Gets the number of scale keys in the specified key frame animation.
Animation index.
Number of scale keys in the specified key frame animation.
Fills an array with scale key data used for key frame animation.
Animation index.
Pointer to a user-allocated array of
If the method succeeds, the return value is
Get scale information for a specific key frame in the animation set.
Animation index.
Key frame.
Pointer to the scale data. See
If the method succeeds, the return value is
Set scale information for a specific key frame in the animation set.
Animation index.
Key frame.
Pointer to the scale data. See
If the method succeeds, the return value is
Gets the number of rotation keys in the specified key frame animation.
Animation index.
Number of rotation keys in the specified key frame animation.
Fills an array with rotational key data used for key frame animation.
Animation index.
Pointer to a user-allocated array of
If the method succeeds, the return value is
Get rotation information for a specific key frame in the animation set.
Animation index.
Key frame.
Pointer to the rotation data. See
If the method succeeds, the return value is
Set rotation information for a specific key frame in the animation set.
Animation index.
Key frame.
Pointer to the rotation data. See
If the method succeeds, the return value is
Gets the number of translation keys in the specified key frame animation.
Animation index.
Number of translation keys in the specified key frame animation.
Fills an array with translational key data used for key frame animation.
Animation index.
Pointer to a user-allocated array of
If the method succeeds, the return value is
Get translation information for a specific key frame in the animation set.
Animation index.
Key Frame.
Pointer to the rotation information. See
If the method succeeds, the return value is
Set translation information for a specific key frame in the animation set.
Animation index.
Key Frame.
Pointer to the translation data. See
If the method succeeds, the return value is
Gets the number of callback keys in the animation set.
Number of callback keys in the animation set.
Fills an array with callback key data used for key frame animation.
Pointer to a user-allocated array of
If the method succeeds, the return value is
Gets information about a specific callback in the animation set.
Animation index.
Pointer to the callback function.
If the method succeeds, the return value is
Sets information about a specific callback in the animation set.
Animation index.
Pointer to the callback function.
If the method succeeds, the return value is
Removes the scale data at the specified key frame.
Animation identifier.
Key frame.
If the method succeeds, the return value is
This method is slow and should not be used after an animation has begun to play.
Removes the rotation data at the specified key frame.
Animation identifier.
Key frame.
If the method succeeds, the return value is
This method is slow and should not be used after an animation has begun to play.
Removes the translation data at the specified key frame.
Animation identifier.
Key frame.
If the method succeeds, the return value is
This method is slow and should not be used after an animation has begun to play.
Register the scale, rotate, and translate (SRT) key frame data for an animation.
Pointer to the animation name.
Number of scale keys.
Number of rotation keys.
Number of translation keys.
Address of a reference to a user-allocated array of
Address of a reference to a user-allocated array of
Address of a reference to a user-allocated array of
Returns the animation index.
If the method succeeds, the return value is
Transforms animations in an animation set into a compressed format and returns a reference to the buffer that stores the compressed data.
One of the
Desired compression loss ratio, in the range from 0 to 1.
Pointer to a
Address of a reference to the
If the method succeeds, the return value is
Remove the animation data from the animation set.
The animation index.
If the method succeeds, the return value is
The
Create a line drawing object with
The LPD3DXLINE type is defined as a reference to the
typedef interface; typedef interface *LPD3DXLINE;
Retrieves the Direct3D device associated with the line object.
Gets or sets the line stipple pattern.
Gets or sets the stipple-pattern scale value.
Gets or sets the thickness of the line.
Gets or sets the line antialiasing state.
Gets or sets the OpenGL-style line-drawing mode.
Retrieves the Direct3D device associated with the line object.
Address of a reference to an
If the method succeeds, the return value is
Prepares a device for drawing lines.
If the method succeeds, the return value is
Calling
This method must be called from inside an
Draws a line strip in screen space. Input is in the form of an array that defines points (of
If the method succeeds, the return value is
Draws a line strip in screen space with a specified input transformation matrix.
Array of vertices that make up the line. See
Number of vertices in the vertex list.
A scale, rotate, and translate (SRT) matrix for transforming the points. See
Color of the line. See
If the method succeeds, the return value is
Applies a stipple pattern to the line.
Describes the stipple pattern: 1 is opaque, 0 is transparent.
If the method succeeds, the return value is
Gets the line stipple pattern.
Returns the line stipple pattern: 1 is opaque, 0 is transparent.
Stretches the stipple pattern along the line direction.
Stipple pattern scaling value. 1.0f is the default value and represents no scaling. A value less than 1.0f shrinks the pattern, and a value greater than 1.0 stretches the pattern.
If the method succeeds, the return value is
Gets the stipple-pattern scale value.
Returns the value used to scale the stipple-pattern. 1.0f is the default value and represents no scaling. A value less than 1.0f shrinks the pattern, and a value greater than 1.0 stretches the pattern.
Specifies the thickness of the line.
Describes the line width.
If the method succeeds, the return value is
Gets the thickness of the line.
The line thickness.
Toggles line antialiasing.
Toggles antialiasing on and off. TRUE turns antialiasing on, and
If the method succeeds, the return value is
Gets the line antialiasing state.
Returns the antialiasing switch value. TRUE means antialiasing is on, and
Toggles the mode to draw OpenGL-style lines.
Toggles OpenGL-style line drawing. TRUE enables OpenGL-style lines, and
If the method succeeds, the return value is
Gets the OpenGL-style line-drawing mode.
Returns TRUE if OpenGL-style lines are enabled, and
Restores the device state to how it was when
If the method succeeds, the return value is
Use this method to release all references to video memory resources and delete all stateblocks. This method should be called whenever a device is lost, or before resetting a device.
If the method succeeds, the return value is
This method should be called whenever the device is lost or before the user calls
Use this method to re-acquire resources and save initial state.
If the method succeeds, the return value is
Applications use the methods of the
To obtain the
This interface inherits additional functionality from the
The LPD3DXMESH type is defined as a reference to the
typedef struct*LPD3DXMESH;
Locks the mesh buffer that contains the mesh attribute data, and returns a reference to it.
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
Address of a reference to a buffer containing a DWORD for each face in the mesh.
If the method succeeds, the return value is
If
Unlocks an attribute buffer.
If the method succeeds, the return value is
Generates a new mesh with reordered faces and vertices to optimize drawing performance.
Specifies the type of optimization to perform. This parameter can be set to a combination of one or more flags from D3DXMESHOPT and D3DXMESH (except
Pointer to an array of three DWORDs per face that specifies the three neighbors for each face in the source mesh. If the edge has no adjacent faces, the value is 0xffffffff. See Remarks.
Pointer to an array of three DWORDs per face that specifies the three neighbors for each face in the optimized mesh. If the edge has no adjacent faces, the value is 0xffffffff.
An array of DWORDs, one per face, that identifies the original mesh face that corresponds to each face in the optimized mesh. If the value supplied for this argument is
Address of a reference to an
Address of a reference to an
If the method succeeds, the return value is
This method generates a new mesh. Before running Optimize, an application must generate an adjacency buffer by calling
This method is very similar to the
Generates a mesh with reordered faces and vertices to optimize drawing performance. This method reorders the existing mesh.
Combination of one or more D3DXMESHOPT flags, specifying the type of optimization to perform.
Pointer to an array of three DWORDs per face that specifies the three neighbors for each face in the source mesh. If the edge has no adjacent faces, the value is 0xffffffff.
Pointer to an array of three DWORDs per face that specifies the three neighbors for each face in the optimized mesh. If the edge has no adjacent faces, the value is 0xffffffff. If the value supplied for this argument is
An array of DWORDs, one per face, that identifies the original mesh face that corresponds to each face in the optimized mesh. If the value supplied for this argument is
Address of a reference to an
If the method succeeds, the return value is
Before running
Note??This method will fail if the mesh is sharing its vertex buffer with another mesh, unless the
Sets the attribute table for a mesh and the number of entries stored in the table.
Pointer to an array of
Number of attributes in the mesh attribute table.
If the method succeeds, the return value is
If an application keeps track of the information in an attribute table, and rearranges the table as a result of changes to attributes or faces, this method allows the application to update the attribute tables instead of calling
This interface encapsulates patch mesh functionality.
A patch mesh is a mesh that consists of a series of patches.
To obtain the
The LPD3DXPATCHMESH type is defined as a reference to the
typedef struct*LPD3DXPATCHMESH;
Gets the number of patches in the mesh.
Gets the number of vertices in the mesh.
Gets the number of control vertices per patch.
Gets the type of patch.
For more information about patch types, see
Gets the device that created the mesh.
Gets the mesh vertex buffer.
This method assumes uniform tessellation.
Gets the mesh index buffer.
The index buffer contains the vertex ordering in the vertex buffer. The index buffer is used to access the vertex buffer when the mesh is rendered.
Gets the number of patches in the mesh.
The number of patches.
Gets the number of vertices in the mesh.
The number of vertices.
Gets the vertex declaration.
Array of
If the method succeeds, the return value is
The array of elements includes the D3DDECL_END macro, which ends the declaration.
Gets the number of control vertices per patch.
The number of control vertices per patch.
Gets the type of patch.
The patch type.
For more information about patch types, see
Gets the device that created the mesh.
Pointer to the device.
If the method succeeds, the return value is
Gets the attributes of the patch.
Pointer to the structures containing the patch attributes. For more information about patch attributes, see
If the method succeeds, the return value is
Gets the mesh vertex buffer.
Pointer to the vertex buffer.
If the method succeeds, the return value is
This method assumes uniform tessellation.
Gets the mesh index buffer.
Pointer to the index buffer.
If the method succeeds, the return value is
The index buffer contains the vertex ordering in the vertex buffer. The index buffer is used to access the vertex buffer when the mesh is rendered.
Lock the vertex buffer.
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
VOID* reference to a memory buffer containing the returned vertex data.
If the method succeeds, the return value is
The vertex buffer is usually locked, written to, and then unlocked for reading.
Patch meshes use 16-bit index buffers.
Unlock the vertex buffer.
If the method succeeds, the return value is
The vertex buffer is usually locked, written to, and then unlocked for reading.
Lock the index buffer.
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
VOID* reference to a memory buffer containing the returned index data.
If the method succeeds, the return value is
The index buffer is usually locked, written to, and then unlocked for reading. Patch mesh index buffers are 16-bit buffers.
Unlock the index buffer.
If the method succeeds, the return value is
The index buffer is usually locked, written to, and then unlocked for reading.
Locks the attribute buffer.
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
Address of a reference to a buffer containing a DWORD for each face in the mesh.
If the method succeeds, the return value is
The attribute buffer is usually locked, written to, and then unlocked for reading.
Unlock the attribute buffer.
If the method succeeds, the return value is
The attribute buffer is usually locked, written to, and then unlocked for reading.
Gets the size of the tessellated mesh, given a tessellation level.
Tessellation level.
Adaptive tessellation. For adaptive tessellation, set this value to TRUE and set fTessLevel to the maximum tessellation value. This will result in the maximum mesh size necessary for adaptive tessellation.
Pointer to the number of triangles generated by the tessellated mesh.
Pointer to the number of vertices generated by the tessellated mesh.
If the method succeeds, the return value is
This method assumes uniform tessellation.
Generate a list of mesh edges and the patches that share each edge.
Specifies that vertices that differ in position by less than the tolerance should be treated as coincident.
If the method succeeds, the return value is
After an application generates adjacency information for a mesh, the mesh data can be optimized for better drawing performance. This method determines which patches are adjacent (within the provided tolerance). This information is used internally to optimize tessellation.
Creates a new patch mesh with the specified vertex declaration.
Combination of one or more D3DXMESH flags that specify creation options for the mesh.
Array of
Address of a reference to an
If the method succeeds, the return value is
CloneMesh converts the vertex buffer to the new vertex declaration. Entries in the vertex declaration that are new to the original mesh are set to 0. If the current mesh has adjacency, the new mesh will also have adjacency.
Optimizes the patch mesh for efficient tessellation.
Currently unused.
If the method succeeds, the return value is
After an application generates adjacency information for a mesh, the mesh data can be optimized (reordered) for better drawing performance. This method determines which patches are adjacent (within the provided tolerance).
Adjacency information is also used to optimize tessellation. Generate adjacency information once and tessellate repeatedly by calling
Sets mesh geometry displacement parameters.
Texture containing the displacement data.
Minification level. For more information, see
Magnification level. For more information, see
Mip filter level. For more information, see
Texture address wrap mode. For more information, see
Level of detail bias value.
If the method succeeds, the return value is
Displacement maps can only be 2D textures. Mipmapping is ignored for nonadaptive tessellation.
Gets mesh geometry displacement parameters.
Texture containing the displacement data.
Minification level. For more information, see
Magnification level. For more information, see
Mip filter level. For more information, see
Texture address wrap mode. For more information, see
Level of detail bias value.
If the method succeeds, the return value is
Displacement maps can only be 2D textures. Mipmapping is ignored for nonadaptive tessellation.
Performs uniform tessellation based on the tessellation level.
Tessellation level. This is the number of vertices introduced between existing vertices. The range of this float parameter is 0 < fTessLevel <= 32.
Resulting tessellated mesh. See
If the method succeeds, the return value is
This function will perform more efficiently if the patch mesh has been optimized using
Performs adaptive tessellation based on the z-based adaptive tessellation criterion.
Specifies a 4D vector that is dotted with the vertices to get the per-vertex adaptive tessellation amount. Each edge is tessellated to the average value of the tessellation levels for the two vertices it connects.
Maximum limit for adaptive tessellation. This is the number of vertices introduced between existing vertices. This integer value can range from 1 to 32, inclusive.
Minimum limit for adaptive tessellation. This is the number of vertices introduced between existing vertices. This integer value can range from 1 to 32, inclusive.
Resulting tessellated mesh. See
If the method succeeds, the return value is
This function will perform more efficiently if the patch mesh has been optimized using
Applications use the methods of the
The LPDIRECT3DPIXELSHADER9 and PDIRECT3DPIXELSHADER9 types are defined as references to the
typedef struct*LPDIRECT3DPIXELSHADER9, *PDIRECT3DPIXELSHADER9;
Gets the device.
Gets the device.
Pointer to the
If the method succeeds, the return value is
Gets a reference to the shader data.
Pointer to a buffer that contains the shader data. The application needs to allocate enough room for this.
Size of the data, in bytes. To get the buffer size that is needed to retrieve the data, set pData =
If the method succeeds, the return value is
Generates a new mesh with reordered faces and vertices to optimize drawing performance.
Specifies the type of optimization to perform. This parameter can be set to a combination of one or more flags from D3DXMESHOPT and D3DXMESH (except
Pointer to an array of three DWORDs per face that specifies the three neighbors for each face in the optimized mesh. If the edge has no adjacent faces, the value is 0xffffffff.
An array of DWORDs, one per face, that identifies the original mesh face that corresponds to each face in the optimized mesh. If the value supplied for this argument is
Address of a reference to an
Address of a reference to an
If the method succeeds, the return value is
This method generates a new mesh. Before running Optimize, an application must generate an adjacency buffer by calling
This method is very similar to the
Applications use the methods of the
The LPDIRECT3DQUERY9 and PDIRECT3DQUERY9 types are defined as references to the
typedef struct*LPDIRECT3DQUERY9, *PDIRECT3DQUERY9;
Gets the device that is being queried.
Gets the number of bytes in the query data.
Gets the device that is being queried.
Pointer to the device being queried. See
If the method succeeds, the return value is
Gets the query type.
Returns the query type. See
Gets the number of bytes in the query data.
Returns the number of bytes of query data.
Issue a query.
Query flags specify the type of state change for the query. See
If the method succeeds, the return value is
A signaled query means the query has completed, the data is available, and
Polls a queried resource to get the query state or a query result. For more information about queries, see Queries (Direct3D 9).
The return type identifies the query state (see Queries (Direct3D 9)). The method returns
It is possible to lose the device while polling for query status. When D3DGETDATA_FLUSH is specified, this method will return
An application must never write code that only invokes GetData ( ... , 0 ), expecting that GetData will eventually return
// Enables an infinite loop: while( pQuery->GetData( ... , 0 ) == S_FALSE ) ; // Still enables an infinite loop: pQuery->GetData( ... , D3DGETDATA_FLUSH ); while( pQuery->GetData( ... , 0 ) == S_FALSE ) ; // Does not enable an infinite loop because eventually the command // buffer will fill up and that will cause a flush to occur. while( pQuery->GetData( ..., 0 ) == S_FALSE ) { pDevice->SetTexture(...); pDevice->Draw(...); }
The
An environment map is used to texture-map scene geometry to provide a more sophisticated scene without using complex geometry. This interface supports creating surfaces for the following kinds of geometry: cube, half sphere or hemispheric, parabolic, or sphere.
The
The LPD3DXRenderToEnvMap type is defined as a reference to the
typedef interface; typedef interface *LPD3DXRenderToEnvMap;
Retrieves the Direct3D device associated with the environment map.
Retrieves the description of the render surface.
Retrieves the Direct3D device associated with the environment map.
Address of a reference to an
If the method succeeds, the return value is
Retrieves the description of the render surface.
Pointer to a
If the method succeeds, the return value is
Initiate the rendering of a cubic environment map.
Pointer to an
If the method succeeds, the return value is
See
Initiate the rendering of a spherical environment map.
Pointer to an
If the method succeeds, the return value is
See
Initiate the rendering of a hemispheric environment map.
Pointer to an
Pointer to an
If the method succeeds, the return value is
See
Initiate the rendering of a parabolic environment map.
Pointer to an
Pointer to an
If the function succeeds, the return value is
See
Initiate the drawing of each face of an environment map.
The first face of the environmental cube map. See
A valid combination of one or more
If the method succeeds, the return value is
This method must be called once for each type of environment map. The only exception is a cubic environment map which requires this method to be called six times, once for each face in
Restore all render targets and, if needed, compose all the rendered faces into the environment map surface.
A valid combination of one or more
If the method succeeds, the return value is
Use this method to release all references to video memory resources and delete all stateblocks. This method should be called whenever a device is lost, or before resetting a device.
If the method succeeds, the return value is
This method should be called whenever the device is lost or before the user calls
Use this method to re-acquire resources and save initial state.
If the method succeeds, the return value is
The
Surfaces can be used in a variety of ways including render targets, off-screen rendering, or rendering to textures.
A surface can be configured using a separate viewport using the
The
The LPD3DXRENDERTOSURFACE type is defined as a reference to the
typedef interface; typedef interface *LPD3DXRENDERTOSURFACE;
Retrieves the Direct3D device associated with the render surface.
Retrieves the parameters of the render surface.
Retrieves the Direct3D device associated with the render surface.
Address of a reference to an
If the method succeeds, the return value is
Retrieves the parameters of the render surface.
Pointer to a
If the method succeeds, the return value is
Begins a scene.
Pointer to an
Pointer to a
If the method succeeds, the return value is
Ends a scene.
Filter options, enumerated in
If the method succeeds, the return value is
Use this method to release all references to video memory resources and delete all stateblocks. This method should be called whenever a device is lost or before resetting a device.
If the method succeeds, the return value is
This method should be called whenever the device is lost or before the user calls
Use this method to re-acquire resources and save initial state.
If the method succeeds, the return value is
Pointer to an
Width of the render surface, in pixels.
Height of the render surface, in pixels.
Member of the
If TRUE, the render surface supports a depth-stencil surface. Otherwise, this member is set to
If DepthStencil is set to TRUE, this parameter is a member of the
Applications use the methods of the
To create a texture resource, you can call one of the following methods.
To create a geometry-oriented resource, you can call one of the following methods.
This interface, like all COM interfaces, inherits from the
The LPDIRECT3DRESOURCE9 and PDIRECT3DRESOURCE9 types are defined as references to the
typedef struct*LPDIRECT3DRESOURCE9, *PDIRECT3DRESOURCE9;
Retrieves the device associated with a resource.
This method allows navigation to the owning device object.
Calling this method will increase the internal reference count on the
Retrieves the priority for this resource.
Priorities are used to determine when managed resources are to be removed from memory. A resource assigned a low priority is removed before a resource with a high priority. If two resources have the same priority, the resource that was used more recently is kept in memory; the other resource is removed. Managed resources have a default priority of 0.
Returns the type of the resource.
Retrieves the device associated with a resource.
Address of a reference to an
If the method succeeds, the return value is
This method allows navigation to the owning device object.
Calling this method will increase the internal reference count on the
Associates data with the resource that is intended for use by the application, not by Direct3D. Data is passed by value, and multiple sets of data can be associated with a single resource.
Reference to the globally unique identifier that identifies the private data to set.
Pointer to a buffer that contains the data to be associated with the resource.
Size of the buffer at pData, in bytes.
Value that describes the type of data being passed, or indicates to the application that the data should be invalidated when the resource changes.
Item | Description |
---|---|
(none) | If no flags are specified, Direct3D allocates memory to hold the data within the buffer and copies the data into the new buffer. The buffer allocated by Direct3D is automatically freed, as appropriate. |
D3DSPD_IUNKNOWN | The data at pData is a reference to an |
?
If the method succeeds, the return value is
Direct3D does not manage the memory at pData. If this buffer was dynamically allocated, it is the calling application's responsibility to free the memory.
Copies the private data associated with the resource to a provided buffer.
The globally unique identifier that identifies the private data to retrieve.
Pointer to a previously allocated buffer to fill with the requested private data if the call succeeds. The application calling this method is responsible for allocating and releasing this buffer. If this parameter is
Pointer to the size of the buffer at pData, in bytes. If this value is less than the actual size of the private data (such as 0), the method sets this parameter to the required buffer size and the method returns
If the method succeeds, the return value is
This method is inherited by the following interfaces:
Frees the specified private data associated with this resource.
Reference to the globally unique identifier that identifies the private data to free.
If the method succeeds, the return value is
Direct3D calls this method automatically when a resource is released.
Assigns the priority of a resource for scheduling purposes.
Priority to assign to a resource.
Differences between Direct3D 9 and Direct3D 9 for Windows Vista The priority can be any DWORD value; Direct3D 9 for Windows Vista also supports any of these pre-defined values D3D9_RESOURCE_PRIORITY. |
?
Returns the previous priority value for the resource.
This method is used to change the priority of managed resources (resources created with the
Priorities are used to determine when managed resources are to be removed from memory. A resource assigned a low priority is removed before a resource with a high priority. If two resources have the same priority, the resource that was used more recently is kept in memory; the other resource is removed. Managed resources have a default priority of 0.
Windows Vista only - When this method is called using an
Retrieves the priority for this resource.
Returns a DWORD value, indicating the priority of the resource.
Priorities are used to determine when managed resources are to be removed from memory. A resource assigned a low priority is removed before a resource with a high priority. If two resources have the same priority, the resource that was used more recently is kept in memory; the other resource is removed. Managed resources have a default priority of 0.
Preloads a managed resource.
Calling this method indicates that the application will need this managed resource shortly. This method has no effect on nonmanaged resources.
Returns the type of the resource.
Returns a member of the
Gets the maximum number of influences for any vertex in the mesh.
Gets the number of bones.
Gets or sets the minimum bone influence. Influence values smaller than this are ignored.
Gets or sets the fixed function vertex value.
This method can return 0 if the vertex format cannot be mapped directly to an FVF code. This will occur for a mesh created from a vertex declaration that doesn't have the same order and elements supported by the FVF codes.
Sets the influence value for a bone.
Bone number.
Number of influences.
The array of vertices influenced by a bone.
The array of weights influenced by a bone.
If the method succeeds, the return value is
Sets an influence value of a bone on a single vertex.
Index of the bone. Must be between 0 and the number of bones.
Index of the influence array of the specified bone.
Blend factor of the specified bone influence.
If the method succeeds, the return value is
Gets the number of influences for a bone.
Bone number.
Returns the number of influences for a bone.
Gets the vertices and weights that a bone influences.
Bone number.
Get the array of vertices influenced by a bone.
Get the array of weights influenced by a bone.
If the method succeeds, the return value is
Use
Retrieves the blend factor and vertex affected by a specified bone influence.
Index of the bone. Must be between 0 and the number of bones.
Index of the influence array of the specified bone.
Pointer to the blend factor influenced by influenceNum.
Pointer to the vertex influenced by influenceNum.
If the method succeeds, the return value is
Gets the maximum number of influences for any vertex in the mesh.
Pointer to the maximum vertex influence.
If the method succeeds, the return value is
Gets the number of bones.
Returns the number of bones.
Retrieves the index of the bone influence affecting a single vertex.
Index of the bone. Must be between 0 and the number of bones.
Index of the vertex for which the bone influence is to be found. Must be between 0 and the number of vertices in the mesh.
Pointer to the index of the bone influence that affects vertexNum.
If the method succeeds, the return value is
Gets the maximum face influences in a triangle mesh with the specified index buffer.
Pointer to the index buffer that contains the mesh index data.
Number of faces in the mesh.
Pointer to the maximum face influences.
If the method succeeds, the return value is
Sets the minimum bone influence. Influence values smaller than this are ignored.
Minimum influence value. Influence values smaller than this are ignored.
If the method succeeds, the return value is
Gets the minimum bone influence. Influence values smaller than this are ignored.
Returns the minimum bone influence value.
Sets the bone name.
Bone number
Bone name
If the method succeeds, the return value is
Bone names are returned by
Gets the bone name, from the bone index.
Bone number.
Returns the bone name. Do not free this string.
Sets the bone offset matrix.
Bone number.
Pointer to the bone offset matrix.
If the method succeeds, the return value is
Bone names are returned by
Gets the bone offset matrix.
Bone number.
Returns a reference to the bone offset matrix. Do not free this reference.
Clones a skin info object.
Address of a reference to an
If the method succeeds, the return value is
Updates bone influence information to match vertices after they are reordered. This method should be called if the target vertex buffer has been reordered externally.
Number of vertices to remap.
Array of DWORDS whose length is specified by NumVertices.
If the method succeeds, the return value is
Each element in pVertexRemap specifies the previous vertex index for that position. For example, if a vertex was in position 3 but has been remapped to position 5, then the fifth element of pVertexRemap should contain 3. The vertex remap array returned by
Sets the flexible vertex format (FVF) type.
Flexible vertex format. See
If the method succeeds, the return value is
Sets the vertex declaration.
Pointer to an array of
If the method succeeds, the return value is
Gets the fixed function vertex value.
Returns the flexible vertex format (FVF) codes.
This method can return 0 if the vertex format cannot be mapped directly to an FVF code. This will occur for a mesh created from a vertex declaration that doesn't have the same order and elements supported by the FVF codes.
Gets the vertex declaration.
Array of
If the method succeeds, the return value is
The array of elements includes the D3DDECL_END macro, which ends the declaration.
Applies software skinning to the target vertices based on the current matrices.
Bone transform matrix.
Inverse transpose of the bone transform matrix.
Pointer to the buffer containing the source vertices.
Pointer to the buffer containing the destination vertices.
If the method succeeds, the return value is
When used to skin vertices with two position elements, this method skins the second position element with the inverse of the bone instead of the bone itself.
Takes a mesh and returns a new mesh with per-vertex blend weights and a bone combination table. The table describes which bones affect which subsets of the mesh.
Input mesh. See
Currently unused.
Input mesh adjacency information.
Output mesh adjacency information.
An array of DWORDs, one per face, that identifies the original mesh face that corresponds to each face in the blended mesh. If the value supplied for this argument is
Address of a reference to an
Pointer to a DWORD that will contain the maximum number of bone influences required per vertex for this skinning method.
Pointer to the number of bones in the bone combination table.
Pointer to the bone combination table. The data is organized in a
Pointer to the new mesh.
If the method succeeds, the return value is
Each element in the remap array specifies the previous index for that position. For example, if a vertex was in position 3 but has been remapped to position 5, then the fifth element of pVertexRemap will contain 3.
This method does not run on hardware that does not support fixed-function vertex blending.
Takes a mesh and returns a new mesh with per-vertex blend weights, indices, and a bone combination table. The table describes which bone palettes affect which subsets of the mesh.
The input mesh. See
Currently unused.
Number of bone matrices available for matrix palette skinning.
Input mesh adjacency information.
Output mesh adjacency information.
An array of DWORDs, one per face, that identifies the original mesh face that corresponds to each face in the blended mesh. If the value supplied for this argument is
Address of a reference to an
Pointer to a DWORD that will contain the maximum number of bone influences required per vertex for this skinning method.
Pointer to the number of bones in the bone combination table.
Pointer to the bone combination table. The data is organized in a
Pointer to the new mesh.
If the method succeeds, the return value is
Each element in the remap arrays specifies the previous index for that position. For example, if a vertex was in position 3 but has been remapped to position 5, then the fifth element of pVertexRemap will contain 3.
This method does not run on hardware that does not support fixed-function vertex blending.
The
The
The application typically first calls
The LPD3DXSPRITE type is defined as a reference to the
typedef interface; typedef interface *LPD3DXSPRITE;
Retrieves the device associated with the sprite object.
Calling this method will increase the internal reference count on the
Gets or sets the sprite transform.
Retrieves the device associated with the sprite object.
Address of a reference to an
If the method succeeds, the return value is
Calling this method will increase the internal reference count on the
Gets the sprite transform.
Pointer to a
If the method succeeds, the return value is
Sets the sprite transform.
Pointer to a
If the method succeeds, the return value is
Sets the right-handed world-view transform for a sprite. A call to this method is required before billboarding or sorting sprites.
Pointer to a
Pointer to a
If the method succeeds, the return value is
A call to this method (or to
Sets the left-handed world-view transform for a sprite. A call to this method is required before billboarding or sorting sprites.
Pointer to a
Pointer to a
If the method succeeds, the return value is
A call to this method (or to
Prepares a device for drawing sprites.
Combination of zero or more flags that describe sprite rendering options. For this method, the valid flags are:
For a description of the flags and for information on how to control device state capture and device view transforms, see
If the method succeeds, the return value is
This method must be called from inside a
This method will set the following states on the device.
Render States:
Type ( | Value |
---|---|
TRUE | |
0x00 | |
AlphaCmpCaps | |
TRUE | |
0 |
?
Texture Stage States:
Stage Identifier | Type ( | Value |
---|---|---|
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | ||
0 | 0 | |
0 | ||
1 | ||
1 |
?
Sampler States:
Sampler Stage Index | Type ( | Value |
---|---|---|
0 | ||
0 | ||
0 | ||
0 | 0 | |
0 | MaxAnisotropy | |
0 | ||
0 | ||
0 | 0 | |
0 | 0 |
?
Note??This method disables N-patches.
Adds a sprite to the list of batched sprites.
Pointer to an
Pointer to a
Pointer to a
Pointer to a
If the method succeeds, the return value is
To scale, rotate, or translate a sprite, call
Forces all batched sprites to be submitted to the device. Device states remain as they were after the last call to
If the method succeeds, the return value is
Calls
If the method succeeds, the return value is
Use this method to release all references to video memory resources and delete all stateblocks. This method should be called whenever a device is lost or before resetting a device.
If the method succeeds, the return value is
This method should be called whenever the device is lost or before the user calls
Use this method to re-acquire resources and save initial state.
If the method succeeds, the return value is
Adds a sprite to the list of batched sprites.
Pointer to an
If the method succeeds, the return value is
To scale, rotate, or translate a sprite, call
Adds a sprite to the list of batched sprites.
Pointer to an
Pointer to a
Pointer to a
Pointer to a
If the method succeeds, the return value is
To scale, rotate, or translate a sprite, call
Applications use the methods of the
This interface can be used to save and restore pipeline state. It can also be used to capture the current state.
The LPDIRECT3DSTATEBLOCK9 and PDIRECT3DSTATEBLOCK9 types are defined as references to the
typedef struct*LPDIRECT3DSTATEBLOCK9, *PDIRECT3DSTATEBLOCK9;
Gets the device.
Gets the device.
Pointer to the
If the method succeeds, the return value is
Capture the current value of states that are included in a stateblock.
If the method succeeds, the return value is
The Capture method captures current values for states within an existing state block. It does not capture the entire state of the device. For example:
* pStateBlock = null ; pd3dDevice->BeginStateBlock(); // Add the ZENABLE state to the stateblock pd3dDevice->SetRenderState (, ); pd3dDevice->EndStateBlock ( &pStateBlock ); // Change the current value that is stored in the state block pd3dDevice->SetRenderState ( , ); pStateBlock->Capture(); pStateBlock->Release();
Creating an empty stateblock and calling the Capture method does nothing if no states have been set.
The Capture method will not capture information for lights that are explicitly or implicitly created after the stateblock is created.
Apply the state block to the current device state.
If the method succeeds, the return value is
Applications use the methods of the
The LPDIRECT3DSURFACE9 and PDIRECT3DSURFACE9 types are defined as references to the
typedef struct*LPDIRECT3DSURFACE9, *PDIRECT3DSURFACE9;
Retrieves a description of the surface.
Provides access to the parent cube texture or texture (mipmap) object, if this surface is a child level of a cube texture or a mipmap. This method can also provide access to the parent swap chain if the surface is a back-buffer child.
Reference identifier of the container being requested.
Address of a reference to fill with the container reference if the query succeeds. See Remarks.
If the method succeeds, the return value is
If the surface is created using CreateRenderTarget or CreateOffscreenPlainSurface or CreateDepthStencilSurface, the surface is considered stand alone. In this case, GetContainer will return the Direct3D device used to create the surface.
If the call succeeds, the reference count of the container is increased by one.
Here's an example getting the parent texture of a mip surface.
// Assumes pSurface is a validreference void *pContainer = null ;*pTexture = null ;hr = pSurface->GetContainer(IID_IDirect3DTexture9, &pContainer); if (SUCCEEDED(hr) && pContainer) { pTexture = ( *)pContainer; }
Retrieves a description of the surface.
Pointer to a
If the method succeeds, the return value is
Locks a rectangle on a surface.
Pointer to a
Pointer to a rectangle to lock. Specified by a reference to a
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
You may not specify a subrect when using
If the method succeeds, the return value is
If the method fails, the return value can be
If the
The only lockable format for a depth-stencil surface is
For performance reasons, dirty regions are recorded only for level zero of a texture. Dirty regions are automatically recorded when
A multisample back buffer cannot be locked.
This method cannot retrieve data from a surface that is is contained by a texture resource created with
Unlocks a rectangle on a surface.
If the method succeeds, the return value is
Retrieves a device context.
Pointer to the device context for the surface.
The following restrictions apply.
When a device context is outstanding on a surface, the application may not call these methods:
| |
| |
| |
| |
| |
| |
| |
|
?
* (on a swap chain that contains the surface)
It is valid to call
The hdc provides access to Win32 and GDI functionality.
Release a device context handle.
Handle to a device context.
If the method succeeds, the return value is
An hdc is a Windows resource. It must be released after use so Windows can return it to the pool of available resources.
This method will release only the device context returned by
Presents the contents of the next buffer in the sequence of back buffers owned by the swap chain.
The Present method is a shortcut to Present. Present has been updated to take a flag allowing the application to request that the method return immediately when the driver reports that it cannot schedule a presentation.
If necessary, a stretch operation is applied to transfer the pixels within the source rectangle to the destination rectangle in the client area of the target window.
Present will fail if called between BeginScene and EndScene pairs unless the render target is not the current render target (such as the back buffer you get from creating an additional swap chain). This is a new behavior for Direct3D 9.
Returns information describing the raster of the monitor on which the swap chain is presented.
Retrieves the display mode's spatial resolution, color resolution, and refresh frequency.
Retrieves the device associated with the swap chain.
This method allows navigation to the owning device object.
Calling this method will increase the internal reference count on the
Retrieves the presentation parameters associated with a swap chain.
This method can be used to see the presentation parameters of the parent swap chain of a surface (a back buffer, for instance). The parent swap chain can be retrieved with
Presents the contents of the next buffer in the sequence of back buffers owned by the swap chain.
Pointer to the source rectangle (see
Pointer to the destination rectangle in client coordinates (see
Destination window whose client area is taken as the target for this presentation. If this value is
This value must be
Allows the application to request that the method return immediately when the driver reports that it cannot schedule a presentation. Valid values are 0, or any combination of
If the method succeeds, the return value is
The Present method is a shortcut to Present. Present has been updated to take a flag allowing the application to request that the method return immediately when the driver reports that it cannot schedule a presentation.
If necessary, a stretch operation is applied to transfer the pixels within the source rectangle to the destination rectangle in the client area of the target window.
Present will fail if called between BeginScene and EndScene pairs unless the render target is not the current render target (such as the back buffer you get from creating an additional swap chain). This is a new behavior for Direct3D 9.
Generates a copy of the swapchain's front buffer and places that copy in a system memory buffer provided by the application.
Pointer to an
If the method succeeds, the return value is
Calling this method will increase the internal reference count on the
Retrieves a back buffer from the swap chain of the device.
Index of the back buffer object to return. Back buffers are numbered from 0 to the total number of back buffers - 1. A value of 0 returns the first back buffer, not the front buffer. The front buffer is not accessible through this method. Use
Stereo view is not supported in Direct3D 9, so the only valid value for this parameter is
Address of a reference to an
Calling this method will increase the internal reference count on the
Returns information describing the raster of the monitor on which the swap chain is presented.
Pointer to a
If the method succeeds, the return value is
Retrieves the display mode's spatial resolution, color resolution, and refresh frequency.
Pointer to a
If the method succeeds, the return value is
Retrieves the device associated with the swap chain.
Address of a reference to an
If the method succeeds, the return value is
This method allows navigation to the owning device object.
Calling this method will increase the internal reference count on the
Retrieves the presentation parameters associated with a swap chain.
Pointer to the presentation parameters. See
If the method succeeds, the return value is
This method can be used to see the presentation parameters of the parent swap chain of a surface (a back buffer, for instance). The parent swap chain can be retrieved with
Applications use the methods of the
There is always at least one swap chain for each device, known as the implicit swap chain. However, an additional swap chain for rendering multiple views from the same device can be created by calling the CreateAdditionalSwapChain method.
This interface, like all COM interfaces, inherits from the
The LPDIRECT3DSWAPCHAIN9 and PDIRECT3DSWAPCHAIN9 types are defined as references to the
Returns the number of times the swapchain has been processed.
Returns the number of times the swapchain has been processed.
Pointer to a UINT to be filled with the number of times the
Retrieves the display mode's spatial resolution, color resolution, refresh frequency, and rotation settings.
Pointer to a
Pointer to a
If the method succeeds, the return value is
Applications use the methods of the
The
This interface inherits additional functionality from the
This interface, like all COM interfaces, inherits from the
The LPDIRECT3DTEXTURE9 and PDIRECT3DTEXTURE9 types are defined as references to the
typedef struct*LPDIRECT3DTEXTURE9, *PDIRECT3DTEXTURE9;
Retrieves a level description of a texture resource.
Identifies a level of the texture resource. This method returns a surface description for the level specified by this parameter.
Pointer to a
Retrieves the specified texture surface level.
Identifies a level of the texture resource. This method returns a surface for the level specified by this parameter. The top-level surface is denoted by 0.
Address of a reference to an
Calling this method will increase the internal reference count on the
Locks a rectangle on a texture resource.
Specifies the level of the texture resource to lock.
Pointer to a
Pointer to a rectangle to lock. Specified by a reference to a
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
You may not specify a subrect when using
If the method succeeds, the return value is
Textures created with
For performance reasons, dirty regions are recorded only for level zero of a texture. Dirty regions are automatically recorded when
The only lockable format for a depth-stencil texture is D3DLOCK_D16_LOCKABLE.
Video memory textures cannot be locked, but must be modified by calling
This method cannot retrieve data from a texture resource created with
Unlocks a rectangle on a texture resource.
Specifies the level of the texture resource to unlock.
If the method succeeds, the return value is
Adds a dirty region to a texture resource.
Pointer to a
If the method succeeds, the return value is
For performance reasons, dirty regions are only recorded for level zero of a texture. For sublevels, it is assumed that the corresponding (scaled) rectangle or box is also dirty. Dirty regions are automatically recorded when
Using
The
The
The
The LPD3DXTEXTURESHADER type is defined as a reference to the
typedef interface*LPD3DXTEXTURESHADER;
Gets a reference to the function DWORD stream.
Get a reference to the constant table.
Gets a description of the constant table.
Gets a reference to the function DWORD stream.
A reference to the function DWORD stream. See
If the method succeeds, the return value is
Get a reference to the constant table.
Pointer to an
If the method succeeds, the return value is
Gets a description of the constant table.
The attributes of the constant table. See
If the method succeeds, the return value is
Gets a reference to the array of constants in the constant table.
Unique identifier to a constant. See
Returns a reference to an array of descriptions. See
The input supplied must be the maximum size of the array. The output is the number of elements that are filled in the array when the function returns.
If the method succeeds, the return value is
Samplers can appear more than once in a constant table, therefore, this method can return an array of descriptions each with a different register index.
Gets a constant by looking up its index.
A handle to the parent data structure. If the constant is a top-level parameter (there is no parent data structure), use
Zero-based index of the constant.
Returns a unique identifier to the constant.
To get a constant from an array of constants, use
Gets a constant by looking up its name.
A handle to the parent data structure. If the constant is a top-level parameter (there is no parent data structure), use
A string containing the name of the constant.
Returns a unique identifier to the constant.
Get a constant from the constant table.
A handle to the array of constants. This value may not be
Zero-based index of the element in the constant table.
Returns a unique identifier to the constant.
To get a constant that is not part of an array, use
Sets the constants to the default values declared in the shader.
If the method succeeds, the return value is
Sets the constant table with the data in the buffer.
Unique identifier to a constant. See
A reference to a buffer containing the constant data.
Size of the buffer, in bytes.
If the method succeeds, the return value is
Sets a
Unique identifier to the constant. See
If the method succeeds, the return value is
Sets an array of
Unique identifier to the array of constants. See
Array of
Number of
If the method succeeds, the return value is
Sets an integer value.
Unique identifier to the constant. See
Integer value.
If the method succeeds, the return value is
Sets an array of integers.
Unique identifier to the array of constants. See
Array of integers.
Number of integers in the array.
If the method succeeds, the return value is
Sets a floating-point number.
Unique identifier to the constant. See
Floating-point number.
If the method succeeds, the return value is
Sets an array of floating-point numbers.
Unique identifier to the array of constants. See
Array of floating-point numbers.
Number of floating-point values in the array.
If the method succeeds, the return value is
Sets a 4D vector.
Unique identifier to the vector constant. See
Pointer to a 4D vector. See
If the method succeeds, the return value is
Sets an array of 4D vectors.
Unique identifier to the array of vector constants. See
Array of 4D vectors. See
Number of vectors in the array.
If the method succeeds, the return value is
Sets a non-transposed matrix.
Unique identifier to the matrix of constants. See
Pointer to a non-transposed matrix. See
If the method succeeds, the return value is
A non-transposed matrix contains row-major data; that is, each vector is contained in a row.
Sets an array of non-transposed matrices.
Unique identifier to the array of constant matrices. See
Array of non-transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A non-transposed matrix contains row-major data; that is, each vector is contained in a row.
Sets an array of references to non-transposed matrices.
Unique identifier to an array of constant matrices. See
Array of references to non-transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A non-transposed matrix contains row-major data; that is, each vector is contained in a row.
Sets a transposed matrix.
Unique identifier to the matrix of constants. See
Pointer to a transposed matrix. See
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
Sets an array of transposed matrices.
Unique identifier to the array of matrix constants. See
Array of transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
Sets an array of references to transposed matrices.
Unique identifier to the array of matrix constants. See
Array of references to transposed matrices. See
Number of matrices in the array.
If the method succeeds, the return value is
A transposed matrix contains column-major data; that is, each vector is contained in a column.
Applications use the methods of the
The
This interface inherits additional functionality from the
This interface, like all COM interfaces, inherits from the
The LPDIRECT3DVERTEXBUFFER9 and PDIRECT3DVERTEXBUFFER9 types are defined as references to the
typedef struct*LPDIRECT3DVERTEXBUFFER9, *PDIRECT3DVERTEXBUFFER9;
Retrieves a description of the vertex buffer resource.
Locks a range of vertex data and obtains a reference to the vertex buffer memory.
Offset into the vertex data to lock, in bytes. To lock the entire vertex buffer, specify 0 for both parameters, SizeToLock and OffsetToLock.
Size of the vertex data to lock, in bytes. To lock the entire vertex buffer, specify 0 for both parameters, SizeToLock and OffsetToLock.
VOID* reference to a memory buffer containing the returned vertex data.
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
If the method succeeds, the return value is
As a general rule, do not hold a lock across more than one frame. When working with vertex buffers, you are allowed to make multiple lock calls; however, you must ensure that the number of lock calls match the number of unlock calls. DrawPrimitive calls will not succeed with any outstanding lock count on any currently set vertex buffer.
The
For information about using
Unlocks vertex data.
If the method succeeds, the return value is
Retrieves a description of the vertex buffer resource.
Pointer to a
If the method succeeds, the return value is
Applications use the methods of the
A vertex shader declaration is made up of an array of vertex elements.
The LPDIRECT3DVERTEXDECLARATION9 and PDIRECT3DVERTEXDECLARATION9 types are defined as references to the
typedef struct*LPDIRECT3DVERTEXDECLARATION9, *PDIRECT3DVERTEXDECLARATION9;
Gets the current device.
Gets the current device.
Pointer to the
If the method succeeds, the return value is
Gets the vertex shader declaration.
Array of vertex elements (see
Number of elements in the array. The application needs to allocate enough room for this.
If the method succeeds, the return value is
The number of elements, pNumElements, includes the D3DDECL_END macro, which ends the declaration. So the element count is actually one higher than the number of valid vertex elements.
Here's an example that will return the vertex declaration array of up to 256 elements:
decl[MAXD3DDECLLENGTH]; UINT numElements; hr = m_pVertexDeclaration->GetDeclaration( decl, &numElements);
Specify
Applications use the methods of the
The LPDIRECT3DVERTEXSHADER9 and PDIRECT3DVERTEXSHADER9 types are defined as references to the
typedef struct*LPDIRECT3DVERTEXSHADER9, *PDIRECT3DVERTEXSHADER9;
Gets the device.
Gets the device.
Pointer to the
If the method succeeds, the return value is
Gets a reference to the shader data.
Pointer to a buffer that contains the shader data. The application needs to allocate enough room for this.
Size of the data, in bytes. To get the buffer size that is needed to retrieve the data, set pData =
If the method succeeds, the return value is
Applications use the methods of the
The
This interface, like all COM interfaces, inherits from the
The LPDIRECT3DVOLUME9 and PDIRECT3DVOLUME9 types are defined as references to the
typedef struct*LPDIRECT3DVOLUME9, *PDIRECT3DVOLUME9;
Retrieves the device associated with a volume.
This method allows navigation to the owning device object.
Calling this method will increase the internal reference count on the
Retrieves a description of the volume.
Retrieves the device associated with a volume.
Address of a reference to an
If the method succeeds, the return value is
This method allows navigation to the owning device object.
Calling this method will increase the internal reference count on the
Associates data with the volume that is intended for use by the application, not by Direct3D.
Reference to the globally unique identifier that identifies the private data to set.
Pointer to a buffer that contains the data to associate with the volume.
Size of the buffer at pData in bytes.
Value that describes the type of data being passed, or indicates to the application that the data should be invalidated when the resource changes.
Item | Description |
---|---|
(none) | If no flags are specified, Direct3D allocates memory to hold the data within the buffer and copies the data into the new buffer. The buffer allocated by Direct3D is automatically freed, as appropriate. |
D3DSPD_IUNKNOWN | The data at pData is a reference to an |
?
If the method succeeds, the return value is
Direct3D does not manage the memory at pData. If this buffer was dynamically allocated, it is the calling application's responsibility to free the memory.
Data is passed by value, and multiple sets of data can be associated with a single volume.
Copies the private data associated with the volume to a provided buffer.
Reference to (C++) or address of (C) the globally unique identifier that identifies the private data to retrieve.
Pointer to a previously allocated buffer to fill with the requested private data if the call succeeds. The application calling this method is responsible for allocating and releasing this buffer. If this parameter is
Pointer to the size of the buffer at pData, in bytes. If this value is less than the actual size of the private data, such as 0, the method sets this parameter to the required buffer size, and the method returns
If the method succeeds, the return value is
Frees the specified private data associated with this volume.
Reference to the globally unique identifier that identifies the private data to free.
If the method succeeds, the return value is
Direct3D calls this method automatically when a volume is released.
Provides access to the parent volume texture object, if this surface is a child level of a volume texture.
Reference identifier of the volume being requested.
Address of a reference to fill with the container reference, if the query succeeds.
If the method succeeds, the return value is
If the call succeeds, the reference count of the container is increased by one.
Here's an example getting the parent volume texture of a volume texture.
// Assumes pSurface is a validreference void *pContainer = null ;*pVolumeTexture = null ;hr = pVolume->GetContainer(IID_IDirect3DVolumeTexture9, &pContainer); if (SUCCEEDED(hr) && pContainer) { pVolumeTexture = ( *)pContainer;
Retrieves a description of the volume.
Pointer to a
If the method succeeds, the return value is
Locks a box on a volume resource.
Pointer to a
Pointer to a box to lock. Specified by a reference to a
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
If the method succeeds, the return value is
For performance reasons, dirty regions are only recorded for level zero of a texture. Dirty regions are automatically recorded when
Unlocks a box on a volume resource.
If the method succeeds, the return value is
Applications use the methods of the
The
This interface inherits additional functionality from the
This interface, like all COM interfaces, inherits from the
The LPDIRECT3DVOLUMETEXTURE9 and PDIRECT3DVOLUMETEXTURE9 types are defined as references to the
typedef struct*LPDIRECT3DVOLUMETEXTURE9, *PDIRECT3DVOLUMETEXTURE9;
Retrieves a level description of a volume texture resource.
Identifies a level of the volume texture resource. This method returns a volume description for the level specified by this parameter.
Pointer to a
Retrieves the specified volume texture level.
Identifies a level of the volume texture resource. This method returns a volume for the level specified by this parameter.
Address of a reference to an
Calling this method will increase the internal reference count on the
Locks a box on a volume texture resource.
Specifies the level of the volume texture resource to lock.
Pointer to a
Pointer to the volume to lock. This parameter is specified by a reference to a
Combination of zero or more locking flags that describe the type of lock to perform. For this method, the valid flags are:
For a description of the flags, see
If the method succeeds, the return value is
For performance reasons, dirty regions are only recorded for level zero of a texture. Dirty regions are automatically recorded when LockBox is called without
Unlocks a box on a volume texture resource.
Specifies the level of the volume texture resource to unlock.
If the method succeeds, the return value is
Adds a dirty region to a volume texture resource.
Pointer to a
If the method succeeds, the return value is
For performance reasons, dirty regions are only recorded for level zero of a texture. For sublevels, it is assumed that the corresponding (scaled) box is also dirty. Dirty regions are automatically recorded when LockBox is called without
Using
Applications use the methods of the
An
The
The globally unique identifier (
The LPD3DXFILE type is defined as a reference to the
typedef interface*LPD3DXFILE;
Creates an enumerator object that will read a .x file.
The data source. Either:
Depending on the value of loadflags.
Value that specifies the source of the data. This value can be one of the D3DXF_FILELOADOPTIONS flags.
Address of a reference to an
If the method succeeds, the return value is
After using this method, use one of the
Creates a save object that will be used to save data to a .x file.
Pointer to the name of the file to use for saving data.
Value that specifies the name of the file to which data is to be saved. This value can be one of the File Save Options flags.
Indicates the format to use when saving the .x file. This value can be one of the File Formats flags. For more information, see Remarks.
Address of a reference to an
If the method succeeds, the return value is
After using this method, use methods of the
For the saved file format dwFileFormat, one of the binary, legacy binary, or text flags in File Formats must be specified. The file can be compressed by using the optional
The file format values can be combined in a logical OR to create compressed text or compressed binary files. If you indicate that the file format should be text and compressed, the file will be written out first as text and then compressed. However, compressed text files are not as efficient as binary text files; in most cases, therefore, you will want to indicate binary and compressed.
Registers custom templates.
Pointer to a buffer consisting of a .x file in text or binary format that contains templates.
Size of the buffer pointed to by pvData, in bytes.
If the method succeeds, the return value is
The following code fragment provides an example call to RegisterTemplates And example contents for the buffer to which pvData points.
#define XSKINEXP_TEMPLATES \ "xof 0303txt 0032\ template XSkinMeshHeader \ { \ <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \ WORD nMaxSkinWeightsPerVertex; \ WORD nMaxSkinWeightsPerFace; \ WORD nBones; \ } \ template VertexDuplicationIndices \ { \ <B8D65549-D7C9-4995-89CF-53A9A8B031E3> \ DWORD nIndices; \ DWORD nOriginalVertices; \ array DWORD indices[nIndices]; \ } \ template SkinWeights \ { \ <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \ STRING transformNodeName;\ DWORD nWeights; \ array DWORD vertexIndices[nWeights]; \ array float weights[nWeights]; \ Matrix4x4 matrixOffset; \ }" . . . LPD3DXFILE pD3DXFile =null ; if ( FAILED (hr = pD3DXFile->RegisterTemplates( (LPVOID)XSKINEXP_TEMPLATES, sizeof( XSKINEXP_TEMPLATES ) - 1 ) ) ) goto End;
All templates must specify a name and a UUID.
This method calls the RegisterEnumTemplates method, obtaining an
Registers custom templates, given an
If the method succeeds, the return value is
If the method fails, the following value will be returned: D3DXFERR_BADVALUE.
When this method is called, it copies templates stored with the
If an
Applications use the methods of the
Data types allowed by the template are called optional members. The optional members are not required, but an object might miss important information without them. These optional members are saved as children of the data object. A child can be another data object or a reference to an earlier data object.
The
The LPD3DXFILEDATA type is defined as a reference to this interface.
typedef interface*LPD3DXFILEDATA;
Retrieves the enumeration object in this file data object.
Retrieves the template ID in this file data object.
Indicates whether this file data object is a reference object that points to another child data object.
Retrieves the number of children in this file data object.
Retrieves the enumeration object in this file data object.
Address of a reference to receive the enumeration object in this file data object.
If the method succeeds, the return value is
Retrieves the name of this file data object.
Address of a reference to receive the name of this file data object. If this parameter is
Pointer to the size of the string that represents the name of this file data object. This parameter can be
If the method succeeds, the return value is
For this method to succeed, either szName or puiSize must be non-
Retrieves the
Pointer to a
If the method succeeds, the return value is
Accesses the .x file data.
Pointer to the size of the .x file data.
Address of a reference to receive the
If the method succeeds, the return value is
The ppData reference is only valid during a
Because file data is not guaranteed to be aligned properly with byte boundaries, you should access ppData with UNALIGNED references.
Returned parameter values are not guaranteed to be valid due to possible file corruption; therefore, your code should verify the returned parameter values.
Ends the lifespan of the ppData reference returned by
The return value is
You must ensure that the number of
Retrieves the template ID in this file data object.
Pointer to the
If the method succeeds, the return value is
Indicates whether this file data object is a reference object that points to another child data object.
Returns TRUE if the file data object is a reference object; returns
Retrieves the number of children in this file data object.
Address of a reference to receive the number of children in this file data object.
If the method succeeds, the return value is
Retrieves a child object in this file data object.
ID of the child object to retrieve.
Address of a reference to receive the child object's interface reference.
If the method succeeds, the return value is
Applications use the methods of the
The
The LPD3DXFILEENUMOBJECT type is defined as a reference to this interface.
typedef interface*LPD3DXFILEENUMOBJECT;
Retrieves the
Retrieves the number of child objects in this file data object.
Retrieves the
If the method succeeds, the return value is
Retrieves the number of child objects in this file data object.
Address of a reference to receive the number of child objects in this file data object.
If the method succeeds, the return value is
Retrieves a child object in this file data object.
ID of the child object to retrieve.
Address of a reference to receive the child object's interface reference.
If the method succeeds, the return value is
Retrieves the data object that has the specified
Reference to the requested
Address of a reference to an
If the method succeeds, the return value is
Obtain the
Retrieves the data object that has the specified name.
Pointer to the requested name.
Address of a reference to an
If the method succeeds, the return value is
Obtain the name szName of the current file data object with the
Applications use the methods of the
The
The LPD3DXFileSaveData type is defined as a reference to this interface.
typedef interface*LPD3DXFILESAVEDATA;
Retrieves a reference to this
Retrieves the template ID of this file data node.
Retrieves a reference to this
If the method succeeds, the return value is
Retrieves the name of this
If the method succeeds, the return value is
For this method to succeed, either szName or puiSize must be non-
Retrieves the
If the method succeeds, the return value is
Retrieves the template ID of this file data node.
Pointer to the
If the method succeeds, the return value is
Adds a data object as a child of the
If the method succeeds, the return value is
Adds a data reference as a child of this
If the method succeeds, the return value is
The file data object being referenced must have either a name or a
Applications use the methods of the
Templates are not required in every file. For example, you could put all templates into a single .x file rather than duplicating them in every .x file.
The
The globally unique identifier (
The LPD3DXFILESAVEOBJECT type is defined as a reference to this interface.
typedef interface*LPD3DXFILESAVEOBJECT;
Gets the
Gets the
If the method succeeds, the return value is
Adds a data object as a child of the
If the method succeeds, the return value is
If a data reference object will reference the data object, either the szName or pId parameter must be non-
Save the created data to disk by using the
Saves a data object and its children to a .x file on disk.
If the method succeeds, the return value is
After this method succeeds,
Stores an attribute table entry.
An attribute table is used to identify areas of the mesh that need to be drawn with different textures, render states, materials, and so on. In addition, the application can use the attribute table to hide portions of a mesh by not drawing a given attribute identifier (AttribId) when drawing the frame.
The LPD3DXATTRIBUTERANGE type is defined as a reference to the
typedef* LPD3DXATTRIBUTERANGE;
Attribute table identifier.
Starting face.
Face count.
Starting vertex.
Vertex count.
Specifies mesh weight attributes.
This structure describes how a simplification operation will consider vertex data when calculating relative costs between collapsing edges. For example, if the Normal field is 0.0, the simplification operation will ignore the vertex normal component when calculating the error for the collapse. However, if the Normal field is 1.0, the simplification operation will use the vertex normal component. If the Normal field is 2.0, double the amount of errors; if the Normal field is 4.0, then quadruple the number of errors, and so on.
The LPD3DXATTRIBUTEWEIGHTS type is defined as a reference to the
typedef* LPD3DXATTRIBUTEWEIGHTS;
Position.
Blend weight.
Normal.
Diffuse lighting value.
Specular lighting value.
Eight texture coordinates.
Tangent.
Binormal.
Throughput metrics for help in understanding the performance of an application.
The bandwidth or maximum data transfer rate from the host CPU to the GPU. This is typically the bandwidth of the PCI or AGP bus which connects the CPU and the GPU.
Memory utilized percentage when uploading data from the host CPU to the GPU.
Vertex throughput percentage. This is the number of vertices processed compared to the theoretical maximum vertex processing rate.
Triangle set-up throughput percentage. This is the number of triangles that are set up for rasterization compared to the theoretical maximum triangle set-up rate.
Pixel fill throughput percentage. This is the number of pixels that are filled compared to the theoretical pixel fill.
Defines a volume.
The restrictions on side ordering observed for
Position of the left side of the box on the x-axis.
Position of the top of the box on the y-axis.
Position of the right side of the box on the x-axis.
Position of the bottom of the box on the y-axis.
Position of the front of the box on the z-axis.
Position of the back of the box on the z-axis.
Measure the cache hit rate performance for textures and indexed vertices.
An efficient cache is typically closer to a 90 percent hit rate, and an inefficient cache is typically closer to a 10 percent hit rate (although a low percentage is not necessarily a problem).
The hit rate for finding a texture in the texture cache. This assumes there is a texture cache. Increasing the level-of-detail bias to use the most detailed texture, using many large textures, or producing a near random texture access pattern on large textures with custom shader code can dramatically affect the texture cache hit rate.
The hit rate for finding transformed vertices in the vertex cache. The GPU is designed to transform indexed vertices and may store them in a vertex cache. If you are using meshes,
Describes a callback key for use in key frame animation.
Key frame time stamp.
Pointer to user callback data.
Describes the current clip status.
When clipping is enabled during vertex processing (by ProcessVertices, DrawPrimitive, or other drawing functions), Direct3D computes a clip code for every vertex. The clip code is a combination of D3DCS_* bits. When a vertex is outside a particular clipping plane, the corresponding bit is set in the clipping code. Direct3D maintains the clip status using
Clip status is not updated by DrawRectPatch and DrawTriPatch because there is no software emulation for them.
Clip union flags that describe the current clip status. This member can be one or more of the following flags:
Value | Meaning |
---|---|
Combination of all clip flags. | |
All vertices are clipped by the left plane of the viewing frustum. | |
All vertices are clipped by the right plane of the viewing frustum. | |
All vertices are clipped by the top plane of the viewing frustum. | |
All vertices are clipped by the bottom plane of the viewing frustum. | |
All vertices are clipped by the front plane of the viewing frustum. | |
All vertices are clipped by the back plane of the viewing frustum. | |
Application-defined clipping planes. | |
Application-defined clipping planes. | |
Application-defined clipping planes. | |
Application-defined clipping planes. | |
Application-defined clipping planes. | |
Application-defined clipping planes. |
?
Clip intersection flags that describe the current clip status. This member can take the same flags as ClipUnion.
A description of a constant in a constant table.
Name of the constant.
Constant data type. See
Zero-based index of the constant in the table.
Number of registers that contain data.
Parameter class. See
Parameter type. See
Number of rows.
Number of columns.
Number of elements in the array.
Number of structure member sub-parameters.
Data size in number of bytes.
Pointer to the default value.
A description of the constant table.
Name of the constant table creator.
Shader version.
Number of constants in the constant table.
Describes the creation parameters for a device.
Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter. Use this ordinal as the Adapter parameter for any of the
Member of the
Window handle to which focus belongs for this Direct3D device. The value of this parameter mirrors the value passed to the CreateDevice call that created this device.
A combination of one or more
Specifies types of display modes to filter out.
The size of this structure. This should always be set to sizeof(
The display mode format to filter out. See
Whether the scanline ordering is interlaced or progressive. See
Describes an effect object.
An effect object can contain multiple rendering techniques and parameters for the same effect.
String that contains the name of the effect creator.
Number of parameters used for effect.
Number of techniques that can render the effect.
Number of functions that can render the effect.
Describes an animation event.
Event type, as defined in
Event track identifier.
Start time of the event in global time.
Duration of the event in global time.
Transition style of the event, as defined in
Track weight for the event.
Track speed for the event.
Track position for the event.
Enable flag.
Returns material information saved in Direct3D (.x) files.
The
The LPD3DXMATERIAL type is defined as a reference to the
typedef struct* LPD3DXMATERIAL;
Pointer to a string that specifies the file name of the texture.
Defines the attributes of a font.
The compiler setting also determines the structure type. If Unicode is defined, the
Possible values of the above members are given in the GDI
Height, in logical units, of the font's character cell or character.
Width, in logical units, of characters in the font.
Weight of the font in the range from 0 through 1000.
Number of mip levels requested. If this value is zero or D3DX_DEFAULT, a complete mipmap chain is created. If the value is 1, the texture space is mapped identically to the screen space.
Set to TRUE for an Italic font.
Character set.
Output precision. The output precision defines how closely the output must match the requested font height, width, character orientation, escapement, pitch, and font type.
Output quality.
Pitch and family of the font.
A null-terminated string or characters that specifies the typeface name of the font. The length of the string must not exceed 32 characters, including the terminating null character. If FaceName is an empty string, the first font that matches the other specified attributes will be used. If the compiler settings require Unicode, the data type TCHAR resolves to WCHAR; otherwise, the data type resolves to CHAR. See Remarks.
Encapsulates a transform frame in a transformation frame hierarchy.
An application can derive from this structure to add other data.
Name of the frame.
Transformation matrix.
Pointer to the mesh container.
Pointer to a sibling frame.
Pointer to a child frame.
Contains red, green, and blue ramp data.
Array of 256 WORD element that describes the red gamma ramp.
Array of 256 WORD element that describes the green gamma ramp.
Array of 256 WORD element that describes the blue gamma ramp.
Returns a description of the original contents of an image file.
Width of original image in pixels.
Height of original image in pixels.
Depth of original image in pixels.
Number of mip levels in original image.
A value from the
Represents the type of the texture stored in the file. It is either
Represents the format of the image file.
Describes an index buffer.
Member of the
Member of the
Combination of one or more of the following flags, specifying the usage for this resource.
Value | Meaning |
---|---|
Set to indicate that the index buffer content will never require clipping. | |
Set to indicate that the index buffer requires dynamic memory use. This is useful for drivers because it enables them to decide where to place the buffer. In general, static index buffers are placed in video memory and dynamic index buffers are placed in AGP memory. Note that there is no separate static usage; if you do not specify For more information about using dynamic index buffers, see Using Dynamic Vertex and Index Buffers. Note that | |
Set to indicate when the index buffer is to be used for drawing high-order primitives. | |
Set to indicate when the index buffer is to be used for drawing N patches. | |
Set to indicate when the index buffer is to be used for drawing point sprites or indexed point lists. | |
Set to indicate that the buffer is to be used with software processing. | |
Informs the system that the application writes only to the index buffer. Using this flag enables the driver to choose the best memory location for efficient write operations and rendering. Attempts to read from an index buffer that is created with this capability can result in degraded performance. |
?
Member of the
Size of the index buffer, in bytes.
Percent of time processing data in the driver. These statistics may help identify cases when the driver is waiting for other resources.
These metrics help identify when a driver is waiting and what it is waiting for. High percentages are not necessarily a problem.
These system-global metrics may or may not be implemented. Depending on the specific hardware, these metrics may not support multiple queries simultaneously.
Percentage of time the driver spent waiting for the GPU to finish using a locked resource (and
Percentage of time the driver spent waiting for the GPU to finish processing some commands before the driver could send more. This indicates the driver has run out of room to send commands to the GPU.
Percentage of time the driver spent waiting for the GPU latency to reduce to less than three rendering frames.
If an application is GPU-limited, the driver must stall the CPU until the GPU gets within three frames. This prevents an application from queuing up many seconds' worth of rendering calls which may dramatically increase the latency between when the user inputs new data and when the user sees the results of that input. In general, the driver can track the number of times Present is called to prevent queuing up more than three frames of rendering work.
Percentage of time the driver spent waiting for a resource that cannot be pipelined (that is operated in parallel). An application may want to avoid using a non-pipelined resource for performance reasons.
Percentage of time the driver spent waiting for other GPU processing.
Defines a set of lighting properties.
Type of the light source. This value is one of the members of the
Diffuse color emitted by the light. This member is a
Specular color emitted by the light. This member is a
Ambient color emitted by the light. This member is a
Position of the light in world space, specified by a
Direction that the light is pointing in world space, specified by a
Distance beyond which the light has no effect. The maximum allowable value for this member is the square root of FLT_MAX. This member does not affect directional lights.
Decrease in illumination between a spotlight's inner cone (the angle specified by Theta) and the outer edge of the outer cone (the angle specified by Phi).
The effect of falloff on the lighting is subtle. Furthermore, a small performance penalty is incurred by shaping the falloff curve. For these reasons, most developers set this value to 1.0.
Value specifying how the light intensity changes over distance. Attenuation values are ignored for directional lights. This member represents an attenuation constant. For information about attenuation, see Light Properties (Direct3D 9). Valid values for this member range from 0.0 to infinity. For non-directional lights, all three attenuation values should not be set to 0.0 at the same time.
Value specifying how the light intensity changes over distance. Attenuation values are ignored for directional lights. This member represents an attenuation constant. For information about attenuation, see Light Properties (Direct3D 9). Valid values for this member range from 0.0 to infinity. For non-directional lights, all three attenuation values should not be set to 0.0 at the same time.
Value specifying how the light intensity changes over distance. Attenuation values are ignored for directional lights. This member represents an attenuation constant. For information about attenuation, see Light Properties (Direct3D 9). Valid values for this member range from 0.0 to infinity. For non-directional lights, all three attenuation values should not be set to 0.0 at the same time.
Angle, in radians, of a spotlight's inner cone - that is, the fully illuminated spotlight cone. This value must be in the range from 0 through the value specified by Phi.
Angle, in radians, defining the outer edge of the spotlight's outer cone. Points outside this cone are not lit by the spotlight. This value must be between 0 and pi.
Describes a locked rectangular region.
The pitch for DXTn formats is different from what was returned in DirectX 7. It now refers to the number of bytes in a row of blocks. For example, if you have a width of 16, then you will have a pitch of 4 blocks (4*8 for DXT1, 4*16 for DXT2-5.)
Number of bytes in one row of the surface.
Pointer to the locked bits. If a
Describes preprocessor definitions used by an effect object.
To use
sample= macro.Name = "DO_CODE_BLOCK"; macro.Definition = "/* here is a block of code */\\\n" "{ do something ... }\\\n";
Notice the 3 backslash characters at the end of the line. The first two are required to output a single '\', followed by the newline character "\n". Optionally, you may also want to terminate your lines using "\\\r\n".
Preprocessor name.
Definition name.
Specifies material properties.
To turn off specular highlights, set
For more information about using the lighting engine to calculate specular lighting, see Specular Lighting (Direct3D 9).
Value specifying the diffuse color of the material. See
Value specifying the ambient color of the material. See
Value specifying the specular color of the material. See
Value specifying the emissive color of the material. See
Floating-point value specifying the sharpness of specular highlights. The higher the value, the sharper the highlight.
Mesh data structure.
Defines the mesh data type. See
Pointer to a mesh. See
Pointer to a patch mesh. See
Pointer to a patch mesh. See
Describes a parameter used for an effect object.
Name of the parameter.
Semantic meaning, also called the usage.
Parameter class. Set this to one of the values in
Parameter type. Set this to one of the values in
Number of rows in the array.
Number of columns in the array.
Number of elements in the array.
Number of annotations.
Number of structure members.
Parameter attributes. See Effect Constants.
The size of the parameter, in bytes.
Describes a pass for an effect object.
String value used for the pass.
Annotations are user-specific data that can be attached to any technique, pass, or parameter. See Add Information to Effect Parameters with_Annotations.
Pointer to the vertex shader function. If an effect is created with
Pointer to the pixel shader function. If an effect is created with
Structure that contains the attributes of a patch mesh.
A mesh is a set of faces, each of which is described by a simple polygon. Objects can be created by connecting several meshes together. A patch mesh is constructed from patches. A patch is a four-sided piece of geometry constructed from curves. The type of curve used and the order of the curve can be varied so that the patch surface will fit almost any surface shape.
The following types of patch combinations are supported:
Patch Type | Basis | Degree |
---|---|---|
Rectangle | Bezier | 2,3,5 |
Rectangle | B-Spline | 2,3,5 |
Rectangle | Catmull-Rom | 3 |
Triangle | Bezier | 2,3,5 |
N-patch | N/A | 3 |
?
The patch type. For information about patch types, see
Degree of the curves used to construct the patch. For information about the degrees supported, see
Type of curve used to construct the patch. For information about the basis types supported, see
Percent of time processing data in the pipeline.
For best performance, a balanced load is recommended.
Percent of time spent running vertex shaders.
Percent of time spent running pixel shaders.
Percent of time spent doing other processing.
Percent of time not processing anything.
Pixel shader driver caps.
Instruction predication is supported if this value is nonzero. See setp_comp - vs.
Either 0 or 24, which represents the depth of the dynamic flow control instruction nesting. See
The number of temporary registers supported. See
The depth of nesting of the loop - vs/rep - vs and call - vs/callnz bool - vs instructions. See
The number of instruction slots supported. See
Describes swapchain statistics relating to PresentEx calls.
When a 9Ex application adopts Flip Mode present (
Applications can determine whether a frame has been dropped by sampling any two instances of PresentCount and GetPresentStats (by calling GetPresentStats API at any two points in time). For example, a media application that is presenting at the same rate as the monitor refresh rate (for example, monitor refresh rate is 60Hz, the application presents a frame every 1/60 seconds) wants to present frames A, B, C, D, E, each corresponding to Present IDs (PresentCount) 1, 2, 3, 7, 8.
The application code looks like the following sequence.
Note that GetPresentStatistics will be processed after it is called, regardless of the state of FLIPEX mode PresentEx calls.
Windows?Vista:??The Present calls will be queued and then processed before GetPresentStats call will be processed.
When an application detects that the presentation of certain frames are behind, it can skip those frames and correct the presentation to re-synchronize with the vblank. To do this, an application can simply not render the late frames and start rendering with the next correct frame in the queue. However, if an application has already started the rendering of late frames, it can use a new Present parameter in D3D9Ex called
Applications can synchronize video and audio streams in the same manner because the behavior of GetPresentStatistics does not change in that scenario.
D3D9Ex Flip Mode provides frame statistics information to windowed applications and full screen 9Ex applications.
Windows?Vista:??Use the DWM APIs for retrieving present statistics.
When Desktop Window Manager is turned off, windowed mode 9Ex applications using flip mode will receive present statistics information of limited accuracy.
Windows?Vista:??
If an application is not fast enough to keep up with the monitor's refresh rate, possibly due to slow hardware or lack of system resources, then it can experience a graphics glitch. A glitch is a so-called visual hiccup. If a monitor is set to refresh at 60 Hz, and the application can only manage 30 fps, then half of the frames will have glitches.
Applications can detect a glitch by keeping track of SynchRefreshCount. For example, an application might perform the following sequence of actions.
Describes the presentation parameters.
Width of the new swap chain's back buffers, in pixels. If Windowed is
Height of the new swap chain's back buffers, in pixels. If Windowed is
The back buffer format. For more information about formats, see
In fact,
For windowed applications, the back buffer format no longer needs to match the display-mode format because color conversion can now be done by the hardware (if the hardware supports color conversion). The set of possible back buffer formats is constrained, but the runtime will allow any valid back buffer format to be presented to any desktop format. (There is the additional requirement that the device be operable in the desktop; devices typically do not operate in 8 bits per pixel modes.)
Full-screen applications cannot do color conversion.
This value can be between 0 and
The method fails if one back buffer cannot be created. The value of BackBufferCount influences what set of swap effects are allowed. Specifically, any
Member of the
Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by CheckDeviceMultiSampleType. Passing a larger value returns the error
Member of the
Differences between Direct3D9 and Direct3D9Ex In Direct3D9Ex, |
?
The device window determines the location and size of the back buffer on screen. This is used by Direct3D when the back buffer contents are copied to the front buffer during Present.
For a full-screen application, this is a handle to the top window (which is the focus window).
For applications that use multiple full-screen devices (such as a multimonitor system), exactly one device can use the focus window as the device window. All other devices must have unique device windows.
Note that no attempt is made by the runtime to reflect user changes in window size. The back buffer is not implicitly reset when this window is reset. However, the Present method does automatically track window position changes.
TRUE if the application runs windowed;
If this value is TRUE, Direct3D will manage depth buffers for the application. The device will create a depth-stencil buffer when it is created. The depth-stencil buffer will be automatically set as the render target of the device. When the device is reset, the depth-stencil buffer will be automatically destroyed and recreated in the new size.
If EnableAutoDepthStencil is TRUE, then AutoDepthStencilFormat must be a valid depth-stencil format.
Member of the
One of the
The rate at which the display adapter refreshes the screen. The value depends on the mode in which the application is running:
The maximum rate at which the swap chain's back buffers can be presented to the front buffer. For a detailed explanation of the modes and the intervals that are supported, see
Describes the raster status.
TRUE if the raster is in the vertical blank period.
If InVBlank is
If InVBlank is TRUE, then this value is set to zero and can be ignored.
Describes a rectangular high-order patch.
The following diagram identifies the parameters that specify a rectangle patch.
Each of the vertices in the vertex buffer is shown as a black dot. In this case, the vertex buffer has 20 vertices in it, 16 of which are in the rectangle patch. The stride is the number of vertices in the width of the vertex buffer, in this case five. The x offset to the first vertex is called the StartIndexVertexWidth and is in this case 1. The y offset to the first patch vertex is called the StartIndexVertexHeight and is in this case 0.
To render a stream of individual rectangular patches (non-mosaic), you should interpret your geometry as a long narrow (1 x N) rectangular patch. The
RectInfo; RectInfo.Width = 4; RectInfo.Height = 4; RectInfo.Stride = 4; RectInfo.Basis = ; RectInfo.Order = D3DORDER_CUBIC; RectInfo.StartVertexOffsetWidth = 0; RectInfo.StartVertexOffsetHeight = 4*i; // The variable i is the index of the // patch you want to render.
Starting vertex offset width, in number of vertices.
Starting vertex offset height, in number of vertices.
Width of each vertex, in number of vertices.
Height of each vertex, in number of vertices.
Width of the imaginary two-dimensional vertex array, which occupies the same space as the vertex buffer. For an example, see the diagram below.
Member of the
Value | Order supported | Width and height |
---|---|---|
Linear, cubic, and quintic | Width = height = (DWORD)order + 1 | |
Linear, cubic, and quintic | Width = height > (DWORD)order | |
D3DBASIS_INTERPOLATE | Cubic | Width = height > (DWORD)order |
?
Member of the
Describes an off-screen render target used by an instance of
This method is used to return the creation parameters used when creating an
Describes a render surface.
Width of the render surface, in pixels.
Height of the render surface, in pixels.
Member of the
If TRUE, the render surface supports a depth-stencil surface; otherwise this member is set to
If DepthStencil is set to TRUE, this parameter is a member of the
Resource statistics gathered by the D3DDEVINFO_ResourceManager when using the asynchronous query mechanism.
Describes a vector key for use in key frame animation. It specifies a vector at a given time. This is used for scale and translation keys.
Key frame time stamp.
Offset from the beginning of this structure, in bytes, to the string that contains the constant information.
Register set. See
The register index.
Number of registers.
Reserved.
Offset from the beginning of this structure, in bytes, to the string that contains the D3DXSHADER_TYPEINFO information.
Offset from the beginning of this structure, in bytes, to the string that contains the default value.
Helper structure for managing a shader constant table. This can also be done using
Shader constant information is included in a tab-delimited table of comments. All offsets are measured in bytes from the beginning of the structure. Entries in the constant table are sorted by Creator in ascending order.
A shader constant table can be managed with the
This size member is often initialized using the following:
constantTable; constantTable.Size = sizeof( )
Semantics map a parameter to vertex or pixel shader registers. They can also be optional descriptive strings attached to non-register parameters.
Semantics are required for vertex and pixel shader, input and output registers.
Options that identify how resources are used. See
Options that modify how the usage is interpreted. The usage and usage index make up a vertex declaration. See Vertex Declaration (Direct3D 9).
Percent of time processing shader data.
For best performance, a balanced load is recommended.
Percent of time in shader spent on memory accesses.
Percent of time processing (moving data around in registers or doing mathematical operations).
Describes a surface.
Member of the
Member of the
Either the
Member of the
Member of the
Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by CheckDeviceMultiSampleType. Passing a larger value returns the error,
Width of the surface, in pixels.
Height of the surface, in pixels.
Describes a technique used by an effect.
Some video cards can render two textures in a single pass. However, if a card does not have this capability, it is often possible to render the same effect in two passes, using one texture for each pass.
String that contains the technique name.
Number of rendering passes the technique requires. See Remarks.
The number of annotations. See Add Information to Effect Parameters with_Annotations.
Describes an animation track and specifies blending weight, speed, and position for the track at a given time.
Tracks with the same priority are blended together, and the two resulting values are then blended using the priority blend factor. A track must have an animation set (stored separately) associated with it.
Priority type, as defined in
Weight value. The weight determines the proportion of this track to blend with other tracks.
Speed value. This is used similarly to a multiplier to scale the period of the track.
Time position of the track, in the local timeframe of its current animation set.
Track enable/disable. To enable, set to TRUE. To disable, set to
Describes a triangular high-order patch.
For example, the following diagram identifies the vertex order and segment numbers for a cubic B?zier triangle patch. The vertex order determines the segment numbers used by DrawTriPatch. The offset is the number of bytes to the first triangle patch vertex in the vertex buffer.
Starting vertex offset, in number of vertices.
Number of vertices.
Member of the
Member of the
Value | Number of vertices |
---|---|
10 | |
3 | |
N/A | |
21 |
?
N/A - Not available. Not supported.
DirectX 8.1 and later versions only.
The
DirectX 8.1 versions only. The Direct3D runtime calls a driver's D3dGetDriverState function to obtain vertex-cache information from the driver. In this D3dGetDriverState call, the runtime specifies the D3DDEVINFOID_VCACHE flag in the dwFlags member of the DD_GETDRIVERSTATEDATA structure that the runtime passes. The driver specifies vertex-cache information in a
DirectX 9.0 and later versions only. The Direct3D runtime specifies D3DDP2OP_CREATEQUERY and D3DDP2OP_ISSUEQUERY commands in calls to the driver's D3dDrawPrimitives2 callback to create driver-side resources for the query and then to asynchronously query the driver for vertex-cache information. In the call with the D3DDP2OP_CREATEQUERY command, the runtime specifies the
When the driver completes a vertex-cache query, the driver sets the total size of the response buffer in the dwErrorOffset member of the D3DHAL_DRAWPRIMITIVES2DATA structure and sets the ddrval member of D3DHAL_DRAWPRIMITIVES2DATA to
Specifies the bit pattern. The driver must specify the bit pattern as the CACH four-character code (FOURCC) value. The driver can use the MAKEFOURCC macro as follows to specify the FOURCC value as CACH:
MAKEFOURCC('C', 'A', 'C', 'H');
Specifies the method of mesh optimization. The driver can use one of the following values to specify the mesh optimization that it uses:
Value | Meaning |
---|---|
| Longest strips optimization |
D3DXMESHOPT_VCACHE (1) | Vertex-cache based optimization |
?
Specifies the effective size, in entries, for which the driver optimizes the vertex cache. The actual cache size is not required to be the size specified in CacheSize because in most cases the actual cache size turns out to be larger. The driver only specifies an optimized size in CacheSize if it also specifies D3DXMESHOPT_VCACHE in the OptMethod member.
Specifies the number that should be used as part of a trial-and-error procedure when determining when to restart the strips list. This number can be set from 1 to the value in the CacheSize member. Typically, the best values are near CacheSize/2.
Describes a vertex buffer.
Member of the
Member of the
Combination of one or more
Member of the
Size of the vertex buffer, in bytes.
Combination of
Defines the vertex data layout. Each vertex can contain one or more data types, and each data type is described by a vertex element.
Vertex data is defined using an array of
Stream number.
Offset from the beginning of the vertex data to the data associated with the particular data type.
The data type, specified as a
The method specifies the tessellator processing, which determines how the tessellator interprets (or operates on) the vertex data. For more information, see
Defines what the data will be used for; that is, the interoperability between vertex data layouts and vertex shaders. Each usage acts to bind a vertex declaration to a vertex shader. In some cases, they have a special interpretation. For example, an element that specifies
Modifies the usage data to allow the user to specify multiple usage types.
Vertex shader caps.
Instruction predication is supported if this value is nonzero. See setp_comp - vs.
Either 0 or 24, which represents the depth of the dynamic flow control instruction nesting. See
The number of temporary registers supported. See
The depth of nesting of the loop - vs/rep - vs and call - vs/callnz bool - vs instructions. See
Reports the number of triangles that have been processed and clipped by the runtime's software vertex processing.
Use the debug runtime and software vertex processing to get the number of non-clipped and clipped primitives for a particular scene. Primitives will typically be clipped based on a guard band (if one is present). The clipping guard band is set with parameters such as GuardBandLeft in
Total number of triangles that are not clipped in this frame.
Number of new triangles generated by clipping.
Describes a volume.
Member of the
Member of the
Currently not used. Always returned as 0.
Member of the
Width of the volume, in pixels.
Height of the volume, in pixels.
Depth of the volume, in pixels.
Specifies tolerance values for each vertex component when comparing vertices to determine if they are similar enough to be welded together.
The LPD3DXWELDEPSILONS type is defined as a reference to the
typedef*LPD3DXWELDEPSILONS;
Position
Blend weight
Normal
Point size value
Specular lighting value
Diffuse lighting value
Eight texture coordinates
Tangent
Binormal
Tessellation factor
Identifies compressed key frame animation data.
Total size, in bytes, of the compressed data in the compressed key frame animation data buffer.
Number of animation key frame ticks that occur per second.
Type of the animation set playback loop. See
Minimum buffer size, in bytes, required to hold compressed key frame animation data. Value is equal to ( ( CompressedBlockSize + 3 ) / 4 ).