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

Side by Side Diff: src/gpu/GrRenderTargetPriv.h

Issue 1232103002: Enable stencil clipping in mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Predefined sample locations, glcaps, render target priv Created 5 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 2015 Google Inc. 2 * Copyright 2015 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 GrRenderTargetPriv_DEFINED 8 #ifndef GrRenderTargetPriv_DEFINED
9 #define GrRenderTargetPriv_DEFINED 9 #define GrRenderTargetPriv_DEFINED
10 10
11 #include "GrRenderTarget.h" 11 #include "GrRenderTarget.h"
12 12
13 /** Class that adds methods to GrRenderTarget that are only intended for use int ernal to Skia. 13 /** Class that adds methods to GrRenderTarget that are only intended for use int ernal to Skia.
14 This class is purely a privileged window into GrRenderTarget. It should neve r have additional 14 This class is purely a privileged window into GrRenderTarget. It should neve r have additional
15 data members or virtual methods. */ 15 data members or virtual methods. */
16 class GrRenderTargetPriv { 16 class GrRenderTargetPriv {
17 public: 17 public:
18 /** 18 /**
19 * GrStencilAttachment is not part of the public API. 19 * GrStencilAttachment is not part of the public API.
20 */ 20 */
21 GrStencilAttachment* getStencilAttachment() const { return fRenderTarget->fS tencilAttachment; } 21 GrStencilAttachment* getStencilAttachment() const { return fRenderTarget->fS tencilAttachment; }
22 22
23 /** 23 /**
24 * Attaches the GrStencilAttachment onto the render target. If stencil is a nullptr then the 24 * Attaches the GrStencilAttachment onto the render target. If stencil is a nullptr then the
25 * currently attached GrStencilAttachment will be removed if one was previou sly attached. This 25 * currently attached GrStencilAttachment will be removed if one was previou sly attached. This
26 * function returns false if there were any failure in attaching the GrStenc ilAttachment. 26 * function returns false if there were any failure in attaching the GrStenc ilAttachment.
27 */ 27 */
28 bool attachStencilAttachment(GrStencilAttachment* stencil); 28 bool attachStencilAttachment(GrStencilAttachment* stencil);
29 29
30 /**
31 * Some hardware allows overriding the default multisampling pattern with us er-defined sample
32 * locations. Returns true if the render target has been configured to use p rogrammable sample
33 * locations. */
34 bool programmableSampleLocationsEnabled() { return fRenderTarget->fProgramma bleSampleLocationsEnabled; }
35
36 /** Mark render target as being configured to use programmable sample locati ons, or otherwise. */
37 void setProgrammableSampleLocationsEnabled(bool enabled) {
38 fRenderTarget->fProgrammableSampleLocationsEnabled = enabled;
39 }
40
41 /**
42 * @return true if centered sample locations have been set for this
43 * render target. Requires support for NV_sample_locations.
44 */
45 bool usesCenteredSampleLocations() const {
46 return fRenderTarget->fUsesCenteredSampleLocations;
47 }
48
49 /**
50 * Flag render target as using or not using programmable sample locations.
51 */
52 void flagAsUsingCenteredSampleLocations(bool useCenteredSampleLocations) {
53 fRenderTarget->fUsesCenteredSampleLocations = useCenteredSampleLocations ;
54 }
55
30 private: 56 private:
31 explicit GrRenderTargetPriv(GrRenderTarget* renderTarget) : fRenderTarget(re nderTarget) {} 57 explicit GrRenderTargetPriv(GrRenderTarget* renderTarget) : fRenderTarget(re nderTarget) {}
32 GrRenderTargetPriv(const GrRenderTargetPriv&) {} // unimpl 58 GrRenderTargetPriv(const GrRenderTargetPriv&) {} // unimpl
33 GrRenderTargetPriv& operator=(const GrRenderTargetPriv&); // unimpl 59 GrRenderTargetPriv& operator=(const GrRenderTargetPriv&); // unimpl
34 60
35 // No taking addresses of this type. 61 // No taking addresses of this type.
36 const GrRenderTargetPriv* operator&() const; 62 const GrRenderTargetPriv* operator&() const;
37 GrRenderTargetPriv* operator&(); 63 GrRenderTargetPriv* operator&();
38 64
39 GrRenderTarget* fRenderTarget; 65 GrRenderTarget* fRenderTarget;
40 66
41 friend class GrRenderTarget; // to construct/copy this type. 67 friend class GrRenderTarget; // to construct/copy this type.
42 }; 68 };
43 69
44 inline GrRenderTargetPriv GrRenderTarget::renderTargetPriv() { return GrRenderTa rgetPriv(this); } 70 inline GrRenderTargetPriv GrRenderTarget::renderTargetPriv() { return GrRenderTa rgetPriv(this); }
45 71
46 inline const GrRenderTargetPriv GrRenderTarget::renderTargetPriv () const { 72 inline const GrRenderTargetPriv GrRenderTarget::renderTargetPriv () const {
47 return GrRenderTargetPriv(const_cast<GrRenderTarget*>(this)); 73 return GrRenderTargetPriv(const_cast<GrRenderTarget*>(this));
48 } 74 }
49 75
50 #endif 76 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698