| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <vector> | 5 #include <vector> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <build/build_config.h> | 8 #include <build/build_config.h> |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #define GLES2_GPU_SERVICE 1 | 10 #define GLES2_GPU_SERVICE 1 |
| 11 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 11 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 12 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 12 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 13 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 13 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 14 #include "gpu/command_buffer/service/gl_utils.h" | 14 #include "gpu/command_buffer/service/gl_utils.h" |
| 15 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 15 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 16 | 16 |
| 17 namespace command_buffer { | 17 namespace gpu { |
| 18 namespace gles2 { | 18 namespace gles2 { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // Returns the address of the first byte after a struct. | 22 // Returns the address of the first byte after a struct. |
| 23 template <typename T> | 23 template <typename T> |
| 24 const void* AddressAfterStruct(const T& pod) { | 24 const void* AddressAfterStruct(const T& pod) { |
| 25 return reinterpret_cast<const uint8*>(&pod) + sizeof(pod); | 25 return reinterpret_cast<const uint8*>(&pod) + sizeof(pod); |
| 26 } | 26 } |
| 27 | 27 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 kNoError = 0, | 96 kNoError = 0, |
| 97 kInvalidEnum, | 97 kInvalidEnum, |
| 98 kInvalidValue, | 98 kInvalidValue, |
| 99 kInvalidOperation, | 99 kInvalidOperation, |
| 100 kOutOfMemory, | 100 kOutOfMemory, |
| 101 kInvalidFrameBufferOperation, | 101 kInvalidFrameBufferOperation, |
| 102 }; | 102 }; |
| 103 } | 103 } |
| 104 | 104 |
| 105 uint32 GLErrorToErrorBit(GLenum error) { | 105 uint32 GLErrorToErrorBit(GLenum error) { |
| 106 switch(error) { | 106 switch (error) { |
| 107 case GL_INVALID_ENUM: | 107 case GL_INVALID_ENUM: |
| 108 return GLErrorBit::kInvalidEnum; | 108 return GLErrorBit::kInvalidEnum; |
| 109 case GL_INVALID_VALUE: | 109 case GL_INVALID_VALUE: |
| 110 return GLErrorBit::kInvalidValue; | 110 return GLErrorBit::kInvalidValue; |
| 111 case GL_INVALID_OPERATION: | 111 case GL_INVALID_OPERATION: |
| 112 return GLErrorBit::kInvalidOperation; | 112 return GLErrorBit::kInvalidOperation; |
| 113 case GL_OUT_OF_MEMORY: | 113 case GL_OUT_OF_MEMORY: |
| 114 return GLErrorBit::kOutOfMemory; | 114 return GLErrorBit::kOutOfMemory; |
| 115 case GL_INVALID_FRAMEBUFFER_OPERATION: | 115 case GL_INVALID_FRAMEBUFFER_OPERATION: |
| 116 return GLErrorBit::kInvalidFrameBufferOperation; | 116 return GLErrorBit::kInvalidFrameBufferOperation; |
| 117 default: | 117 default: |
| 118 DCHECK(false); | 118 DCHECK(false); |
| 119 return GLErrorBit::kNoError; | 119 return GLErrorBit::kNoError; |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 GLenum GLErrorBitToGLError(uint32 error_bit) { | 123 GLenum GLErrorBitToGLError(uint32 error_bit) { |
| 124 switch(error_bit) { | 124 switch (error_bit) { |
| 125 case GLErrorBit::kInvalidEnum: | 125 case GLErrorBit::kInvalidEnum: |
| 126 return GL_INVALID_ENUM; | 126 return GL_INVALID_ENUM; |
| 127 case GLErrorBit::kInvalidValue: | 127 case GLErrorBit::kInvalidValue: |
| 128 return GL_INVALID_VALUE; | 128 return GL_INVALID_VALUE; |
| 129 case GLErrorBit::kInvalidOperation: | 129 case GLErrorBit::kInvalidOperation: |
| 130 return GL_INVALID_OPERATION; | 130 return GL_INVALID_OPERATION; |
| 131 case GLErrorBit::kOutOfMemory: | 131 case GLErrorBit::kOutOfMemory: |
| 132 return GL_OUT_OF_MEMORY; | 132 return GL_OUT_OF_MEMORY; |
| 133 case GLErrorBit::kInvalidFrameBufferOperation: | 133 case GLErrorBit::kInvalidFrameBufferOperation: |
| 134 return GL_INVALID_FRAMEBUFFER_OPERATION; | 134 return GL_INVALID_FRAMEBUFFER_OPERATION; |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 } else { | 691 } else { |
| 692 result = parse_error::kParseInvalidArguments; | 692 result = parse_error::kParseInvalidArguments; |
| 693 } | 693 } |
| 694 } else { | 694 } else { |
| 695 result = DoCommonCommand(command, arg_count, cmd_data); | 695 result = DoCommonCommand(command, arg_count, cmd_data); |
| 696 } | 696 } |
| 697 return result; | 697 return result; |
| 698 } | 698 } |
| 699 | 699 |
| 700 } // namespace gles2 | 700 } // namespace gles2 |
| 701 } // namespace command_buffer | 701 } // namespace gpu |
| 702 | 702 |
| 703 // This is included so the compiler will make these inline. | 703 // This is included so the compiler will make these inline. |
| 704 #include "gpu/command_buffer/service/gles2_cmd_decoder_validate.h" | 704 #include "gpu/command_buffer/service/gles2_cmd_decoder_validate.h" |
| 705 | 705 |
| 706 namespace command_buffer { | 706 namespace gpu { |
| 707 namespace gles2 { | 707 namespace gles2 { |
| 708 | 708 |
| 709 void GLES2DecoderImpl::CreateProgramHelper(GLuint client_id) { | 709 void GLES2DecoderImpl::CreateProgramHelper(GLuint client_id) { |
| 710 // TODO(gman): verify client_id is unused. | 710 // TODO(gman): verify client_id is unused. |
| 711 GLuint service_id = glCreateProgram(); | 711 GLuint service_id = glCreateProgram(); |
| 712 if (service_id) { | 712 if (service_id) { |
| 713 id_map_.AddMapping(client_id, service_id); | 713 id_map_.AddMapping(client_id, service_id); |
| 714 } | 714 } |
| 715 } | 715 } |
| 716 | 716 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 // TODO(gman): Implement. | 1224 // TODO(gman): Implement. |
| 1225 return parse_error::kParseNoError; | 1225 return parse_error::kParseNoError; |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 // Include the auto-generated part of this file. We split this because it means | 1228 // Include the auto-generated part of this file. We split this because it means |
| 1229 // we can easily edit the non-auto generated parts right here in this file | 1229 // we can easily edit the non-auto generated parts right here in this file |
| 1230 // instead of having to edit some template or the code generator. | 1230 // instead of having to edit some template or the code generator. |
| 1231 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 1231 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 1232 | 1232 |
| 1233 } // namespace gles2 | 1233 } // namespace gles2 |
| 1234 } // namespace command_buffer | 1234 } // namespace gpu |
| 1235 | 1235 |
| OLD | NEW |