summaryrefslogtreecommitdiffstats
path: root/gpu/pgl
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/pgl')
-rw-r--r--gpu/pgl/command_buffer_pepper.cc97
-rw-r--r--gpu/pgl/command_buffer_pepper.h14
2 files changed, 28 insertions, 83 deletions
diff --git a/gpu/pgl/command_buffer_pepper.cc b/gpu/pgl/command_buffer_pepper.cc
index 9dd3c70..8522bbe 100644
--- a/gpu/pgl/command_buffer_pepper.cc
+++ b/gpu/pgl/command_buffer_pepper.cc
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "gpu/command_buffer/common/constants.h"
#include "gpu/pgl/command_buffer_pepper.h"
+
#ifdef __native_client__
#include <assert.h>
#define NOTREACHED() assert(0)
@@ -12,6 +14,7 @@
using base::SharedMemory;
using gpu::Buffer;
+using gpu::CommandBuffer;
CommandBufferPepper::CommandBufferPepper(NPP npp,
NPDevice* device,
@@ -37,29 +40,20 @@ Buffer CommandBufferPepper::GetRingBuffer() {
return buffer;
}
-int32 CommandBufferPepper::GetSize() {
- return context_->commandBufferEntries;
-}
-
-int32 CommandBufferPepper::SyncOffsets(int32 put_offset) {
- context_->putOffset = put_offset;
+CommandBuffer::State CommandBufferPepper::GetState() {
if (NPERR_NO_ERROR != device_->flushContext(npp_, context_, NULL, NULL))
- return -1;
+ context_->error = gpu::parse_error::kParseGenericError;
- return context_->getOffset;
+ return ConvertState();
}
-int32 CommandBufferPepper::GetGetOffset() {
- int32 value;
- if (NPERR_NO_ERROR != device_->getStateContext(
- npp_,
- context_,
- NPDeviceContext3DState_GetOffset,
- &value)) {
- return -1;
- }
+CommandBuffer::State CommandBufferPepper::Flush(int32 put_offset) {
+ context_->putOffset = put_offset;
- return value;
+ if (NPERR_NO_ERROR != device_->flushContext(npp_, context_, NULL, NULL))
+ context_->error = gpu::parse_error::kParseGenericError;
+
+ return ConvertState();
}
void CommandBufferPepper::SetGetOffset(int32 get_offset) {
@@ -67,19 +61,6 @@ void CommandBufferPepper::SetGetOffset(int32 get_offset) {
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))
@@ -103,56 +84,24 @@ Buffer CommandBufferPepper::GetTransferBuffer(int32 id) {
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) {
+void CommandBufferPepper::SetParseError(
+ gpu::parse_error::ParseError 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();
+CommandBuffer::State CommandBufferPepper::ConvertState() {
+ CommandBuffer::State state;
+ state.size = context_->commandBufferEntries;
+ state.get_offset = context_->getOffset;
+ state.put_offset = context_->putOffset;
+ state.token = context_->token;
+ state.error = static_cast<gpu::parse_error::ParseError>(
+ context_->error);
+ return state;
}
diff --git a/gpu/pgl/command_buffer_pepper.h b/gpu/pgl/command_buffer_pepper.h
index aa1d14b..b3efaea 100644
--- a/gpu/pgl/command_buffer_pepper.h
+++ b/gpu/pgl/command_buffer_pepper.h
@@ -28,22 +28,18 @@ class CommandBufferPepper : public gpu::CommandBuffer {
// CommandBuffer implementation.
virtual bool Initialize(int32 size);
virtual gpu::Buffer GetRingBuffer();
- virtual int32 GetSize();
- virtual int32 SyncOffsets(int32 put_offset);
- virtual int32 GetGetOffset();
+ virtual State GetState();
+ virtual State Flush(int32 put_offset);
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();
+ virtual void SetParseError(gpu::parse_error::ParseError parse_error);
private:
+ CommandBuffer::State ConvertState();
+
NPP npp_;
NPDevice* device_;
NPDeviceContext3D* context_;