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

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

Issue 1126613003: Revert of Move instanced index buffer creation to flush time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrDashLinePathRenderer.cpp » ('j') | 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 #include "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return true; 118 return true;
119 } 119 }
120 120
121 void GrContext::initCommon() { 121 void GrContext::initCommon() {
122 fResourceCache = SkNEW(GrResourceCache); 122 fResourceCache = SkNEW(GrResourceCache);
123 fResourceCache->setOverBudgetCallback(OverBudgetCB, this); 123 fResourceCache->setOverBudgetCallback(OverBudgetCB, this);
124 fResourceProvider = SkNEW_ARGS(GrResourceProvider, (fGpu, fResourceCache)); 124 fResourceProvider = SkNEW_ARGS(GrResourceProvider, (fGpu, fResourceCache));
125 125
126 fLayerCache.reset(SkNEW_ARGS(GrLayerCache, (this))); 126 fLayerCache.reset(SkNEW_ARGS(GrLayerCache, (this)));
127 127
128 fAARectRenderer = SkNEW(GrAARectRenderer); 128 fAARectRenderer = SkNEW_ARGS(GrAARectRenderer, (fGpu));
129 fOvalRenderer = SkNEW(GrOvalRenderer); 129 fOvalRenderer = SkNEW_ARGS(GrOvalRenderer, (fGpu));
130 130
131 fDidTestPMConversions = false; 131 fDidTestPMConversions = false;
132 132
133 this->setupDrawBuffer(); 133 this->setupDrawBuffer();
134 134
135 // GrBatchFontCache will eventually replace GrFontCache 135 // GrBatchFontCache will eventually replace GrFontCache
136 fBatchFontCache = SkNEW_ARGS(GrBatchFontCache, (this)); 136 fBatchFontCache = SkNEW_ARGS(GrBatchFontCache, (this));
137 137
138 fTextBlobCache.reset(SkNEW_ARGS(GrTextBlobCache, (TextBlobCacheOverBudgetCB, this))); 138 fTextBlobCache.reset(SkNEW_ARGS(GrTextBlobCache, (TextBlobCacheOverBudgetCB, this)));
139 } 139 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 delete fDrawBuffer; 180 delete fDrawBuffer;
181 fDrawBuffer = NULL; 181 fDrawBuffer = NULL;
182 182
183 delete fDrawBufferVBAllocPool; 183 delete fDrawBufferVBAllocPool;
184 fDrawBufferVBAllocPool = NULL; 184 fDrawBufferVBAllocPool = NULL;
185 185
186 delete fDrawBufferIBAllocPool; 186 delete fDrawBufferIBAllocPool;
187 fDrawBufferIBAllocPool = NULL; 187 fDrawBufferIBAllocPool = NULL;
188 188
189 fAARectRenderer->reset();
190 fOvalRenderer->reset();
191
189 fBatchFontCache->freeAll(); 192 fBatchFontCache->freeAll();
190 fLayerCache->freeAll(); 193 fLayerCache->freeAll();
191 fTextBlobCache->freeAll(); 194 fTextBlobCache->freeAll();
192 } 195 }
193 196
194 void GrContext::resetContext(uint32_t state) { 197 void GrContext::resetContext(uint32_t state) {
195 fGpu->markContextDirty(state); 198 fGpu->markContextDirty(state);
196 } 199 }
197 200
198 void GrContext::freeGpuResources() { 201 void GrContext::freeGpuResources() {
199 this->flush(); 202 this->flush();
200 203
201 if (fDrawBuffer) { 204 if (fDrawBuffer) {
202 fDrawBuffer->purgeResources(); 205 fDrawBuffer->purgeResources();
203 } 206 }
204 207
208 fAARectRenderer->reset();
209 fOvalRenderer->reset();
210
205 fBatchFontCache->freeAll(); 211 fBatchFontCache->freeAll();
206 fLayerCache->freeAll(); 212 fLayerCache->freeAll();
207 // a path renderer may be holding onto resources 213 // a path renderer may be holding onto resources
208 SkSafeSetNull(fPathRendererChain); 214 SkSafeSetNull(fPathRendererChain);
209 SkSafeSetNull(fSoftwarePathRenderer); 215 SkSafeSetNull(fSoftwarePathRenderer);
210 216
211 fResourceCache->purgeAllUnlocked(); 217 fResourceCache->purgeAllUnlocked();
212 } 218 }
213 219
214 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const { 220 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const {
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 1833
1828 fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (this, 1834 fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (this,
1829 fDrawBufferVBAllocPool, 1835 fDrawBufferVBAllocPool,
1830 fDrawBufferIBAllocPool)); 1836 fDrawBufferIBAllocPool));
1831 } 1837 }
1832 1838
1833 GrDrawTarget* GrContext::getTextTarget() { 1839 GrDrawTarget* GrContext::getTextTarget() {
1834 return this->prepareToDraw(); 1840 return this->prepareToDraw();
1835 } 1841 }
1836 1842
1843 const GrIndexBuffer* GrContext::getQuadIndexBuffer() const {
1844 return fGpu->getQuadIndexBuffer();
1845 }
1846
1837 namespace { 1847 namespace {
1838 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { 1848 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) {
1839 GrConfigConversionEffect::PMConversion pmToUPM; 1849 GrConfigConversionEffect::PMConversion pmToUPM;
1840 GrConfigConversionEffect::PMConversion upmToPM; 1850 GrConfigConversionEffect::PMConversion upmToPM;
1841 GrConfigConversionEffect::TestForPreservingPMConversions(ctx, &pmToUPM, &upm ToPM); 1851 GrConfigConversionEffect::TestForPreservingPMConversions(ctx, &pmToUPM, &upm ToPM);
1842 *pmToUPMValue = pmToUPM; 1852 *pmToUPMValue = pmToUPM;
1843 *upmToPMValue = upmToPM; 1853 *upmToPMValue = upmToPM;
1844 } 1854 }
1845 } 1855 }
1846 1856
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 fDrawBuffer->addGpuTraceMarker(marker); 1909 fDrawBuffer->addGpuTraceMarker(marker);
1900 } 1910 }
1901 } 1911 }
1902 1912
1903 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 1913 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
1904 fGpu->removeGpuTraceMarker(marker); 1914 fGpu->removeGpuTraceMarker(marker);
1905 if (fDrawBuffer) { 1915 if (fDrawBuffer) {
1906 fDrawBuffer->removeGpuTraceMarker(marker); 1916 fDrawBuffer->removeGpuTraceMarker(marker);
1907 } 1917 }
1908 } 1918 }
OLDNEW
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrDashLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698