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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 "GLint should be the same size as uint32_t"); | 254 "GLint should be the same size as uint32_t"); |
255 static_assert(sizeof(GLsizei) == sizeof(uint32_t), // NOLINT | 255 static_assert(sizeof(GLsizei) == sizeof(uint32_t), // NOLINT |
256 "GLsizei should be the same size as uint32_t"); | 256 "GLsizei should be the same size as uint32_t"); |
257 static_assert(sizeof(GLfloat) == sizeof(float), // NOLINT | 257 static_assert(sizeof(GLfloat) == sizeof(float), // NOLINT |
258 "GLfloat should be the same size as float"); | 258 "GLfloat should be the same size as float"); |
259 | 259 |
260 // TODO(kbr): the use of this anonymous namespace core dumps the | 260 // TODO(kbr): the use of this anonymous namespace core dumps the |
261 // linker on Mac OS X 10.6 when the symbol ordering file is used | 261 // linker on Mac OS X 10.6 when the symbol ordering file is used |
262 // namespace { | 262 // namespace { |
263 | 263 |
264 // Returns the address of the first byte after a struct. | |
265 template <typename T> | |
266 const void* AddressAfterStruct(const T& pod) { | |
267 return reinterpret_cast<const uint8_t*>(&pod) + sizeof(pod); | |
268 } | |
269 | |
270 // Returns the address of the frst byte after the struct or NULL if size > | |
271 // immediate_data_size. | |
272 template <typename RETURN_TYPE, typename COMMAND_TYPE> | |
273 RETURN_TYPE GetImmediateDataAs(const COMMAND_TYPE& pod, | |
274 uint32_t size, | |
275 uint32_t immediate_data_size) { | |
276 return (size <= immediate_data_size) ? | |
277 static_cast<RETURN_TYPE>(const_cast<void*>(AddressAfterStruct(pod))) : | |
278 NULL; | |
279 } | |
280 | |
281 // Return true if a character belongs to the ASCII subset as defined in | 264 // Return true if a character belongs to the ASCII subset as defined in |
282 // GLSL ES 1.0 spec section 3.1. | 265 // GLSL ES 1.0 spec section 3.1. |
283 static bool CharacterIsValidForGLES(unsigned char c) { | 266 static bool CharacterIsValidForGLES(unsigned char c) { |
284 // Printing characters are valid except " $ ` @ \ ' DEL. | 267 // Printing characters are valid except " $ ` @ \ ' DEL. |
285 if (c >= 32 && c <= 126 && | 268 if (c >= 32 && c <= 126 && |
286 c != '"' && | 269 c != '"' && |
287 c != '$' && | 270 c != '$' && |
288 c != '`' && | 271 c != '`' && |
289 c != '@' && | 272 c != '@' && |
290 c != '\\' && | 273 c != '\\' && |
(...skipping 16523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16814 } | 16797 } |
16815 | 16798 |
16816 // Include the auto-generated part of this file. We split this because it means | 16799 // Include the auto-generated part of this file. We split this because it means |
16817 // we can easily edit the non-auto generated parts right here in this file | 16800 // we can easily edit the non-auto generated parts right here in this file |
16818 // instead of having to edit some template or the code generator. | 16801 // instead of having to edit some template or the code generator. |
16819 #include "base/macros.h" | 16802 #include "base/macros.h" |
16820 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16803 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16821 | 16804 |
16822 } // namespace gles2 | 16805 } // namespace gles2 |
16823 } // namespace gpu | 16806 } // namespace gpu |
OLD | NEW |