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

Unified Diff: src/gpu/gl/GrGLRenderTarget.h

Issue 1232103002: Enable stencil clipping in mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLRenderTarget.h
diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h
index d1365efd420c10af802bd173fd534a4d443871cd..4987c4c53096fe91de9efa022919c71abcb678a6 100644
--- a/src/gpu/gl/GrGLRenderTarget.h
+++ b/src/gpu/gl/GrGLRenderTarget.h
@@ -70,6 +70,46 @@ public:
// components seperately.
void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override;
+ /**
+ * Some hardware allows overriding coordinates of sample locations in multisampled
+ * render targets.
+ */
+ enum SampleLocationsConfig {
+ kDefault_SampleLocationsConfig = 0,
+ kProgrammable_SampleLocationsConfig = 1
+ };
Chris Dalton 2015/09/22 08:35:25 Just a thought -- we may want to consider putting
+
+ /** Returns sample locations config in use. */
+ SampleLocationsConfig sampleLocationsConfig() { return fSampleLocationsConfig; }
+
+ /** Set sample locations config in use. */
+ void setSampleLocationsConfig(SampleLocationsConfig sampleLocationsConfig) {
+ fSampleLocationsConfig = sampleLocationsConfig;
+ }
+
+ /** Returns a pointer to default sample locations array. */
+ const float* defaultSampleLocations() { return fDefaultSampleLocations; }
+
+ /** Initializes default sample locations array with 'count' pairs of sample location coordinates. */
+ void setDefaultSampleLocations(int count, const float *sampleLocations) {
+ memcpy(fDefaultSampleLocations, sampleLocations, 2 * count * sizeof(fDefaultSampleLocations[0]));
+ }
+
+ /**
+ * @return true if programmable sample locations have been set for this
+ * render target. Requires support for NV_sample_locations.
+ */
+ bool usesProgrammableSampleLocations() const {
+ return fUsesProgrammableSampleLocations;
+ }
+
+ /**
+ * Flag render target as using or not using programmable sample locations.
+ */
+ void flagAsUsingProgrammableSampleLocations(bool useSampleLocations) {
+ fUsesProgrammableSampleLocations = useSampleLocations;
+ }
+
protected:
// The public constructor registers this object with the cache. However, only the most derived
// class should register with the cache. This constructor does not do the registration and
@@ -99,22 +139,29 @@ private:
// The number total number of samples, including both MSAA and resolve texture samples.
int totalSamples() const;
- GrGLuint fRTFBOID;
- GrGLuint fTexFBOID;
- GrGLuint fMSColorRenderbufferID;
+ GrGLuint fRTFBOID;
+ GrGLuint fTexFBOID;
+ GrGLuint fMSColorRenderbufferID;
// We track this separately from GrGpuResource because this may be both a texture and a render
// target, and the texture may be wrapped while the render target is not.
- LifeCycle fRTLifecycle;
+ LifeCycle fRTLifecycle;
// when we switch to this render target we want to set the viewport to
// only render to content area (as opposed to the whole allocation) and
// we want the rendering to be at top left (GL has origin in bottom left)
- GrGLIRect fViewport;
+ GrGLIRect fViewport;
// onGpuMemorySize() needs to know the VRAM footprint of the FBO(s). However, abandon and
// release zero out the IDs and the cache needs to know the size even after those actions.
- size_t fGpuMemorySize;
+ size_t fGpuMemorySize;
+
+ // Configures sample locations to be either default or programmable, if MSAA.
+ SampleLocationsConfig fSampleLocationsConfig;
+ // Render target's default sample locations array, if MSAA.
+ float fDefaultSampleLocations[32];
+
+ bool fUsesProgrammableSampleLocations;
typedef GrRenderTarget INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698