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

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

Issue 1116943004: Move instanced index buffer creation to flush time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix missing assignment of keys to index buffers 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_ARGS(GrAARectRenderer, (fGpu)); 128 fAARectRenderer = SkNEW(GrAARectRenderer);
129 fOvalRenderer = SkNEW_ARGS(GrOvalRenderer, (fGpu)); 129 fOvalRenderer = SkNEW(GrOvalRenderer);
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
192 fBatchFontCache->freeAll(); 189 fBatchFontCache->freeAll();
193 fLayerCache->freeAll(); 190 fLayerCache->freeAll();
194 fTextBlobCache->freeAll(); 191 fTextBlobCache->freeAll();
195 } 192 }
196 193
197 void GrContext::resetContext(uint32_t state) { 194 void GrContext::resetContext(uint32_t state) {
198 fGpu->markContextDirty(state); 195 fGpu->markContextDirty(state);
199 } 196 }
200 197
201 void GrContext::freeGpuResources() { 198 void GrContext::freeGpuResources() {
202 this->flush(); 199 this->flush();
203 200
204 if (fDrawBuffer) { 201 if (fDrawBuffer) {
205 fDrawBuffer->purgeResources(); 202 fDrawBuffer->purgeResources();
206 } 203 }
207 204
208 fAARectRenderer->reset();
209 fOvalRenderer->reset();
210
211 fBatchFontCache->freeAll(); 205 fBatchFontCache->freeAll();
212 fLayerCache->freeAll(); 206 fLayerCache->freeAll();
213 // a path renderer may be holding onto resources 207 // a path renderer may be holding onto resources
214 SkSafeSetNull(fPathRendererChain); 208 SkSafeSetNull(fPathRendererChain);
215 SkSafeSetNull(fSoftwarePathRenderer); 209 SkSafeSetNull(fSoftwarePathRenderer);
216 210
217 fResourceCache->purgeAllUnlocked(); 211 fResourceCache->purgeAllUnlocked();
218 } 212 }
219 213
220 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const { 214 void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const {
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 1827
1834 fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (this, 1828 fDrawBuffer = SkNEW_ARGS(GrInOrderDrawBuffer, (this,
1835 fDrawBufferVBAllocPool, 1829 fDrawBufferVBAllocPool,
1836 fDrawBufferIBAllocPool)); 1830 fDrawBufferIBAllocPool));
1837 } 1831 }
1838 1832
1839 GrDrawTarget* GrContext::getTextTarget() { 1833 GrDrawTarget* GrContext::getTextTarget() {
1840 return this->prepareToDraw(); 1834 return this->prepareToDraw();
1841 } 1835 }
1842 1836
1843 const GrIndexBuffer* GrContext::getQuadIndexBuffer() const {
1844 return fGpu->getQuadIndexBuffer();
1845 }
1846
1847 namespace { 1837 namespace {
1848 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) { 1838 void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) {
1849 GrConfigConversionEffect::PMConversion pmToUPM; 1839 GrConfigConversionEffect::PMConversion pmToUPM;
1850 GrConfigConversionEffect::PMConversion upmToPM; 1840 GrConfigConversionEffect::PMConversion upmToPM;
1851 GrConfigConversionEffect::TestForPreservingPMConversions(ctx, &pmToUPM, &upm ToPM); 1841 GrConfigConversionEffect::TestForPreservingPMConversions(ctx, &pmToUPM, &upm ToPM);
1852 *pmToUPMValue = pmToUPM; 1842 *pmToUPMValue = pmToUPM;
1853 *upmToPMValue = upmToPM; 1843 *upmToPMValue = upmToPM;
1854 } 1844 }
1855 } 1845 }
1856 1846
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 fDrawBuffer->addGpuTraceMarker(marker); 1899 fDrawBuffer->addGpuTraceMarker(marker);
1910 } 1900 }
1911 } 1901 }
1912 1902
1913 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 1903 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
1914 fGpu->removeGpuTraceMarker(marker); 1904 fGpu->removeGpuTraceMarker(marker);
1915 if (fDrawBuffer) { 1905 if (fDrawBuffer) {
1916 fDrawBuffer->removeGpuTraceMarker(marker); 1906 fDrawBuffer->removeGpuTraceMarker(marker);
1917 } 1907 }
1918 } 1908 }
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