OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 23 matching lines...) Expand all Loading... | |
34 | 34 |
35 #include <algorithm> | 35 #include <algorithm> |
36 #include "core/platform/graphics/Extensions3D.h" | 36 #include "core/platform/graphics/Extensions3D.h" |
37 #include "core/platform/graphics/GraphicsLayer.h" | 37 #include "core/platform/graphics/GraphicsLayer.h" |
38 #include "platform/TraceEvent.h" | 38 #include "platform/TraceEvent.h" |
39 #include "public/platform/Platform.h" | 39 #include "public/platform/Platform.h" |
40 #include "public/platform/WebCompositorSupport.h" | 40 #include "public/platform/WebCompositorSupport.h" |
41 #include "public/platform/WebExternalBitmap.h" | 41 #include "public/platform/WebExternalBitmap.h" |
42 #include "public/platform/WebExternalTextureLayer.h" | 42 #include "public/platform/WebExternalTextureLayer.h" |
43 #include "public/platform/WebGraphicsContext3D.h" | 43 #include "public/platform/WebGraphicsContext3D.h" |
44 #include "third_party/khronos/GLES2/gl2.h" | |
Ken Russell (switch to Gerrit)
2013/12/06 23:45:20
Should be unnecessary.
| |
44 | 45 |
45 using namespace std; | 46 using namespace std; |
46 | 47 |
47 namespace WebCore { | 48 namespace WebCore { |
48 | 49 |
49 // Global resource ceiling (expressed in terms of pixels) for DrawingBuffer crea tion and resize. | 50 // Global resource ceiling (expressed in terms of pixels) for DrawingBuffer crea tion and resize. |
50 // When this limit is set, DrawingBuffer::create() and DrawingBuffer::reset() ca lls that would | 51 // When this limit is set, DrawingBuffer::create() and DrawingBuffer::reset() ca lls that would |
51 // exceed the global cap will instead clear the buffer. | 52 // exceed the global cap will instead clear the buffer. |
52 static const int s_maximumResourceUsePixels = 16 * 1024 * 1024; | 53 static const int s_maximumResourceUsePixels = 16 * 1024 * 1024; |
53 static int s_currentResourceUsePixels = 0; | 54 static int s_currentResourceUsePixels = 0; |
54 static const float s_resourceAdjustedRatio = 0.5; | 55 static const float s_resourceAdjustedRatio = 0.5; |
55 | 56 |
56 static const bool s_allowContextEvictionOnCreate = true; | 57 static const bool s_allowContextEvictionOnCreate = true; |
57 static const int s_maxScaleAttempts = 3; | 58 static const int s_maxScaleAttempts = 3; |
58 | 59 |
59 class ScopedTextureUnit0BindingRestorer { | 60 class ScopedTextureUnit0BindingRestorer { |
60 public: | 61 public: |
61 ScopedTextureUnit0BindingRestorer(GraphicsContext3D* context, GC3Denum activ eTextureUnit, Platform3DObject textureUnitZeroId) | 62 ScopedTextureUnit0BindingRestorer(GraphicsContext3D* context, GC3Denum activ eTextureUnit, Platform3DObject textureUnitZeroId) |
62 : m_context(context) | 63 : m_context(context) |
63 , m_oldActiveTextureUnit(activeTextureUnit) | 64 , m_oldActiveTextureUnit(activeTextureUnit) |
64 , m_oldTextureUnitZeroId(textureUnitZeroId) | 65 , m_oldTextureUnitZeroId(textureUnitZeroId) |
65 { | 66 { |
66 m_context->activeTexture(GraphicsContext3D::TEXTURE0); | 67 m_context->activeTexture(GL_TEXTURE0); |
67 } | 68 } |
68 ~ScopedTextureUnit0BindingRestorer() | 69 ~ScopedTextureUnit0BindingRestorer() |
69 { | 70 { |
70 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_oldTextureUnitZe roId); | 71 m_context->bindTexture(GL_TEXTURE_2D, m_oldTextureUnitZeroId); |
71 m_context->activeTexture(m_oldActiveTextureUnit); | 72 m_context->activeTexture(m_oldActiveTextureUnit); |
72 } | 73 } |
73 | 74 |
74 private: | 75 private: |
75 GraphicsContext3D* m_context; | 76 GraphicsContext3D* m_context; |
76 GC3Denum m_oldActiveTextureUnit; | 77 GC3Denum m_oldActiveTextureUnit; |
77 Platform3DObject m_oldTextureUnitZeroId; | 78 Platform3DObject m_oldTextureUnitZeroId; |
78 }; | 79 }; |
79 | 80 |
80 PassRefPtr<DrawingBuffer> DrawingBuffer::create(GraphicsContext3D* context, cons t IntSize& size, PreserveDrawingBuffer preserve, PassRefPtr<ContextEvictionManag er> contextEvictionManager) | 81 PassRefPtr<DrawingBuffer> DrawingBuffer::create(GraphicsContext3D* context, cons t IntSize& size, PreserveDrawingBuffer preserve, PassRefPtr<ContextEvictionManag er> contextEvictionManager) |
(...skipping 18 matching lines...) Expand all Loading... | |
99 DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, | 100 DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, |
100 const IntSize& size, | 101 const IntSize& size, |
101 bool multisampleExtensionSupported, | 102 bool multisampleExtensionSupported, |
102 bool packedDepthStencilExtensionSupported, | 103 bool packedDepthStencilExtensionSupported, |
103 PreserveDrawingBuffer preserve, | 104 PreserveDrawingBuffer preserve, |
104 PassRefPtr<ContextEvictionManager> contextEvictionM anager) | 105 PassRefPtr<ContextEvictionManager> contextEvictionM anager) |
105 : m_preserveDrawingBuffer(preserve) | 106 : m_preserveDrawingBuffer(preserve) |
106 , m_scissorEnabled(false) | 107 , m_scissorEnabled(false) |
107 , m_texture2DBinding(0) | 108 , m_texture2DBinding(0) |
108 , m_framebufferBinding(0) | 109 , m_framebufferBinding(0) |
109 , m_activeTextureUnit(GraphicsContext3D::TEXTURE0) | 110 , m_activeTextureUnit(GL_TEXTURE0) |
110 , m_context(context) | 111 , m_context(context) |
111 , m_size(-1, -1) | 112 , m_size(-1, -1) |
112 , m_multisampleExtensionSupported(multisampleExtensionSupported) | 113 , m_multisampleExtensionSupported(multisampleExtensionSupported) |
113 , m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupporte d) | 114 , m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupporte d) |
114 , m_fbo(0) | 115 , m_fbo(0) |
115 , m_colorBuffer(0) | 116 , m_colorBuffer(0) |
116 , m_frontColorBuffer(0) | 117 , m_frontColorBuffer(0) |
117 , m_depthStencilBuffer(0) | 118 , m_depthStencilBuffer(0) |
118 , m_depthBuffer(0) | 119 , m_depthBuffer(0) |
119 , m_stencilBuffer(0) | 120 , m_stencilBuffer(0) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 nextFrontColorBuffer = createNewMailbox(newColorBuffer); | 189 nextFrontColorBuffer = createNewMailbox(newColorBuffer); |
189 } | 190 } |
190 | 191 |
191 if (m_preserveDrawingBuffer == Discard) { | 192 if (m_preserveDrawingBuffer == Discard) { |
192 m_colorBuffer = nextFrontColorBuffer->textureId; | 193 m_colorBuffer = nextFrontColorBuffer->textureId; |
193 swap(nextFrontColorBuffer, m_lastColorBuffer); | 194 swap(nextFrontColorBuffer, m_lastColorBuffer); |
194 // It appears safe to overwrite the context's framebuffer binding in the Discard case since there will always be a | 195 // It appears safe to overwrite the context's framebuffer binding in the Discard case since there will always be a |
195 // WebGLRenderingContext::clearIfComposited() call made before the next draw call which restores the framebuffer binding. | 196 // WebGLRenderingContext::clearIfComposited() call made before the next draw call which restores the framebuffer binding. |
196 // If this stops being true at some point, we should track the current f ramebuffer binding in the DrawingBuffer and restore | 197 // If this stops being true at some point, we should track the current f ramebuffer binding in the DrawingBuffer and restore |
197 // it after attaching the new back buffer here. | 198 // it after attaching the new back buffer here. |
198 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); | 199 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
199 m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, Graphics Context3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0); | 200 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_colorBuffer, 0); |
200 } else { | 201 } else { |
201 Extensions3D* extensions = m_context->extensions(); | 202 Extensions3D* extensions = m_context->extensions(); |
202 extensions->copyTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, m_colorBu ffer, nextFrontColorBuffer->textureId, 0, GraphicsContext3D::RGBA, GraphicsConte xt3D::UNSIGNED_BYTE); | 203 extensions->copyTextureCHROMIUM(GL_TEXTURE_2D, m_colorBuffer, nextFrontC olorBuffer->textureId, 0, GL_RGBA, GL_UNSIGNED_BYTE); |
203 } | 204 } |
204 | 205 |
205 if (multisample() && !m_framebufferBinding) | 206 if (multisample() && !m_framebufferBinding) |
206 bind(); | 207 bind(); |
207 else | 208 else |
208 restoreFramebufferBinding(); | 209 restoreFramebufferBinding(); |
209 | 210 |
210 m_contentsChanged = false; | 211 m_contentsChanged = false; |
211 | 212 |
212 context()->bindTexture(GraphicsContext3D::TEXTURE_2D, nextFrontColorBuffer-> textureId); | 213 context()->bindTexture(GL_TEXTURE_2D, nextFrontColorBuffer->textureId); |
213 context()->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, nextFrontCo lorBuffer->mailbox.name); | 214 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, nextFrontColorBuffer->mailb ox.name); |
214 context()->flush(); | 215 context()->flush(); |
215 m_context->markLayerComposited(); | 216 m_context->markLayerComposited(); |
216 | 217 |
217 *outMailbox = nextFrontColorBuffer->mailbox; | 218 *outMailbox = nextFrontColorBuffer->mailbox; |
218 m_frontColorBuffer = nextFrontColorBuffer->textureId; | 219 m_frontColorBuffer = nextFrontColorBuffer->textureId; |
219 return true; | 220 return true; |
220 } | 221 } |
221 | 222 |
222 void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mail box) | 223 void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mail box) |
223 { | 224 { |
(...skipping 14 matching lines...) Expand all Loading... | |
238 return PassRefPtr<MailboxInfo>(); | 239 return PassRefPtr<MailboxInfo>(); |
239 | 240 |
240 RefPtr<MailboxInfo> mailboxInfo = m_recycledMailboxes.last().release(); | 241 RefPtr<MailboxInfo> mailboxInfo = m_recycledMailboxes.last().release(); |
241 m_recycledMailboxes.removeLast(); | 242 m_recycledMailboxes.removeLast(); |
242 | 243 |
243 if (mailboxInfo->mailbox.syncPoint) { | 244 if (mailboxInfo->mailbox.syncPoint) { |
244 context()->waitSyncPoint(mailboxInfo->mailbox.syncPoint); | 245 context()->waitSyncPoint(mailboxInfo->mailbox.syncPoint); |
245 mailboxInfo->mailbox.syncPoint = 0; | 246 mailboxInfo->mailbox.syncPoint = 0; |
246 } | 247 } |
247 | 248 |
248 context()->bindTexture(GraphicsContext3D::TEXTURE_2D, mailboxInfo->textureId ); | 249 context()->bindTexture(GL_TEXTURE_2D, mailboxInfo->textureId); |
249 context()->consumeTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, mailboxInfo ->mailbox.name); | 250 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailboxInfo->mailbox.name); |
250 | 251 |
251 if (mailboxInfo->size != m_size) { | 252 if (mailboxInfo->size != m_size) { |
252 m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, m_in ternalColorFormat, m_size.width(), m_size.height(), 0, m_colorFormat, GraphicsCo ntext3D::UNSIGNED_BYTE); | 253 m_context->texImage2DResourceSafe(GL_TEXTURE_2D, 0, m_internalColorForma t, m_size.width(), m_size.height(), 0, m_colorFormat, GL_UNSIGNED_BYTE); |
253 mailboxInfo->size = m_size; | 254 mailboxInfo->size = m_size; |
254 } | 255 } |
255 | 256 |
256 return mailboxInfo.release(); | 257 return mailboxInfo.release(); |
257 } | 258 } |
258 | 259 |
259 PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::createNewMailbox(unsigned textureId) | 260 PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::createNewMailbox(unsigned textureId) |
260 { | 261 { |
261 RefPtr<MailboxInfo> returnMailbox = adoptRef(new MailboxInfo()); | 262 RefPtr<MailboxInfo> returnMailbox = adoptRef(new MailboxInfo()); |
262 context()->genMailboxCHROMIUM(returnMailbox->mailbox.name); | 263 context()->genMailboxCHROMIUM(returnMailbox->mailbox.name); |
263 returnMailbox->textureId = textureId; | 264 returnMailbox->textureId = textureId; |
264 returnMailbox->size = m_size; | 265 returnMailbox->size = m_size; |
265 m_textureMailboxes.append(returnMailbox); | 266 m_textureMailboxes.append(returnMailbox); |
266 return returnMailbox.release(); | 267 return returnMailbox.release(); |
267 } | 268 } |
268 | 269 |
269 void DrawingBuffer::initialize(const IntSize& size) | 270 void DrawingBuffer::initialize(const IntSize& size) |
270 { | 271 { |
271 ASSERT(m_context); | 272 ASSERT(m_context); |
272 m_attributes = m_context->getContextAttributes(); | 273 m_attributes = m_context->getContextAttributes(); |
273 | 274 |
274 if (m_attributes.alpha) { | 275 if (m_attributes.alpha) { |
275 m_internalColorFormat = GraphicsContext3D::RGBA; | 276 m_internalColorFormat = GL_RGBA; |
276 m_colorFormat = GraphicsContext3D::RGBA; | 277 m_colorFormat = GL_RGBA; |
277 m_internalRenderbufferFormat = Extensions3D::RGBA8_OES; | 278 m_internalRenderbufferFormat = Extensions3D::RGBA8_OES; |
278 } else { | 279 } else { |
279 m_internalColorFormat = GraphicsContext3D::RGB; | 280 m_internalColorFormat = GL_RGB; |
280 m_colorFormat = GraphicsContext3D::RGB; | 281 m_colorFormat = GL_RGB; |
281 m_internalRenderbufferFormat = Extensions3D::RGB8_OES; | 282 m_internalRenderbufferFormat = Extensions3D::RGB8_OES; |
282 } | 283 } |
283 | 284 |
284 m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_maxTextureSiz e); | 285 m_context->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize); |
285 | 286 |
286 m_fbo = m_context->createFramebuffer(); | 287 m_fbo = m_context->createFramebuffer(); |
287 | 288 |
288 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); | 289 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
289 m_colorBuffer = createColorTexture(); | 290 m_colorBuffer = createColorTexture(); |
290 m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsCont ext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0); | 291 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEX TURE_2D, m_colorBuffer, 0); |
291 createSecondaryBuffers(); | 292 createSecondaryBuffers(); |
292 reset(size); | 293 reset(size); |
293 m_lastColorBuffer = createNewMailbox(m_colorBuffer); | 294 m_lastColorBuffer = createNewMailbox(m_colorBuffer); |
294 } | 295 } |
295 | 296 |
296 unsigned DrawingBuffer::frontColorBuffer() const | 297 unsigned DrawingBuffer::frontColorBuffer() const |
297 { | 298 { |
298 return m_frontColorBuffer; | 299 return m_frontColorBuffer; |
299 } | 300 } |
300 | 301 |
(...skipping 23 matching lines...) Expand all Loading... | |
324 bool unpackPremultiplyAlphaNeeded = false; | 325 bool unpackPremultiplyAlphaNeeded = false; |
325 bool unpackUnpremultiplyAlphaNeeded = false; | 326 bool unpackUnpremultiplyAlphaNeeded = false; |
326 if (m_attributes.alpha && m_attributes.premultipliedAlpha && !premultiplyAlp ha) | 327 if (m_attributes.alpha && m_attributes.premultipliedAlpha && !premultiplyAlp ha) |
327 unpackUnpremultiplyAlphaNeeded = true; | 328 unpackUnpremultiplyAlphaNeeded = true; |
328 else if (m_attributes.alpha && !m_attributes.premultipliedAlpha && premultip lyAlpha) | 329 else if (m_attributes.alpha && !m_attributes.premultipliedAlpha && premultip lyAlpha) |
329 unpackPremultiplyAlphaNeeded = true; | 330 unpackPremultiplyAlphaNeeded = true; |
330 | 331 |
331 context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, unpac kUnpremultiplyAlphaNeeded); | 332 context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, unpac kUnpremultiplyAlphaNeeded); |
332 context.pixelStorei(Extensions3D::UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, unpackP remultiplyAlphaNeeded); | 333 context.pixelStorei(Extensions3D::UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, unpackP remultiplyAlphaNeeded); |
333 context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, flipY); | 334 context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, flipY); |
334 extensions->copyTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, sourceTexture , texture, level, internalFormat, destType); | 335 extensions->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level , internalFormat, destType); |
335 context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, false); | 336 context.pixelStorei(Extensions3D::UNPACK_FLIP_Y_CHROMIUM, false); |
336 context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false ); | 337 context.pixelStorei(Extensions3D::UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false ); |
337 context.pixelStorei(Extensions3D::UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); | 338 context.pixelStorei(Extensions3D::UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); |
338 | 339 |
339 return true; | 340 return true; |
340 } | 341 } |
341 | 342 |
342 Platform3DObject DrawingBuffer::framebuffer() const | 343 Platform3DObject DrawingBuffer::framebuffer() const |
343 { | 344 { |
344 return m_fbo; | 345 return m_fbo; |
(...skipping 11 matching lines...) Expand all Loading... | |
356 m_layer->setBlendBackgroundColor(m_attributes.alpha); | 357 m_layer->setBlendBackgroundColor(m_attributes.alpha); |
357 m_layer->setPremultipliedAlpha(m_attributes.premultipliedAlpha); | 358 m_layer->setPremultipliedAlpha(m_attributes.premultipliedAlpha); |
358 GraphicsLayer::registerContentsLayer(m_layer->layer()); | 359 GraphicsLayer::registerContentsLayer(m_layer->layer()); |
359 } | 360 } |
360 | 361 |
361 return m_layer->layer(); | 362 return m_layer->layer(); |
362 } | 363 } |
363 | 364 |
364 void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer) | 365 void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer) |
365 { | 366 { |
366 if (!m_context || !m_context->makeContextCurrent() || m_context->extensions( )->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR) | 367 if (!m_context || !m_context->makeContextCurrent() || m_context->extensions( )->getGraphicsResetStatusARB() != GL_NO_ERROR) |
367 return; | 368 return; |
368 | 369 |
369 Extensions3D* extensions = m_context->extensions(); | 370 Extensions3D* extensions = m_context->extensions(); |
370 | 371 |
371 if (!imageBuffer) | 372 if (!imageBuffer) |
372 return; | 373 return; |
373 Platform3DObject tex = imageBuffer->getBackingTexture(); | 374 Platform3DObject tex = imageBuffer->getBackingTexture(); |
374 if (tex) { | 375 if (tex) { |
375 extensions->copyTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, m_frontCo lorBuffer, | 376 extensions->copyTextureCHROMIUM(GL_TEXTURE_2D, m_frontColorBuffer, |
376 tex, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE); | 377 tex, 0, GL_RGBA, GL_UNSIGNED_BYTE); |
377 return; | 378 return; |
378 } | 379 } |
379 | 380 |
380 // Since the m_frontColorBuffer was produced and sent to the compositor, it cannot be bound to an fbo. | 381 // Since the m_frontColorBuffer was produced and sent to the compositor, it cannot be bound to an fbo. |
381 // We have to make a copy of it here and bind that copy instead. | 382 // We have to make a copy of it here and bind that copy instead. |
382 // FIXME: That's not true any more, provided we don't change texture | 383 // FIXME: That's not true any more, provided we don't change texture |
383 // parameters. | 384 // parameters. |
384 unsigned sourceTexture = createColorTexture(m_size); | 385 unsigned sourceTexture = createColorTexture(m_size); |
385 extensions->copyTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D, m_frontColorB uffer, sourceTexture, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BY TE); | 386 extensions->copyTextureCHROMIUM(GL_TEXTURE_2D, m_frontColorBuffer, sourceTex ture, 0, GL_RGBA, GL_UNSIGNED_BYTE); |
386 | 387 |
387 // Since we're using the same context as WebGL, we have to restore any state we change (in this case, just the framebuffer binding). | 388 // Since we're using the same context as WebGL, we have to restore any state we change (in this case, just the framebuffer binding). |
388 // FIXME: The WebGLRenderingContext tracks the current framebuffer binding, it would be slightly more efficient to use this value | 389 // FIXME: The WebGLRenderingContext tracks the current framebuffer binding, it would be slightly more efficient to use this value |
389 // rather than querying it off of the context. | 390 // rather than querying it off of the context. |
390 GC3Dint previousFramebuffer = 0; | 391 GC3Dint previousFramebuffer = 0; |
391 m_context->getIntegerv(GraphicsContext3D::FRAMEBUFFER_BINDING, &previousFram ebuffer); | 392 m_context->getIntegerv(GL_FRAMEBUFFER_BINDING, &previousFramebuffer); |
392 | 393 |
393 Platform3DObject framebuffer = m_context->createFramebuffer(); | 394 Platform3DObject framebuffer = m_context->createFramebuffer(); |
394 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, framebuffer); | 395 m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer); |
395 m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsCont ext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, sourceTexture, 0); | 396 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEX TURE_2D, sourceTexture, 0); |
396 | 397 |
397 extensions->paintFramebufferToCanvas(framebuffer, size().width(), size().hei ght(), !m_attributes.premultipliedAlpha, imageBuffer); | 398 extensions->paintFramebufferToCanvas(framebuffer, size().width(), size().hei ght(), !m_attributes.premultipliedAlpha, imageBuffer); |
398 m_context->deleteFramebuffer(framebuffer); | 399 m_context->deleteFramebuffer(framebuffer); |
399 m_context->deleteTexture(sourceTexture); | 400 m_context->deleteTexture(sourceTexture); |
400 | 401 |
401 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, previousFramebuff er); | 402 m_context->bindFramebuffer(GL_FRAMEBUFFER, previousFramebuffer); |
402 } | 403 } |
403 | 404 |
404 void DrawingBuffer::clearPlatformLayer() | 405 void DrawingBuffer::clearPlatformLayer() |
405 { | 406 { |
406 if (m_layer) | 407 if (m_layer) |
407 m_layer->clearTexture(); | 408 m_layer->clearTexture(); |
408 | 409 |
409 if (m_context) | 410 if (m_context) |
410 m_context->flush(); | 411 m_context->flush(); |
411 } | 412 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 | 466 |
466 unsigned DrawingBuffer::createColorTexture(const IntSize& size) | 467 unsigned DrawingBuffer::createColorTexture(const IntSize& size) |
467 { | 468 { |
468 if (!m_context) | 469 if (!m_context) |
469 return 0; | 470 return 0; |
470 | 471 |
471 unsigned offscreenColorTexture = m_context->createTexture(); | 472 unsigned offscreenColorTexture = m_context->createTexture(); |
472 if (!offscreenColorTexture) | 473 if (!offscreenColorTexture) |
473 return 0; | 474 return 0; |
474 | 475 |
475 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, offscreenColorTexture) ; | 476 m_context->bindTexture(GL_TEXTURE_2D, offscreenColorTexture); |
476 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T EXTURE_MAG_FILTER, GraphicsContext3D::LINEAR); | 477 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
477 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T EXTURE_MIN_FILTER, GraphicsContext3D::LINEAR); | 478 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
478 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T EXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE); | 479 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ; |
479 m_context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::T EXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE); | 480 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) ; |
480 if (!size.isEmpty()) | 481 if (!size.isEmpty()) |
481 m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, m_in ternalColorFormat, size.width(), size.height(), 0, m_colorFormat, GraphicsContex t3D::UNSIGNED_BYTE); | 482 m_context->texImage2DResourceSafe(GL_TEXTURE_2D, 0, m_internalColorForma t, size.width(), size.height(), 0, m_colorFormat, GL_UNSIGNED_BYTE); |
482 | 483 |
483 return offscreenColorTexture; | 484 return offscreenColorTexture; |
484 } | 485 } |
485 | 486 |
486 void DrawingBuffer::createSecondaryBuffers() | 487 void DrawingBuffer::createSecondaryBuffers() |
487 { | 488 { |
488 // create a multisample FBO | 489 // create a multisample FBO |
489 if (multisample()) { | 490 if (multisample()) { |
490 m_multisampleFBO = m_context->createFramebuffer(); | 491 m_multisampleFBO = m_context->createFramebuffer(); |
491 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisample FBO); | 492 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); |
492 m_multisampleColorBuffer = m_context->createRenderbuffer(); | 493 m_multisampleColorBuffer = m_context->createRenderbuffer(); |
493 } | 494 } |
494 } | 495 } |
495 | 496 |
496 bool DrawingBuffer::resizeFramebuffer(const IntSize& size) | 497 bool DrawingBuffer::resizeFramebuffer(const IntSize& size) |
497 { | 498 { |
498 // resize regular FBO | 499 // resize regular FBO |
499 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); | 500 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
500 | 501 |
501 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer); | 502 m_context->bindTexture(GL_TEXTURE_2D, m_colorBuffer); |
502 m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, m_intern alColorFormat, size.width(), size.height(), 0, m_colorFormat, GraphicsContext3D: :UNSIGNED_BYTE); | 503 m_context->texImage2DResourceSafe(GL_TEXTURE_2D, 0, m_internalColorFormat, s ize.width(), size.height(), 0, m_colorFormat, GL_UNSIGNED_BYTE); |
503 if (m_lastColorBuffer) | 504 if (m_lastColorBuffer) |
504 m_lastColorBuffer->size = m_size; | 505 m_lastColorBuffer->size = m_size; |
505 | 506 |
506 m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsCont ext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0); | 507 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEX TURE_2D, m_colorBuffer, 0); |
507 | 508 |
508 m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); | 509 m_context->bindTexture(GL_TEXTURE_2D, 0); |
509 | 510 |
510 if (!multisample()) | 511 if (!multisample()) |
511 resizeDepthStencil(size, 0); | 512 resizeDepthStencil(size, 0); |
512 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != Gra phicsContext3D::FRAMEBUFFER_COMPLETE) | 513 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMP LETE) |
513 return false; | 514 return false; |
514 | 515 |
515 return true; | 516 return true; |
516 } | 517 } |
517 | 518 |
518 bool DrawingBuffer::resizeMultisampleFramebuffer(const IntSize& size) | 519 bool DrawingBuffer::resizeMultisampleFramebuffer(const IntSize& size) |
519 { | 520 { |
520 if (multisample()) { | 521 if (multisample()) { |
521 int maxSampleCount = 0; | 522 int maxSampleCount = 0; |
522 | 523 |
523 m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSampleCount); | 524 m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSampleCount); |
524 int sampleCount = std::min(4, maxSampleCount); | 525 int sampleCount = std::min(4, maxSampleCount); |
525 | 526 |
526 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisample FBO); | 527 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); |
527 | 528 |
528 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisamp leColorBuffer); | 529 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer); |
529 m_context->extensions()->renderbufferStorageMultisample(GraphicsContext3 D::RENDERBUFFER, sampleCount, m_internalRenderbufferFormat, size.width(), size.h eight()); | 530 m_context->extensions()->renderbufferStorageMultisample(GL_RENDERBUFFER, sampleCount, m_internalRenderbufferFormat, size.width(), size.height()); |
530 | 531 |
531 if (m_context->getError() == GraphicsContext3D::OUT_OF_MEMORY) | 532 if (m_context->getError() == GL_OUT_OF_MEMORY) |
532 return false; | 533 return false; |
533 | 534 |
534 m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, Graph icsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleC olorBuffer); | 535 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer); |
535 resizeDepthStencil(size, sampleCount); | 536 resizeDepthStencil(size, sampleCount); |
536 if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) | 537 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_ COMPLETE) |
537 return false; | 538 return false; |
538 } | 539 } |
539 | 540 |
540 return true; | 541 return true; |
541 } | 542 } |
542 | 543 |
543 void DrawingBuffer::resizeDepthStencil(const IntSize& size, int sampleCount) | 544 void DrawingBuffer::resizeDepthStencil(const IntSize& size, int sampleCount) |
544 { | 545 { |
545 if (m_attributes.depth && m_attributes.stencil && m_packedDepthStencilExtens ionSupported) { | 546 if (m_attributes.depth && m_attributes.stencil && m_packedDepthStencilExtens ionSupported) { |
546 if (!m_depthStencilBuffer) | 547 if (!m_depthStencilBuffer) |
547 m_depthStencilBuffer = m_context->createRenderbuffer(); | 548 m_depthStencilBuffer = m_context->createRenderbuffer(); |
548 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthSten cilBuffer); | 549 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer); |
549 if (multisample()) | 550 if (multisample()) |
550 m_context->extensions()->renderbufferStorageMultisample(GraphicsCont ext3D::RENDERBUFFER, sampleCount, Extensions3D::DEPTH24_STENCIL8, size.width(), size.height()); | 551 m_context->extensions()->renderbufferStorageMultisample(GL_RENDERBUF FER, sampleCount, Extensions3D::DEPTH24_STENCIL8, size.width(), size.height()); |
551 else | 552 else |
552 m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, Exte nsions3D::DEPTH24_STENCIL8, size.width(), size.height()); | 553 m_context->renderbufferStorage(GL_RENDERBUFFER, Extensions3D::DEPTH2 4_STENCIL8, size.width(), size.height()); |
553 m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, Graph icsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStenci lBuffer); | 554 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT , GL_RENDERBUFFER, m_depthStencilBuffer); |
554 m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, Graph icsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilB uffer); | 555 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer); |
555 } else { | 556 } else { |
556 if (m_attributes.depth) { | 557 if (m_attributes.depth) { |
557 if (!m_depthBuffer) | 558 if (!m_depthBuffer) |
558 m_depthBuffer = m_context->createRenderbuffer(); | 559 m_depthBuffer = m_context->createRenderbuffer(); |
559 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depth Buffer); | 560 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer); |
560 if (multisample()) | 561 if (multisample()) |
561 m_context->extensions()->renderbufferStorageMultisample(Graphics Context3D::RENDERBUFFER, sampleCount, GraphicsContext3D::DEPTH_COMPONENT16, size .width(), size.height()); | 562 m_context->extensions()->renderbufferStorageMultisample(GL_RENDE RBUFFER, sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height()); |
562 else | 563 else |
563 m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_COMPONENT16, size.width(), size.height()); | 564 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONE NT16, size.width(), size.height()); |
564 m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, G raphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuff er); | 565 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHME NT, GL_RENDERBUFFER, m_depthBuffer); |
565 } | 566 } |
566 if (m_attributes.stencil) { | 567 if (m_attributes.stencil) { |
567 if (!m_stencilBuffer) | 568 if (!m_stencilBuffer) |
568 m_stencilBuffer = m_context->createRenderbuffer(); | 569 m_stencilBuffer = m_context->createRenderbuffer(); |
569 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_stenc ilBuffer); | 570 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_stencilBuffer); |
570 if (multisample()) | 571 if (multisample()) |
571 m_context->extensions()->renderbufferStorageMultisample(Graphics Context3D::RENDERBUFFER, sampleCount, GraphicsContext3D::STENCIL_INDEX8, size.wi dth(), size.height()); | 572 m_context->extensions()->renderbufferStorageMultisample(GL_RENDE RBUFFER, sampleCount, GL_STENCIL_INDEX8, size.width(), size.height()); |
572 else | 573 else |
573 m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, size.width(), size.height()); | 574 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX 8, size.width(), size.height()); |
574 m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, G raphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencil Buffer); | 575 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACH MENT, GL_RENDERBUFFER, m_stencilBuffer); |
575 } | 576 } |
576 } | 577 } |
577 m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0); | 578 m_context->bindRenderbuffer(GL_RENDERBUFFER, 0); |
578 } | 579 } |
579 | 580 |
580 | 581 |
581 | 582 |
582 void DrawingBuffer::clearFramebuffers(GC3Dbitfield clearMask) | 583 void DrawingBuffer::clearFramebuffers(GC3Dbitfield clearMask) |
583 { | 584 { |
584 if (!m_context) | 585 if (!m_context) |
585 return; | 586 return; |
586 | 587 |
587 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo); | 588 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO ? m_multisampleF BO : m_fbo); |
588 | 589 |
589 m_context->clear(clearMask); | 590 m_context->clear(clearMask); |
590 | 591 |
591 // The multisample fbo was just cleared, but we also need to clear the non-m ultisampled buffer too. | 592 // The multisample fbo was just cleared, but we also need to clear the non-m ultisampled buffer too. |
592 if (m_multisampleFBO) { | 593 if (m_multisampleFBO) { |
593 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); | 594 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
594 m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); | 595 m_context->clear(GL_COLOR_BUFFER_BIT); |
595 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisample FBO); | 596 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); |
596 } | 597 } |
597 } | 598 } |
598 | 599 |
599 void DrawingBuffer::setSize(const IntSize& size) { | 600 void DrawingBuffer::setSize(const IntSize& size) { |
600 if (m_size == size) | 601 if (m_size == size) |
601 return; | 602 return; |
602 | 603 |
603 s_currentResourceUsePixels += pixelDelta(size); | 604 s_currentResourceUsePixels += pixelDelta(size); |
604 m_size = size; | 605 m_size = size; |
605 } | 606 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 } | 682 } |
682 break; | 683 break; |
683 } while (!adjustedSize.isEmpty()); | 684 } while (!adjustedSize.isEmpty()); |
684 | 685 |
685 setSize(adjustedSize); | 686 setSize(adjustedSize); |
686 | 687 |
687 if (adjustedSize.isEmpty()) | 688 if (adjustedSize.isEmpty()) |
688 return; | 689 return; |
689 } | 690 } |
690 | 691 |
691 m_context->disable(GraphicsContext3D::SCISSOR_TEST); | 692 m_context->disable(GL_SCISSOR_TEST); |
692 m_context->clearColor(0, 0, 0, 0); | 693 m_context->clearColor(0, 0, 0, 0); |
693 m_context->colorMask(true, true, true, true); | 694 m_context->colorMask(true, true, true, true); |
694 | 695 |
695 GC3Dbitfield clearMask = GraphicsContext3D::COLOR_BUFFER_BIT; | 696 GC3Dbitfield clearMask = GL_COLOR_BUFFER_BIT; |
696 if (m_attributes.depth) { | 697 if (m_attributes.depth) { |
697 m_context->clearDepth(1.0f); | 698 m_context->clearDepth(1.0f); |
698 clearMask |= GraphicsContext3D::DEPTH_BUFFER_BIT; | 699 clearMask |= GL_DEPTH_BUFFER_BIT; |
699 m_context->depthMask(true); | 700 m_context->depthMask(true); |
700 } | 701 } |
701 if (m_attributes.stencil) { | 702 if (m_attributes.stencil) { |
702 m_context->clearStencil(0); | 703 m_context->clearStencil(0); |
703 clearMask |= GraphicsContext3D::STENCIL_BUFFER_BIT; | 704 clearMask |= GL_STENCIL_BUFFER_BIT; |
704 m_context->stencilMaskSeparate(GraphicsContext3D::FRONT, 0xFFFFFFFF); | 705 m_context->stencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); |
705 } | 706 } |
706 | 707 |
707 clearFramebuffers(clearMask); | 708 clearFramebuffers(clearMask); |
708 } | 709 } |
709 | 710 |
710 void DrawingBuffer::commit(long x, long y, long width, long height) | 711 void DrawingBuffer::commit(long x, long y, long width, long height) |
711 { | 712 { |
712 if (!m_context) | 713 if (!m_context) |
713 return; | 714 return; |
714 | 715 |
715 if (width < 0) | 716 if (width < 0) |
716 width = m_size.width(); | 717 width = m_size.width(); |
717 if (height < 0) | 718 if (height < 0) |
718 height = m_size.height(); | 719 height = m_size.height(); |
719 | 720 |
720 m_context->makeContextCurrent(); | 721 m_context->makeContextCurrent(); |
721 | 722 |
722 if (m_multisampleFBO && !m_contentsChangeCommitted) { | 723 if (m_multisampleFBO && !m_contentsChangeCommitted) { |
723 m_context->bindFramebuffer(Extensions3D::READ_FRAMEBUFFER, m_multisample FBO); | 724 m_context->bindFramebuffer(Extensions3D::READ_FRAMEBUFFER, m_multisample FBO); |
724 m_context->bindFramebuffer(Extensions3D::DRAW_FRAMEBUFFER, m_fbo); | 725 m_context->bindFramebuffer(Extensions3D::DRAW_FRAMEBUFFER, m_fbo); |
725 | 726 |
726 if (m_scissorEnabled) | 727 if (m_scissorEnabled) |
727 m_context->disable(GraphicsContext3D::SCISSOR_TEST); | 728 m_context->disable(GL_SCISSOR_TEST); |
728 | 729 |
729 // Use NEAREST, because there is no scale performed during the blit. | 730 // Use NEAREST, because there is no scale performed during the blit. |
730 m_context->extensions()->blitFramebuffer(x, y, width, height, x, y, widt h, height, GraphicsContext3D::COLOR_BUFFER_BIT, GraphicsContext3D::NEAREST); | 731 m_context->extensions()->blitFramebuffer(x, y, width, height, x, y, widt h, height, GL_COLOR_BUFFER_BIT, GL_NEAREST); |
731 | 732 |
732 if (m_scissorEnabled) | 733 if (m_scissorEnabled) |
733 m_context->enable(GraphicsContext3D::SCISSOR_TEST); | 734 m_context->enable(GL_SCISSOR_TEST); |
734 } | 735 } |
735 | 736 |
736 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); | 737 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
737 m_contentsChangeCommitted = true; | 738 m_contentsChangeCommitted = true; |
738 } | 739 } |
739 | 740 |
740 void DrawingBuffer::restoreFramebufferBinding() | 741 void DrawingBuffer::restoreFramebufferBinding() |
741 { | 742 { |
742 if (!m_context || !m_framebufferBinding) | 743 if (!m_context || !m_framebufferBinding) |
743 return; | 744 return; |
744 | 745 |
745 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebufferBind ing); | 746 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_framebufferBinding); |
746 } | 747 } |
747 | 748 |
748 bool DrawingBuffer::multisample() const | 749 bool DrawingBuffer::multisample() const |
749 { | 750 { |
750 return m_attributes.antialias && m_multisampleExtensionSupported; | 751 return m_attributes.antialias && m_multisampleExtensionSupported; |
751 } | 752 } |
752 | 753 |
753 void DrawingBuffer::bind() | 754 void DrawingBuffer::bind() |
754 { | 755 { |
755 if (!m_context) | 756 if (!m_context) |
756 return; | 757 return; |
757 | 758 |
758 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo); | 759 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO ? m_multisampleF BO : m_fbo); |
759 } | 760 } |
760 | 761 |
761 } // namespace WebCore | 762 } // namespace WebCore |
OLD | NEW |