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

Side by Side Diff: gpu/command_buffer/client/gl_in_process_context.h

Issue 455783002: GPU context creation code duplication cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fix even more build dependencies Created 6 years, 4 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
« no previous file with comments | « gpu/command_buffer/client/BUILD.gn ('k') | gpu/command_buffer/client/gl_in_process_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ 6 #define GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "gl_in_process_context_export.h" 10 #include "gl_in_process_context_export.h"
11 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
11 #include "gpu/command_buffer/service/in_process_command_buffer.h" 12 #include "gpu/command_buffer/service/in_process_command_buffer.h"
12 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
13 #include "ui/gl/gl_surface.h" 14 #include "ui/gl/gl_surface.h"
14 #include "ui/gl/gpu_preference.h" 15 #include "ui/gl/gpu_preference.h"
15 16
16 namespace gfx { 17 namespace gfx {
17 class Size; 18 class Size;
18 } 19 }
19 20
20 #if defined(OS_ANDROID) 21 #if defined(OS_ANDROID)
21 namespace gfx { 22 namespace gfx {
22 class SurfaceTexture; 23 class SurfaceTexture;
23 } 24 }
24 #endif 25 #endif
25 26
26 namespace gpu { 27 namespace gpu {
27 28
28 namespace gles2 { 29 namespace gles2 {
29 class GLES2Implementation; 30 class GLES2Implementation;
30 } 31 }
31 32
32 // The default uninitialized value is -1.
33 struct GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContextAttribs {
34 GLInProcessContextAttribs();
35
36 int32 alpha_size;
37 int32 blue_size;
38 int32 green_size;
39 int32 red_size;
40 int32 depth_size;
41 int32 stencil_size;
42 int32 samples;
43 int32 sample_buffers;
44 int32 fail_if_major_perf_caveat;
45 int32 lose_context_when_out_of_memory;
46 };
47
48 class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext { 33 class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext {
49 public: 34 public:
50 virtual ~GLInProcessContext() {} 35 virtual ~GLInProcessContext() {}
51 36
52 // Create a GLInProcessContext, if |is_offscreen| is true, renders to an 37 // Create a GLInProcessContext, if |is_offscreen| is true, renders to an
53 // offscreen context. |attrib_list| must be NULL or a NONE-terminated list 38 // offscreen context. |attrib_list| must be NULL or a NONE-terminated list
54 // of attribute/value pairs. 39 // of attribute/value pairs.
55 // If |surface| is not NULL, then it must match |is_offscreen| and |size|, 40 // If |surface| is not NULL, then it must match |is_offscreen| and |size|,
56 // |window| must be gfx::kNullAcceleratedWidget, and the command buffer 41 // |window| must be gfx::kNullAcceleratedWidget, and the command buffer
57 // service must run on the same thread as this client because GLSurface is 42 // service must run on the same thread as this client because GLSurface is
58 // not thread safe. If |surface| is NULL, then the other parameters are used 43 // not thread safe. If |surface| is NULL, then the other parameters are used
59 // to correctly create a surface. 44 // to correctly create a surface.
60 // Only one of |share_context| and |use_global_share_group| can be used at 45 // Only one of |share_context| and |use_global_share_group| can be used at
61 // the same time. 46 // the same time.
62 static GLInProcessContext* Create( 47 static GLInProcessContext* Create(
63 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, 48 scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
64 scoped_refptr<gfx::GLSurface> surface, 49 scoped_refptr<gfx::GLSurface> surface,
65 bool is_offscreen, 50 bool is_offscreen,
66 gfx::AcceleratedWidget window, 51 gfx::AcceleratedWidget window,
67 const gfx::Size& size, 52 const gfx::Size& size,
68 GLInProcessContext* share_context, 53 GLInProcessContext* share_context,
69 bool use_global_share_group, 54 bool use_global_share_group,
70 const GLInProcessContextAttribs& attribs, 55 const gpu::gles2::ContextCreationAttribHelper& attribs,
71 gfx::GpuPreference gpu_preference); 56 gfx::GpuPreference gpu_preference);
72 57
73 virtual void SetContextLostCallback(const base::Closure& callback) = 0; 58 virtual void SetContextLostCallback(const base::Closure& callback) = 0;
74 59
75 // Allows direct access to the GLES2 implementation so a GLInProcessContext 60 // Allows direct access to the GLES2 implementation so a GLInProcessContext
76 // can be used without making it current. 61 // can be used without making it current.
77 virtual gles2::GLES2Implementation* GetImplementation() = 0; 62 virtual gles2::GLES2Implementation* GetImplementation() = 0;
78 63
79 #if defined(OS_ANDROID) 64 #if defined(OS_ANDROID)
80 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( 65 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(
81 uint32 stream_id) = 0; 66 uint32 stream_id) = 0;
82 #endif 67 #endif
83 }; 68 };
84 69
85 } // namespace gpu 70 } // namespace gpu
86 71
87 #endif // GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_ 72 #endif // GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/BUILD.gn ('k') | gpu/command_buffer/client/gl_in_process_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698