Getting rid of GetDefaultProfile(), clean up of ProfileManager (which was in a seriou...
[chromium-blink-merge.git] / gpu / gles2_conform_support / egl / display.h
blobf7c0ff3829091c5328fdcbb7a8f843f8c3f08931
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_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_
6 #define GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_
8 #include <EGL/egl.h>
10 #include "base/memory/scoped_ptr.h"
11 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
12 #include "gpu/command_buffer/service/command_buffer_service.h"
13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
14 #include "gpu/command_buffer/service/gpu_scheduler.h"
15 #include "ui/gfx/native_widget_types.h"
16 #include "ui/gl/gl_context.h"
17 #include "ui/gl/gl_surface.h"
19 namespace gpu {
20 class CommandBufferService;
21 class GpuControl;
22 class GpuScheduler;
23 class TransferBuffer;
24 class TransferBufferManagerInterface;
26 namespace gles2 {
27 class GLES2CmdHelper;
28 class GLES2Implementation;
29 } // namespace gles2
30 } // namespace gpu
32 namespace egl {
34 class Config;
35 class Surface;
37 class Display {
38 public:
39 explicit Display(EGLNativeDisplayType display_id);
40 virtual ~Display();
42 void SetCreateOffscreen(int width, int height) {
43 create_offscreen_ = true;
44 create_offscreen_width_ = width;
45 create_offscreen_height_ = height;
48 bool is_initialized() const { return is_initialized_; }
49 bool Initialize();
51 // Config routines.
52 bool IsValidConfig(EGLConfig config);
53 bool ChooseConfigs(
54 EGLConfig* configs, EGLint config_size, EGLint* num_config);
55 bool GetConfigs(EGLConfig* configs, EGLint config_size, EGLint* num_config);
56 bool GetConfigAttrib(EGLConfig config, EGLint attribute, EGLint* value);
58 // Surface routines.
59 bool IsValidNativeWindow(EGLNativeWindowType win);
60 bool IsValidSurface(EGLSurface surface);
61 EGLSurface CreateWindowSurface(EGLConfig config,
62 EGLNativeWindowType win,
63 const EGLint* attrib_list);
64 void DestroySurface(EGLSurface surface);
65 void SwapBuffers(EGLSurface surface);
67 // Context routines.
68 bool IsValidContext(EGLContext ctx);
69 EGLContext CreateContext(EGLConfig config,
70 EGLContext share_ctx,
71 const EGLint* attrib_list);
72 void DestroyContext(EGLContext ctx);
73 bool MakeCurrent(EGLSurface draw, EGLSurface read, EGLContext ctx);
75 private:
76 EGLNativeDisplayType display_id_;
78 bool is_initialized_;
79 bool create_offscreen_;
80 int create_offscreen_width_;
81 int create_offscreen_height_;
83 scoped_ptr<gpu::TransferBufferManagerInterface> transfer_buffer_manager_;
84 scoped_ptr<gpu::CommandBufferService> command_buffer_;
85 scoped_ptr<gpu::GpuScheduler> gpu_scheduler_;
86 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
87 scoped_ptr<gpu::GpuControl> gpu_control_;
88 scoped_refptr<gfx::GLContext> gl_context_;
89 scoped_refptr<gfx::GLSurface> gl_surface_;
90 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_;
91 scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
93 // TODO(alokp): Support more than one config, surface, and context.
94 scoped_ptr<Config> config_;
95 scoped_ptr<Surface> surface_;
96 scoped_ptr<gpu::gles2::GLES2Implementation> context_;
98 DISALLOW_COPY_AND_ASSIGN(Display);
101 } // namespace egl
103 #endif // GPU_GLES2_CONFORM_SUPPORT_EGL_DISPLAY_H_