diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrBackendSurface.h | 63 | ||||
-rw-r--r-- | include/gpu/GrCaps.h | 9 | ||||
-rw-r--r-- | include/gpu/GrContext.h | 41 | ||||
-rw-r--r-- | include/gpu/mock/GrMockTypes.h | 3 | ||||
-rw-r--r-- | include/private/SkSurfaceCharacterization.h | 33 |
5 files changed, 10 insertions, 139 deletions
diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index d28ef8af98..ffe422d0a7 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -16,69 +16,6 @@ #include "vk/GrVkTypes.h" #endif -class SK_API GrBackendFormat { -public: - // Creates an invalid backend format. - GrBackendFormat() : fValid(false) {} - - static GrBackendFormat MakeGL(GrGLenum format, GrGLenum target) { - return GrBackendFormat(format, target); - } - -#ifdef SK_VULKAN - static GrBackendFormat MakeVK(VkFormat format) { - return GrBackendFormat(format); - } -#endif - - static GrBackendFormat MakeMock(GrPixelConfig config) { - return GrBackendFormat(config); - } - - GrBackend backend() const {return fBackend; } - - // If the backend API is GL, these return a pointer to the format and target. Otherwise - // it returns nullptr. - const GrGLenum* getGLFormat() const; - const GrGLenum* getGLTarget() const; - -#ifdef SK_VULKAN - // If the backend API is Vulkan, this returns a pointer to a VkFormat. Otherwise - // it returns nullptr - const VkFormat* getVkFormat() const; -#endif - - // If the backend API is Mock, this returns a pointer to a GrPixelConfig. Otherwise - // it returns nullptr. - const GrPixelConfig* getMockFormat() const; - - // Returns true if the backend format has been initialized. - bool isValid() const { return fValid; } - -private: - GrBackendFormat(GrGLenum format, GrGLenum target); - -#ifdef SK_VULKAN - GrBackendFormat(const VkFormat vkFormat); -#endif - - GrBackendFormat(const GrPixelConfig config); - - GrBackend fBackend; - bool fValid; - - union { - struct { - GrGLenum fGLTarget; // GL_TEXTURE_2D, GL_TEXTURE_EXTERNAL or GL_TEXTURE_RECTANGLE - GrGLenum fGLFormat; // the sized, internal format of the GL resource - }; -#ifdef SK_VULKAN - VkFormat fVkFormat; -#endif - GrPixelConfig fMockFormat; - }; -}; - class SK_API GrBackendTexture { public: // Creates an invalid backend texture. diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 1b81b18fcb..0f03f162f0 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -15,7 +15,6 @@ #include "SkRefCnt.h" #include "SkString.h" -class GrBackendFormat; class GrBackendRenderTarget; class GrBackendTexture; struct GrContextOptions; @@ -201,7 +200,7 @@ public: bool validateSurfaceDesc(const GrSurfaceDesc&, GrMipMapped) const; /** - * Returns true if the GrBackendTexture can be used with the supplied SkColorType. If it is + * Returns true if the GrBackendTexutre can we used with the supplied SkColorType. If it is * compatible, the passed in GrPixelConfig will be set to a config that matches the backend * format and requested SkColorType. */ @@ -210,12 +209,6 @@ public: virtual bool validateBackendRenderTarget(const GrBackendRenderTarget&, SkColorType, GrPixelConfig*) const = 0; - // TODO: replace validateBackendTexture and validateBackendRenderTarget with calls to - // getConfigFromBackendFormat? - // TODO: it seems like we could pass the full SkImageInfo and validate its colorSpace too - virtual bool getConfigFromBackendFormat(const GrBackendFormat& format, SkColorType ct, - GrPixelConfig*) const = 0; - protected: /** Subclasses must call this at the end of their constructors in order to apply caps overrides requested by the client. Note that overrides will only reduce the caps never diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 4d937c727e..cb68bb9128 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -17,7 +17,6 @@ #include "GrContextOptions.h" class GrAtlasGlyphCache; -class GrBackendFormat; class GrBackendSemaphore; class GrContextPriv; class GrContextThreadSafeProxy; @@ -37,18 +36,17 @@ class GrResourceCache; class GrResourceProvider; class GrSamplerState; class GrSurfaceProxy; -class GrSwizzle; class GrTextBlobCache; class GrTextContext; class GrTextureProxy; class GrVertexBuffer; struct GrVkBackendContext; +class GrSwizzle; +class SkTraceMemoryDump; class SkImage; -class SkSurfaceCharacterization; class SkSurfaceProps; class SkTaskGroup; -class SkTraceMemoryDump; class SK_API GrContext : public SkRefCnt { public: @@ -437,41 +435,6 @@ class GrContextThreadSafeProxy : public SkRefCnt { public: bool matches(GrContext* context) const { return context->uniqueID() == fContextUniqueID; } - /** - * Create a surface characterization for a DDL that will be replayed into the GrContext - * that created this proxy. On failure the resulting characterization will be invalid (i.e., - * "!c.isValid()"). - * - * @param cacheMaxResourceBytes The max resource bytes limit that will be in effect when the - * DDL created with this characterization is replayed. - * Note: the contract here is that the DDL will be created as - * if it had a full 'cacheMaxResourceBytes' to use. If replayed - * into a GrContext that already has locked GPU memory, the - * replay can exceed the budget. To rephrase, all resource - * allocation decisions are made at record time and at playback - * time the budget limits will be ignored. - * @param ii The image info specifying properties of the SkSurface that - * the DDL created with this characterization will be replayed - * into. - * Note: Ganesh doesn't make use of the SkImageInfo's alphaType - * @param backendFormat Information about the format of the GPU surface that will - * back the SkSurface upon replay - * @param sampleCount The sample count of the SkSurface that the DDL created with - * this characterization will be replayed into - * @param origin The origin of the SkSurface that the DDL created with this - * characterization will be replayed into - * @param surfaceProps The surface properties of the SkSurface that the DDL created - * with this characterization will be replayed into - * @param isMipMapped Will the surface the DDL will be replayed into have space - * allocated for mipmaps? - */ - SkSurfaceCharacterization createCharacterization( - size_t cacheMaxResourceBytes, - const SkImageInfo& ii, const GrBackendFormat& backendFormat, - int sampleCount, GrSurfaceOrigin origin, - const SkSurfaceProps& surfaceProps, - bool isMipMapped); - private: // DDL TODO: need to add unit tests for backend & maybe options GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, diff --git a/include/gpu/mock/GrMockTypes.h b/include/gpu/mock/GrMockTypes.h index 49601cb55e..0954c5eadc 100644 --- a/include/gpu/mock/GrMockTypes.h +++ b/include/gpu/mock/GrMockTypes.h @@ -12,8 +12,7 @@ #include "../private/GrTypesPriv.h" struct GrMockTextureInfo { - GrPixelConfig fConfig; - int fID; + int fID; }; /** diff --git a/include/private/SkSurfaceCharacterization.h b/include/private/SkSurfaceCharacterization.h index 48c22351b3..9e5f40df64 100644 --- a/include/private/SkSurfaceCharacterization.h +++ b/include/private/SkSurfaceCharacterization.h @@ -36,7 +36,8 @@ public: enum class MipMapped : bool { kNo = false, kYes = true }; SkSurfaceCharacterization() - : fCacheMaxResourceBytes(0) + : fCacheMaxResourceCount(0) + , fCacheMaxResourceBytes(0) , fOrigin(kBottomLeft_GrSurfaceOrigin) , fWidth(0) , fHeight(0) @@ -55,10 +56,9 @@ public: SkSurfaceCharacterization& operator=(const SkSurfaceCharacterization& other) = default; GrContextThreadSafeProxy* contextInfo() const { return fContextInfo.get(); } + int cacheMaxResourceCount() const { return fCacheMaxResourceCount; } size_t cacheMaxResourceBytes() const { return fCacheMaxResourceBytes; } - bool isValid() const { return kUnknown_GrPixelConfig != fConfig; } - GrSurfaceOrigin origin() const { return fOrigin; } int width() const { return fWidth; } int height() const { return fHeight; } @@ -73,30 +73,9 @@ public: private: friend class SkSurface_Gpu; // for 'set' - friend class GrContextThreadSafeProxy; // for private ctor - - SkSurfaceCharacterization(sk_sp<GrContextThreadSafeProxy> contextInfo, - size_t cacheMaxResourceBytes, - GrSurfaceOrigin origin, int width, int height, - GrPixelConfig config, GrFSAAType FSAAType, int stencilCnt, - Textureable isTextureable, MipMapped isMipMapped, - sk_sp<SkColorSpace> colorSpace, - const SkSurfaceProps& surfaceProps) - : fContextInfo(std::move(contextInfo)) - , fCacheMaxResourceBytes(cacheMaxResourceBytes) - , fOrigin(origin) - , fWidth(width) - , fHeight(height) - , fConfig(config) - , fFSAAType(FSAAType) - , fStencilCnt(stencilCnt) - , fIsTextureable(isTextureable) - , fIsMipMapped(isMipMapped) - , fColorSpace(std::move(colorSpace)) - , fSurfaceProps(surfaceProps) { - } void set(sk_sp<GrContextThreadSafeProxy> contextInfo, + int cacheMaxResourceCount, size_t cacheMaxResourceBytes, GrSurfaceOrigin origin, int width, int height, @@ -110,6 +89,7 @@ private: SkASSERT(MipMapped::kNo == isMipMapped || Textureable::kYes == isTextureable); fContextInfo = contextInfo; + fCacheMaxResourceCount = cacheMaxResourceCount; fCacheMaxResourceBytes = cacheMaxResourceBytes; fOrigin = origin; @@ -125,6 +105,7 @@ private: } sk_sp<GrContextThreadSafeProxy> fContextInfo; + int fCacheMaxResourceCount; size_t fCacheMaxResourceBytes; GrSurfaceOrigin fOrigin; @@ -149,8 +130,6 @@ public: , fSurfaceProps(0, kUnknown_SkPixelGeometry) { } - bool isValid() const { return false; } - int width() const { return fWidth; } int height() const { return fHeight; } SkColorSpace* colorSpace() const { return fColorSpace.get(); } |