blob: a60c230d3de93c543914f345328c03b2073cd423 [file] [log] [blame]
Robert Phillips84a81202016-11-04 11:59:10 -04001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrTextureRenderTargetProxy_DEFINED
9#define GrTextureRenderTargetProxy_DEFINED
10
11#include "GrRenderTargetProxy.h"
12#include "GrTextureProxy.h"
13
14#ifdef SK_BUILD_FOR_WIN
15// Windows gives warnings about inheriting asTextureProxy/asRenderTargetProxy via dominance.
16#pragma warning(push)
17#pragma warning(disable: 4250)
18#endif
19
20// This class delays the acquisition of RenderTargets that are also textures until
21// they are actually required
22// Beware: the uniqueID of the TextureRenderTargetProxy will usually be different than
23// the uniqueID of the RenderTarget/Texture it represents!
Brian Osman086679b2018-09-10 16:26:51 -040024class GrTextureRenderTargetProxy : public GrRenderTargetProxy, public GrTextureProxy {
Robert Phillips84a81202016-11-04 11:59:10 -040025private:
Robert Phillips0bd24dc2018-01-16 08:06:32 -050026 // DDL TODO: rm the GrSurfaceProxy friending
Robert Phillips37430132016-11-09 06:50:43 -050027 friend class GrSurfaceProxy; // for ctors
Robert Phillips0bd24dc2018-01-16 08:06:32 -050028 friend class GrProxyProvider; // for ctors
Robert Phillips37430132016-11-09 06:50:43 -050029
Robert Phillips84a81202016-11-04 11:59:10 -040030 // Deferred version
Brian Salomon2a4f9832018-03-03 22:43:43 -050031 GrTextureRenderTargetProxy(const GrCaps&, const GrSurfaceDesc&, GrSurfaceOrigin, GrMipMapped,
Brian Salomon7226c232018-07-30 13:13:17 -040032 GrTextureType, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
Robert Phillips84a81202016-11-04 11:59:10 -040033
Chris Dalton706a6ff2017-11-29 22:01:06 -070034 // Lazy-callback version
Greg Daniel457469c2018-02-08 15:05:44 -050035 GrTextureRenderTargetProxy(LazyInstantiateCallback&&, LazyInstantiationType,
Brian Salomon2a4f9832018-03-03 22:43:43 -050036 const GrSurfaceDesc& desc, GrSurfaceOrigin, GrMipMapped,
Brian Salomon7226c232018-07-30 13:13:17 -040037 GrTextureType, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
Chris Dalton706a6ff2017-11-29 22:01:06 -070038
Robert Phillips84a81202016-11-04 11:59:10 -040039 // Wrapped version
Robert Phillips066f0202017-07-25 10:16:35 -040040 GrTextureRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
Robert Phillips84a81202016-11-04 11:59:10 -040041
Robert Phillipseee4d6e2017-06-05 09:26:07 -040042 bool instantiate(GrResourceProvider*) override;
Robert Phillips5af44de2017-07-18 14:49:38 -040043 sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
Brian Salomonbb5711a2017-05-17 13:49:59 -040044
45 size_t onUninstantiatedGpuMemorySize() const override;
Chris Dalton706a6ff2017-11-29 22:01:06 -070046
Greg Daniel849dce12018-04-24 14:32:53 -040047 SkDEBUGCODE(void onValidateSurface(const GrSurface*) override;)
Robert Phillips84a81202016-11-04 11:59:10 -040048};
49
50#ifdef SK_BUILD_FOR_WIN
51#pragma warning(pop)
52#endif
53
54#endif