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

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

Issue 1407063011: Revert of 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLPathRendering.cpp » ('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 fc9675fdda30478cf3d2a03048658a73932f34fc..8bd06638521db4b9c204381d8276d277cb64a588 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1492,11 +1492,11 @@
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.getRenderTarget());
this->flushStencil(pipeline.getStencil());
this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->origin());
- this->flushHWAAState(glRT, pipeline.isHWAntialiasState());
+ this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !pipeline.getStencil().isDisabled());
// This must come after textures are flushed because a texture may need
// to be msaa-resolved (which will modify bound FBO state).
- this->flushRenderTarget(glRT, nullptr, pipeline.hasCoCenteredSamples());
+ this->flushRenderTarget(glRT, nullptr);
return true;
}
@@ -2026,10 +2026,33 @@
return true;
}
-void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound,
- bool coCenterSamples) {
+void GrGLGpu::setColocatedSampleLocations(GrRenderTarget* rt, bool useColocatedSampleLocations) {
+ GrGLRenderTarget* target = static_cast<GrGLRenderTarget*>(rt->asRenderTarget());
+ SkASSERT(0 != target->renderFBOID());
+
+ if (!rt->isStencilBufferMultisampled() ||
+ useColocatedSampleLocations == target->usesColocatedSampleLocations()) {
+ return;
+ }
+
+ if (kGL_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_VER(4,5)) {
+ GL_CALL(NamedFramebufferParameteri(target->renderFBOID(),
+ GR_GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS,
+ useColocatedSampleLocations));
+ } else {
+ GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID()));
+ GL_CALL(FramebufferParameteri(GR_GL_FRAMEBUFFER,
+ GR_GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS,
+ useColocatedSampleLocations));
+ fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID;
+ }
+
+ target->flagAsUsingColocatedSampleLocations(useColocatedSampleLocations);
+}
+
+void GrGLGpu::flushRenderTarget(GrGLRenderTarget* target, const SkIRect* bound) {
+
SkASSERT(target);
- SkASSERT(!coCenterSamples || this->caps()->programmableSampleLocationsSupport());
uint32_t rtID = target->getUniqueID();
if (fHWBoundRenderTargetUniqueID != rtID) {
@@ -2072,19 +2095,6 @@
GrTexture *texture = target->asTexture();
if (texture) {
texture->texturePriv().dirtyMipMaps(true);
- }
-
- if (this->caps()->programmableSampleLocationsSupport()) {
- ResetTimestamp timestamp;
- bool hasCoCenteredSamples = target->getCachedCoCenteredSamplesState(&timestamp);
- if (timestamp < this->getResetTimestamp() || hasCoCenteredSamples != coCenterSamples) {
- // The default state for programmable sample locations is already at pixel center, so we
- // don't assign them. This assumes the client does not modify them outside of Skia.
- GL_CALL(FramebufferParameteri(GR_GL_FRAMEBUFFER,
- GR_GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS,
- coCenterSamples));
- target->setCachedCoCenteredSamplesState(coCenterSamples, this->getResetTimestamp());
- }
}
}
@@ -2287,10 +2297,20 @@
}
}
-void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA) {
+void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool stencilEnabled) {
SkASSERT(!useHWAA || rt->isStencilBufferMultisampled());
- if (this->caps()->multisampleDisableSupport()) {
+ if (rt->hasMixedSamples() && stencilEnabled &&
+ this->glCaps().glslCaps()->programmableSampleLocationsSupport()) {
+ if (useHWAA) {
+ this->setColocatedSampleLocations(rt, false);
+ } else {
+ this->setColocatedSampleLocations(rt, true);
+ }
+ useHWAA = true;
+ }
+
+ if (this->glCaps().multisampleDisableSupport()) {
if (useHWAA) {
if (kYes_TriState != fMSAAEnabled) {
GL_CALL(Enable(GR_GL_MULTISAMPLE));
@@ -3091,7 +3111,7 @@
this->flushBlend(blendInfo);
this->flushColorWrite(true);
this->flushDrawFace(GrPipelineBuilder::kBoth_DrawFace);
- this->flushHWAAState(dstRT, false);
+ this->flushHWAAState(dstRT, false, false);
this->disableScissor();
GrStencilSettings stencil;
stencil.setDisabled();
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLPathRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698