• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2015 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // formatutilsgl.h: Queries for GL image formats and their translations to native
8 // GL formats.
9 
10 #ifndef LIBANGLE_RENDERER_GL_FORMATUTILSGL_H_
11 #define LIBANGLE_RENDERER_GL_FORMATUTILSGL_H_
12 
13 #include <map>
14 #include <string>
15 #include <vector>
16 
17 #include "angle_gl.h"
18 #include "libANGLE/Version.h"
19 #include "libANGLE/renderer/gl/FunctionsGL.h"
20 
21 namespace angle
22 {
23 struct FeaturesGL;
24 }  // namespace angle
25 
26 namespace rx
27 {
28 
29 namespace nativegl
30 {
31 
32 struct SupportRequirement
33 {
34     SupportRequirement();
35     SupportRequirement(const SupportRequirement &other);
36     SupportRequirement &operator=(const SupportRequirement &other);
37 
38     ~SupportRequirement();
39 
40     // Version that this format became supported without extensions
41     gl::Version version;
42 
43     // Extensions that are required if the minimum version is not met
44     std::vector<std::string> versionExtensions;
45 
46     // Sets of extensions that are required to support this format
47     // All the extensions in one of the sets have to be available for a format to be supported
48     std::vector<std::vector<std::string>> requiredExtensions;
49 };
50 
51 struct InternalFormat
52 {
53     InternalFormat();
54     InternalFormat(const InternalFormat &other);
55     ~InternalFormat();
56 
57     SupportRequirement texture;
58     SupportRequirement filter;
59     // Texture created with InternalFormat can be used in glFramebufferTexture2D
60     SupportRequirement textureAttachment;
61     // Renderbuffer created with InternalFormat can be used in glFramebufferRenderbuffer
62     SupportRequirement renderbuffer;
63 };
64 const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, StandardGL standard);
65 
66 struct TexImageFormat
67 {
68     GLenum internalFormat = GL_NONE;
69     GLenum format         = GL_NONE;
70     GLenum type           = GL_NONE;
71 };
72 TexImageFormat GetTexImageFormat(const FunctionsGL *functions,
73                                  const angle::FeaturesGL &features,
74                                  GLenum internalFormat,
75                                  GLenum format,
76                                  GLenum type);
77 
78 struct TexSubImageFormat
79 {
80     GLenum format = GL_NONE;
81     GLenum type   = GL_NONE;
82 };
83 TexSubImageFormat GetTexSubImageFormat(const FunctionsGL *functions,
84                                        const angle::FeaturesGL &features,
85                                        GLenum format,
86                                        GLenum type);
87 
88 struct CompressedTexImageFormat
89 {
90     GLenum internalFormat = GL_NONE;
91 };
92 CompressedTexImageFormat GetCompressedTexImageFormat(const FunctionsGL *functions,
93                                                      const angle::FeaturesGL &features,
94                                                      GLenum internalFormat);
95 
96 struct CompressedTexSubImageFormat
97 {
98     GLenum format = GL_NONE;
99 };
100 CompressedTexSubImageFormat GetCompressedSubTexImageFormat(const FunctionsGL *functions,
101                                                            const angle::FeaturesGL &features,
102                                                            GLenum format);
103 
104 struct CopyTexImageImageFormat
105 {
106     GLenum internalFormat = GL_NONE;
107 };
108 CopyTexImageImageFormat GetCopyTexImageImageFormat(const FunctionsGL *functions,
109                                                    const angle::FeaturesGL &features,
110                                                    GLenum internalFormat,
111                                                    GLenum framebufferType);
112 
113 struct TexStorageFormat
114 {
115     GLenum internalFormat = GL_NONE;
116 };
117 TexStorageFormat GetTexStorageFormat(const FunctionsGL *functions,
118                                      const angle::FeaturesGL &features,
119                                      GLenum internalFormat);
120 
121 struct RenderbufferFormat
122 {
123     GLenum internalFormat = GL_NONE;
124 };
125 RenderbufferFormat GetRenderbufferFormat(const FunctionsGL *functions,
126                                          const angle::FeaturesGL &features,
127                                          GLenum internalFormat);
128 
129 struct ReadPixelsFormat
130 {
131     GLenum format = GL_NONE;
132     GLenum type   = GL_NONE;
133 };
134 ReadPixelsFormat GetReadPixelsFormat(const FunctionsGL *functions,
135                                      const angle::FeaturesGL &features,
136                                      GLenum readAttachmentFormat,
137                                      GLenum format,
138                                      GLenum type);
139 }  // namespace nativegl
140 
141 }  // namespace rx
142 
143 #endif  // LIBANGLE_RENDERER_GL_FORMATUTILSGL_H_
144