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

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

Issue 1817323003: Revert of Remove create/delete methods from WebGraphicsContext3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@complex-casts
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/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..bd921b84d70448877fde1fb7d60c543d551f12e2 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp
@@ -101,6 +101,7 @@
// static
bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* webglContext)
{
+ WebGraphicsContext3D* context = webglContext->webContext();
gpu::gles2::GLES2Interface* gl = webglContext->contextGL();
Extensions3DUtil* extensionsUtil = webglContext->extensionsUtil();
@@ -112,8 +113,7 @@
if (maxDrawBuffers < 4 || maxColorAttachments < 4)
return false;
- GLuint fbo;
- gl->GenFramebuffers(1, &fbo);
+ Platform3DObject fbo = context->createFramebuffer();
gl->BindFramebuffer(GL_FRAMEBUFFER, fbo);
const unsigned char* buffer = 0; // Chromium doesn't allow init data for depth/stencil tetxures.
@@ -122,15 +122,15 @@
|| extensionsUtil->supportsExtension("GL_ARB_depth_texture"));
bool supportsDepthStencil = (extensionsUtil->supportsExtension("GL_EXT_packed_depth_stencil")
|| extensionsUtil->supportsExtension("GL_OES_packed_depth_stencil"));
- GLuint depthStencil = 0;
+ Platform3DObject depthStencil = 0;
if (supportsDepthStencil) {
- gl->GenTextures(1, &depthStencil);
+ depthStencil = context->createTexture();
gl->BindTexture(GL_TEXTURE_2D, depthStencil);
gl->TexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, 1, 1, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, buffer);
}
- GLuint depth = 0;
+ Platform3DObject depth = 0;
if (supportsDepth) {
- gl->GenTextures(1, &depth);
+ depth = context->createTexture();
gl->BindTexture(GL_TEXTURE_2D, depth);
gl->TexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 1, 1, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, buffer);
}
@@ -139,8 +139,7 @@
bool ok = true;
GLint maxAllowedBuffers = std::min(maxDrawBuffers, maxColorAttachments);
for (GLint i = 0; i < maxAllowedBuffers; ++i) {
- GLuint color;
- gl->GenTextures(1, &color);
+ Platform3DObject color = context->createTexture();
colors.append(color);
gl->BindTexture(GL_TEXTURE_2D, color);
gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
@@ -170,13 +169,14 @@
}
webglContext->restoreCurrentFramebuffer();
- gl->DeleteFramebuffers(1, &fbo);
+ context->deleteFramebuffer(fbo);
webglContext->restoreCurrentTexture2D();
if (supportsDepth)
- gl->DeleteTextures(1, &depth);
+ context->deleteTexture(depth);
if (supportsDepthStencil)
- gl->DeleteTextures(1, &depthStencil);
- gl->DeleteTextures(colors.size(), colors.data());
+ context->deleteTexture(depthStencil);
+ for (size_t i = 0; i < colors.size(); ++i)
+ context->deleteTexture(colors[i]);
return ok;
}
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLBuffer.cpp ('k') | third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698