Chromium Code Reviews| 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; |
| }; |