| 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 "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
| 9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
| 10 #endif | 10 #endif |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return gl_->glname(a1, a2); \ | 286 return gl_->glname(a1, a2); \ |
| 287 } | 287 } |
| 288 | 288 |
| 289 #define DELEGATE_TO_GL_3(name, glname, t1, t2, t3) \ | 289 #define DELEGATE_TO_GL_3(name, glname, t1, t2, t3) \ |
| 290 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \ | 290 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \ |
| 291 t1 a1, t2 a2, t3 a3) { \ | 291 t1 a1, t2 a2, t3 a3) { \ |
| 292 ClearContext(); \ | 292 ClearContext(); \ |
| 293 gl_->glname(a1, a2, a3); \ | 293 gl_->glname(a1, a2, a3); \ |
| 294 } | 294 } |
| 295 | 295 |
| 296 #define DELEGATE_TO_GL_3R(name, glname, t1, t2, t3, rt) \ | |
| 297 rt WebGraphicsContext3DInProcessCommandBufferImpl::name( \ | |
| 298 t1 a1, t2 a2, t3 a3) { \ | |
| 299 ClearContext(); \ | |
| 300 return gl_->glname(a1, a2, a3); \ | |
| 301 } | |
| 302 | |
| 303 #define DELEGATE_TO_GL_4(name, glname, t1, t2, t3, t4) \ | 296 #define DELEGATE_TO_GL_4(name, glname, t1, t2, t3, t4) \ |
| 304 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \ | 297 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \ |
| 305 t1 a1, t2 a2, t3 a3, t4 a4) { \ | 298 t1 a1, t2 a2, t3 a3, t4 a4) { \ |
| 306 ClearContext(); \ | 299 ClearContext(); \ |
| 307 gl_->glname(a1, a2, a3, a4); \ | 300 gl_->glname(a1, a2, a3, a4); \ |
| 308 } | 301 } |
| 309 | 302 |
| 303 #define DELEGATE_TO_GL_4R(name, glname, t1, t2, t3, t4, rt) \ |
| 304 rt WebGraphicsContext3DInProcessCommandBufferImpl::name( \ |
| 305 t1 a1, t2 a2, t3 a3, t4 a4) { \ |
| 306 ClearContext(); \ |
| 307 return gl_->glname(a1, a2, a3, a4); \ |
| 308 } |
| 309 |
| 310 #define DELEGATE_TO_GL_5(name, glname, t1, t2, t3, t4, t5) \ | 310 #define DELEGATE_TO_GL_5(name, glname, t1, t2, t3, t4, t5) \ |
| 311 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \ | 311 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \ |
| 312 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) { \ | 312 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5) { \ |
| 313 ClearContext(); \ | 313 ClearContext(); \ |
| 314 gl_->glname(a1, a2, a3, a4, a5); \ | 314 gl_->glname(a1, a2, a3, a4, a5); \ |
| 315 } | 315 } |
| 316 | 316 |
| 317 #define DELEGATE_TO_GL_6(name, glname, t1, t2, t3, t4, t5, t6) \ | 317 #define DELEGATE_TO_GL_6(name, glname, t1, t2, t3, t4, t5, t6) \ |
| 318 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \ | 318 void WebGraphicsContext3DInProcessCommandBufferImpl::name( \ |
| 319 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) { \ | 319 t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) { \ |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 1133 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
| 1134 // TODO(kbr): improve the precision here. | 1134 // TODO(kbr): improve the precision here. |
| 1135 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; | 1135 context_lost_reason_ = GL_UNKNOWN_CONTEXT_RESET_ARB; |
| 1136 if (context_lost_callback_) { | 1136 if (context_lost_callback_) { |
| 1137 context_lost_callback_->onContextLost(); | 1137 context_lost_callback_->onContextLost(); |
| 1138 } | 1138 } |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 DELEGATE_TO_GL_3R(createImageCHROMIUM, CreateImageCHROMIUM, | 1141 DELEGATE_TO_GL_4R(createImageCHROMIUM, |
| 1142 WGC3Dsizei, WGC3Dsizei, WGC3Denum, WGC3Duint); | 1142 CreateImageCHROMIUM, |
| 1143 WGC3Dsizei, |
| 1144 WGC3Dsizei, |
| 1145 WGC3Denum, |
| 1146 WGC3Denum, |
| 1147 WGC3Duint); |
| 1148 |
| 1149 WGC3Duint WebGraphicsContext3DInProcessCommandBufferImpl::createImageCHROMIUM( |
| 1150 WGC3Dsizei width, |
| 1151 WGC3Dsizei height, |
| 1152 WGC3Denum internalformat) { |
| 1153 ClearContext(); |
| 1154 return gl_->CreateImageCHROMIUM(width, height, internalformat, GL_READ_WRITE); |
| 1155 } |
| 1143 | 1156 |
| 1144 DELEGATE_TO_GL_1(destroyImageCHROMIUM, DestroyImageCHROMIUM, WGC3Duint); | 1157 DELEGATE_TO_GL_1(destroyImageCHROMIUM, DestroyImageCHROMIUM, WGC3Duint); |
| 1145 | 1158 |
| 1146 DELEGATE_TO_GL_3(getImageParameterivCHROMIUM, GetImageParameterivCHROMIUM, | 1159 DELEGATE_TO_GL_3(getImageParameterivCHROMIUM, GetImageParameterivCHROMIUM, |
| 1147 WGC3Duint, WGC3Denum, GLint*); | 1160 WGC3Duint, WGC3Denum, GLint*); |
| 1148 | 1161 |
| 1149 DELEGATE_TO_GL_2R(mapImageCHROMIUM, MapImageCHROMIUM, | 1162 DELEGATE_TO_GL_1R(mapImageCHROMIUM, MapImageCHROMIUM, WGC3Duint, void*); |
| 1150 WGC3Duint, WGC3Denum, void*); | 1163 |
| 1164 void* WebGraphicsContext3DInProcessCommandBufferImpl::mapImageCHROMIUM( |
| 1165 WGC3Duint image_id, |
| 1166 WGC3Denum access) { |
| 1167 ClearContext(); |
| 1168 return gl_->MapImageCHROMIUM(image_id); |
| 1169 } |
| 1151 | 1170 |
| 1152 DELEGATE_TO_GL_1(unmapImageCHROMIUM, UnmapImageCHROMIUM, WGC3Duint); | 1171 DELEGATE_TO_GL_1(unmapImageCHROMIUM, UnmapImageCHROMIUM, WGC3Duint); |
| 1153 | 1172 |
| 1154 DELEGATE_TO_GL_6(framebufferTexture2DMultisampleEXT, | 1173 DELEGATE_TO_GL_6(framebufferTexture2DMultisampleEXT, |
| 1155 FramebufferTexture2DMultisampleEXT, | 1174 FramebufferTexture2DMultisampleEXT, |
| 1156 WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint, WGC3Dsizei) | 1175 WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint, WGC3Dsizei) |
| 1157 | 1176 |
| 1158 DELEGATE_TO_GL_5(renderbufferStorageMultisampleEXT, | 1177 DELEGATE_TO_GL_5(renderbufferStorageMultisampleEXT, |
| 1159 RenderbufferStorageMultisampleEXT, WGC3Denum, WGC3Dsizei, | 1178 RenderbufferStorageMultisampleEXT, WGC3Denum, WGC3Dsizei, |
| 1160 WGC3Denum, WGC3Dsizei, WGC3Dsizei) | 1179 WGC3Denum, WGC3Dsizei, WGC3Dsizei) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 | 1214 |
| 1196 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, | 1215 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, |
| 1197 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, | 1216 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, |
| 1198 WGC3Denum, WGC3Denum, const void*) | 1217 WGC3Denum, WGC3Denum, const void*) |
| 1199 | 1218 |
| 1200 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, | 1219 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, |
| 1201 WGC3Denum) | 1220 WGC3Denum) |
| 1202 | 1221 |
| 1203 } // namespace gpu | 1222 } // namespace gpu |
| 1204 } // namespace webkit | 1223 } // namespace webkit |
| OLD | NEW |