Implemented reset status.

TRAC #18607 Signed-off-by: Daniel Koch Authors: Shannon Woods, Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@847 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 9d788502
...@@ -325,6 +325,13 @@ typedef void* GLeglImageOES; ...@@ -325,6 +325,13 @@ typedef void* GLeglImageOES;
#define GL_UNPACK_SKIP_PIXELS 0x0CF4 #define GL_UNPACK_SKIP_PIXELS 0x0CF4
#endif #endif
/* GL_EXT_robustness */
#ifndef GL_EXT_robustness
#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
#endif
/*------------------------------------------------------------------------* /*------------------------------------------------------------------------*
* DMP extension tokens * DMP extension tokens
*------------------------------------------------------------------------*/ *------------------------------------------------------------------------*/
...@@ -931,6 +938,15 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GL ...@@ -931,6 +938,15 @@ typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GL
#define GL_EXT_unpack_subimage 1 #define GL_EXT_unpack_subimage 1
#endif #endif
/* GL_EXT_robustness */
#ifndef GL_EXT_robustness
#define GL_EXT_robustness 1
#ifdef GL_GLEXT_PROTOTYPES
GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
#endif
typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
#endif
/*------------------------------------------------------------------------* /*------------------------------------------------------------------------*
* DMP extension functions * DMP extension functions
*------------------------------------------------------------------------*/ *------------------------------------------------------------------------*/
......
...@@ -813,7 +813,7 @@ bool Display::testDeviceLost() ...@@ -813,7 +813,7 @@ bool Display::testDeviceLost()
{ {
return FAILED(mDeviceEx->CheckDeviceState(NULL)); return FAILED(mDeviceEx->CheckDeviceState(NULL));
} }
else if(mDevice) else if (mDevice)
{ {
return FAILED(mDevice->TestCooperativeLevel()); return FAILED(mDevice->TestCooperativeLevel());
} }
...@@ -821,6 +821,29 @@ bool Display::testDeviceLost() ...@@ -821,6 +821,29 @@ bool Display::testDeviceLost()
return false; // No device yet, so no reset required return false; // No device yet, so no reset required
} }
bool Display::testDeviceResettable()
{
HRESULT status = D3D_OK;
if (mDeviceEx)
{
status = mDeviceEx->CheckDeviceState(NULL);
}
else if (mDevice)
{
status = mDevice->TestCooperativeLevel();
}
switch (status)
{
case D3DERR_DEVICENOTRESET:
case D3DERR_DEVICEHUNG:
return true;
default:
return false;
}
}
void Display::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray) void Display::getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray)
{ {
for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++) for (int multiSampleIndex = 0; multiSampleIndex <= D3DMULTISAMPLE_16_SAMPLES; multiSampleIndex++)
......
...@@ -61,7 +61,8 @@ class Display ...@@ -61,7 +61,8 @@ class Display
virtual IDirect3DDevice9 *getDevice(); virtual IDirect3DDevice9 *getDevice();
virtual D3DCAPS9 getDeviceCaps(); virtual D3DCAPS9 getDeviceCaps();
virtual D3DADAPTER_IDENTIFIER9 *getAdapterIdentifier(); virtual D3DADAPTER_IDENTIFIER9 *getAdapterIdentifier();
bool testDeviceLost(); virtual bool testDeviceLost();
virtual bool testDeviceResettable();
virtual void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray); virtual void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
virtual bool getDXT1TextureSupport(); virtual bool getDXT1TextureSupport();
virtual bool getDXT3TextureSupport(); virtual bool getDXT3TextureSupport();
......
...@@ -159,6 +159,7 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext) : m ...@@ -159,6 +159,7 @@ Context::Context(const egl::Config *config, const gl::Context *shareContext) : m
mHasBeenCurrent = false; mHasBeenCurrent = false;
mContextLost = false; mContextLost = false;
mResetStatus = GL_NO_ERROR;
mSupportsDXT1Textures = false; mSupportsDXT1Textures = false;
mSupportsDXT3Textures = false; mSupportsDXT3Textures = false;
...@@ -392,6 +393,7 @@ void Context::markAllStateDirty() ...@@ -392,6 +393,7 @@ void Context::markAllStateDirty()
void Context::markContextLost() void Context::markContextLost()
{ {
mResetStatus = GL_UNKNOWN_CONTEXT_RESET_EXT;
mContextLost = true; mContextLost = true;
} }
...@@ -3003,6 +3005,31 @@ GLenum Context::getError() ...@@ -3003,6 +3005,31 @@ GLenum Context::getError()
return GL_NO_ERROR; return GL_NO_ERROR;
} }
GLenum Context::getResetStatus()
{
if (mResetStatus == GL_NO_ERROR)
{
bool lost = mDisplay->testDeviceLost();
if (lost)
{
mDisplay->notifyDeviceLost(); // Sets mResetStatus
}
}
GLenum status = mResetStatus;
if (mResetStatus != GL_NO_ERROR)
{
if (mDisplay->testDeviceResettable())
{
mResetStatus = GL_NO_ERROR;
}
}
return status;
}
bool Context::supportsShaderModel3() const bool Context::supportsShaderModel3() const
{ {
return mSupportsShaderModel3; return mSupportsShaderModel3;
......
...@@ -437,6 +437,7 @@ class Context ...@@ -437,6 +437,7 @@ class Context
void recordInvalidFramebufferOperation(); void recordInvalidFramebufferOperation();
GLenum getError(); GLenum getError();
GLenum getResetStatus();
bool supportsShaderModel3() const; bool supportsShaderModel3() const;
int getMaximumVaryingVectors() const; int getMaximumVaryingVectors() const;
...@@ -537,6 +538,7 @@ class Context ...@@ -537,6 +538,7 @@ class Context
// Current/lost context flags // Current/lost context flags
bool mHasBeenCurrent; bool mHasBeenCurrent;
bool mContextLost; bool mContextLost;
GLenum mResetStatus;
unsigned int mAppliedTextureSerialPS[MAX_TEXTURE_IMAGE_UNITS]; unsigned int mAppliedTextureSerialPS[MAX_TEXTURE_IMAGE_UNITS];
unsigned int mAppliedTextureSerialVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF]; unsigned int mAppliedTextureSerialVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF];
......
...@@ -2850,6 +2850,27 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac ...@@ -2850,6 +2850,27 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
} }
} }
GLenum __stdcall glGetGraphicsResetStatusEXT(void)
{
EVENT("()");
try
{
gl::Context *context = gl::getContext();
if (context)
{
return context->getResetStatus();
}
return GL_NO_ERROR;
}
catch(std::bad_alloc&)
{
return GL_OUT_OF_MEMORY;
}
}
void __stdcall glGetIntegerv(GLenum pname, GLint* params) void __stdcall glGetIntegerv(GLenum pname, GLint* params)
{ {
EVENT("(GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pname, params); EVENT("(GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pname, params);
...@@ -5802,6 +5823,7 @@ __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char * ...@@ -5802,6 +5823,7 @@ __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *
{"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE}, {"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE},
{"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV}, {"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV},
{"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV}, {"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV},
{"glGetGraphicsResetStatusEXT", (__eglMustCastToProperFunctionPointerType)glGetGraphicsResetStatusEXT},
{"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV}, {"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV},
{"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV}, {"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV},
{"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV}, {"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV},
...@@ -5821,6 +5843,8 @@ __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char * ...@@ -5821,6 +5843,8 @@ __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *
return NULL; return NULL;
} }
// Non-public functions used by EGL
void __stdcall glBindTexImage(egl::Surface *surface) void __stdcall glBindTexImage(egl::Surface *surface)
{ {
EVENT("(egl::Surface* surface = 0x%0.8p)", EVENT("(egl::Surface* surface = 0x%0.8p)",
......
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