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

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

Issue 1717393002: Add "sample locations" feature to GrProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_getmultisamp
Patch Set: move into GrProcessor Created 4 years, 9 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 GrStencilSettings;
14
13 /** Class that adds methods to GrRenderTarget that are only intended for use int ernal to Skia. 15 /** 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 16 This class is purely a privileged window into GrRenderTarget. It should neve r have additional
15 data members or virtual methods. */ 17 data members or virtual methods. */
16 class GrRenderTargetPriv { 18 class GrRenderTargetPriv {
17 public: 19 public:
20 typedef GrRenderTarget::MultisampleSpecs MultisampleSpecs;
21
18 /** 22 /**
19 * GrStencilAttachment is not part of the public API. 23 * GrStencilAttachment is not part of the public API.
20 */ 24 */
21 GrStencilAttachment* getStencilAttachment() const { return fRenderTarget->fS tencilAttachment; } 25 GrStencilAttachment* getStencilAttachment() const { return fRenderTarget->fS tencilAttachment; }
22 26
23 /** 27 /**
24 * Attaches the GrStencilAttachment onto the render target. If stencil is a nullptr then the 28 * 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 29 * 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. 30 * function returns false if there were any failure in attaching the GrStenc ilAttachment.
27 */ 31 */
28 bool attachStencilAttachment(GrStencilAttachment* stencil); 32 bool attachStencilAttachment(GrStencilAttachment* stencil);
29 33
34 /**
35 * Returns the actual number of samples the GPU will run when drawing to thi s render target with
36 * HW antialiasing and the provided stencil settings. NOTE: this can be grea ter than the sample
37 * count in the render target's surface descriptor.
38 */
39 int getEffectiveSampleCount(const GrStencilSettings&) const;
40
41 /**
42 * Returns a nonzero unique ID that identifies the sample pattern the GPU wi ll use when drawing
43 * to this render target with HW antialiasing and the provided stencil setti ngs.
44 *
45 * Requires support for sample locations.
46 */
47 uint16_t getSamplePatternID(const GrStencilSettings&) const;
48
49 /**
50 * Returns the sample locations the GPU will use when drawing to this render target with HW
51 * antialiasing and the provided stencil settings. The sample locations are stored in device
52 * space, with the center of the pixel at [0.5, 0.5].
53 *
54 * Requires support for sample locations.
55 */
56 const SkPoint* getSampleLocations(const GrStencilSettings&) const;
57
58 /**
59 * Used by GrGpu to cache the render target's multisample info.
60 */
61 SkAutoTDelete<MultisampleSpecs>* accessMultisampleSpecs() {
62 return &fRenderTarget->fMultisampleSpecs;
63 }
64
30 private: 65 private:
31 explicit GrRenderTargetPriv(GrRenderTarget* renderTarget) : fRenderTarget(re nderTarget) {} 66 explicit GrRenderTargetPriv(GrRenderTarget* renderTarget) : fRenderTarget(re nderTarget) {}
32 GrRenderTargetPriv(const GrRenderTargetPriv&) {} // unimpl 67 GrRenderTargetPriv(const GrRenderTargetPriv&) {} // unimpl
33 GrRenderTargetPriv& operator=(const GrRenderTargetPriv&); // unimpl 68 GrRenderTargetPriv& operator=(const GrRenderTargetPriv&); // unimpl
34 69
35 // No taking addresses of this type. 70 // No taking addresses of this type.
36 const GrRenderTargetPriv* operator&() const; 71 const GrRenderTargetPriv* operator&() const;
37 GrRenderTargetPriv* operator&(); 72 GrRenderTargetPriv* operator&();
38 73
39 GrRenderTarget* fRenderTarget; 74 GrRenderTarget* fRenderTarget;
40 75
41 friend class GrRenderTarget; // to construct/copy this type. 76 friend class GrRenderTarget; // to construct/copy this type.
42 }; 77 };
43 78
44 inline GrRenderTargetPriv GrRenderTarget::renderTargetPriv() { return GrRenderTa rgetPriv(this); } 79 inline GrRenderTargetPriv GrRenderTarget::renderTargetPriv() { return GrRenderTa rgetPriv(this); }
45 80
46 inline const GrRenderTargetPriv GrRenderTarget::renderTargetPriv () const { 81 inline const GrRenderTargetPriv GrRenderTarget::renderTargetPriv () const {
47 return GrRenderTargetPriv(const_cast<GrRenderTarget*>(this)); 82 return GrRenderTargetPriv(const_cast<GrRenderTarget*>(this));
48 } 83 }
49 84
50 #endif 85 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698