2013-02-13 15:26:24 -08:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "SharedSurfaceGL.h"
|
|
|
|
#include "GLContext.h"
|
2013-11-28 12:57:19 -08:00
|
|
|
#include "GLBlitHelper.h"
|
2013-11-25 19:25:25 -08:00
|
|
|
#include "ScopedGLHelpers.h"
|
2013-12-10 08:11:58 -08:00
|
|
|
#include "mozilla/gfx/2D.h"
|
2014-01-02 07:17:29 -08:00
|
|
|
#include "GLReadTexImageHelper.h"
|
2013-02-13 15:26:24 -08:00
|
|
|
|
|
|
|
using namespace mozilla::gfx;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
|
|
|
|
// |src| must begin and end locked, though we may
|
|
|
|
// temporarily unlock it if we need to.
|
|
|
|
void
|
2014-03-10 19:08:49 -07:00
|
|
|
SharedSurface_GL::ProdCopy(SharedSurface_GL* src, SharedSurface_GL* dest,
|
|
|
|
SurfaceFactory_GL* factory)
|
2013-02-13 15:26:24 -08:00
|
|
|
{
|
|
|
|
GLContext* gl = src->GL();
|
|
|
|
|
2014-04-15 09:01:21 -07:00
|
|
|
gl->MakeCurrent();
|
|
|
|
|
2013-02-13 15:26:24 -08:00
|
|
|
if (src->AttachType() == AttachmentType::Screen &&
|
|
|
|
dest->AttachType() == AttachmentType::Screen)
|
|
|
|
{
|
|
|
|
// Here, we actually need to blit through a temp surface, so let's make one.
|
|
|
|
nsAutoPtr<SharedSurface_GLTexture> tempSurf(
|
|
|
|
SharedSurface_GLTexture::Create(gl, gl,
|
|
|
|
factory->Formats(),
|
|
|
|
src->Size(),
|
|
|
|
factory->Caps().alpha));
|
|
|
|
|
2014-03-10 19:08:49 -07:00
|
|
|
ProdCopy(src, tempSurf, factory);
|
|
|
|
ProdCopy(tempSurf, dest, factory);
|
2013-02-13 15:26:24 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src->AttachType() == AttachmentType::Screen) {
|
2014-03-10 19:08:49 -07:00
|
|
|
SharedSurface_GL* origLocked = gl->GetLockedSurface();
|
2013-02-13 15:26:24 -08:00
|
|
|
bool srcNeedsUnlock = false;
|
|
|
|
bool origNeedsRelock = false;
|
|
|
|
if (origLocked != src) {
|
|
|
|
if (origLocked) {
|
|
|
|
origLocked->UnlockProd();
|
|
|
|
origNeedsRelock = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
src->LockProd();
|
|
|
|
srcNeedsUnlock = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dest->AttachType() == AttachmentType::GLTexture) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint destTex = dest->ProdTexture();
|
|
|
|
GLenum destTarget = dest->ProdTextureTarget();
|
2013-02-13 15:26:24 -08:00
|
|
|
|
2013-11-28 12:57:19 -08:00
|
|
|
gl->BlitHelper()->BlitFramebufferToTexture(0, destTex, src->Size(), dest->Size(), destTarget);
|
2013-02-13 15:26:24 -08:00
|
|
|
} else if (dest->AttachType() == AttachmentType::GLRenderbuffer) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint destRB = dest->ProdRenderbuffer();
|
2013-02-13 15:26:24 -08:00
|
|
|
ScopedFramebufferForRenderbuffer destWrapper(gl, destRB);
|
|
|
|
|
2013-11-28 12:57:19 -08:00
|
|
|
gl->BlitHelper()->BlitFramebufferToFramebuffer(0, destWrapper.FB(),
|
|
|
|
src->Size(), dest->Size());
|
2013-02-13 15:26:24 -08:00
|
|
|
} else {
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Unhandled dest->AttachType().");
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (srcNeedsUnlock)
|
|
|
|
src->UnlockProd();
|
|
|
|
|
|
|
|
if (origNeedsRelock)
|
|
|
|
origLocked->LockProd();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dest->AttachType() == AttachmentType::Screen) {
|
2014-03-10 19:08:49 -07:00
|
|
|
SharedSurface_GL* origLocked = gl->GetLockedSurface();
|
2013-02-13 15:26:24 -08:00
|
|
|
bool destNeedsUnlock = false;
|
|
|
|
bool origNeedsRelock = false;
|
|
|
|
if (origLocked != dest) {
|
|
|
|
if (origLocked) {
|
|
|
|
origLocked->UnlockProd();
|
|
|
|
origNeedsRelock = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
dest->LockProd();
|
|
|
|
destNeedsUnlock = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src->AttachType() == AttachmentType::GLTexture) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint srcTex = src->ProdTexture();
|
|
|
|
GLenum srcTarget = src->ProdTextureTarget();
|
2013-02-13 15:26:24 -08:00
|
|
|
|
2013-11-28 12:57:19 -08:00
|
|
|
gl->BlitHelper()->BlitTextureToFramebuffer(srcTex, 0, src->Size(), dest->Size(), srcTarget);
|
2013-02-13 15:26:24 -08:00
|
|
|
} else if (src->AttachType() == AttachmentType::GLRenderbuffer) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint srcRB = src->ProdRenderbuffer();
|
2013-02-13 15:26:24 -08:00
|
|
|
ScopedFramebufferForRenderbuffer srcWrapper(gl, srcRB);
|
|
|
|
|
2013-11-28 12:57:19 -08:00
|
|
|
gl->BlitHelper()->BlitFramebufferToFramebuffer(srcWrapper.FB(), 0,
|
|
|
|
src->Size(), dest->Size());
|
2013-02-13 15:26:24 -08:00
|
|
|
} else {
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Unhandled src->AttachType().");
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (destNeedsUnlock)
|
|
|
|
dest->UnlockProd();
|
|
|
|
|
|
|
|
if (origNeedsRelock)
|
|
|
|
origLocked->LockProd();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Alright, done with cases involving Screen types.
|
|
|
|
// Only {src,dest}x{texture,renderbuffer} left.
|
|
|
|
|
|
|
|
if (src->AttachType() == AttachmentType::GLTexture) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint srcTex = src->ProdTexture();
|
|
|
|
GLenum srcTarget = src->ProdTextureTarget();
|
2013-02-13 15:26:24 -08:00
|
|
|
|
|
|
|
if (dest->AttachType() == AttachmentType::GLTexture) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint destTex = dest->ProdTexture();
|
|
|
|
GLenum destTarget = dest->ProdTextureTarget();
|
2013-02-13 15:26:24 -08:00
|
|
|
|
2013-11-28 12:57:19 -08:00
|
|
|
gl->BlitHelper()->BlitTextureToTexture(srcTex, destTex,
|
|
|
|
src->Size(), dest->Size(),
|
|
|
|
srcTarget, destTarget);
|
2014-02-20 15:23:52 -08:00
|
|
|
|
2013-02-13 15:26:24 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dest->AttachType() == AttachmentType::GLRenderbuffer) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint destRB = dest->ProdRenderbuffer();
|
2013-02-13 15:26:24 -08:00
|
|
|
ScopedFramebufferForRenderbuffer destWrapper(gl, destRB);
|
|
|
|
|
2013-11-28 12:57:19 -08:00
|
|
|
gl->BlitHelper()->BlitTextureToFramebuffer(srcTex, destWrapper.FB(),
|
|
|
|
src->Size(), dest->Size(), srcTarget);
|
2014-02-20 15:23:52 -08:00
|
|
|
|
2013-02-13 15:26:24 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Unhandled dest->AttachType().");
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (src->AttachType() == AttachmentType::GLRenderbuffer) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint srcRB = src->ProdRenderbuffer();
|
2013-02-13 15:26:24 -08:00
|
|
|
ScopedFramebufferForRenderbuffer srcWrapper(gl, srcRB);
|
|
|
|
|
|
|
|
if (dest->AttachType() == AttachmentType::GLTexture) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint destTex = dest->ProdTexture();
|
|
|
|
GLenum destTarget = dest->ProdTextureTarget();
|
2013-02-13 15:26:24 -08:00
|
|
|
|
2013-11-28 12:57:19 -08:00
|
|
|
gl->BlitHelper()->BlitFramebufferToTexture(srcWrapper.FB(), destTex,
|
|
|
|
src->Size(), dest->Size(), destTarget);
|
2013-02-13 15:26:24 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dest->AttachType() == AttachmentType::GLRenderbuffer) {
|
2014-03-10 19:08:49 -07:00
|
|
|
GLuint destRB = dest->ProdRenderbuffer();
|
2013-02-13 15:26:24 -08:00
|
|
|
ScopedFramebufferForRenderbuffer destWrapper(gl, destRB);
|
|
|
|
|
2013-11-28 12:57:19 -08:00
|
|
|
gl->BlitHelper()->BlitFramebufferToFramebuffer(srcWrapper.FB(), destWrapper.FB(),
|
|
|
|
src->Size(), dest->Size());
|
2013-02-13 15:26:24 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Unhandled dest->AttachType().");
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Unhandled src->AttachType().");
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedSurface_GL::LockProd()
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!mIsLocked);
|
|
|
|
|
|
|
|
LockProdImpl();
|
|
|
|
|
2014-02-20 15:23:52 -08:00
|
|
|
mGL->LockSurface(this);
|
2013-02-13 15:26:24 -08:00
|
|
|
mIsLocked = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedSurface_GL::UnlockProd()
|
|
|
|
{
|
|
|
|
if (!mIsLocked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
UnlockProdImpl();
|
|
|
|
|
2014-02-20 15:23:52 -08:00
|
|
|
mGL->UnlockSurface(this);
|
2013-02-13 15:26:24 -08:00
|
|
|
mIsLocked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SurfaceFactory_GL::SurfaceFactory_GL(GLContext* gl,
|
|
|
|
SharedSurfaceType type,
|
|
|
|
const SurfaceCaps& caps)
|
|
|
|
: SurfaceFactory(type, caps)
|
|
|
|
, mGL(gl)
|
|
|
|
, mFormats(gl->ChooseGLFormats(caps))
|
|
|
|
{
|
|
|
|
ChooseBufferBits(caps, mDrawCaps, mReadCaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceFactory_GL::ChooseBufferBits(const SurfaceCaps& caps,
|
|
|
|
SurfaceCaps& drawCaps,
|
|
|
|
SurfaceCaps& readCaps) const
|
|
|
|
{
|
|
|
|
SurfaceCaps screenCaps;
|
|
|
|
|
|
|
|
screenCaps.color = caps.color;
|
|
|
|
screenCaps.alpha = caps.alpha;
|
|
|
|
screenCaps.bpp16 = caps.bpp16;
|
|
|
|
|
|
|
|
screenCaps.depth = caps.depth;
|
|
|
|
screenCaps.stencil = caps.stencil;
|
|
|
|
|
|
|
|
screenCaps.antialias = caps.antialias;
|
|
|
|
screenCaps.preserve = caps.preserve;
|
|
|
|
|
|
|
|
if (caps.antialias) {
|
|
|
|
drawCaps = screenCaps;
|
|
|
|
readCaps.Clear();
|
|
|
|
|
|
|
|
// Color caps need to be duplicated in readCaps.
|
|
|
|
readCaps.color = caps.color;
|
|
|
|
readCaps.alpha = caps.alpha;
|
|
|
|
readCaps.bpp16 = caps.bpp16;
|
|
|
|
} else {
|
|
|
|
drawCaps.Clear();
|
|
|
|
readCaps = screenCaps;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SharedSurface_Basic*
|
|
|
|
SharedSurface_Basic::Create(GLContext* gl,
|
|
|
|
const GLFormats& formats,
|
2013-12-10 08:11:58 -08:00
|
|
|
const IntSize& size,
|
2013-02-13 15:26:24 -08:00
|
|
|
bool hasAlpha)
|
|
|
|
{
|
|
|
|
gl->MakeCurrent();
|
2013-12-06 07:36:13 -08:00
|
|
|
GLuint tex = CreateTexture(gl, formats.color_texInternalFormat,
|
|
|
|
formats.color_texFormat,
|
|
|
|
formats.color_texType,
|
|
|
|
size);
|
2013-02-13 15:26:24 -08:00
|
|
|
|
2014-01-10 11:06:16 -08:00
|
|
|
SurfaceFormat format = SurfaceFormat::B8G8R8X8;
|
2013-02-13 15:26:24 -08:00
|
|
|
switch (formats.color_texInternalFormat) {
|
|
|
|
case LOCAL_GL_RGB:
|
|
|
|
case LOCAL_GL_RGB8:
|
|
|
|
if (formats.color_texType == LOCAL_GL_UNSIGNED_SHORT_5_6_5)
|
2014-01-10 11:06:16 -08:00
|
|
|
format = SurfaceFormat::R5G6B5;
|
2013-02-13 15:26:24 -08:00
|
|
|
else
|
2014-01-10 11:06:16 -08:00
|
|
|
format = SurfaceFormat::B8G8R8X8;
|
2013-02-13 15:26:24 -08:00
|
|
|
break;
|
|
|
|
case LOCAL_GL_RGBA:
|
|
|
|
case LOCAL_GL_RGBA8:
|
2014-01-10 11:06:16 -08:00
|
|
|
format = SurfaceFormat::B8G8R8A8;
|
2013-02-13 15:26:24 -08:00
|
|
|
break;
|
|
|
|
default:
|
2013-06-28 18:38:30 -07:00
|
|
|
MOZ_CRASH("Unhandled Tex format.");
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
return new SharedSurface_Basic(gl, size, hasAlpha, format, tex);
|
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface_Basic::SharedSurface_Basic(GLContext* gl,
|
2013-12-10 08:11:58 -08:00
|
|
|
const IntSize& size,
|
2013-02-13 15:26:24 -08:00
|
|
|
bool hasAlpha,
|
2013-12-10 08:11:58 -08:00
|
|
|
SurfaceFormat format,
|
2013-02-13 15:26:24 -08:00
|
|
|
GLuint tex)
|
|
|
|
: SharedSurface_GL(SharedSurfaceType::Basic,
|
|
|
|
AttachmentType::GLTexture,
|
|
|
|
gl,
|
|
|
|
size,
|
|
|
|
hasAlpha)
|
2014-03-05 13:49:37 -08:00
|
|
|
, mTex(tex), mFB(0)
|
2013-02-13 15:26:24 -08:00
|
|
|
{
|
2014-03-05 13:49:37 -08:00
|
|
|
mGL->MakeCurrent();
|
|
|
|
mGL->fGenFramebuffers(1, &mFB);
|
|
|
|
|
|
|
|
ScopedBindFramebuffer autoFB(mGL, mFB);
|
|
|
|
mGL->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER,
|
|
|
|
LOCAL_GL_COLOR_ATTACHMENT0,
|
|
|
|
LOCAL_GL_TEXTURE_2D,
|
|
|
|
mTex,
|
|
|
|
0);
|
|
|
|
|
|
|
|
GLenum status = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
|
|
|
|
if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
mGL->fDeleteFramebuffers(1, &mFB);
|
|
|
|
mFB = 0;
|
|
|
|
}
|
|
|
|
|
2013-12-10 08:11:58 -08:00
|
|
|
mData = Factory::CreateDataSourceSurfaceWithStride(size, format,
|
|
|
|
GetAlignedStride<4>(size.width * BytesPerPixel(format)));
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface_Basic::~SharedSurface_Basic()
|
|
|
|
{
|
|
|
|
if (!mGL->MakeCurrent())
|
|
|
|
return;
|
|
|
|
|
2014-03-05 13:49:37 -08:00
|
|
|
if (mFB)
|
|
|
|
mGL->fDeleteFramebuffers(1, &mFB);
|
|
|
|
|
2014-02-13 15:02:03 -08:00
|
|
|
mGL->fDeleteTextures(1, &mTex);
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedSurface_Basic::Fence()
|
|
|
|
{
|
2014-02-20 15:23:52 -08:00
|
|
|
mGL->MakeCurrent();
|
2014-03-05 13:49:37 -08:00
|
|
|
ScopedBindFramebuffer autoFB(mGL, mFB);
|
2014-04-28 16:26:54 -07:00
|
|
|
ReadPixelsIntoDataSurface(mGL, mData);
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SharedSurface_GLTexture*
|
|
|
|
SharedSurface_GLTexture::Create(GLContext* prodGL,
|
2013-12-10 08:11:58 -08:00
|
|
|
GLContext* consGL,
|
|
|
|
const GLFormats& formats,
|
|
|
|
const gfx::IntSize& size,
|
2014-03-05 13:49:37 -08:00
|
|
|
bool hasAlpha,
|
|
|
|
GLuint texture)
|
2013-02-13 15:26:24 -08:00
|
|
|
{
|
2013-06-16 19:48:41 -07:00
|
|
|
MOZ_ASSERT(prodGL);
|
|
|
|
MOZ_ASSERT(!consGL || prodGL->SharesWith(consGL));
|
2013-02-13 15:26:24 -08:00
|
|
|
|
|
|
|
prodGL->MakeCurrent();
|
|
|
|
|
2014-03-05 13:49:37 -08:00
|
|
|
GLuint tex = texture;
|
|
|
|
|
|
|
|
bool ownsTex = false;
|
|
|
|
|
|
|
|
if (!tex) {
|
|
|
|
tex = CreateTextureForOffscreen(prodGL, formats, size);
|
|
|
|
ownsTex = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new SharedSurface_GLTexture(prodGL, consGL, size, hasAlpha, tex, ownsTex);
|
2013-02-13 15:26:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
SharedSurface_GLTexture::~SharedSurface_GLTexture()
|
|
|
|
{
|
|
|
|
if (!mGL->MakeCurrent())
|
|
|
|
return;
|
|
|
|
|
2014-03-05 13:49:37 -08:00
|
|
|
if (mOwnsTex) {
|
|
|
|
mGL->fDeleteTextures(1, &mTex);
|
|
|
|
}
|
2013-02-13 15:26:24 -08:00
|
|
|
|
|
|
|
if (mSync) {
|
|
|
|
mGL->fDeleteSync(mSync);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SharedSurface_GLTexture::Fence()
|
|
|
|
{
|
2013-06-04 17:05:28 -07:00
|
|
|
MutexAutoLock lock(mMutex);
|
2013-02-13 15:26:24 -08:00
|
|
|
mGL->MakeCurrent();
|
|
|
|
|
2013-06-04 17:05:28 -07:00
|
|
|
if (mConsGL && mGL->IsExtensionSupported(GLContext::ARB_sync)) {
|
2013-02-13 15:26:24 -08:00
|
|
|
if (mSync) {
|
|
|
|
mGL->fDeleteSync(mSync);
|
|
|
|
mSync = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
mSync = mGL->fFenceSync(LOCAL_GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
|
|
if (mSync) {
|
|
|
|
mGL->fFlush();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MOZ_ASSERT(!mSync);
|
|
|
|
|
|
|
|
mGL->fFinish();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SharedSurface_GLTexture::WaitSync()
|
|
|
|
{
|
2013-06-04 17:05:28 -07:00
|
|
|
MutexAutoLock lock(mMutex);
|
2013-02-13 15:26:24 -08:00
|
|
|
if (!mSync) {
|
|
|
|
// We must have used glFinish instead of glFenceSync.
|
|
|
|
return true;
|
|
|
|
}
|
2013-06-04 17:05:28 -07:00
|
|
|
|
2013-03-26 22:29:07 -07:00
|
|
|
mConsGL->MakeCurrent();
|
|
|
|
MOZ_ASSERT(mConsGL->IsExtensionSupported(GLContext::ARB_sync));
|
2013-02-13 15:26:24 -08:00
|
|
|
|
2013-03-26 22:29:07 -07:00
|
|
|
mConsGL->fWaitSync(mSync,
|
|
|
|
0,
|
|
|
|
LOCAL_GL_TIMEOUT_IGNORED);
|
|
|
|
mConsGL->fDeleteSync(mSync);
|
2013-02-13 15:26:24 -08:00
|
|
|
mSync = 0;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-10 19:08:50 -07:00
|
|
|
GLuint
|
|
|
|
SharedSurface_GLTexture::ConsTexture(GLContext* consGL)
|
2013-06-04 17:05:28 -07:00
|
|
|
{
|
|
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
MOZ_ASSERT(consGL);
|
2013-06-16 19:48:41 -07:00
|
|
|
MOZ_ASSERT(mGL->SharesWith(consGL));
|
2014-03-10 19:08:50 -07:00
|
|
|
MOZ_ASSERT_IF(mConsGL, consGL == mConsGL);
|
|
|
|
|
2013-06-04 17:05:28 -07:00
|
|
|
mConsGL = consGL;
|
2014-03-10 19:08:50 -07:00
|
|
|
|
|
|
|
return mTex;
|
2013-06-04 17:05:28 -07:00
|
|
|
}
|
|
|
|
|
2013-02-13 15:26:24 -08:00
|
|
|
} /* namespace gfx */
|
|
|
|
} /* namespace mozilla */
|