| 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 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2691 GLenum BackFramebuffer::CheckStatus() { | 2674 GLenum BackFramebuffer::CheckStatus() { |
| 2692 DCHECK_NE(id_, 0u); | 2675 DCHECK_NE(id_, 0u); |
| 2693 ScopedGLErrorSuppressor suppressor("BackFramebuffer::CheckStatus", | 2676 ScopedGLErrorSuppressor suppressor("BackFramebuffer::CheckStatus", |
| 2694 decoder_->GetErrorState()); | 2677 decoder_->GetErrorState()); |
| 2695 ScopedFrameBufferBinder binder(decoder_, id_); | 2678 ScopedFrameBufferBinder binder(decoder_, id_); |
| 2696 return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 2679 return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
| 2697 } | 2680 } |
| 2698 | 2681 |
| 2699 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { | 2682 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { |
| 2700 if (group->gpu_preferences().use_passthrough_cmd_decoder) { | 2683 if (group->gpu_preferences().use_passthrough_cmd_decoder) { |
| 2701 return CreateGLES2DecoderPassthroughImpl(group); | 2684 return new GLES2DecoderPassthroughImpl(group); |
| 2702 } | 2685 } |
| 2703 return new GLES2DecoderImpl(group); | 2686 return new GLES2DecoderImpl(group); |
| 2704 } | 2687 } |
| 2705 | 2688 |
| 2706 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) | 2689 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) |
| 2707 : GLES2Decoder(), | 2690 : GLES2Decoder(), |
| 2708 group_(group), | 2691 group_(group), |
| 2709 logger_(&debug_marker_manager_), | 2692 logger_(&debug_marker_manager_), |
| 2710 state_(group_->feature_info(), this, &logger_), | 2693 state_(group_->feature_info(), this, &logger_), |
| 2711 attrib_0_buffer_id_(0), | 2694 attrib_0_buffer_id_(0), |
| (...skipping 14204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16916 } | 16899 } |
| 16917 | 16900 |
| 16918 // Include the auto-generated part of this file. We split this because it means | 16901 // Include the auto-generated part of this file. We split this because it means |
| 16919 // we can easily edit the non-auto generated parts right here in this file | 16902 // we can easily edit the non-auto generated parts right here in this file |
| 16920 // instead of having to edit some template or the code generator. | 16903 // instead of having to edit some template or the code generator. |
| 16921 #include "base/macros.h" | 16904 #include "base/macros.h" |
| 16922 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16905 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 16923 | 16906 |
| 16924 } // namespace gles2 | 16907 } // namespace gles2 |
| 16925 } // namespace gpu | 16908 } // namespace gpu |
| OLD | NEW |