OLD | NEW |
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 |
11 #include "GrClip.h" | 11 #include "GrClip.h" |
12 #include "GrColor.h" | 12 #include "GrColor.h" |
13 #include "GrPaint.h" | 13 #include "GrPaint.h" |
14 #include "GrPathRendererChain.h" | 14 #include "GrPathRendererChain.h" |
15 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
16 #include "GrTextureProvider.h" | 16 #include "GrTextureProvider.h" |
17 #include "SkMatrix.h" | 17 #include "SkMatrix.h" |
18 #include "SkPathEffect.h" | 18 #include "SkPathEffect.h" |
19 #include "SkTypes.h" | 19 #include "SkTypes.h" |
20 | 20 |
21 class GrAARectRenderer; | 21 class GrAARectRenderer; |
22 class GrBatchFontCache; | 22 class GrBatchFontCache; |
23 class GrCaps; | |
24 struct GrContextOptions; | 23 struct GrContextOptions; |
25 class GrDrawContext; | 24 class GrDrawContext; |
26 class GrDrawTarget; | 25 class GrDrawTarget; |
27 class GrFragmentProcessor; | 26 class GrFragmentProcessor; |
28 class GrGpu; | 27 class GrGpu; |
29 class GrGpuTraceMarker; | 28 class GrGpuTraceMarker; |
30 class GrIndexBuffer; | 29 class GrIndexBuffer; |
31 class GrLayerCache; | 30 class GrLayerCache; |
32 class GrOvalRenderer; | 31 class GrOvalRenderer; |
33 class GrPath; | 32 class GrPath; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 */ | 148 */ |
150 void freeGpuResources(); | 149 void freeGpuResources(); |
151 | 150 |
152 /** | 151 /** |
153 * Purge all the unlocked resources from the cache. | 152 * Purge all the unlocked resources from the cache. |
154 * This entry point is mainly meant for timing texture uploads | 153 * This entry point is mainly meant for timing texture uploads |
155 * and is not defined in normal builds of Skia. | 154 * and is not defined in normal builds of Skia. |
156 */ | 155 */ |
157 void purgeAllUnlockedResources(); | 156 void purgeAllUnlockedResources(); |
158 | 157 |
159 /** Access the context capabilities */ | 158 ////////////////////////////////////////////////////////////////////////// |
160 const GrCaps* caps() const { return fCaps; } | 159 /// Texture and Render Target Queries |
| 160 |
| 161 /** |
| 162 * Are shader derivatives supported? |
| 163 */ |
| 164 bool shaderDerivativeSupport() const; |
| 165 |
| 166 /** |
| 167 * Can the provided configuration act as a texture? |
| 168 */ |
| 169 bool isConfigTexturable(GrPixelConfig) const; |
| 170 |
| 171 /** |
| 172 * Can non-power-of-two textures be used with tile modes other than clamp? |
| 173 */ |
| 174 bool npotTextureTileSupport() const; |
| 175 |
| 176 /** |
| 177 * Return the max width or height of a texture supported by the current GPU
. |
| 178 */ |
| 179 int getMaxTextureSize() const; |
| 180 |
| 181 /** |
| 182 * Can the provided configuration act as a color render target? |
| 183 */ |
| 184 bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const; |
| 185 |
| 186 /** |
| 187 * Return the max width or height of a render target supported by the |
| 188 * current GPU. |
| 189 */ |
| 190 int getMaxRenderTargetSize() const; |
| 191 |
| 192 /** |
| 193 * Returns the max sample count for a render target. It will be 0 if MSAA |
| 194 * is not supported. |
| 195 */ |
| 196 int getMaxSampleCount() const; |
161 | 197 |
162 /** | 198 /** |
163 * Returns the recommended sample count for a render target when using this | 199 * Returns the recommended sample count for a render target when using this |
164 * context. | 200 * context. |
165 * | 201 * |
166 * @param config the configuration of the render target. | 202 * @param config the configuration of the render target. |
167 * @param dpi the display density in dots per inch. | 203 * @param dpi the display density in dots per inch. |
168 * | 204 * |
169 * @return sample count that should be perform well and have good enough | 205 * @return sample count that should be perform well and have good enough |
170 * rendering quality for the display. Alternatively returns 0 if | 206 * rendering quality for the display. Alternatively returns 0 if |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ | 385 /** Prints cache stats to the string if GR_CACHE_STATS == 1. */ |
350 void dumpCacheStats(SkString*) const; | 386 void dumpCacheStats(SkString*) const; |
351 void printCacheStats() const; | 387 void printCacheStats() const; |
352 | 388 |
353 /** Prints GPU stats to the string if GR_GPU_STATS == 1. */ | 389 /** Prints GPU stats to the string if GR_GPU_STATS == 1. */ |
354 void dumpGpuStats(SkString*) const; | 390 void dumpGpuStats(SkString*) const; |
355 void printGpuStats() const; | 391 void printGpuStats() const; |
356 | 392 |
357 private: | 393 private: |
358 GrGpu* fGpu; | 394 GrGpu* fGpu; |
359 const GrCaps* fCaps; | |
360 GrResourceCache* fResourceCache; | 395 GrResourceCache* fResourceCache; |
361 // this union exists because the inheritance of GrTextureProvider->GrResourc
eProvider | 396 // this union exists because the inheritance of GrTextureProvider->GrResourc
eProvider |
362 // is in a private header. | 397 // is in a private header. |
363 union { | 398 union { |
364 GrResourceProvider* fResourceProvider; | 399 GrResourceProvider* fResourceProvider; |
365 GrTextureProvider* fTextureProvider; | 400 GrTextureProvider* fTextureProvider; |
366 }; | 401 }; |
367 | 402 |
368 GrBatchFontCache* fBatchFontCache; | 403 GrBatchFontCache* fBatchFontCache; |
369 SkAutoTDelete<GrLayerCache> fLayerCache; | 404 SkAutoTDelete<GrLayerCache> fLayerCache; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 */ | 496 */ |
462 static void TextBlobCacheOverBudgetCB(void* data); | 497 static void TextBlobCacheOverBudgetCB(void* data); |
463 | 498 |
464 // TODO see note on createTextContext | 499 // TODO see note on createTextContext |
465 friend class SkGpuDevice; | 500 friend class SkGpuDevice; |
466 | 501 |
467 typedef SkRefCnt INHERITED; | 502 typedef SkRefCnt INHERITED; |
468 }; | 503 }; |
469 | 504 |
470 #endif | 505 #endif |
OLD | NEW |