Commit 1c76801e by apatrick@chromium.org

- Check for D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES capability during…

- Check for D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES capability during initialization to fail on DirectX8 drivers. - Fail in GetDeviceCaps loop after one second. Review URL: http://codereview.appspot.com/2354042 git-svn-id: https://angleproject.googlecode.com/svn/trunk@446 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent c1693978
...@@ -97,22 +97,25 @@ bool Display::initialize() ...@@ -97,22 +97,25 @@ bool Display::initialize()
HRESULT result; HRESULT result;
do // Give up on getting device caps after about one second.
for (int i = 0; i < 10; ++i)
{ {
result = mD3d9->GetDeviceCaps(mAdapter, mDeviceType, &mDeviceCaps); result = mD3d9->GetDeviceCaps(mAdapter, mDeviceType, &mDeviceCaps);
if (result == D3DERR_NOTAVAILABLE) if (SUCCEEDED(result))
{
break;
}
else if (result == D3DERR_NOTAVAILABLE)
{ {
Sleep(0); // Give the driver some time to initialize/recover Sleep(100); // Give the driver some time to initialize/recover
} }
else if (FAILED(result)) // D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY, D3DERR_INVALIDDEVICE, or another error we can't recover from else if (FAILED(result)) // D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY, D3DERR_INVALIDDEVICE, or another error we can't recover from
{ {
terminate();
return error(EGL_BAD_ALLOC, false); return error(EGL_BAD_ALLOC, false);
} }
} }
while(result == D3DERR_NOTAVAILABLE);
ASSERT(SUCCEEDED(result));
if (mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(2, 0)) if (mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(2, 0))
{ {
...@@ -120,6 +123,14 @@ bool Display::initialize() ...@@ -120,6 +123,14 @@ bool Display::initialize()
return error(EGL_NOT_INITIALIZED, false); return error(EGL_NOT_INITIALIZED, false);
} }
// When DirectX9 is running with an older DirectX8 driver, a StretchRect from a regular texture to a render target texture is not supported.
// This is required by Texture2D::convertToRenderTarget.
if ((mDeviceCaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
{
terminate();
return error(EGL_NOT_INITIALIZED, false);
}
mMinSwapInterval = 4; mMinSwapInterval = 4;
mMaxSwapInterval = 0; mMaxSwapInterval = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment