1 /* 2 * Copyright 2023 Google LLC 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 GrGLBackendSurfacePriv_DEFINED 9 #define GrGLBackendSurfacePriv_DEFINED 10 11 #include "include/core/SkRefCnt.h" 12 #include "include/gpu/GrBackendSurface.h" 13 #include "include/gpu/GrTypes.h" 14 #include "src/gpu/ganesh/GrBackendSurfacePriv.h" 15 #include "src/gpu/ganesh/gl/GrGLTypesPriv.h" 16 17 #include <string_view> 18 19 struct GrGLTextureInfo; 20 namespace skgpu { enum class Mipmapped : bool; } 21 22 namespace GrBackendTextures { 23 // The GrGLTextureInfo must have a valid fFormat. 24 GrBackendTexture MakeGL(int width, 25 int height, 26 skgpu::Mipmapped, 27 const GrGLTextureInfo& glInfo, 28 sk_sp<GrGLTextureParameters> params, 29 std::string_view label = {}); 30 } // namespace GrBackendTextures 31 32 class GrGLBackendTextureData final : public GrBackendTextureData { 33 public: 34 GrGLBackendTextureData(const GrGLTextureInfo& info, sk_sp<GrGLTextureParameters> params); 35 info()36 const GrGLBackendTextureInfo& info() const { return fGLInfo; } 37 38 private: 39 void copyTo(AnyTextureData&) const override; 40 bool isProtected() const override; 41 bool equal(const GrBackendTextureData* that) const override; 42 bool isSameTexture(const GrBackendTextureData* that) const override; 43 GrBackendFormat getBackendFormat() const override; 44 #if defined(SK_DEBUG) type()45 GrBackendApi type() const override { return GrBackendApi::kOpenGL; } 46 #endif 47 48 GrGLBackendTextureInfo fGLInfo; 49 }; 50 51 #endif 52