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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 "GLint should be the same size as uint32_t"); | 261 "GLint should be the same size as uint32_t"); |
262 static_assert(sizeof(GLsizei) == sizeof(uint32_t), // NOLINT | 262 static_assert(sizeof(GLsizei) == sizeof(uint32_t), // NOLINT |
263 "GLsizei should be the same size as uint32_t"); | 263 "GLsizei should be the same size as uint32_t"); |
264 static_assert(sizeof(GLfloat) == sizeof(float), // NOLINT | 264 static_assert(sizeof(GLfloat) == sizeof(float), // NOLINT |
265 "GLfloat should be the same size as float"); | 265 "GLfloat should be the same size as float"); |
266 | 266 |
267 // TODO(kbr): the use of this anonymous namespace core dumps the | 267 // TODO(kbr): the use of this anonymous namespace core dumps the |
268 // linker on Mac OS X 10.6 when the symbol ordering file is used | 268 // linker on Mac OS X 10.6 when the symbol ordering file is used |
269 // namespace { | 269 // namespace { |
270 | 270 |
271 // Returns the address of the first byte after a struct. | |
272 template <typename T> | |
273 const void* AddressAfterStruct(const T& pod) { | |
274 return reinterpret_cast<const uint8_t*>(&pod) + sizeof(pod); | |
275 } | |
276 | |
277 // Returns the address of the frst byte after the struct or NULL if size > | |
278 // immediate_data_size. | |
279 template <typename RETURN_TYPE, typename COMMAND_TYPE> | |
280 RETURN_TYPE GetImmediateDataAs(const COMMAND_TYPE& pod, | |
281 uint32_t size, | |
282 uint32_t immediate_data_size) { | |
283 return (size <= immediate_data_size) ? | |
284 static_cast<RETURN_TYPE>(const_cast<void*>(AddressAfterStruct(pod))) : | |
285 NULL; | |
286 } | |
287 | |
288 // Return true if a character belongs to the ASCII subset as defined in | 271 // Return true if a character belongs to the ASCII subset as defined in |
289 // GLSL ES 1.0 spec section 3.1. | 272 // GLSL ES 1.0 spec section 3.1. |
290 static bool CharacterIsValidForGLES(unsigned char c) { | 273 static bool CharacterIsValidForGLES(unsigned char c) { |
291 // Printing characters are valid except " $ ` @ \ ' DEL. | 274 // Printing characters are valid except " $ ` @ \ ' DEL. |
292 if (c >= 32 && c <= 126 && | 275 if (c >= 32 && c <= 126 && |
293 c != '"' && | 276 c != '"' && |
294 c != '$' && | 277 c != '$' && |
295 c != '`' && | 278 c != '`' && |
296 c != '@' && | 279 c != '@' && |
297 c != '\\' && | 280 c != '\\' && |
(...skipping 16527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16825 } | 16808 } |
16826 | 16809 |
16827 // Include the auto-generated part of this file. We split this because it means | 16810 // Include the auto-generated part of this file. We split this because it means |
16828 // we can easily edit the non-auto generated parts right here in this file | 16811 // we can easily edit the non-auto generated parts right here in this file |
16829 // instead of having to edit some template or the code generator. | 16812 // instead of having to edit some template or the code generator. |
16830 #include "base/macros.h" | 16813 #include "base/macros.h" |
16831 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16814 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16832 | 16815 |
16833 } // namespace gles2 | 16816 } // namespace gles2 |
16834 } // namespace gpu | 16817 } // namespace gpu |
OLD | NEW |