Debian Codegraph @

include/gpu/ganesh/gl/GrGLBackendSurface.h

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