Reland "Initiate MSAA resolves during DAG generation"
This is a reland of 804f6a0fe7f3c7df5ac69891841ee9cdf6d1121a
Original change's description:
> Initiate MSAA resolves during DAG generation
>
> Adds an "fIsMSAADirty" flag to GrRenderTargetProxy and switches to
> resolving MSAA in GrTextureResolveRenderTask. This completes our push
> to resolve textures outside of render passes.
>
> For the time being, we only store a dirty flag on the proxy and still
> rely on the GrRenderTarget itself to track the actual dirty rect. This
> will be followed by a CL that moves the dirty rect out of
> GrRenderTarget and into the proxy.
>
> Bug: skia:
> Change-Id: I21219a58028bdb4590940210e565133093cd34b3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235672
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
Bug: skia:
Change-Id: I805b3af1404eb7919ae937cff3dfa97921e32c69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237482
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrTextureResolveRenderTask.cpp b/src/gpu/GrTextureResolveRenderTask.cpp
index 9a4d6b4..0b77383 100644
--- a/src/gpu/GrTextureResolveRenderTask.cpp
+++ b/src/gpu/GrTextureResolveRenderTask.cpp
@@ -10,10 +10,25 @@
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrOpFlushState.h"
+#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrResourceAllocator.h"
#include "src/gpu/GrTexturePriv.h"
void GrTextureResolveRenderTask::init(const GrCaps& caps) {
+ if (GrSurfaceProxy::ResolveFlags::kMSAA & fResolveFlags) {
+ GrRenderTargetProxy* renderTargetProxy = fTarget->asRenderTargetProxy();
+ SkASSERT(renderTargetProxy);
+ SkASSERT(renderTargetProxy->isMSAADirty());
+ renderTargetProxy->markMSAAResolved();
+ }
+
+ if (GrSurfaceProxy::ResolveFlags::kMipMaps & fResolveFlags) {
+ GrTextureProxy* textureProxy = fTarget->asTextureProxy();
+ SkASSERT(GrMipMapped::kYes == textureProxy->mipMapped());
+ SkASSERT(textureProxy->mipMapsAreDirty());
+ textureProxy->markMipMapsClean();
+ }
+
// Add the target as a dependency: We will read the existing contents of this texture while
// generating mipmap levels and/or resolving MSAA.
//
@@ -23,13 +38,6 @@
// We only resolve the texture; nobody should try to do anything else with this opsTask.
this->makeClosed(caps);
-
- if (GrTextureResolveFlags::kMipMaps & fResolveFlags) {
- GrTextureProxy* textureProxy = fTarget->asTextureProxy();
- SkASSERT(GrMipMapped::kYes == textureProxy->mipMapped());
- SkASSERT(textureProxy->mipMapsAreDirty());
- textureProxy->markMipMapsClean();
- }
}
void GrTextureResolveRenderTask::gatherProxyIntervals(GrResourceAllocator* alloc) const {
@@ -42,12 +50,21 @@
}
bool GrTextureResolveRenderTask::onExecute(GrOpFlushState* flushState) {
- GrTexture* texture = fTarget->peekTexture();
- SkASSERT(texture);
+ // Resolve msaa before regenerating mipmaps.
+ if (GrSurfaceProxy::ResolveFlags::kMSAA & fResolveFlags) {
+ GrRenderTarget* renderTarget = fTarget->peekRenderTarget();
+ SkASSERT(renderTarget);
+ if (renderTarget->needsResolve()) {
+ flushState->gpu()->resolveRenderTarget(renderTarget);
+ }
+ }
- if ((GrTextureResolveFlags::kMipMaps & fResolveFlags) &&
- texture->texturePriv().mipMapsAreDirty()) {
- flushState->gpu()->regenerateMipMapLevels(texture);
+ if (GrSurfaceProxy::ResolveFlags::kMipMaps & fResolveFlags) {
+ GrTexture* texture = fTarget->peekTexture();
+ SkASSERT(texture);
+ if (texture->texturePriv().mipMapsAreDirty()) {
+ flushState->gpu()->regenerateMipMapLevels(texture);
+ }
}
return true;