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

Side by Side Diff: include/gpu/GrContext.h

Issue 864383003: Remove createUncachedTexture function, attempt to recycle scratch in createTexture. (Closed) Base URL: https://skia.googlesource.com/skia.git@continue
Patch Set: Comments, fixes Created 5 years, 10 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 | « gm/texdata.cpp ('k') | src/effects/SkBlurMaskFilter.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 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrContext_DEFINED 8 #ifndef GrContext_DEFINED
9 #define GrContext_DEFINED 9 #define GrContext_DEFINED
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 bool enableDistanceFieldFonts); 211 bool enableDistanceFieldFonts);
212 212
213 /////////////////////////////////////////////////////////////////////////// 213 ///////////////////////////////////////////////////////////////////////////
214 // Textures 214 // Textures
215 215
216 /** 216 /**
217 * Creates a new texture in the resource cache and returns it. The caller ow ns a 217 * Creates a new texture in the resource cache and returns it. The caller ow ns a
218 * ref on the returned texture which must be balanced by a call to unref. 218 * ref on the returned texture which must be balanced by a call to unref.
219 * 219 *
220 * @param desc Description of the texture properties. 220 * @param desc Description of the texture properties.
221 * @param srcData Pointer to the pixel values. 221 * @param budgeted Does the texture count against the resource cache budget ?
222 * @param srcData Pointer to the pixel values (optional).
222 * @param rowBytes The number of bytes between rows of the texture. Zero 223 * @param rowBytes The number of bytes between rows of the texture. Zero
223 * implies tightly packed rows. For compressed pixel config s, this 224 * implies tightly packed rows. For compressed pixel config s, this
224 * field is ignored. 225 * field is ignored.
225 */ 226 */
226 GrTexture* createTexture(const GrSurfaceDesc& desc, const void* srcData, siz e_t rowBytes); 227 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi d* srcData,
228 size_t rowBytes);
227 229
228 GrTexture* createTexture(const GrSurfaceDesc& desc) { 230 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) {
229 return this->createTexture(desc, NULL, 0); 231 return this->createTexture(desc, budgeted, NULL, 0);
230 } 232 }
231 233
232 /** 234 /**
233 * Creates a texture that is outside the cache. Does not count against 235 * DEPRECATED: use createTexture().
234 * cache's budget.
235 *
236 * TODO: Add a budgeted param to createTexture and remove this function.
237 */ 236 */
238 GrTexture* createUncachedTexture(const GrSurfaceDesc& desc, void* srcData, s ize_t rowBytes); 237 GrTexture* createUncachedTexture(const GrSurfaceDesc& desc, void* srcData, s ize_t rowBytes) {
238 return this->createTexture(desc, false, srcData, rowBytes);
239 }
239 240
240 /** 241 /**
241 * Enum that determines how closely a returned scratch texture must match 242 * Enum that determines how closely a returned scratch texture must match
242 * a provided GrSurfaceDesc. 243 * a provided GrSurfaceDesc. TODO: Remove this. createTexture() should be us ed
244 * for exact match and refScratchTexture() should be replaced with createApp roxTexture().
243 */ 245 */
244 enum ScratchTexMatch { 246 enum ScratchTexMatch {
245 /** 247 /**
246 * Finds a texture that exactly matches the descriptor. 248 * Finds a texture that exactly matches the descriptor.
247 */ 249 */
248 kExact_ScratchTexMatch, 250 kExact_ScratchTexMatch,
249 /** 251 /**
250 * Finds a texture that approximately matches the descriptor. Will be 252 * Finds a texture that approximately matches the descriptor. Will be
251 * at least as large in width and height as desc specifies. If desc 253 * at least as large in width and height as desc specifies. If desc
252 * specifies that texture is a render target then result will be a 254 * specifies that texture is a render target then result will be a
253 * render target. If desc specifies a render target and doesn't set the 255 * render target. If desc specifies a render target and doesn't set the
254 * no stencil flag then result will have a stencil. Format and aa level 256 * no stencil flag then result will have a stencil. Format and aa level
255 * will always match. 257 * will always match.
256 */ 258 */
257 kApprox_ScratchTexMatch 259 kApprox_ScratchTexMatch
258 }; 260 };
259 261
260 /** 262 /**
261 * Returns a texture matching the desc. It's contents are unknown. The calle r 263 * Returns a texture matching the desc. It's contents are unknown. The calle r
262 * owns a ref on the returned texture and must balance with a call to unref. 264 * owns a ref on the returned texture and must balance with a call to unref.
263 * It is guaranteed that the same texture will not be returned in subsequent 265 * It is guaranteed that the same texture will not be returned in subsequent
264 * calls until all refs to the texture are dropped. 266 * calls until all refs to the texture are dropped.
265 * 267 *
266 * Textures created by createTexture() hide the complications of 268 * Textures created by createTexture() hide the complications of
267 * tiling non-power-of-two textures on APIs that don't support this (e.g. 269 * tiling non-power-of-two textures on APIs that don't support this (e.g.
268 * unextended GLES2). NPOT scratch textures are not tilable on such APIs. 270 * unextended GLES2). NPOT scratch textures are not tilable on such APIs.
269 * 271 *
270 * internalFlag is a temporary workaround until changes in the internal 272 * internalFlag is a temporary workaround until changes in the internal
271 * architecture are complete. Use the default value. 273 * architecture are complete. Use the default value.
274 *
275 * TODO: Once internal flag can be removed, this should be replaced with
276 * createApproxTexture() and exact textures should be created with
277 * createTexture().
272 */ 278 */
273 GrTexture* refScratchTexture(const GrSurfaceDesc&, ScratchTexMatch match, 279 GrTexture* refScratchTexture(const GrSurfaceDesc&, ScratchTexMatch match,
274 bool internalFlag = false); 280 bool internalFlag = false);
275 281
276 /** 282 /**
277 * Can the provided configuration act as a texture? 283 * Can the provided configuration act as a texture?
278 */ 284 */
279 bool isConfigTexturable(GrPixelConfig) const; 285 bool isConfigTexturable(GrPixelConfig) const;
280 286
281 /** 287 /**
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, const GrPaint* paint, const AutoCheckFlush*); 836 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, const GrPaint* paint, const AutoCheckFlush*);
831 837
832 void internalDrawPath(GrDrawTarget*, 838 void internalDrawPath(GrDrawTarget*,
833 GrPipelineBuilder*, 839 GrPipelineBuilder*,
834 const SkMatrix& viewMatrix, 840 const SkMatrix& viewMatrix,
835 GrColor, 841 GrColor,
836 bool useAA, 842 bool useAA,
837 const SkPath&, 843 const SkPath&,
838 const GrStrokeInfo&); 844 const GrStrokeInfo&);
839 845
840 // TODO: Move this out of GrContext. 846 GrTexture* internalRefScratchTexture(const GrSurfaceDesc&, uint32_t flags);
841 GrTexture* createResizedTexture(const GrSurfaceDesc&,
842 const GrContentKey& origKey,
843 const void* srcData,
844 size_t rowBytes,
845 bool filter);
846 847
847 /** 848 /**
848 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair 849 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair
849 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O therwise, they 850 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O therwise, they
850 * return NULL. 851 * return NULL.
851 */ 852 */
852 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); 853 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&);
853 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); 854 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&);
854 855
855 /** 856 /**
856 * This callback allows the resource cache to callback into the GrContext 857 * This callback allows the resource cache to callback into the GrContext
857 * when the cache is still over budget after a purge. 858 * when the cache is still over budget after a purge.
858 */ 859 */
859 static void OverBudgetCB(void* data); 860 static void OverBudgetCB(void* data);
860 861
861 typedef SkRefCnt INHERITED; 862 typedef SkRefCnt INHERITED;
862 }; 863 };
863 864
864 #endif 865 #endif
OLDNEW
« no previous file with comments | « gm/texdata.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698