?/TD> |
Microsoft DirectX 9.0 |
Creates a depth-stencil resource.
Syntax
HRESULT CreateDepthStencilSurface(
UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pHandle );
Parameters
- Width
- [in] Width of the depth-stencil surface, in pixels.
- Height
- [in] Height of the depth-stencil surface, in pixels.
- Format
- [in] Member of the D3DFORMAT enumerated type, describing the format of the depth-stencil surface. This value must be one of the enumerated depth-stencil formats for this device.
- MultiSample
- [in] Member of the D3DMULTISAMPLE_TYPE enumerated type, describing the multisampling buffer type. This value must be one of the allowed multisample types. When this surface is passed to IDirect3DDevice9::SetDepthStencilSurface, its multisample type must be the same as that of the render target set by IDirect3DDevice9::SetRenderTarget.
- MultisampleQuality
- [in] Quality level. The valid range is between zero and one less than the level returned by pQualityLevels used by IDirect3D9::CheckDeviceMultiSampleType. Passing a larger value returns the error D3DERR_INVALIDCALL. The MultisampleQuality values of paired render targets, depth stencil surfaces, and the MultiSample type must all match.
- Discard
- [in] Set this flag to TRUE to enable z-buffer discarding, and FALSE otherwise.
If this flag is set, the contents of the depth stencil buffer will be invalid after calling either IDirect3DDevice9::Present or IDirect3DDevice9::SetDepthStencilSurface with a different depth surface.
This flag has the same behavior as the constant, D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL, in D3DPRESENTFLAG.
- ppSurface
- [out, retval] Address of a pointer to an IDirect3DSurface9 interface, representing the created depth-stencil surface resource.
- pHandle
- [in] Reserved. Set this parameter to NULL.
Return Value
If the method succeeds, the return value is D3D_OK.
If the method fails, the return value can be one of the following values.
D3DERR_NOTAVAILABLE This device does not support the queried multisample type.
D3DERR_INVALIDCALL The method call is invalid. For example, a method's parameter may have an invalid value. D3DERR_OUTOFVIDEOMEMORY Microsoft?Direct3D?does not have enough display memory to perform the operation. E_OUTOFMEMORY Direct3D could not allocate sufficient memory to complete the call.
Remarks
The memory class of the depth-stencil buffer is always D3DPOOL_DEFAULT.
See Also
IDirect3DDevice9::UpdateSurface