15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file. 45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef MOJO_GLES2_GLES2_CONTEXT_H_ 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define MOJO_GLES2_GLES2_CONTEXT_H_ 75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "base/macros.h" 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "gpu/command_buffer/client/gles2_implementation.h" 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "mojo/gles2/command_buffer_client_impl.h" 124ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdoch#include "mojo/public/c/gles2/gles2.h" 135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct MojoGLES2ContextPrivate {}; 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace gpu { 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class TransferBuffer; 185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace gles2 { 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class GLES2CmdHelper; 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class GLES2Implementation; 215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace mojo { 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace gles2 { 265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class GLES2Context : public CommandBufferDelegate, 285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public MojoGLES2ContextPrivate { 295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public: 30f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) explicit GLES2Context(const MojoAsyncWaiter* async_waiter, 310de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) ScopedMessagePipeHandle command_buffer_handle, 325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) MojoGLES2ContextLost lost_callback, 335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void* closure); 345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual ~GLES2Context(); 355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool Initialize(); 365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) gpu::gles2::GLES2Interface* interface() const { 385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return implementation_.get(); 395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) gpu::ContextSupport* context_support() const { return implementation_.get(); } 415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) private: 4323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) virtual void ContextLost() OVERRIDE; 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) CommandBufferClientImpl command_buffer_; 465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) scoped_ptr<gpu::TransferBuffer> transfer_buffer_; 485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) scoped_ptr<gpu::gles2::GLES2Implementation> implementation_; 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) MojoGLES2ContextLost lost_callback_; 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void* closure_; 515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2Context); 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}; 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} // namespace gles2 565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} // namespace mojo 575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif // MOJO_GLES2_GLES2_CONTEXT_H_ 59