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> |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 base::TimeDelta total_processing_commands_time_; | 1871 base::TimeDelta total_processing_commands_time_; |
1872 | 1872 |
1873 // States related to each manager. | 1873 // States related to each manager. |
1874 DecoderTextureState texture_state_; | 1874 DecoderTextureState texture_state_; |
1875 DecoderFramebufferState framebuffer_state_; | 1875 DecoderFramebufferState framebuffer_state_; |
1876 | 1876 |
1877 scoped_ptr<GPUTracer> gpu_tracer_; | 1877 scoped_ptr<GPUTracer> gpu_tracer_; |
1878 scoped_ptr<GPUStateTracer> gpu_state_tracer_; | 1878 scoped_ptr<GPUStateTracer> gpu_state_tracer_; |
1879 const unsigned char* cb_command_trace_category_; | 1879 const unsigned char* cb_command_trace_category_; |
1880 const unsigned char* gpu_decoder_category_; | 1880 const unsigned char* gpu_decoder_category_; |
1881 const unsigned char* gpu_group_marker_category_; | |
1882 int gpu_trace_level_; | 1881 int gpu_trace_level_; |
1883 bool gpu_trace_commands_; | 1882 bool gpu_trace_commands_; |
1884 bool gpu_debug_commands_; | 1883 bool gpu_debug_commands_; |
1885 | 1884 |
1886 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; | 1885 std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; |
1887 | 1886 |
1888 // Used to validate multisample renderbuffers if needed | 1887 // Used to validate multisample renderbuffers if needed |
1889 GLuint validation_texture_; | 1888 GLuint validation_texture_; |
1890 GLuint validation_fbo_multisample_; | 1889 GLuint validation_fbo_multisample_; |
1891 GLuint validation_fbo_; | 1890 GLuint validation_fbo_; |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2389 switches::kEnableGPUServiceLoggingGPU)), | 2388 switches::kEnableGPUServiceLoggingGPU)), |
2390 viewport_max_width_(0), | 2389 viewport_max_width_(0), |
2391 viewport_max_height_(0), | 2390 viewport_max_height_(0), |
2392 texture_state_(group_->feature_info() | 2391 texture_state_(group_->feature_info() |
2393 ->workarounds() | 2392 ->workarounds() |
2394 .texsubimage2d_faster_than_teximage2d), | 2393 .texsubimage2d_faster_than_teximage2d), |
2395 cb_command_trace_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( | 2394 cb_command_trace_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( |
2396 TRACE_DISABLED_BY_DEFAULT("cb_command"))), | 2395 TRACE_DISABLED_BY_DEFAULT("cb_command"))), |
2397 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( | 2396 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( |
2398 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), | 2397 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), |
2399 gpu_group_marker_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( | |
2400 TRACE_DISABLED_BY_DEFAULT("gpu_group_marker"))), | |
2401 gpu_trace_level_(2), | 2398 gpu_trace_level_(2), |
2402 gpu_trace_commands_(false), | 2399 gpu_trace_commands_(false), |
2403 gpu_debug_commands_(false), | 2400 gpu_debug_commands_(false), |
2404 validation_texture_(0), | 2401 validation_texture_(0), |
2405 validation_fbo_multisample_(0), | 2402 validation_fbo_multisample_(0), |
2406 validation_fbo_(0) { | 2403 validation_fbo_(0) { |
2407 DCHECK(group); | 2404 DCHECK(group); |
2408 | 2405 |
2409 attrib_0_value_.v[0] = 0.0f; | 2406 attrib_0_value_.v[0] = 0.0f; |
2410 attrib_0_value_.v[1] = 0.0f; | 2407 attrib_0_value_.v[1] = 0.0f; |
(...skipping 8588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10999 length ? std::string(marker, length) : std::string(marker)); | 10996 length ? std::string(marker, length) : std::string(marker)); |
11000 } | 10997 } |
11001 | 10998 |
11002 void GLES2DecoderImpl::DoPushGroupMarkerEXT( | 10999 void GLES2DecoderImpl::DoPushGroupMarkerEXT( |
11003 GLsizei length, const GLchar* marker) { | 11000 GLsizei length, const GLchar* marker) { |
11004 if (!marker) { | 11001 if (!marker) { |
11005 marker = ""; | 11002 marker = ""; |
11006 } | 11003 } |
11007 std::string name = length ? std::string(marker, length) : std::string(marker); | 11004 std::string name = length ? std::string(marker, length) : std::string(marker); |
11008 debug_marker_manager_.PushGroup(name); | 11005 debug_marker_manager_.PushGroup(name); |
11009 if (*gpu_group_marker_category_) { | 11006 gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_group_marker"), name, |
11010 gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_group_marker"), name, | 11007 kTraceGroupMarker); |
11011 kTraceGroupMarker); | |
11012 } | |
11013 } | 11008 } |
11014 | 11009 |
11015 void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) { | 11010 void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) { |
11016 debug_marker_manager_.PopGroup(); | 11011 debug_marker_manager_.PopGroup(); |
11017 if (*gpu_group_marker_category_) { | 11012 gpu_tracer_->End(kTraceGroupMarker); |
11018 gpu_tracer_->End(kTraceGroupMarker); | |
11019 } | |
11020 } | 11013 } |
11021 | 11014 |
11022 void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM( | 11015 void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM( |
11023 GLenum target, GLint image_id) { | 11016 GLenum target, GLint image_id) { |
11024 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM"); | 11017 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM"); |
11025 | 11018 |
11026 if (target == GL_TEXTURE_CUBE_MAP) { | 11019 if (target == GL_TEXTURE_CUBE_MAP) { |
11027 LOCAL_SET_GL_ERROR( | 11020 LOCAL_SET_GL_ERROR( |
11028 GL_INVALID_ENUM, | 11021 GL_INVALID_ENUM, |
11029 "glBindTexImage2DCHROMIUM", "invalid target"); | 11022 "glBindTexImage2DCHROMIUM", "invalid target"); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11117 return error::kInvalidArguments; | 11110 return error::kInvalidArguments; |
11118 } | 11111 } |
11119 | 11112 |
11120 std::string category_name; | 11113 std::string category_name; |
11121 std::string trace_name; | 11114 std::string trace_name; |
11122 if (!category_bucket->GetAsString(&category_name) || | 11115 if (!category_bucket->GetAsString(&category_name) || |
11123 !name_bucket->GetAsString(&trace_name)) { | 11116 !name_bucket->GetAsString(&trace_name)) { |
11124 return error::kInvalidArguments; | 11117 return error::kInvalidArguments; |
11125 } | 11118 } |
11126 | 11119 |
11127 TRACE_EVENT_COPY_ASYNC_BEGIN0(category_name.c_str(), trace_name.c_str(), | |
11128 this); | |
11129 if (!gpu_tracer_->Begin(category_name, trace_name, kTraceCHROMIUM)) { | 11120 if (!gpu_tracer_->Begin(category_name, trace_name, kTraceCHROMIUM)) { |
11130 LOCAL_SET_GL_ERROR( | 11121 LOCAL_SET_GL_ERROR( |
11131 GL_INVALID_OPERATION, | 11122 GL_INVALID_OPERATION, |
11132 "glTraceBeginCHROMIUM", "unable to create begin trace"); | 11123 "glTraceBeginCHROMIUM", "unable to create begin trace"); |
11133 return error::kNoError; | 11124 return error::kNoError; |
11134 } | 11125 } |
11135 return error::kNoError; | 11126 return error::kNoError; |
11136 } | 11127 } |
11137 | 11128 |
11138 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { | 11129 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { |
11139 if (gpu_tracer_->CurrentCategory().empty() || | 11130 if (!gpu_tracer_->End(kTraceCHROMIUM)) { |
11140 gpu_tracer_->CurrentName().empty()) { | 11131 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
11141 LOCAL_SET_GL_ERROR( | 11132 "glTraceEndCHROMIUM", "no trace begin found"); |
11142 GL_INVALID_OPERATION, | |
11143 "glTraceEndCHROMIUM", "no trace begin found"); | |
11144 return; | 11133 return; |
11145 } | 11134 } |
11146 TRACE_EVENT_COPY_ASYNC_END0(gpu_tracer_->CurrentCategory().c_str(), | |
11147 gpu_tracer_->CurrentName().c_str(), this); | |
11148 gpu_tracer_->End(kTraceCHROMIUM); | |
11149 } | 11135 } |
11150 | 11136 |
11151 void GLES2DecoderImpl::DoDrawBuffersEXT( | 11137 void GLES2DecoderImpl::DoDrawBuffersEXT( |
11152 GLsizei count, const GLenum* bufs) { | 11138 GLsizei count, const GLenum* bufs) { |
11153 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) { | 11139 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) { |
11154 LOCAL_SET_GL_ERROR( | 11140 LOCAL_SET_GL_ERROR( |
11155 GL_INVALID_VALUE, | 11141 GL_INVALID_VALUE, |
11156 "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT"); | 11142 "glDrawBuffersEXT", "greater than GL_MAX_DRAW_BUFFERS_EXT"); |
11157 return; | 11143 return; |
11158 } | 11144 } |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11562 } | 11548 } |
11563 } | 11549 } |
11564 | 11550 |
11565 // Include the auto-generated part of this file. We split this because it means | 11551 // Include the auto-generated part of this file. We split this because it means |
11566 // we can easily edit the non-auto generated parts right here in this file | 11552 // we can easily edit the non-auto generated parts right here in this file |
11567 // instead of having to edit some template or the code generator. | 11553 // instead of having to edit some template or the code generator. |
11568 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11554 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
11569 | 11555 |
11570 } // namespace gles2 | 11556 } // namespace gles2 |
11571 } // namespace gpu | 11557 } // namespace gpu |
OLD | NEW |