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

Side by Side Diff: src/gpu/gl/GrGLGpu.h

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

Powered by Google App Engine
This is Rietveld 408576698