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

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

Issue 375303002: cc: Refactor ResourceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 6 years, 5 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/resources/scoped_gpu_raster.h"
6 #include "gpu/command_buffer/client/gles2_interface.h"
7 #include "third_party/khronos/GLES2/gl2.h"
8 #include "third_party/khronos/GLES2/gl2ext.h"
9 #include "third_party/skia/include/gpu/GrContext.h"
10
11 using gpu::gles2::GLES2Interface;
12
13 namespace cc {
14
15 ScopedGpuRaster::ScopedGpuRaster(ContextProvider* context_provider)
16 : context_provider_(context_provider) {
17 BeginGpuRaster();
18 }
19
20 ScopedGpuRaster::~ScopedGpuRaster() {
21 EndGpuRaster();
22 }
23
24 void ScopedGpuRaster::BeginGpuRaster() {
25 GLES2Interface* gl = context_provider_->ContextGL();
26 DCHECK(gl);
danakj 2014/07/11 16:49:04 not needed
sohanjg 2014/07/11 17:12:45 Done.
27
28 // TODO(alokp): Use a trace macro to push/pop markers.
29 // Using push/pop functions directly incurs cost to evaluate function
30 // arguments even when tracing is disabled.
31 gl->PushGroupMarkerEXT(0, "GpuRasterization");
32
33 class GrContext* gr_context = context_provider_->GrContext();
34 if (gr_context)
danakj 2014/07/11 16:49:04 nto needed
sohanjg 2014/07/11 17:12:45 Done.
35 gr_context->resetContext();
36 }
37
38 void ScopedGpuRaster::EndGpuRaster() {
39 GLES2Interface* gl = context_provider_->ContextGL();
40 DCHECK(gl);
danakj 2014/07/11 16:49:04 not needed
sohanjg 2014/07/11 17:12:45 Done.
41
42 class GrContext* gr_context = context_provider_->GrContext();
43 if (gr_context)
danakj 2014/07/11 16:49:04 not needed
sohanjg 2014/07/11 17:12:45 Done.
44 gr_context->flush();
45
46 // TODO(alokp): Use a trace macro to push/pop markers.
47 // Using push/pop functions directly incurs cost to evaluate function
48 // arguments even when tracing is disabled.
49 gl->PopGroupMarkerEXT();
50 }
51
52 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698