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

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

Issue 1883153003: Fixed regression in WEBGL_draw_buffers support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expectation for single failing trybot Created 4 years, 8 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/WebGLDrawBuffers.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp
index 4142408539e52bc7a1e8e4fdae9daded81ad263c..fed31b9d42f8fb1a4ce32c53034f9df61ea3aa37 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp
@@ -140,6 +140,7 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web
GLint maxAllowedBuffers = std::min(maxDrawBuffers, maxColorAttachments);
for (GLint i = 0; i < maxAllowedBuffers; ++i) {
GLuint color;
+
gl->GenTextures(1, &color);
colors.append(color);
gl->BindTexture(GL_TEXTURE_2D, color);
@@ -158,14 +159,14 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web
gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
}
if (supportsDepthStencil) {
- gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0);
- gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0);
+ // For ES 2.0 contexts DEPTH_STENCIL is not available natively, so we emulate it
+ // at the command buffer level for WebGL contexts.
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, depthStencil, 0);
if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
ok = false;
break;
}
- gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
- gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
+ gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
}
}
@@ -177,6 +178,7 @@ bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web
if (supportsDepthStencil)
gl->DeleteTextures(1, &depthStencil);
gl->DeleteTextures(colors.size(), colors.data());
+
return ok;
}

Powered by Google App Engine
This is Rietveld 408576698