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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp

Issue 1950763002: Remove abstractions around GLuint and GL constants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 gl->BindTexture(GL_TEXTURE_2D, depthStencil); 128 gl->BindTexture(GL_TEXTURE_2D, depthStencil);
129 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, 1, 1, 0, GL_DEPTH _STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, buffer); 129 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, 1, 1, 0, GL_DEPTH _STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, buffer);
130 } 130 }
131 GLuint depth = 0; 131 GLuint depth = 0;
132 if (supportsDepth) { 132 if (supportsDepth) {
133 gl->GenTextures(1, &depth); 133 gl->GenTextures(1, &depth);
134 gl->BindTexture(GL_TEXTURE_2D, depth); 134 gl->BindTexture(GL_TEXTURE_2D, depth);
135 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 1, 1, 0, GL_DEPTH_C OMPONENT, GL_UNSIGNED_INT, buffer); 135 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 1, 1, 0, GL_DEPTH_C OMPONENT, GL_UNSIGNED_INT, buffer);
136 } 136 }
137 137
138 Vector<Platform3DObject> colors; 138 Vector<GLuint> colors;
139 bool ok = true; 139 bool ok = true;
140 GLint maxAllowedBuffers = std::min(maxDrawBuffers, maxColorAttachments); 140 GLint maxAllowedBuffers = std::min(maxDrawBuffers, maxColorAttachments);
141 for (GLint i = 0; i < maxAllowedBuffers; ++i) { 141 for (GLint i = 0; i < maxAllowedBuffers; ++i) {
142 GLuint color; 142 GLuint color;
143 143
144 gl->GenTextures(1, &color); 144 gl->GenTextures(1, &color);
145 colors.append(color); 145 colors.append(color);
146 gl->BindTexture(GL_TEXTURE_2D, color); 146 gl->BindTexture(GL_TEXTURE_2D, color);
147 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_ BYTE, buffer); 147 gl->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_ BYTE, buffer);
148 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TE XTURE_2D, color, 0); 148 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TE XTURE_2D, color, 0);
(...skipping 27 matching lines...) Expand all
176 if (supportsDepth) 176 if (supportsDepth)
177 gl->DeleteTextures(1, &depth); 177 gl->DeleteTextures(1, &depth);
178 if (supportsDepthStencil) 178 if (supportsDepthStencil)
179 gl->DeleteTextures(1, &depthStencil); 179 gl->DeleteTextures(1, &depthStencil);
180 gl->DeleteTextures(colors.size(), colors.data()); 180 gl->DeleteTextures(colors.size(), colors.data());
181 181
182 return ok; 182 return ok;
183 } 183 }
184 184
185 } // namespace blink 185 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698