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

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: setupQuadForAntialiasing modifies localQuad only if useAA is true 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)
761 return false;
762
763 LayerQuad deviceLayerBounds = LayerQuad(gfx::QuadF(deviceLayerQuad.BoundingB ox()));
764 deviceLayerBounds.inflateAntiAliasingDistance();
765
766 LayerQuad deviceLayerEdges = LayerQuad(deviceLayerQuad);
767 deviceLayerEdges.inflateAntiAliasingDistance();
768
769 deviceLayerEdges.toFloatArray(edge);
770 deviceLayerBounds.toFloatArray(&edge[12]);
771
772 gfx::PointF bottomRight = tileRect.bottom_right();
773 gfx::PointF bottomLeft = tileRect.bottom_left();
774 gfx::PointF topLeft = tileRect.origin();
775 gfx::PointF topRight = tileRect.top_right();
776
777 // Map points to device space.
778 bottomRight = MathUtil::mapPoint(deviceTransform, bottomRight, clipped);
779 DCHECK(!clipped);
780 bottomLeft = MathUtil::mapPoint(deviceTransform, bottomLeft, clipped);
781 DCHECK(!clipped);
782 topLeft = MathUtil::mapPoint(deviceTransform, topLeft, clipped);
783 DCHECK(!clipped);
784 topRight = MathUtil::mapPoint(deviceTransform, topRight, clipped);
785 DCHECK(!clipped);
786
787 LayerQuad::Edge bottomEdge(bottomRight, bottomLeft);
788 LayerQuad::Edge leftEdge(bottomLeft, topLeft);
789 LayerQuad::Edge topEdge(topLeft, topRight);
790 LayerQuad::Edge rightEdge(topRight, bottomRight);
791
792 // Only apply anti-aliasing to edges not clipped by culling or scissoring.
793 if (quad->IsTopEdge() && tileRect.y() == quad->rect.y())
794 topEdge = deviceLayerEdges.top();
795 if (quad->IsLeftEdge() && tileRect.x() == quad->rect.x())
796 leftEdge = deviceLayerEdges.left();
797 if (quad->IsRightEdge() && tileRect.right() == quad->rect.right())
798 rightEdge = deviceLayerEdges.right();
799 if (quad->IsBottomEdge() && tileRect.bottom() == quad->rect.bottom())
800 bottomEdge = deviceLayerEdges.bottom();
801
802 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1;
803 bottomEdge.scale(sign);
804 leftEdge.scale(sign);
805 topEdge.scale(sign);
806 rightEdge.scale(sign);
807
808 // Create device space quad.
809 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge);
810
811 // Map device space quad to local space. deviceTransform has no 3d component since it was flattened, so we don't need to project.
812 // We should have already checked that the transform was uninvertible above.
813 gfx::Transform inverseDeviceTransform(gfx::Transform::kSkipInitialization);
814 bool didInvert = deviceTransform.GetInverse(&inverseDeviceTransform);
815 DCHECK(didInvert);
816 *localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF(), clipped);
817 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become
818 // clipped. To our knowledge this scenario does not need to be handled diffe rently than the unclipped case.
819
820 return true;
821 }
822
725 void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorD rawQuad* quad) 823 void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorD rawQuad* quad)
726 { 824 {
727 setBlendEnabled(quad->ShouldDrawWithBlending()); 825 gfx::Rect tileRect = quad->visible_rect;
728 826
729 const SolidColorProgram* program = solidColorProgram(); 827 gfx::Transform deviceTransform = frame.windowMatrix * frame.projectionMatrix * quad->quadTransform();
730 setUseProgram(program->program()); 828 deviceTransform.FlattenTo2d();
829 if (!deviceTransform.IsInvertible())
830 return;
831
832 gfx::QuadF localQuad = gfx::QuadF(gfx::RectF(tileRect));
833 float edge[24];
834 bool useAA = setupQuadForAntialiasing(deviceTransform, quad, &localQuad, edg e);
835
836 SolidColorProgramUniforms uniforms;
837 if (useAA)
838 solidColorUniformLocation(solidColorProgramAA(), uniforms);
839 else
840 solidColorUniformLocation(solidColorProgram(), uniforms);
841 setUseProgram(uniforms.program);
731 842
732 SkColor color = quad->color; 843 SkColor color = quad->color;
733 float opacity = quad->opacity(); 844 float opacity = quad->opacity();
734 float alpha = (SkColorGetA(color) / 255.0) * opacity; 845 float alpha = (SkColorGetA(color) / 255.0) * opacity;
735 846
736 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation( ), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, ( SkColorGetB(color) / 255.0) * alpha, alpha)); 847 GLC(context(), context()->uniform4f(uniforms.colorLocation,
848 (SkColorGetR(color) / 255.0) * alpha,
849 (SkColorGetG(color) / 255.0) * alpha,
850 (SkColorGetB(color) / 255.0) * alpha,
851 alpha));
737 852
738 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, program->vertexSh ader().matrixLocation()); 853 GLC(context(), context()->uniform2f(uniforms.texScaleLocation, 1.0f, 1.0f));
854
855 if (useAA) {
856 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge));
857 }
858
859 // Enable blending when the quad properties require it or if we decided
860 // to use antialiasing.
861 setBlendEnabled(quad->ShouldDrawWithBlending() || useAA);
862
863 // Normalize to tileRect.
864 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height());
865
866 setShaderQuadF(localQuad, uniforms.pointLocation);
867
868 // The tile quad shader behaves differently compared to all other shaders.
reveman 2013/03/04 22:59:06 we shouldn't be referring to the tile quad shader
ernstm 2013/03/05 00:46:51 Done.
869 // The transform and vertex data are used to figure out the extents that the
870 // un-antialiased quad should have and which vertex this is and the float
871 // quad passed in via uniform is the actual geometry that gets used to draw
872 // it. This is why this centered rect is used and not the original quadRect.
873 gfx::RectF centeredRect(gfx::PointF(-0.5 * tileRect.width(), -0.5 * tileRect .height()), tileRect.size());
874 drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrix Location);
739 } 875 }
740 876
741 struct TileProgramUniforms { 877 struct TileProgramUniforms {
742 unsigned program; 878 unsigned program;
743 unsigned samplerLocation; 879 unsigned samplerLocation;
744 unsigned vertexTexTransformLocation; 880 unsigned vertexTexTransformLocation;
745 unsigned fragmentTexTransformLocation; 881 unsigned fragmentTexTransformLocation;
746 unsigned edgeLocation; 882 unsigned edgeLocation;
747 unsigned matrixLocation; 883 unsigned matrixLocation;
748 unsigned alphaLocation; 884 unsigned alphaLocation;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 float vertexTexScaleX = tileRect.width() / clampGeomRect.width(); 942 float vertexTexScaleX = tileRect.width() / clampGeomRect.width();
807 float vertexTexScaleY = tileRect.height() / clampGeomRect.height(); 943 float vertexTexScaleY = tileRect.height() / clampGeomRect.height();
808 944
809 // Map to normalized texture coordinates. 945 // Map to normalized texture coordinates.
810 const gfx::Size& textureSize = quad->texture_size; 946 const gfx::Size& textureSize = quad->texture_size;
811 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width(); 947 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width();
812 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height(); 948 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height();
813 float fragmentTexScaleX = clampTexRect.width() / textureSize.width(); 949 float fragmentTexScaleX = clampTexRect.width() / textureSize.width();
814 float fragmentTexScaleY = clampTexRect.height() / textureSize.height(); 950 float fragmentTexScaleY = clampTexRect.height() / textureSize.height();
815 951
816 gfx::QuadF localQuad;
817 gfx::Transform deviceTransform = frame.windowMatrix * frame.projectionMatrix * quad->quadTransform(); 952 gfx::Transform deviceTransform = frame.windowMatrix * frame.projectionMatrix * quad->quadTransform();
818 deviceTransform.FlattenTo2d(); 953 deviceTransform.FlattenTo2d();
819 if (!deviceTransform.IsInvertible()) 954 if (!deviceTransform.IsInvertible())
820 return; 955 return;
821 956
822 bool clipped = false; 957 gfx::QuadF localQuad = gfx::QuadF(gfx::RectF(tileRect));
823 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q uad->visibleContentRect()), clipped); 958 float edge[24];
824 DCHECK(!clipped); 959 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 960
832 TileProgramUniforms uniforms; 961 TileProgramUniforms uniforms;
833 if (useAA) { 962 if (useAA) {
834 if (quad->swizzle_contents) 963 if (quad->swizzle_contents)
835 tileUniformLocation(tileProgramSwizzleAA(), uniforms); 964 tileUniformLocation(tileProgramSwizzleAA(), uniforms);
836 else 965 else
837 tileUniformLocation(tileProgramAA(), uniforms); 966 tileUniformLocation(tileProgramAA(), uniforms);
838 } else { 967 } else {
839 if (quad->ShouldDrawWithBlending()) { 968 if (quad->ShouldDrawWithBlending()) {
840 if (quad->swizzle_contents) 969 if (quad->swizzle_contents)
841 tileUniformLocation(tileProgramSwizzle(), uniforms); 970 tileUniformLocation(tileProgramSwizzle(), uniforms);
842 else 971 else
843 tileUniformLocation(tileProgram(), uniforms); 972 tileUniformLocation(tileProgram(), uniforms);
844 } else { 973 } else {
845 if (quad->swizzle_contents) 974 if (quad->swizzle_contents)
846 tileUniformLocation(tileProgramSwizzleOpaque(), uniforms); 975 tileUniformLocation(tileProgramSwizzleOpaque(), uniforms);
847 else 976 else
848 tileUniformLocation(tileProgramOpaque(), uniforms); 977 tileUniformLocation(tileProgramOpaque(), uniforms);
849 } 978 }
850 } 979 }
851 980
852 setUseProgram(uniforms.program); 981 setUseProgram(uniforms.program);
853 GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); 982 GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0));
854 bool scaled = (texToGeomScaleX != 1 || texToGeomScaleY != 1); 983 bool scaled = (texToGeomScaleX != 1 || texToGeomScaleY != 1);
855 GLenum filter = (useAA || scaled || !quad->quadTransform().IsIdentityOrInteg erTranslation()) ? GL_LINEAR : GL_NEAREST; 984 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); 985 ResourceProvider::ScopedSamplerGL quadResourceLock(m_resourceProvider, quad- >resource_id, GL_TEXTURE_2D, filter);
857 986
858 if (useAA) { 987 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)); 988 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge));
869
870 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); 989 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
871 GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocatio n, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexS caleY)); 990 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 { 991 } else {
922 // Move fragment shader transform to vertex shader. We can do this while 992 // Move fragment shader transform to vertex shader. We can do this while
923 // still producing correct results as fragmentTexTransformLocation 993 // still producing correct results as fragmentTexTransformLocation
924 // should always be non-negative when tiles are transformed in a way 994 // should always be non-negative when tiles are transformed in a way
925 // that could result in sampling outside the layer. 995 // that could result in sampling outside the layer.
926 vertexTexScaleX *= fragmentTexScaleX; 996 vertexTexScaleX *= fragmentTexScaleX;
927 vertexTexScaleY *= fragmentTexScaleY; 997 vertexTexScaleY *= fragmentTexScaleY;
928 vertexTexTranslateX *= fragmentTexScaleX; 998 vertexTexTranslateX *= fragmentTexScaleX;
929 vertexTexTranslateY *= fragmentTexScaleY; 999 vertexTexTranslateY *= fragmentTexScaleY;
930 vertexTexTranslateX += fragmentTexTranslateX; 1000 vertexTexTranslateX += fragmentTexTranslateX;
931 vertexTexTranslateY += fragmentTexTranslateY; 1001 vertexTexTranslateY += fragmentTexTranslateY;
932 1002
933 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); 1003 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
934
935 localQuad = gfx::RectF(tileRect);
936 } 1004 }
937 1005
938 // Enable blending when the quad properties require it or if we decided 1006 // Enable blending when the quad properties require it or if we decided
939 // to use antialiasing. 1007 // to use antialiasing.
940 setBlendEnabled(quad->ShouldDrawWithBlending() || useAA); 1008 setBlendEnabled(quad->ShouldDrawWithBlending() || useAA);
941 1009
942 // Normalize to tileRect. 1010 // Normalize to tileRect.
943 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); 1011 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height());
944 1012
945 setShaderOpacity(quad->opacity(), uniforms.alphaLocation); 1013 setShaderOpacity(quad->opacity(), uniforms.alphaLocation);
946 setShaderQuadF(localQuad, uniforms.pointLocation); 1014 setShaderQuadF(localQuad, uniforms.pointLocation);
947 1015
948 // The tile quad shader behaves differently compared to all other shaders. 1016 // The tile quad shader behaves differently compared to all other shaders.
reveman 2013/03/04 22:59:06 adjust this comment too.
ernstm 2013/03/05 00:46:51 Done.
949 // The transform and vertex data are used to figure out the extents that the 1017 // The transform and vertex data are used to figure out the extents that the
950 // un-antialiased quad should have and which vertex this is and the float 1018 // un-antialiased quad should have and which vertex this is and the float
951 // quad passed in via uniform is the actual geometry that gets used to draw 1019 // quad passed in via uniform is the actual geometry that gets used to draw
952 // it. This is why this centered rect is used and not the original quadRect. 1020 // it. This is why this centered rect is used and not the original quadRect.
953 gfx::RectF centeredRect(gfx::PointF(-0.5 * tileRect.width(), -0.5 * tileRect .height()), tileRect.size()); 1021 gfx::RectF centeredRect(gfx::PointF(-0.5 * tileRect.width(), -0.5 * tileRect .height()), tileRect.size());
954 drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrix Location); 1022 drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrix Location);
955 } 1023 }
956 1024
957 void GLRenderer::drawYUVVideoQuad(const DrawingFrame& frame, const YUVVideoDrawQ uad* quad) 1025 void GLRenderer::drawYUVVideoQuad(const DrawingFrame& frame, const YUVVideoDrawQ uad* quad)
958 { 1026 {
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 { 1708 {
1641 if (!m_solidColorProgram) 1709 if (!m_solidColorProgram)
1642 m_solidColorProgram = make_scoped_ptr(new SolidColorProgram(m_context)); 1710 m_solidColorProgram = make_scoped_ptr(new SolidColorProgram(m_context));
1643 if (!m_solidColorProgram->initialized()) { 1711 if (!m_solidColorProgram->initialized()) {
1644 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); 1712 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize");
1645 m_solidColorProgram->initialize(m_context, m_isUsingBindUniform); 1713 m_solidColorProgram->initialize(m_context, m_isUsingBindUniform);
1646 } 1714 }
1647 return m_solidColorProgram.get(); 1715 return m_solidColorProgram.get();
1648 } 1716 }
1649 1717
1718 const GLRenderer::SolidColorProgramAA* GLRenderer::solidColorProgramAA()
1719 {
1720 if (!m_solidColorProgramAA)
1721 m_solidColorProgramAA = make_scoped_ptr(new SolidColorProgramAA(m_conte xt));
1722 if (!m_solidColorProgramAA->initialized()) {
1723 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize");
1724 m_solidColorProgramAA->initialize(m_context, m_isUsingBindUniform);
1725 }
1726 return m_solidColorProgramAA.get();
1727 }
1728
1650 const GLRenderer::RenderPassProgram* GLRenderer::renderPassProgram() 1729 const GLRenderer::RenderPassProgram* GLRenderer::renderPassProgram()
1651 { 1730 {
1652 DCHECK(m_renderPassProgram); 1731 DCHECK(m_renderPassProgram);
1653 if (!m_renderPassProgram->initialized()) { 1732 if (!m_renderPassProgram->initialized()) {
1654 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); 1733 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize");
1655 m_renderPassProgram->initialize(m_context, m_isUsingBindUniform); 1734 m_renderPassProgram->initialize(m_context, m_isUsingBindUniform);
1656 } 1735 }
1657 return m_renderPassProgram.get(); 1736 return m_renderPassProgram.get();
1658 } 1737 }
1659 1738
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 if (m_textureIOSurfaceProgram) 1925 if (m_textureIOSurfaceProgram)
1847 m_textureIOSurfaceProgram->cleanup(m_context); 1926 m_textureIOSurfaceProgram->cleanup(m_context);
1848 1927
1849 if (m_videoYUVProgram) 1928 if (m_videoYUVProgram)
1850 m_videoYUVProgram->cleanup(m_context); 1929 m_videoYUVProgram->cleanup(m_context);
1851 if (m_videoStreamTextureProgram) 1930 if (m_videoStreamTextureProgram)
1852 m_videoStreamTextureProgram->cleanup(m_context); 1931 m_videoStreamTextureProgram->cleanup(m_context);
1853 1932
1854 if (m_solidColorProgram) 1933 if (m_solidColorProgram)
1855 m_solidColorProgram->cleanup(m_context); 1934 m_solidColorProgram->cleanup(m_context);
1935 if (m_solidColorProgramAA)
1936 m_solidColorProgramAA->cleanup(m_context);
1856 1937
1857 if (m_offscreenFramebufferId) 1938 if (m_offscreenFramebufferId)
1858 GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId)); 1939 GLC(m_context, m_context->deleteFramebuffer(m_offscreenFramebufferId));
1859 1940
1860 releaseRenderPassTextures(); 1941 releaseRenderPassTextures();
1861 } 1942 }
1862 1943
1863 bool GLRenderer::isContextLost() 1944 bool GLRenderer::isContextLost()
1864 { 1945 {
1865 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); 1946 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR);
1866 } 1947 }
1867 1948
1868 } // namespace cc 1949 } // 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