OLD | NEW |
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/raster/scoped_gpu_raster.h" | 5 #include "cc/raster/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 |
(...skipping 16 matching lines...) Expand all Loading... |
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->TraceBeginCHROMIUM("ScopedGpuRaster", "GpuRasterization"); | 30 gl->TraceBeginCHROMIUM("ScopedGpuRaster", "GpuRasterization"); |
31 | 31 |
32 class GrContext* gr_context = context_provider_->GrContext(); | 32 class GrContext* gr_context = context_provider_->GrContext(); |
33 gr_context->resetContext(); | 33 gr_context->resetContext(); |
34 } | 34 } |
35 | 35 |
36 void ScopedGpuRaster::EndGpuRaster() { | 36 void ScopedGpuRaster::EndGpuRaster() { |
37 class GrContext* gr_context = context_provider_->GrContext(); | |
38 gr_context->flush(); | |
39 | |
40 GLES2Interface* gl = context_provider_->ContextGL(); | 37 GLES2Interface* gl = context_provider_->ContextGL(); |
41 | 38 |
42 // Restore default GL unpack alignment. TextureUploader expects this. | 39 // Restore default GL unpack alignment. TextureUploader expects this. |
43 gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4); | 40 gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4); |
44 | 41 |
45 // TODO(alokp): Use a trace macro to push/pop markers. | 42 // TODO(alokp): Use a trace macro to push/pop markers. |
46 // Using push/pop functions directly incurs cost to evaluate function | 43 // Using push/pop functions directly incurs cost to evaluate function |
47 // arguments even when tracing is disabled. | 44 // arguments even when tracing is disabled. |
48 gl->TraceEndCHROMIUM(); | 45 gl->TraceEndCHROMIUM(); |
49 } | 46 } |
50 | 47 |
51 } // namespace cc | 48 } // namespace cc |
OLD | NEW |