| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/blink/webgraphicscontext3d_impl.h" | 5 #include "gpu/blink/webgraphicscontext3d_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 } | 193 } |
| 194 | 194 |
| 195 void WebGraphicsContext3DImpl::synthesizeGLError(WGC3Denum error) { | 195 void WebGraphicsContext3DImpl::synthesizeGLError(WGC3Denum error) { |
| 196 if (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == | 196 if (std::find(synthetic_errors_.begin(), synthetic_errors_.end(), error) == |
| 197 synthetic_errors_.end()) { | 197 synthetic_errors_.end()) { |
| 198 synthetic_errors_.push_back(error); | 198 synthetic_errors_.push_back(error); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 DELEGATE_TO_GL_R(lastFlushID, GetLastFlushIdCHROMIUM, WebGLId) | |
| 203 | |
| 204 DELEGATE_TO_GL_R(insertFenceSyncCHROMIUM, InsertFenceSyncCHROMIUM, WGC3Duint64) | |
| 205 | |
| 206 bool WebGraphicsContext3DImpl::genSyncTokenCHROMIUM(WGC3Duint64 fenceSync, | 202 bool WebGraphicsContext3DImpl::genSyncTokenCHROMIUM(WGC3Duint64 fenceSync, |
| 207 WGC3Dbyte* syncToken) { | 203 WGC3Dbyte* syncToken) { |
| 208 gl_->GenSyncTokenCHROMIUM(fenceSync, syncToken); | 204 gl_->GenSyncTokenCHROMIUM(fenceSync, syncToken); |
| 209 return true; | 205 return true; |
| 210 } | 206 } |
| 211 | 207 |
| 212 DELEGATE_TO_GL_1(waitSyncTokenCHROMIUM, WaitSyncTokenCHROMIUM, const WGC3Dbyte*) | |
| 213 | |
| 214 DELEGATE_TO_GL_3(discardFramebufferEXT, DiscardFramebufferEXT, WGC3Denum, | |
| 215 WGC3Dsizei, const WGC3Denum*) | |
| 216 | |
| 217 blink::WebString WebGraphicsContext3DImpl:: | 208 blink::WebString WebGraphicsContext3DImpl:: |
| 218 getRequestableExtensionsCHROMIUM() { | 209 getRequestableExtensionsCHROMIUM() { |
| 219 return blink::WebString::fromUTF8( | 210 return blink::WebString::fromUTF8( |
| 220 gl_->GetRequestableExtensionsCHROMIUM()); | 211 gl_->GetRequestableExtensionsCHROMIUM()); |
| 221 } | 212 } |
| 222 | 213 |
| 223 DELEGATE_TO_GL_1(requestExtensionCHROMIUM, RequestExtensionCHROMIUM, | |
| 224 const char*) | |
| 225 | |
| 226 void WebGraphicsContext3DImpl::blitFramebufferCHROMIUM( | 214 void WebGraphicsContext3DImpl::blitFramebufferCHROMIUM( |
| 227 WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, | 215 WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, |
| 228 WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, | 216 WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, |
| 229 WGC3Dbitfield mask, WGC3Denum filter) { | 217 WGC3Dbitfield mask, WGC3Denum filter) { |
| 230 gl_->BlitFramebufferCHROMIUM( | 218 gl_->BlitFramebufferCHROMIUM( |
| 231 srcX0, srcY0, srcX1, srcY1, | 219 srcX0, srcY0, srcX1, srcY1, |
| 232 dstX0, dstY0, dstX1, dstY1, | 220 dstX0, dstY0, dstX1, dstY1, |
| 233 mask, filter); | 221 mask, filter); |
| 234 } | 222 } |
| 235 | 223 |
| 236 DELEGATE_TO_GL_5(renderbufferStorageMultisampleCHROMIUM, | |
| 237 RenderbufferStorageMultisampleCHROMIUM, WGC3Denum, WGC3Dsizei, | |
| 238 WGC3Denum, WGC3Dsizei, WGC3Dsizei) | |
| 239 | |
| 240 DELEGATE_TO_GL_1(activeTexture, ActiveTexture, WGC3Denum) | |
| 241 | |
| 242 DELEGATE_TO_GL(applyScreenSpaceAntialiasingCHROMIUM, | |
| 243 ApplyScreenSpaceAntialiasingCHROMIUM); | |
| 244 | |
| 245 DELEGATE_TO_GL_2(attachShader, AttachShader, WebGLId, WebGLId) | |
| 246 | |
| 247 DELEGATE_TO_GL_3(bindAttribLocation, BindAttribLocation, WebGLId, | |
| 248 WGC3Duint, const WGC3Dchar*) | |
| 249 | |
| 250 DELEGATE_TO_GL_2(bindBuffer, BindBuffer, WGC3Denum, WebGLId) | |
| 251 | |
| 252 DELEGATE_TO_GL_2(bindFramebuffer, BindFramebuffer, WGC3Denum, WebGLId) | |
| 253 | |
| 254 DELEGATE_TO_GL_2(bindRenderbuffer, BindRenderbuffer, WGC3Denum, WebGLId) | |
| 255 | |
| 256 DELEGATE_TO_GL_2(bindTexture, BindTexture, WGC3Denum, WebGLId) | |
| 257 | |
| 258 DELEGATE_TO_GL_4(blendColor, BlendColor, | |
| 259 WGC3Dclampf, WGC3Dclampf, WGC3Dclampf, WGC3Dclampf) | |
| 260 | |
| 261 DELEGATE_TO_GL_1(blendEquation, BlendEquation, WGC3Denum) | |
| 262 | |
| 263 DELEGATE_TO_GL_2(blendEquationSeparate, BlendEquationSeparate, | |
| 264 WGC3Denum, WGC3Denum) | |
| 265 | |
| 266 DELEGATE_TO_GL_2(blendFunc, BlendFunc, WGC3Denum, WGC3Denum) | |
| 267 | |
| 268 DELEGATE_TO_GL_4(blendFuncSeparate, BlendFuncSeparate, | |
| 269 WGC3Denum, WGC3Denum, WGC3Denum, WGC3Denum) | |
| 270 | |
| 271 DELEGATE_TO_GL_4(bufferData, BufferData, | |
| 272 WGC3Denum, WGC3Dsizeiptr, const void*, WGC3Denum) | |
| 273 | |
| 274 DELEGATE_TO_GL_4(bufferSubData, BufferSubData, | |
| 275 WGC3Denum, WGC3Dintptr, WGC3Dsizeiptr, const void*) | |
| 276 | |
| 277 DELEGATE_TO_GL_1R(checkFramebufferStatus, CheckFramebufferStatus, | |
| 278 WGC3Denum, WGC3Denum) | |
| 279 | |
| 280 DELEGATE_TO_GL_1(clear, Clear, WGC3Dbitfield) | |
| 281 | |
| 282 DELEGATE_TO_GL_4(clearColor, ClearColor, | |
| 283 WGC3Dclampf, WGC3Dclampf, WGC3Dclampf, WGC3Dclampf) | |
| 284 | |
| 285 DELEGATE_TO_GL_1(clearDepth, ClearDepthf, WGC3Dclampf) | |
| 286 | |
| 287 DELEGATE_TO_GL_1(clearStencil, ClearStencil, WGC3Dint) | |
| 288 | |
| 289 DELEGATE_TO_GL_4(colorMask, ColorMask, | |
| 290 WGC3Dboolean, WGC3Dboolean, WGC3Dboolean, WGC3Dboolean) | |
| 291 | |
| 292 DELEGATE_TO_GL_1(compileShader, CompileShader, WebGLId) | |
| 293 | |
| 294 DELEGATE_TO_GL_8(compressedTexImage2D, CompressedTexImage2D, | |
| 295 WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dint, WGC3Dint, | |
| 296 WGC3Dsizei, WGC3Dsizei, const void*) | |
| 297 | |
| 298 DELEGATE_TO_GL_9(compressedTexSubImage2D, CompressedTexSubImage2D, | |
| 299 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, | |
| 300 WGC3Denum, WGC3Dsizei, const void*) | |
| 301 | |
| 302 DELEGATE_TO_GL_8(copyTexImage2D, CopyTexImage2D, | |
| 303 WGC3Denum, WGC3Dint, WGC3Denum, WGC3Dint, WGC3Dint, | |
| 304 WGC3Dsizei, WGC3Dsizei, WGC3Dint) | |
| 305 | |
| 306 DELEGATE_TO_GL_8(copyTexSubImage2D, CopyTexSubImage2D, | |
| 307 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, | |
| 308 WGC3Dsizei, WGC3Dsizei) | |
| 309 | |
| 310 DELEGATE_TO_GL_1(cullFace, CullFace, WGC3Denum) | |
| 311 | |
| 312 DELEGATE_TO_GL_1(depthFunc, DepthFunc, WGC3Denum) | |
| 313 | |
| 314 DELEGATE_TO_GL_1(depthMask, DepthMask, WGC3Dboolean) | |
| 315 | |
| 316 DELEGATE_TO_GL_2(depthRange, DepthRangef, WGC3Dclampf, WGC3Dclampf) | |
| 317 | |
| 318 DELEGATE_TO_GL_2(detachShader, DetachShader, WebGLId, WebGLId) | |
| 319 | |
| 320 DELEGATE_TO_GL_1(disable, Disable, WGC3Denum) | |
| 321 | |
| 322 DELEGATE_TO_GL_1(disableVertexAttribArray, DisableVertexAttribArray, | |
| 323 WGC3Duint) | |
| 324 | |
| 325 DELEGATE_TO_GL_3(drawArrays, DrawArrays, WGC3Denum, WGC3Dint, WGC3Dsizei) | |
| 326 | |
| 327 void WebGraphicsContext3DImpl::drawElements(WGC3Denum mode, | 224 void WebGraphicsContext3DImpl::drawElements(WGC3Denum mode, |
| 328 WGC3Dsizei count, | 225 WGC3Dsizei count, |
| 329 WGC3Denum type, | 226 WGC3Denum type, |
| 330 WGC3Dintptr offset) { | 227 WGC3Dintptr offset) { |
| 331 gl_->DrawElements( | 228 gl_->DrawElements( |
| 332 mode, count, type, | 229 mode, count, type, |
| 333 reinterpret_cast<void*>(static_cast<intptr_t>(offset))); | 230 reinterpret_cast<void*>(static_cast<intptr_t>(offset))); |
| 334 } | 231 } |
| 335 | 232 |
| 336 DELEGATE_TO_GL_1(enable, Enable, WGC3Denum) | |
| 337 | |
| 338 DELEGATE_TO_GL_1(enableVertexAttribArray, EnableVertexAttribArray, | |
| 339 WGC3Duint) | |
| 340 | |
| 341 DELEGATE_TO_GL(finish, Finish) | 233 DELEGATE_TO_GL(finish, Finish) |
| 342 DELEGATE_TO_GL(flush, Flush) | 234 DELEGATE_TO_GL(flush, Flush) |
| 343 | 235 |
| 344 DELEGATE_TO_GL_1(frontFace, FrontFace, WGC3Denum) | 236 DELEGATE_TO_GL_1(frontFace, FrontFace, WGC3Denum) |
| 345 | 237 |
| 346 DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, WGC3Denum) | 238 DELEGATE_TO_GL_1(generateMipmap, GenerateMipmap, WGC3Denum) |
| 347 | 239 |
| 348 bool WebGraphicsContext3DImpl::getActiveAttrib( | 240 bool WebGraphicsContext3DImpl::getActiveAttrib( |
| 349 WebGLId program, WGC3Duint index, ActiveInfo& info) { | 241 WebGLId program, WGC3Duint index, ActiveInfo& info) { |
| 350 if (!program) { | 242 if (!program) { |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_WEBGL2; | 1075 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_WEBGL2; |
| 1184 break; | 1076 break; |
| 1185 default: | 1077 default: |
| 1186 NOTREACHED(); | 1078 NOTREACHED(); |
| 1187 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_OPENGLES2; | 1079 output_attribs->context_type = ::gpu::gles2::CONTEXT_TYPE_OPENGLES2; |
| 1188 break; | 1080 break; |
| 1189 } | 1081 } |
| 1190 } | 1082 } |
| 1191 | 1083 |
| 1192 } // namespace gpu_blink | 1084 } // namespace gpu_blink |
| OLD | NEW |