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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include <public/WebGraphicsContext3D.h> | 36 #include <public/WebGraphicsContext3D.h> |
37 #include <public/WebSharedGraphicsContext3D.h> | 37 #include <public/WebSharedGraphicsContext3D.h> |
38 #include <set> | 38 #include <set> |
39 #include <string> | 39 #include <string> |
40 #include <vector> | 40 #include <vector> |
41 | 41 |
42 using namespace std; | 42 using namespace std; |
43 using WebKit::WebGraphicsContext3D; | 43 using WebKit::WebGraphicsContext3D; |
44 using WebKit::WebGraphicsMemoryAllocation; | 44 using WebKit::WebGraphicsMemoryAllocation; |
45 using WebKit::WebSharedGraphicsContext3D; | 45 using WebKit::WebSharedGraphicsContext3D; |
46 using WebKit::WebTransformationMatrix; | |
47 | 46 |
48 namespace cc { | 47 namespace cc { |
49 | 48 |
50 namespace { | 49 namespace { |
51 | 50 |
52 bool needsIOSurfaceReadbackWorkaround() | 51 bool needsIOSurfaceReadbackWorkaround() |
53 { | 52 { |
54 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
55 return true; | 54 return true; |
56 #else | 55 #else |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 321 |
323 void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde
rDrawQuad* quad) | 322 void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde
rDrawQuad* quad) |
324 { | 323 { |
325 static float glMatrix[16]; | 324 static float glMatrix[16]; |
326 const SolidColorProgram* program = solidColorProgram(); | 325 const SolidColorProgram* program = solidColorProgram(); |
327 DCHECK(program && (program->initialized() || isContextLost())); | 326 DCHECK(program && (program->initialized() || isContextLost())); |
328 GLC(context(), context()->useProgram(program->program())); | 327 GLC(context(), context()->useProgram(program->program())); |
329 | 328 |
330 // Use the full quadRect for debug quads to not move the edges based on part
ial swaps. | 329 // Use the full quadRect for debug quads to not move the edges based on part
ial swaps. |
331 const gfx::Rect& layerRect = quad->rect; | 330 const gfx::Rect& layerRect = quad->rect; |
332 WebTransformationMatrix renderMatrix = quad->quadTransform(); | 331 gfx::Transform renderMatrix = quad->quadTransform(); |
333 renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerR
ect.height() + layerRect.y()); | 332 renderMatrix.Translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerR
ect.height() + layerRect.y()); |
334 renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); | 333 renderMatrix.Scale(layerRect.width(), layerRect.height()); |
335 GLRenderer::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); | 334 GLRenderer::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); |
336 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc
ation(), 1, false, &glMatrix[0])); | 335 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc
ation(), 1, false, &glMatrix[0])); |
337 | 336 |
338 SkColor color = quad->color; | 337 SkColor color = quad->color; |
339 float alpha = SkColorGetA(color) / 255.0; | 338 float alpha = SkColorGetA(color) / 255.0; |
340 | 339 |
341 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(
), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, (
SkColorGetB(color) / 255.0) * alpha, alpha)); | 340 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(
), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, (
SkColorGetB(color) / 255.0) * alpha, alpha)); |
342 | 341 |
343 GLC(context(), context()->lineWidth(quad->width)); | 342 GLC(context(), context()->lineWidth(quad->width)); |
344 | 343 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 canvas.clear(0x0); | 427 canvas.clear(0x0); |
429 canvas.drawSprite(source, 0, 0, &paint); | 428 canvas.drawSprite(source, 0, 0, &paint); |
430 canvas.flush(); | 429 canvas.flush(); |
431 context3d->flush(); | 430 context3d->flush(); |
432 return device.accessBitmap(false); | 431 return device.accessBitmap(false); |
433 } | 432 } |
434 | 433 |
435 scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters( | 434 scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters( |
436 DrawingFrame& frame, const RenderPassDrawQuad* quad, | 435 DrawingFrame& frame, const RenderPassDrawQuad* quad, |
437 const WebKit::WebFilterOperations& filters, | 436 const WebKit::WebFilterOperations& filters, |
438 const WebTransformationMatrix& contentsDeviceTransform, | 437 const gfx::Transform& contentsDeviceTransform, |
439 const WebTransformationMatrix& contentsDeviceTransformInverse) | 438 const gfx::Transform& contentsDeviceTransformInverse) |
440 { | 439 { |
441 // This method draws a background filter, which applies a filter to any pixe
ls behind the quad and seen through its background. | 440 // This method draws a background filter, which applies a filter to any pixe
ls behind the quad and seen through its background. |
442 // The algorithm works as follows: | 441 // The algorithm works as follows: |
443 // 1. Compute a bounding box around the pixels that will be visible through
the quad. | 442 // 1. Compute a bounding box around the pixels that will be visible through
the quad. |
444 // 2. Read the pixels in the bounding box into a buffer R. | 443 // 2. Read the pixels in the bounding box into a buffer R. |
445 // 3. Apply the background filter to R, so that it is applied in the pixels'
coordinate space. | 444 // 3. Apply the background filter to R, so that it is applied in the pixels'
coordinate space. |
446 // 4. Apply the quad's inverse transform to map the pixels in R into the qua
d's content space. This implicitly | 445 // 4. Apply the quad's inverse transform to map the pixels in R into the qua
d's content space. This implicitly |
447 // clips R by the content bounds of the quad since the destination texture h
as bounds matching the quad's content. | 446 // clips R by the content bounds of the quad since the destination texture h
as bounds matching the quad's content. |
448 // 5. Draw the background texture for the contents using the same transform
as used to draw the contents itself. This is done | 447 // 5. Draw the background texture for the contents using the same transform
as used to draw the contents itself. This is done |
449 // without blending to replace the current background pixels with the new fi
ltered background. | 448 // without blending to replace the current background pixels with the new fi
ltered background. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 484 |
486 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso
urceProvider); | 485 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso
urceProvider); |
487 if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->rect.size(), GL_R
GBA, ResourceProvider::TextureUsageFramebuffer)) | 486 if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->rect.size(), GL_R
GBA, ResourceProvider::TextureUsageFramebuffer)) |
488 return scoped_ptr<ScopedResource>(); | 487 return scoped_ptr<ScopedResource>(); |
489 | 488 |
490 const RenderPass* targetRenderPass = frame.currentRenderPass; | 489 const RenderPass* targetRenderPass = frame.currentRenderPass; |
491 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(
), quad->rect); | 490 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(
), quad->rect); |
492 | 491 |
493 if (usingBackgroundTexture) { | 492 if (usingBackgroundTexture) { |
494 // Copy the readback pixels from device to the background texture for th
e surface. | 493 // Copy the readback pixels from device to the background texture for th
e surface. |
495 WebTransformationMatrix deviceToFramebufferTransform; | 494 gfx::Transform deviceToFramebufferTransform; |
496 deviceToFramebufferTransform.translate(quad->rect.width() / 2.0, quad->r
ect.height() / 2.0); | 495 deviceToFramebufferTransform.Translate(quad->rect.width() / 2.0, quad->r
ect.height() / 2.0); |
497 deviceToFramebufferTransform.scale3d(quad->rect.width(), quad->rect.heig
ht(), 1); | 496 deviceToFramebufferTransform.Scale3d(quad->rect.width(), quad->rect.heig
ht(), 1); |
498 deviceToFramebufferTransform.multiply(contentsDeviceTransformInverse); | 497 deviceToFramebufferTransform.PreconcatTransform(contentsDeviceTransformI
nverse); |
499 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic
eRect, deviceToFramebufferTransform); | 498 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic
eRect, deviceToFramebufferTransform); |
500 } | 499 } |
501 | 500 |
502 useRenderPass(frame, targetRenderPass); | 501 useRenderPass(frame, targetRenderPass); |
503 | 502 |
504 if (!usingBackgroundTexture) | 503 if (!usingBackgroundTexture) |
505 return scoped_ptr<ScopedResource>(); | 504 return scoped_ptr<ScopedResource>(); |
506 return backgroundTexture.Pass(); | 505 return backgroundTexture.Pass(); |
507 } | 506 } |
508 | 507 |
509 void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
d* quad) | 508 void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
d* quad) |
510 { | 509 { |
511 CachedResource* contentsTexture = m_renderPassTextures.get(quad->render_pass
_id); | 510 CachedResource* contentsTexture = m_renderPassTextures.get(quad->render_pass
_id); |
512 if (!contentsTexture || !contentsTexture->id()) | 511 if (!contentsTexture || !contentsTexture->id()) |
513 return; | 512 return; |
514 | 513 |
515 const RenderPass* renderPass = frame.renderPassesById->get(quad->render_pass
_id); | 514 const RenderPass* renderPass = frame.renderPassesById->get(quad->render_pass
_id); |
516 DCHECK(renderPass); | 515 DCHECK(renderPass); |
517 if (!renderPass) | 516 if (!renderPass) |
518 return; | 517 return; |
519 | 518 |
520 WebTransformationMatrix quadRectMatrix; | 519 gfx::Transform quadRectMatrix; |
521 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect); | 520 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect); |
522 WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * fram
e.projectionMatrix * quadRectMatrix).to2dTransform(); | 521 gfx::Transform contentsDeviceTransform = MathUtil::to2dTransform(frame.windo
wMatrix * frame.projectionMatrix * quadRectMatrix); |
523 | 522 |
524 // Can only draw surface if device matrix is invertible. | 523 // Can only draw surface if device matrix is invertible. |
525 if (!contentsDeviceTransform.isInvertible()) | 524 if (!contentsDeviceTransform.IsInvertible()) |
526 return; | 525 return; |
527 | 526 |
528 WebTransformationMatrix contentsDeviceTransformInverse = contentsDeviceTrans
form.inverse(); | 527 gfx::Transform contentsDeviceTransformInverse = MathUtil::inverse(contentsDe
viceTransform); |
529 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( | 528 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( |
530 frame, quad, renderPass->background_filters, | 529 frame, quad, renderPass->background_filters, |
531 contentsDeviceTransform, contentsDeviceTransformInverse); | 530 contentsDeviceTransform, contentsDeviceTransformInverse); |
532 | 531 |
533 // FIXME: Cache this value so that we don't have to do it for both the surfa
ce and its replica. | 532 // FIXME: Cache this value so that we don't have to do it for both the surfa
ce and its replica. |
534 // Apply filters to the contents texture. | 533 // Apply filters to the contents texture. |
535 SkBitmap filterBitmap; | 534 SkBitmap filterBitmap; |
536 if (renderPass->filter) { | 535 if (renderPass->filter) { |
537 filterBitmap = applyImageFilter(this, renderPass->filter, contentsTextur
e, m_client->hasImplThread()); | 536 filterBitmap = applyImageFilter(this, renderPass->filter, contentsTextur
e, m_client->hasImplThread()); |
538 } else { | 537 } else { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 741 |
743 // Map to normalized texture coordinates. | 742 // Map to normalized texture coordinates. |
744 const gfx::Size& textureSize = quad->texture_size; | 743 const gfx::Size& textureSize = quad->texture_size; |
745 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width(); | 744 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width(); |
746 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height(); | 745 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height(); |
747 float fragmentTexScaleX = clampTexRect.width() / textureSize.width(); | 746 float fragmentTexScaleX = clampTexRect.width() / textureSize.width(); |
748 float fragmentTexScaleY = clampTexRect.height() / textureSize.height(); | 747 float fragmentTexScaleY = clampTexRect.height() / textureSize.height(); |
749 | 748 |
750 | 749 |
751 gfx::QuadF localQuad; | 750 gfx::QuadF localQuad; |
752 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind
owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform(); | 751 gfx::Transform deviceTransform = MathUtil::to2dTransform(frame.windowMatrix
* frame.projectionMatrix * quad->quadTransform()); |
753 if (!deviceTransform.isInvertible()) | 752 if (!deviceTransform.IsInvertible()) |
754 return; | 753 return; |
755 | 754 |
756 bool clipped = false; | 755 bool clipped = false; |
757 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q
uad->visibleContentRect()), clipped); | 756 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q
uad->visibleContentRect()), clipped); |
758 DCHECK(!clipped); | 757 DCHECK(!clipped); |
759 | 758 |
760 TileProgramUniforms uniforms; | 759 TileProgramUniforms uniforms; |
761 // For now, we simply skip anti-aliasing with the quad is clipped. This only
happens | 760 // For now, we simply skip anti-aliasing with the quad is clipped. This only
happens |
762 // on perspective transformed layers that go partially behind the camera. | 761 // on perspective transformed layers that go partially behind the camera. |
763 if (quad->IsAntialiased() && !clipped) { | 762 if (quad->IsAntialiased() && !clipped) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1; | 832 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1; |
834 bottomEdge.scale(sign); | 833 bottomEdge.scale(sign); |
835 leftEdge.scale(sign); | 834 leftEdge.scale(sign); |
836 topEdge.scale(sign); | 835 topEdge.scale(sign); |
837 rightEdge.scale(sign); | 836 rightEdge.scale(sign); |
838 | 837 |
839 // Create device space quad. | 838 // Create device space quad. |
840 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); | 839 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); |
841 | 840 |
842 // Map device space quad to local space. deviceTransform has no 3d compo
nent since it was generated with to2dTransform() so we don't need to project. | 841 // Map device space quad to local space. deviceTransform has no 3d compo
nent since it was generated with to2dTransform() so we don't need to project. |
843 WebTransformationMatrix deviceTransformInverse = deviceTransform.inverse
(); | 842 gfx::Transform deviceTransformInverse = MathUtil::inverse(deviceTransfor
m); |
844 localQuad = MathUtil::mapQuad(deviceTransformInverse, deviceQuad.ToQuadF
(), clipped); | 843 localQuad = MathUtil::mapQuad(deviceTransformInverse, deviceQuad.ToQuadF
(), clipped); |
845 | 844 |
846 // We should not DCHECK(!clipped) here, because anti-aliasing inflation
may cause deviceQuad to become | 845 // We should not DCHECK(!clipped) here, because anti-aliasing inflation
may cause deviceQuad to become |
847 // clipped. To our knowledge this scenario does not need to be handled d
ifferently than the unclipped case. | 846 // clipped. To our knowledge this scenario does not need to be handled d
ifferently than the unclipped case. |
848 } else { | 847 } else { |
849 // Move fragment shader transform to vertex shader. We can do this while | 848 // Move fragment shader transform to vertex shader. We can do this while |
850 // still producing correct results as fragmentTexTransformLocation | 849 // still producing correct results as fragmentTexTransformLocation |
851 // should always be non-negative when tiles are transformed in a way | 850 // should always be non-negative when tiles are transformed in a way |
852 // that could result in sampling outside the layer. | 851 // that could result in sampling outside the layer. |
853 vertexTexScaleX *= fragmentTexScaleX; | 852 vertexTexScaleX *= fragmentTexScaleX; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 | 1055 |
1057 void GLRenderer::ensureScissorTestDisabled() | 1056 void GLRenderer::ensureScissorTestDisabled() |
1058 { | 1057 { |
1059 if (!m_isScissorEnabled) | 1058 if (!m_isScissorEnabled) |
1060 return; | 1059 return; |
1061 | 1060 |
1062 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); | 1061 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); |
1063 m_isScissorEnabled = false; | 1062 m_isScissorEnabled = false; |
1064 } | 1063 } |
1065 | 1064 |
1066 void GLRenderer::toGLMatrix(float* flattened, const WebTransformationMatrix& m) | 1065 void GLRenderer::toGLMatrix(float* glMatrix, const gfx::Transform& transform) |
1067 { | 1066 { |
1068 flattened[0] = m.m11(); | 1067 transform.matrix().asColMajorf(glMatrix); |
1069 flattened[1] = m.m12(); | |
1070 flattened[2] = m.m13(); | |
1071 flattened[3] = m.m14(); | |
1072 flattened[4] = m.m21(); | |
1073 flattened[5] = m.m22(); | |
1074 flattened[6] = m.m23(); | |
1075 flattened[7] = m.m24(); | |
1076 flattened[8] = m.m31(); | |
1077 flattened[9] = m.m32(); | |
1078 flattened[10] = m.m33(); | |
1079 flattened[11] = m.m34(); | |
1080 flattened[12] = m.m41(); | |
1081 flattened[13] = m.m42(); | |
1082 flattened[14] = m.m43(); | |
1083 flattened[15] = m.m44(); | |
1084 } | 1068 } |
1085 | 1069 |
1086 void GLRenderer::setShaderQuadF(const gfx::QuadF& quad, int quadLocation) | 1070 void GLRenderer::setShaderQuadF(const gfx::QuadF& quad, int quadLocation) |
1087 { | 1071 { |
1088 if (quadLocation == -1) | 1072 if (quadLocation == -1) |
1089 return; | 1073 return; |
1090 | 1074 |
1091 float point[8]; | 1075 float point[8]; |
1092 point[0] = quad.p1().x(); | 1076 point[0] = quad.p1().x(); |
1093 point[1] = quad.p1().y(); | 1077 point[1] = quad.p1().y(); |
1094 point[2] = quad.p2().x(); | 1078 point[2] = quad.p2().x(); |
1095 point[3] = quad.p2().y(); | 1079 point[3] = quad.p2().y(); |
1096 point[4] = quad.p3().x(); | 1080 point[4] = quad.p3().x(); |
1097 point[5] = quad.p3().y(); | 1081 point[5] = quad.p3().y(); |
1098 point[6] = quad.p4().x(); | 1082 point[6] = quad.p4().x(); |
1099 point[7] = quad.p4().y(); | 1083 point[7] = quad.p4().y(); |
1100 GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); | 1084 GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); |
1101 } | 1085 } |
1102 | 1086 |
1103 void GLRenderer::setShaderOpacity(float opacity, int alphaLocation) | 1087 void GLRenderer::setShaderOpacity(float opacity, int alphaLocation) |
1104 { | 1088 { |
1105 if (alphaLocation != -1) | 1089 if (alphaLocation != -1) |
1106 GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); | 1090 GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); |
1107 } | 1091 } |
1108 | 1092 |
1109 void GLRenderer::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTr
ansformationMatrix& drawTransform, const gfx::RectF& quadRect, int matrixLocatio
n) | 1093 void GLRenderer::drawQuadGeometry(const DrawingFrame& frame, const gfx::Transfor
m& drawTransform, const gfx::RectF& quadRect, int matrixLocation) |
1110 { | 1094 { |
1111 WebTransformationMatrix quadRectMatrix; | 1095 gfx::Transform quadRectMatrix; |
1112 quadRectTransform(&quadRectMatrix, drawTransform, quadRect); | 1096 quadRectTransform(&quadRectMatrix, drawTransform, quadRect); |
1113 static float glMatrix[16]; | 1097 static float glMatrix[16]; |
1114 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); | 1098 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); |
1115 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr
ix[0])); | 1099 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr
ix[0])); |
1116 | 1100 |
1117 GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0
)); | 1101 GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0
)); |
1118 } | 1102 } |
1119 | 1103 |
1120 void GLRenderer::copyTextureToFramebuffer(const DrawingFrame& frame, int texture
Id, const gfx::Rect& rect, const WebTransformationMatrix& drawMatrix) | 1104 void GLRenderer::copyTextureToFramebuffer(const DrawingFrame& frame, int texture
Id, const gfx::Rect& rect, const gfx::Transform& drawMatrix) |
1121 { | 1105 { |
1122 const RenderPassProgram* program = renderPassProgram(); | 1106 const RenderPassProgram* program = renderPassProgram(); |
1123 | 1107 |
1124 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, textureId)); | 1108 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, textureId)); |
1125 | 1109 |
1126 GLC(context(), context()->useProgram(program->program())); | 1110 GLC(context(), context()->useProgram(program->program())); |
1127 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio
n(), 0)); | 1111 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio
n(), 0)); |
1128 setShaderOpacity(1, program->fragmentShader().alphaLocation()); | 1112 setShaderOpacity(1, program->fragmentShader().alphaLocation()); |
1129 drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLoca
tion()); | 1113 drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLoca
tion()); |
1130 } | 1114 } |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 | 1625 |
1642 releaseRenderPassTextures(); | 1626 releaseRenderPassTextures(); |
1643 } | 1627 } |
1644 | 1628 |
1645 bool GLRenderer::isContextLost() | 1629 bool GLRenderer::isContextLost() |
1646 { | 1630 { |
1647 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1631 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
1648 } | 1632 } |
1649 | 1633 |
1650 } // namespace cc | 1634 } // namespace cc |
OLD | NEW |