Commit a2643b64 by Jamie Madill

Add UMA histogram for D3D9 init results.

Similar to D3D11 results, this can add statistics for the result of initializing the D3D9 Renderer. BUG=436191 Change-Id: I746c95a8dbb27456613844fde816e17352dc4b8d Reviewed-on: https://chromium-review.googlesource.com/248660Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent b9293977
......@@ -112,6 +112,15 @@ egl::Error CreateRendererD3D(egl::Display *display, RendererD3D **outRenderer)
platform->histogramEnumeration("GPU.ANGLE.D3D11InitializeResult",
result.getID(), NUM_D3D11_INIT_ERRORS);
}
else
{
ASSERT(renderer->getRendererClass() == RENDERER_D3D9);
ASSERT(result.getID() >= 0 && result.getID() < NUM_D3D9_INIT_ERRORS);
angle::Platform *platform = angle::Platform::current();
platform->histogramEnumeration("GPU.ANGLE.D3D9InitializeResult",
result.getID(), NUM_D3D9_INIT_ERRORS);
}
if (!result.isError())
{
......
......@@ -178,7 +178,9 @@ egl::Error Renderer9::initialize()
{
if (!mCompiler.initialize())
{
return egl::Error(EGL_NOT_INITIALIZED, "Compiler failed to initialize.");
return egl::Error(EGL_NOT_INITIALIZED,
D3D9_INIT_COMPILER_ERROR,
"Compiler failed to initialize.");
}
TRACE_EVENT0("gpu", "GetModuleHandle_d3d9");
......@@ -186,7 +188,7 @@ egl::Error Renderer9::initialize()
if (mD3d9Module == NULL)
{
return egl::Error(EGL_NOT_INITIALIZED, "No D3D9 module found.");
return egl::Error(EGL_NOT_INITIALIZED, D3D9_INIT_MISSING_DEP, "No D3D9 module found.");
}
typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
......@@ -210,7 +212,7 @@ egl::Error Renderer9::initialize()
if (!mD3d9)
{
return egl::Error(EGL_NOT_INITIALIZED, "Could not create D3D9 device.");
return egl::Error(EGL_NOT_INITIALIZED, D3D9_INIT_MISSING_DEP, "Could not create D3D9 device.");
}
if (mDisplay->getNativeDisplayId() != nullptr)
......@@ -236,7 +238,9 @@ egl::Error Renderer9::initialize()
}
else if (FAILED(result)) // D3DERR_OUTOFVIDEOMEMORY, E_OUTOFMEMORY, D3DERR_INVALIDDEVICE, or another error we can't recover from
{
return egl::Error(EGL_NOT_INITIALIZED, "Failed to get device caps: Error code 0x%x\n", result);
return egl::Error(EGL_NOT_INITIALIZED,
D3D9_INIT_OTHER_ERROR,
"Failed to get device caps: Error code 0x%x\n", result);
}
}
}
......@@ -249,14 +253,18 @@ egl::Error Renderer9::initialize()
if (mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(minShaderModel, 0))
{
return egl::Error(EGL_NOT_INITIALIZED, "Renderer does not support PS %u.%u.aborting!", minShaderModel, 0);
return egl::Error(EGL_NOT_INITIALIZED,
D3D9_INIT_UNSUPPORTED_VERSION,
"Renderer does not support PS %u.%u.aborting!", minShaderModel, 0);
}
// 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::ensureRenderTarget.
if ((mDeviceCaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
{
return egl::Error(EGL_NOT_INITIALIZED, "Renderer does not support StretctRect from textures.");
return egl::Error(EGL_NOT_INITIALIZED,
D3D9_INIT_UNSUPPORTED_STRETCHRECT,
"Renderer does not support StretctRect from textures.");
}
{
......@@ -281,7 +289,8 @@ egl::Error Renderer9::initialize()
}
if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
{
return egl::Error(EGL_BAD_ALLOC, "CreateDevice failed: device lost of out of memory");
return egl::Error(EGL_BAD_ALLOC, D3D9_INIT_OUT_OF_MEMORY,
"CreateDevice failed: device lost of out of memory");
}
if (FAILED(result))
......@@ -292,7 +301,8 @@ egl::Error Renderer9::initialize()
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_NOTAVAILABLE || result == D3DERR_DEVICELOST);
return egl::Error(EGL_BAD_ALLOC, "CreateDevice2 failed: device lost, not available, or of out of memory");
return egl::Error(EGL_BAD_ALLOC, D3D9_INIT_OUT_OF_MEMORY,
"CreateDevice2 failed: device lost, not available, or of out of memory");
}
}
......
......@@ -36,6 +36,26 @@ class StaticIndexBufferInterface;
struct TranslatedAttribute;
class Blit9;
enum D3D9InitError
{
D3D9_INIT_SUCCESS = 0,
// Failed to load the D3D or ANGLE compiler
D3D9_INIT_COMPILER_ERROR,
// Failed to load a necessary DLL
D3D9_INIT_MISSING_DEP,
// Device creation error
D3D9_INIT_CREATE_DEVICE_ERROR,
// System does not meet minimum shader spec
D3D9_INIT_UNSUPPORTED_VERSION,
// System does not support stretchrect from textures
D3D9_INIT_UNSUPPORTED_STRETCHRECT,
// A call returned out of memory or device lost
D3D9_INIT_OUT_OF_MEMORY,
// Other unspecified error
D3D9_INIT_OTHER_ERROR,
NUM_D3D9_INIT_ERRORS
};
class Renderer9 : public RendererD3D
{
public:
......
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