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 GrGLBackendSurface_DEFINED
9#define GrGLBackendSurface_DEFINED
10
11#include "include/gpu/gl/GrGLTypes.h"
12#include "include/private/base/SkAPI.h"
13
14#include <string_view>
15
16class GrBackendFormat;
17class GrBackendTexture;
18class GrBackendRenderTarget;
19
20namespace skgpu { enum class Mipmapped : bool; }
21
22namespace GrBackendFormats {
23SK_API GrBackendFormat MakeGL(GrGLenum format, GrGLenum target);
24
25SK_API GrGLFormat AsGLFormat(const GrBackendFormat&);
26SK_API GrGLenum AsGLFormatEnum(const GrBackendFormat&);
27} // namespace GrBackendFormats
28
29namespace GrBackendTextures {
30// The GrGLTextureInfo must have a valid fFormat.
31SK_API GrBackendTexture MakeGL(int width,
32 int height,
33 skgpu::Mipmapped,
34 const GrGLTextureInfo& glInfo,
35 std::string_view label = {});
36
37// If the backend API is GL, copies a snapshot of the GrGLTextureInfo struct into the passed in
38// pointer and returns true. Otherwise returns false if the backend API is not GL.
39SK_API bool GetGLTextureInfo(const GrBackendTexture&, GrGLTextureInfo*);
40
41// Call this to indicate that the texture parameters have been modified in the GL context
42// externally to GrContext.
43SK_API void GLTextureParametersModified(GrBackendTexture*);
44} // namespace GrBackendTextures
45
46namespace GrBackendRenderTargets {
47// The GrGLTextureInfo must have a valid fFormat. If wrapping in an SkSurface we require the
48// stencil bits to be either 0, 8 or 16.
49SK_API GrBackendRenderTarget MakeGL(int width,
50 int height,
51 int sampleCnt,
52 int stencilBits,
53 const GrGLFramebufferInfo& glInfo);
54
55SK_API bool GetGLFramebufferInfo(const GrBackendRenderTarget&, GrGLFramebufferInfo*);
56} // namespace GrBackendRenderTargets
57
58#endif
59

source code of flutter_engine/third_party/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h