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

Side by Side Diff: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp

Issue 1345823002: Update params to get better packing for DF path atlas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Re-enable DF paths Created 5 years, 3 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
« no previous file with comments | « no previous file | 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 2014 Google Inc. 3 * Copyright 2014 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 #include "GrAADistanceFieldPathRenderer.h" 9 #include "GrAADistanceFieldPathRenderer.h"
10 10
11 #include "GrBatchFlushState.h" 11 #include "GrBatchFlushState.h"
12 #include "GrBatchTest.h" 12 #include "GrBatchTest.h"
13 #include "GrContext.h" 13 #include "GrContext.h"
14 #include "GrPipelineBuilder.h" 14 #include "GrPipelineBuilder.h"
15 #include "GrResourceProvider.h" 15 #include "GrResourceProvider.h"
16 #include "GrSurfacePriv.h" 16 #include "GrSurfacePriv.h"
17 #include "GrSWMaskHelper.h" 17 #include "GrSWMaskHelper.h"
18 #include "GrTexturePriv.h" 18 #include "GrTexturePriv.h"
19 #include "GrVertexBuffer.h" 19 #include "GrVertexBuffer.h"
20 #include "batches/GrVertexBatch.h" 20 #include "batches/GrVertexBatch.h"
21 #include "effects/GrDistanceFieldGeoProc.h" 21 #include "effects/GrDistanceFieldGeoProc.h"
22 22
23 #include "SkDistanceFieldGen.h" 23 #include "SkDistanceFieldGen.h"
24 #include "SkRTConf.h" 24 #include "SkRTConf.h"
25 25
26 #define ATLAS_TEXTURE_WIDTH 1024 26 #define ATLAS_TEXTURE_WIDTH 2048
27 #define ATLAS_TEXTURE_HEIGHT 2048 27 #define ATLAS_TEXTURE_HEIGHT 2048
28 #define PLOT_WIDTH 256 28 #define PLOT_WIDTH 512
29 #define PLOT_HEIGHT 256 29 #define PLOT_HEIGHT 256
30 30
31 #define NUM_PLOTS_X (ATLAS_TEXTURE_WIDTH / PLOT_WIDTH) 31 #define NUM_PLOTS_X (ATLAS_TEXTURE_WIDTH / PLOT_WIDTH)
32 #define NUM_PLOTS_Y (ATLAS_TEXTURE_HEIGHT / PLOT_HEIGHT) 32 #define NUM_PLOTS_Y (ATLAS_TEXTURE_HEIGHT / PLOT_HEIGHT)
33 33
34 #ifdef DF_PATH_TRACKING 34 #ifdef DF_PATH_TRACKING
35 static int g_NumCachedPaths = 0; 35 static int g_NumCachedPaths = 0;
36 static int g_NumFreedPaths = 0; 36 static int g_NumFreedPaths = 0;
37 #endif 37 #endif
38 38
39 // mip levels 39 // mip levels
40 static const int kSmallMIP = 32; 40 static const int kSmallMIP = 32;
41 static const int kMediumMIP = 78; 41 static const int kMediumMIP = 72;
42 static const int kLargeMIP = 192; 42 static const int kLargeMIP = 162;
43 43
44 // Callback to clear out internal path cache when eviction occurs 44 // Callback to clear out internal path cache when eviction occurs
45 void GrAADistanceFieldPathRenderer::HandleEviction(GrBatchAtlas::AtlasID id, voi d* pr) { 45 void GrAADistanceFieldPathRenderer::HandleEviction(GrBatchAtlas::AtlasID id, voi d* pr) {
46 GrAADistanceFieldPathRenderer* dfpr = (GrAADistanceFieldPathRenderer*)pr; 46 GrAADistanceFieldPathRenderer* dfpr = (GrAADistanceFieldPathRenderer*)pr;
47 // remove any paths that use this plot 47 // remove any paths that use this plot
48 PathDataList::Iter iter; 48 PathDataList::Iter iter;
49 iter.init(dfpr->fPathList, PathDataList::Iter::kHead_IterStart); 49 iter.init(dfpr->fPathList, PathDataList::Iter::kHead_IterStart);
50 PathData* pathData; 50 PathData* pathData;
51 while ((pathData = iter.get())) { 51 while ((pathData = iter.get())) {
52 iter.next(); 52 iter.next();
(...skipping 22 matching lines...) Expand all
75 } 75 }
76 delete fAtlas; 76 delete fAtlas;
77 77
78 #ifdef DF_PATH_TRACKING 78 #ifdef DF_PATH_TRACKING
79 SkDebugf("Cached paths: %d, freed paths: %d\n", g_NumCachedPaths, g_NumFreed Paths); 79 SkDebugf("Cached paths: %d, freed paths: %d\n", g_NumCachedPaths, g_NumFreed Paths);
80 #endif 80 #endif
81 } 81 }
82 82
83 //////////////////////////////////////////////////////////////////////////////// 83 ////////////////////////////////////////////////////////////////////////////////
84 bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c onst { 84 bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c onst {
85 85
86 // TODO: Support inverse fill 86 // TODO: Support inverse fill
87 // TODO: Support strokes 87 // TODO: Support strokes
88 if (!args.fShaderCaps->shaderDerivativeSupport() || !args.fAntiAlias || 88 if (!args.fShaderCaps->shaderDerivativeSupport() || !args.fAntiAlias ||
89 args.fPath->isInverseFillType() || args.fPath->isVolatile() || 89 args.fPath->isInverseFillType() || args.fPath->isVolatile() ||
90 !args.fStroke->isFillStyle()) { 90 !args.fStroke->isFillStyle()) {
91 return false; 91 return false;
92 } 92 }
93 93
94 // currently don't support perspective 94 // currently don't support perspective
95 if (args.fViewMatrix->hasPerspective()) { 95 if (args.fViewMatrix->hasPerspective()) {
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 geometry.fPath = GrTest::TestPath(random); 617 geometry.fPath = GrTest::TestPath(random);
618 geometry.fAntiAlias = random->nextBool(); 618 geometry.fAntiAlias = random->nextBool();
619 619
620 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, 620 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
621 gTestStruct.fAtlas, 621 gTestStruct.fAtlas,
622 &gTestStruct.fPathCache, 622 &gTestStruct.fPathCache,
623 &gTestStruct.fPathList); 623 &gTestStruct.fPathList);
624 } 624 }
625 625
626 #endif 626 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698