| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGLGpu_DEFINED | 8 #ifndef GrGLGpu_DEFINED |
| 9 #define GrGLGpu_DEFINED | 9 #define GrGLGpu_DEFINED |
| 10 | 10 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // ensures that such operations don't negatively interact with tracking boun
d textures. | 276 // ensures that such operations don't negatively interact with tracking boun
d textures. |
| 277 void setScratchTextureUnit(); | 277 void setScratchTextureUnit(); |
| 278 | 278 |
| 279 // bounds is region that may be modified and therefore has to be resolved. | 279 // bounds is region that may be modified and therefore has to be resolved. |
| 280 // nullptr means whole target. Can be an empty rect. | 280 // nullptr means whole target. Can be an empty rect. |
| 281 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); | 281 void flushRenderTarget(GrGLRenderTarget*, const SkIRect* bounds); |
| 282 | 282 |
| 283 void flushStencil(const GrStencilSettings&); | 283 void flushStencil(const GrStencilSettings&); |
| 284 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); | 284 void flushHWAAState(GrRenderTarget* rt, bool useHWAA); |
| 285 | 285 |
| 286 void generateConfigTable(); | |
| 287 | |
| 288 // helper for onCreateTexture and writeTexturePixels | 286 // helper for onCreateTexture and writeTexturePixels |
| 289 bool uploadTexData(const GrSurfaceDesc& desc, | 287 bool uploadTexData(const GrSurfaceDesc& desc, |
| 290 GrGLenum target, | 288 GrGLenum target, |
| 291 bool isNewTexture, | 289 bool isNewTexture, |
| 292 int left, int top, int width, int height, | 290 int left, int top, int width, int height, |
| 293 GrPixelConfig dataConfig, | 291 GrPixelConfig dataConfig, |
| 294 const void* data, | 292 const void* data, |
| 295 size_t rowBytes); | 293 size_t rowBytes); |
| 296 | 294 |
| 297 // helper for onCreateCompressedTexture. If width and height are | 295 // helper for onCreateCompressedTexture. If width and height are |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 526 |
| 529 static int TextureTargetToCopyProgramIdx(GrGLenum target) { | 527 static int TextureTargetToCopyProgramIdx(GrGLenum target) { |
| 530 if (target == GR_GL_TEXTURE_2D) { | 528 if (target == GR_GL_TEXTURE_2D) { |
| 531 return 0; | 529 return 0; |
| 532 } else { | 530 } else { |
| 533 SkASSERT(target == GR_GL_TEXTURE_EXTERNAL); | 531 SkASSERT(target == GR_GL_TEXTURE_EXTERNAL); |
| 534 return 1; | 532 return 1; |
| 535 } | 533 } |
| 536 } | 534 } |
| 537 | 535 |
| 538 struct ConfigEntry { | |
| 539 // Default constructor inits to known bad GL enum values. | |
| 540 ConfigEntry() { | |
| 541 memset(this, 0xAB, sizeof(ConfigEntry)); | |
| 542 fStencilFormatIndex = kUnknown_StencilIndex; | |
| 543 } | |
| 544 GrGLenum fBaseInternalFormat; | |
| 545 GrGLenum fSizedInternalFormat; | |
| 546 GrGLenum fExternalFormat; | |
| 547 GrGLenum fExternalType; | |
| 548 | |
| 549 // The <format> parameter to use for glTexImage and glTexSubImage. | |
| 550 // This is usually the same as fExternalFormat except for kSRGBA on some
GL contexts. | |
| 551 GrGLenum fExternalFormatForTexImage; | |
| 552 // Either the base or sized internal format depending on the GL and conf
ig. | |
| 553 GrGLenum fInternalFormatTexImage; | |
| 554 | |
| 555 // Index into GrGLCaps's list of stencil formats. Support is determined
experimentally and | |
| 556 // lazily. | |
| 557 int fStencilFormatIndex; | |
| 558 enum { | |
| 559 // This indicates that a stencil format has not yet been determined
for the config. | |
| 560 kUnknown_StencilIndex = -1, | |
| 561 // This indicates that there is no supported stencil format for the
config. | |
| 562 kUnsupported_StencilFormatIndex = -2 | |
| 563 }; | |
| 564 }; | |
| 565 | |
| 566 ConfigEntry fConfigTable[kGrPixelConfigCnt]; | |
| 567 | |
| 568 typedef GrGpu INHERITED; | 536 typedef GrGpu INHERITED; |
| 569 friend class GrGLPathRendering; // For accessing setTextureUnit. | 537 friend class GrGLPathRendering; // For accessing setTextureUnit. |
| 570 }; | 538 }; |
| 571 | 539 |
| 572 #endif | 540 #endif |
| OLD | NEW |