OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 // debugging simpler. | 39 // debugging simpler. |
40 SK_CONF_DECLARE(bool, c_Defer, "gpu.deferContext", true, | 40 SK_CONF_DECLARE(bool, c_Defer, "gpu.deferContext", true, |
41 "Defers rendering in GrContext via GrInOrderDrawBuffer."); | 41 "Defers rendering in GrContext via GrInOrderDrawBuffer."); |
42 | 42 |
43 #define BUFFERED_DRAW (c_Defer ? kYes_BufferedDraw : kNo_BufferedDraw) | 43 #define BUFFERED_DRAW (c_Defer ? kYes_BufferedDraw : kNo_BufferedDraw) |
44 | 44 |
45 // When we're using coverage AA but the blend is incompatible (given gpu | 45 // When we're using coverage AA but the blend is incompatible (given gpu |
46 // limitations) should we disable AA or draw wrong? | 46 // limitations) should we disable AA or draw wrong? |
47 #define DISABLE_COVERAGE_AA_FOR_BLEND 1 | 47 #define DISABLE_COVERAGE_AA_FOR_BLEND 1 |
48 | 48 |
49 #if GR_DEBUG | 49 #ifdef SK_DEBUG |
50 // change this to a 1 to see notifications when partial coverage fails | 50 // change this to a 1 to see notifications when partial coverage fails |
51 #define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0 | 51 #define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0 |
52 #else | 52 #else |
53 #define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0 | 53 #define GR_DEBUG_PARTIAL_COVERAGE_CHECK 0 |
54 #endif | 54 #endif |
55 | 55 |
56 static const size_t MAX_TEXTURE_CACHE_COUNT = 2048; | 56 static const size_t MAX_TEXTURE_CACHE_COUNT = 2048; |
57 static const size_t MAX_TEXTURE_CACHE_BYTES = GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT
* 1024 * 1024; | 57 static const size_t MAX_TEXTURE_CACHE_BYTES = GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT
* 1024 * 1024; |
58 | 58 |
59 static const size_t DRAW_BUFFER_VBPOOL_BUFFER_SIZE = 1 << 15; | 59 static const size_t DRAW_BUFFER_VBPOOL_BUFFER_SIZE = 1 << 15; |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 // we check if the rect will be axis-aligned, and the rect won't land on | 688 // we check if the rect will be axis-aligned, and the rect won't land on |
689 // integer coords. | 689 // integer coords. |
690 | 690 |
691 // we are keeping around the "tweak the alpha" trick because | 691 // we are keeping around the "tweak the alpha" trick because |
692 // it is our only hope for the fixed-pipe implementation. | 692 // it is our only hope for the fixed-pipe implementation. |
693 // In a shader implementation we can give a separate coverage input | 693 // In a shader implementation we can give a separate coverage input |
694 // TODO: remove this ugliness when we drop the fixed-pipe impl | 694 // TODO: remove this ugliness when we drop the fixed-pipe impl |
695 *useVertexCoverage = false; | 695 *useVertexCoverage = false; |
696 if (!target->getDrawState().canTweakAlphaForCoverage()) { | 696 if (!target->getDrawState().canTweakAlphaForCoverage()) { |
697 if (disable_coverage_aa_for_blend(target)) { | 697 if (disable_coverage_aa_for_blend(target)) { |
698 #if GR_DEBUG | 698 #ifdef SK_DEBUG |
699 //GrPrintf("Turning off AA to correctly apply blend.\n"); | 699 //GrPrintf("Turning off AA to correctly apply blend.\n"); |
700 #endif | 700 #endif |
701 return false; | 701 return false; |
702 } else { | 702 } else { |
703 *useVertexCoverage = true; | 703 *useVertexCoverage = true; |
704 } | 704 } |
705 } | 705 } |
706 const GrDrawState& drawState = target->getDrawState(); | 706 const GrDrawState& drawState = target->getDrawState(); |
707 if (drawState.getRenderTarget()->isMultisampled()) { | 707 if (drawState.getRenderTarget()->isMultisampled()) { |
708 return false; | 708 return false; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 | 1115 |
1116 void GrContext::internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath&
path, | 1116 void GrContext::internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath&
path, |
1117 const SkStrokeRec& stroke) { | 1117 const SkStrokeRec& stroke) { |
1118 SkASSERT(!path.isEmpty()); | 1118 SkASSERT(!path.isEmpty()); |
1119 | 1119 |
1120 // An Assumption here is that path renderer would use some form of tweaking | 1120 // An Assumption here is that path renderer would use some form of tweaking |
1121 // the src color (either the input alpha or in the frag shader) to implement | 1121 // the src color (either the input alpha or in the frag shader) to implement |
1122 // aa. If we have some future driver-mojo path AA that can do the right | 1122 // aa. If we have some future driver-mojo path AA that can do the right |
1123 // thing WRT to the blend then we'll need some query on the PR. | 1123 // thing WRT to the blend then we'll need some query on the PR. |
1124 if (disable_coverage_aa_for_blend(target)) { | 1124 if (disable_coverage_aa_for_blend(target)) { |
1125 #if GR_DEBUG | 1125 #ifdef SK_DEBUG |
1126 //GrPrintf("Turning off AA to correctly apply blend.\n"); | 1126 //GrPrintf("Turning off AA to correctly apply blend.\n"); |
1127 #endif | 1127 #endif |
1128 useAA = false; | 1128 useAA = false; |
1129 } | 1129 } |
1130 | 1130 |
1131 GrPathRendererChain::DrawType type = useAA ? GrPathRendererChain::kColorAnti
Alias_DrawType : | 1131 GrPathRendererChain::DrawType type = useAA ? GrPathRendererChain::kColorAnti
Alias_DrawType : |
1132 GrPathRendererChain::kColor_Dra
wType; | 1132 GrPathRendererChain::kColor_Dra
wType; |
1133 | 1133 |
1134 const SkPath* pathPtr = &path; | 1134 const SkPath* pathPtr = &path; |
1135 SkPath tmpPath; | 1135 SkPath tmpPath; |
(...skipping 12 matching lines...) Expand all Loading... |
1148 } | 1148 } |
1149 if (pathPtr->isEmpty()) { | 1149 if (pathPtr->isEmpty()) { |
1150 return; | 1150 return; |
1151 } | 1151 } |
1152 | 1152 |
1153 // This time, allow SW renderer | 1153 // This time, allow SW renderer |
1154 pr = this->getPathRenderer(*pathPtr, strokeRec, target, true, type); | 1154 pr = this->getPathRenderer(*pathPtr, strokeRec, target, true, type); |
1155 } | 1155 } |
1156 | 1156 |
1157 if (NULL == pr) { | 1157 if (NULL == pr) { |
1158 #if GR_DEBUG | 1158 #ifdef SK_DEBUG |
1159 GrPrintf("Unable to find path renderer compatible with path.\n"); | 1159 GrPrintf("Unable to find path renderer compatible with path.\n"); |
1160 #endif | 1160 #endif |
1161 return; | 1161 return; |
1162 } | 1162 } |
1163 | 1163 |
1164 pr->drawPath(*pathPtr, strokeRec, target, useAA); | 1164 pr->drawPath(*pathPtr, strokeRec, target, useAA); |
1165 } | 1165 } |
1166 | 1166 |
1167 //////////////////////////////////////////////////////////////////////////////// | 1167 //////////////////////////////////////////////////////////////////////////////// |
1168 | 1168 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 return NULL; | 1742 return NULL; |
1743 } | 1743 } |
1744 } | 1744 } |
1745 | 1745 |
1746 /////////////////////////////////////////////////////////////////////////////// | 1746 /////////////////////////////////////////////////////////////////////////////// |
1747 #if GR_CACHE_STATS | 1747 #if GR_CACHE_STATS |
1748 void GrContext::printCacheStats() const { | 1748 void GrContext::printCacheStats() const { |
1749 fTextureCache->printStats(); | 1749 fTextureCache->printStats(); |
1750 } | 1750 } |
1751 #endif | 1751 #endif |
OLD | NEW |