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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 uint32_t internal_format, uint32_t texture_type); | 149 uint32_t internal_format, uint32_t texture_type); |
150 | 150 |
151 // Returns a bitmask for the channels the given format supports. | 151 // Returns a bitmask for the channels the given format supports. |
152 // See ChannelBits. | 152 // See ChannelBits. |
153 static uint32_t GetChannelsForFormat(int format); | 153 static uint32_t GetChannelsForFormat(int format); |
154 | 154 |
155 // Returns a bitmask for the channels the given attachment type needs. | 155 // Returns a bitmask for the channels the given attachment type needs. |
156 static uint32_t GetChannelsNeededForAttachmentType( | 156 static uint32_t GetChannelsNeededForAttachmentType( |
157 int type, uint32_t max_color_attachments); | 157 int type, uint32_t max_color_attachments); |
158 | 158 |
| 159 // Return true if value is neither a power of two nor zero. |
159 static bool IsNPOT(uint32_t value) { | 160 static bool IsNPOT(uint32_t value) { |
160 return value > 0 && (value & (value - 1)) != 0; | 161 return (value & (value - 1)) != 0; |
| 162 } |
| 163 |
| 164 // Return true if value is a power of two or zero. |
| 165 static bool IsPOT(uint32_t value) { |
| 166 return (value & (value - 1)) == 0; |
161 } | 167 } |
162 | 168 |
163 static std::string GetStringEnum(uint32_t value); | 169 static std::string GetStringEnum(uint32_t value); |
164 static std::string GetStringBool(uint32_t value); | 170 static std::string GetStringBool(uint32_t value); |
165 static std::string GetStringError(uint32_t value); | 171 static std::string GetStringError(uint32_t value); |
166 | 172 |
167 // Parses a uniform name. | 173 // Parses a uniform name. |
168 // array_pos: the position of the last '[' character in name. | 174 // array_pos: the position of the last '[' character in name. |
169 // element_index: the index of the array element specifed in the name. | 175 // element_index: the index of the array element specifed in the name. |
170 // getting_array: True if name refers to array. | 176 // getting_array: True if name refers to array. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 bool bind_generates_resource_; | 217 bool bind_generates_resource_; |
212 bool fail_if_major_perf_caveat_; | 218 bool fail_if_major_perf_caveat_; |
213 bool lose_context_when_out_of_memory_; | 219 bool lose_context_when_out_of_memory_; |
214 }; | 220 }; |
215 | 221 |
216 } // namespace gles2 | 222 } // namespace gles2 |
217 } // namespace gpu | 223 } // namespace gpu |
218 | 224 |
219 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ | 225 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ |
220 | 226 |
OLD | NEW |