forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG=155557 Review URL: https://chromiumcodereview.appspot.com/11275120 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166442 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
gman@chromium.org
committed
Nov 7, 2012
1 parent
e2c9267
commit 1868a34
Showing
40 changed files
with
1,669 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright (c) 2012 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "gpu/command_buffer/service/gl_context_virtual.h" | ||
|
||
#include "gpu/command_buffer/service/gl_state_restorer_impl.h" | ||
#include "ui/gl/gl_surface.h" | ||
|
||
namespace gpu { | ||
|
||
GLContextVirtual::GLContextVirtual( | ||
gfx::GLShareGroup* share_group, | ||
gfx::GLContext* shared_context, | ||
gles2::GLES2Decoder* decoder) | ||
: GLContext(share_group), | ||
shared_context_(shared_context), | ||
display_(NULL), | ||
state_restorer_(new GLStateRestorerImpl(decoder)) { | ||
shared_context_->SetupForVirtualization(); | ||
} | ||
|
||
gfx::Display* GLContextVirtual::display() { | ||
return display_; | ||
} | ||
|
||
bool GLContextVirtual::Initialize( | ||
gfx::GLSurface* compatible_surface, gfx::GpuPreference gpu_preference) { | ||
display_ = static_cast<gfx::Display*>(compatible_surface->GetDisplay()); | ||
|
||
return true; | ||
} | ||
|
||
void GLContextVirtual::Destroy() { | ||
} | ||
|
||
bool GLContextVirtual::MakeCurrent(gfx::GLSurface* surface) { | ||
shared_context_->MakeVirtuallyCurrent(this, surface); | ||
return true; | ||
} | ||
|
||
void GLContextVirtual::ReleaseCurrent(gfx::GLSurface* surface) { | ||
shared_context_ = NULL; | ||
display_ = NULL; | ||
} | ||
|
||
bool GLContextVirtual::IsCurrent(gfx::GLSurface* surface) { | ||
return true; | ||
} | ||
|
||
void* GLContextVirtual::GetHandle() { | ||
return NULL; | ||
} | ||
|
||
gfx::GLStateRestorer* GLContextVirtual::GetGLStateRestorer() { | ||
return state_restorer_.get(); | ||
} | ||
|
||
void GLContextVirtual::SetSwapInterval(int interval) { | ||
shared_context_->SetSwapInterval(interval); | ||
} | ||
|
||
std::string GLContextVirtual::GetExtensions() { | ||
return shared_context_->GetExtensions(); | ||
} | ||
|
||
bool GLContextVirtual::GetTotalGpuMemory(size_t* bytes) { | ||
return shared_context_->GetTotalGpuMemory(bytes); | ||
} | ||
|
||
bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() { | ||
return shared_context_->WasAllocatedUsingRobustnessExtension(); | ||
} | ||
|
||
GLContextVirtual::~GLContextVirtual() { | ||
Destroy(); | ||
} | ||
|
||
} // namespace gpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) 2012 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ | ||
#define GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ | ||
|
||
#include "base/compiler_specific.h" | ||
#include "base/memory/scoped_ptr.h" | ||
#include "gpu/gpu_export.h" | ||
#include "ui/gl/gl_context.h" | ||
|
||
namespace gfx { | ||
class Display; | ||
class GLSurface; | ||
class GLStateRestorer; | ||
} | ||
|
||
namespace gpu { | ||
namespace gles2 { | ||
class GLES2Decoder; | ||
} | ||
|
||
// Encapsulates a virtual OpenGL context. | ||
class GPU_EXPORT GLContextVirtual : public gfx::GLContext { | ||
public: | ||
GLContextVirtual( | ||
gfx::GLShareGroup* share_group, | ||
gfx::GLContext* shared_context, | ||
gles2::GLES2Decoder* decoder); | ||
|
||
gfx::Display* display(); | ||
|
||
// Implement GLContext. | ||
virtual bool Initialize( | ||
gfx::GLSurface* compatible_surface, | ||
gfx::GpuPreference gpu_preference) OVERRIDE; | ||
virtual void Destroy() OVERRIDE; | ||
virtual bool MakeCurrent(gfx::GLSurface* surface) OVERRIDE; | ||
virtual void ReleaseCurrent(gfx::GLSurface* surface) OVERRIDE; | ||
virtual bool IsCurrent(gfx::GLSurface* surface) OVERRIDE; | ||
virtual void* GetHandle() OVERRIDE; | ||
virtual gfx::GLStateRestorer* GetGLStateRestorer() OVERRIDE; | ||
virtual void SetSwapInterval(int interval) OVERRIDE; | ||
virtual std::string GetExtensions() OVERRIDE; | ||
virtual bool GetTotalGpuMemory(size_t* bytes) OVERRIDE; | ||
virtual bool WasAllocatedUsingRobustnessExtension() OVERRIDE; | ||
|
||
protected: | ||
virtual ~GLContextVirtual(); | ||
|
||
private: | ||
gfx::GLContext* shared_context_; | ||
gfx::Display* display_; | ||
scoped_ptr<gfx::GLStateRestorer> state_restorer_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(GLContextVirtual); | ||
}; | ||
|
||
} // namespace gpu | ||
|
||
#endif // GPU_COMMAND_BUFFER_SERVICE_GL_CONTEXT_VIRTUAL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) 2012 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "gpu/command_buffer/service/gl_state_restorer_impl.h" | ||
|
||
#include "gpu/command_buffer/service/gles2_cmd_decoder.h" | ||
|
||
namespace gpu { | ||
|
||
GLStateRestorerImpl::GLStateRestorerImpl(gles2::GLES2Decoder* decoder) | ||
: decoder_(decoder) { | ||
} | ||
|
||
GLStateRestorerImpl::~GLStateRestorerImpl() { | ||
} | ||
|
||
void GLStateRestorerImpl::RestoreState() { | ||
decoder_->RestoreState(); | ||
} | ||
|
||
} // namespace gpu | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2012 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// This file contains the GLStateRestorerImpl class. | ||
|
||
#ifndef GPU_COMMAND_BUFFER_SERVICE_GL_STATE_RESTORER_IMPL_H_ | ||
#define GPU_COMMAND_BUFFER_SERVICE_GL_STATE_RESTORER_IMPL_H_ | ||
|
||
#include "base/compiler_specific.h" | ||
#include "gpu/gpu_export.h" | ||
#include "ui/gl/gl_state_restorer.h" | ||
|
||
namespace gpu { | ||
namespace gles2 { | ||
class GLES2Decoder; | ||
} | ||
|
||
// This class implements a GLStateRestorer that forwards to a GLES2Decoder. | ||
class GPU_EXPORT GLStateRestorerImpl : public gfx::GLStateRestorer { | ||
public: | ||
explicit GLStateRestorerImpl(gles2::GLES2Decoder* decoder); | ||
virtual ~GLStateRestorerImpl(); | ||
|
||
virtual void RestoreState() OVERRIDE; | ||
|
||
private: | ||
gles2::GLES2Decoder* decoder_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(GLStateRestorerImpl); | ||
}; | ||
|
||
} // namespace gpu | ||
|
||
#endif // GPU_COMMAND_BUFFER_SERVICE_GL_STATE_RESTORER_IMPL_H_ | ||
|
Oops, something went wrong.