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 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 GLenum BackFramebuffer::CheckStatus() { | 2657 GLenum BackFramebuffer::CheckStatus() { |
2675 DCHECK_NE(id_, 0u); | 2658 DCHECK_NE(id_, 0u); |
2676 ScopedGLErrorSuppressor suppressor("BackFramebuffer::CheckStatus", | 2659 ScopedGLErrorSuppressor suppressor("BackFramebuffer::CheckStatus", |
2677 decoder_->GetErrorState()); | 2660 decoder_->GetErrorState()); |
2678 ScopedFrameBufferBinder binder(decoder_, id_); | 2661 ScopedFrameBufferBinder binder(decoder_, id_); |
2679 return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 2662 return glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
2680 } | 2663 } |
2681 | 2664 |
2682 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { | 2665 GLES2Decoder* GLES2Decoder::Create(ContextGroup* group) { |
2683 if (group->gpu_preferences().use_passthrough_cmd_decoder) { | 2666 if (group->gpu_preferences().use_passthrough_cmd_decoder) { |
2684 return CreateGLES2DecoderPassthroughImpl(group); | 2667 return new GLES2DecoderPassthroughImpl(group); |
2685 } | 2668 } |
2686 return new GLES2DecoderImpl(group); | 2669 return new GLES2DecoderImpl(group); |
2687 } | 2670 } |
2688 | 2671 |
2689 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) | 2672 GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group) |
2690 : GLES2Decoder(), | 2673 : GLES2Decoder(), |
2691 group_(group), | 2674 group_(group), |
2692 logger_(&debug_marker_manager_), | 2675 logger_(&debug_marker_manager_), |
2693 state_(group_->feature_info(), this, &logger_), | 2676 state_(group_->feature_info(), this, &logger_), |
2694 attrib_0_buffer_id_(0), | 2677 attrib_0_buffer_id_(0), |
(...skipping 14094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16789 } | 16772 } |
16790 | 16773 |
16791 // Include the auto-generated part of this file. We split this because it means | 16774 // Include the auto-generated part of this file. We split this because it means |
16792 // we can easily edit the non-auto generated parts right here in this file | 16775 // we can easily edit the non-auto generated parts right here in this file |
16793 // instead of having to edit some template or the code generator. | 16776 // instead of having to edit some template or the code generator. |
16794 #include "base/macros.h" | 16777 #include "base/macros.h" |
16795 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 16778 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
16796 | 16779 |
16797 } // namespace gles2 | 16780 } // namespace gles2 |
16798 } // namespace gpu | 16781 } // namespace gpu |
OLD | NEW |