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