mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1413230 - Ensure we are attached to the GL context in SurfaceTextureHostOGL::PrepareTextureSource() r=jnicol,nical
MozReview-Commit-ID: BxDng9OG3RF
This commit is contained in:
parent
6931291fc3
commit
bc001da86a
@ -453,12 +453,11 @@ SurfaceTextureHost::~SurfaceTextureHost()
|
||||
void
|
||||
SurfaceTextureHost::PrepareTextureSource(CompositableTextureSourceRef& aTexture)
|
||||
{
|
||||
GLContext* gl = this->gl();
|
||||
if (!gl || !gl->MakeCurrent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mContinuousUpdate && mSurfTex) {
|
||||
if (!EnsureAttached()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// UpdateTexImage() advances the internal buffer queue, so we only want to call this
|
||||
// once per transactionwhen we are not in continuous mode (as we are here). Otherwise,
|
||||
// the SurfaceTexture content will be de-synced from the rest of the page in subsequent
|
||||
@ -474,14 +473,32 @@ SurfaceTextureHost::gl() const
|
||||
}
|
||||
|
||||
bool
|
||||
SurfaceTextureHost::Lock()
|
||||
SurfaceTextureHost::EnsureAttached()
|
||||
{
|
||||
GLContext* gl = this->gl();
|
||||
if (!gl || !gl->MakeCurrent()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mSurfTex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GLContext* gl = this->gl();
|
||||
if (!gl || !gl->MakeCurrent()) {
|
||||
if (!mSurfTex->IsAttachedToGLContext((int64_t)gl)) {
|
||||
GLuint texName;
|
||||
gl->fGenTextures(1, &texName);
|
||||
if (NS_FAILED(mSurfTex->AttachToGLContext((int64_t)gl, texName))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SurfaceTextureHost::Lock()
|
||||
{
|
||||
if (!EnsureAttached()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -501,14 +518,6 @@ SurfaceTextureHost::Lock()
|
||||
mIgnoreTransform);
|
||||
}
|
||||
|
||||
if (!mSurfTex->IsAttachedToGLContext((int64_t)gl)) {
|
||||
GLuint texName;
|
||||
gl->fGenTextures(1, &texName);
|
||||
if (NS_FAILED(mSurfTex->AttachToGLContext((int64_t)gl, texName))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -429,6 +429,8 @@ public:
|
||||
virtual const char* Name() override { return "SurfaceTextureHost"; }
|
||||
|
||||
protected:
|
||||
bool EnsureAttached();
|
||||
|
||||
mozilla::java::GeckoSurfaceTexture::GlobalRef mSurfTex;
|
||||
const gfx::IntSize mSize;
|
||||
const gfx::SurfaceFormat mFormat;
|
||||
|
Loading…
Reference in New Issue
Block a user