本文整理汇总了C++中IDirect3DDevice9::GetDepthStencilSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9::GetDepthStencilSurface方法的具体用法?C++ IDirect3DDevice9::GetDepthStencilSurface怎么用?C++ IDirect3DDevice9::GetDepthStencilSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DDevice9
的用法示例。
在下文中一共展示了IDirect3DDevice9::GetDepthStencilSurface方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Enable
//----------------------------------------------------------------------------
void PdrRenderTarget::Enable (Renderer* renderer)
{
IDirect3DDevice9* device = renderer->mData->mDevice;
HRESULT hr;
WM5_UNUSED(hr);
hr = device->GetRenderTarget(0, &mSaveColorSurface);
assertion(hr == D3D_OK, "Failed to get old rt 0 color surface: %s\n",
DXGetErrorString(hr));
// The viewport is automatically set by this call.
hr = device->SetRenderTarget(0, mColorSurfaces[0]);
assertion(hr == D3D_OK, "Failed to set new rt 0 color surface: %s\n",
DXGetErrorString(hr));
for (int i = 1; i < mNumTargets; ++i)
{
hr = device->SetRenderTarget((DWORD)i, mColorSurfaces[i]);
assertion(hr == D3D_OK, "Failed to set new rt %d color surface: %s\n",
i, DXGetErrorString(hr));
}
if (mHasDepthStencil)
{
hr = device->GetDepthStencilSurface(&mSaveDepthStencilSurface);
assertion(hr == D3D_OK,
"Failed to get old rt depthstencil surface: %s\n",
DXGetErrorString(hr));
hr = device->SetDepthStencilSurface(mDepthStencilSurface);
assertion(hr == D3D_OK,
"Failed to set new rt depthstencil surface: %s\n",
DXGetErrorString(hr));
}
}
示例2: saveState
void Blit::saveState()
{
IDirect3DDevice9 *device = getDevice();
HRESULT hr;
device->GetDepthStencilSurface(&mSavedDepthStencil);
device->GetRenderTarget(0, &mSavedRenderTarget);
if (mSavedStateBlock == NULL)
{
hr = device->BeginStateBlock();
ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
setCommonBlitState();
static const float dummyConst[4] = { 0, 0, 0, 0 };
device->SetVertexShader(NULL);
device->SetVertexShaderConstantF(0, dummyConst, 1);
device->SetPixelShader(NULL);
device->SetPixelShaderConstantF(0, dummyConst, 1);
D3DVIEWPORT9 dummyVp;
dummyVp.X = 0;
dummyVp.Y = 0;
dummyVp.Width = 1;
dummyVp.Height = 1;
dummyVp.MinZ = 0;
dummyVp.MaxZ = 1;
device->SetViewport(&dummyVp);
device->SetTexture(0, NULL);
device->SetStreamSource(0, mQuadVertexBuffer, 0, 0);
device->SetVertexDeclaration(mQuadVertexDeclaration);
hr = device->EndStateBlock(&mSavedStateBlock);
ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
}
ASSERT(mSavedStateBlock != NULL);
if (mSavedStateBlock != NULL)
{
hr = mSavedStateBlock->Capture();
ASSERT(SUCCEEDED(hr));
}
}