Add device error checking utility functions.

TRAC #18606 Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@843 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent f81103a6
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// main.cpp: DLL entry point and management of thread-local data. // main.cpp: DLL entry point and management of thread-local data.
#include "libGLESv2/main.h" #include "libGLESv2/main.h"
#include "libGLESv2/utilities.h"
#include "common/debug.h" #include "common/debug.h"
#include "libEGL/Surface.h" #include "libEGL/Surface.h"
...@@ -106,6 +107,17 @@ IDirect3DDevice9 *getDevice() ...@@ -106,6 +107,17 @@ IDirect3DDevice9 *getDevice()
return display->getDevice(); return display->getDevice();
} }
bool checkDeviceLost(HRESULT errorCode)
{
egl::Display *display = NULL;
if (isDeviceLostError(errorCode))
{
return true;
}
return false;
}
} }
// Records an error code // Records an error code
......
...@@ -32,6 +32,8 @@ Context *getContext(); ...@@ -32,6 +32,8 @@ Context *getContext();
egl::Display *getDisplay(); egl::Display *getDisplay();
IDirect3DDevice9 *getDevice(); IDirect3DDevice9 *getDevice();
bool checkDeviceLost(HRESULT errorCode);
} }
void error(GLenum errorCode); void error(GLenum errorCode);
......
...@@ -87,4 +87,18 @@ GLenum ConvertDepthStencilFormat(D3DFORMAT format); ...@@ -87,4 +87,18 @@ GLenum ConvertDepthStencilFormat(D3DFORMAT format);
std::string getTempPath(); std::string getTempPath();
void writeFile(const char* path, const void* data, size_t size); void writeFile(const char* path, const void* data, size_t size);
inline bool isDeviceLostError(HRESULT errorCode)
{
switch (errorCode)
{
case D3DERR_DRIVERINTERNALERROR:
case D3DERR_DEVICELOST:
case D3DERR_DEVICEHUNG:
case D3DERR_DEVICEREMOVED:
return true;
default:
return false;
}
};
#endif // LIBGLESV2_UTILITIES_H #endif // LIBGLESV2_UTILITIES_H
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