OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/gl_renderer.h" | 7 #include "cc/gl_renderer.h" |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_split.h" | 11 #include "base/string_split.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "cc/damage_tracker.h" | 13 #include "cc/damage_tracker.h" |
14 #include "cc/geometry_binding.h" | 14 #include "cc/geometry_binding.h" |
15 #include "cc/layer_quad.h" | 15 #include "cc/layer_quad.h" |
16 #include "cc/math_util.h" | 16 #include "cc/math_util.h" |
17 #include "cc/platform_color.h" | 17 #include "cc/platform_color.h" |
18 #include "cc/priority_calculator.h" | 18 #include "cc/priority_calculator.h" |
19 #include "cc/proxy.h" | 19 #include "cc/proxy.h" |
20 #include "cc/render_pass.h" | 20 #include "cc/render_pass.h" |
21 #include "cc/render_surface_filters.h" | 21 #include "cc/render_surface_filters.h" |
22 #include "cc/scoped_texture.h" | 22 #include "cc/scoped_resource.h" |
23 #include "cc/settings.h" | 23 #include "cc/settings.h" |
24 #include "cc/single_thread_proxy.h" | 24 #include "cc/single_thread_proxy.h" |
25 #include "cc/stream_video_draw_quad.h" | 25 #include "cc/stream_video_draw_quad.h" |
26 #include "cc/texture_draw_quad.h" | 26 #include "cc/texture_draw_quad.h" |
27 #include "cc/video_layer_impl.h" | 27 #include "cc/video_layer_impl.h" |
28 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
29 #include "third_party/khronos/GLES2/gl2ext.h" | 29 #include "third_party/khronos/GLES2/gl2ext.h" |
30 #include "third_party/skia/include/core/SkBitmap.h" | 30 #include "third_party/skia/include/core/SkBitmap.h" |
31 #include "third_party/skia/include/core/SkColor.h" | 31 #include "third_party/skia/include/core/SkColor.h" |
32 #include "third_party/skia/include/gpu/GrContext.h" | 32 #include "third_party/skia/include/gpu/GrContext.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 351 } |
352 | 352 |
353 static GrContext* getFilterGrContext(bool hasImplThread) | 353 static GrContext* getFilterGrContext(bool hasImplThread) |
354 { | 354 { |
355 if (hasImplThread) | 355 if (hasImplThread) |
356 return WebSharedGraphicsContext3D::compositorThreadGrContext(); | 356 return WebSharedGraphicsContext3D::compositorThreadGrContext(); |
357 else | 357 else |
358 return WebSharedGraphicsContext3D::mainThreadGrContext(); | 358 return WebSharedGraphicsContext3D::mainThreadGrContext(); |
359 } | 359 } |
360 | 360 |
361 static inline SkBitmap applyFilters(GLRenderer* renderer, const WebKit::WebFilte
rOperations& filters, ScopedTexture* sourceTexture, bool hasImplThread) | 361 static inline SkBitmap applyFilters(GLRenderer* renderer, const WebKit::WebFilte
rOperations& filters, ScopedResource* sourceTexture, bool hasImplThread) |
362 { | 362 { |
363 if (filters.isEmpty()) | 363 if (filters.isEmpty()) |
364 return SkBitmap(); | 364 return SkBitmap(); |
365 | 365 |
366 WebGraphicsContext3D* filterContext = getFilterContext(hasImplThread); | 366 WebGraphicsContext3D* filterContext = getFilterContext(hasImplThread); |
367 GrContext* filterGrContext = getFilterGrContext(hasImplThread); | 367 GrContext* filterGrContext = getFilterGrContext(hasImplThread); |
368 | 368 |
369 if (!filterContext || !filterGrContext) | 369 if (!filterContext || !filterGrContext) |
370 return SkBitmap(); | 370 return SkBitmap(); |
371 | 371 |
372 renderer->context()->flush(); | 372 renderer->context()->flush(); |
373 | 373 |
374 ResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourc
eTexture->id()); | 374 ResourceProvider::ScopedWriteLockGL lock(renderer->resourceProvider(), sourc
eTexture->id()); |
375 SkBitmap source = RenderSurfaceFilters::apply(filters, lock.textureId(), sou
rceTexture->size(), filterContext, filterGrContext); | 375 SkBitmap source = RenderSurfaceFilters::apply(filters, lock.textureId(), sou
rceTexture->size(), filterContext, filterGrContext); |
376 return source; | 376 return source; |
377 } | 377 } |
378 | 378 |
379 static SkBitmap applyImageFilter(GLRenderer* renderer, SkImageFilter* filter, Sc
opedTexture* sourceTexture, bool hasImplThread) | 379 static SkBitmap applyImageFilter(GLRenderer* renderer, SkImageFilter* filter, Sc
opedResource* sourceTexture, bool hasImplThread) |
380 { | 380 { |
381 if (!filter) | 381 if (!filter) |
382 return SkBitmap(); | 382 return SkBitmap(); |
383 | 383 |
384 WebGraphicsContext3D* context3d = getFilterContext(hasImplThread); | 384 WebGraphicsContext3D* context3d = getFilterContext(hasImplThread); |
385 GrContext* grContext = getFilterGrContext(hasImplThread); | 385 GrContext* grContext = getFilterGrContext(hasImplThread); |
386 | 386 |
387 if (!context3d || !grContext) | 387 if (!context3d || !grContext) |
388 return SkBitmap(); | 388 return SkBitmap(); |
389 | 389 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // Draw the source bitmap through the filter to the canvas. | 421 // Draw the source bitmap through the filter to the canvas. |
422 SkPaint paint; | 422 SkPaint paint; |
423 paint.setImageFilter(filter); | 423 paint.setImageFilter(filter); |
424 canvas.clear(0x0); | 424 canvas.clear(0x0); |
425 canvas.drawSprite(source, 0, 0, &paint); | 425 canvas.drawSprite(source, 0, 0, &paint); |
426 canvas.flush(); | 426 canvas.flush(); |
427 context3d->flush(); | 427 context3d->flush(); |
428 return device.accessBitmap(false); | 428 return device.accessBitmap(false); |
429 } | 429 } |
430 | 430 |
431 scoped_ptr<ScopedTexture> GLRenderer::drawBackgroundFilters( | 431 scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters( |
432 DrawingFrame& frame, const RenderPassDrawQuad* quad, | 432 DrawingFrame& frame, const RenderPassDrawQuad* quad, |
433 const WebKit::WebFilterOperations& filters, | 433 const WebKit::WebFilterOperations& filters, |
434 const WebTransformationMatrix& contentsDeviceTransform, | 434 const WebTransformationMatrix& contentsDeviceTransform, |
435 const WebTransformationMatrix& contentsDeviceTransformInverse) | 435 const WebTransformationMatrix& contentsDeviceTransformInverse) |
436 { | 436 { |
437 // This method draws a background filter, which applies a filter to any pixe
ls behind the quad and seen through its background. | 437 // This method draws a background filter, which applies a filter to any pixe
ls behind the quad and seen through its background. |
438 // The algorithm works as follows: | 438 // The algorithm works as follows: |
439 // 1. Compute a bounding box around the pixels that will be visible through
the quad. | 439 // 1. Compute a bounding box around the pixels that will be visible through
the quad. |
440 // 2. Read the pixels in the bounding box into a buffer R. | 440 // 2. Read the pixels in the bounding box into a buffer R. |
441 // 3. Apply the background filter to R, so that it is applied in the pixels'
coordinate space. | 441 // 3. Apply the background filter to R, so that it is applied in the pixels'
coordinate space. |
442 // 4. Apply the quad's inverse transform to map the pixels in R into the qua
d's content space. This implicitly | 442 // 4. Apply the quad's inverse transform to map the pixels in R into the qua
d's content space. This implicitly |
443 // clips R by the content bounds of the quad since the destination texture h
as bounds matching the quad's content. | 443 // clips R by the content bounds of the quad since the destination texture h
as bounds matching the quad's content. |
444 // 5. Draw the background texture for the contents using the same transform
as used to draw the contents itself. This is done | 444 // 5. Draw the background texture for the contents using the same transform
as used to draw the contents itself. This is done |
445 // without blending to replace the current background pixels with the new fi
ltered background. | 445 // without blending to replace the current background pixels with the new fi
ltered background. |
446 // 6. Draw the contents of the quad over drop of the new background with ble
nding, as per usual. The filtered background | 446 // 6. Draw the contents of the quad over drop of the new background with ble
nding, as per usual. The filtered background |
447 // pixels will show through any non-opaque pixels in this draws. | 447 // pixels will show through any non-opaque pixels in this draws. |
448 // | 448 // |
449 // Pixel copies in this algorithm occur at steps 2, 3, 4, and 5. | 449 // Pixel copies in this algorithm occur at steps 2, 3, 4, and 5. |
450 | 450 |
451 // FIXME: When this algorithm changes, update LayerTreeHost::prioritizeTextu
res() accordingly. | 451 // FIXME: When this algorithm changes, update LayerTreeHost::prioritizeTextu
res() accordingly. |
452 | 452 |
453 if (filters.isEmpty()) | 453 if (filters.isEmpty()) |
454 return scoped_ptr<ScopedTexture>(); | 454 return scoped_ptr<ScopedResource>(); |
455 | 455 |
456 // FIXME: We only allow background filters on an opaque render surface becau
se other surfaces may contain | 456 // FIXME: We only allow background filters on an opaque render surface becau
se other surfaces may contain |
457 // translucent pixels, and the contents behind those translucent pixels woul
dn't have the filter applied. | 457 // translucent pixels, and the contents behind those translucent pixels woul
dn't have the filter applied. |
458 if (frame.currentRenderPass->hasTransparentBackground()) | 458 if (frame.currentRenderPass->hasTransparentBackground()) |
459 return scoped_ptr<ScopedTexture>(); | 459 return scoped_ptr<ScopedResource>(); |
460 DCHECK(!frame.currentTexture); | 460 DCHECK(!frame.currentTexture); |
461 | 461 |
462 // FIXME: Do a single readback for both the surface and replica and cache th
e filtered results (once filter textures are not reused). | 462 // FIXME: Do a single readback for both the surface and replica and cache th
e filtered results (once filter textures are not reused). |
463 gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(content
sDeviceTransform, sharedGeometryQuad().BoundingBox())); | 463 gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(content
sDeviceTransform, sharedGeometryQuad().BoundingBox())); |
464 | 464 |
465 int top, right, bottom, left; | 465 int top, right, bottom, left; |
466 filters.getOutsets(top, right, bottom, left); | 466 filters.getOutsets(top, right, bottom, left); |
467 deviceRect.Inset(-left, -top, -right, -bottom); | 467 deviceRect.Inset(-left, -top, -right, -bottom); |
468 | 468 |
469 deviceRect.Intersect(frame.currentRenderPass->outputRect()); | 469 deviceRect.Intersect(frame.currentRenderPass->outputRect()); |
470 | 470 |
471 scoped_ptr<ScopedTexture> deviceBackgroundTexture = ScopedTexture::create(m_
resourceProvider); | 471 scoped_ptr<ScopedResource> deviceBackgroundTexture = ScopedResource::create(
m_resourceProvider); |
472 if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) | 472 if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) |
473 return scoped_ptr<ScopedTexture>(); | 473 return scoped_ptr<ScopedResource>(); |
474 | 474 |
475 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr
oundTexture.get(), m_client->hasImplThread()); | 475 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr
oundTexture.get(), m_client->hasImplThread()); |
476 if (!filteredDeviceBackground.getTexture()) | 476 if (!filteredDeviceBackground.getTexture()) |
477 return scoped_ptr<ScopedTexture>(); | 477 return scoped_ptr<ScopedResource>(); |
478 | 478 |
479 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g
etTexture()); | 479 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g
etTexture()); |
480 int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); | 480 int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); |
481 | 481 |
482 scoped_ptr<ScopedTexture> backgroundTexture = ScopedTexture::create(m_resour
ceProvider); | 482 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso
urceProvider); |
483 if (!backgroundTexture->allocate(Renderer::ImplPool, quad->quadRect().size()
, GL_RGBA, ResourceProvider::TextureUsageFramebuffer)) | 483 if (!backgroundTexture->allocate(Renderer::ImplPool, quad->quadRect().size()
, GL_RGBA, ResourceProvider::TextureUsageFramebuffer)) |
484 return scoped_ptr<ScopedTexture>(); | 484 return scoped_ptr<ScopedResource>(); |
485 | 485 |
486 const RenderPass* targetRenderPass = frame.currentRenderPass; | 486 const RenderPass* targetRenderPass = frame.currentRenderPass; |
487 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(
), quad->quadRect()); | 487 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(
), quad->quadRect()); |
488 | 488 |
489 if (usingBackgroundTexture) { | 489 if (usingBackgroundTexture) { |
490 // Copy the readback pixels from device to the background texture for th
e surface. | 490 // Copy the readback pixels from device to the background texture for th
e surface. |
491 WebTransformationMatrix deviceToFramebufferTransform; | 491 WebTransformationMatrix deviceToFramebufferTransform; |
492 deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, q
uad->quadRect().height() / 2.0); | 492 deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, q
uad->quadRect().height() / 2.0); |
493 deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->qua
dRect().height(), 1); | 493 deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->qua
dRect().height(), 1); |
494 deviceToFramebufferTransform.multiply(contentsDeviceTransformInverse); | 494 deviceToFramebufferTransform.multiply(contentsDeviceTransformInverse); |
495 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic
eRect, deviceToFramebufferTransform); | 495 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic
eRect, deviceToFramebufferTransform); |
496 } | 496 } |
497 | 497 |
498 useRenderPass(frame, targetRenderPass); | 498 useRenderPass(frame, targetRenderPass); |
499 | 499 |
500 if (!usingBackgroundTexture) | 500 if (!usingBackgroundTexture) |
501 return scoped_ptr<ScopedTexture>(); | 501 return scoped_ptr<ScopedResource>(); |
502 return backgroundTexture.Pass(); | 502 return backgroundTexture.Pass(); |
503 } | 503 } |
504 | 504 |
505 void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
d* quad) | 505 void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
d* quad) |
506 { | 506 { |
507 CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId
()); | 507 CachedResource* contentsTexture = m_renderPassTextures.get(quad->renderPassI
d()); |
508 if (!contentsTexture || !contentsTexture->id()) | 508 if (!contentsTexture || !contentsTexture->id()) |
509 return; | 509 return; |
510 | 510 |
511 const RenderPass* renderPass = frame.renderPassesById->get(quad->renderPassI
d()); | 511 const RenderPass* renderPass = frame.renderPassesById->get(quad->renderPassI
d()); |
512 DCHECK(renderPass); | 512 DCHECK(renderPass); |
513 if (!renderPass) | 513 if (!renderPass) |
514 return; | 514 return; |
515 | 515 |
516 WebTransformationMatrix quadRectMatrix; | 516 WebTransformationMatrix quadRectMatrix; |
517 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->quadRect()); | 517 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->quadRect()); |
518 WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * fram
e.projectionMatrix * quadRectMatrix).to2dTransform(); | 518 WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * fram
e.projectionMatrix * quadRectMatrix).to2dTransform(); |
519 | 519 |
520 // Can only draw surface if device matrix is invertible. | 520 // Can only draw surface if device matrix is invertible. |
521 if (!contentsDeviceTransform.isInvertible()) | 521 if (!contentsDeviceTransform.isInvertible()) |
522 return; | 522 return; |
523 | 523 |
524 WebTransformationMatrix contentsDeviceTransformInverse = contentsDeviceTrans
form.inverse(); | 524 WebTransformationMatrix contentsDeviceTransformInverse = contentsDeviceTrans
form.inverse(); |
525 scoped_ptr<ScopedTexture> backgroundTexture = drawBackgroundFilters( | 525 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( |
526 frame, quad, renderPass->backgroundFilters(), | 526 frame, quad, renderPass->backgroundFilters(), |
527 contentsDeviceTransform, contentsDeviceTransformInverse); | 527 contentsDeviceTransform, contentsDeviceTransformInverse); |
528 | 528 |
529 // FIXME: Cache this value so that we don't have to do it for both the surfa
ce and its replica. | 529 // FIXME: Cache this value so that we don't have to do it for both the surfa
ce and its replica. |
530 // Apply filters to the contents texture. | 530 // Apply filters to the contents texture. |
531 SkBitmap filterBitmap; | 531 SkBitmap filterBitmap; |
532 if (renderPass->filter()) { | 532 if (renderPass->filter()) { |
533 filterBitmap = applyImageFilter(this, renderPass->filter(), contentsText
ure, m_client->hasImplThread()); | 533 filterBitmap = applyImageFilter(this, renderPass->filter(), contentsText
ure, m_client->hasImplThread()); |
534 } else { | 534 } else { |
535 filterBitmap = applyFilters(this, renderPass->filters(), contentsTexture
, m_client->hasImplThread()); | 535 filterBitmap = applyFilters(this, renderPass->filters(), contentsTexture
, m_client->hasImplThread()); |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 // Clean up. | 1287 // Clean up. |
1288 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); | 1288 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); |
1289 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, 0)); | 1289 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, 0)); |
1290 GLC(m_context, m_context->deleteFramebuffer(temporaryFBO)); | 1290 GLC(m_context, m_context->deleteFramebuffer(temporaryFBO)); |
1291 GLC(m_context, m_context->deleteTexture(temporaryTexture)); | 1291 GLC(m_context, m_context->deleteTexture(temporaryTexture)); |
1292 } | 1292 } |
1293 | 1293 |
1294 enforceMemoryPolicy(); | 1294 enforceMemoryPolicy(); |
1295 } | 1295 } |
1296 | 1296 |
1297 bool GLRenderer::getFramebufferTexture(ScopedTexture* texture, const gfx::Rect&
deviceRect) | 1297 bool GLRenderer::getFramebufferTexture(ScopedResource* texture, const gfx::Rect&
deviceRect) |
1298 { | 1298 { |
1299 DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->f
ormat() == GL_RGB)); | 1299 DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->f
ormat() == GL_RGB)); |
1300 | 1300 |
1301 if (!texture->id() && !texture->allocate(Renderer::ImplPool, deviceRect.size
(), GL_RGB, ResourceProvider::TextureUsageAny)) | 1301 if (!texture->id() && !texture->allocate(Renderer::ImplPool, deviceRect.size
(), GL_RGB, ResourceProvider::TextureUsageAny)) |
1302 return false; | 1302 return false; |
1303 | 1303 |
1304 ResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id()); | 1304 ResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id()); |
1305 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, lock.textureId())); | 1305 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, lock.textureId())); |
1306 GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, texture->format()
, | 1306 GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, texture->format()
, |
1307 deviceRect.x(), deviceRect.y(), dev
iceRect.width(), deviceRect.height(), 0)); | 1307 deviceRect.x(), deviceRect.y(), dev
iceRect.width(), deviceRect.height(), 0)); |
1308 return true; | 1308 return true; |
1309 } | 1309 } |
1310 | 1310 |
1311 bool GLRenderer::useScopedTexture(DrawingFrame& frame, const ScopedTexture* text
ure, const gfx::Rect& viewportRect) | 1311 bool GLRenderer::useScopedTexture(DrawingFrame& frame, const ScopedResource* tex
ture, const gfx::Rect& viewportRect) |
1312 { | 1312 { |
1313 DCHECK(texture->id()); | 1313 DCHECK(texture->id()); |
1314 frame.currentRenderPass = 0; | 1314 frame.currentRenderPass = 0; |
1315 frame.currentTexture = texture; | 1315 frame.currentTexture = texture; |
1316 | 1316 |
1317 return bindFramebufferToTexture(frame, texture, viewportRect); | 1317 return bindFramebufferToTexture(frame, texture, viewportRect); |
1318 } | 1318 } |
1319 | 1319 |
1320 void GLRenderer::bindFramebufferToOutputSurface(DrawingFrame& frame) | 1320 void GLRenderer::bindFramebufferToOutputSurface(DrawingFrame& frame) |
1321 { | 1321 { |
1322 m_currentFramebufferLock.reset(); | 1322 m_currentFramebufferLock.reset(); |
1323 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); | 1323 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); |
1324 } | 1324 } |
1325 | 1325 |
1326 bool GLRenderer::bindFramebufferToTexture(DrawingFrame& frame, const ScopedTextu
re* texture, const gfx::Rect& framebufferRect) | 1326 bool GLRenderer::bindFramebufferToTexture(DrawingFrame& frame, const ScopedResou
rce* texture, const gfx::Rect& framebufferRect) |
1327 { | 1327 { |
1328 DCHECK(texture->id()); | 1328 DCHECK(texture->id()); |
1329 | 1329 |
1330 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_offscreenFramebu
fferId)); | 1330 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_offscreenFramebu
fferId)); |
1331 m_currentFramebufferLock = make_scoped_ptr(new ResourceProvider::ScopedWrite
LockGL(m_resourceProvider, texture->id())); | 1331 m_currentFramebufferLock = make_scoped_ptr(new ResourceProvider::ScopedWrite
LockGL(m_resourceProvider, texture->id())); |
1332 unsigned textureId = m_currentFramebufferLock->textureId(); | 1332 unsigned textureId = m_currentFramebufferLock->textureId(); |
1333 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, textureId, 0)); | 1333 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, textureId, 0)); |
1334 | 1334 |
1335 DCHECK(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_C
OMPLETE); | 1335 DCHECK(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_C
OMPLETE); |
1336 | 1336 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 | 1609 |
1610 releaseRenderPassTextures(); | 1610 releaseRenderPassTextures(); |
1611 } | 1611 } |
1612 | 1612 |
1613 bool GLRenderer::isContextLost() | 1613 bool GLRenderer::isContextLost() |
1614 { | 1614 { |
1615 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1615 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
1616 } | 1616 } |
1617 | 1617 |
1618 } // namespace cc | 1618 } // namespace cc |
OLD | NEW |