cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / gpu / command_buffer / client / gl_in_process_context.h
blob3fe82aafda2abc2006481b098e3c561830be693c
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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_
8 #include "base/callback.h"
9 #include "base/compiler_specific.h"
10 #include "gles2_impl_export.h"
11 #include "ui/gfx/native_widget_types.h"
12 #include "ui/gl/gl_surface.h"
13 #include "ui/gl/gpu_preference.h"
15 namespace gfx {
16 class Size;
19 #if defined(OS_ANDROID)
20 namespace gfx {
21 class SurfaceTexture;
23 #endif
25 namespace gpu {
27 namespace gles2 {
28 class GLES2Implementation;
31 // The default uninitialized value is -1.
32 struct GLES2_IMPL_EXPORT GLInProcessContextAttribs {
33 GLInProcessContextAttribs();
35 int32 alpha_size;
36 int32 blue_size;
37 int32 green_size;
38 int32 red_size;
39 int32 depth_size;
40 int32 stencil_size;
41 int32 samples;
42 int32 sample_buffers;
45 class GLES2_IMPL_EXPORT GLInProcessContext {
46 public:
47 virtual ~GLInProcessContext() {}
49 // Create a GLInProcessContext, if |is_offscreen| is true, renders to an
50 // offscreen context. |attrib_list| must be NULL or a NONE-terminated list
51 // of attribute/value pairs.
52 static GLInProcessContext* CreateContext(
53 bool is_offscreen,
54 gfx::AcceleratedWidget window,
55 const gfx::Size& size,
56 bool share_resources,
57 const char* allowed_extensions,
58 const GLInProcessContextAttribs& attribs,
59 gfx::GpuPreference gpu_preference);
61 // Create context with the provided GLSurface. All other arguments match
62 // CreateContext factory above. Can only be called if the command buffer
63 // service runs on the same thread as this client because GLSurface is not
64 // thread safe.
65 static GLInProcessContext* CreateWithSurface(
66 scoped_refptr<gfx::GLSurface> surface,
67 bool share_resources,
68 const char* allowed_extensions,
69 const GLInProcessContextAttribs& attribs,
70 gfx::GpuPreference gpu_preference);
72 virtual void SetContextLostCallback(const base::Closure& callback) = 0;
74 virtual void SignalSyncPoint(unsigned sync_point,
75 const base::Closure& callback) = 0;
77 virtual void SignalQuery(unsigned query, const base::Closure& callback) = 0;
79 // Allows direct access to the GLES2 implementation so a GLInProcessContext
80 // can be used without making it current.
81 virtual gles2::GLES2Implementation* GetImplementation() = 0;
83 #if defined(OS_ANDROID)
84 virtual scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(
85 uint32 stream_id) = 0;
86 #endif
89 } // namespace gpu
91 #endif // GPU_COMMAND_BUFFER_CLIENT_GL_IN_PROCESS_CONTEXT_H_