зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1559286 - Remove gl.msaa-level and SurfaceCaps.antialias. r=lsalzman
Also remove now-clearly-defunct parts of GLScreenBuffer. Differential Revision: https://phabricator.services.mozilla.com/D34987 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fb616d00a6
Коммит
e13411ac11
|
@ -1746,16 +1746,6 @@ GLFormats GLContext::ChooseGLFormats(const SurfaceCaps& caps) const {
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t msaaLevel = StaticPrefs::MSAALevel();
|
||||
GLsizei samples = msaaLevel * msaaLevel;
|
||||
samples = std::min(samples, mMaxSamples);
|
||||
|
||||
// Bug 778765.
|
||||
if (WorkAroundDriverBugs() && samples == 1) {
|
||||
samples = 0;
|
||||
}
|
||||
formats.samples = samples;
|
||||
|
||||
// Be clear that these are 0 if unavailable.
|
||||
formats.depthStencil = 0;
|
||||
if (IsSupported(GLFeature::packed_depth_stencil)) {
|
||||
|
@ -2899,5 +2889,14 @@ void GLContext::OnImplicitMakeCurrentFailure(const char* const funcName) {
|
|||
<< " mImplicitMakeCurrent.";
|
||||
}
|
||||
|
||||
// -
|
||||
|
||||
// These are defined out of line so that we don't need to include
|
||||
// ISurfaceAllocator.h in SurfaceTypes.h.
|
||||
SurfaceCaps::SurfaceCaps() = default;
|
||||
SurfaceCaps::SurfaceCaps(const SurfaceCaps& other) = default;
|
||||
SurfaceCaps& SurfaceCaps::operator=(const SurfaceCaps& other) = default;
|
||||
SurfaceCaps::~SurfaceCaps() = default;
|
||||
|
||||
} /* namespace gl */
|
||||
} /* namespace mozilla */
|
||||
|
|
|
@ -1154,26 +1154,15 @@ already_AddRefed<GLContext> GLContextProviderEGL::CreateOffscreen(
|
|||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
SurfaceCaps minBackbufferCaps = minOffscreenCaps;
|
||||
if (minOffscreenCaps.antialias) {
|
||||
minBackbufferCaps.antialias = false;
|
||||
minBackbufferCaps.depth = false;
|
||||
minBackbufferCaps.stencil = false;
|
||||
}
|
||||
|
||||
gl = GLContextEGL::CreateEGLPBufferOffscreenContext(
|
||||
flags, size, minBackbufferCaps, out_failureId);
|
||||
flags, size, minOffscreenCaps, out_failureId);
|
||||
if (!gl) return nullptr;
|
||||
|
||||
// Pull the actual resulting caps to ensure that our offscreen matches our
|
||||
// backbuffer.
|
||||
minOffscreenCaps.alpha = gl->Caps().alpha;
|
||||
if (!minOffscreenCaps.antialias) {
|
||||
// Only update these if we don't have AA. If we do have AA, we ignore
|
||||
// backbuffer depth/stencil.
|
||||
minOffscreenCaps.depth = gl->Caps().depth;
|
||||
minOffscreenCaps.stencil = gl->Caps().stencil;
|
||||
}
|
||||
minOffscreenCaps.depth = gl->Caps().depth;
|
||||
minOffscreenCaps.stencil = gl->Caps().stencil;
|
||||
}
|
||||
|
||||
// Init the offscreen with the updated offscreen caps.
|
||||
|
|
|
@ -773,8 +773,6 @@ static bool ChooseConfig(GLXLibrary* glx, Display* display, int screen,
|
|||
GLXFBConfig* const out_config, int* const out_visid) {
|
||||
ScopedXFree<GLXFBConfig>& scopedConfigArr = *out_scopedConfigArr;
|
||||
|
||||
if (minCaps.antialias) return false;
|
||||
|
||||
int attribs[] = {LOCAL_GLX_DRAWABLE_TYPE,
|
||||
LOCAL_GLX_PIXMAP_BIT,
|
||||
LOCAL_GLX_X_RENDERABLE,
|
||||
|
@ -1041,16 +1039,8 @@ already_AddRefed<GLContext> GLContextProviderGLX::CreateHeadless(
|
|||
already_AddRefed<GLContext> GLContextProviderGLX::CreateOffscreen(
|
||||
const IntSize& size, const SurfaceCaps& minCaps, CreateContextFlags flags,
|
||||
nsACString* const out_failureId) {
|
||||
SurfaceCaps minBackbufferCaps = minCaps;
|
||||
if (minCaps.antialias) {
|
||||
minBackbufferCaps.antialias = false;
|
||||
minBackbufferCaps.depth = false;
|
||||
minBackbufferCaps.stencil = false;
|
||||
}
|
||||
|
||||
RefPtr<GLContext> gl;
|
||||
gl = CreateOffscreenPixmapContext(flags, size, minBackbufferCaps,
|
||||
out_failureId);
|
||||
gl = CreateOffscreenPixmapContext(flags, size, minCaps, out_failureId);
|
||||
if (!gl) return nullptr;
|
||||
|
||||
if (!gl->InitOffscreen(size, minCaps)) {
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */
|
||||
/* 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 "GLContextTypes.h"
|
||||
#include <cstring>
|
||||
|
||||
using namespace mozilla::gl;
|
||||
|
||||
GLFormats::GLFormats() { std::memset(this, 0, sizeof(GLFormats)); }
|
|
@ -19,19 +19,14 @@ enum class GLContextType { Unknown, WGL, CGL, GLX, EGL, EAGL };
|
|||
enum class OriginPos : uint8_t { TopLeft, BottomLeft };
|
||||
|
||||
struct GLFormats {
|
||||
// Constructs a zeroed object:
|
||||
GLFormats();
|
||||
GLenum color_texInternalFormat = 0;
|
||||
GLenum color_texFormat = 0;
|
||||
GLenum color_texType = 0;
|
||||
GLenum color_rbFormat = 0;
|
||||
|
||||
GLenum color_texInternalFormat;
|
||||
GLenum color_texFormat;
|
||||
GLenum color_texType;
|
||||
GLenum color_rbFormat;
|
||||
|
||||
GLenum depthStencil;
|
||||
GLenum depth;
|
||||
GLenum stencil;
|
||||
|
||||
GLsizei samples;
|
||||
GLenum depthStencil = 0;
|
||||
GLenum depth = 0;
|
||||
GLenum stencil = 0;
|
||||
};
|
||||
|
||||
enum class CreateContextFlags : uint8_t {
|
||||
|
|
|
@ -43,9 +43,6 @@ UniquePtr<GLScreenBuffer> GLScreenBuffer::Create(GLContext* gl,
|
|||
const gfx::IntSize& size,
|
||||
const SurfaceCaps& caps) {
|
||||
UniquePtr<GLScreenBuffer> ret;
|
||||
if (caps.antialias && !gl->IsSupported(GLFeature::framebuffer_multisample)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
layers::TextureFlags flags = layers::TextureFlags::ORIGIN_BOTTOM_LEFT;
|
||||
if (!caps.premultAlpha) {
|
||||
|
@ -155,7 +152,6 @@ GLScreenBuffer::GLScreenBuffer(GLContext* gl, const SurfaceCaps& caps,
|
|||
|
||||
GLScreenBuffer::~GLScreenBuffer() {
|
||||
mFactory = nullptr;
|
||||
mDraw = nullptr;
|
||||
mRead = nullptr;
|
||||
|
||||
if (!mBack) return;
|
||||
|
@ -395,37 +391,6 @@ void GLScreenBuffer::RequireBlit() { mNeedsBlit = true; }
|
|||
void GLScreenBuffer::AssureBlitted() {
|
||||
if (!mNeedsBlit) return;
|
||||
|
||||
if (mDraw) {
|
||||
GLuint drawFB = DrawFB();
|
||||
GLuint readFB = ReadFB();
|
||||
|
||||
MOZ_ASSERT(drawFB != 0);
|
||||
MOZ_ASSERT(drawFB != readFB);
|
||||
MOZ_ASSERT(mGL->IsSupported(GLFeature::split_framebuffer));
|
||||
MOZ_ASSERT(mDraw->mSize == mRead->Size());
|
||||
|
||||
ScopedBindFramebuffer boundFB(mGL);
|
||||
ScopedGLState scissor(mGL, LOCAL_GL_SCISSOR_TEST, false);
|
||||
|
||||
BindReadFB_Internal(drawFB);
|
||||
BindDrawFB_Internal(readFB);
|
||||
|
||||
if (mGL->IsSupported(GLFeature::framebuffer_blit)) {
|
||||
const gfx::IntSize& srcSize = mDraw->mSize;
|
||||
const gfx::IntSize& destSize = mRead->Size();
|
||||
|
||||
mGL->raw_fBlitFramebuffer(0, 0, srcSize.width, srcSize.height, 0, 0,
|
||||
destSize.width, destSize.height,
|
||||
LOCAL_GL_COLOR_BUFFER_BIT, LOCAL_GL_NEAREST);
|
||||
} else if (mGL->IsExtensionSupported(
|
||||
GLContext::APPLE_framebuffer_multisample)) {
|
||||
mGL->fResolveMultisampleFramebufferAPPLE();
|
||||
} else {
|
||||
MOZ_CRASH("GFX: No available blit methods.");
|
||||
}
|
||||
// Done!
|
||||
}
|
||||
|
||||
mNeedsBlit = false;
|
||||
}
|
||||
|
||||
|
@ -449,25 +414,8 @@ bool GLScreenBuffer::Attach(SharedSurface* surf, const gfx::IntSize& size) {
|
|||
// Same size, same type, ready for reuse!
|
||||
mRead->Attach(surf);
|
||||
} else {
|
||||
// Else something changed, so resize:
|
||||
UniquePtr<DrawBuffer> draw;
|
||||
bool drawOk = true;
|
||||
|
||||
/* Don't change out the draw buffer unless we resize. In the
|
||||
* preserveDrawingBuffer:true case, prior contents of the buffer must
|
||||
* be retained. If we're using a draw buffer, it's an MSAA buffer, so
|
||||
* even if we copy the previous frame into the (single-sampled) read
|
||||
* buffer, if we need to re-resolve from draw to read (as triggered by
|
||||
* drawing), we'll need the old MSAA content to still be in the draw
|
||||
* buffer.
|
||||
*/
|
||||
if (!mDraw || size != Size())
|
||||
drawOk = CreateDraw(size, &draw); // Can be null.
|
||||
|
||||
UniquePtr<ReadBuffer> read = CreateRead(surf);
|
||||
bool readOk = !!read;
|
||||
|
||||
if (!drawOk || !readOk) {
|
||||
if (!read) {
|
||||
surf->UnlockProd();
|
||||
if (readNeedsUnlock) {
|
||||
SharedSurf()->LockProd();
|
||||
|
@ -475,8 +423,6 @@ bool GLScreenBuffer::Attach(SharedSurface* surf, const gfx::IntSize& size) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (draw) mDraw = std::move(draw);
|
||||
|
||||
mRead = std::move(read);
|
||||
}
|
||||
|
||||
|
@ -519,7 +465,7 @@ bool GLScreenBuffer::Swap(const gfx::IntSize& size) {
|
|||
mFront = mBack;
|
||||
mBack = newBack;
|
||||
|
||||
if (ShouldPreserveBuffer() && mFront && mBack && !mDraw) {
|
||||
if (ShouldPreserveBuffer() && mFront && mBack) {
|
||||
auto src = mFront->Surf();
|
||||
auto dest = mBack->Surf();
|
||||
|
||||
|
@ -575,15 +521,6 @@ bool GLScreenBuffer::Resize(const gfx::IntSize& size) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GLScreenBuffer::CreateDraw(const gfx::IntSize& size,
|
||||
UniquePtr<DrawBuffer>* out_buffer) {
|
||||
GLContext* gl = mFactory->mGL;
|
||||
const GLFormats& formats = mFactory->mFormats;
|
||||
const SurfaceCaps& caps = mFactory->DrawCaps();
|
||||
|
||||
return DrawBuffer::Create(gl, caps, formats, size, out_buffer);
|
||||
}
|
||||
|
||||
UniquePtr<ReadBuffer> GLScreenBuffer::CreateRead(SharedSurface* surf) {
|
||||
GLContext* gl = mFactory->mGL;
|
||||
const GLFormats& formats = mFactory->mFormats;
|
||||
|
@ -600,7 +537,7 @@ void GLScreenBuffer::SetDrawBuffer(GLenum mode) {
|
|||
|
||||
mUserDrawBufferMode = mode;
|
||||
|
||||
GLuint fb = mDraw ? mDraw->mFB : mRead->mFB;
|
||||
GLuint fb = mRead->mFB;
|
||||
GLenum internalMode;
|
||||
|
||||
switch (mode) {
|
||||
|
@ -629,8 +566,7 @@ void GLScreenBuffer::SetReadBuffer(GLenum mode) {
|
|||
}
|
||||
|
||||
bool GLScreenBuffer::IsDrawFramebufferDefault() const {
|
||||
if (!mDraw) return IsReadFramebufferDefault();
|
||||
return mDraw->mFB == 0;
|
||||
return IsReadFramebufferDefault();
|
||||
}
|
||||
|
||||
bool GLScreenBuffer::IsReadFramebufferDefault() const {
|
||||
|
@ -648,143 +584,39 @@ uint32_t GLScreenBuffer::DepthBits() const {
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
// Utils
|
||||
|
||||
static void RenderbufferStorageBySamples(GLContext* aGL, GLsizei aSamples,
|
||||
GLenum aInternalFormat,
|
||||
const gfx::IntSize& aSize) {
|
||||
if (aSamples) {
|
||||
aGL->fRenderbufferStorageMultisample(LOCAL_GL_RENDERBUFFER, aSamples,
|
||||
aInternalFormat, aSize.width,
|
||||
aSize.height);
|
||||
} else {
|
||||
aGL->fRenderbufferStorage(LOCAL_GL_RENDERBUFFER, aInternalFormat,
|
||||
aSize.width, aSize.height);
|
||||
}
|
||||
}
|
||||
static void CreateRenderbuffersForOffscreen(GLContext* const aGL,
|
||||
const GLFormats& aFormats,
|
||||
const gfx::IntSize& aSize,
|
||||
GLuint* const aDepthRB,
|
||||
GLuint* const aStencilRB) {
|
||||
const auto fnCreateRenderbuffer = [&](const GLenum sizedFormat) {
|
||||
GLuint rb = 0;
|
||||
aGL->fGenRenderbuffers(1, &rb);
|
||||
ScopedBindRenderbuffer autoRB(aGL, rb);
|
||||
|
||||
static GLuint CreateRenderbuffer(GLContext* aGL, GLenum aFormat,
|
||||
GLsizei aSamples, const gfx::IntSize& aSize) {
|
||||
GLuint rb = 0;
|
||||
aGL->fGenRenderbuffers(1, &rb);
|
||||
ScopedBindRenderbuffer autoRB(aGL, rb);
|
||||
|
||||
RenderbufferStorageBySamples(aGL, aSamples, aFormat, aSize);
|
||||
|
||||
return rb;
|
||||
}
|
||||
|
||||
static void CreateRenderbuffersForOffscreen(
|
||||
GLContext* aGL, const GLFormats& aFormats, const gfx::IntSize& aSize,
|
||||
bool aMultisample, GLuint* aColorMSRB, GLuint* aDepthRB,
|
||||
GLuint* aStencilRB) {
|
||||
GLsizei samples = aMultisample ? aFormats.samples : 0;
|
||||
if (aColorMSRB) {
|
||||
MOZ_ASSERT(aFormats.samples > 0);
|
||||
MOZ_ASSERT(aFormats.color_rbFormat);
|
||||
|
||||
GLenum colorFormat = aFormats.color_rbFormat;
|
||||
if (aGL->IsANGLE()) {
|
||||
MOZ_ASSERT(colorFormat == LOCAL_GL_RGBA8);
|
||||
colorFormat = LOCAL_GL_BGRA8_EXT;
|
||||
}
|
||||
|
||||
*aColorMSRB = CreateRenderbuffer(aGL, colorFormat, samples, aSize);
|
||||
}
|
||||
aGL->fRenderbufferStorage(LOCAL_GL_RENDERBUFFER, sizedFormat, aSize.width,
|
||||
aSize.height);
|
||||
return rb;
|
||||
};
|
||||
|
||||
if (aDepthRB && aStencilRB && aFormats.depthStencil) {
|
||||
*aDepthRB = CreateRenderbuffer(aGL, aFormats.depthStencil, samples, aSize);
|
||||
*aDepthRB = fnCreateRenderbuffer(aFormats.depthStencil);
|
||||
*aStencilRB = *aDepthRB;
|
||||
} else {
|
||||
if (aDepthRB) {
|
||||
MOZ_ASSERT(aFormats.depth);
|
||||
|
||||
*aDepthRB = CreateRenderbuffer(aGL, aFormats.depth, samples, aSize);
|
||||
*aDepthRB = fnCreateRenderbuffer(aFormats.depth);
|
||||
}
|
||||
|
||||
if (aStencilRB) {
|
||||
MOZ_ASSERT(aFormats.stencil);
|
||||
|
||||
*aStencilRB = CreateRenderbuffer(aGL, aFormats.stencil, samples, aSize);
|
||||
*aStencilRB = fnCreateRenderbuffer(aFormats.stencil);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// DrawBuffer
|
||||
|
||||
bool DrawBuffer::Create(GLContext* const gl, const SurfaceCaps& caps,
|
||||
const GLFormats& formats, const gfx::IntSize& size,
|
||||
UniquePtr<DrawBuffer>* out_buffer) {
|
||||
MOZ_ASSERT(out_buffer);
|
||||
*out_buffer = nullptr;
|
||||
|
||||
if (!caps.color) {
|
||||
MOZ_ASSERT(!caps.alpha && !caps.depth && !caps.stencil);
|
||||
|
||||
// Nothing is needed.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (caps.antialias) {
|
||||
if (formats.samples == 0) return false; // Can't create it.
|
||||
|
||||
MOZ_ASSERT(uint32_t(formats.samples) <= gl->MaxSamples());
|
||||
}
|
||||
|
||||
GLuint colorMSRB = 0;
|
||||
GLuint depthRB = 0;
|
||||
GLuint stencilRB = 0;
|
||||
|
||||
GLuint* pColorMSRB = caps.antialias ? &colorMSRB : nullptr;
|
||||
GLuint* pDepthRB = caps.depth ? &depthRB : nullptr;
|
||||
GLuint* pStencilRB = caps.stencil ? &stencilRB : nullptr;
|
||||
|
||||
if (!formats.color_rbFormat) pColorMSRB = nullptr;
|
||||
|
||||
if (pDepthRB && pStencilRB) {
|
||||
if (!formats.depth && !formats.depthStencil) pDepthRB = nullptr;
|
||||
|
||||
if (!formats.stencil && !formats.depthStencil) pStencilRB = nullptr;
|
||||
} else {
|
||||
if (!formats.depth) pDepthRB = nullptr;
|
||||
|
||||
if (!formats.stencil) pStencilRB = nullptr;
|
||||
}
|
||||
|
||||
GLContext::LocalErrorScope localError(*gl);
|
||||
|
||||
CreateRenderbuffersForOffscreen(gl, formats, size, caps.antialias, pColorMSRB,
|
||||
pDepthRB, pStencilRB);
|
||||
|
||||
GLuint fb = 0;
|
||||
gl->fGenFramebuffers(1, &fb);
|
||||
gl->AttachBuffersToFB(0, colorMSRB, depthRB, stencilRB, fb);
|
||||
|
||||
const GLsizei samples = formats.samples;
|
||||
UniquePtr<DrawBuffer> ret(
|
||||
new DrawBuffer(gl, size, samples, fb, colorMSRB, depthRB, stencilRB));
|
||||
|
||||
GLenum err = localError.GetError();
|
||||
MOZ_ASSERT_IF(err != LOCAL_GL_NO_ERROR, err == LOCAL_GL_OUT_OF_MEMORY);
|
||||
if (err || !gl->IsFramebufferComplete(fb)) return false;
|
||||
|
||||
*out_buffer = std::move(ret);
|
||||
return true;
|
||||
}
|
||||
|
||||
DrawBuffer::~DrawBuffer() {
|
||||
if (!mGL->MakeCurrent()) return;
|
||||
|
||||
GLuint fb = mFB;
|
||||
GLuint rbs[] = {
|
||||
mColorMSRB, mDepthRB,
|
||||
(mStencilRB != mDepthRB) ? mStencilRB
|
||||
: 0, // Don't double-delete DEPTH_STENCIL RBs.
|
||||
};
|
||||
|
||||
mGL->fDeleteFramebuffers(1, &fb);
|
||||
mGL->fDeleteRenderbuffers(3, rbs);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// ReadBuffer
|
||||
|
||||
|
@ -806,8 +638,8 @@ UniquePtr<ReadBuffer> ReadBuffer::Create(GLContext* gl, const SurfaceCaps& caps,
|
|||
|
||||
GLContext::LocalErrorScope localError(*gl);
|
||||
|
||||
CreateRenderbuffersForOffscreen(gl, formats, surf->mSize, caps.antialias,
|
||||
nullptr, pDepthRB, pStencilRB);
|
||||
CreateRenderbuffersForOffscreen(gl, formats, surf->mSize, pDepthRB,
|
||||
pStencilRB);
|
||||
|
||||
GLuint colorTex = 0;
|
||||
GLuint colorRB = 0;
|
||||
|
|
|
@ -37,41 +37,6 @@ class SharedSurface;
|
|||
class ShSurfHandle;
|
||||
class SurfaceFactory;
|
||||
|
||||
class DrawBuffer {
|
||||
public:
|
||||
// Fallible!
|
||||
// But it may return true with *out_buffer==nullptr if unneeded.
|
||||
static bool Create(GLContext* const gl, const SurfaceCaps& caps,
|
||||
const GLFormats& formats, const gfx::IntSize& size,
|
||||
UniquePtr<DrawBuffer>* out_buffer);
|
||||
|
||||
protected:
|
||||
GLContext* const mGL;
|
||||
|
||||
public:
|
||||
const gfx::IntSize mSize;
|
||||
const GLsizei mSamples;
|
||||
const GLuint mFB;
|
||||
|
||||
protected:
|
||||
const GLuint mColorMSRB;
|
||||
const GLuint mDepthRB;
|
||||
const GLuint mStencilRB;
|
||||
|
||||
DrawBuffer(GLContext* gl, const gfx::IntSize& size, GLsizei samples,
|
||||
GLuint fb, GLuint colorMSRB, GLuint depthRB, GLuint stencilRB)
|
||||
: mGL(gl),
|
||||
mSize(size),
|
||||
mSamples(samples),
|
||||
mFB(fb),
|
||||
mColorMSRB(colorMSRB),
|
||||
mDepthRB(depthRB),
|
||||
mStencilRB(stencilRB) {}
|
||||
|
||||
public:
|
||||
virtual ~DrawBuffer();
|
||||
};
|
||||
|
||||
class ReadBuffer {
|
||||
public:
|
||||
// Infallible, always non-null.
|
||||
|
@ -136,7 +101,6 @@ class GLScreenBuffer {
|
|||
RefPtr<layers::SharedSurfaceTextureClient> mBack;
|
||||
RefPtr<layers::SharedSurfaceTextureClient> mFront;
|
||||
|
||||
UniquePtr<DrawBuffer> mDraw;
|
||||
UniquePtr<ReadBuffer> mRead;
|
||||
|
||||
bool mNeedsBlit;
|
||||
|
@ -174,27 +138,16 @@ class GLScreenBuffer {
|
|||
|
||||
bool ShouldPreserveBuffer() const { return mCaps.preserve; }
|
||||
|
||||
GLuint DrawFB() const {
|
||||
if (!mDraw) return ReadFB();
|
||||
|
||||
return mDraw->mFB;
|
||||
}
|
||||
GLuint DrawFB() const { return ReadFB(); }
|
||||
|
||||
GLuint ReadFB() const { return mRead->mFB; }
|
||||
|
||||
GLsizei Samples() const {
|
||||
if (!mDraw) return 0;
|
||||
|
||||
return mDraw->mSamples;
|
||||
}
|
||||
|
||||
uint32_t DepthBits() const;
|
||||
|
||||
void DeletingFB(GLuint fb);
|
||||
|
||||
const gfx::IntSize& Size() const {
|
||||
MOZ_ASSERT(mRead);
|
||||
MOZ_ASSERT(!mDraw || mDraw->mSize == mRead->Size());
|
||||
return mRead->Size();
|
||||
}
|
||||
|
||||
|
@ -242,7 +195,6 @@ class GLScreenBuffer {
|
|||
protected:
|
||||
bool Attach(SharedSurface* surf, const gfx::IntSize& size);
|
||||
|
||||
bool CreateDraw(const gfx::IntSize& size, UniquePtr<DrawBuffer>* out_buffer);
|
||||
UniquePtr<ReadBuffer> CreateRead(SharedSurface* surf);
|
||||
|
||||
public:
|
||||
|
|
|
@ -241,21 +241,10 @@ static void ChooseBufferBits(const SurfaceCaps& caps,
|
|||
screenCaps.depth = caps.depth;
|
||||
screenCaps.stencil = caps.stencil;
|
||||
|
||||
screenCaps.antialias = caps.antialias;
|
||||
screenCaps.preserve = caps.preserve;
|
||||
|
||||
if (caps.antialias) {
|
||||
*out_drawCaps = screenCaps;
|
||||
out_readCaps->Clear();
|
||||
|
||||
// Color caps need to be duplicated in readCaps.
|
||||
out_readCaps->color = caps.color;
|
||||
out_readCaps->alpha = caps.alpha;
|
||||
out_readCaps->bpp16 = caps.bpp16;
|
||||
} else {
|
||||
out_drawCaps->Clear();
|
||||
*out_readCaps = screenCaps;
|
||||
}
|
||||
out_drawCaps->Clear();
|
||||
*out_readCaps = screenCaps;
|
||||
}
|
||||
|
||||
SurfaceFactory::SurfaceFactory(
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */
|
||||
/* 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 "SurfaceTypes.h"
|
||||
|
||||
#include "mozilla/layers/TextureForwarder.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
SurfaceCaps::SurfaceCaps() { Clear(); }
|
||||
|
||||
/* These are defined out of line so that we don't need to include
|
||||
* ISurfaceAllocator.h in the header */
|
||||
SurfaceCaps::SurfaceCaps(const SurfaceCaps& other) = default;
|
||||
SurfaceCaps& SurfaceCaps::operator=(const SurfaceCaps& other) = default;
|
||||
|
||||
void SurfaceCaps::Clear() {
|
||||
any = false;
|
||||
color = false;
|
||||
alpha = false;
|
||||
bpp16 = false;
|
||||
depth = false;
|
||||
stencil = false;
|
||||
antialias = false;
|
||||
premultAlpha = true;
|
||||
preserve = false;
|
||||
surfaceAllocator = nullptr;
|
||||
}
|
||||
|
||||
SurfaceCaps::~SurfaceCaps() {}
|
||||
|
||||
} // namespace gl
|
||||
} // namespace mozilla
|
|
@ -18,13 +18,14 @@ class LayersIPCChannel;
|
|||
namespace gl {
|
||||
|
||||
struct SurfaceCaps final {
|
||||
bool any;
|
||||
bool color, alpha;
|
||||
bool bpp16;
|
||||
bool depth, stencil;
|
||||
bool antialias;
|
||||
bool premultAlpha;
|
||||
bool preserve;
|
||||
bool any = false;
|
||||
bool color = false;
|
||||
bool alpha = false;
|
||||
bool bpp16 = false;
|
||||
bool depth = false;
|
||||
bool stencil = false;
|
||||
bool premultAlpha = true;
|
||||
bool preserve = false;
|
||||
|
||||
// The surface allocator that we want to create this
|
||||
// for. May be null.
|
||||
|
@ -34,7 +35,7 @@ struct SurfaceCaps final {
|
|||
SurfaceCaps(const SurfaceCaps& other);
|
||||
~SurfaceCaps();
|
||||
|
||||
void Clear();
|
||||
void Clear() { *this = {}; }
|
||||
|
||||
SurfaceCaps& operator=(const SurfaceCaps& other);
|
||||
|
||||
|
|
|
@ -125,7 +125,6 @@ UNIFIED_SOURCES += [
|
|||
'GLContext.cpp',
|
||||
'GLContextFeatures.cpp',
|
||||
'GLContextProviderEGL.cpp',
|
||||
'GLContextTypes.cpp',
|
||||
'GLDebugUtils.cpp',
|
||||
'GLLibraryEGL.cpp',
|
||||
'GLLibraryLoader.cpp',
|
||||
|
@ -138,7 +137,6 @@ UNIFIED_SOURCES += [
|
|||
'SharedSurface.cpp',
|
||||
'SharedSurfaceEGL.cpp',
|
||||
'SharedSurfaceGL.cpp',
|
||||
'SurfaceTypes.cpp',
|
||||
'TextureImageEGL.cpp',
|
||||
]
|
||||
|
||||
|
|
|
@ -3507,13 +3507,6 @@ VARCACHE_PREF(
|
|||
RelaxedAtomicBool, false
|
||||
)
|
||||
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
"gl.msaa-level",
|
||||
MSAALevel,
|
||||
RelaxedAtomicUint32, 2
|
||||
)
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
VARCACHE_PREF(
|
||||
Live,
|
||||
|
|
Загрузка…
Ссылка в новой задаче