OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is here so other GLES2 related files can have a common set of | 5 // This file is here so other GLES2 related files can have a common set of |
6 // includes where appropriate. | 6 // includes where appropriate. |
7 | 7 |
8 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ | 8 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ |
9 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ | 9 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 kGreen = 0x2, | 62 kGreen = 0x2, |
63 kBlue = 0x4, | 63 kBlue = 0x4, |
64 kAlpha = 0x8, | 64 kAlpha = 0x8, |
65 kDepth = 0x10000, | 65 kDepth = 0x10000, |
66 kStencil = 0x20000, | 66 kStencil = 0x20000, |
67 | 67 |
68 kRGB = kRed | kGreen | kBlue, | 68 kRGB = kRed | kGreen | kBlue, |
69 kRGBA = kRGB | kAlpha | 69 kRGBA = kRGB | kAlpha |
70 }; | 70 }; |
71 | 71 |
| 72 enum TargetESVersion { |
| 73 kES2, |
| 74 kES3 |
| 75 }; |
| 76 |
72 struct EnumToString { | 77 struct EnumToString { |
73 uint32_t value; | 78 uint32_t value; |
74 const char* name; | 79 const char* name; |
75 }; | 80 }; |
76 | 81 |
77 GLES2Util() | 82 GLES2Util() |
78 : num_compressed_texture_formats_(0), | 83 : num_compressed_texture_formats_(0), |
79 num_shader_binary_formats_(0) { | 84 num_shader_binary_formats_(0) { |
80 } | 85 } |
81 | 86 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 static size_t GetGLTypeSizeForPathCoordType(uint32_t type); | 135 static size_t GetGLTypeSizeForPathCoordType(uint32_t type); |
131 | 136 |
132 static uint32_t GLErrorToErrorBit(uint32_t gl_error); | 137 static uint32_t GLErrorToErrorBit(uint32_t gl_error); |
133 | 138 |
134 static uint32_t GLErrorBitToGLError(uint32_t error_bit); | 139 static uint32_t GLErrorBitToGLError(uint32_t error_bit); |
135 | 140 |
136 static uint32_t IndexToGLFaceTarget(int index); | 141 static uint32_t IndexToGLFaceTarget(int index); |
137 | 142 |
138 static size_t GLTargetToFaceIndex(uint32_t target); | 143 static size_t GLTargetToFaceIndex(uint32_t target); |
139 | 144 |
140 static uint32_t GetPreferredGLReadPixelsFormat(uint32_t internal_format); | 145 static uint32_t GetGLReadPixelsImplementationFormat( |
| 146 uint32_t internal_format, TargetESVersion target_es_version); |
141 | 147 |
142 static uint32_t GetPreferredGLReadPixelsType( | 148 static uint32_t GetGLReadPixelsImplementationType( |
143 uint32_t internal_format, uint32_t texture_type); | 149 uint32_t internal_format, uint32_t texture_type, |
| 150 TargetESVersion target_es_version); |
144 | 151 |
145 // Returns a bitmask for the channels the given format supports. | 152 // Returns a bitmask for the channels the given format supports. |
146 // See ChannelBits. | 153 // See ChannelBits. |
147 static uint32_t GetChannelsForFormat(int format); | 154 static uint32_t GetChannelsForFormat(int format); |
148 | 155 |
149 // Returns a bitmask for the channels the given attachment type needs. | 156 // Returns a bitmask for the channels the given attachment type needs. |
150 static uint32_t GetChannelsNeededForAttachmentType( | 157 static uint32_t GetChannelsNeededForAttachmentType( |
151 int type, uint32_t max_color_attachments); | 158 int type, uint32_t max_color_attachments); |
152 | 159 |
153 // Return true if value is neither a power of two nor zero. | 160 // Return true if value is neither a power of two nor zero. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 bool lose_context_when_out_of_memory; | 231 bool lose_context_when_out_of_memory; |
225 // 0 if not a WebGL context. | 232 // 0 if not a WebGL context. |
226 unsigned webgl_version; | 233 unsigned webgl_version; |
227 }; | 234 }; |
228 | 235 |
229 } // namespace gles2 | 236 } // namespace gles2 |
230 } // namespace gpu | 237 } // namespace gpu |
231 | 238 |
232 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ | 239 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ |
233 | 240 |
OLD | NEW |