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

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

Issue 188403003: Add API for GrContext to recommend rendertarget sample count (Closed) Base URL: https://skia.googlesource.com/skia.git@skpathobject
Patch Set: address review commetns Created 6 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
« 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 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 } 1696 }
1697 1697
1698 return pr; 1698 return pr;
1699 } 1699 }
1700 1700
1701 //////////////////////////////////////////////////////////////////////////////// 1701 ////////////////////////////////////////////////////////////////////////////////
1702 bool GrContext::isConfigRenderable(GrPixelConfig config, bool withMSAA) const { 1702 bool GrContext::isConfigRenderable(GrPixelConfig config, bool withMSAA) const {
1703 return fGpu->caps()->isConfigRenderable(config, withMSAA); 1703 return fGpu->caps()->isConfigRenderable(config, withMSAA);
1704 } 1704 }
1705 1705
1706 int GrContext::getRecommendedSampleCount(GrPixelConfig config,
1707 SkScalar dpi) const {
1708 if (!this->isConfigRenderable(config, true)) {
1709 return 0;
1710 }
1711 int chosenSampleCount = 0;
1712 if (fGpu->caps()->pathRenderingSupport()) {
1713 if (dpi >= 250.0f) {
1714 chosenSampleCount = 4;
1715 } else {
1716 chosenSampleCount = 16;
1717 }
1718 }
1719 return chosenSampleCount <= fGpu->caps()->maxSampleCount() ?
1720 chosenSampleCount : 0;
1721 }
1722
1706 void GrContext::setupDrawBuffer() { 1723 void GrContext::setupDrawBuffer() {
1707 SkASSERT(NULL == fDrawBuffer); 1724 SkASSERT(NULL == fDrawBuffer);
1708 SkASSERT(NULL == fDrawBufferVBAllocPool); 1725 SkASSERT(NULL == fDrawBufferVBAllocPool);
1709 SkASSERT(NULL == fDrawBufferIBAllocPool); 1726 SkASSERT(NULL == fDrawBufferIBAllocPool);
1710 1727
1711 fDrawBufferVBAllocPool = 1728 fDrawBufferVBAllocPool =
1712 SkNEW_ARGS(GrVertexBufferAllocPool, (fGpu, false, 1729 SkNEW_ARGS(GrVertexBufferAllocPool, (fGpu, false,
1713 DRAW_BUFFER_VBPOOL_BUFFER_SIZE, 1730 DRAW_BUFFER_VBPOOL_BUFFER_SIZE,
1714 DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS)); 1731 DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS));
1715 fDrawBufferIBAllocPool = 1732 fDrawBufferIBAllocPool =
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 } 1806 }
1790 return path; 1807 return path;
1791 } 1808 }
1792 1809
1793 /////////////////////////////////////////////////////////////////////////////// 1810 ///////////////////////////////////////////////////////////////////////////////
1794 #if GR_CACHE_STATS 1811 #if GR_CACHE_STATS
1795 void GrContext::printCacheStats() const { 1812 void GrContext::printCacheStats() const {
1796 fTextureCache->printStats(); 1813 fTextureCache->printStats();
1797 } 1814 }
1798 #endif 1815 #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