• 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();
37 
38     // Version that this format became supported without extensions
39     gl::Version version;
40 
41     // Extensions that are required if the minimum version is not met
42     std::vector<std::string> versionExtensions;
43 
44     // Sets of extensions that are required to support this format
45     // All the extensions in one of the sets have to be available for a format to be supported
46     std::vector<std::vector<std::string>> requiredExtensions;
47 };
48 
49 struct InternalFormat
50 {
51     InternalFormat();
52     InternalFormat(const InternalFormat &other);
53     ~InternalFormat();
54 
55     SupportRequirement texture;
56     SupportRequirement filter;
57     // Texture created with InternalFormat can be used in glFramebufferTexture2D
58     SupportRequirement textureAttachment;
59     // Renderbuffer created with InternalFormat can be used in glFramebufferRenderbuffer
60     SupportRequirement renderbuffer;
61 };
62 const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, StandardGL standard);
63 
64 struct TexImageFormat
65 {
66     GLenum internalFormat;
67     GLenum format;
68     GLenum type;
69 };
70 TexImageFormat GetTexImageFormat(const FunctionsGL *functions,
71                                  const angle::FeaturesGL &features,
72                                  GLenum internalFormat,
73                                  GLenum format,
74                                  GLenum type);
75 
76 struct TexSubImageFormat
77 {
78     GLenum format;
79     GLenum type;
80 };
81 TexSubImageFormat GetTexSubImageFormat(const FunctionsGL *functions,
82                                        const angle::FeaturesGL &features,
83                                        GLenum format,
84                                        GLenum type);
85 
86 struct CompressedTexImageFormat
87 {
88     GLenum internalFormat;
89 };
90 CompressedTexImageFormat GetCompressedTexImageFormat(const FunctionsGL *functions,
91                                                      const angle::FeaturesGL &features,
92                                                      GLenum internalFormat);
93 
94 struct CompressedTexSubImageFormat
95 {
96     GLenum format;
97 };
98 CompressedTexSubImageFormat GetCompressedSubTexImageFormat(const FunctionsGL *functions,
99                                                            const angle::FeaturesGL &features,
100                                                            GLenum format);
101 
102 struct CopyTexImageImageFormat
103 {
104     GLenum internalFormat;
105 };
106 CopyTexImageImageFormat GetCopyTexImageImageFormat(const FunctionsGL *functions,
107                                                    const angle::FeaturesGL &features,
108                                                    GLenum internalFormat,
109                                                    GLenum framebufferType);
110 
111 struct TexStorageFormat
112 {
113     GLenum internalFormat;
114 };
115 TexStorageFormat GetTexStorageFormat(const FunctionsGL *functions,
116                                      const angle::FeaturesGL &features,
117                                      GLenum internalFormat);
118 
119 struct RenderbufferFormat
120 {
121     GLenum internalFormat;
122 };
123 RenderbufferFormat GetRenderbufferFormat(const FunctionsGL *functions,
124                                          const angle::FeaturesGL &features,
125                                          GLenum internalFormat);
126 
127 struct ReadPixelsFormat
128 {
129     GLenum format;
130     GLenum type;
131 };
132 ReadPixelsFormat GetReadPixelsFormat(const FunctionsGL *functions,
133                                      const angle::FeaturesGL &features,
134                                      GLenum readAttachmentFormat,
135                                      GLenum format,
136                                      GLenum type);
137 }  // namespace nativegl
138 
139 }  // namespace rx
140 
141 #endif  // LIBANGLE_RENDERER_GL_FORMATUTILSGL_H_
142