Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: cc/gl_renderer.cc

Issue 12393053: Re-land: cc: Added antialiasing support for solid color layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 setShaderOpacity(quad->opacity(), shaderAlphaLocation); 715 setShaderOpacity(quad->opacity(), shaderAlphaLocation);
716 setShaderQuadF(surfaceQuad, shaderQuadLocation); 716 setShaderQuadF(surfaceQuad, shaderQuadLocation);
717 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, shaderMatrixLocat ion); 717 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, shaderMatrixLocat ion);
718 718
719 // Flush the compositor context before the filter bitmap goes out of 719 // Flush the compositor context before the filter bitmap goes out of
720 // scope, so the draw gets processed before the filter texture gets deleted. 720 // scope, so the draw gets processed before the filter texture gets deleted.
721 if (filterBitmap.getTexture()) 721 if (filterBitmap.getTexture())
722 m_context->flush(); 722 m_context->flush();
723 } 723 }
724 724
725 struct SolidColorProgramUniforms {
726 unsigned program;
727 unsigned matrixLocation;
728 unsigned colorLocation;
729 unsigned pointLocation;
730 unsigned texScaleLocation;
731 unsigned edgeLocation;
732 };
733
734 template<class T>
735 static void solidColorUniformLocation(T program, SolidColorProgramUniforms& unif orms)
736 {
737 uniforms.program = program->program();
738 uniforms.matrixLocation = program->vertexShader().matrixLocation();
739 uniforms.colorLocation = program->fragmentShader().colorLocation();
740 uniforms.pointLocation = program->vertexShader().pointLocation();
741 uniforms.texScaleLocation = program->vertexShader().texScaleLocation();
742 uniforms.edgeLocation = program->fragmentShader().edgeLocation();
743 }
744
745 bool GLRenderer::setupQuadForAntialiasing(const gfx::Transform& deviceTransform, const DrawQuad* quad,
746 gfx::QuadF* localQuad, float* edge) co nst
747 {
748 gfx::Rect tileRect = quad->visible_rect;
749
750 bool clipped = false;
751 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q uad->visibleContentRect()), clipped);
752 DCHECK(!clipped);
753
754 // TODO(reveman): Axis-aligned is not enough to avoid anti-aliasing.
755 // Bounding rectangle for quad also needs to be expressible as
756 // an integer rectangle. crbug.com/169374
757 bool isAxisAlignedInTarget = deviceLayerQuad.IsRectilinear();
758 bool useAA = !clipped && !isAxisAlignedInTarget && quad->IsEdge();
759
760 if (useAA) {
reveman 2013/03/04 20:28:30 you can do "if (!useAA) return false;" here if you
ernstm 2013/03/04 22:00:26 Done.
761 LayerQuad deviceLayerBounds = LayerQuad(gfx::QuadF(deviceLayerQuad.Bound ingBox()));
762 deviceLayerBounds.inflateAntiAliasingDistance();
763
764 LayerQuad deviceLayerEdges = LayerQuad(deviceLayerQuad);
765 deviceLayerEdges.inflateAntiAliasingDistance();
766
767 deviceLayerEdges.toFloatArray(edge);
768 deviceLayerBounds.toFloatArray(&edge[12]);
769
770 gfx::PointF bottomRight = tileRect.bottom_right();
771 gfx::PointF bottomLeft = tileRect.bottom_left();
772 gfx::PointF topLeft = tileRect.origin();
773 gfx::PointF topRight = tileRect.top_right();
774
775 // Map points to device space.
776 bottomRight = MathUtil::mapPoint(deviceTransform, bottomRight, clipped);
777 DCHECK(!clipped);
778 bottomLeft = MathUtil::mapPoint(deviceTransform, bottomLeft, clipped);
779 DCHECK(!clipped);
780 topLeft = MathUtil::mapPoint(deviceTransform, topLeft, clipped);
781 DCHECK(!clipped);
782 topRight = MathUtil::mapPoint(deviceTransform, topRight, clipped);
783 DCHECK(!clipped);
784
785 LayerQuad::Edge bottomEdge(bottomRight, bottomLeft);
786 LayerQuad::Edge leftEdge(bottomLeft, topLeft);
787 LayerQuad::Edge topEdge(topLeft, topRight);
788 LayerQuad::Edge rightEdge(topRight, bottomRight);
789
790 // Only apply anti-aliasing to edges not clipped by culling or scissorin g.
791 if (quad->IsTopEdge() && tileRect.y() == quad->rect.y())
792 topEdge = deviceLayerEdges.top();
793 if (quad->IsLeftEdge() && tileRect.x() == quad->rect.x())
794 leftEdge = deviceLayerEdges.left();
795 if (quad->IsRightEdge() && tileRect.right() == quad->rect.right())
796 rightEdge = deviceLayerEdges.right();
797 if (quad->IsBottomEdge() && tileRect.bottom() == quad->rect.bottom())
798 bottomEdge = deviceLayerEdges.bottom();
799
800 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1;
801 bottomEdge.scale(sign);
802 leftEdge.scale(sign);
803 topEdge.scale(sign);
804 rightEdge.scale(sign);
805
806 // Create device space quad.
807 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge);
808
809 // Map device space quad to local space. deviceTransform has no 3d compo nent since it was flattened, so we don't need to project.
810 // We should have already checked that the transform was uninvertible ab ove.
811 gfx::Transform inverseDeviceTransform(gfx::Transform::kSkipInitializatio n);
812 bool didInvert = deviceTransform.GetInverse(&inverseDeviceTransform);
813 DCHECK(didInvert);
814 *localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuad F(), clipped);
815
816 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become
817 // clipped. To our knowledge this scenario does not need to be handled d ifferently than the unclipped case.
818 } else {
819 *localQuad = gfx::RectF(tileRect);
820 }
821
822 return useAA;
823 }
824
725 void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorD rawQuad* quad) 825 void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorD rawQuad* quad)
726 { 826 {
727 setBlendEnabled(quad->ShouldDrawWithBlending()); 827 gfx::Rect tileRect = quad->visible_rect;
728 828
729 const SolidColorProgram* program = solidColorProgram(); 829 gfx::Transform deviceTransform = frame.windowMatrix * frame.projectionMatrix * quad->quadTransform();
730 setUseProgram(program->program()); 830 deviceTransform.FlattenTo2d();
831 if (!deviceTransform.IsInvertible())
832 return;
833
834 gfx::QuadF localQuad;
835 float edge[24];
836 bool useAA = setupQuadForAntialiasing(deviceTransform, quad, &localQuad, edg e);
837
838 SolidColorProgramUniforms uniforms;
839 if (useAA)
840 solidColorUniformLocation(solidColorProgramAA(), uniforms);
841 else
842 solidColorUniformLocation(solidColorProgram(), uniforms);
843 setUseProgram(uniforms.program);
731 844
732 SkColor color = quad->color; 845 SkColor color = quad->color;
733 float opacity = quad->opacity(); 846 float opacity = quad->opacity();
734 float alpha = (SkColorGetA(color) / 255.0) * opacity; 847 float alpha = (SkColorGetA(color) / 255.0) * opacity;
735 848
736 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation( ), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, ( SkColorGetB(color) / 255.0) * alpha, alpha)); 849 GLC(context(), context()->uniform4f(uniforms.colorLocation,
850 (SkColorGetR(color) / 255.0) * alpha,
851 (SkColorGetG(color) / 255.0) * alpha,
852 (SkColorGetB(color) / 255.0) * alpha,
853 alpha));
737 854
738 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, program->vertexSh ader().matrixLocation()); 855 GLC(context(), context()->uniform2f(uniforms.texScaleLocation, 1.0f, 1.0f));
856
857 if (useAA) {
858 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge));
859 }
860
861 // Enable blending when the quad properties require it or if we decided
862 // to use antialiasing.
863 setBlendEnabled(quad->ShouldDrawWithBlending() || useAA);
864
865 // Normalize to tileRect.
866 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height());
867
868 setShaderQuadF(localQuad, uniforms.pointLocation);
869
870 // The tile quad shader behaves differently compared to all other shaders.
871 // The transform and vertex data are used to figure out the extents that the
872 // un-antialiased quad should have and which vertex this is and the float
873 // quad passed in via uniform is the actual geometry that gets used to draw
874 // it. This is why this centered rect is used and not the original quadRect.
875 gfx::RectF centeredRect(gfx::PointF(-0.5 * tileRect.width(), -0.5 * tileRect .height()), tileRect.size());
876 drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrix Location);
739 } 877 }
740 878
741 struct TileProgramUniforms { 879 struct TileProgramUniforms {
742 unsigned program; 880 unsigned program;
743 unsigned samplerLocation; 881 unsigned samplerLocation;
744 unsigned vertexTexTransformLocation; 882 unsigned vertexTexTransformLocation;
745 unsigned fragmentTexTransformLocation; 883 unsigned fragmentTexTransformLocation;
746 unsigned edgeLocation; 884 unsigned edgeLocation;
747 unsigned matrixLocation; 885 unsigned matrixLocation;
748 unsigned alphaLocation; 886 unsigned alphaLocation;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 float vertexTexScaleX = tileRect.width() / clampGeomRect.width(); 944 float vertexTexScaleX = tileRect.width() / clampGeomRect.width();
807 float vertexTexScaleY = tileRect.height() / clampGeomRect.height(); 945 float vertexTexScaleY = tileRect.height() / clampGeomRect.height();
808 946
809 // Map to normalized texture coordinates. 947 // Map to normalized texture coordinates.
810 const gfx::Size& textureSize = quad->texture_size; 948 const gfx::Size& textureSize = quad->texture_size;
811 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width(); 949 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width();
812 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height(); 950 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height();
813 float fragmentTexScaleX = clampTexRect.width() / textureSize.width(); 951 float fragmentTexScaleX = clampTexRect.width() / textureSize.width();
814 float fragmentTexScaleY = clampTexRect.height() / textureSize.height(); 952 float fragmentTexScaleY = clampTexRect.height() / textureSize.height();
815 953
816 gfx::QuadF localQuad;
817 gfx::Transform deviceTransform = frame.windowMatrix * frame.projectionMatrix * quad->quadTransform(); 954 gfx::Transform deviceTransform = frame.windowMatrix * frame.projectionMatrix * quad->quadTransform();
818 deviceTransform.FlattenTo2d(); 955 deviceTransform.FlattenTo2d();
819 if (!deviceTransform.IsInvertible()) 956 if (!deviceTransform.IsInvertible())
820 return; 957 return;
821 958
822 bool clipped = false; 959 gfx::QuadF localQuad;
823 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q uad->visibleContentRect()), clipped); 960 float edge[24];
824 DCHECK(!clipped); 961 bool useAA = setupQuadForAntialiasing(deviceTransform, quad, &localQuad, edg e);
825
826 // TODO(reveman): Axis-aligned is not enough to avoid anti-aliasing.
827 // Bounding rectangle for quad also needs to be expressible as
828 // an integer rectangle. crbug.com/169374
829 bool isAxisAlignedInTarget = deviceLayerQuad.IsRectilinear();
830 bool useAA = !clipped && !isAxisAlignedInTarget && quad->IsEdge();
831 962
832 TileProgramUniforms uniforms; 963 TileProgramUniforms uniforms;
833 if (useAA) { 964 if (useAA) {
834 if (quad->swizzle_contents) 965 if (quad->swizzle_contents)
835 tileUniformLocation(tileProgramSwizzleAA(), uniforms); 966 tileUniformLocation(tileProgramSwizzleAA(), uniforms);
836 else 967 else
837 tileUniformLocation(tileProgramAA(), uniforms); 968 tileUniformLocation(tileProgramAA(), uniforms);
838 } else { 969 } else {
839 if (quad->ShouldDrawWithBlending()) { 970 if (quad->ShouldDrawWithBlending()) {
840 if (quad->swizzle_contents) 971 if (quad->swizzle_contents)
841 tileUniformLocation(tileProgramSwizzle(), uniforms); 972 tileUniformLocation(tileProgramSwizzle(), uniforms);
842 else 973 else
843 tileUniformLocation(tileProgram(), uniforms); 974 tileUniformLocation(tileProgram(), uniforms);
844 } else { 975 } else {
845 if (quad->swizzle_contents) 976 if (quad->swizzle_contents)
846 tileUniformLocation(tileProgramSwizzleOpaque(), uniforms); 977 tileUniformLocation(tileProgramSwizzleOpaque(), uniforms);
847 else 978 else
848 tileUniformLocation(tileProgramOpaque(), uniforms); 979 tileUniformLocation(tileProgramOpaque(), uniforms);
849 } 980 }
850 } 981 }
851 982
852 setUseProgram(uniforms.program); 983 setUseProgram(uniforms.program);
853 GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); 984 GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0));
854 bool scaled = (texToGeomScaleX != 1 || texToGeomScaleY != 1); 985 bool scaled = (texToGeomScaleX != 1 || texToGeomScaleY != 1);
855 GLenum filter = (useAA || scaled || !quad->quadTransform().IsIdentityOrInteg erTranslation()) ? GL_LINEAR : GL_NEAREST; 986 GLenum filter = (useAA || scaled || !quad->quadTransform().IsIdentityOrInteg erTranslation()) ? GL_LINEAR : GL_NEAREST;
856 ResourceProvider::ScopedSamplerGL quadResourceLock(m_resourceProvider, quad- >resource_id, GL_TEXTURE_2D, filter); 987 ResourceProvider::ScopedSamplerGL quadResourceLock(m_resourceProvider, quad- >resource_id, GL_TEXTURE_2D, filter);
857 988
858 if (useAA) { 989 if (useAA) {
859 LayerQuad deviceLayerBounds = LayerQuad(gfx::QuadF(deviceLayerQuad.Bound ingBox()));
860 deviceLayerBounds.inflateAntiAliasingDistance();
861
862 LayerQuad deviceLayerEdges = LayerQuad(deviceLayerQuad);
863 deviceLayerEdges.inflateAntiAliasingDistance();
864
865 float edge[24];
866 deviceLayerEdges.toFloatArray(edge);
867 deviceLayerBounds.toFloatArray(&edge[12]);
868 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge)); 990 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge));
869
870 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); 991 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
871 GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocatio n, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexS caleY)); 992 GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocatio n, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexS caleY));
872
873 gfx::PointF bottomRight = tileRect.bottom_right();
874 gfx::PointF bottomLeft = tileRect.bottom_left();
875 gfx::PointF topLeft = tileRect.origin();
876 gfx::PointF topRight = tileRect.top_right();
877
878 // Map points to device space.
879 bottomRight = MathUtil::mapPoint(deviceTransform, bottomRight, clipped);
880 DCHECK(!clipped);
881 bottomLeft = MathUtil::mapPoint(deviceTransform, bottomLeft, clipped);
882 DCHECK(!clipped);
883 topLeft = MathUtil::mapPoint(deviceTransform, topLeft, clipped);
884 DCHECK(!clipped);
885 topRight = MathUtil::mapPoint(deviceTransform, topRight, clipped);
886 DCHECK(!clipped);
887
888 LayerQuad::Edge bottomEdge(bottomRight, bottomLeft);
889 LayerQuad::Edge leftEdge(bottomLeft, topLeft);
890 LayerQuad::Edge topEdge(topLeft, topRight);
891 LayerQuad::Edge rightEdge(topRight, bottomRight);
892
893 // Only apply anti-aliasing to edges not clipped by culling or scissorin g.
894 if (quad->IsTopEdge() && tileRect.y() == quad->rect.y())
895 topEdge = deviceLayerEdges.top();
896 if (quad->IsLeftEdge() && tileRect.x() == quad->rect.x())
897 leftEdge = deviceLayerEdges.left();
898 if (quad->IsRightEdge() && tileRect.right() == quad->rect.right())
899 rightEdge = deviceLayerEdges.right();
900 if (quad->IsBottomEdge() && tileRect.bottom() == quad->rect.bottom())
901 bottomEdge = deviceLayerEdges.bottom();
902
903 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1;
904 bottomEdge.scale(sign);
905 leftEdge.scale(sign);
906 topEdge.scale(sign);
907 rightEdge.scale(sign);
908
909 // Create device space quad.
910 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge);
911
912 // Map device space quad to local space. deviceTransform has no 3d compo nent since it was flattened, so we don't need to project.
913 // We should have already checked that the transform was uninvertible ab ove.
914 gfx::Transform inverseDeviceTransform(gfx::Transform::kSkipInitializatio n);
915 bool didInvert = deviceTransform.GetInverse(&inverseDeviceTransform);
916 DCHECK(didInvert);
917 localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF (), clipped);
918
919 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become
920 // clipped. To our knowledge this scenario does not need to be handled d ifferently than the unclipped case.
921 } else { 993 } else {
922 // Move fragment shader transform to vertex shader. We can do this while 994 // Move fragment shader transform to vertex shader. We can do this while
923 // still producing correct results as fragmentTexTransformLocation 995 // still producing correct results as fragmentTexTransformLocation
924 // should always be non-negative when tiles are transformed in a way 996 // should always be non-negative when tiles are transformed in a way
925 // that could result in sampling outside the layer. 997 // that could result in sampling outside the layer.
926 vertexTexScaleX *= fragmentTexScaleX; 998 vertexTexScaleX *= fragmentTexScaleX;
927 vertexTexScaleY *= fragmentTexScaleY; 999 vertexTexScaleY *= fragmentTexScaleY;
928 vertexTexTranslateX *= fragmentTexScaleX; 1000 vertexTexTranslateX *= fragmentTexScaleX;
929 vertexTexTranslateY *= fragmentTexScaleY; 1001 vertexTexTranslateY *= fragmentTexScaleY;
930 vertexTexTranslateX += fragmentTexTranslateX; 1002 vertexTexTranslateX += fragmentTexTranslateX;
931 vertexTexTranslateY += fragmentTexTranslateY; 1003 vertexTexTranslateY += fragmentTexTranslateY;
932 1004
933 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); 1005 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
934
935 localQuad = gfx::RectF(tileRect);
936 } 1006 }
937 1007
938 // Enable blending when the quad properties require it or if we decided 1008 // Enable blending when the quad properties require it or if we decided
939 // to use antialiasing. 1009 // to use antialiasing.
940 setBlendEnabled(quad->ShouldDrawWithBlending() || useAA); 1010 setBlendEnabled(quad->ShouldDrawWithBlending() || useAA);
941 1011
942 // Normalize to tileRect. 1012 // Normalize to tileRect.
943 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); 1013 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height());
944 1014
945 setShaderOpacity(quad->opacity(), uniforms.alphaLocation); 1015 setShaderOpacity(quad->opacity(), uniforms.alphaLocation);
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 { 1710 {
1641 if (!m_solidColorProgram) 1711 if (!m_solidColorProgram)
1642 m_solidColorProgram = make_scoped_ptr(new SolidColorProgram(m_context)); 1712 m_solidColorProgram = make_scoped_ptr(new SolidColorProgram(m_context));
1643 if (!m_solidColorProgram->initialized()) { 1713 if (!m_solidColorProgram->initialized()) {
1644 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); 1714 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize");
1645 m_solidColorProgram->initialize(m_context, m_isUsingBindUniform); 1715 m_solidColorProgram->initialize(m_context, m_isUsingBindUniform);
1646 } 1716 }
1647 return m_solidColorProgram.get(); 1717 return m_solidColorProgram.get();
1648 } 1718 }
1649 1719
1720 const GLRenderer::SolidColorProgramAA* GLRenderer::solidColorProgramAA()
1721 {
1722 if (!m_solidColorProgramAA)
1723 m_solidColorProgramAA = make_scoped_ptr(new SolidColorProgramAA(m_conte xt));
1724 if (!m_solidColorProgramAA->initialized()) {
1725 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize");
1726 m_solidColorProgramAA->initialize(m_context, m_isUsingBindUniform);
1727 }
1728 return m_solidColorProgramAA.get();
1729 }
1730
1650 const GLRenderer::RenderPassProgram* GLRenderer::renderPassProgram() 1731 const GLRenderer::RenderPassProgram* GLRenderer::renderPassProgram()
1651 { 1732 {
1652 DCHECK(m_renderPassProgram); 1733 DCHECK(m_renderPassProgram);
1653 if (!m_renderPassProgram->initialized()) { 1734 if (!m_renderPassProgram->initialized()) {
1654 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); 1735 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize");
1655 m_renderPassProgram->initialize(m_context, m_isUsingBindUniform); 1736 m_renderPassProgram->initialize(m_context, m_isUsingBindUniform);
1656 } 1737 }
1657 return m_renderPassProgram.get(); 1738 return m_renderPassProgram.get();
1658 } 1739 }
1659 1740
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 if (m_textureIOSurfaceProgram) 1927 if (m_textureIOSurfaceProgram)
1847 m_textureIOSurfaceProgram->cleanup(m_context); 1928 m_textureIOSurfaceProgram->cleanup(m_context);
1848 1929
1849 if (m_videoYUVProgram) 1930 if (m_videoYUVProgram)
1850 m_videoYUVProgram->cleanup(m_context); 1931 m_videoYUVProgram->cleanup(m_context);
1851 if (m_videoStreamTextureProgram) 1932 if (m_videoStreamTextureProgram)
1852 m_videoStreamTextureProgram->cleanup(m_context); 1933 m_videoStreamTextureProgram->cleanup(m_context);
1853 1934
1854 if (m_solidColorProgram) 1935 if (m_solidColorProgram)
1855 m_solidColorProgram->cleanup(m_context); 1936 m_solidColorProgram->cleanup(m_context);
1937 if (m_solidColorProgramAA)
1938 m_solidColorProgramAA->cleanup(m_context);
1856 1939
1857 if (m_offscreenFramebufferId) 1940 if (m_offscreenFramebufferId)
1858 GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId)); 1941 GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId));
1859 1942
1860 releaseRenderPassTextures(); 1943 releaseRenderPassTextures();
1861 } 1944 }
1862 1945
1863 bool GLRenderer::isContextLost() 1946 bool GLRenderer::isContextLost()
1864 { 1947 {
1865 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); 1948 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR);
1866 } 1949 }
1867 1950
1868 } // namespace cc 1951 } // namespace cc
OLDNEW
« cc/gl_renderer.h ('K') | « cc/gl_renderer.h ('k') | cc/gl_renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698