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

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

Issue 1431593006: Fix mixed samples stencil clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/gpu/gl/GrGLRenderTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #ifndef GrGLRenderTarget_DEFINED 9 #ifndef GrGLRenderTarget_DEFINED
10 #define GrGLRenderTarget_DEFINED 10 #define GrGLRenderTarget_DEFINED
11 11
12 #include "GrGpu.h"
12 #include "GrGLIRect.h" 13 #include "GrGLIRect.h"
13 #include "GrRenderTarget.h" 14 #include "GrRenderTarget.h"
14 #include "SkScalar.h" 15 #include "SkScalar.h"
15 16
16 class GrGLGpu; 17 class GrGLGpu;
17 class GrGLStencilAttachment; 18 class GrGLStencilAttachment;
18 19
19 class GrGLRenderTarget : public GrRenderTarget { 20 class GrGLRenderTarget : public GrRenderTarget {
20 public: 21 public:
21 // set fTexFBOID to this value to indicate that it is multisampled but 22 // set fTexFBOID to this value to indicate that it is multisampled but
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 64
64 /** When we don't own the FBO ID we don't attempt to modify its attachments. */ 65 /** When we don't own the FBO ID we don't attempt to modify its attachments. */
65 bool canAttemptStencilAttachment() const override { 66 bool canAttemptStencilAttachment() const override {
66 return kCached_LifeCycle == fRTLifecycle || kUncached_LifeCycle == fRTLi fecycle; 67 return kCached_LifeCycle == fRTLifecycle || kUncached_LifeCycle == fRTLi fecycle;
67 } 68 }
68 69
69 // GrGLRenderTarget overrides dumpMemoryStatistics so it can log its texture and renderbuffer 70 // GrGLRenderTarget overrides dumpMemoryStatistics so it can log its texture and renderbuffer
70 // components seperately. 71 // components seperately.
71 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override ; 72 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override ;
72 73
73 /** 74 bool getCachedCoCenteredSamplesState(GrGpu::ResetTimestamp* stamp) const {
74 * @return true if sample locations colocated at pixel center have been set for this 75 *stamp = fHasCoCenteredSamplesTimestamp;
75 * render target. Requires support for NV_sample_locations. 76 return fHasCoCenteredSamples;
76 */
77 bool usesColocatedSampleLocations() const {
78 return fUsesColocatedSampleLocations;
79 } 77 }
80 78
81 /** 79 void setCachedCoCenteredSamplesState(bool hasCoCenteredSamples, GrGpu::Reset Timestamp stamp) {
82 * Flag render target as using or not using sample locations colocated at pi xel center. 80 fHasCoCenteredSamples = hasCoCenteredSamples;
83 */ 81 fHasCoCenteredSamplesTimestamp = stamp;
84 void flagAsUsingColocatedSampleLocations(bool useColocatedSampleLocations) {
85 fUsesColocatedSampleLocations = useColocatedSampleLocations;
86 } 82 }
87 83
88 protected: 84 protected:
89 // The public constructor registers this object with the cache. However, onl y the most derived 85 // The public constructor registers this object with the cache. However, onl y the most derived
90 // class should register with the cache. This constructor does not do the re gistration and 86 // class should register with the cache. This constructor does not do the re gistration and
91 // rather moves that burden onto the derived class. 87 // rather moves that burden onto the derived class.
92 enum Derived { kDerived }; 88 enum Derived { kDerived };
93 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived); 89 GrGLRenderTarget(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&, Derived);
94 90
95 void init(const GrSurfaceDesc&, const IDDesc&); 91 void init(const GrSurfaceDesc&, const IDDesc&);
(...skipping 11 matching lines...) Expand all
107 103
108 GrGLGpu* getGLGpu() const; 104 GrGLGpu* getGLGpu() const;
109 bool completeStencilAttachment() override; 105 bool completeStencilAttachment() override;
110 106
111 // The total size of the resource (including all pixels) for a single sample . 107 // The total size of the resource (including all pixels) for a single sample .
112 size_t totalBytesPerSample() const; 108 size_t totalBytesPerSample() const;
113 int msaaSamples() const; 109 int msaaSamples() const;
114 // The number total number of samples, including both MSAA and resolve textu re samples. 110 // The number total number of samples, including both MSAA and resolve textu re samples.
115 int totalSamples() const; 111 int totalSamples() const;
116 112
117 GrGLuint fRTFBOID; 113 GrGLuint fRTFBOID;
118 GrGLuint fTexFBOID; 114 GrGLuint fTexFBOID;
119 GrGLuint fMSColorRenderbufferID; 115 GrGLuint fMSColorRenderbufferID;
116 bool fHasCoCenteredSamples;
117 GrGpu::ResetTimestamp fHasCoCenteredSamplesTimestamp;
120 118
121 // We track this separately from GrGpuResource because this may be both a te xture and a render 119 // We track this separately from GrGpuResource because this may be both a te xture and a render
122 // target, and the texture may be wrapped while the render target is not. 120 // target, and the texture may be wrapped while the render target is not.
123 LifeCycle fRTLifecycle; 121 LifeCycle fRTLifecycle;
124 122
125 // when we switch to this render target we want to set the viewport to 123 // when we switch to this render target we want to set the viewport to
126 // only render to content area (as opposed to the whole allocation) and 124 // only render to content area (as opposed to the whole allocation) and
127 // we want the rendering to be at top left (GL has origin in bottom left) 125 // we want the rendering to be at top left (GL has origin in bottom left)
128 GrGLIRect fViewport; 126 GrGLIRect fViewport;
129 127
130 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However , abandon and 128 // onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However , abandon and
131 // release zero out the IDs and the cache needs to know the size even after those actions. 129 // release zero out the IDs and the cache needs to know the size even after those actions.
132 size_t fGpuMemorySize; 130 size_t fGpuMemorySize;
133
134 // True if sample locations colocated at pixel center are currently in use, false if default
135 // sample locations are currently in use.
136 bool fUsesColocatedSampleLocations;
137 131
138 typedef GrRenderTarget INHERITED; 132 typedef GrRenderTarget INHERITED;
139 }; 133 };
140 134
141 #endif 135 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.cpp ('k') | src/gpu/gl/GrGLRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698