summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'gpu')
-rw-r--r--gpu/gpu.gyp24
-rw-r--r--gpu/pgl/command_buffer_pepper.cc153
-rw-r--r--gpu/pgl/command_buffer_pepper.h49
-rw-r--r--gpu/pgl/pgl.cc161
-rw-r--r--gpu/pgl/pgl.h23
5 files changed, 0 insertions, 410 deletions
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 3185f5b..8a51c05 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -361,30 +361,6 @@
'command_buffer/client/gles2_demo_cc.cc',
],
},
- {
- 'target_name': 'pgl',
- 'type': 'static_library',
- 'dependencies': [
- 'command_buffer_client',
- 'gles2_c_lib',
- '../third_party/npapi/npapi.gyp:npapi',
- ],
- 'include_dirs': [
- '..',
- '../third_party/npapi/bindings',
- ],
- 'all_dependent_settings': {
- 'include_dirs': [
- '../third_party/npapi/bindings',
- ],
- },
- 'sources': [
- 'pgl/command_buffer_pepper.cc',
- 'pgl/command_buffer_pepper.h',
- 'pgl/pgl.cc',
- 'pgl/pgl.h',
- ],
- },
],
'conditions': [
['OS == "win"',
diff --git a/gpu/pgl/command_buffer_pepper.cc b/gpu/pgl/command_buffer_pepper.cc
deleted file mode 100644
index 3ee5406..0000000
--- a/gpu/pgl/command_buffer_pepper.cc
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright (c) 2010 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/pgl/command_buffer_pepper.h"
-#include "base/logging.h"
-
-using base::SharedMemory;
-using gpu::Buffer;
-
-CommandBufferPepper::CommandBufferPepper(NPP npp,
- NPDevice* device,
- NPDeviceContext3D* context)
- : npp_(npp),
- device_(device),
- context_(context) {
-}
-
-CommandBufferPepper::~CommandBufferPepper() {
-}
-
-// Not implemented in CommandBufferPepper.
-bool CommandBufferPepper::Initialize(int32 size) {
- NOTREACHED();
- return false;
-}
-
-Buffer CommandBufferPepper::GetRingBuffer() {
- Buffer buffer;
- buffer.ptr = context_->commandBuffer;
- buffer.size = context_->commandBufferEntries * sizeof(int32);
- return buffer;
-}
-
-int32 CommandBufferPepper::GetSize() {
- return context_->commandBufferEntries;
-}
-
-int32 CommandBufferPepper::SyncOffsets(int32 put_offset) {
- context_->putOffset = put_offset;
- if (NPERR_NO_ERROR != device_->flushContext(npp_, context_, NULL, NULL))
- return -1;
-
- return context_->getOffset;
-}
-
-int32 CommandBufferPepper::GetGetOffset() {
- int32 value;
- if (NPERR_NO_ERROR != device_->getStateContext(
- npp_,
- context_,
- NPDeviceContext3DState_GetOffset,
- &value)) {
- return -1;
- }
-
- return value;
-}
-
-void CommandBufferPepper::SetGetOffset(int32 get_offset) {
- // Not implemented by proxy.
- NOTREACHED();
-}
-
-int32 CommandBufferPepper::GetPutOffset() {
- int32 value;
- if (NPERR_NO_ERROR != device_->getStateContext(
- npp_,
- context_,
- NPDeviceContext3DState_PutOffset,
- &value)) {
- return -1;
- }
-
- return value;
-}
-
-int32 CommandBufferPepper::CreateTransferBuffer(size_t size) {
- int32 id;
- if (NPERR_NO_ERROR != device_->createBuffer(npp_, context_, size, &id))
- return -1;
-
- return id;
-}
-
-void CommandBufferPepper::DestroyTransferBuffer(int32 id) {
- device_->destroyBuffer(npp_, context_, id);
-}
-
-Buffer CommandBufferPepper::GetTransferBuffer(int32 id) {
- NPDeviceBuffer np_buffer;
- if (NPERR_NO_ERROR != device_->mapBuffer(npp_, context_, id, &np_buffer))
- return Buffer();
-
- Buffer buffer;
- buffer.ptr = np_buffer.ptr;
- buffer.size = np_buffer.size;
- return buffer;
-}
-
-int32 CommandBufferPepper::GetToken() {
- int32 value;
- if (NPERR_NO_ERROR != device_->getStateContext(
- npp_,
- context_,
- NPDeviceContext3DState_Token,
- &value)) {
- return -1;
- }
-
- return value;
-}
-
-void CommandBufferPepper::SetToken(int32 token) {
- // Not implemented by proxy.
- NOTREACHED();
-}
-
-int32 CommandBufferPepper::ResetParseError() {
- int32 value;
- if (NPERR_NO_ERROR != device_->getStateContext(
- npp_,
- context_,
- NPDeviceContext3DState_ParseError,
- &value)) {
- return -1;
- }
-
- return value;
-}
-
-void CommandBufferPepper::SetParseError(int32 parse_error) {
- // Not implemented by proxy.
- NOTREACHED();
-}
-
-bool CommandBufferPepper::GetErrorStatus() {
- int32 value;
- if (NPERR_NO_ERROR != device_->getStateContext(
- npp_,
- context_,
- NPDeviceContext3DState_ErrorStatus,
- &value)) {
- return value != 0;
- }
-
- return true;
-}
-
-void CommandBufferPepper::RaiseErrorStatus() {
- // Not implemented by proxy.
- NOTREACHED();
-}
diff --git a/gpu/pgl/command_buffer_pepper.h b/gpu/pgl/command_buffer_pepper.h
deleted file mode 100644
index ab114e3..0000000
--- a/gpu/pgl/command_buffer_pepper.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2010 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_PGL_COMMAND_BUFFER_PEPPER_H
-#define GPU_PGL_COMMAND_BUFFER_PEPPER_H
-
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "third_party/npapi/bindings/npapi.h"
-#include "third_party/npapi/bindings/npruntime.h"
-#include "webkit/glue/plugins/nphostapi.h"
-
-// A CommandBuffer proxy implementation that uses the Pepper API to access
-// the command buffer.
-
-class CommandBufferPepper : public gpu::CommandBuffer {
- public:
- CommandBufferPepper(NPP npp,
- NPDevice* device,
- NPDeviceContext3D* device_context);
- virtual ~CommandBufferPepper();
-
- // CommandBuffer implementation.
- virtual bool Initialize(int32 size);
- virtual gpu::Buffer GetRingBuffer();
- virtual int32 GetSize();
- virtual int32 SyncOffsets(int32 put_offset);
- virtual int32 GetGetOffset();
- virtual void SetGetOffset(int32 get_offset);
- virtual int32 GetPutOffset();
- virtual int32 CreateTransferBuffer(size_t size);
- virtual void DestroyTransferBuffer(int32 id);
- virtual gpu::Buffer GetTransferBuffer(int32 handle);
- virtual int32 GetToken();
- virtual void SetToken(int32 token);
- virtual int32 ResetParseError();
- virtual void SetParseError(int32 parse_error);
- virtual bool GetErrorStatus();
- virtual void RaiseErrorStatus();
-
- private:
- NPP npp_;
- NPDevice* device_;
- NPDeviceContext3D* context_;
-};
-
-#endif // GPU_PGL_COMMAND_BUFFER_PEPPER_H
-
-
diff --git a/gpu/pgl/pgl.cc b/gpu/pgl/pgl.cc
deleted file mode 100644
index 320dfff..0000000
--- a/gpu/pgl/pgl.cc
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (c) 2010 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/client/gles2_cmd_helper.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "gpu/command_buffer/client/gles2_lib.h"
-#include "gpu/pgl/command_buffer_pepper.h"
-#include "gpu/pgl/pgl.h"
-
-#if defined(_MSC_VER)
-#define THREAD_LOCAL __declspec(thread)
-#else
-#define THREAD_LOCAL __thread
-#endif
-
-namespace {
-const int32 kTransferBufferSize = 512 * 1024;
-
-class PGLContextImpl {
- public:
- PGLContextImpl(NPP npp,
- NPDevice* device,
- NPDeviceContext3D* device_context);
- ~PGLContextImpl();
-
- // Initlaize a PGL context with a transfer buffer of a particular size.
- bool Initialize(int32 transfer_buffer_size);
-
- // Destroy all resources associated with the PGL context.
- void Destroy();
-
- // Make a PGL context current for the calling thread.
- static bool MakeCurrent(PGLContextImpl* pgl_context);
-
- // Display all content rendered since last call to SwapBuffers.
- bool SwapBuffers();
-
- private:
- PGLContextImpl(const PGLContextImpl&);
- void operator=(const PGLContextImpl&);
-
- NPP npp_;
- NPDevice* device_;
- NPDeviceContext3D* device_context_;
- CommandBufferPepper* command_buffer_;
- gpu::gles2::GLES2CmdHelper* gles2_helper_;
- int32 transfer_buffer_id_;
- gpu::gles2::GLES2Implementation* gles2_implementation_;
-};
-
-THREAD_LOCAL PGLContextImpl* g_current_pgl_context;
-
-PGLContextImpl::PGLContextImpl(NPP npp,
- NPDevice* device,
- NPDeviceContext3D* device_context)
- : npp_(npp),
- device_(device),
- device_context_(device_context),
- command_buffer_(NULL),
- gles2_helper_(NULL),
- transfer_buffer_id_(0),
- gles2_implementation_(NULL) {
-}
-
-PGLContextImpl::~PGLContextImpl() {
- Destroy();
-}
-
-bool PGLContextImpl::Initialize(int32 transfer_buffer_size) {
- // Create and initialize the objects required to issue GLES2 calls.
- command_buffer_ = new CommandBufferPepper(
- npp_, device_, device_context_);
- gles2_helper_ = new gpu::gles2::GLES2CmdHelper(command_buffer_);
- if (gles2_helper_->Initialize()) {
- transfer_buffer_id_ =
- command_buffer_->CreateTransferBuffer(kTransferBufferSize);
- gpu::Buffer transfer_buffer =
- command_buffer_->GetTransferBuffer(transfer_buffer_id_);
- if (transfer_buffer.ptr) {
- gles2_implementation_ = new gpu::gles2::GLES2Implementation(
- gles2_helper_,
- transfer_buffer.size,
- transfer_buffer.ptr,
- transfer_buffer_id_);
- return true;
- }
- }
-
- // Tear everything down if initialization failed.
- Destroy();
- return false;
-}
-
-void PGLContextImpl::Destroy() {
- delete gles2_implementation_;
- gles2_implementation_ = NULL;
-
- if (command_buffer_ && transfer_buffer_id_ != 0) {
- command_buffer_->DestroyTransferBuffer(transfer_buffer_id_);
- transfer_buffer_id_ = 0;
- }
-
- delete gles2_helper_;
- gles2_helper_ = NULL;
-
- delete command_buffer_;
- command_buffer_ = NULL;
-}
-
-bool PGLContextImpl::MakeCurrent(PGLContextImpl* pgl_context) {
- g_current_pgl_context = pgl_context;
- if (pgl_context)
- gles2::g_gl_impl = pgl_context->gles2_implementation_;
- else
- gles2::g_gl_impl = NULL;
-
- return true;
-}
-
-bool PGLContextImpl::SwapBuffers() {
- gles2_implementation_->SwapBuffers();
- return true;
-}
-} // namespace anonymous
-
-extern "C" {
-
-PGLContext pglCreateContext(NPP npp,
- NPDevice* device,
- NPDeviceContext3D* device_context) {
- PGLContextImpl* pgl_context = new PGLContextImpl(
- npp, device, device_context);
- if (pgl_context->Initialize(kTransferBufferSize)) {
- return pgl_context;
- }
-
- delete pgl_context;
- return NULL;
-}
-
-PGLBoolean pglMakeCurrent(PGLContext pgl_context) {
- return PGLContextImpl::MakeCurrent(static_cast<PGLContextImpl*>(pgl_context));
-}
-
-PGLBoolean pglSwapBuffers() {
- if (!g_current_pgl_context)
- return false;
-
- return g_current_pgl_context->SwapBuffers();
-}
-
-PGLBoolean pglDestroyContext(PGLContext pgl_context) {
- if (!pgl_context)
- return false;
-
- delete pgl_context;
- return true;
-}
-
-} // extern "C"
diff --git a/gpu/pgl/pgl.h b/gpu/pgl/pgl.h
deleted file mode 100644
index 0cbc97d..0000000
--- a/gpu/pgl/pgl.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2010 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_PGL_PGL_H
-#define GPU_PGL_PGL_H
-
-#include "npapi.h"
-#include "npapi_extensions.h"
-
-extern "C" {
-typedef void* PGLContext;
-typedef bool PGLBoolean;
-
-PGLContext pglCreateContext(NPP npp,
- NPDevice* device,
- NPDeviceContext3D* device_context);
-PGLBoolean pglMakeCurrent(PGLContext pgl_context);
-PGLBoolean pglSwapBuffers();
-PGLBoolean pglDestroyContext(PGLContext pgl_context);
-} // extern "C"
-
-#endif // GPU_PGL_PGL_H \ No newline at end of file