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 |
11 #include "GrGLContext.h" | 11 #include "GrGLContext.h" |
12 #include "GrGLIRect.h" | 12 #include "GrGLIRect.h" |
13 #include "GrGLPathRendering.h" | 13 #include "GrGLPathRendering.h" |
14 #include "GrGLProgram.h" | 14 #include "GrGLProgram.h" |
15 #include "GrGLRenderTarget.h" | 15 #include "GrGLRenderTarget.h" |
16 #include "GrGLStencilAttachment.h" | 16 #include "GrGLStencilAttachment.h" |
17 #include "GrGLTexture.h" | 17 #include "GrGLTexture.h" |
18 #include "GrGLVertexArray.h" | 18 #include "GrGLVertexArray.h" |
19 #include "GrGpu.h" | 19 #include "GrGpu.h" |
20 #include "GrTypes.h" | 20 #include "GrTypes.h" |
21 #include "GrWindowRectsState.h" | |
22 #include "GrXferProcessor.h" | 21 #include "GrXferProcessor.h" |
23 #include "SkTArray.h" | 22 #include "SkTArray.h" |
24 #include "SkTypes.h" | 23 #include "SkTypes.h" |
25 | 24 |
26 class GrGLBuffer; | 25 class GrGLBuffer; |
27 class GrPipeline; | 26 class GrPipeline; |
28 class GrNonInstancedMesh; | 27 class GrNonInstancedMesh; |
29 class GrSwizzle; | 28 class GrSwizzle; |
30 | 29 |
31 namespace gr_instanced { class GLInstancedRendering; } | 30 namespace gr_instanced { class GLInstancedRendering; } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 307 |
309 // flushes the scissor. see the note on flushBoundTextureAndParams about | 308 // flushes the scissor. see the note on flushBoundTextureAndParams about |
310 // flushing the scissor after that function is called. | 309 // flushing the scissor after that function is called. |
311 void flushScissor(const GrScissorState&, | 310 void flushScissor(const GrScissorState&, |
312 const GrGLIRect& rtViewport, | 311 const GrGLIRect& rtViewport, |
313 GrSurfaceOrigin rtOrigin); | 312 GrSurfaceOrigin rtOrigin); |
314 | 313 |
315 // disables the scissor | 314 // disables the scissor |
316 void disableScissor(); | 315 void disableScissor(); |
317 | 316 |
318 void flushWindowRectangles(const GrWindowRectsState&, const GrGLRenderTarget
*); | 317 void flushWindowRectangles(const GrWindowRectangles&, const GrGLRenderTarget
*); |
319 void disableWindowRectangles(); | 318 void disableWindowRectangles(); |
320 | 319 |
321 void initFSAASupport(); | 320 void initFSAASupport(); |
322 | 321 |
323 // determines valid stencil formats | 322 // determines valid stencil formats |
324 void initStencilFormats(); | 323 void initStencilFormats(); |
325 | 324 |
326 // sets a texture unit to use for texture operations other than binding a te
xture to a program. | 325 // sets a texture unit to use for texture operations other than binding a te
xture to a program. |
327 // ensures that such operations don't negatively interact with tracking boun
d textures. | 326 // ensures that such operations don't negatively interact with tracking boun
d textures. |
328 void setScratchTextureUnit(); | 327 void setScratchTextureUnit(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 TriState fEnabled; | 417 TriState fEnabled; |
419 GrGLIRect fRect; | 418 GrGLIRect fRect; |
420 void invalidate() { | 419 void invalidate() { |
421 fEnabled = kUnknown_TriState; | 420 fEnabled = kUnknown_TriState; |
422 fRect.invalidate(); | 421 fRect.invalidate(); |
423 } | 422 } |
424 } fHWScissorSettings; | 423 } fHWScissorSettings; |
425 | 424 |
426 class { | 425 class { |
427 public: | 426 public: |
428 bool valid() const { return kInvalidSurfaceOrigin != fRTOrigin; } | 427 bool valid() const { return kInvalidOrigin != fOrigin; } |
429 void invalidate() { fRTOrigin = kInvalidSurfaceOrigin; } | 428 void invalidate() { fOrigin = kInvalidOrigin; } |
430 bool knownDisabled() const { return this->valid() && !fWindowState.enabl
ed(); } | |
431 void setDisabled() { fRTOrigin = kDefault_GrSurfaceOrigin, fWindowState.
setDisabled(); } | |
432 | 429 |
433 void set(GrSurfaceOrigin rtOrigin, const GrGLIRect& viewport, | 430 bool disabled() const { |
434 const GrWindowRectsState& windowState) { | 431 return this->valid() && Mode::kExclusive == fWindows.mode() && !fWin
dows.count(); |
435 fRTOrigin = rtOrigin; | |
436 fViewport = viewport; | |
437 fWindowState = windowState; | |
438 } | 432 } |
| 433 void setDisabled() { fOrigin = kDefault_GrSurfaceOrigin, fWindows.reset(
); } |
439 | 434 |
440 bool knownEqualTo(GrSurfaceOrigin rtOrigin, const GrGLIRect& viewport, | 435 bool equal(GrSurfaceOrigin org, const GrGLIRect& viewp, |
441 const GrWindowRectsState& windowState) const { | 436 const GrWindowRectangles& windows) const { |
442 if (!this->valid()) { | 437 if (!this->valid()) { |
443 return false; | 438 return false; |
444 } | 439 } |
445 if (fWindowState.numWindows() && (fRTOrigin != rtOrigin || fViewport
!= viewport)) { | 440 if (fWindows.count() && (fOrigin != org || fViewport != viewp)) { |
446 return false; | 441 return false; |
447 } | 442 } |
448 return fWindowState.cheapEqualTo(windowState); | 443 return fWindows == windows; |
| 444 } |
| 445 |
| 446 void set(GrSurfaceOrigin org, const GrGLIRect& viewp, const GrWindowRect
angles& windows) { |
| 447 fOrigin = org; |
| 448 fViewport = viewp; |
| 449 fWindows = windows; |
449 } | 450 } |
450 | 451 |
451 private: | 452 private: |
452 enum { kInvalidSurfaceOrigin = -1 }; | 453 typedef GrWindowRectangles::Mode Mode; |
| 454 enum { kInvalidOrigin = -1 }; |
453 | 455 |
454 int fRTOrigin; | 456 int fOrigin; |
455 GrGLIRect fViewport; | 457 GrGLIRect fViewport; |
456 GrWindowRectsState fWindowState; | 458 GrWindowRectangles fWindows; |
457 } fHWWindowRectsState; | 459 } fHWWindowRects; |
458 | 460 |
459 GrGLIRect fHWViewport; | 461 GrGLIRect fHWViewport; |
460 | 462 |
461 /** | 463 /** |
462 * Tracks vertex attrib array state. | 464 * Tracks vertex attrib array state. |
463 */ | 465 */ |
464 class HWVertexArrayState { | 466 class HWVertexArrayState { |
465 public: | 467 public: |
466 HWVertexArrayState() : fCoreProfileVertexArray(nullptr) { this->invalida
te(); } | 468 HWVertexArrayState() : fCoreProfileVertexArray(nullptr) { this->invalida
te(); } |
467 | 469 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 bool fPLSHasBeenUsed; | 635 bool fPLSHasBeenUsed; |
634 | 636 |
635 float fHWMinSampleShading; | 637 float fHWMinSampleShading; |
636 | 638 |
637 typedef GrGpu INHERITED; | 639 typedef GrGpu INHERITED; |
638 friend class GrGLPathRendering; // For accessing setTextureUnit. | 640 friend class GrGLPathRendering; // For accessing setTextureUnit. |
639 friend class gr_instanced::GLInstancedRendering; // For accessing flushGLSta
te. | 641 friend class gr_instanced::GLInstancedRendering; // For accessing flushGLSta
te. |
640 }; | 642 }; |
641 | 643 |
642 #endif | 644 #endif |
OLD | NEW |