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 <cmath> | 10 #include <cmath> |
(...skipping 11033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11044 "width", (is_offscreen ? offscreen_size_.width() : | 11044 "width", (is_offscreen ? offscreen_size_.width() : |
11045 surface_->GetSize().width())); | 11045 surface_->GetSize().width())); |
11046 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", | 11046 TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", |
11047 "offscreen", is_offscreen, | 11047 "offscreen", is_offscreen, |
11048 "frame", this_frame_number); | 11048 "frame", this_frame_number); |
11049 { | 11049 { |
11050 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); | 11050 TRACE_EVENT_SYNTHETIC_DELAY("gpu.PresentingFrame"); |
11051 } | 11051 } |
11052 | 11052 |
11053 ScopedGPUTrace scoped_gpu_trace(gpu_tracer_.get(), kTraceDecoder, | 11053 ScopedGPUTrace scoped_gpu_trace(gpu_tracer_.get(), kTraceDecoder, |
11054 "gpu_toplevel", "SwapBuffer"); | 11054 "GLES2Decoder", "SwapBuffer"); |
11055 | 11055 |
11056 bool is_tracing; | 11056 bool is_tracing; |
11057 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), | 11057 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
11058 &is_tracing); | 11058 &is_tracing); |
11059 if (is_tracing) { | 11059 if (is_tracing) { |
11060 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); | 11060 ScopedFrameBufferBinder binder(this, GetBackbufferServiceId()); |
11061 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( | 11061 gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( |
11062 is_offscreen ? offscreen_size_ : surface_->GetSize()); | 11062 is_offscreen ? offscreen_size_ : surface_->GetSize()); |
11063 } | 11063 } |
11064 | 11064 |
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13127 void GLES2DecoderImpl::DoInsertEventMarkerEXT( | 13127 void GLES2DecoderImpl::DoInsertEventMarkerEXT( |
13128 GLsizei length, const GLchar* marker) { | 13128 GLsizei length, const GLchar* marker) { |
13129 if (!marker) { | 13129 if (!marker) { |
13130 marker = ""; | 13130 marker = ""; |
13131 } | 13131 } |
13132 debug_marker_manager_.SetMarker( | 13132 debug_marker_manager_.SetMarker( |
13133 length ? std::string(marker, length) : std::string(marker)); | 13133 length ? std::string(marker, length) : std::string(marker)); |
13134 } | 13134 } |
13135 | 13135 |
13136 void GLES2DecoderImpl::DoPushGroupMarkerEXT( | 13136 void GLES2DecoderImpl::DoPushGroupMarkerEXT( |
13137 GLsizei length, const GLchar* marker) { | 13137 GLsizei /*length*/, const GLchar* /*marker*/) { |
13138 if (!marker) { | |
13139 marker = ""; | |
13140 } | |
13141 std::string name = length ? std::string(marker, length) : std::string(marker); | |
13142 debug_marker_manager_.PushGroup(name); | |
13143 gpu_tracer_->Begin(TRACE_DISABLED_BY_DEFAULT("gpu_group_marker"), name, | |
13144 kTraceGroupMarker); | |
13145 } | 13138 } |
13146 | 13139 |
13147 void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) { | 13140 void GLES2DecoderImpl::DoPopGroupMarkerEXT(void) { |
13148 debug_marker_manager_.PopGroup(); | |
13149 gpu_tracer_->End(kTraceGroupMarker); | |
13150 } | 13141 } |
13151 | 13142 |
13152 void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM( | 13143 void GLES2DecoderImpl::DoBindTexImage2DCHROMIUM( |
13153 GLenum target, GLint image_id) { | 13144 GLenum target, GLint image_id) { |
13154 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM"); | 13145 TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoBindTexImage2DCHROMIUM"); |
13155 | 13146 |
13156 if (target == GL_TEXTURE_CUBE_MAP) { | 13147 if (target == GL_TEXTURE_CUBE_MAP) { |
13157 LOCAL_SET_GL_ERROR( | 13148 LOCAL_SET_GL_ERROR( |
13158 GL_INVALID_ENUM, | 13149 GL_INVALID_ENUM, |
13159 "glBindTexImage2DCHROMIUM", "invalid target"); | 13150 "glBindTexImage2DCHROMIUM", "invalid target"); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13248 return error::kInvalidArguments; | 13239 return error::kInvalidArguments; |
13249 } | 13240 } |
13250 | 13241 |
13251 std::string category_name; | 13242 std::string category_name; |
13252 std::string trace_name; | 13243 std::string trace_name; |
13253 if (!category_bucket->GetAsString(&category_name) || | 13244 if (!category_bucket->GetAsString(&category_name) || |
13254 !name_bucket->GetAsString(&trace_name)) { | 13245 !name_bucket->GetAsString(&trace_name)) { |
13255 return error::kInvalidArguments; | 13246 return error::kInvalidArguments; |
13256 } | 13247 } |
13257 | 13248 |
| 13249 debug_marker_manager_.PushGroup(trace_name); |
13258 if (!gpu_tracer_->Begin(category_name, trace_name, kTraceCHROMIUM)) { | 13250 if (!gpu_tracer_->Begin(category_name, trace_name, kTraceCHROMIUM)) { |
13259 LOCAL_SET_GL_ERROR( | 13251 LOCAL_SET_GL_ERROR( |
13260 GL_INVALID_OPERATION, | 13252 GL_INVALID_OPERATION, |
13261 "glTraceBeginCHROMIUM", "unable to create begin trace"); | 13253 "glTraceBeginCHROMIUM", "unable to create begin trace"); |
13262 return error::kNoError; | 13254 return error::kNoError; |
13263 } | 13255 } |
13264 return error::kNoError; | 13256 return error::kNoError; |
13265 } | 13257 } |
13266 | 13258 |
13267 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { | 13259 void GLES2DecoderImpl::DoTraceEndCHROMIUM() { |
| 13260 debug_marker_manager_.PopGroup(); |
13268 if (!gpu_tracer_->End(kTraceCHROMIUM)) { | 13261 if (!gpu_tracer_->End(kTraceCHROMIUM)) { |
13269 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, | 13262 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, |
13270 "glTraceEndCHROMIUM", "no trace begin found"); | 13263 "glTraceEndCHROMIUM", "no trace begin found"); |
13271 return; | 13264 return; |
13272 } | 13265 } |
13273 } | 13266 } |
13274 | 13267 |
13275 void GLES2DecoderImpl::DoDrawBuffersEXT( | 13268 void GLES2DecoderImpl::DoDrawBuffersEXT( |
13276 GLsizei count, const GLenum* bufs) { | 13269 GLsizei count, const GLenum* bufs) { |
13277 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) { | 13270 if (count > static_cast<GLsizei>(group_->max_draw_buffers())) { |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14384 return error::kNoError; | 14377 return error::kNoError; |
14385 } | 14378 } |
14386 | 14379 |
14387 // Include the auto-generated part of this file. We split this because it means | 14380 // Include the auto-generated part of this file. We split this because it means |
14388 // we can easily edit the non-auto generated parts right here in this file | 14381 // we can easily edit the non-auto generated parts right here in this file |
14389 // instead of having to edit some template or the code generator. | 14382 // instead of having to edit some template or the code generator. |
14390 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 14383 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
14391 | 14384 |
14392 } // namespace gles2 | 14385 } // namespace gles2 |
14393 } // namespace gpu | 14386 } // namespace gpu |
OLD | NEW |