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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 25673004: When cache is full delay flush until GrContext draw is finished (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rob's comments Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 static const int DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS = 4; 61 static const int DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS = 4;
62 62
63 static const size_t DRAW_BUFFER_IBPOOL_BUFFER_SIZE = 1 << 11; 63 static const size_t DRAW_BUFFER_IBPOOL_BUFFER_SIZE = 1 << 11;
64 static const int DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS = 4; 64 static const int DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS = 4;
65 65
66 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this) 66 #define ASSERT_OWNED_RESOURCE(R) SkASSERT(!(R) || (R)->getContext() == this)
67 67
68 // Glorified typedef to avoid including GrDrawState.h in GrContext.h 68 // Glorified typedef to avoid including GrDrawState.h in GrContext.h
69 class GrContext::AutoRestoreEffects : public GrDrawState::AutoRestoreEffects {}; 69 class GrContext::AutoRestoreEffects : public GrDrawState::AutoRestoreEffects {};
70 70
71 class GrContext::AutoCheckFlush {
72 public:
73 AutoCheckFlush(GrContext* context) : fContext(context) { SkASSERT(NULL != co ntext); }
74
75 ~AutoCheckFlush() {
76 if (fContext->fFlushToReduceCacheSize) {
77 fContext->flush();
78 }
79 }
80
81 private:
82 GrContext* fContext;
83 };
84
71 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext) { 85 GrContext* GrContext::Create(GrBackend backend, GrBackendContext backendContext) {
72 GrContext* context = SkNEW(GrContext); 86 GrContext* context = SkNEW(GrContext);
73 if (context->init(backend, backendContext)) { 87 if (context->init(backend, backendContext)) {
74 return context; 88 return context;
75 } else { 89 } else {
76 context->unref(); 90 context->unref();
77 return NULL; 91 return NULL;
78 } 92 }
79 } 93 }
80 94
(...skipping 13 matching lines...) Expand all
94 fDrawState = NULL; 108 fDrawState = NULL;
95 fGpu = NULL; 109 fGpu = NULL;
96 fClip = NULL; 110 fClip = NULL;
97 fPathRendererChain = NULL; 111 fPathRendererChain = NULL;
98 fSoftwarePathRenderer = NULL; 112 fSoftwarePathRenderer = NULL;
99 fTextureCache = NULL; 113 fTextureCache = NULL;
100 fFontCache = NULL; 114 fFontCache = NULL;
101 fDrawBuffer = NULL; 115 fDrawBuffer = NULL;
102 fDrawBufferVBAllocPool = NULL; 116 fDrawBufferVBAllocPool = NULL;
103 fDrawBufferIBAllocPool = NULL; 117 fDrawBufferIBAllocPool = NULL;
118 fFlushToReduceCacheSize = false;
104 fAARectRenderer = NULL; 119 fAARectRenderer = NULL;
105 fOvalRenderer = NULL; 120 fOvalRenderer = NULL;
106 fViewMatrix.reset(); 121 fViewMatrix.reset();
107 fMaxTextureSizeOverride = 1 << 20; 122 fMaxTextureSizeOverride = 1 << 20;
108 } 123 }
109 124
110 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) { 125 bool GrContext::init(GrBackend backend, GrBackendContext backendContext) {
111 SkASSERT(NULL == fGpu); 126 SkASSERT(NULL == fGpu);
112 127
113 fGpu = GrGpu::Create(backend, backendContext, this); 128 fGpu = GrGpu::Create(backend, backendContext, this);
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 fTextureCache->purgeAsNeeded(); 541 fTextureCache->purgeAsNeeded();
527 } 542 }
528 } 543 }
529 544
530 bool GrContext::OverbudgetCB(void* data) { 545 bool GrContext::OverbudgetCB(void* data) {
531 SkASSERT(NULL != data); 546 SkASSERT(NULL != data);
532 547
533 GrContext* context = reinterpret_cast<GrContext*>(data); 548 GrContext* context = reinterpret_cast<GrContext*>(data);
534 549
535 // Flush the InOrderDrawBuffer to possibly free up some textures 550 // Flush the InOrderDrawBuffer to possibly free up some textures
536 context->flush(); 551 context->fFlushToReduceCacheSize = true;
537 552
538 // TODO: actually track flush's behavior rather than always just
539 // returning true.
540 return true; 553 return true;
541 } 554 }
542 555
543 556
544 GrTexture* GrContext::createUncachedTexture(const GrTextureDesc& descIn, 557 GrTexture* GrContext::createUncachedTexture(const GrTextureDesc& descIn,
545 void* srcData, 558 void* srcData,
546 size_t rowBytes) { 559 size_t rowBytes) {
547 GrTextureDesc descCopy = descIn; 560 GrTextureDesc descCopy = descIn;
548 return fGpu->createTexture(descCopy, srcData, rowBytes); 561 return fGpu->createTexture(descCopy, srcData, rowBytes);
549 } 562 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 return true; 612 return true;
600 } 613 }
601 614
602 615
603 //////////////////////////////////////////////////////////////////////////////// 616 ////////////////////////////////////////////////////////////////////////////////
604 617
605 void GrContext::clear(const SkIRect* rect, 618 void GrContext::clear(const SkIRect* rect,
606 const GrColor color, 619 const GrColor color,
607 GrRenderTarget* target) { 620 GrRenderTarget* target) {
608 AutoRestoreEffects are; 621 AutoRestoreEffects are;
609 this->prepareToDraw(NULL, BUFFERED_DRAW, &are)->clear(rect, color, target); 622 AutoCheckFlush acf(this);
623 this->prepareToDraw(NULL, BUFFERED_DRAW, &are, &acf)->clear(rect, color, tar get);
610 } 624 }
611 625
612 void GrContext::drawPaint(const GrPaint& origPaint) { 626 void GrContext::drawPaint(const GrPaint& origPaint) {
613 // set rect to be big enough to fill the space, but not super-huge, so we 627 // set rect to be big enough to fill the space, but not super-huge, so we
614 // don't overflow fixed-point implementations 628 // don't overflow fixed-point implementations
615 SkRect r; 629 SkRect r;
616 r.setLTRB(0, 0, 630 r.setLTRB(0, 0,
617 SkIntToScalar(getRenderTarget()->width()), 631 SkIntToScalar(getRenderTarget()->width()),
618 SkIntToScalar(getRenderTarget()->height())); 632 SkIntToScalar(getRenderTarget()->height()));
619 SkMatrix inverse; 633 SkMatrix inverse;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 point.fY >= rect.fTop && point.fY <= rect.fBottom; 762 point.fY >= rect.fTop && point.fY <= rect.fBottom;
749 } 763 }
750 764
751 void GrContext::drawRect(const GrPaint& paint, 765 void GrContext::drawRect(const GrPaint& paint,
752 const SkRect& rect, 766 const SkRect& rect,
753 SkScalar width, 767 SkScalar width,
754 const SkMatrix* matrix) { 768 const SkMatrix* matrix) {
755 SK_TRACE_EVENT0("GrContext::drawRect"); 769 SK_TRACE_EVENT0("GrContext::drawRect");
756 770
757 AutoRestoreEffects are; 771 AutoRestoreEffects are;
758 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are); 772 AutoCheckFlush acf(this);
773 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf );
759 774
760 SkMatrix combinedMatrix = target->drawState()->getViewMatrix(); 775 SkMatrix combinedMatrix = target->drawState()->getViewMatrix();
761 if (NULL != matrix) { 776 if (NULL != matrix) {
762 combinedMatrix.preConcat(*matrix); 777 combinedMatrix.preConcat(*matrix);
763 } 778 }
764 779
765 // Check if this is a full RT draw and can be replaced with a clear. We don' t bother checking 780 // Check if this is a full RT draw and can be replaced with a clear. We don' t bother checking
766 // cases where the RT is fully inside a stroke. 781 // cases where the RT is fully inside a stroke.
767 if (width < 0) { 782 if (width < 0) {
768 SkRect rtRect; 783 SkRect rtRect;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 882 }
868 } 883 }
869 884
870 void GrContext::drawRectToRect(const GrPaint& paint, 885 void GrContext::drawRectToRect(const GrPaint& paint,
871 const SkRect& dstRect, 886 const SkRect& dstRect,
872 const SkRect& localRect, 887 const SkRect& localRect,
873 const SkMatrix* dstMatrix, 888 const SkMatrix* dstMatrix,
874 const SkMatrix* localMatrix) { 889 const SkMatrix* localMatrix) {
875 SK_TRACE_EVENT0("GrContext::drawRectToRect"); 890 SK_TRACE_EVENT0("GrContext::drawRectToRect");
876 AutoRestoreEffects are; 891 AutoRestoreEffects are;
877 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are); 892 AutoCheckFlush acf(this);
893 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf );
878 894
879 target->drawRect(dstRect, dstMatrix, &localRect, localMatrix); 895 target->drawRect(dstRect, dstMatrix, &localRect, localMatrix);
880 } 896 }
881 897
882 namespace { 898 namespace {
883 899
884 extern const GrVertexAttrib gPosUVColorAttribs[] = { 900 extern const GrVertexAttrib gPosUVColorAttribs[] = {
885 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding }, 901 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding },
886 {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBind ing }, 902 {kVec2f_GrVertexAttribType, sizeof(GrPoint), kLocalCoord_GrVertexAttribBind ing },
887 {kVec4ub_GrVertexAttribType, 2*sizeof(GrPoint), kColor_GrVertexAttribBinding } 903 {kVec4ub_GrVertexAttribType, 2*sizeof(GrPoint), kColor_GrVertexAttribBinding }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 const GrPoint positions[], 939 const GrPoint positions[],
924 const GrPoint texCoords[], 940 const GrPoint texCoords[],
925 const GrColor colors[], 941 const GrColor colors[],
926 const uint16_t indices[], 942 const uint16_t indices[],
927 int indexCount) { 943 int indexCount) {
928 SK_TRACE_EVENT0("GrContext::drawVertices"); 944 SK_TRACE_EVENT0("GrContext::drawVertices");
929 945
930 GrDrawTarget::AutoReleaseGeometry geo; 946 GrDrawTarget::AutoReleaseGeometry geo;
931 947
932 AutoRestoreEffects are; 948 AutoRestoreEffects are;
933 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are); 949 AutoCheckFlush acf(this);
950 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf );
934 951
935 GrDrawState* drawState = target->drawState(); 952 GrDrawState* drawState = target->drawState();
936 953
937 int colorOffset = -1, texOffset = -1; 954 int colorOffset = -1, texOffset = -1;
938 set_vertex_attributes(drawState, texCoords, colors, &colorOffset, &texOffset ); 955 set_vertex_attributes(drawState, texCoords, colors, &colorOffset, &texOffset );
939 956
940 size_t vertexSize = drawState->getVertexSize(); 957 size_t vertexSize = drawState->getVertexSize();
941 if (sizeof(GrPoint) != vertexSize) { 958 if (sizeof(GrPoint) != vertexSize) {
942 if (!geo.set(target, vertexCount, 0)) { 959 if (!geo.set(target, vertexCount, 0)) {
943 GrPrintf("Failed to get space for vertices!\n"); 960 GrPrintf("Failed to get space for vertices!\n");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 /////////////////////////////////////////////////////////////////////////////// 992 ///////////////////////////////////////////////////////////////////////////////
976 993
977 void GrContext::drawRRect(const GrPaint& paint, 994 void GrContext::drawRRect(const GrPaint& paint,
978 const SkRRect& rect, 995 const SkRRect& rect,
979 const SkStrokeRec& stroke) { 996 const SkStrokeRec& stroke) {
980 if (rect.isEmpty()) { 997 if (rect.isEmpty()) {
981 return; 998 return;
982 } 999 }
983 1000
984 AutoRestoreEffects are; 1001 AutoRestoreEffects are;
985 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are); 1002 AutoCheckFlush acf(this);
1003 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf );
986 1004
987 bool useAA = paint.isAntiAlias() && 1005 bool useAA = paint.isAntiAlias() &&
988 !target->getDrawState().getRenderTarget()->isMultisampled() && 1006 !target->getDrawState().getRenderTarget()->isMultisampled() &&
989 !disable_coverage_aa_for_blend(target); 1007 !disable_coverage_aa_for_blend(target);
990 1008
991 if (!fOvalRenderer->drawSimpleRRect(target, this, useAA, rect, stroke)) { 1009 if (!fOvalRenderer->drawSimpleRRect(target, this, useAA, rect, stroke)) {
992 SkPath path; 1010 SkPath path;
993 path.addRRect(rect); 1011 path.addRRect(rect);
994 this->internalDrawPath(target, useAA, path, stroke); 1012 this->internalDrawPath(target, useAA, path, stroke);
995 } 1013 }
996 } 1014 }
997 1015
998 /////////////////////////////////////////////////////////////////////////////// 1016 ///////////////////////////////////////////////////////////////////////////////
999 1017
1000 void GrContext::drawOval(const GrPaint& paint, 1018 void GrContext::drawOval(const GrPaint& paint,
1001 const SkRect& oval, 1019 const SkRect& oval,
1002 const SkStrokeRec& stroke) { 1020 const SkStrokeRec& stroke) {
1003 if (oval.isEmpty()) { 1021 if (oval.isEmpty()) {
1004 return; 1022 return;
1005 } 1023 }
1006 1024
1007 AutoRestoreEffects are; 1025 AutoRestoreEffects are;
1008 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are); 1026 AutoCheckFlush acf(this);
1027 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf );
1009 1028
1010 bool useAA = paint.isAntiAlias() && 1029 bool useAA = paint.isAntiAlias() &&
1011 !target->getDrawState().getRenderTarget()->isMultisampled() && 1030 !target->getDrawState().getRenderTarget()->isMultisampled() &&
1012 !disable_coverage_aa_for_blend(target); 1031 !disable_coverage_aa_for_blend(target);
1013 1032
1014 if (!fOvalRenderer->drawOval(target, this, useAA, oval, stroke)) { 1033 if (!fOvalRenderer->drawOval(target, this, useAA, oval, stroke)) {
1015 SkPath path; 1034 SkPath path;
1016 path.addOval(oval); 1035 path.addOval(oval);
1017 this->internalDrawPath(target, useAA, path, stroke); 1036 this->internalDrawPath(target, useAA, path, stroke);
1018 } 1037 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 } 1100 }
1082 return; 1101 return;
1083 } 1102 }
1084 1103
1085 // Note that internalDrawPath may sw-rasterize the path into a scratch textu re. 1104 // Note that internalDrawPath may sw-rasterize the path into a scratch textu re.
1086 // Scratch textures can be recycled after they are returned to the texture 1105 // Scratch textures can be recycled after they are returned to the texture
1087 // cache. This presents a potential hazard for buffered drawing. However, 1106 // cache. This presents a potential hazard for buffered drawing. However,
1088 // the writePixels that uploads to the scratch will perform a flush so we're 1107 // the writePixels that uploads to the scratch will perform a flush so we're
1089 // OK. 1108 // OK.
1090 AutoRestoreEffects are; 1109 AutoRestoreEffects are;
1091 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are); 1110 AutoCheckFlush acf(this);
1111 GrDrawTarget* target = this->prepareToDraw(&paint, BUFFERED_DRAW, &are, &acf );
1092 1112
1093 bool useAA = paint.isAntiAlias() && !target->getDrawState().getRenderTarget( )->isMultisampled(); 1113 bool useAA = paint.isAntiAlias() && !target->getDrawState().getRenderTarget( )->isMultisampled();
1094 if (useAA && stroke.getWidth() < 0 && !path.isConvex()) { 1114 if (useAA && stroke.getWidth() < 0 && !path.isConvex()) {
1095 // Concave AA paths are expensive - try to avoid them for special cases 1115 // Concave AA paths are expensive - try to avoid them for special cases
1096 bool useVertexCoverage; 1116 bool useVertexCoverage;
1097 SkRect rects[2]; 1117 SkRect rects[2];
1098 1118
1099 if (is_nested_rects(target, path, stroke, rects, &useVertexCoverage)) { 1119 if (is_nested_rects(target, path, stroke, rects, &useVertexCoverage)) {
1100 SkMatrix origViewMatrix = target->getDrawState().getViewMatrix(); 1120 SkMatrix origViewMatrix = target->getDrawState().getViewMatrix();
1101 GrDrawState::AutoViewMatrixRestore avmr; 1121 GrDrawState::AutoViewMatrixRestore avmr;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 void GrContext::flush(int flagsBitfield) { 1196 void GrContext::flush(int flagsBitfield) {
1177 if (NULL == fDrawBuffer) { 1197 if (NULL == fDrawBuffer) {
1178 return; 1198 return;
1179 } 1199 }
1180 1200
1181 if (kDiscard_FlushBit & flagsBitfield) { 1201 if (kDiscard_FlushBit & flagsBitfield) {
1182 fDrawBuffer->reset(); 1202 fDrawBuffer->reset();
1183 } else { 1203 } else {
1184 fDrawBuffer->flush(); 1204 fDrawBuffer->flush();
1185 } 1205 }
1206 fFlushToReduceCacheSize = false;
1186 } 1207 }
1187 1208
1188 bool GrContext::writeTexturePixels(GrTexture* texture, 1209 bool GrContext::writeTexturePixels(GrTexture* texture,
1189 int left, int top, int width, int height, 1210 int left, int top, int width, int height,
1190 GrPixelConfig config, const void* buffer, siz e_t rowBytes, 1211 GrPixelConfig config, const void* buffer, siz e_t rowBytes,
1191 uint32_t flags) { 1212 uint32_t flags) {
1192 SK_TRACE_EVENT0("GrContext::writeTexturePixels"); 1213 SK_TRACE_EVENT0("GrContext::writeTexturePixels");
1193 ASSERT_OWNED_RESOURCE(texture); 1214 ASSERT_OWNED_RESOURCE(texture);
1194 1215
1195 if ((kUnpremul_PixelOpsFlag & flags) || !fGpu->canWriteTexturePixels(texture , config)) { 1216 if ((kUnpremul_PixelOpsFlag & flags) || !fGpu->canWriteTexturePixels(texture , config)) {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 1604
1584 drawState->setRenderTarget(target); 1605 drawState->setRenderTarget(target);
1585 1606
1586 fGpu->drawSimpleRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heig ht)), NULL); 1607 fGpu->drawSimpleRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(heig ht)), NULL);
1587 return true; 1608 return true;
1588 } 1609 }
1589 //////////////////////////////////////////////////////////////////////////////// 1610 ////////////////////////////////////////////////////////////////////////////////
1590 1611
1591 GrDrawTarget* GrContext::prepareToDraw(const GrPaint* paint, 1612 GrDrawTarget* GrContext::prepareToDraw(const GrPaint* paint,
1592 BufferedDraw buffered, 1613 BufferedDraw buffered,
1593 AutoRestoreEffects* are) { 1614 AutoRestoreEffects* are,
1615 AutoCheckFlush* acf) {
1594 // All users of this draw state should be freeing up all effects when they'r e done. 1616 // All users of this draw state should be freeing up all effects when they'r e done.
1595 // Otherwise effects that own resources may keep those resources alive indef initely. 1617 // Otherwise effects that own resources may keep those resources alive indef initely.
1596 SkASSERT(0 == fDrawState->numColorStages() && 0 == fDrawState->numCoverageSt ages()); 1618 SkASSERT(0 == fDrawState->numColorStages() && 0 == fDrawState->numCoverageSt ages());
1597 1619
1598 if (kNo_BufferedDraw == buffered && kYes_BufferedDraw == fLastDrawWasBuffere d) { 1620 if (kNo_BufferedDraw == buffered && kYes_BufferedDraw == fLastDrawWasBuffere d) {
1599 fDrawBuffer->flush(); 1621 fDrawBuffer->flush();
1600 fLastDrawWasBuffered = kNo_BufferedDraw; 1622 fLastDrawWasBuffered = kNo_BufferedDraw;
1601 } 1623 }
1602 ASSERT_OWNED_RESOURCE(fRenderTarget.get()); 1624 ASSERT_OWNED_RESOURCE(fRenderTarget.get());
1603 if (NULL != paint) { 1625 if (NULL != paint) {
1604 SkASSERT(NULL != are); 1626 SkASSERT(NULL != are);
1627 SkASSERT(NULL != acf);
1605 are->set(fDrawState); 1628 are->set(fDrawState);
1606 fDrawState->setFromPaint(*paint, fViewMatrix, fRenderTarget.get()); 1629 fDrawState->setFromPaint(*paint, fViewMatrix, fRenderTarget.get());
1607 #if GR_DEBUG_PARTIAL_COVERAGE_CHECK 1630 #if GR_DEBUG_PARTIAL_COVERAGE_CHECK
1608 if ((paint->hasMask() || 0xff != paint->fCoverage) && 1631 if ((paint->hasMask() || 0xff != paint->fCoverage) &&
1609 !fGpu->canApplyCoverage()) { 1632 !fGpu->canApplyCoverage()) {
1610 GrPrintf("Partial pixel coverage will be incorrectly blended.\n"); 1633 GrPrintf("Partial pixel coverage will be incorrectly blended.\n");
1611 } 1634 }
1612 #endif 1635 #endif
1613 } else { 1636 } else {
1614 fDrawState->reset(fViewMatrix); 1637 fDrawState->reset(fViewMatrix);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1694 DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS)); 1717 DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS));
1695 1718
1696 fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (fGpu, 1719 fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (fGpu,
1697 fDrawBufferVBAllocPool, 1720 fDrawBufferVBAllocPool,
1698 fDrawBufferIBAllocPool)); 1721 fDrawBufferIBAllocPool));
1699 1722
1700 fDrawBuffer->setDrawState(fDrawState); 1723 fDrawBuffer->setDrawState(fDrawState);
1701 } 1724 }
1702 1725
1703 GrDrawTarget* GrContext::getTextTarget() { 1726 GrDrawTarget* GrContext::getTextTarget() {
1704 return this->prepareToDraw(NULL, BUFFERED_DRAW, NULL); 1727 return this->prepareToDraw(NULL, BUFFERED_DRAW, NULL, NULL);
1705 } 1728 }
1706 1729
1707 const GrIndexBuffer* GrContext::getQuadIndexBuffer() const { 1730 const GrIndexBuffer* GrContext::getQuadIndexBuffer() const {
1708 return fGpu->getQuadIndexBuffer(); 1731 return fGpu->getQuadIndexBuffer();
1709 } 1732 }
1710 1733
1711 namespace { 1734 namespace {
1712 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { 1735 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) {
1713 GrConfigConversionEffect::PMConversion pmToUPM; 1736 GrConfigConversionEffect::PMConversion pmToUPM;
1714 GrConfigConversionEffect::PMConversion upmToPM; 1737 GrConfigConversionEffect::PMConversion upmToPM;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 return NULL; 1772 return NULL;
1750 } 1773 }
1751 } 1774 }
1752 1775
1753 /////////////////////////////////////////////////////////////////////////////// 1776 ///////////////////////////////////////////////////////////////////////////////
1754 #if GR_CACHE_STATS 1777 #if GR_CACHE_STATS
1755 void GrContext::printCacheStats() const { 1778 void GrContext::printCacheStats() const {
1756 fTextureCache->printStats(); 1779 fTextureCache->printStats();
1757 } 1780 }
1758 #endif 1781 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698