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(); | |
286 bool configToGLFormats(GrPixelConfig config, | 287 bool configToGLFormats(GrPixelConfig config, |
287 bool getSizedInternal, | 288 bool getSizedInternal, |
288 GrGLenum* internalFormat, | 289 GrGLenum* internalFormat, |
289 GrGLenum* externalFormat, | 290 GrGLenum* externalFormat, |
290 GrGLenum* externalType) const; | 291 GrGLenum* externalType) const; |
291 // helper for onCreateTexture and writeTexturePixels | 292 // helper for onCreateTexture and writeTexturePixels |
292 bool uploadTexData(const GrSurfaceDesc& desc, | 293 bool uploadTexData(const GrSurfaceDesc& desc, |
293 GrGLenum target, | 294 GrGLenum target, |
294 bool isNewTexture, | 295 bool isNewTexture, |
295 int left, int top, int width, int height, | 296 int left, int top, int width, int height, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
493 | 494 |
494 void invalidate() { | 495 void invalidate() { |
495 fEquation = static_cast<GrBlendEquation>(-1); | 496 fEquation = static_cast<GrBlendEquation>(-1); |
496 fSrcCoeff = static_cast<GrBlendCoeff>(-1); | 497 fSrcCoeff = static_cast<GrBlendCoeff>(-1); |
497 fDstCoeff = static_cast<GrBlendCoeff>(-1); | 498 fDstCoeff = static_cast<GrBlendCoeff>(-1); |
498 fConstColorValid = false; | 499 fConstColorValid = false; |
499 fEnabled = kUnknown_TriState; | 500 fEnabled = kUnknown_TriState; |
500 } | 501 } |
501 } fHWBlendState; | 502 } fHWBlendState; |
502 | 503 |
504 TriState fMSAAEnabled; | |
505 | |
506 GrStencilSettings fHWStencilSettings; | |
507 TriState fHWStencilTestEnabled; | |
508 | |
509 | |
510 GrPipelineBuilder::DrawFace fHWDrawFace; | |
511 TriState fHWWriteToColor; | |
512 uint32_t fHWBoundRenderTargetUniqueID; | |
513 TriState fHWSRGBFramebuffer; | |
514 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; | |
bsalomon
2015/12/16 19:10:45
just moved this stuff to be within the ///@} below
| |
515 ///@} | |
516 | |
503 /** IDs for copy surface program. */ | 517 /** IDs for copy surface program. */ |
504 struct { | 518 struct { |
505 GrGLuint fProgram; | 519 GrGLuint fProgram; |
506 GrGLint fTextureUniform; | 520 GrGLint fTextureUniform; |
507 GrGLint fTexCoordXformUniform; | 521 GrGLint fTexCoordXformUniform; |
508 GrGLint fPosXformUniform; | 522 GrGLint fPosXformUniform; |
509 } fCopyPrograms[2]; | 523 } fCopyPrograms[2]; |
510 GrGLuint fCopyProgramArrayBuffer; | 524 GrGLuint fCopyProgramArrayBuffer; |
511 | 525 |
512 struct { | 526 struct { |
513 GrGLuint fProgram; | 527 GrGLuint fProgram; |
514 GrGLint fColorUniform; | 528 GrGLint fColorUniform; |
515 GrGLint fRectUniform; | 529 GrGLint fRectUniform; |
516 } fWireRectProgram; | 530 } fWireRectProgram; |
517 GrGLuint fWireRectArrayBuffer; | 531 GrGLuint fWireRectArrayBuffer; |
518 | 532 |
519 static int TextureTargetToCopyProgramIdx(GrGLenum target) { | 533 static int TextureTargetToCopyProgramIdx(GrGLenum target) { |
520 if (target == GR_GL_TEXTURE_2D) { | 534 if (target == GR_GL_TEXTURE_2D) { |
521 return 0; | 535 return 0; |
522 } else { | 536 } else { |
523 SkASSERT(target == GR_GL_TEXTURE_EXTERNAL); | 537 SkASSERT(target == GR_GL_TEXTURE_EXTERNAL); |
524 return 1; | 538 return 1; |
525 } | 539 } |
526 } | 540 } |
527 | 541 |
528 TriState fMSAAEnabled; | 542 struct ConfigEntry { |
543 // Default constructor inits to known bad GL enum values. | |
544 ConfigEntry() { memset(this, 0xAB, sizeof(ConfigEntry)); } | |
545 GrGLenum fBaseInternalFormat; | |
546 GrGLenum fSizedInternalFormat; | |
547 GrGLenum fExternalFormat; | |
548 GrGLenum fExternalType; | |
549 }; | |
529 | 550 |
530 GrStencilSettings fHWStencilSettings; | 551 ConfigEntry fConfigTable[kLast_GrPixelConfig + 1]; |
egdaniel
2015/12/16 19:19:08
Why not have this configTable live on the caps ins
bsalomon
2015/12/16 19:21:20
Yes, as noted in description, this is the first st
| |
531 TriState fHWStencilTestEnabled; | |
532 | |
533 | |
534 GrPipelineBuilder::DrawFace fHWDrawFace; | |
535 TriState fHWWriteToColor; | |
536 uint32_t fHWBoundRenderTargetUniqueID; | |
537 TriState fHWSRGBFramebuffer; | |
538 SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs; | |
539 | |
540 ///@} | |
541 | 552 |
542 // Mapping of pixel configs to known supported stencil formats to be used | 553 // Mapping of pixel configs to known supported stencil formats to be used |
543 // when adding a stencil buffer to a framebuffer. | 554 // when adding a stencil buffer to a framebuffer. |
544 int fPixelConfigToStencilIndex[kGrPixelConfigCnt]; | 555 int fPixelConfigToStencilIndex[kGrPixelConfigCnt]; |
545 | 556 |
546 typedef GrGpu INHERITED; | 557 typedef GrGpu INHERITED; |
547 friend class GrGLPathRendering; // For accessing setTextureUnit. | 558 friend class GrGLPathRendering; // For accessing setTextureUnit. |
548 }; | 559 }; |
549 | 560 |
550 #endif | 561 #endif |
OLD | NEW |