Bug 1184402 - Reset format usage authority on context lose/restore. r=jgilbert

This commit is contained in:
Dan Glastonbury 2015-08-04 13:39:47 +10:00
parent e3d5bca93c
commit 1a99cebbe6
6 changed files with 21 additions and 3 deletions

View File

@ -20,13 +20,18 @@ WebGL1Context::Create()
WebGL1Context::WebGL1Context()
: WebGLContext()
{
mFormatUsage = Move(webgl::FormatUsageAuthority::CreateForWebGL1());
}
WebGL1Context::~WebGL1Context()
{
}
UniquePtr<webgl::FormatUsageAuthority>
WebGL1Context::CreateFormatUsage() const
{
return webgl::FormatUsageAuthority::CreateForWebGL1();
}
JSObject*
WebGL1Context::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto)
{

View File

@ -18,6 +18,7 @@ public:
private:
WebGL1Context();
virtual UniquePtr<webgl::FormatUsageAuthority> CreateFormatUsage() const override;
public:
virtual ~WebGL1Context();

View File

@ -21,8 +21,6 @@ WebGL2Context::WebGL2Context()
{
MOZ_ASSERT(IsSupported(), "not supposed to create a WebGL2Context"
"context when not supported");
mFormatUsage = Move(webgl::FormatUsageAuthority::CreateForWebGL2());
}
WebGL2Context::~WebGL2Context()
@ -30,6 +28,12 @@ WebGL2Context::~WebGL2Context()
}
UniquePtr<webgl::FormatUsageAuthority>
WebGL2Context::CreateFormatUsage() const
{
return webgl::FormatUsageAuthority::CreateForWebGL2();
}
/*static*/ bool
WebGL2Context::IsSupported()
{

View File

@ -356,6 +356,7 @@ public:
private:
WebGL2Context();
virtual UniquePtr<webgl::FormatUsageAuthority> CreateFormatUsage() const override;
virtual bool IsTexParamValid(GLenum pname) const override;

View File

@ -1487,7 +1487,9 @@ public:
void GenerateWarning(const char* fmt, ...);
void GenerateWarning(const char* fmt, va_list ap);
public:
UniquePtr<webgl::FormatUsageAuthority> mFormatUsage;
virtual UniquePtr<webgl::FormatUsageAuthority> CreateFormatUsage() const = 0;
// Friend list
friend class WebGLTexture;

View File

@ -1653,6 +1653,11 @@ WebGLContext::InitAndValidateGL()
if (!gl)
return false;
// Unconditionally create a new format usage authority. This is
// important when restoring contexts and extensions need to add
// formats back into the authority.
mFormatUsage = CreateFormatUsage();
GLenum error = gl->fGetError();
if (error != LOCAL_GL_NO_ERROR) {
GenerateWarning("GL error 0x%x occurred during OpenGL context"