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

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1001503002: Implement support for mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@mix1
Patch Set: Fix build error related to isMultisamped renaming Created 5 years, 6 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
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLRenderTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 08e83ec197c59b03362d7a08a17d7005cdad2c1e..625299d58c532c756dbd726b8b07f7a44a5263e4 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -373,6 +373,14 @@ void GrGLGpu::onResetContext(uint32_t resetBits) {
if (resetBits & kMSAAEnable_GrGLBackendState) {
fMSAAEnabled = kUnknown_TriState;
+
+ // In mixed samples mode coverage modulation allows the coverage to be converted to
+ // "opacity", which can then be blended into the color buffer to accomplish antialiasing.
+ // Enable coverage modulation suitable for premultiplied alpha colors.
+ // This state has no effect when not rendering to a mixed sampled target.
+ if (this->glCaps().shaderCaps()->mixedSamplesSupport()) {
+ GL_CALL(CoverageModulation(GR_GL_RGBA));
+ }
}
fHWActiveTextureUnitIdx = -1; // invalid
@@ -851,6 +859,7 @@ static bool renderbuffer_storage_msaa(const GrGLContext& ctx,
switch (ctx.caps()->msFBOType()) {
case GrGLCaps::kDesktop_ARB_MSFBOType:
case GrGLCaps::kDesktop_EXT_MSFBOType:
+ case GrGLCaps::kMixedSamples_MSFBOType:
case GrGLCaps::kES_3_0_MSFBOType:
GL_ALLOC_CALL(ctx.interface(),
RenderbufferStorageMultisample(GR_GL_RENDERBUFFER,
@@ -888,6 +897,9 @@ bool GrGLGpu::createRenderTargetObjects(const GrSurfaceDesc& desc,
idDesc->fRTFBOID = 0;
idDesc->fTexFBOID = 0;
idDesc->fLifeCycle = lifeCycle;
+ idDesc->fSampleConfig = (GrGLCaps::kMixedSamples_MSFBOType == this->glCaps().msFBOType() &&
+ desc.fSampleCnt > 0) ? GrRenderTarget::kStencil_SampleConfig :
+ GrRenderTarget::kUnified_SampleConfig;
GrGLenum status;
@@ -1170,7 +1182,7 @@ bool GrGLGpu::createStencilAttachmentForRenderTarget(GrRenderTarget* rt, int wid
SkASSERT(width >= rt->width());
SkASSERT(height >= rt->height());
- int samples = rt->numSamples();
+ int samples = rt->numStencilSamples();
GrGLStencilAttachment::IDDesc sbDesc;
int stencilFmtCnt = this->glCaps().stencilFormats().count();
@@ -2090,7 +2102,7 @@ void GrGLGpu::flushStencil(const GrStencilSettings& stencilSettings) {
}
void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) {
- SkASSERT(!useHWAA || rt->isMultisampled());
+ SkASSERT(!useHWAA || rt->isStencilBufferMultisampled());
if (this->glCaps().multisampleDisableSupport()) {
if (useHWAA) {
« no previous file with comments | « src/gpu/gl/GrGLCaps.cpp ('k') | src/gpu/gl/GrGLRenderTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698