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

Side by Side Diff: cc/resources/scoped_gpu_raster.cc

Issue 1132283003: Merge Group Markers into Chromium Traces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed extra c_str() call Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/resources/scoped_gpu_raster.h" 5 #include "cc/resources/scoped_gpu_raster.h"
6 #include "gpu/command_buffer/client/gles2_interface.h" 6 #include "gpu/command_buffer/client/gles2_interface.h"
7 #include "third_party/khronos/GLES2/gl2.h" 7 #include "third_party/khronos/GLES2/gl2.h"
8 #include "third_party/khronos/GLES2/gl2ext.h" 8 #include "third_party/khronos/GLES2/gl2ext.h"
9 #include "third_party/skia/include/gpu/GrContext.h" 9 #include "third_party/skia/include/gpu/GrContext.h"
10 10
11 using gpu::gles2::GLES2Interface; 11 using gpu::gles2::GLES2Interface;
12 12
13 namespace cc { 13 namespace cc {
14 14
15 ScopedGpuRaster::ScopedGpuRaster(ContextProvider* context_provider) 15 ScopedGpuRaster::ScopedGpuRaster(ContextProvider* context_provider)
16 : context_provider_(context_provider) { 16 : context_provider_(context_provider) {
17 BeginGpuRaster(); 17 BeginGpuRaster();
18 } 18 }
19 19
20 ScopedGpuRaster::~ScopedGpuRaster() { 20 ScopedGpuRaster::~ScopedGpuRaster() {
21 EndGpuRaster(); 21 EndGpuRaster();
22 } 22 }
23 23
24 void ScopedGpuRaster::BeginGpuRaster() { 24 void ScopedGpuRaster::BeginGpuRaster() {
25 GLES2Interface* gl = context_provider_->ContextGL(); 25 GLES2Interface* gl = context_provider_->ContextGL();
26 26
27 // TODO(alokp): Use a trace macro to push/pop markers. 27 // TODO(alokp): Use a trace macro to push/pop markers.
28 // Using push/pop functions directly incurs cost to evaluate function 28 // Using push/pop functions directly incurs cost to evaluate function
29 // arguments even when tracing is disabled. 29 // arguments even when tracing is disabled.
30 gl->PushGroupMarkerEXT(0, "GpuRasterization"); 30 gl->PushGroupMarkerEXT(0, "GpuRasterization");
vmiura 2015/05/12 21:47:41 Markers and traces each add some overhead, and I t
31 gl->TraceBeginCHROMIUM("ScopedGpuRaster", "GpuRasterization");
31 32
32 class GrContext* gr_context = context_provider_->GrContext(); 33 class GrContext* gr_context = context_provider_->GrContext();
33 gr_context->resetContext(); 34 gr_context->resetContext();
34 } 35 }
35 36
36 void ScopedGpuRaster::EndGpuRaster() { 37 void ScopedGpuRaster::EndGpuRaster() {
37 class GrContext* gr_context = context_provider_->GrContext(); 38 class GrContext* gr_context = context_provider_->GrContext();
38 gr_context->flush(); 39 gr_context->flush();
39 40
40 GLES2Interface* gl = context_provider_->ContextGL(); 41 GLES2Interface* gl = context_provider_->ContextGL();
41 42
42 // Restore default GL unpack alignment. TextureUploader expects this. 43 // Restore default GL unpack alignment. TextureUploader expects this.
43 gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4); 44 gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4);
44 45
45 // TODO(alokp): Use a trace macro to push/pop markers. 46 // TODO(alokp): Use a trace macro to push/pop markers.
46 // Using push/pop functions directly incurs cost to evaluate function 47 // Using push/pop functions directly incurs cost to evaluate function
47 // arguments even when tracing is disabled. 48 // arguments even when tracing is disabled.
49 gl->TraceEndCHROMIUM();
48 gl->PopGroupMarkerEXT(); 50 gl->PopGroupMarkerEXT();
49 } 51 }
50 52
51 } // namespace cc 53 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698