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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2125023002: Reland "webgl: use immutable texture for the default FBO." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: create immutable texture on WebGL2 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/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index f516c0de10c4a3346599dfedc00c53128916a293..b75e8f3ecaf0b35f1ddaa34c0bbc192abbddd318 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -885,15 +885,21 @@ bool isSRGBFormat(GLenum internalformat)
} // namespace
-WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes)
- : WebGLRenderingContextBase(nullptr, passedOffscreenCanvas, std::move(contextProvider), requestedAttributes)
+WebGLRenderingContextBase::WebGLRenderingContextBase(OffscreenCanvas* passedOffscreenCanvas,
+ std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
+ const WebGLContextAttributes& requestedAttributes, unsigned version)
+ : WebGLRenderingContextBase(nullptr, passedOffscreenCanvas, std::move(contextProvider), requestedAttributes, version)
{ }
-WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes)
- : WebGLRenderingContextBase(passedCanvas, nullptr, std::move(contextProvider), requestedAttributes)
+WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas,
+ std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
+ const WebGLContextAttributes& requestedAttributes, unsigned version)
+ : WebGLRenderingContextBase(passedCanvas, nullptr, std::move(contextProvider), requestedAttributes, version)
{ }
-WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttributes& requestedAttributes)
+WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas,
+ OffscreenCanvas* passedOffscreenCanvas, std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
+ const WebGLContextAttributes& requestedAttributes, unsigned version)
: CanvasRenderingContext(passedCanvas, passedOffscreenCanvas)
, m_isHidden(false)
, m_contextLostMode(NotLostContext)
@@ -913,6 +919,7 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCa
, m_isOESTextureHalfFloatFormatsTypesAdded(false)
, m_isWebGLDepthTextureFormatsTypesAdded(false)
, m_isEXTsRGBFormatsTypesAdded(false)
+ , m_version(version)
{
ASSERT(contextProvider);
@@ -952,6 +959,14 @@ PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(std::un
bool wantStencilBuffer = m_requestedAttributes.stencil();
bool wantAntialiasing = m_requestedAttributes.antialias();
DrawingBuffer::PreserveDrawingBuffer preserve = m_requestedAttributes.preserveDrawingBuffer() ? DrawingBuffer::Preserve : DrawingBuffer::Discard;
+ DrawingBuffer::WebGLVersion webGLVersion = DrawingBuffer::WebGL1;
+ if (version() == 1) {
dshwang 2016/07/07 12:33:26 version() has to be non-virtual to be used here, b
+ webGLVersion = DrawingBuffer::WebGL1;
+ } else if (version() == 2) {
+ webGLVersion = DrawingBuffer::WebGL2;
+ } else {
+ NOTREACHED();
+ }
return DrawingBuffer::create(
std::move(contextProvider),
clampedCanvasSize(),
@@ -960,7 +975,8 @@ PassRefPtr<DrawingBuffer> WebGLRenderingContextBase::createDrawingBuffer(std::un
wantDepthBuffer,
wantStencilBuffer,
wantAntialiasing,
- preserve);
+ preserve,
+ webGLVersion);
}
void WebGLRenderingContextBase::initializeNewContext()

Powered by Google App Engine
This is Rietveld 408576698