Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| index be644ce11ef3c4088bf6f42fa6eb03582a9d01c1..a530ec69574e5cdb6018612e028af645d77fe6ea 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -42,6 +42,7 @@ |
| #include "gpu/command_buffer/service/gl_utils.h" |
| #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
| +#include "gpu/command_buffer/service/gpu_state_tracer.h" |
| #include "gpu/command_buffer/service/gpu_switches.h" |
| #include "gpu/command_buffer/service/gpu_tracer.h" |
| #include "gpu/command_buffer/service/image_manager.h" |
| @@ -1665,6 +1666,7 @@ class GLES2DecoderImpl : public GLES2Decoder { |
| DecoderFramebufferState framebuffer_state_; |
| scoped_ptr<GPUTracer> gpu_tracer_; |
| + scoped_ptr<GPUStateTracer> gpu_state_tracer_; |
| std::queue<linked_ptr<FenceCallback> > pending_readpixel_fences_; |
| @@ -2129,6 +2131,7 @@ bool GLES2DecoderImpl::Initialize( |
| set_initialized(); |
| gpu_tracer_ = GPUTracer::Create(); |
| + gpu_state_tracer_ = GPUStateTracer::Create(&state_); |
| if (CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kEnableGPUDebugging)) { |
| @@ -6983,6 +6986,15 @@ error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
| "glPostSubBufferCHROMIUM", "command not supported by surface"); |
| return error::kNoError; |
| } |
| + bool is_tracing; |
| + TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
| + &is_tracing); |
| + if (is_tracing) { |
| + bool is_offscreen = !!offscreen_target_frame_buffer_.get(); |
| + ScopedFrameBufferBinder binder(this, 0); |
|
piman
2013/09/10 17:40:08
you want GetBackbufferServiceId() rather than 0, t
Sami
2013/09/10 17:45:29
Great point, done.
|
| + gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( |
| + is_offscreen ? offscreen_size_ : surface_->GetSize()); |
| + } |
| if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { |
| return error::kNoError; |
| } else { |
| @@ -8575,6 +8587,15 @@ void GLES2DecoderImpl::DoSwapBuffers() { |
| TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoSwapBuffers", |
| "offscreen", is_offscreen, |
| "frame", this_frame_number); |
| + bool is_tracing; |
| + TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("gpu.debug"), |
| + &is_tracing); |
| + if (is_tracing) { |
| + ScopedFrameBufferBinder binder(this, 0); |
| + gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( |
| + is_offscreen ? offscreen_size_ : surface_->GetSize()); |
| + } |
| + |
| // If offscreen then don't actually SwapBuffers to the display. Just copy |
| // the rendered frame to another frame buffer. |
| if (is_offscreen) { |