Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 23926013: gpu: Record GL state to trace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build failure. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/debug/trace_event.h ('k') | gpu/command_buffer/service/gpu_state_tracer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d6a9276918ef49b2a5c404b6356e215b27a5bee9..747ce78ea710eb17ec4435d518df085b5ec6e6a1 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"
@@ -1664,6 +1665,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_;
@@ -2127,6 +2129,7 @@ bool GLES2DecoderImpl::Initialize(
set_initialized();
gpu_tracer_ = GPUTracer::Create();
+ gpu_state_tracer_ = GPUStateTracer::Create(&state_);
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableGPUDebugging)) {
@@ -7011,6 +7014,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, GetBackbufferServiceId());
+ 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 {
@@ -8603,6 +8615,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, GetBackbufferServiceId());
+ 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) {
« no previous file with comments | « base/debug/trace_event.h ('k') | gpu/command_buffer/service/gpu_state_tracer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698