eaa862569d
This reverts commit7d7d7d1946
. Reason for revert: Reverting this to see if it really was crashing on SVGs or if that was cross talk. Original change's description: > Revert "Add GrRenderTargetContext instantiate & asTextureProxy" > > This reverts commit9113edfff8
. > > Reason for revert: Looks to be causing EXCEPTION_ACCESS_VIOLATION: > > https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-NUC-GPU-IntelIris6100-x86_64-Debug/builds/121/steps/test_skia%20on%20Windows/logs/stdio > https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-GCE-CPU-AVX2-x86-Debug/builds/2384/steps/test_skia%20on%20Windows-2008ServerR2-SP1/logs/stdio > https://uberchromegw.corp.google.com/i/client.skia/builders/Test-Win-MSVC-ShuttleC-GPU-iHD530-x86_64-Debug/builds/785/steps/test_skia%20on%20Windows/logs/stdio > > Original change's description: > > Add GrRenderTargetContext instantiate & asTextureProxy > > > > This CL also centralizes the instantiation code in GrSurfaceProxy and adds a test. > > > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4494 > > > > Change-Id: I0081d9a216dc0af293179f23bcb88acf6a822324 > > Reviewed-on: https://skia-review.googlesource.com/4494 > > Reviewed-by: Brian Salomon <bsalomon@google.com> > > Commit-Queue: Robert Phillips <robertphillips@google.com> > > > > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > > Change-Id: I225ce7867ebd445067e5ea55ebbfd587f7fe782a > Reviewed-on: https://skia-review.googlesource.com/4528 > Commit-Queue: Leon Scroggins <scroggo@google.com> > Reviewed-by: Leon Scroggins <scroggo@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,scroggo@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Ifc3b9ac343009a3808f5f47500eef50df438e3d9 Reviewed-on: https://skia-review.googlesource.com/4537 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
92 lines
3.2 KiB
C++
92 lines
3.2 KiB
C++
/*
|
|
* Copyright 2016 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef GrRenderTargetProxy_DEFINED
|
|
#define GrRenderTargetProxy_DEFINED
|
|
|
|
#include "GrRenderTarget.h"
|
|
#include "GrSurfaceProxy.h"
|
|
#include "GrTypes.h"
|
|
|
|
class GrTextureProvider;
|
|
|
|
// This class delays the acquisition of RenderTargets until they are actually
|
|
// required
|
|
// Beware: the uniqueID of the RenderTargetProxy will usually be different than
|
|
// the uniqueID of the RenderTarget it represents!
|
|
class GrRenderTargetProxy : virtual public GrSurfaceProxy {
|
|
public:
|
|
/**
|
|
* The caller gets the creation ref.
|
|
*/
|
|
static sk_sp<GrRenderTargetProxy> Make(const GrCaps&, const GrSurfaceDesc&,
|
|
SkBackingFit, SkBudgeted);
|
|
static sk_sp<GrRenderTargetProxy> Make(sk_sp<GrRenderTarget>);
|
|
|
|
GrRenderTargetProxy* asRenderTargetProxy() override { return this; }
|
|
const GrRenderTargetProxy* asRenderTargetProxy() const override { return this; }
|
|
|
|
// Actually instantiate the backing rendertarget, if necessary.
|
|
GrRenderTarget* instantiate(GrTextureProvider* texProvider);
|
|
|
|
bool isStencilBufferMultisampled() const { return fDesc.fSampleCnt > 0; }
|
|
|
|
/**
|
|
* For our purposes, "Mixed Sampled" means the stencil buffer is multisampled but the color
|
|
* buffer is not.
|
|
*/
|
|
bool isMixedSampled() const { return fFlags & GrRenderTarget::Flags::kMixedSampled; }
|
|
|
|
/**
|
|
* "Unified Sampled" means the stencil and color buffers are both multisampled.
|
|
*/
|
|
bool isUnifiedMultisampled() const { return fDesc.fSampleCnt > 0 && !this->isMixedSampled(); }
|
|
|
|
/**
|
|
* Returns the number of samples/pixel in the stencil buffer (Zero if non-MSAA).
|
|
*/
|
|
int numStencilSamples() const { return fDesc.fSampleCnt; }
|
|
|
|
/**
|
|
* Returns the number of samples/pixel in the color buffer (Zero if non-MSAA or mixed sampled).
|
|
*/
|
|
int numColorSamples() const { return this->isMixedSampled() ? 0 : fDesc.fSampleCnt; }
|
|
|
|
GrRenderTarget::Flags testingOnly_getFlags() const;
|
|
|
|
GrRenderTargetOpList* getLastRenderTargetOpList() {
|
|
return (GrRenderTargetOpList*) this->getLastOpList();
|
|
}
|
|
|
|
SkDEBUGCODE(void validate(GrContext*) const;)
|
|
|
|
protected:
|
|
// Deferred version
|
|
GrRenderTargetProxy(const GrCaps&, const GrSurfaceDesc&, SkBackingFit, SkBudgeted);
|
|
|
|
// Wrapped version
|
|
GrRenderTargetProxy(sk_sp<GrRenderTarget> rt);
|
|
|
|
private:
|
|
size_t onGpuMemorySize() const override;
|
|
|
|
// For wrapped render targets the actual GrRenderTarget is stored in the GrIORefProxy class.
|
|
// For deferred proxies that pointer is filled in when we need to instantiate the
|
|
// deferred resource.
|
|
|
|
// These don't usually get computed until the render target is instantiated, but the render
|
|
// target proxy may need to answer queries about it before then. And since in the deferred case
|
|
// we know the newly created render target will be internal, we are able to precompute what the
|
|
// flags will ultimately end up being. In the wrapped case we just copy the wrapped
|
|
// rendertarget's info here.
|
|
GrRenderTarget::Flags fFlags;
|
|
|
|
typedef GrSurfaceProxy INHERITED;
|
|
};
|
|
|
|
#endif
|