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

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

Issue 2125023002: Reland "webgl: use immutable texture for the default FBO." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: m_webGLVersion > WebGL1 (for future versions) Created 4 years, 5 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 e0a19da5761fbfe3445f69b93b6f22155621eb72..c6d86e4e7897291fa812573e9e04fc06a5227c81 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -72,6 +72,10 @@ public:
Preserve,
Discard
};
+ enum WebGLVersion {
+ WebGL1,
+ WebGL2,
+ };
static PassRefPtr<DrawingBuffer> create(
std::unique_ptr<WebGraphicsContext3DProvider>,
@@ -81,7 +85,8 @@ public:
bool wantDepthBuffer,
bool wantStencilBuffer,
bool wantAntialiasing,
- PreserveDrawingBuffer);
+ PreserveDrawingBuffer,
+ WebGLVersion);
static void forceNextDrawingBufferCreationToFail();
~DrawingBuffer() override;
@@ -227,6 +232,7 @@ protected: // For unittests
bool wantAlphaChannel,
bool premultipliedAlpha,
PreserveDrawingBuffer,
+ WebGLVersion,
bool wantsDepth,
bool wantsStencil);
@@ -253,6 +259,7 @@ private:
DISALLOW_NEW();
GLuint textureId = 0;
GLuint imageId = 0;
+ bool immutable = false;
// A GpuMemoryBuffer is a concept that the compositor understands. and
// is able to operate on. The id is scoped to renderer process.
@@ -321,9 +328,8 @@ private:
// Helper function to flip a bitmap vertically.
void flipVertically(uint8_t* data, int width, int height);
- // Helper to texImage2D with pixel==0 case: pixels are initialized to 0.
- // By default, alignment is 4, the OpenGL default setting.
- void texImage2DResourceSafe(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint alignment = 4);
+ // Allocate a storage texture if possible. Otherwise, allocate a regular texture.
+ void allocateConditionallyImmutableTexture(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
// Allocate buffer storage to be sent to compositor using either texImage2D or CHROMIUM_image based on available support.
void deleteChromiumImageForTexture(TextureInfo*);
@@ -358,6 +364,7 @@ private:
GLenum getMultisampledRenderbufferFormat();
const PreserveDrawingBuffer m_preserveDrawingBuffer;
+ const WebGLVersion m_webGLVersion;
bool m_scissorEnabled = false;
GLuint m_texture2DBinding = 0;
GLuint m_drawFramebufferBinding = 0;
@@ -376,6 +383,7 @@ private:
const bool m_wantAlphaChannel;
const bool m_premultipliedAlpha;
bool m_hasImplicitStencilBuffer = false;
+ bool m_storageTextureSupported = false;
struct FrontBufferInfo {
TextureInfo texInfo;
WebExternalTextureMailbox mailbox;

Powered by Google App Engine
This is Rietveld 408576698