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

Unified Diff: gpu/command_buffer/service/x_utils.h

Issue 1540004: Implemented offscreen rendering path for GLES2CmdDecoder on Linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/gpu_processor_linux.cc ('k') | gpu/command_buffer/service/x_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/x_utils.h
===================================================================
--- gpu/command_buffer/service/x_utils.h (revision 43138)
+++ gpu/command_buffer/service/x_utils.h (working copy)
@@ -13,36 +13,97 @@
namespace gpu {
+// Abstracts between on-screen and off-screen GLX contexts.
+class GLXContextWrapper {
+ public:
+ explicit GLXContextWrapper(Display* display)
+ : display_(display),
+ context_(NULL) {
+ DCHECK(display_);
+ }
+
+ virtual ~GLXContextWrapper();
+
+ // Initializes the GL context. Subclasses should perform their
+ // initialization work and then call the superclass implementation.
+ virtual bool Initialize();
+
+ // Destroys the GL context. Subclasses may call this before or after
+ // doing any necessary cleanup work.
+ virtual void Destroy();
+
+ // Makes the GL context current on the current thread.
+ virtual bool MakeCurrent() = 0;
+
+ // Returns true if this context is offscreen.
+ virtual bool IsOffscreen() = 0;
+
+ // Swaps front and back buffers. This has no effect for off-screen
+ // contexts.
+ virtual void SwapBuffers() = 0;
+
+ // Fetches the GLX context for sharing of server-side objects.
+ GLXContext GetContext() {
+ return context_;
+ }
+
+ protected:
+ Display* GetDisplay() {
+ return display_;
+ }
+
+ void SetContext(GLXContext context) {
+ context_ = context;
+ }
+
+ private:
+ Display* display_;
+ GLXContext context_;
+
+ DISALLOW_COPY_AND_ASSIGN(GLXContextWrapper);
+};
+
// This class is a wrapper around an X Window and associated GL context. It is
// useful to isolate intrusive X headers, since it can be forward declared
// (Window and GLXContext can't).
-class XWindowWrapper {
+class XWindowWrapper : public GLXContextWrapper {
public:
XWindowWrapper(Display *display, Window window)
- : display_(display),
+ : GLXContextWrapper(display),
window_(window) {
- DCHECK(display_);
DCHECK(window_);
}
- // Initializes the GL context.
- bool Initialize();
- // Destroys the GL context.
- void Destroy();
+ virtual bool Initialize();
+ virtual bool MakeCurrent();
+ virtual bool IsOffscreen();
+ virtual void SwapBuffers();
- // Makes the GL context current on the current thread.
- bool MakeCurrent();
-
- // Swaps front and back buffers.
- void SwapBuffers();
-
private:
- Display *display_;
Window window_;
- GLXContext context_;
DISALLOW_COPY_AND_ASSIGN(XWindowWrapper);
};
+// This class is a wrapper around a GLX pbuffer and associated GL context. It
+// serves the same purpose as the XWindowWrapper for initializing off-screen
+// rendering.
+class GLXPbufferWrapper : public GLXContextWrapper {
+ public:
+ explicit GLXPbufferWrapper(Display* display)
+ : GLXContextWrapper(display) {
+ }
+
+ virtual bool Initialize();
+ virtual void Destroy();
+ virtual bool MakeCurrent();
+ virtual bool IsOffscreen();
+ virtual void SwapBuffers();
+
+ private:
+ GLXPbuffer pbuffer_;
+ DISALLOW_COPY_AND_ASSIGN(GLXPbufferWrapper);
+};
+
} // namespace gpu
#endif // GPU_COMMAND_BUFFER_SERVICE_X_UTILS_H_
« no previous file with comments | « gpu/command_buffer/service/gpu_processor_linux.cc ('k') | gpu/command_buffer/service/x_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698