Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(917)

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h

Issue 1852533002: Remove alpha/depth/stencil/antialias from WGC3D::Attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@premul
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
index 140c949d5d472fff8e6c7f4f20360ebe22e8ff02..a4f70eeb17b1b5a4197a2274aa357ae8177e151b 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -76,7 +76,15 @@ public:
Discard
};
- static PassRefPtr<DrawingBuffer> create(PassOwnPtr<WebGraphicsContext3DProvider>, const IntSize&, bool premultipliedAlpha, PreserveDrawingBuffer, WebGraphicsContext3D::Attributes requestedAttributes);
+ static PassRefPtr<DrawingBuffer> create(
+ PassOwnPtr<WebGraphicsContext3DProvider>,
+ const IntSize&,
+ bool premultipliedAlpha,
+ bool wantAlphaChannel,
+ bool wantDepthBuffer,
+ bool wantStencilBuffer,
+ bool wantAntialiasing,
+ PreserveDrawingBuffer);
static void forceNextDrawingBufferCreationToFail();
~DrawingBuffer() override;
@@ -92,11 +100,11 @@ public:
// in the situation where the end user only asked for a depth buffer. In this case, we need to
// upgrade clears of the depth buffer to clears of the depth and stencil buffers in order to
// avoid performance problems on some GPUs.
- bool hasImplicitStencilBuffer() const;
+ bool hasImplicitStencilBuffer() const { return m_hasImplicitStencilBuffer; }
// Given the desired buffer size, provides the largest dimensions that will fit in the pixel budget.
static IntSize adjustSize(const IntSize& desiredSize, const IntSize& curSize, int maxTextureSize);
- bool reset(const IntSize&);
+ bool reset(const IntSize&, bool wantAlphaChannel, bool wantDepthOrStencilBuffer);
void bind(GLenum target);
IntSize size() const { return m_size; }
@@ -154,9 +162,8 @@ public:
gpu::gles2::GLES2Interface* contextGL();
WebGraphicsContext3DProvider* contextProvider();
- // Returns the actual context attributes for this drawing buffer which may differ from the
- // requested context attributes due to implementation limits.
- WebGraphicsContext3D::Attributes getActualAttributes() const { return m_actualAttributes; }
+ bool hasDepthBuffer() const { return m_hasDepthBuffer; }
+ bool hasStencilBuffer() const { return m_hasStencilBuffer; }
// WebExternalTextureLayerClient implementation.
bool prepareMailbox(WebExternalTextureMailbox*, WebExternalBitmap*) override;
@@ -183,13 +190,11 @@ protected: // For unittests
DrawingBuffer(
PassOwnPtr<WebGraphicsContext3DProvider>,
PassOwnPtr<Extensions3DUtil>,
- bool multisampleExtensionSupported,
bool discardFramebufferSupported,
bool premultipliedAlpha,
- PreserveDrawingBuffer,
- WebGraphicsContext3D::Attributes requestedAttributes);
+ PreserveDrawingBuffer);
- bool initialize(const IntSize&);
+ bool initialize(const IntSize&, bool wantAlphaChannel, bool wantDepthBuffer, bool wantStencilBuffer, bool multisampleExtensionSupported);
private:
struct TextureParameters {
@@ -240,10 +245,10 @@ private:
// The texture parameters to use for a texture that will be backed by a
// CHROMIUM_image.
- TextureParameters chromiumImageTextureParameters();
+ TextureParameters chromiumImageTextureParameters(bool wantAlphaChannel);
// The texture parameters to use for a default texture.
- TextureParameters defaultTextureParameters();
+ TextureParameters defaultTextureParameters(bool wantAlphaChannel);
void mailboxReleasedWithoutRecycling(const WebExternalTextureMailbox&);
@@ -254,8 +259,8 @@ private:
// Create the depth/stencil and multisample buffers, if needed.
void createSecondaryBuffers();
- bool resizeFramebuffer(const IntSize&);
- bool resizeMultisampleFramebuffer(const IntSize&);
+ bool resizeFramebuffer(const IntSize&, bool wantDepthOrStencilBuffer);
+ bool resizeMultisampleFramebuffer(const IntSize&, bool wantDepthOrStencilBuffer);
void resizeDepthStencil(const IntSize&);
void clearPlatformLayer();
@@ -290,10 +295,10 @@ private:
// Tries to create a CHROMIUM_image backed texture if
// RuntimeEnabledFeatures::webGLImageChromiumEnabled() is true. On failure,
// or if the flag is false, creates a default texture.
- TextureInfo createTextureAndAllocateMemory(const IntSize&);
+ TextureInfo createTextureAndAllocateMemory(const IntSize&, bool wantAlphaChannel);
// Creates and allocates space for a default texture.
- TextureInfo createDefaultTextureAndAllocateMemory(const IntSize&);
+ TextureInfo createDefaultTextureAndAllocateMemory(const IntSize&, bool wantAlphaChannel);
void resizeTextureMemory(TextureInfo*, const IntSize&);
@@ -311,10 +316,13 @@ private:
gpu::gles2::GLES2Interface* m_gl; // Lifetime is tied to the m_contextProvider.
OwnPtr<Extensions3DUtil> m_extensionsUtil;
IntSize m_size;
- WebGraphicsContext3D::Attributes m_requestedAttributes;
- bool m_multisampleExtensionSupported;
+ WebGraphicsContext3D::Attributes m_attributes;
bool m_discardFramebufferSupported;
bool m_premultipliedAlpha;
+ bool m_hasAlphaChannel;
+ bool m_hasDepthBuffer;
+ bool m_hasStencilBuffer;
+ bool m_hasImplicitStencilBuffer;
GLuint m_fbo;
// DrawingBuffer's output is double-buffered. m_colorBuffer is the back buffer.
TextureInfo m_colorBuffer;
@@ -349,7 +357,6 @@ private:
AntialiasingMode m_antiAliasingMode;
- WebGraphicsContext3D::Attributes m_actualAttributes;
int m_maxTextureSize;
int m_sampleCount;
int m_packAlignment;

Powered by Google App Engine
This is Rietveld 408576698