| 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 <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <stack> | 12 #include <stack> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/at_exit.h" | 16 #include "base/at_exit.h" |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/callback_helpers.h" | 18 #include "base/callback_helpers.h" |
| 19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 20 #include "base/debug/trace_event.h" | |
| 21 #include "base/debug/trace_event_synthetic_delay.h" | |
| 22 #include "base/float_util.h" | 20 #include "base/float_util.h" |
| 23 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 24 #include "base/numerics/safe_math.h" | 22 #include "base/numerics/safe_math.h" |
| 25 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 26 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
| 25 #include "base/trace_event/trace_event.h" |
| 26 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #define GLES2_GPU_SERVICE 1 | 28 #define GLES2_GPU_SERVICE 1 |
| 29 #include "gpu/command_buffer/common/debug_marker_manager.h" | 29 #include "gpu/command_buffer/common/debug_marker_manager.h" |
| 30 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 30 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 31 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 31 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 32 #include "gpu/command_buffer/common/id_allocator.h" | 32 #include "gpu/command_buffer/common/id_allocator.h" |
| 33 #include "gpu/command_buffer/common/mailbox.h" | 33 #include "gpu/command_buffer/common/mailbox.h" |
| 34 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | 34 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" |
| 35 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" | 35 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h" |
| 36 #include "gpu/command_buffer/service/buffer_manager.h" | 36 #include "gpu/command_buffer/service/buffer_manager.h" |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 const std::string& name_str); | 1171 const std::string& name_str); |
| 1172 | 1172 |
| 1173 error::Error GetFragDataLocationHelper( | 1173 error::Error GetFragDataLocationHelper( |
| 1174 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, | 1174 GLuint client_id, uint32 location_shm_id, uint32 location_shm_offset, |
| 1175 const std::string& name_str); | 1175 const std::string& name_str); |
| 1176 | 1176 |
| 1177 // Wrapper for glShaderSource. | 1177 // Wrapper for glShaderSource. |
| 1178 void DoShaderSource( | 1178 void DoShaderSource( |
| 1179 GLuint client_id, GLsizei count, const char** data, const GLint* length); | 1179 GLuint client_id, GLsizei count, const char** data, const GLint* length); |
| 1180 | 1180 |
| 1181 // Wrapper for glTransformFeedbackVaryings. |
| 1182 void DoTransformFeedbackVaryings( |
| 1183 GLuint client_program_id, GLsizei count, const char* const* varyings, |
| 1184 GLenum buffer_mode); |
| 1185 |
| 1181 // Clear any textures used by the current program. | 1186 // Clear any textures used by the current program. |
| 1182 bool ClearUnclearedTextures(); | 1187 bool ClearUnclearedTextures(); |
| 1183 | 1188 |
| 1184 // Clears any uncleared attachments attached to the given frame buffer. | 1189 // Clears any uncleared attachments attached to the given frame buffer. |
| 1185 // Returns false if there was a generated GL error. | 1190 // Returns false if there was a generated GL error. |
| 1186 void ClearUnclearedAttachments(GLenum target, Framebuffer* framebuffer); | 1191 void ClearUnclearedAttachments(GLenum target, Framebuffer* framebuffer); |
| 1187 | 1192 |
| 1188 // overridden from GLES2Decoder | 1193 // overridden from GLES2Decoder |
| 1189 bool ClearLevel(unsigned service_id, | 1194 bool ClearLevel(unsigned service_id, |
| 1190 unsigned bind_target, | 1195 unsigned bind_target, |
| (...skipping 5859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7050 } | 7055 } |
| 7051 Shader* shader = GetShaderInfoNotProgram(client_id, "glShaderSource"); | 7056 Shader* shader = GetShaderInfoNotProgram(client_id, "glShaderSource"); |
| 7052 if (!shader) { | 7057 if (!shader) { |
| 7053 return; | 7058 return; |
| 7054 } | 7059 } |
| 7055 // Note: We don't actually call glShaderSource here. We wait until | 7060 // Note: We don't actually call glShaderSource here. We wait until |
| 7056 // the call to glCompileShader. | 7061 // the call to glCompileShader. |
| 7057 shader->set_source(str); | 7062 shader->set_source(str); |
| 7058 } | 7063 } |
| 7059 | 7064 |
| 7065 void GLES2DecoderImpl::DoTransformFeedbackVaryings( |
| 7066 GLuint client_program_id, GLsizei count, const char* const* varyings, |
| 7067 GLenum buffer_mode) { |
| 7068 Program* program = GetProgramInfoNotShader( |
| 7069 client_program_id, "glTransformFeedbackVaryings"); |
| 7070 if (!program) { |
| 7071 return; |
| 7072 } |
| 7073 glTransformFeedbackVaryings( |
| 7074 program->service_id(), count, varyings, buffer_mode); |
| 7075 } |
| 7076 |
| 7060 void GLES2DecoderImpl::DoCompileShader(GLuint client_id) { | 7077 void GLES2DecoderImpl::DoCompileShader(GLuint client_id) { |
| 7061 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompileShader"); | 7078 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCompileShader"); |
| 7062 Shader* shader = GetShaderInfoNotProgram(client_id, "glCompileShader"); | 7079 Shader* shader = GetShaderInfoNotProgram(client_id, "glCompileShader"); |
| 7063 if (!shader) { | 7080 if (!shader) { |
| 7064 return; | 7081 return; |
| 7065 } | 7082 } |
| 7066 ShaderTranslator* translator = NULL; | 7083 ShaderTranslator* translator = NULL; |
| 7067 if (use_shader_translator_) { | 7084 if (use_shader_translator_) { |
| 7068 translator = shader->shader_type() == GL_VERTEX_SHADER ? | 7085 translator = shader->shader_type() == GL_VERTEX_SHADER ? |
| 7069 vertex_translator_.get() : fragment_translator_.get(); | 7086 vertex_translator_.get() : fragment_translator_.get(); |
| (...skipping 4581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11651 } | 11668 } |
| 11652 } | 11669 } |
| 11653 | 11670 |
| 11654 // Include the auto-generated part of this file. We split this because it means | 11671 // Include the auto-generated part of this file. We split this because it means |
| 11655 // we can easily edit the non-auto generated parts right here in this file | 11672 // we can easily edit the non-auto generated parts right here in this file |
| 11656 // instead of having to edit some template or the code generator. | 11673 // instead of having to edit some template or the code generator. |
| 11657 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11674 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 11658 | 11675 |
| 11659 } // namespace gles2 | 11676 } // namespace gles2 |
| 11660 } // namespace gpu | 11677 } // namespace gpu |
| OLD | NEW |