| 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 "cc/gl_renderer.h" | 5 #include "cc/gl_renderer.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 DCHECK_LE(tex_scale_y, 1.0f); | 636 DCHECK_LE(tex_scale_y, 1.0f); |
| 637 | 637 |
| 638 if (shaderTexTransformLocation != -1) { | 638 if (shaderTexTransformLocation != -1) { |
| 639 GLC(context(), context()->uniform4f(shaderTexTransformLocation, | 639 GLC(context(), context()->uniform4f(shaderTexTransformLocation, |
| 640 0.0f, 0.0f, | 640 0.0f, 0.0f, |
| 641 tex_scale_x, tex_scale_y)); | 641 tex_scale_x, tex_scale_y)); |
| 642 } else if (shaderTexScaleLocation != -1) { | 642 } else if (shaderTexScaleLocation != -1) { |
| 643 GLC(context(), context()->uniform2f(shaderTexScaleLocation, | 643 GLC(context(), context()->uniform2f(shaderTexScaleLocation, |
| 644 tex_scale_x, tex_scale_y)); | 644 tex_scale_x, tex_scale_y)); |
| 645 } else { | 645 } else { |
| 646 NOTREACHED(); | 646 DCHECK(isContextLost()); |
| 647 } | 647 } |
| 648 | 648 |
| 649 if (shaderMaskSamplerLocation != -1) { | 649 if (shaderMaskSamplerLocation != -1) { |
| 650 DCHECK(shaderMaskTexCoordScaleLocation != 1); | 650 DCHECK(shaderMaskTexCoordScaleLocation != 1); |
| 651 DCHECK(shaderMaskTexCoordOffsetLocation != 1); | 651 DCHECK(shaderMaskTexCoordOffsetLocation != 1); |
| 652 GLC(context(), context()->activeTexture(GL_TEXTURE1)); | 652 GLC(context(), context()->activeTexture(GL_TEXTURE1)); |
| 653 GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); | 653 GLC(context(), context()->uniform1i(shaderMaskSamplerLocation, 1)); |
| 654 GLC(context(), context()->uniform2f(shaderMaskTexCoordOffsetLocation, | 654 GLC(context(), context()->uniform2f(shaderMaskTexCoordOffsetLocation, |
| 655 quad->mask_uv_rect.x(), quad->mask_u
v_rect.y())); | 655 quad->mask_uv_rect.x(), quad->mask_u
v_rect.y())); |
| 656 GLC(context(), context()->uniform2f(shaderMaskTexCoordScaleLocation, | 656 GLC(context(), context()->uniform2f(shaderMaskTexCoordScaleLocation, |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 | 1506 |
| 1507 bool GLRenderer::bindFramebufferToTexture(DrawingFrame& frame, const ScopedResou
rce* texture, const gfx::Rect& framebufferRect) | 1507 bool GLRenderer::bindFramebufferToTexture(DrawingFrame& frame, const ScopedResou
rce* texture, const gfx::Rect& framebufferRect) |
| 1508 { | 1508 { |
| 1509 DCHECK(texture->id()); | 1509 DCHECK(texture->id()); |
| 1510 | 1510 |
| 1511 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_offscreenFramebu
fferId)); | 1511 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_offscreenFramebu
fferId)); |
| 1512 m_currentFramebufferLock = make_scoped_ptr(new ResourceProvider::ScopedWrite
LockGL(m_resourceProvider, texture->id())); | 1512 m_currentFramebufferLock = make_scoped_ptr(new ResourceProvider::ScopedWrite
LockGL(m_resourceProvider, texture->id())); |
| 1513 unsigned textureId = m_currentFramebufferLock->textureId(); | 1513 unsigned textureId = m_currentFramebufferLock->textureId(); |
| 1514 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, textureId, 0)); | 1514 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, textureId, 0)); |
| 1515 | 1515 |
| 1516 DCHECK(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_C
OMPLETE); | 1516 DCHECK(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_C
OMPLETE || isContextLost()); |
| 1517 | 1517 |
| 1518 initializeMatrices(frame, framebufferRect, false); | 1518 initializeMatrices(frame, framebufferRect, false); |
| 1519 setDrawViewportSize(framebufferRect.size()); | 1519 setDrawViewportSize(framebufferRect.size()); |
| 1520 | 1520 |
| 1521 return true; | 1521 return true; |
| 1522 } | 1522 } |
| 1523 | 1523 |
| 1524 void GLRenderer::setScissorTestRect(const gfx::Rect& scissorRect) | 1524 void GLRenderer::setScissorTestRect(const gfx::Rect& scissorRect) |
| 1525 { | 1525 { |
| 1526 ensureScissorTestEnabled(); | 1526 ensureScissorTestEnabled(); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 | 1799 |
| 1800 releaseRenderPassTextures(); | 1800 releaseRenderPassTextures(); |
| 1801 } | 1801 } |
| 1802 | 1802 |
| 1803 bool GLRenderer::isContextLost() | 1803 bool GLRenderer::isContextLost() |
| 1804 { | 1804 { |
| 1805 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1805 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1806 } | 1806 } |
| 1807 | 1807 |
| 1808 } // namespace cc | 1808 } // namespace cc |
| OLD | NEW |