GrTextureRenderTargetProxy.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  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. #ifndef GrTextureRenderTargetProxy_DEFINED
  8. #define GrTextureRenderTargetProxy_DEFINED
  9. #include "src/gpu/GrRenderTargetProxy.h"
  10. #include "src/gpu/GrTextureProxy.h"
  11. #ifdef SK_BUILD_FOR_WIN
  12. // Windows gives warnings about inheriting asTextureProxy/asRenderTargetProxy via dominance.
  13. #pragma warning(push)
  14. #pragma warning(disable: 4250)
  15. #endif
  16. // This class delays the acquisition of RenderTargets that are also textures until
  17. // they are actually required
  18. // Beware: the uniqueID of the TextureRenderTargetProxy will usually be different than
  19. // the uniqueID of the RenderTarget/Texture it represents!
  20. class GrTextureRenderTargetProxy : public GrRenderTargetProxy, public GrTextureProxy {
  21. private:
  22. // DDL TODO: rm the GrSurfaceProxy friending
  23. friend class GrSurfaceProxy; // for ctors
  24. friend class GrProxyProvider; // for ctors
  25. // Deferred version
  26. GrTextureRenderTargetProxy(const GrCaps&, const GrBackendFormat&, const GrSurfaceDesc&,
  27. int sampleCnt, GrSurfaceOrigin, GrMipMapped,
  28. const GrSwizzle& textureSwizzle, const GrSwizzle& outputSwizzle,
  29. SkBackingFit, SkBudgeted, GrProtected, GrInternalSurfaceFlags);
  30. // Lazy-callback version
  31. GrTextureRenderTargetProxy(LazyInstantiateCallback&&, LazyInstantiationType,
  32. const GrBackendFormat&, const GrSurfaceDesc& desc, int sampleCnt,
  33. GrSurfaceOrigin, GrMipMapped, const GrSwizzle& textureSwizzle,
  34. const GrSwizzle& outputSwizzle, SkBackingFit, SkBudgeted,
  35. GrProtected, GrInternalSurfaceFlags);
  36. // Wrapped version
  37. GrTextureRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin, const GrSwizzle& textureSwizzle,
  38. const GrSwizzle& outputSwizzle);
  39. bool instantiate(GrResourceProvider*) override;
  40. sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
  41. size_t onUninstantiatedGpuMemorySize() const override;
  42. SkDEBUGCODE(void onValidateSurface(const GrSurface*) override;)
  43. };
  44. #ifdef SK_BUILD_FOR_WIN
  45. #pragma warning(pop)
  46. #endif
  47. #endif