summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer/client')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.cc195
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.h216
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper_test.cc303
-rw-r--r--gpu/command_buffer/client/fenced_allocator.cc214
-rw-r--r--gpu/command_buffer/client/fenced_allocator.h266
-rw-r--r--gpu/command_buffer/client/fenced_allocator_test.cc501
-rw-r--r--gpu/command_buffer/client/gles2_c_lib.cc16
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h504
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper.cc14
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper.h36
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h1143
-rw-r--r--gpu/command_buffer/client/gles2_demo.cc203
-rw-r--r--gpu/command_buffer/client/gles2_demo_c.c15
-rw-r--r--gpu/command_buffer/client/gles2_demo_c.h22
-rw-r--r--gpu/command_buffer/client/gles2_demo_cc.cc21
-rw-r--r--gpu/command_buffer/client/gles2_demo_cc.h14
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc154
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h93
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h684
-rw-r--r--gpu/command_buffer/client/gles2_implementation_gen.h72
-rw-r--r--gpu/command_buffer/client/gles2_lib.cc20
-rw-r--r--gpu/command_buffer/client/gles2_lib.h26
-rw-r--r--gpu/command_buffer/client/id_allocator.cc85
-rw-r--r--gpu/command_buffer/client/id_allocator.h78
-rw-r--r--gpu/command_buffer/client/id_allocator_test.cc112
25 files changed, 0 insertions, 5007 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
deleted file mode 100644
index e8f6fef..0000000
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// This file contains the implementation of the command buffer helper class.
-
-#include "gpu/command_buffer/client/cmd_buffer_helper.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "gpu/np_utils/np_utils.h"
-
-namespace command_buffer {
-
-using command_buffer::CommandBuffer;
-using np_utils::NPBrowser;
-using np_utils::NPInvoke;
-using np_utils::NPObjectPointer;
-
-CommandBufferHelper::CommandBufferHelper(CommandBuffer* command_buffer)
- : command_buffer_(command_buffer),
- entries_(NULL),
- entry_count_(0),
- token_(0),
- last_token_read_(-1),
- get_(0),
- put_(0) {
-}
-
-bool CommandBufferHelper::Initialize() {
- ring_buffer_ = command_buffer_->GetRingBuffer();
- if (!ring_buffer_)
- return false;
-
- // Map the ring buffer into this process.
- if (!ring_buffer_->Map(ring_buffer_->max_size()))
- return false;
-
- entries_ = static_cast<CommandBufferEntry*>(ring_buffer_->memory());
- entry_count_ = command_buffer_->GetSize();
- get_ = command_buffer_->GetGetOffset();
- put_ = command_buffer_->GetPutOffset();
- last_token_read_ = command_buffer_->GetToken();
-
- return true;
-}
-
-CommandBufferHelper::~CommandBufferHelper() {
-}
-
-bool CommandBufferHelper::Flush() {
- get_ = command_buffer_->SyncOffsets(put_);
- return !command_buffer_->GetErrorStatus();
-}
-
-// Calls Flush() and then waits until the buffer is empty. Break early if the
-// error is set.
-bool CommandBufferHelper::Finish() {
- do {
- // Do not loop forever if the flush fails, meaning the command buffer reader
- // has shutdown).
- if (!Flush())
- return false;
- } while (put_ != get_);
-
- return true;
-}
-
-// Inserts a new token into the command stream. It uses an increasing value
-// scheme so that we don't lose tokens (a token has passed if the current token
-// value is higher than that token). Calls Finish() if the token value wraps,
-// which will be rare.
-int32 CommandBufferHelper::InsertToken() {
- // Increment token as 31-bit integer. Negative values are used to signal an
- // error.
- token_ = (token_ + 1) & 0x7FFFFFFF;
- CommandBufferEntry args;
- args.value_uint32 = token_;
- const uint32 kSetToken = 1; // TODO(gman): add a common set of commands.
- AddCommand(kSetToken, 1, &args);
- if (token_ == 0) {
- // we wrapped
- Finish();
- last_token_read_ = command_buffer_->GetToken();
- DCHECK_EQ(token_, last_token_read_);
- }
- return token_;
-}
-
-// Waits until the current token value is greater or equal to the value passed
-// in argument.
-void CommandBufferHelper::WaitForToken(int32 token) {
- // Return immediately if corresponding InsertToken failed.
- if (token < 0)
- return;
- if (last_token_read_ >= token) return; // fast path.
- if (token > token_) return; // we wrapped
- Flush();
- last_token_read_ = command_buffer_->GetToken();
- while (last_token_read_ < token) {
- if (get_ == put_) {
- LOG(FATAL) << "Empty command buffer while waiting on a token.";
- return;
- }
- // Do not loop forever if the flush fails, meaning the command buffer reader
- // has shutdown.
- if (!Flush())
- return;
- last_token_read_ = command_buffer_->GetToken();
- }
-}
-
-// Waits for available entries, basically waiting until get >= put + count + 1.
-// It actually waits for contiguous entries, so it may need to wrap the buffer
-// around, adding noops. Thus this function may change the value of put_.
-// The function will return early if an error occurs, in which case the
-// available space may not be available.
-void CommandBufferHelper::WaitForAvailableEntries(int32 count) {
- CHECK(count < entry_count_);
- if (put_ + count > entry_count_) {
- // There's not enough room between the current put and the end of the
- // buffer, so we need to wrap. We will add noops all the way to the end,
- // but we need to make sure get wraps first, actually that get is 1 or
- // more (since put will wrap to 0 after we add the noops).
- DCHECK_LE(1, put_);
- Flush();
- while (get_ > put_ || get_ == 0) {
- // Do not loop forever if the flush fails, meaning the command buffer
- // reader has shutdown.
- if (!Flush())
- return;
- }
- // Add the noops. By convention, a noop is a command 0 with no args.
- // TODO(apatrick): A noop can have a size. It would be better to add a
- // single noop with a variable size. Watch out for size limit on
- // individual commands.
- CommandHeader header;
- header.size = 1;
- header.command = 0;
- while (put_ < entry_count_) {
- entries_[put_++].value_header = header;
- }
- put_ = 0;
- }
- // If we have enough room, return immediatly.
- if (count <= AvailableEntries()) return;
- // Otherwise flush, and wait until we do have enough room.
- Flush();
- while (AvailableEntries() < count) {
- // Do not loop forever if the flush fails, meaning the command buffer reader
- // has shutdown.
- if (!Flush())
- return;
- }
-}
-
-CommandBufferEntry* CommandBufferHelper::GetSpace(uint32 entries) {
- WaitForAvailableEntries(entries);
- CommandBufferEntry* space = &entries_[put_];
- put_ += entries;
- return space;
-}
-
-parse_error::ParseError CommandBufferHelper::GetParseError() {
- int32 parse_error = command_buffer_->ResetParseError();
- return static_cast<parse_error::ParseError>(parse_error);
-}
-
-} // namespace command_buffer
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.h b/gpu/command_buffer/client/cmd_buffer_helper.h
deleted file mode 100644
index 7cac568..0000000
--- a/gpu/command_buffer/client/cmd_buffer_helper.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// This file contains the command buffer helper class.
-
-#ifndef GPU_COMMAND_BUFFER_CLIENT_CROSS_CMD_BUFFER_HELPER_H_
-#define GPU_COMMAND_BUFFER_CLIENT_CROSS_CMD_BUFFER_HELPER_H_
-
-#include "gpu/command_buffer/common/logging.h"
-#include "gpu/command_buffer/common/constants.h"
-#include "gpu/command_buffer/common/cmd_buffer_common.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-
-namespace command_buffer {
-
-// Command buffer helper class. This class simplifies ring buffer management:
-// it will allocate the buffer, give it to the buffer interface, and let the
-// user add commands to it, while taking care of the synchronization (put and
-// get). It also provides a way to ensure commands have been executed, through
-// the token mechanism:
-//
-// helper.AddCommand(...);
-// helper.AddCommand(...);
-// int32 token = helper.InsertToken();
-// helper.AddCommand(...);
-// helper.AddCommand(...);
-// [...]
-//
-// helper.WaitForToken(token); // this doesn't return until the first two
-// // commands have been executed.
-class CommandBufferHelper {
- public:
- explicit CommandBufferHelper(command_buffer::CommandBuffer* command_buffer);
- virtual ~CommandBufferHelper();
-
- bool Initialize();
-
- // Flushes the commands, setting the put pointer to let the buffer interface
- // know that new commands have been added. After a flush returns, the command
- // buffer service is aware of all pending commands and it is guaranteed to
- // have made some progress in processing them. Returns whether the flush was
- // successful. The flush will fail if the command buffer service has
- // disconnected.
- bool Flush();
-
- // Waits until all the commands have been executed. Returns whether it
- // was successful. The function will fail if the command buffer service has
- // disconnected.
- bool Finish();
-
- // Waits until a given number of available entries are available.
- // Parameters:
- // count: number of entries needed. This value must be at most
- // the size of the buffer minus one.
- void WaitForAvailableEntries(int32 count);
-
- // Adds a command data to the command buffer. This may wait until sufficient
- // space is available.
- // Parameters:
- // entries: The command entries to add.
- // count: The number of entries.
- void AddCommandData(const CommandBufferEntry* entries, int32 count) {
- WaitForAvailableEntries(count);
- for (; count > 0; --count) {
- entries_[put_++] = *entries++;
- }
- DCHECK_LE(put_, entry_count_);
- if (put_ == entry_count_) put_ = 0;
- }
-
- // A typed version of AddCommandData.
- template <typename T>
- void AddTypedCmdData(const T& cmd) {
- AddCommandData(reinterpret_cast<const CommandBufferEntry*>(&cmd),
- ComputeNumEntries(sizeof(cmd)));
- }
-
- // Adds a command to the command buffer. This may wait until sufficient space
- // is available.
- // Parameters:
- // command: the command index.
- // arg_count: the number of arguments for the command.
- // args: the arguments for the command (these are copied before the
- // function returns).
- void AddCommand(int32 command,
- int32 arg_count,
- const CommandBufferEntry *args) {
- CommandHeader header;
- header.size = arg_count + 1;
- header.command = command;
- WaitForAvailableEntries(header.size);
- entries_[put_++].value_header = header;
- for (int i = 0; i < arg_count; ++i) {
- entries_[put_++] = args[i];
- }
- DCHECK_LE(put_, entry_count_);
- if (put_ == entry_count_) put_ = 0;
- }
-
- // Inserts a new token into the command buffer. This token either has a value
- // different from previously inserted tokens, or ensures that previously
- // inserted tokens with that value have already passed through the command
- // stream.
- // Returns:
- // the value of the new token or -1 if the command buffer reader has
- // shutdown.
- int32 InsertToken();
-
- // Waits until the token of a particular value has passed through the command
- // stream (i.e. commands inserted before that token have been executed).
- // NOTE: This will call Flush if it needs to block.
- // Parameters:
- // the value of the token to wait for.
- void WaitForToken(int32 token);
-
- // Waits for a certain amount of space to be available. Returns address
- // of space.
- CommandBufferEntry* GetSpace(uint32 entries);
-
- // Typed version of GetSpace. Gets enough room for the given type and returns
- // a reference to it.
- template <typename T>
- T& GetCmdSpace() {
- COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed);
- uint32 space_needed = ComputeNumEntries(sizeof(T));
- void* data = GetSpace(space_needed);
- return *reinterpret_cast<T*>(data);
- }
-
- // Typed version of GetSpace for immediate commands.
- template <typename T>
- T& GetImmediateCmdSpace(size_t data_space) {
- COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN);
- uint32 space_needed = ComputeNumEntries(sizeof(T) + data_space);
- void* data = GetSpace(space_needed);
- return *reinterpret_cast<T*>(data);
- }
-
- // Typed version of GetSpace for immediate commands.
- template <typename T>
- T& GetImmediateCmdSpaceTotalSize(size_t total_space) {
- COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN);
- uint32 space_needed = ComputeNumEntries(total_space);
- void* data = GetSpace(space_needed);
- return *reinterpret_cast<T*>(data);
- }
-
- parse_error::ParseError GetParseError();
-
- // Common Commands
- void Noop(uint32 skip_count) {
- cmd::Noop& cmd = GetImmediateCmdSpace<cmd::Noop>(
- skip_count * sizeof(CommandBufferEntry));
- cmd.Init(skip_count);
- }
-
- void SetToken(uint32 token) {
- cmd::SetToken& cmd = GetCmdSpace<cmd::SetToken>();
- cmd.Init(token);
- }
-
-
- private:
- // Waits until get changes, updating the value of get_.
- void WaitForGetChange();
-
- // Returns the number of available entries (they may not be contiguous).
- int32 AvailableEntries() {
- return (get_ - put_ - 1 + entry_count_) % entry_count_;
- }
-
- command_buffer::CommandBuffer* command_buffer_;
- ::base::SharedMemory* ring_buffer_;
- CommandBufferEntry *entries_;
- int32 entry_count_;
- int32 token_;
- int32 last_token_read_;
- int32 get_;
- int32 put_;
-
- friend class CommandBufferHelperTest;
- DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper);
-};
-
-} // namespace command_buffer
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_CROSS_CMD_BUFFER_HELPER_H_
diff --git a/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
deleted file mode 100644
index 4e2b31b..0000000
--- a/gpu/command_buffer/client/cmd_buffer_helper_test.cc
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// Tests for the Command Buffer Helper.
-
-#include "base/at_exit.h"
-#include "base/message_loop.h"
-#include "gpu/command_buffer/client/cmd_buffer_helper.h"
-#include "gpu/command_buffer/service/mocks.h"
-#include "gpu/command_buffer/service/command_buffer_service.h"
-#include "gpu/command_buffer/service/gpu_processor.h"
-#include "gpu/np_utils/np_object_pointer.h"
-#include "gpu/np_utils/np_browser_stub.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace command_buffer {
-
-using command_buffer::CommandBufferService;
-using command_buffer::GPUProcessor;
-using np_utils::NPCreateObject;
-using np_utils::NPObjectPointer;
-using testing::Return;
-using testing::Mock;
-using testing::Truly;
-using testing::Sequence;
-using testing::DoAll;
-using testing::Invoke;
-using testing::_;
-
-const int32 kNumCommandEntries = 10;
-const int32 kCommandBufferSizeBytes = kNumCommandEntries * sizeof(int32);
-
-// Test fixture for CommandBufferHelper test - Creates a CommandBufferHelper,
-// using a CommandBufferEngine with a mock AsyncAPIInterface for its interface
-// (calling it directly, not through the RPC mechanism).
-class CommandBufferHelperTest : public testing::Test {
- protected:
- virtual void SetUp() {
- api_mock_.reset(new AsyncAPIMock);
- // ignore noops in the mock - we don't want to inspect the internals of the
- // helper.
- EXPECT_CALL(*api_mock_, DoCommand(0, 0, _))
- .WillRepeatedly(Return(parse_error::kParseNoError));
-
- ::base::SharedMemory* ring_buffer = new ::base::SharedMemory;
- ring_buffer->Create(std::wstring(), false, false, kCommandBufferSizeBytes);
- ring_buffer->Map(1024);
-
- command_buffer_.reset(new CommandBufferService);
- command_buffer_->Initialize(ring_buffer);
-
- parser_ = new command_buffer::CommandParser(ring_buffer->memory(),
- kCommandBufferSizeBytes,
- 0,
- kCommandBufferSizeBytes,
- 0,
- api_mock_.get());
-
- scoped_refptr<GPUProcessor> gpu_processor(new GPUProcessor(
- command_buffer_.get(), NULL, parser_, 1));
- command_buffer_->SetPutOffsetChangeCallback(NewCallback(
- gpu_processor.get(), &GPUProcessor::ProcessCommands));
-
- api_mock_->set_engine(gpu_processor.get());
-
- helper_.reset(new CommandBufferHelper(command_buffer_.get()));
- helper_->Initialize();
- }
-
- virtual void TearDown() {
- // If the GPUProcessor posts any tasks, this forces them to run.
- MessageLoop::current()->RunAllPending();
- helper_.release();
- }
-
- // Adds a command to the buffer through the helper, while adding it as an
- // expected call on the API mock.
- void AddCommandWithExpect(parse_error::ParseError _return,
- unsigned int command,
- unsigned int arg_count,
- CommandBufferEntry *args) {
- helper_->AddCommand(command, arg_count, args);
- EXPECT_CALL(*api_mock_, DoCommand(command, arg_count,
- Truly(AsyncAPIMock::IsArgs(arg_count, args))))
- .InSequence(sequence_)
- .WillOnce(Return(_return));
- }
-
- // Checks that the buffer from put to put+size is free in the parser.
- void CheckFreeSpace(CommandBufferOffset put, unsigned int size) {
- CommandBufferOffset parser_put = parser_->put();
- CommandBufferOffset parser_get = parser_->get();
- CommandBufferOffset limit = put + size;
- if (parser_get > parser_put) {
- // "busy" buffer wraps, so "free" buffer is between put (inclusive) and
- // get (exclusive).
- EXPECT_LE(parser_put, put);
- EXPECT_GT(parser_get, limit);
- } else {
- // "busy" buffer does not wrap, so the "free" buffer is the top side (from
- // put to the limit) and the bottom side (from 0 to get).
- if (put >= parser_put) {
- // we're on the top side, check we are below the limit.
- EXPECT_GE(kNumCommandEntries, limit);
- } else {
- // we're on the bottom side, check we are below get.
- EXPECT_GT(parser_get, limit);
- }
- }
- }
-
- CommandBufferOffset get_helper_put() { return helper_->put_; }
-
- base::AtExitManager at_exit_manager_;
- MessageLoop message_loop_;
- np_utils::StubNPBrowser browser_;
- scoped_ptr<AsyncAPIMock> api_mock_;
- scoped_ptr<CommandBufferService> command_buffer_;
- command_buffer::CommandParser* parser_;
- scoped_ptr<CommandBufferHelper> helper_;
- Sequence sequence_;
-};
-
-// Checks that commands in the buffer are properly executed, and that the
-// status/error stay valid.
-TEST_F(CommandBufferHelperTest, TestCommandProcessing) {
- // Check initial state of the engine - it should have been configured by the
- // helper.
- EXPECT_TRUE(parser_ != NULL);
- EXPECT_FALSE(command_buffer_->GetErrorStatus());
- EXPECT_EQ(parse_error::kParseNoError, command_buffer_->ResetParseError());
- EXPECT_EQ(0u, command_buffer_->GetGetOffset());
-
- // Add 3 commands through the helper
- AddCommandWithExpect(parse_error::kParseNoError, 1, 0, NULL);
-
- CommandBufferEntry args1[2];
- args1[0].value_uint32 = 3;
- args1[1].value_float = 4.f;
- AddCommandWithExpect(parse_error::kParseNoError, 2, 2, args1);
-
- CommandBufferEntry args2[2];
- args2[0].value_uint32 = 5;
- args2[1].value_float = 6.f;
- AddCommandWithExpect(parse_error::kParseNoError, 3, 2, args2);
-
- helper_->Flush();
- // Check that the engine has work to do now.
- EXPECT_FALSE(parser_->IsEmpty());
-
- // Wait until it's done.
- helper_->Finish();
- // Check that the engine has no more work to do.
- EXPECT_TRUE(parser_->IsEmpty());
-
- // Check that the commands did happen.
- Mock::VerifyAndClearExpectations(api_mock_.get());
-
- // Check the error status.
- EXPECT_FALSE(command_buffer_->GetErrorStatus());
- EXPECT_EQ(parse_error::kParseNoError, command_buffer_->ResetParseError());
-}
-
-// Checks that commands in the buffer are properly executed when wrapping the
-// buffer, and that the status/error stay valid.
-TEST_F(CommandBufferHelperTest, TestCommandWrapping) {
- // Add 5 commands of size 3 through the helper to make sure we do wrap.
- CommandBufferEntry args1[2];
- args1[0].value_uint32 = 3;
- args1[1].value_float = 4.f;
-
- for (unsigned int i = 0; i < 5; ++i) {
- AddCommandWithExpect(parse_error::kParseNoError, i + 1, 2, args1);
- }
-
- helper_->Finish();
- // Check that the commands did happen.
- Mock::VerifyAndClearExpectations(api_mock_.get());
-
- // Check the error status.
- EXPECT_FALSE(command_buffer_->GetErrorStatus());
- EXPECT_EQ(parse_error::kParseNoError, command_buffer_->ResetParseError());
-}
-
-
-// Checks that commands in the buffer are properly executed, even if they
-// generate a recoverable error. Check that the error status is properly set,
-// and reset when queried.
-TEST_F(CommandBufferHelperTest, TestRecoverableError) {
- CommandBufferEntry args[2];
- args[0].value_uint32 = 3;
- args[1].value_float = 4.f;
-
- // Create a command buffer with 3 commands, 2 of them generating errors
- AddCommandWithExpect(parse_error::kParseNoError, 1, 2, args);
- AddCommandWithExpect(parse_error::kParseUnknownCommand, 2, 2, args);
- AddCommandWithExpect(parse_error::kParseInvalidArguments, 3, 2,
- args);
-
- helper_->Finish();
- // Check that the commands did happen.
- Mock::VerifyAndClearExpectations(api_mock_.get());
-
- // Check that the error status was set to the first error.
- EXPECT_EQ(parse_error::kParseUnknownCommand,
- command_buffer_->ResetParseError());
- // Check that the error status was reset after the query.
- EXPECT_EQ(parse_error::kParseNoError, command_buffer_->ResetParseError());
-}
-
-// Checks that asking for available entries work, and that the parser
-// effectively won't use that space.
-TEST_F(CommandBufferHelperTest, TestAvailableEntries) {
- CommandBufferEntry args[2];
- args[0].value_uint32 = 3;
- args[1].value_float = 4.f;
-
- // Add 2 commands through the helper - 8 entries
- AddCommandWithExpect(parse_error::kParseNoError, 1, 0, NULL);
- AddCommandWithExpect(parse_error::kParseNoError, 2, 0, NULL);
- AddCommandWithExpect(parse_error::kParseNoError, 3, 2, args);
- AddCommandWithExpect(parse_error::kParseNoError, 4, 2, args);
-
- // Ask for 5 entries.
- helper_->WaitForAvailableEntries(5);
-
- CommandBufferOffset put = get_helper_put();
- CheckFreeSpace(put, 5);
-
- // Add more commands.
- AddCommandWithExpect(parse_error::kParseNoError, 5, 2, args);
-
- // Wait until everything is done done.
- helper_->Finish();
-
- // Check that the commands did happen.
- Mock::VerifyAndClearExpectations(api_mock_.get());
-
- // Check the error status.
- EXPECT_FALSE(command_buffer_->GetErrorStatus());
- EXPECT_EQ(parse_error::kParseNoError, command_buffer_->ResetParseError());
-}
-
-// Checks that the InsertToken/WaitForToken work.
-TEST_F(CommandBufferHelperTest, TestToken) {
- CommandBufferEntry args[2];
- args[0].value_uint32 = 3;
- args[1].value_float = 4.f;
-
- // Add a first command.
- AddCommandWithExpect(parse_error::kParseNoError, 3, 2, args);
- // keep track of the buffer position.
- CommandBufferOffset command1_put = get_helper_put();
- int32 token = helper_->InsertToken();
-
- EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _))
- .WillOnce(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken),
- Return(parse_error::kParseNoError)));
- // Add another command.
- AddCommandWithExpect(parse_error::kParseNoError, 4, 2, args);
- helper_->WaitForToken(token);
- // check that the get pointer is beyond the first command.
- EXPECT_LE(command1_put, command_buffer_->GetGetOffset());
- helper_->Finish();
-
- // Check that the commands did happen.
- Mock::VerifyAndClearExpectations(api_mock_.get());
-
- // Check the error status.
- EXPECT_FALSE(command_buffer_->GetErrorStatus());
- EXPECT_EQ(parse_error::kParseNoError, command_buffer_->ResetParseError());
-}
-
-} // namespace command_buffer
diff --git a/gpu/command_buffer/client/fenced_allocator.cc b/gpu/command_buffer/client/fenced_allocator.cc
deleted file mode 100644
index 810feb5..0000000
--- a/gpu/command_buffer/client/fenced_allocator.cc
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// This file contains the implementation of the FencedAllocator class.
-
-#include "gpu/command_buffer/client/fenced_allocator.h"
-#include <algorithm>
-#include "gpu/command_buffer/client/cmd_buffer_helper.h"
-
-namespace command_buffer {
-
-#ifndef COMPILER_MSVC
-const FencedAllocator::Offset FencedAllocator::kInvalidOffset;
-#endif
-
-FencedAllocator::~FencedAllocator() {
- // Free blocks pending tokens.
- for (unsigned int i = 0; i < blocks_.size(); ++i) {
- if (blocks_[i].state == FREE_PENDING_TOKEN) {
- i = WaitForTokenAndFreeBlock(i);
- }
- }
- DCHECK_EQ(blocks_.size(), 1u);
- DCHECK_EQ(blocks_[0].state, FREE);
-}
-
-// Looks for a non-allocated block that is big enough. Search in the FREE
-// blocks first (for direct usage), first-fit, then in the FREE_PENDING_TOKEN
-// blocks, waiting for them. The current implementation isn't smart about
-// optimizing what to wait for, just looks inside the block in order (first-fit
-// as well).
-FencedAllocator::Offset FencedAllocator::Alloc(unsigned int size) {
- // Similarly to malloc, an allocation of 0 allocates at least 1 byte, to
- // return different pointers every time.
- if (size == 0) size = 1;
-
- // Try first to allocate in a free block.
- for (unsigned int i = 0; i < blocks_.size(); ++i) {
- Block &block = blocks_[i];
- if (block.state == FREE && block.size >= size) {
- return AllocInBlock(i, size);
- }
- }
-
- // No free block is available. Look for blocks pending tokens, and wait for
- // them to be re-usable.
- for (unsigned int i = 0; i < blocks_.size(); ++i) {
- if (blocks_[i].state != FREE_PENDING_TOKEN)
- continue;
- i = WaitForTokenAndFreeBlock(i);
- if (blocks_[i].size >= size)
- return AllocInBlock(i, size);
- }
- return kInvalidOffset;
-}
-
-// Looks for the corresponding block, mark it FREE, and collapse it if
-// necessary.
-void FencedAllocator::Free(FencedAllocator::Offset offset) {
- BlockIndex index = GetBlockByOffset(offset);
- DCHECK_NE(blocks_[index].state, FREE);
- blocks_[index].state = FREE;
- CollapseFreeBlock(index);
-}
-
-// Looks for the corresponding block, mark it FREE_PENDING_TOKEN.
-void FencedAllocator::FreePendingToken(FencedAllocator::Offset offset,
- unsigned int token) {
- BlockIndex index = GetBlockByOffset(offset);
- Block &block = blocks_[index];
- block.state = FREE_PENDING_TOKEN;
- block.token = token;
-}
-
-// Gets the max of the size of the blocks marked as free.
-unsigned int FencedAllocator::GetLargestFreeSize() {
- unsigned int max_size = 0;
- for (unsigned int i = 0; i < blocks_.size(); ++i) {
- Block &block = blocks_[i];
- if (block.state == FREE)
- max_size = std::max(max_size, block.size);
- }
- return max_size;
-}
-
-// Gets the size of the largest segment of blocks that are either FREE or
-// FREE_PENDING_TOKEN.
-unsigned int FencedAllocator::GetLargestFreeOrPendingSize() {
- unsigned int max_size = 0;
- unsigned int current_size = 0;
- for (unsigned int i = 0; i < blocks_.size(); ++i) {
- Block &block = blocks_[i];
- if (block.state == IN_USE) {
- max_size = std::max(max_size, current_size);
- current_size = 0;
- } else {
- DCHECK(block.state == FREE || block.state == FREE_PENDING_TOKEN);
- current_size += block.size;
- }
- }
- return std::max(max_size, current_size);
-}
-
-// Makes sure that:
-// - there is at least one block.
-// - there are no contiguous FREE blocks (they should have been collapsed).
-// - the successive offsets match the block sizes, and they are in order.
-bool FencedAllocator::CheckConsistency() {
- if (blocks_.size() < 1) return false;
- for (unsigned int i = 0; i < blocks_.size() - 1; ++i) {
- Block &current = blocks_[i];
- Block &next = blocks_[i + 1];
- // This test is NOT included in the next one, because offset is unsigned.
- if (next.offset <= current.offset)
- return false;
- if (next.offset != current.offset + current.size)
- return false;
- if (current.state == FREE && next.state == FREE)
- return false;
- }
- return true;
-}
-
-// Collapse the block to the next one, then to the previous one. Provided the
-// structure is consistent, those are the only blocks eligible for collapse.
-FencedAllocator::BlockIndex FencedAllocator::CollapseFreeBlock(
- BlockIndex index) {
- if (index + 1 < blocks_.size()) {
- Block &next = blocks_[index + 1];
- if (next.state == FREE) {
- blocks_[index].size += next.size;
- blocks_.erase(blocks_.begin() + index + 1);
- }
- }
- if (index > 0) {
- Block &prev = blocks_[index - 1];
- if (prev.state == FREE) {
- prev.size += blocks_[index].size;
- blocks_.erase(blocks_.begin() + index);
- --index;
- }
- }
- return index;
-}
-
-// Waits for the block's token, then mark the block as free, then collapse it.
-FencedAllocator::BlockIndex FencedAllocator::WaitForTokenAndFreeBlock(
- BlockIndex index) {
- Block &block = blocks_[index];
- DCHECK_EQ(block.state, FREE_PENDING_TOKEN);
- helper_->WaitForToken(block.token);
- block.state = FREE;
- return CollapseFreeBlock(index);
-}
-
-// If the block is exactly the requested size, simply mark it IN_USE, otherwise
-// split it and mark the first one (of the requested size) IN_USE.
-FencedAllocator::Offset FencedAllocator::AllocInBlock(BlockIndex index,
- unsigned int size) {
- Block &block = blocks_[index];
- DCHECK_GE(block.size, size);
- DCHECK_EQ(block.state, FREE);
- Offset offset = block.offset;
- if (block.size == size) {
- block.state = IN_USE;
- return offset;
- }
- Block newblock = { FREE, offset + size, block.size - size, kUnusedToken};
- block.state = IN_USE;
- block.size = size;
- // this is the last thing being done because it may invalidate block;
- blocks_.insert(blocks_.begin() + index + 1, newblock);
- return offset;
-}
-
-// The blocks are in offset order, so we can do a binary search.
-FencedAllocator::BlockIndex FencedAllocator::GetBlockByOffset(Offset offset) {
- Block templ = { IN_USE, offset, 0, kUnusedToken };
- Container::iterator it = std::lower_bound(blocks_.begin(), blocks_.end(),
- templ, OffsetCmp());
- DCHECK(it != blocks_.end() && it->offset == offset);
- return it-blocks_.begin();
-}
-
-} // namespace command_buffer
diff --git a/gpu/command_buffer/client/fenced_allocator.h b/gpu/command_buffer/client/fenced_allocator.h
deleted file mode 100644
index 72bba33..0000000
--- a/gpu/command_buffer/client/fenced_allocator.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// This file contains the definition of the FencedAllocator class.
-
-#ifndef GPU_COMMAND_BUFFER_CLIENT_CROSS_FENCED_ALLOCATOR_H_
-#define GPU_COMMAND_BUFFER_CLIENT_CROSS_FENCED_ALLOCATOR_H_
-
-#include <vector>
-#include "base/basictypes.h"
-#include "gpu/command_buffer/common/logging.h"
-
-namespace command_buffer {
-class CommandBufferHelper;
-
-// FencedAllocator provides a mechanism to manage allocations within a fixed
-// block of memory (storing the book-keeping externally). Furthermore this
-// class allows to free data "pending" the passage of a command buffer token,
-// that is, the memory won't be reused until the command buffer has processed
-// that token.
-//
-// NOTE: Although this class is intended to be used in the command buffer
-// environment which is multi-process, this class isn't "thread safe", because
-// it isn't meant to be shared across modules. It is thread-compatible though
-// (see http://www.corp.google.com/eng/doc/cpp_primer.html#thread_safety).
-class FencedAllocator {
- public:
- typedef unsigned int Offset;
- // Invalid offset, returned by Alloc in case of failure.
- static const Offset kInvalidOffset = 0xffffffffU;
-
- // Creates a FencedAllocator. Note that the size of the buffer is passed, but
- // not its base address: everything is handled as offsets into the buffer.
- FencedAllocator(unsigned int size,
- CommandBufferHelper *helper)
- : helper_(helper) {
- Block block = { FREE, 0, size, kUnusedToken };
- blocks_.push_back(block);
- }
-
- ~FencedAllocator();
-
- // Allocates a block of memory. If the buffer is out of directly available
- // memory, this function may wait until memory that was freed "pending a
- // token" can be re-used.
- //
- // Parameters:
- // size: the size of the memory block to allocate.
- //
- // Returns:
- // the offset of the allocated memory block, or kInvalidOffset if out of
- // memory.
- Offset Alloc(unsigned int size);
-
- // Frees a block of memory.
- //
- // Parameters:
- // offset: the offset of the memory block to free.
- void Free(Offset offset);
-
- // Frees a block of memory, pending the passage of a token. That memory won't
- // be re-allocated until the token has passed through the command stream.
- //
- // Parameters:
- // offset: the offset of the memory block to free.
- // token: the token value to wait for before re-using the memory.
- void FreePendingToken(Offset offset, unsigned int token);
-
- // Gets the size of the largest free block that is available without waiting.
- unsigned int GetLargestFreeSize();
-
- // Gets the size of the largest free block that can be allocated if the
- // caller can wait. Allocating a block of this size will succeed, but may
- // block.
- unsigned int GetLargestFreeOrPendingSize();
-
- // Checks for consistency inside the book-keeping structures. Used for
- // testing.
- bool CheckConsistency();
-
- private:
- // Status of a block of memory, for book-keeping.
- enum State {
- IN_USE,
- FREE,
- FREE_PENDING_TOKEN
- };
-
- // Book-keeping sturcture that describes a block of memory.
- struct Block {
- State state;
- Offset offset;
- unsigned int size;
- unsigned int token; // token to wait for in the FREE_PENDING_TOKEN case.
- };
-
- // Comparison functor for memory block sorting.
- class OffsetCmp {
- public:
- bool operator() (const Block &left, const Block &right) {
- return left.offset < right.offset;
- }
- };
-
- typedef std::vector<Block> Container;
- typedef unsigned int BlockIndex;
-
- static const unsigned int kUnusedToken = 0;
-
- // Gets the index of a memory block, given its offset.
- BlockIndex GetBlockByOffset(Offset offset);
-
- // Collapse a free block with its neighbours if they are free. Returns the
- // index of the collapsed block.
- // NOTE: this will invalidate block indices.
- BlockIndex CollapseFreeBlock(BlockIndex index);
-
- // Waits for a FREE_PENDING_TOKEN block to be usable, and free it. Returns
- // the new index of that block (since it may have been collapsed).
- // NOTE: this will invalidate block indices.
- BlockIndex WaitForTokenAndFreeBlock(BlockIndex index);
-
- // Allocates a block of memory inside a given block, splitting it in two
- // (unless that block is of the exact requested size).
- // NOTE: this will invalidate block indices.
- // Returns the offset of the allocated block (NOTE: this is different from
- // the other functions that return a block index).
- Offset AllocInBlock(BlockIndex index, unsigned int size);
-
- command_buffer::CommandBufferHelper *helper_;
- Container blocks_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocator);
-};
-
-// This class functions just like FencedAllocator, but its API uses pointers
-// instead of offsets.
-class FencedAllocatorWrapper {
- public:
- FencedAllocatorWrapper(unsigned int size,
- CommandBufferHelper *helper,
- void *base)
- : allocator_(size, helper),
- base_(base) { }
-
- // Allocates a block of memory. If the buffer is out of directly available
- // memory, this function may wait until memory that was freed "pending a
- // token" can be re-used.
- //
- // Parameters:
- // size: the size of the memory block to allocate.
- //
- // Returns:
- // the pointer to the allocated memory block, or NULL if out of
- // memory.
- void *Alloc(unsigned int size) {
- FencedAllocator::Offset offset = allocator_.Alloc(size);
- return GetPointer(offset);
- }
-
- // Allocates a block of memory. If the buffer is out of directly available
- // memory, this function may wait until memory that was freed "pending a
- // token" can be re-used.
- // This is a type-safe version of Alloc, returning a typed pointer.
- //
- // Parameters:
- // count: the number of elements to allocate.
- //
- // Returns:
- // the pointer to the allocated memory block, or NULL if out of
- // memory.
- template <typename T> T *AllocTyped(unsigned int count) {
- return static_cast<T *>(Alloc(count * sizeof(T)));
- }
-
- // Frees a block of memory.
- //
- // Parameters:
- // pointer: the pointer to the memory block to free.
- void Free(void *pointer) {
- DCHECK(pointer);
- allocator_.Free(GetOffset(pointer));
- }
-
- // Frees a block of memory, pending the passage of a token. That memory won't
- // be re-allocated until the token has passed through the command stream.
- //
- // Parameters:
- // pointer: the pointer to the memory block to free.
- // token: the token value to wait for before re-using the memory.
- void FreePendingToken(void *pointer, unsigned int token) {
- DCHECK(pointer);
- allocator_.FreePendingToken(GetOffset(pointer), token);
- }
-
- // Gets a pointer to a memory block given the base memory and the offset.
- // It translates FencedAllocator::kInvalidOffset to NULL.
- void *GetPointer(FencedAllocator::Offset offset) {
- return (offset == FencedAllocator::kInvalidOffset) ?
- NULL : static_cast<char *>(base_) + offset;
- }
-
- // Gets the offset to a memory block given the base memory and the address.
- // It translates NULL to FencedAllocator::kInvalidOffset.
- FencedAllocator::Offset GetOffset(void *pointer) {
- return pointer ? static_cast<char *>(pointer) - static_cast<char *>(base_) :
- FencedAllocator::kInvalidOffset;
- }
-
- // Gets the size of the largest free block that is available without waiting.
- unsigned int GetLargestFreeSize() {
- return allocator_.GetLargestFreeSize();
- }
-
- // Gets the size of the largest free block that can be allocated if the
- // caller can wait.
- unsigned int GetLargestFreeOrPendingSize() {
- return allocator_.GetLargestFreeOrPendingSize();
- }
-
- // Checks for consistency inside the book-keeping structures. Used for
- // testing.
- bool CheckConsistency() {
- return allocator_.CheckConsistency();
- }
-
- FencedAllocator &allocator() { return allocator_; }
-
- private:
- FencedAllocator allocator_;
- void *base_;
- DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocatorWrapper);
-};
-
-} // namespace command_buffer
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_CROSS_FENCED_ALLOCATOR_H_
diff --git a/gpu/command_buffer/client/fenced_allocator_test.cc b/gpu/command_buffer/client/fenced_allocator_test.cc
deleted file mode 100644
index dcb75bc..0000000
--- a/gpu/command_buffer/client/fenced_allocator_test.cc
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// This file contains the tests for the FencedAllocator class.
-
-#include "base/at_exit.h"
-#include "base/message_loop.h"
-#include "gpu/command_buffer/client/cmd_buffer_helper.h"
-#include "gpu/command_buffer/client/fenced_allocator.h"
-#include "gpu/command_buffer/service/cmd_buffer_engine.h"
-#include "gpu/command_buffer/service/mocks.h"
-#include "gpu/command_buffer/service/command_buffer_service.h"
-#include "gpu/command_buffer/service/gpu_processor.h"
-#include "gpu/np_utils/np_browser_stub.h"
-#include "gpu/np_utils/np_object_pointer.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace command_buffer {
-
-using command_buffer::CommandBufferService;
-using command_buffer::GPUProcessor;
-using np_utils::NPCreateObject;
-using np_utils::NPObjectPointer;
-using testing::Return;
-using testing::Mock;
-using testing::Truly;
-using testing::Sequence;
-using testing::DoAll;
-using testing::Invoke;
-using testing::_;
-
-class BaseFencedAllocatorTest : public testing::Test {
- protected:
- static const unsigned int kBufferSize = 1024;
-
- virtual void SetUp() {
- api_mock_.reset(new AsyncAPIMock);
- // ignore noops in the mock - we don't want to inspect the internals of the
- // helper.
- EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _))
- .WillRepeatedly(Return(parse_error::kParseNoError));
- // Forward the SetToken calls to the engine
- EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _))
- .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken),
- Return(parse_error::kParseNoError)));
-
- ::base::SharedMemory* ring_buffer = new ::base::SharedMemory;
- ring_buffer->Create(std::wstring(), false, false, 1024);
- ring_buffer->Map(1024);
-
- command_buffer_.reset(new CommandBufferService);
- command_buffer_->Initialize(ring_buffer);
-
- parser_ = new command_buffer::CommandParser(ring_buffer->memory(),
- kBufferSize,
- 0,
- kBufferSize,
- 0,
- api_mock_.get());
-
- scoped_refptr<GPUProcessor> gpu_processor(new GPUProcessor(
- command_buffer_.get(), NULL, parser_, INT_MAX));
- command_buffer_->SetPutOffsetChangeCallback(NewCallback(
- gpu_processor.get(), &GPUProcessor::ProcessCommands));
-
- api_mock_->set_engine(gpu_processor.get());
-
- helper_.reset(new CommandBufferHelper(command_buffer_.get()));
- helper_->Initialize();
- }
-
- virtual void TearDown() {
- helper_.release();
- }
-
- base::AtExitManager at_exit_manager_;
- MessageLoop message_loop_;
- np_utils::StubNPBrowser browser_;
- scoped_ptr<AsyncAPIMock> api_mock_;
- scoped_ptr<CommandBufferService> command_buffer_;
- command_buffer::CommandParser* parser_;
- scoped_ptr<CommandBufferHelper> helper_;
-};
-
-#ifndef COMPILER_MSVC
-const unsigned int BaseFencedAllocatorTest::kBufferSize;
-#endif
-
-// Test fixture for FencedAllocator test - Creates a FencedAllocator, using a
-// CommandBufferHelper with a mock AsyncAPIInterface for its interface (calling
-// it directly, not through the RPC mechanism), making sure Noops are ignored
-// and SetToken are properly forwarded to the engine.
-class FencedAllocatorTest : public BaseFencedAllocatorTest {
- protected:
- virtual void SetUp() {
- BaseFencedAllocatorTest::SetUp();
- allocator_.reset(new FencedAllocator(kBufferSize, helper_.get()));
- }
-
- virtual void TearDown() {
- // If the GPUProcessor posts any tasks, this forces them to run.
- MessageLoop::current()->RunAllPending();
-
- EXPECT_TRUE(allocator_->CheckConsistency());
- allocator_.release();
-
- BaseFencedAllocatorTest::TearDown();
- }
-
- scoped_ptr<FencedAllocator> allocator_;
-};
-
-// Checks basic alloc and free.
-TEST_F(FencedAllocatorTest, TestBasic) {
- allocator_->CheckConsistency();
-
- const unsigned int kSize = 16;
- FencedAllocator::Offset offset = allocator_->Alloc(kSize);
- EXPECT_NE(FencedAllocator::kInvalidOffset, offset);
- EXPECT_GE(kBufferSize, offset+kSize);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- allocator_->Free(offset);
- EXPECT_TRUE(allocator_->CheckConsistency());
-}
-
-// Checks out-of-memory condition.
-TEST_F(FencedAllocatorTest, TestOutOfMemory) {
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- const unsigned int kSize = 16;
- const unsigned int kAllocCount = kBufferSize / kSize;
- CHECK(kAllocCount * kSize == kBufferSize);
-
- // Allocate several buffers to fill in the memory.
- FencedAllocator::Offset offsets[kAllocCount];
- for (unsigned int i = 0; i < kAllocCount; ++i) {
- offsets[i] = allocator_->Alloc(kSize);
- EXPECT_NE(FencedAllocator::kInvalidOffset, offsets[i]);
- EXPECT_GE(kBufferSize, offsets[i]+kSize);
- EXPECT_TRUE(allocator_->CheckConsistency());
- }
-
- // This allocation should fail.
- FencedAllocator::Offset offset_failed = allocator_->Alloc(kSize);
- EXPECT_EQ(FencedAllocator::kInvalidOffset, offset_failed);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // Free one successful allocation, reallocate with half the size
- allocator_->Free(offsets[0]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- offsets[0] = allocator_->Alloc(kSize/2);
- EXPECT_NE(FencedAllocator::kInvalidOffset, offsets[0]);
- EXPECT_GE(kBufferSize, offsets[0]+kSize);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // This allocation should fail as well.
- offset_failed = allocator_->Alloc(kSize);
- EXPECT_EQ(FencedAllocator::kInvalidOffset, offset_failed);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // Free up everything.
- for (unsigned int i = 0; i < kAllocCount; ++i) {
- allocator_->Free(offsets[i]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- }
-}
-
-// Checks the free-pending-token mechanism.
-TEST_F(FencedAllocatorTest, TestFreePendingToken) {
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- const unsigned int kSize = 16;
- const unsigned int kAllocCount = kBufferSize / kSize;
- CHECK(kAllocCount * kSize == kBufferSize);
-
- // Allocate several buffers to fill in the memory.
- FencedAllocator::Offset offsets[kAllocCount];
- for (unsigned int i = 0; i < kAllocCount; ++i) {
- offsets[i] = allocator_->Alloc(kSize);
- EXPECT_NE(FencedAllocator::kInvalidOffset, offsets[i]);
- EXPECT_GE(kBufferSize, offsets[i]+kSize);
- EXPECT_TRUE(allocator_->CheckConsistency());
- }
-
- // This allocation should fail.
- FencedAllocator::Offset offset_failed = allocator_->Alloc(kSize);
- EXPECT_EQ(FencedAllocator::kInvalidOffset, offset_failed);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // Free one successful allocation, pending fence.
- int32 token = helper_.get()->InsertToken();
- allocator_->FreePendingToken(offsets[0], token);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // The way we hooked up the helper and engine, it won't process commands
- // until it has to wait for something. Which means the token shouldn't have
- // passed yet at this point.
- EXPECT_GT(token, command_buffer_->GetToken());
-
- // This allocation will need to reclaim the space freed above, so that should
- // process the commands until the token is passed.
- offsets[0] = allocator_->Alloc(kSize);
- EXPECT_NE(FencedAllocator::kInvalidOffset, offsets[0]);
- EXPECT_GE(kBufferSize, offsets[0]+kSize);
- EXPECT_TRUE(allocator_->CheckConsistency());
- // Check that the token has indeed passed.
- EXPECT_LE(token, command_buffer_->GetToken());
-
- // Free up everything.
- for (unsigned int i = 0; i < kAllocCount; ++i) {
- allocator_->Free(offsets[i]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- }
-}
-
-// Tests GetLargestFreeSize
-TEST_F(FencedAllocatorTest, TestGetLargestFreeSize) {
- EXPECT_TRUE(allocator_->CheckConsistency());
- EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeSize());
-
- FencedAllocator::Offset offset = allocator_->Alloc(kBufferSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset);
- EXPECT_EQ(0u, allocator_->GetLargestFreeSize());
- allocator_->Free(offset);
- EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeSize());
-
- const unsigned int kSize = 16;
- offset = allocator_->Alloc(kSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset);
- // The following checks that the buffer is allocated "smartly" - which is
- // dependent on the implementation. But both first-fit or best-fit would
- // ensure that.
- EXPECT_EQ(kBufferSize - kSize, allocator_->GetLargestFreeSize());
-
- // Allocate 2 more buffers (now 3), and then free the first two. This is to
- // ensure a hole. Note that this is dependent on the first-fit current
- // implementation.
- FencedAllocator::Offset offset1 = allocator_->Alloc(kSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset1);
- FencedAllocator::Offset offset2 = allocator_->Alloc(kSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset2);
- allocator_->Free(offset);
- allocator_->Free(offset1);
- EXPECT_EQ(kBufferSize - 3 * kSize, allocator_->GetLargestFreeSize());
-
- offset = allocator_->Alloc(kBufferSize - 3 * kSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset);
- EXPECT_EQ(2 * kSize, allocator_->GetLargestFreeSize());
-
- offset1 = allocator_->Alloc(2 * kSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset1);
- EXPECT_EQ(0u, allocator_->GetLargestFreeSize());
-
- allocator_->Free(offset);
- allocator_->Free(offset1);
- allocator_->Free(offset2);
-}
-
-// Tests GetLargestFreeOrPendingSize
-TEST_F(FencedAllocatorTest, TestGetLargestFreeOrPendingSize) {
- EXPECT_TRUE(allocator_->CheckConsistency());
- EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeOrPendingSize());
-
- FencedAllocator::Offset offset = allocator_->Alloc(kBufferSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset);
- EXPECT_EQ(0u, allocator_->GetLargestFreeOrPendingSize());
- allocator_->Free(offset);
- EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeOrPendingSize());
-
- const unsigned int kSize = 16;
- offset = allocator_->Alloc(kSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset);
- // The following checks that the buffer is allocates "smartly" - which is
- // dependent on the implementation. But both first-fit or best-fit would
- // ensure that.
- EXPECT_EQ(kBufferSize - kSize, allocator_->GetLargestFreeOrPendingSize());
-
- // Allocate 2 more buffers (now 3), and then free the first two. This is to
- // ensure a hole. Note that this is dependent on the first-fit current
- // implementation.
- FencedAllocator::Offset offset1 = allocator_->Alloc(kSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset1);
- FencedAllocator::Offset offset2 = allocator_->Alloc(kSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset2);
- allocator_->Free(offset);
- allocator_->Free(offset1);
- EXPECT_EQ(kBufferSize - 3 * kSize,
- allocator_->GetLargestFreeOrPendingSize());
-
- // Free the last one, pending a token.
- int32 token = helper_.get()->InsertToken();
- allocator_->FreePendingToken(offset2, token);
-
- // Now all the buffers have been freed...
- EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeOrPendingSize());
- // .. but one is still waiting for the token.
- EXPECT_EQ(kBufferSize - 3 * kSize,
- allocator_->GetLargestFreeSize());
-
- // The way we hooked up the helper and engine, it won't process commands
- // until it has to wait for something. Which means the token shouldn't have
- // passed yet at this point.
- EXPECT_GT(token, command_buffer_->GetToken());
- // This allocation will need to reclaim the space freed above, so that should
- // process the commands until the token is passed, but it will succeed.
- offset = allocator_->Alloc(kBufferSize);
- ASSERT_NE(FencedAllocator::kInvalidOffset, offset);
- // Check that the token has indeed passed.
- EXPECT_LE(token, command_buffer_->GetToken());
- allocator_->Free(offset);
-
- // Everything now has been freed...
- EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeOrPendingSize());
- // ... for real.
- EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeSize());
-}
-
-// Test fixture for FencedAllocatorWrapper test - Creates a
-// FencedAllocatorWrapper, using a CommandBufferHelper with a mock
-// AsyncAPIInterface for its interface (calling it directly, not through the
-// RPC mechanism), making sure Noops are ignored and SetToken are properly
-// forwarded to the engine.
-class FencedAllocatorWrapperTest : public BaseFencedAllocatorTest {
- protected:
- virtual void SetUp() {
- BaseFencedAllocatorTest::SetUp();
-
- // Though allocating this buffer isn't strictly necessary, it makes
- // allocations point to valid addresses, so they could be used for
- // something.
- buffer_.reset(new char[kBufferSize]);
- allocator_.reset(new FencedAllocatorWrapper(kBufferSize, helper_.get(),
- buffer_.get()));
- }
-
- virtual void TearDown() {
- // If the GPUProcessor posts any tasks, this forces them to run.
- MessageLoop::current()->RunAllPending();
-
- EXPECT_TRUE(allocator_->CheckConsistency());
- allocator_.release();
- buffer_.release();
-
- BaseFencedAllocatorTest::TearDown();
- }
-
- scoped_ptr<FencedAllocatorWrapper> allocator_;
- scoped_array<char> buffer_;
-};
-
-// Checks basic alloc and free.
-TEST_F(FencedAllocatorWrapperTest, TestBasic) {
- allocator_->CheckConsistency();
-
- const unsigned int kSize = 16;
- void *pointer = allocator_->Alloc(kSize);
- ASSERT_TRUE(pointer);
- EXPECT_LE(buffer_.get(), static_cast<char *>(pointer));
- EXPECT_GE(kBufferSize, static_cast<char *>(pointer) - buffer_.get() + kSize);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- allocator_->Free(pointer);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- char *pointer_char = allocator_->AllocTyped<char>(kSize);
- ASSERT_TRUE(pointer_char);
- EXPECT_LE(buffer_.get(), pointer_char);
- EXPECT_GE(buffer_.get() + kBufferSize, pointer_char + kSize);
- allocator_->Free(pointer_char);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- unsigned int *pointer_uint = allocator_->AllocTyped<unsigned int>(kSize);
- ASSERT_TRUE(pointer_uint);
- EXPECT_LE(buffer_.get(), reinterpret_cast<char *>(pointer_uint));
- EXPECT_GE(buffer_.get() + kBufferSize,
- reinterpret_cast<char *>(pointer_uint + kSize));
-
- // Check that it did allocate kSize * sizeof(unsigned int). We can't tell
- // directly, except from the remaining size.
- EXPECT_EQ(kBufferSize - kSize * sizeof(*pointer_uint),
- allocator_->GetLargestFreeSize());
- allocator_->Free(pointer_uint);
-}
-
-// Checks out-of-memory condition.
-TEST_F(FencedAllocatorWrapperTest, TestOutOfMemory) {
- allocator_->CheckConsistency();
-
- const unsigned int kSize = 16;
- const unsigned int kAllocCount = kBufferSize / kSize;
- CHECK(kAllocCount * kSize == kBufferSize);
-
- // Allocate several buffers to fill in the memory.
- void *pointers[kAllocCount];
- for (unsigned int i = 0; i < kAllocCount; ++i) {
- pointers[i] = allocator_->Alloc(kSize);
- EXPECT_TRUE(pointers[i]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- }
-
- // This allocation should fail.
- void *pointer_failed = allocator_->Alloc(kSize);
- EXPECT_FALSE(pointer_failed);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // Free one successful allocation, reallocate with half the size
- allocator_->Free(pointers[0]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- pointers[0] = allocator_->Alloc(kSize/2);
- EXPECT_TRUE(pointers[0]);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // This allocation should fail as well.
- pointer_failed = allocator_->Alloc(kSize);
- EXPECT_FALSE(pointer_failed);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // Free up everything.
- for (unsigned int i = 0; i < kAllocCount; ++i) {
- allocator_->Free(pointers[i]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- }
-}
-
-// Checks the free-pending-token mechanism.
-TEST_F(FencedAllocatorWrapperTest, TestFreePendingToken) {
- allocator_->CheckConsistency();
-
- const unsigned int kSize = 16;
- const unsigned int kAllocCount = kBufferSize / kSize;
- CHECK(kAllocCount * kSize == kBufferSize);
-
- // Allocate several buffers to fill in the memory.
- void *pointers[kAllocCount];
- for (unsigned int i = 0; i < kAllocCount; ++i) {
- pointers[i] = allocator_->Alloc(kSize);
- EXPECT_TRUE(pointers[i]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- }
-
- // This allocation should fail.
- void *pointer_failed = allocator_->Alloc(kSize);
- EXPECT_FALSE(pointer_failed);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // Free one successful allocation, pending fence.
- int32 token = helper_.get()->InsertToken();
- allocator_->FreePendingToken(pointers[0], token);
- EXPECT_TRUE(allocator_->CheckConsistency());
-
- // The way we hooked up the helper and engine, it won't process commands
- // until it has to wait for something. Which means the token shouldn't have
- // passed yet at this point.
- EXPECT_GT(token, command_buffer_->GetToken());
-
- // This allocation will need to reclaim the space freed above, so that should
- // process the commands until the token is passed.
- pointers[0] = allocator_->Alloc(kSize);
- EXPECT_TRUE(pointers[0]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- // Check that the token has indeed passed.
- EXPECT_LE(token, command_buffer_->GetToken());
-
- // Free up everything.
- for (unsigned int i = 0; i < kAllocCount; ++i) {
- allocator_->Free(pointers[i]);
- EXPECT_TRUE(allocator_->CheckConsistency());
- }
-}
-
-} // namespace command_buffer
diff --git a/gpu/command_buffer/client/gles2_c_lib.cc b/gpu/command_buffer/client/gles2_c_lib.cc
deleted file mode 100644
index d311a5d..0000000
--- a/gpu/command_buffer/client/gles2_c_lib.cc
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2006-2009 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.
-
-// These functions emluate GLES2 over command buffers for C.
-
-#include "gpu/command_buffer/client/gles2_lib.h"
-
-extern "C" {
-// Include the auto-generated part of this file. We split this because it means
-// we can easily edit the non-auto generated parts right here in this file
-// instead of having to edit some template or the code generator.
-#include "gpu/command_buffer/client/gles2_c_lib_autogen.h"
-} // extern "C"
-
-
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
deleted file mode 100644
index c03a350..0000000
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ /dev/null
@@ -1,504 +0,0 @@
-// This file is auto-generated. DO NOT EDIT!
-
-
-// These functions emluate GLES2 over command buffers.
-
-
-void GLES2ActiveTexture(GLenum texture) {
- gles2::GetGLContext()->ActiveTexture(texture);
-}
-void GLES2AttachShader(GLuint program, GLuint shader) {
- gles2::GetGLContext()->AttachShader(program, shader);
-}
-void GLES2BindAttribLocation(GLuint program, GLuint index, const char* name) {
- gles2::GetGLContext()->BindAttribLocation(program, index, name);
-}
-void GLES2BindBuffer(GLenum target, GLuint buffer) {
- gles2::GetGLContext()->BindBuffer(target, buffer);
-}
-void GLES2BindFramebuffer(GLenum target, GLuint framebuffer) {
- gles2::GetGLContext()->BindFramebuffer(target, framebuffer);
-}
-void GLES2BindRenderbuffer(GLenum target, GLuint renderbuffer) {
- gles2::GetGLContext()->BindRenderbuffer(target, renderbuffer);
-}
-void GLES2BindTexture(GLenum target, GLuint texture) {
- gles2::GetGLContext()->BindTexture(target, texture);
-}
-void GLES2BlendColor(
- GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- gles2::GetGLContext()->BlendColor(red, green, blue, alpha);
-}
-void GLES2BlendEquation(GLenum mode) {
- gles2::GetGLContext()->BlendEquation(mode);
-}
-void GLES2BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
- gles2::GetGLContext()->BlendEquationSeparate(modeRGB, modeAlpha);
-}
-void GLES2BlendFunc(GLenum sfactor, GLenum dfactor) {
- gles2::GetGLContext()->BlendFunc(sfactor, dfactor);
-}
-void GLES2BlendFuncSeparate(
- GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- gles2::GetGLContext()->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-void GLES2BufferData(
- GLenum target, GLsizeiptr size, const void* data, GLenum usage) {
- gles2::GetGLContext()->BufferData(target, size, data, usage);
-}
-void GLES2BufferSubData(
- GLenum target, GLintptr offset, GLsizeiptr size, const void* data) {
- gles2::GetGLContext()->BufferSubData(target, offset, size, data);
-}
-GLenum GLES2CheckFramebufferStatus(GLenum target) {
- return gles2::GetGLContext()->CheckFramebufferStatus(target);
-}
-void GLES2Clear(GLbitfield mask) {
- gles2::GetGLContext()->Clear(mask);
-}
-void GLES2ClearColor(
- GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- gles2::GetGLContext()->ClearColor(red, green, blue, alpha);
-}
-void GLES2ClearDepthf(GLclampf depth) {
- gles2::GetGLContext()->ClearDepthf(depth);
-}
-void GLES2ClearStencil(GLint s) {
- gles2::GetGLContext()->ClearStencil(s);
-}
-void GLES2ColorMask(
- GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
- gles2::GetGLContext()->ColorMask(red, green, blue, alpha);
-}
-void GLES2CompileShader(GLuint shader) {
- gles2::GetGLContext()->CompileShader(shader);
-}
-void GLES2CompressedTexImage2D(
- GLenum target, GLint level, GLenum internalformat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize, const void* data) {
- gles2::GetGLContext(
- )->CompressedTexImage2D(
- target, level, internalformat, width, height, border, imageSize,
- data);
-}
-void GLES2CompressedTexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLsizei imageSize, const void* data) {
- gles2::GetGLContext(
- )->CompressedTexSubImage2D(
- target, level, xoffset, yoffset, width, height, format, imageSize,
- data);
-}
-void GLES2CopyTexImage2D(
- GLenum target, GLint level, GLenum internalformat, GLint x, GLint y,
- GLsizei width, GLsizei height, GLint border) {
- gles2::GetGLContext(
- )->CopyTexImage2D(
- target, level, internalformat, x, y, width, height, border);
-}
-void GLES2CopyTexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y,
- GLsizei width, GLsizei height) {
- gles2::GetGLContext(
- )->CopyTexSubImage2D(
- target, level, xoffset, yoffset, x, y, width, height);
-}
-GLuint GLES2CreateProgram() {
- return gles2::GetGLContext()->CreateProgram();
-}
-GLuint GLES2CreateShader(GLenum type) {
- return gles2::GetGLContext()->CreateShader(type);
-}
-void GLES2CullFace(GLenum mode) {
- gles2::GetGLContext()->CullFace(mode);
-}
-void GLES2DeleteBuffers(GLsizei n, const GLuint* buffers) {
- gles2::GetGLContext()->DeleteBuffers(n, buffers);
-}
-void GLES2DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) {
- gles2::GetGLContext()->DeleteFramebuffers(n, framebuffers);
-}
-void GLES2DeleteProgram(GLuint program) {
- gles2::GetGLContext()->DeleteProgram(program);
-}
-void GLES2DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) {
- gles2::GetGLContext()->DeleteRenderbuffers(n, renderbuffers);
-}
-void GLES2DeleteShader(GLuint shader) {
- gles2::GetGLContext()->DeleteShader(shader);
-}
-void GLES2DeleteTextures(GLsizei n, const GLuint* textures) {
- gles2::GetGLContext()->DeleteTextures(n, textures);
-}
-void GLES2DepthFunc(GLenum func) {
- gles2::GetGLContext()->DepthFunc(func);
-}
-void GLES2DepthMask(GLboolean flag) {
- gles2::GetGLContext()->DepthMask(flag);
-}
-void GLES2DepthRangef(GLclampf zNear, GLclampf zFar) {
- gles2::GetGLContext()->DepthRangef(zNear, zFar);
-}
-void GLES2DetachShader(GLuint program, GLuint shader) {
- gles2::GetGLContext()->DetachShader(program, shader);
-}
-void GLES2Disable(GLenum cap) {
- gles2::GetGLContext()->Disable(cap);
-}
-void GLES2DisableVertexAttribArray(GLuint index) {
- gles2::GetGLContext()->DisableVertexAttribArray(index);
-}
-void GLES2DrawArrays(GLenum mode, GLint first, GLsizei count) {
- gles2::GetGLContext()->DrawArrays(mode, first, count);
-}
-void GLES2DrawElements(
- GLenum mode, GLsizei count, GLenum type, const void* indices) {
- gles2::GetGLContext()->DrawElements(mode, count, type, indices);
-}
-void GLES2Enable(GLenum cap) {
- gles2::GetGLContext()->Enable(cap);
-}
-void GLES2EnableVertexAttribArray(GLuint index) {
- gles2::GetGLContext()->EnableVertexAttribArray(index);
-}
-void GLES2Finish() {
- gles2::GetGLContext()->Finish();
-}
-void GLES2Flush() {
- gles2::GetGLContext()->Flush();
-}
-void GLES2FramebufferRenderbuffer(
- GLenum target, GLenum attachment, GLenum renderbuffertarget,
- GLuint renderbuffer) {
- gles2::GetGLContext(
- )->FramebufferRenderbuffer(
- target, attachment, renderbuffertarget, renderbuffer);
-}
-void GLES2FramebufferTexture2D(
- GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
- GLint level) {
- gles2::GetGLContext(
- )->FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-void GLES2FrontFace(GLenum mode) {
- gles2::GetGLContext()->FrontFace(mode);
-}
-void GLES2GenBuffers(GLsizei n, GLuint* buffers) {
- gles2::GetGLContext()->GenBuffers(n, buffers);
-}
-void GLES2GenerateMipmap(GLenum target) {
- gles2::GetGLContext()->GenerateMipmap(target);
-}
-void GLES2GenFramebuffers(GLsizei n, GLuint* framebuffers) {
- gles2::GetGLContext()->GenFramebuffers(n, framebuffers);
-}
-void GLES2GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
- gles2::GetGLContext()->GenRenderbuffers(n, renderbuffers);
-}
-void GLES2GenTextures(GLsizei n, GLuint* textures) {
- gles2::GetGLContext()->GenTextures(n, textures);
-}
-void GLES2GetActiveAttrib(
- GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
- GLenum* type, char* name) {
- gles2::GetGLContext(
- )->GetActiveAttrib(program, index, bufsize, length, size, type, name);
-}
-void GLES2GetActiveUniform(
- GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
- GLenum* type, char* name) {
- gles2::GetGLContext(
- )->GetActiveUniform(program, index, bufsize, length, size, type, name);
-}
-void GLES2GetAttachedShaders(
- GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
- gles2::GetGLContext()->GetAttachedShaders(program, maxcount, count, shaders);
-}
-int GLES2GetAttribLocation(GLuint program, const char* name) {
- return gles2::GetGLContext()->GetAttribLocation(program, name);
-}
-void GLES2GetBooleanv(GLenum pname, GLboolean* params) {
- gles2::GetGLContext()->GetBooleanv(pname, params);
-}
-void GLES2GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) {
- gles2::GetGLContext()->GetBufferParameteriv(target, pname, params);
-}
-GLenum GLES2GetError() {
- return gles2::GetGLContext()->GetError();
-}
-void GLES2GetFloatv(GLenum pname, GLfloat* params) {
- gles2::GetGLContext()->GetFloatv(pname, params);
-}
-void GLES2GetFramebufferAttachmentParameteriv(
- GLenum target, GLenum attachment, GLenum pname, GLint* params) {
- gles2::GetGLContext(
- )->GetFramebufferAttachmentParameteriv(
- target, attachment, pname, params);
-}
-void GLES2GetIntegerv(GLenum pname, GLint* params) {
- gles2::GetGLContext()->GetIntegerv(pname, params);
-}
-void GLES2GetProgramiv(GLuint program, GLenum pname, GLint* params) {
- gles2::GetGLContext()->GetProgramiv(program, pname, params);
-}
-void GLES2GetProgramInfoLog(
- GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) {
- gles2::GetGLContext()->GetProgramInfoLog(program, bufsize, length, infolog);
-}
-void GLES2GetRenderbufferParameteriv(
- GLenum target, GLenum pname, GLint* params) {
- gles2::GetGLContext()->GetRenderbufferParameteriv(target, pname, params);
-}
-void GLES2GetShaderiv(GLuint shader, GLenum pname, GLint* params) {
- gles2::GetGLContext()->GetShaderiv(shader, pname, params);
-}
-void GLES2GetShaderInfoLog(
- GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) {
- gles2::GetGLContext()->GetShaderInfoLog(shader, bufsize, length, infolog);
-}
-void GLES2GetShaderPrecisionFormat(
- GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
- gles2::GetGLContext(
- )->GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-void GLES2GetShaderSource(
- GLuint shader, GLsizei bufsize, GLsizei* length, char* source) {
- gles2::GetGLContext()->GetShaderSource(shader, bufsize, length, source);
-}
-const GLubyte* GLES2GetString(GLenum name) {
- return gles2::GetGLContext()->GetString(name);
-}
-void GLES2GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) {
- gles2::GetGLContext()->GetTexParameterfv(target, pname, params);
-}
-void GLES2GetTexParameteriv(GLenum target, GLenum pname, GLint* params) {
- gles2::GetGLContext()->GetTexParameteriv(target, pname, params);
-}
-void GLES2GetUniformfv(GLuint program, GLint location, GLfloat* params) {
- gles2::GetGLContext()->GetUniformfv(program, location, params);
-}
-void GLES2GetUniformiv(GLuint program, GLint location, GLint* params) {
- gles2::GetGLContext()->GetUniformiv(program, location, params);
-}
-int GLES2GetUniformLocation(GLuint program, const char* name) {
- return gles2::GetGLContext()->GetUniformLocation(program, name);
-}
-void GLES2GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) {
- gles2::GetGLContext()->GetVertexAttribfv(index, pname, params);
-}
-void GLES2GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) {
- gles2::GetGLContext()->GetVertexAttribiv(index, pname, params);
-}
-void GLES2GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) {
- gles2::GetGLContext()->GetVertexAttribPointerv(index, pname, pointer);
-}
-void GLES2Hint(GLenum target, GLenum mode) {
- gles2::GetGLContext()->Hint(target, mode);
-}
-GLboolean GLES2IsBuffer(GLuint buffer) {
- return gles2::GetGLContext()->IsBuffer(buffer);
-}
-GLboolean GLES2IsEnabled(GLenum cap) {
- return gles2::GetGLContext()->IsEnabled(cap);
-}
-GLboolean GLES2IsFramebuffer(GLuint framebuffer) {
- return gles2::GetGLContext()->IsFramebuffer(framebuffer);
-}
-GLboolean GLES2IsProgram(GLuint program) {
- return gles2::GetGLContext()->IsProgram(program);
-}
-GLboolean GLES2IsRenderbuffer(GLuint renderbuffer) {
- return gles2::GetGLContext()->IsRenderbuffer(renderbuffer);
-}
-GLboolean GLES2IsShader(GLuint shader) {
- return gles2::GetGLContext()->IsShader(shader);
-}
-GLboolean GLES2IsTexture(GLuint texture) {
- return gles2::GetGLContext()->IsTexture(texture);
-}
-void GLES2LineWidth(GLfloat width) {
- gles2::GetGLContext()->LineWidth(width);
-}
-void GLES2LinkProgram(GLuint program) {
- gles2::GetGLContext()->LinkProgram(program);
-}
-void GLES2PixelStorei(GLenum pname, GLint param) {
- gles2::GetGLContext()->PixelStorei(pname, param);
-}
-void GLES2PolygonOffset(GLfloat factor, GLfloat units) {
- gles2::GetGLContext()->PolygonOffset(factor, units);
-}
-void GLES2ReadPixels(
- GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- void* pixels) {
- gles2::GetGLContext()->ReadPixels(x, y, width, height, format, type, pixels);
-}
-void GLES2RenderbufferStorage(
- GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
- gles2::GetGLContext(
- )->RenderbufferStorage(target, internalformat, width, height);
-}
-void GLES2SampleCoverage(GLclampf value, GLboolean invert) {
- gles2::GetGLContext()->SampleCoverage(value, invert);
-}
-void GLES2Scissor(GLint x, GLint y, GLsizei width, GLsizei height) {
- gles2::GetGLContext()->Scissor(x, y, width, height);
-}
-void GLES2ShaderSource(
- GLuint shader, GLsizei count, const char** string, const GLint* length) {
- gles2::GetGLContext()->ShaderSource(shader, count, string, length);
-}
-void GLES2StencilFunc(GLenum func, GLint ref, GLuint mask) {
- gles2::GetGLContext()->StencilFunc(func, ref, mask);
-}
-void GLES2StencilFuncSeparate(
- GLenum face, GLenum func, GLint ref, GLuint mask) {
- gles2::GetGLContext()->StencilFuncSeparate(face, func, ref, mask);
-}
-void GLES2StencilMask(GLuint mask) {
- gles2::GetGLContext()->StencilMask(mask);
-}
-void GLES2StencilMaskSeparate(GLenum face, GLuint mask) {
- gles2::GetGLContext()->StencilMaskSeparate(face, mask);
-}
-void GLES2StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
- gles2::GetGLContext()->StencilOp(fail, zfail, zpass);
-}
-void GLES2StencilOpSeparate(
- GLenum face, GLenum fail, GLenum zfail, GLenum zpass) {
- gles2::GetGLContext()->StencilOpSeparate(face, fail, zfail, zpass);
-}
-void GLES2TexImage2D(
- GLenum target, GLint level, GLint internalformat, GLsizei width,
- GLsizei height, GLint border, GLenum format, GLenum type,
- const void* pixels) {
- gles2::GetGLContext(
- )->TexImage2D(
- target, level, internalformat, width, height, border, format, type,
- pixels);
-}
-void GLES2TexParameterf(GLenum target, GLenum pname, GLfloat param) {
- gles2::GetGLContext()->TexParameterf(target, pname, param);
-}
-void GLES2TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) {
- gles2::GetGLContext()->TexParameterfv(target, pname, params);
-}
-void GLES2TexParameteri(GLenum target, GLenum pname, GLint param) {
- gles2::GetGLContext()->TexParameteri(target, pname, param);
-}
-void GLES2TexParameteriv(GLenum target, GLenum pname, const GLint* params) {
- gles2::GetGLContext()->TexParameteriv(target, pname, params);
-}
-void GLES2TexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLenum type, const void* pixels) {
- gles2::GetGLContext(
- )->TexSubImage2D(
- target, level, xoffset, yoffset, width, height, format, type,
- pixels);
-}
-void GLES2Uniform1f(GLint location, GLfloat x) {
- gles2::GetGLContext()->Uniform1f(location, x);
-}
-void GLES2Uniform1fv(GLint location, GLsizei count, const GLfloat* v) {
- gles2::GetGLContext()->Uniform1fv(location, count, v);
-}
-void GLES2Uniform1i(GLint location, GLint x) {
- gles2::GetGLContext()->Uniform1i(location, x);
-}
-void GLES2Uniform1iv(GLint location, GLsizei count, const GLint* v) {
- gles2::GetGLContext()->Uniform1iv(location, count, v);
-}
-void GLES2Uniform2f(GLint location, GLfloat x, GLfloat y) {
- gles2::GetGLContext()->Uniform2f(location, x, y);
-}
-void GLES2Uniform2fv(GLint location, GLsizei count, const GLfloat* v) {
- gles2::GetGLContext()->Uniform2fv(location, count, v);
-}
-void GLES2Uniform2i(GLint location, GLint x, GLint y) {
- gles2::GetGLContext()->Uniform2i(location, x, y);
-}
-void GLES2Uniform2iv(GLint location, GLsizei count, const GLint* v) {
- gles2::GetGLContext()->Uniform2iv(location, count, v);
-}
-void GLES2Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) {
- gles2::GetGLContext()->Uniform3f(location, x, y, z);
-}
-void GLES2Uniform3fv(GLint location, GLsizei count, const GLfloat* v) {
- gles2::GetGLContext()->Uniform3fv(location, count, v);
-}
-void GLES2Uniform3i(GLint location, GLint x, GLint y, GLint z) {
- gles2::GetGLContext()->Uniform3i(location, x, y, z);
-}
-void GLES2Uniform3iv(GLint location, GLsizei count, const GLint* v) {
- gles2::GetGLContext()->Uniform3iv(location, count, v);
-}
-void GLES2Uniform4f(
- GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- gles2::GetGLContext()->Uniform4f(location, x, y, z, w);
-}
-void GLES2Uniform4fv(GLint location, GLsizei count, const GLfloat* v) {
- gles2::GetGLContext()->Uniform4fv(location, count, v);
-}
-void GLES2Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) {
- gles2::GetGLContext()->Uniform4i(location, x, y, z, w);
-}
-void GLES2Uniform4iv(GLint location, GLsizei count, const GLint* v) {
- gles2::GetGLContext()->Uniform4iv(location, count, v);
-}
-void GLES2UniformMatrix2fv(
- GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- gles2::GetGLContext()->UniformMatrix2fv(location, count, transpose, value);
-}
-void GLES2UniformMatrix3fv(
- GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- gles2::GetGLContext()->UniformMatrix3fv(location, count, transpose, value);
-}
-void GLES2UniformMatrix4fv(
- GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- gles2::GetGLContext()->UniformMatrix4fv(location, count, transpose, value);
-}
-void GLES2UseProgram(GLuint program) {
- gles2::GetGLContext()->UseProgram(program);
-}
-void GLES2ValidateProgram(GLuint program) {
- gles2::GetGLContext()->ValidateProgram(program);
-}
-void GLES2VertexAttrib1f(GLuint indx, GLfloat x) {
- gles2::GetGLContext()->VertexAttrib1f(indx, x);
-}
-void GLES2VertexAttrib1fv(GLuint indx, const GLfloat* values) {
- gles2::GetGLContext()->VertexAttrib1fv(indx, values);
-}
-void GLES2VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
- gles2::GetGLContext()->VertexAttrib2f(indx, x, y);
-}
-void GLES2VertexAttrib2fv(GLuint indx, const GLfloat* values) {
- gles2::GetGLContext()->VertexAttrib2fv(indx, values);
-}
-void GLES2VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
- gles2::GetGLContext()->VertexAttrib3f(indx, x, y, z);
-}
-void GLES2VertexAttrib3fv(GLuint indx, const GLfloat* values) {
- gles2::GetGLContext()->VertexAttrib3fv(indx, values);
-}
-void GLES2VertexAttrib4f(
- GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- gles2::GetGLContext()->VertexAttrib4f(indx, x, y, z, w);
-}
-void GLES2VertexAttrib4fv(GLuint indx, const GLfloat* values) {
- gles2::GetGLContext()->VertexAttrib4fv(indx, values);
-}
-void GLES2VertexAttribPointer(
- GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
- const void* ptr) {
- gles2::GetGLContext(
- )->VertexAttribPointer(indx, size, type, normalized, stride, ptr);
-}
-void GLES2Viewport(GLint x, GLint y, GLsizei width, GLsizei height) {
- gles2::GetGLContext()->Viewport(x, y, width, height);
-}
-void GLES2SwapBuffers() {
- gles2::GetGLContext()->SwapBuffers();
-}
-
diff --git a/gpu/command_buffer/client/gles2_cmd_helper.cc b/gpu/command_buffer/client/gles2_cmd_helper.cc
deleted file mode 100644
index 1dff914..0000000
--- a/gpu/command_buffer/client/gles2_cmd_helper.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2006-2009 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"
-
-namespace command_buffer {
-
-// Currently this is a place holder.
-
-} // namespace command_buffer
-
-
-
diff --git a/gpu/command_buffer/client/gles2_cmd_helper.h b/gpu/command_buffer/client/gles2_cmd_helper.h
deleted file mode 100644
index 9a1a741..0000000
--- a/gpu/command_buffer/client/gles2_cmd_helper.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2006-2009 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_CLIENT_GLES2_CMD_HELPER_H
-#define GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H
-
-#include "gpu/command_buffer/client/cmd_buffer_helper.h"
-#include "gpu/command_buffer/common/gles2_cmd_format.h"
-
-namespace command_buffer {
-namespace gles2 {
-
-// A class that helps write GL command buffers.
-class GLES2CmdHelper : public CommandBufferHelper {
- public:
- explicit GLES2CmdHelper(command_buffer::CommandBuffer* command_buffer)
- : CommandBufferHelper(command_buffer) {
- }
- virtual ~GLES2CmdHelper() {
- }
-
- // Include the auto-generated part of this class. We split this because it
- // means we can easily edit the non-auto generated parts right here in this
- // file instead of having to edit some template or the code generator.
- #include "gpu/command_buffer/client/gles2_cmd_helper_autogen.h"
-
- private:
- DISALLOW_COPY_AND_ASSIGN(GLES2CmdHelper);
-};
-
-} // namespace gles2
-} // namespace command_buffer
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H
-
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
deleted file mode 100644
index 1cfee5b..0000000
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ /dev/null
@@ -1,1143 +0,0 @@
- void ActiveTexture(GLenum texture) {
- gles2::ActiveTexture& c = GetCmdSpace<gles2::ActiveTexture>();
- c.Init(texture);
- }
-
- void AttachShader(GLuint program, GLuint shader) {
- gles2::AttachShader& c = GetCmdSpace<gles2::AttachShader>();
- c.Init(program, shader);
- }
-
- void BindAttribLocation(
- GLuint program, GLuint index, uint32 name_shm_id, uint32 name_shm_offset,
- uint32 data_size) {
- gles2::BindAttribLocation& c = GetCmdSpace<gles2::BindAttribLocation>();
- c.Init(program, index, name_shm_id, name_shm_offset, data_size);
- }
-
- void BindAttribLocationImmediate(
- GLuint program, GLuint index, const char* name) {
- const uint32 size = gles2::BindAttribLocationImmediate::ComputeSize(name);
- gles2::BindAttribLocationImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::BindAttribLocationImmediate>(
- size);
- c.Init(program, index, name);
- }
-
- void BindBuffer(GLenum target, GLuint buffer) {
- gles2::BindBuffer& c = GetCmdSpace<gles2::BindBuffer>();
- c.Init(target, buffer);
- }
-
- void BindFramebuffer(GLenum target, GLuint framebuffer) {
- gles2::BindFramebuffer& c = GetCmdSpace<gles2::BindFramebuffer>();
- c.Init(target, framebuffer);
- }
-
- void BindRenderbuffer(GLenum target, GLuint renderbuffer) {
- gles2::BindRenderbuffer& c = GetCmdSpace<gles2::BindRenderbuffer>();
- c.Init(target, renderbuffer);
- }
-
- void BindTexture(GLenum target, GLuint texture) {
- gles2::BindTexture& c = GetCmdSpace<gles2::BindTexture>();
- c.Init(target, texture);
- }
-
- void BlendColor(
- GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- gles2::BlendColor& c = GetCmdSpace<gles2::BlendColor>();
- c.Init(red, green, blue, alpha);
- }
-
- void BlendEquation(GLenum mode) {
- gles2::BlendEquation& c = GetCmdSpace<gles2::BlendEquation>();
- c.Init(mode);
- }
-
- void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
- gles2::BlendEquationSeparate& c =
- GetCmdSpace<gles2::BlendEquationSeparate>();
- c.Init(modeRGB, modeAlpha);
- }
-
- void BlendFunc(GLenum sfactor, GLenum dfactor) {
- gles2::BlendFunc& c = GetCmdSpace<gles2::BlendFunc>();
- c.Init(sfactor, dfactor);
- }
-
- void BlendFuncSeparate(
- GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- gles2::BlendFuncSeparate& c = GetCmdSpace<gles2::BlendFuncSeparate>();
- c.Init(srcRGB, dstRGB, srcAlpha, dstAlpha);
- }
-
- void BufferData(
- GLenum target, GLsizeiptr size, uint32 data_shm_id,
- uint32 data_shm_offset, GLenum usage) {
- gles2::BufferData& c = GetCmdSpace<gles2::BufferData>();
- c.Init(target, size, data_shm_id, data_shm_offset, usage);
- }
-
- void BufferDataImmediate(GLenum target, GLsizeiptr size, GLenum usage) {
- const uint32 s = 0; // TODO(gman): compute correct size
- gles2::BufferDataImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::BufferDataImmediate>(s);
- c.Init(target, size, usage);
- }
-
- void BufferSubData(
- GLenum target, GLintptr offset, GLsizeiptr size, uint32 data_shm_id,
- uint32 data_shm_offset) {
- gles2::BufferSubData& c = GetCmdSpace<gles2::BufferSubData>();
- c.Init(target, offset, size, data_shm_id, data_shm_offset);
- }
-
- void BufferSubDataImmediate(
- GLenum target, GLintptr offset, GLsizeiptr size) {
- const uint32 s = 0; // TODO(gman): compute correct size
- gles2::BufferSubDataImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::BufferSubDataImmediate>(s);
- c.Init(target, offset, size);
- }
-
- void CheckFramebufferStatus(GLenum target) {
- gles2::CheckFramebufferStatus& c =
- GetCmdSpace<gles2::CheckFramebufferStatus>();
- c.Init(target);
- }
-
- void Clear(GLbitfield mask) {
- gles2::Clear& c = GetCmdSpace<gles2::Clear>();
- c.Init(mask);
- }
-
- void ClearColor(
- GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- gles2::ClearColor& c = GetCmdSpace<gles2::ClearColor>();
- c.Init(red, green, blue, alpha);
- }
-
- void ClearDepthf(GLclampf depth) {
- gles2::ClearDepthf& c = GetCmdSpace<gles2::ClearDepthf>();
- c.Init(depth);
- }
-
- void ClearStencil(GLint s) {
- gles2::ClearStencil& c = GetCmdSpace<gles2::ClearStencil>();
- c.Init(s);
- }
-
- void ColorMask(
- GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
- gles2::ColorMask& c = GetCmdSpace<gles2::ColorMask>();
- c.Init(red, green, blue, alpha);
- }
-
- void CompileShader(GLuint shader) {
- gles2::CompileShader& c = GetCmdSpace<gles2::CompileShader>();
- c.Init(shader);
- }
-
- void CompressedTexImage2D(
- GLenum target, GLint level, GLenum internalformat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize, uint32 data_shm_id,
- uint32 data_shm_offset) {
- gles2::CompressedTexImage2D& c =
- GetCmdSpace<gles2::CompressedTexImage2D>();
- c.Init(
- target, level, internalformat, width, height, border, imageSize,
- data_shm_id, data_shm_offset);
- }
-
- void CompressedTexImage2DImmediate(
- GLenum target, GLint level, GLenum internalformat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize) {
- const uint32 s = 0; // TODO(gman): compute correct size
- gles2::CompressedTexImage2DImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::CompressedTexImage2DImmediate>(s);
- c.Init(target, level, internalformat, width, height, border, imageSize);
- }
-
- void CompressedTexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLsizei imageSize, uint32 data_shm_id,
- uint32 data_shm_offset) {
- gles2::CompressedTexSubImage2D& c =
- GetCmdSpace<gles2::CompressedTexSubImage2D>();
- c.Init(
- target, level, xoffset, yoffset, width, height, format, imageSize,
- data_shm_id, data_shm_offset);
- }
-
- void CompressedTexSubImage2DImmediate(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLsizei imageSize) {
- const uint32 s = 0; // TODO(gman): compute correct size
- gles2::CompressedTexSubImage2DImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::CompressedTexSubImage2DImmediate>(
- s);
- c.Init(target, level, xoffset, yoffset, width, height, format, imageSize);
- }
-
- void CopyTexImage2D(
- GLenum target, GLint level, GLenum internalformat, GLint x, GLint y,
- GLsizei width, GLsizei height, GLint border) {
- gles2::CopyTexImage2D& c = GetCmdSpace<gles2::CopyTexImage2D>();
- c.Init(target, level, internalformat, x, y, width, height, border);
- }
-
- void CopyTexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x,
- GLint y, GLsizei width, GLsizei height) {
- gles2::CopyTexSubImage2D& c = GetCmdSpace<gles2::CopyTexSubImage2D>();
- c.Init(target, level, xoffset, yoffset, x, y, width, height);
- }
-
- void CreateProgram(uint32 client_id) {
- gles2::CreateProgram& c = GetCmdSpace<gles2::CreateProgram>();
- c.Init(client_id);
- }
-
- void CreateShader(GLenum type, uint32 client_id) {
- gles2::CreateShader& c = GetCmdSpace<gles2::CreateShader>();
- c.Init(type, client_id);
- }
-
- void CullFace(GLenum mode) {
- gles2::CullFace& c = GetCmdSpace<gles2::CullFace>();
- c.Init(mode);
- }
-
- void DeleteBuffers(
- GLsizei n, uint32 buffers_shm_id, uint32 buffers_shm_offset) {
- gles2::DeleteBuffers& c = GetCmdSpace<gles2::DeleteBuffers>();
- c.Init(n, buffers_shm_id, buffers_shm_offset);
- }
-
- void DeleteBuffersImmediate(GLsizei n, const GLuint* buffers) {
- const uint32 size = gles2::DeleteBuffersImmediate::ComputeSize(n);
- gles2::DeleteBuffersImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::DeleteBuffersImmediate>(size);
- c.Init(n, buffers);
- }
-
- void DeleteFramebuffers(
- GLsizei n, uint32 framebuffers_shm_id, uint32 framebuffers_shm_offset) {
- gles2::DeleteFramebuffers& c = GetCmdSpace<gles2::DeleteFramebuffers>();
- c.Init(n, framebuffers_shm_id, framebuffers_shm_offset);
- }
-
- void DeleteFramebuffersImmediate(GLsizei n, const GLuint* framebuffers) {
- const uint32 size = gles2::DeleteFramebuffersImmediate::ComputeSize(n);
- gles2::DeleteFramebuffersImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::DeleteFramebuffersImmediate>(
- size);
- c.Init(n, framebuffers);
- }
-
- void DeleteProgram(GLuint program) {
- gles2::DeleteProgram& c = GetCmdSpace<gles2::DeleteProgram>();
- c.Init(program);
- }
-
- void DeleteRenderbuffers(
- GLsizei n, uint32 renderbuffers_shm_id,
- uint32 renderbuffers_shm_offset) {
- gles2::DeleteRenderbuffers& c = GetCmdSpace<gles2::DeleteRenderbuffers>();
- c.Init(n, renderbuffers_shm_id, renderbuffers_shm_offset);
- }
-
- void DeleteRenderbuffersImmediate(GLsizei n, const GLuint* renderbuffers) {
- const uint32 size = gles2::DeleteRenderbuffersImmediate::ComputeSize(n);
- gles2::DeleteRenderbuffersImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::DeleteRenderbuffersImmediate>(
- size);
- c.Init(n, renderbuffers);
- }
-
- void DeleteShader(GLuint shader) {
- gles2::DeleteShader& c = GetCmdSpace<gles2::DeleteShader>();
- c.Init(shader);
- }
-
- void DeleteTextures(
- GLsizei n, uint32 textures_shm_id, uint32 textures_shm_offset) {
- gles2::DeleteTextures& c = GetCmdSpace<gles2::DeleteTextures>();
- c.Init(n, textures_shm_id, textures_shm_offset);
- }
-
- void DeleteTexturesImmediate(GLsizei n, const GLuint* textures) {
- const uint32 size = gles2::DeleteTexturesImmediate::ComputeSize(n);
- gles2::DeleteTexturesImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::DeleteTexturesImmediate>(size);
- c.Init(n, textures);
- }
-
- void DepthFunc(GLenum func) {
- gles2::DepthFunc& c = GetCmdSpace<gles2::DepthFunc>();
- c.Init(func);
- }
-
- void DepthMask(GLboolean flag) {
- gles2::DepthMask& c = GetCmdSpace<gles2::DepthMask>();
- c.Init(flag);
- }
-
- void DepthRangef(GLclampf zNear, GLclampf zFar) {
- gles2::DepthRangef& c = GetCmdSpace<gles2::DepthRangef>();
- c.Init(zNear, zFar);
- }
-
- void DetachShader(GLuint program, GLuint shader) {
- gles2::DetachShader& c = GetCmdSpace<gles2::DetachShader>();
- c.Init(program, shader);
- }
-
- void Disable(GLenum cap) {
- gles2::Disable& c = GetCmdSpace<gles2::Disable>();
- c.Init(cap);
- }
-
- void DisableVertexAttribArray(GLuint index) {
- gles2::DisableVertexAttribArray& c =
- GetCmdSpace<gles2::DisableVertexAttribArray>();
- c.Init(index);
- }
-
- void DrawArrays(GLenum mode, GLint first, GLsizei count) {
- gles2::DrawArrays& c = GetCmdSpace<gles2::DrawArrays>();
- c.Init(mode, first, count);
- }
-
- void DrawElements(
- GLenum mode, GLsizei count, GLenum type, GLuint index_offset) {
- gles2::DrawElements& c = GetCmdSpace<gles2::DrawElements>();
- c.Init(mode, count, type, index_offset);
- }
-
- void Enable(GLenum cap) {
- gles2::Enable& c = GetCmdSpace<gles2::Enable>();
- c.Init(cap);
- }
-
- void EnableVertexAttribArray(GLuint index) {
- gles2::EnableVertexAttribArray& c =
- GetCmdSpace<gles2::EnableVertexAttribArray>();
- c.Init(index);
- }
-
- void Finish() {
- gles2::Finish& c = GetCmdSpace<gles2::Finish>();
- c.Init();
- }
-
- void Flush() {
- gles2::Flush& c = GetCmdSpace<gles2::Flush>();
- c.Init();
- }
-
- void FramebufferRenderbuffer(
- GLenum target, GLenum attachment, GLenum renderbuffertarget,
- GLuint renderbuffer) {
- gles2::FramebufferRenderbuffer& c =
- GetCmdSpace<gles2::FramebufferRenderbuffer>();
- c.Init(target, attachment, renderbuffertarget, renderbuffer);
- }
-
- void FramebufferTexture2D(
- GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
- GLint level) {
- gles2::FramebufferTexture2D& c =
- GetCmdSpace<gles2::FramebufferTexture2D>();
- c.Init(target, attachment, textarget, texture, level);
- }
-
- void FrontFace(GLenum mode) {
- gles2::FrontFace& c = GetCmdSpace<gles2::FrontFace>();
- c.Init(mode);
- }
-
- void GenBuffers(
- GLsizei n, uint32 buffers_shm_id, uint32 buffers_shm_offset) {
- gles2::GenBuffers& c = GetCmdSpace<gles2::GenBuffers>();
- c.Init(n, buffers_shm_id, buffers_shm_offset);
- }
-
- void GenBuffersImmediate(GLsizei n, GLuint* buffers) {
- const uint32 size = gles2::GenBuffersImmediate::ComputeSize(n);
- gles2::GenBuffersImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::GenBuffersImmediate>(size);
- c.Init(n, buffers);
- }
-
- void GenerateMipmap(GLenum target) {
- gles2::GenerateMipmap& c = GetCmdSpace<gles2::GenerateMipmap>();
- c.Init(target);
- }
-
- void GenFramebuffers(
- GLsizei n, uint32 framebuffers_shm_id, uint32 framebuffers_shm_offset) {
- gles2::GenFramebuffers& c = GetCmdSpace<gles2::GenFramebuffers>();
- c.Init(n, framebuffers_shm_id, framebuffers_shm_offset);
- }
-
- void GenFramebuffersImmediate(GLsizei n, GLuint* framebuffers) {
- const uint32 size = gles2::GenFramebuffersImmediate::ComputeSize(n);
- gles2::GenFramebuffersImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::GenFramebuffersImmediate>(size);
- c.Init(n, framebuffers);
- }
-
- void GenRenderbuffers(
- GLsizei n, uint32 renderbuffers_shm_id,
- uint32 renderbuffers_shm_offset) {
- gles2::GenRenderbuffers& c = GetCmdSpace<gles2::GenRenderbuffers>();
- c.Init(n, renderbuffers_shm_id, renderbuffers_shm_offset);
- }
-
- void GenRenderbuffersImmediate(GLsizei n, GLuint* renderbuffers) {
- const uint32 size = gles2::GenRenderbuffersImmediate::ComputeSize(n);
- gles2::GenRenderbuffersImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::GenRenderbuffersImmediate>(size);
- c.Init(n, renderbuffers);
- }
-
- void GenTextures(
- GLsizei n, uint32 textures_shm_id, uint32 textures_shm_offset) {
- gles2::GenTextures& c = GetCmdSpace<gles2::GenTextures>();
- c.Init(n, textures_shm_id, textures_shm_offset);
- }
-
- void GenTexturesImmediate(GLsizei n, GLuint* textures) {
- const uint32 size = gles2::GenTexturesImmediate::ComputeSize(n);
- gles2::GenTexturesImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::GenTexturesImmediate>(size);
- c.Init(n, textures);
- }
-
- void GetActiveAttrib(
- GLuint program, GLuint index, GLsizei bufsize, uint32 length_shm_id,
- uint32 length_shm_offset, uint32 size_shm_id, uint32 size_shm_offset,
- uint32 type_shm_id, uint32 type_shm_offset, uint32 name_shm_id,
- uint32 name_shm_offset) {
- gles2::GetActiveAttrib& c = GetCmdSpace<gles2::GetActiveAttrib>();
- c.Init(
- program, index, bufsize, length_shm_id, length_shm_offset, size_shm_id,
- size_shm_offset, type_shm_id, type_shm_offset, name_shm_id,
- name_shm_offset);
- }
-
- void GetActiveUniform(
- GLuint program, GLuint index, GLsizei bufsize, uint32 length_shm_id,
- uint32 length_shm_offset, uint32 size_shm_id, uint32 size_shm_offset,
- uint32 type_shm_id, uint32 type_shm_offset, uint32 name_shm_id,
- uint32 name_shm_offset) {
- gles2::GetActiveUniform& c = GetCmdSpace<gles2::GetActiveUniform>();
- c.Init(
- program, index, bufsize, length_shm_id, length_shm_offset, size_shm_id,
- size_shm_offset, type_shm_id, type_shm_offset, name_shm_id,
- name_shm_offset);
- }
-
- void GetAttachedShaders(
- GLuint program, GLsizei maxcount, uint32 count_shm_id,
- uint32 count_shm_offset, uint32 shaders_shm_id,
- uint32 shaders_shm_offset) {
- gles2::GetAttachedShaders& c = GetCmdSpace<gles2::GetAttachedShaders>();
- c.Init(
- program, maxcount, count_shm_id, count_shm_offset, shaders_shm_id,
- shaders_shm_offset);
- }
-
- void GetAttribLocation(
- GLuint program, uint32 name_shm_id, uint32 name_shm_offset,
- uint32 data_size) {
- gles2::GetAttribLocation& c = GetCmdSpace<gles2::GetAttribLocation>();
- c.Init(program, name_shm_id, name_shm_offset, data_size);
- }
-
- void GetAttribLocationImmediate(GLuint program, const char* name) {
- const uint32 size = gles2::GetAttribLocationImmediate::ComputeSize(name);
- gles2::GetAttribLocationImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::GetAttribLocationImmediate>(size);
- c.Init(program, name);
- }
-
- void GetBooleanv(
- GLenum pname, uint32 params_shm_id, uint32 params_shm_offset) {
- gles2::GetBooleanv& c = GetCmdSpace<gles2::GetBooleanv>();
- c.Init(pname, params_shm_id, params_shm_offset);
- }
-
- void GetBufferParameteriv(
- GLenum target, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetBufferParameteriv& c =
- GetCmdSpace<gles2::GetBufferParameteriv>();
- c.Init(target, pname, params_shm_id, params_shm_offset);
- }
-
- void GetError(uint32 result_shm_id, uint32 result_shm_offset) {
- gles2::GetError& c = GetCmdSpace<gles2::GetError>();
- c.Init(result_shm_id, result_shm_offset);
- }
-
- void GetFloatv(
- GLenum pname, uint32 params_shm_id, uint32 params_shm_offset) {
- gles2::GetFloatv& c = GetCmdSpace<gles2::GetFloatv>();
- c.Init(pname, params_shm_id, params_shm_offset);
- }
-
- void GetFramebufferAttachmentParameteriv(
- GLenum target, GLenum attachment, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetFramebufferAttachmentParameteriv& c =
- GetCmdSpace<gles2::GetFramebufferAttachmentParameteriv>();
- c.Init(target, attachment, pname, params_shm_id, params_shm_offset);
- }
-
- void GetIntegerv(
- GLenum pname, uint32 params_shm_id, uint32 params_shm_offset) {
- gles2::GetIntegerv& c = GetCmdSpace<gles2::GetIntegerv>();
- c.Init(pname, params_shm_id, params_shm_offset);
- }
-
- void GetProgramiv(
- GLuint program, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetProgramiv& c = GetCmdSpace<gles2::GetProgramiv>();
- c.Init(program, pname, params_shm_id, params_shm_offset);
- }
-
- void GetProgramInfoLog(
- GLuint program, GLsizei bufsize, uint32 length_shm_id,
- uint32 length_shm_offset, uint32 infolog_shm_id,
- uint32 infolog_shm_offset) {
- gles2::GetProgramInfoLog& c = GetCmdSpace<gles2::GetProgramInfoLog>();
- c.Init(
- program, bufsize, length_shm_id, length_shm_offset, infolog_shm_id,
- infolog_shm_offset);
- }
-
- void GetRenderbufferParameteriv(
- GLenum target, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetRenderbufferParameteriv& c =
- GetCmdSpace<gles2::GetRenderbufferParameteriv>();
- c.Init(target, pname, params_shm_id, params_shm_offset);
- }
-
- void GetShaderiv(
- GLuint shader, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetShaderiv& c = GetCmdSpace<gles2::GetShaderiv>();
- c.Init(shader, pname, params_shm_id, params_shm_offset);
- }
-
- void GetShaderInfoLog(
- GLuint shader, GLsizei bufsize, uint32 length_shm_id,
- uint32 length_shm_offset, uint32 infolog_shm_id,
- uint32 infolog_shm_offset) {
- gles2::GetShaderInfoLog& c = GetCmdSpace<gles2::GetShaderInfoLog>();
- c.Init(
- shader, bufsize, length_shm_id, length_shm_offset, infolog_shm_id,
- infolog_shm_offset);
- }
-
- void GetShaderPrecisionFormat(
- GLenum shadertype, GLenum precisiontype, uint32 range_shm_id,
- uint32 range_shm_offset, uint32 precision_shm_id,
- uint32 precision_shm_offset) {
- gles2::GetShaderPrecisionFormat& c =
- GetCmdSpace<gles2::GetShaderPrecisionFormat>();
- c.Init(
- shadertype, precisiontype, range_shm_id, range_shm_offset,
- precision_shm_id, precision_shm_offset);
- }
-
- void GetShaderSource(
- GLuint shader, GLsizei bufsize, uint32 length_shm_id,
- uint32 length_shm_offset, uint32 source_shm_id,
- uint32 source_shm_offset) {
- gles2::GetShaderSource& c = GetCmdSpace<gles2::GetShaderSource>();
- c.Init(
- shader, bufsize, length_shm_id, length_shm_offset, source_shm_id,
- source_shm_offset);
- }
-
- void GetString(GLenum name) {
- gles2::GetString& c = GetCmdSpace<gles2::GetString>();
- c.Init(name);
- }
-
- void GetTexParameterfv(
- GLenum target, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetTexParameterfv& c = GetCmdSpace<gles2::GetTexParameterfv>();
- c.Init(target, pname, params_shm_id, params_shm_offset);
- }
-
- void GetTexParameteriv(
- GLenum target, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetTexParameteriv& c = GetCmdSpace<gles2::GetTexParameteriv>();
- c.Init(target, pname, params_shm_id, params_shm_offset);
- }
-
- void GetUniformfv(
- GLuint program, GLint location, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetUniformfv& c = GetCmdSpace<gles2::GetUniformfv>();
- c.Init(program, location, params_shm_id, params_shm_offset);
- }
-
- void GetUniformiv(
- GLuint program, GLint location, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetUniformiv& c = GetCmdSpace<gles2::GetUniformiv>();
- c.Init(program, location, params_shm_id, params_shm_offset);
- }
-
- void GetUniformLocation(
- GLuint program, uint32 name_shm_id, uint32 name_shm_offset,
- uint32 data_size) {
- gles2::GetUniformLocation& c = GetCmdSpace<gles2::GetUniformLocation>();
- c.Init(program, name_shm_id, name_shm_offset, data_size);
- }
-
- void GetUniformLocationImmediate(GLuint program, const char* name) {
- const uint32 size = gles2::GetUniformLocationImmediate::ComputeSize(name);
- gles2::GetUniformLocationImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::GetUniformLocationImmediate>(
- size);
- c.Init(program, name);
- }
-
- void GetVertexAttribfv(
- GLuint index, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetVertexAttribfv& c = GetCmdSpace<gles2::GetVertexAttribfv>();
- c.Init(index, pname, params_shm_id, params_shm_offset);
- }
-
- void GetVertexAttribiv(
- GLuint index, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::GetVertexAttribiv& c = GetCmdSpace<gles2::GetVertexAttribiv>();
- c.Init(index, pname, params_shm_id, params_shm_offset);
- }
-
- void GetVertexAttribPointerv(
- GLuint index, GLenum pname, uint32 pointer_shm_id,
- uint32 pointer_shm_offset) {
- gles2::GetVertexAttribPointerv& c =
- GetCmdSpace<gles2::GetVertexAttribPointerv>();
- c.Init(index, pname, pointer_shm_id, pointer_shm_offset);
- }
-
- void Hint(GLenum target, GLenum mode) {
- gles2::Hint& c = GetCmdSpace<gles2::Hint>();
- c.Init(target, mode);
- }
-
- void IsBuffer(
- GLuint buffer, uint32 result_shm_id, uint32 result_shm_offset) {
- gles2::IsBuffer& c = GetCmdSpace<gles2::IsBuffer>();
- c.Init(buffer, result_shm_id, result_shm_offset);
- }
-
- void IsEnabled(GLenum cap, uint32 result_shm_id, uint32 result_shm_offset) {
- gles2::IsEnabled& c = GetCmdSpace<gles2::IsEnabled>();
- c.Init(cap, result_shm_id, result_shm_offset);
- }
-
- void IsFramebuffer(
- GLuint framebuffer, uint32 result_shm_id, uint32 result_shm_offset) {
- gles2::IsFramebuffer& c = GetCmdSpace<gles2::IsFramebuffer>();
- c.Init(framebuffer, result_shm_id, result_shm_offset);
- }
-
- void IsProgram(
- GLuint program, uint32 result_shm_id, uint32 result_shm_offset) {
- gles2::IsProgram& c = GetCmdSpace<gles2::IsProgram>();
- c.Init(program, result_shm_id, result_shm_offset);
- }
-
- void IsRenderbuffer(
- GLuint renderbuffer, uint32 result_shm_id, uint32 result_shm_offset) {
- gles2::IsRenderbuffer& c = GetCmdSpace<gles2::IsRenderbuffer>();
- c.Init(renderbuffer, result_shm_id, result_shm_offset);
- }
-
- void IsShader(
- GLuint shader, uint32 result_shm_id, uint32 result_shm_offset) {
- gles2::IsShader& c = GetCmdSpace<gles2::IsShader>();
- c.Init(shader, result_shm_id, result_shm_offset);
- }
-
- void IsTexture(
- GLuint texture, uint32 result_shm_id, uint32 result_shm_offset) {
- gles2::IsTexture& c = GetCmdSpace<gles2::IsTexture>();
- c.Init(texture, result_shm_id, result_shm_offset);
- }
-
- void LineWidth(GLfloat width) {
- gles2::LineWidth& c = GetCmdSpace<gles2::LineWidth>();
- c.Init(width);
- }
-
- void LinkProgram(GLuint program) {
- gles2::LinkProgram& c = GetCmdSpace<gles2::LinkProgram>();
- c.Init(program);
- }
-
- void PixelStorei(GLenum pname, GLint param) {
- gles2::PixelStorei& c = GetCmdSpace<gles2::PixelStorei>();
- c.Init(pname, param);
- }
-
- void PolygonOffset(GLfloat factor, GLfloat units) {
- gles2::PolygonOffset& c = GetCmdSpace<gles2::PolygonOffset>();
- c.Init(factor, units);
- }
-
- void ReadPixels(
- GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
- GLenum type, uint32 pixels_shm_id, uint32 pixels_shm_offset) {
- gles2::ReadPixels& c = GetCmdSpace<gles2::ReadPixels>();
- c.Init(
- x, y, width, height, format, type, pixels_shm_id, pixels_shm_offset);
- }
-
- void RenderbufferStorage(
- GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
- gles2::RenderbufferStorage& c = GetCmdSpace<gles2::RenderbufferStorage>();
- c.Init(target, internalformat, width, height);
- }
-
- void SampleCoverage(GLclampf value, GLboolean invert) {
- gles2::SampleCoverage& c = GetCmdSpace<gles2::SampleCoverage>();
- c.Init(value, invert);
- }
-
- void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) {
- gles2::Scissor& c = GetCmdSpace<gles2::Scissor>();
- c.Init(x, y, width, height);
- }
-
- void ShaderSource(
- GLuint shader, GLsizei count, uint32 data_shm_id, uint32 data_shm_offset,
- uint32 data_size) {
- gles2::ShaderSource& c = GetCmdSpace<gles2::ShaderSource>();
- c.Init(shader, count, data_shm_id, data_shm_offset, data_size);
- }
-
- void ShaderSourceImmediate(GLuint shader, GLsizei count, uint32 data_size) {
- const uint32 s = 0; // TODO(gman): compute correct size
- gles2::ShaderSourceImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::ShaderSourceImmediate>(s);
- c.Init(shader, count, data_size);
- }
-
- void StencilFunc(GLenum func, GLint ref, GLuint mask) {
- gles2::StencilFunc& c = GetCmdSpace<gles2::StencilFunc>();
- c.Init(func, ref, mask);
- }
-
- void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) {
- gles2::StencilFuncSeparate& c = GetCmdSpace<gles2::StencilFuncSeparate>();
- c.Init(face, func, ref, mask);
- }
-
- void StencilMask(GLuint mask) {
- gles2::StencilMask& c = GetCmdSpace<gles2::StencilMask>();
- c.Init(mask);
- }
-
- void StencilMaskSeparate(GLenum face, GLuint mask) {
- gles2::StencilMaskSeparate& c = GetCmdSpace<gles2::StencilMaskSeparate>();
- c.Init(face, mask);
- }
-
- void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
- gles2::StencilOp& c = GetCmdSpace<gles2::StencilOp>();
- c.Init(fail, zfail, zpass);
- }
-
- void StencilOpSeparate(
- GLenum face, GLenum fail, GLenum zfail, GLenum zpass) {
- gles2::StencilOpSeparate& c = GetCmdSpace<gles2::StencilOpSeparate>();
- c.Init(face, fail, zfail, zpass);
- }
-
- void TexImage2D(
- GLenum target, GLint level, GLint internalformat, GLsizei width,
- GLsizei height, GLint border, GLenum format, GLenum type,
- uint32 pixels_shm_id, uint32 pixels_shm_offset) {
- gles2::TexImage2D& c = GetCmdSpace<gles2::TexImage2D>();
- c.Init(
- target, level, internalformat, width, height, border, format, type,
- pixels_shm_id, pixels_shm_offset);
- }
-
- void TexImage2DImmediate(
- GLenum target, GLint level, GLint internalformat, GLsizei width,
- GLsizei height, GLint border, GLenum format, GLenum type) {
- const uint32 s = 0; // TODO(gman): compute correct size
- gles2::TexImage2DImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::TexImage2DImmediate>(s);
- c.Init(target, level, internalformat, width, height, border, format, type);
- }
-
- void TexParameterf(GLenum target, GLenum pname, GLfloat param) {
- gles2::TexParameterf& c = GetCmdSpace<gles2::TexParameterf>();
- c.Init(target, pname, param);
- }
-
- void TexParameterfv(
- GLenum target, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::TexParameterfv& c = GetCmdSpace<gles2::TexParameterfv>();
- c.Init(target, pname, params_shm_id, params_shm_offset);
- }
-
- void TexParameterfvImmediate(
- GLenum target, GLenum pname, const GLfloat* params) {
- const uint32 size = gles2::TexParameterfvImmediate::ComputeSize();
- gles2::TexParameterfvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::TexParameterfvImmediate>(size);
- c.Init(target, pname, params);
- }
-
- void TexParameteri(GLenum target, GLenum pname, GLint param) {
- gles2::TexParameteri& c = GetCmdSpace<gles2::TexParameteri>();
- c.Init(target, pname, param);
- }
-
- void TexParameteriv(
- GLenum target, GLenum pname, uint32 params_shm_id,
- uint32 params_shm_offset) {
- gles2::TexParameteriv& c = GetCmdSpace<gles2::TexParameteriv>();
- c.Init(target, pname, params_shm_id, params_shm_offset);
- }
-
- void TexParameterivImmediate(
- GLenum target, GLenum pname, const GLint* params) {
- const uint32 size = gles2::TexParameterivImmediate::ComputeSize();
- gles2::TexParameterivImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::TexParameterivImmediate>(size);
- c.Init(target, pname, params);
- }
-
- void TexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLenum type, uint32 pixels_shm_id,
- uint32 pixels_shm_offset) {
- gles2::TexSubImage2D& c = GetCmdSpace<gles2::TexSubImage2D>();
- c.Init(
- target, level, xoffset, yoffset, width, height, format, type,
- pixels_shm_id, pixels_shm_offset);
- }
-
- void TexSubImage2DImmediate(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLenum type) {
- const uint32 s = 0; // TODO(gman): compute correct size
- gles2::TexSubImage2DImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::TexSubImage2DImmediate>(s);
- c.Init(target, level, xoffset, yoffset, width, height, format, type);
- }
-
- void Uniform1f(GLint location, GLfloat x) {
- gles2::Uniform1f& c = GetCmdSpace<gles2::Uniform1f>();
- c.Init(location, x);
- }
-
- void Uniform1fv(
- GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) {
- gles2::Uniform1fv& c = GetCmdSpace<gles2::Uniform1fv>();
- c.Init(location, count, v_shm_id, v_shm_offset);
- }
-
- void Uniform1fvImmediate(GLint location, GLsizei count, const GLfloat* v) {
- const uint32 size = gles2::Uniform1fvImmediate::ComputeSize(count);
- gles2::Uniform1fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::Uniform1fvImmediate>(size);
- c.Init(location, count, v);
- }
-
- void Uniform1i(GLint location, GLint x) {
- gles2::Uniform1i& c = GetCmdSpace<gles2::Uniform1i>();
- c.Init(location, x);
- }
-
- void Uniform1iv(
- GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) {
- gles2::Uniform1iv& c = GetCmdSpace<gles2::Uniform1iv>();
- c.Init(location, count, v_shm_id, v_shm_offset);
- }
-
- void Uniform1ivImmediate(GLint location, GLsizei count, const GLint* v) {
- const uint32 size = gles2::Uniform1ivImmediate::ComputeSize(count);
- gles2::Uniform1ivImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::Uniform1ivImmediate>(size);
- c.Init(location, count, v);
- }
-
- void Uniform2f(GLint location, GLfloat x, GLfloat y) {
- gles2::Uniform2f& c = GetCmdSpace<gles2::Uniform2f>();
- c.Init(location, x, y);
- }
-
- void Uniform2fv(
- GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) {
- gles2::Uniform2fv& c = GetCmdSpace<gles2::Uniform2fv>();
- c.Init(location, count, v_shm_id, v_shm_offset);
- }
-
- void Uniform2fvImmediate(GLint location, GLsizei count, const GLfloat* v) {
- const uint32 size = gles2::Uniform2fvImmediate::ComputeSize(count);
- gles2::Uniform2fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::Uniform2fvImmediate>(size);
- c.Init(location, count, v);
- }
-
- void Uniform2i(GLint location, GLint x, GLint y) {
- gles2::Uniform2i& c = GetCmdSpace<gles2::Uniform2i>();
- c.Init(location, x, y);
- }
-
- void Uniform2iv(
- GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) {
- gles2::Uniform2iv& c = GetCmdSpace<gles2::Uniform2iv>();
- c.Init(location, count, v_shm_id, v_shm_offset);
- }
-
- void Uniform2ivImmediate(GLint location, GLsizei count, const GLint* v) {
- const uint32 size = gles2::Uniform2ivImmediate::ComputeSize(count);
- gles2::Uniform2ivImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::Uniform2ivImmediate>(size);
- c.Init(location, count, v);
- }
-
- void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) {
- gles2::Uniform3f& c = GetCmdSpace<gles2::Uniform3f>();
- c.Init(location, x, y, z);
- }
-
- void Uniform3fv(
- GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) {
- gles2::Uniform3fv& c = GetCmdSpace<gles2::Uniform3fv>();
- c.Init(location, count, v_shm_id, v_shm_offset);
- }
-
- void Uniform3fvImmediate(GLint location, GLsizei count, const GLfloat* v) {
- const uint32 size = gles2::Uniform3fvImmediate::ComputeSize(count);
- gles2::Uniform3fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::Uniform3fvImmediate>(size);
- c.Init(location, count, v);
- }
-
- void Uniform3i(GLint location, GLint x, GLint y, GLint z) {
- gles2::Uniform3i& c = GetCmdSpace<gles2::Uniform3i>();
- c.Init(location, x, y, z);
- }
-
- void Uniform3iv(
- GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) {
- gles2::Uniform3iv& c = GetCmdSpace<gles2::Uniform3iv>();
- c.Init(location, count, v_shm_id, v_shm_offset);
- }
-
- void Uniform3ivImmediate(GLint location, GLsizei count, const GLint* v) {
- const uint32 size = gles2::Uniform3ivImmediate::ComputeSize(count);
- gles2::Uniform3ivImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::Uniform3ivImmediate>(size);
- c.Init(location, count, v);
- }
-
- void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- gles2::Uniform4f& c = GetCmdSpace<gles2::Uniform4f>();
- c.Init(location, x, y, z, w);
- }
-
- void Uniform4fv(
- GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) {
- gles2::Uniform4fv& c = GetCmdSpace<gles2::Uniform4fv>();
- c.Init(location, count, v_shm_id, v_shm_offset);
- }
-
- void Uniform4fvImmediate(GLint location, GLsizei count, const GLfloat* v) {
- const uint32 size = gles2::Uniform4fvImmediate::ComputeSize(count);
- gles2::Uniform4fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::Uniform4fvImmediate>(size);
- c.Init(location, count, v);
- }
-
- void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) {
- gles2::Uniform4i& c = GetCmdSpace<gles2::Uniform4i>();
- c.Init(location, x, y, z, w);
- }
-
- void Uniform4iv(
- GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) {
- gles2::Uniform4iv& c = GetCmdSpace<gles2::Uniform4iv>();
- c.Init(location, count, v_shm_id, v_shm_offset);
- }
-
- void Uniform4ivImmediate(GLint location, GLsizei count, const GLint* v) {
- const uint32 size = gles2::Uniform4ivImmediate::ComputeSize(count);
- gles2::Uniform4ivImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::Uniform4ivImmediate>(size);
- c.Init(location, count, v);
- }
-
- void UniformMatrix2fv(
- GLint location, GLsizei count, GLboolean transpose, uint32 value_shm_id,
- uint32 value_shm_offset) {
- gles2::UniformMatrix2fv& c = GetCmdSpace<gles2::UniformMatrix2fv>();
- c.Init(location, count, transpose, value_shm_id, value_shm_offset);
- }
-
- void UniformMatrix2fvImmediate(
- GLint location, GLsizei count, GLboolean transpose,
- const GLfloat* value) {
- const uint32 size = gles2::UniformMatrix2fvImmediate::ComputeSize(count);
- gles2::UniformMatrix2fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::UniformMatrix2fvImmediate>(size);
- c.Init(location, count, transpose, value);
- }
-
- void UniformMatrix3fv(
- GLint location, GLsizei count, GLboolean transpose, uint32 value_shm_id,
- uint32 value_shm_offset) {
- gles2::UniformMatrix3fv& c = GetCmdSpace<gles2::UniformMatrix3fv>();
- c.Init(location, count, transpose, value_shm_id, value_shm_offset);
- }
-
- void UniformMatrix3fvImmediate(
- GLint location, GLsizei count, GLboolean transpose,
- const GLfloat* value) {
- const uint32 size = gles2::UniformMatrix3fvImmediate::ComputeSize(count);
- gles2::UniformMatrix3fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::UniformMatrix3fvImmediate>(size);
- c.Init(location, count, transpose, value);
- }
-
- void UniformMatrix4fv(
- GLint location, GLsizei count, GLboolean transpose, uint32 value_shm_id,
- uint32 value_shm_offset) {
- gles2::UniformMatrix4fv& c = GetCmdSpace<gles2::UniformMatrix4fv>();
- c.Init(location, count, transpose, value_shm_id, value_shm_offset);
- }
-
- void UniformMatrix4fvImmediate(
- GLint location, GLsizei count, GLboolean transpose,
- const GLfloat* value) {
- const uint32 size = gles2::UniformMatrix4fvImmediate::ComputeSize(count);
- gles2::UniformMatrix4fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::UniformMatrix4fvImmediate>(size);
- c.Init(location, count, transpose, value);
- }
-
- void UseProgram(GLuint program) {
- gles2::UseProgram& c = GetCmdSpace<gles2::UseProgram>();
- c.Init(program);
- }
-
- void ValidateProgram(GLuint program) {
- gles2::ValidateProgram& c = GetCmdSpace<gles2::ValidateProgram>();
- c.Init(program);
- }
-
- void VertexAttrib1f(GLuint indx, GLfloat x) {
- gles2::VertexAttrib1f& c = GetCmdSpace<gles2::VertexAttrib1f>();
- c.Init(indx, x);
- }
-
- void VertexAttrib1fv(
- GLuint indx, uint32 values_shm_id, uint32 values_shm_offset) {
- gles2::VertexAttrib1fv& c = GetCmdSpace<gles2::VertexAttrib1fv>();
- c.Init(indx, values_shm_id, values_shm_offset);
- }
-
- void VertexAttrib1fvImmediate(GLuint indx, const GLfloat* values) {
- const uint32 size = gles2::VertexAttrib1fvImmediate::ComputeSize();
- gles2::VertexAttrib1fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::VertexAttrib1fvImmediate>(size);
- c.Init(indx, values);
- }
-
- void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
- gles2::VertexAttrib2f& c = GetCmdSpace<gles2::VertexAttrib2f>();
- c.Init(indx, x, y);
- }
-
- void VertexAttrib2fv(
- GLuint indx, uint32 values_shm_id, uint32 values_shm_offset) {
- gles2::VertexAttrib2fv& c = GetCmdSpace<gles2::VertexAttrib2fv>();
- c.Init(indx, values_shm_id, values_shm_offset);
- }
-
- void VertexAttrib2fvImmediate(GLuint indx, const GLfloat* values) {
- const uint32 size = gles2::VertexAttrib2fvImmediate::ComputeSize();
- gles2::VertexAttrib2fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::VertexAttrib2fvImmediate>(size);
- c.Init(indx, values);
- }
-
- void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
- gles2::VertexAttrib3f& c = GetCmdSpace<gles2::VertexAttrib3f>();
- c.Init(indx, x, y, z);
- }
-
- void VertexAttrib3fv(
- GLuint indx, uint32 values_shm_id, uint32 values_shm_offset) {
- gles2::VertexAttrib3fv& c = GetCmdSpace<gles2::VertexAttrib3fv>();
- c.Init(indx, values_shm_id, values_shm_offset);
- }
-
- void VertexAttrib3fvImmediate(GLuint indx, const GLfloat* values) {
- const uint32 size = gles2::VertexAttrib3fvImmediate::ComputeSize();
- gles2::VertexAttrib3fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::VertexAttrib3fvImmediate>(size);
- c.Init(indx, values);
- }
-
- void VertexAttrib4f(
- GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- gles2::VertexAttrib4f& c = GetCmdSpace<gles2::VertexAttrib4f>();
- c.Init(indx, x, y, z, w);
- }
-
- void VertexAttrib4fv(
- GLuint indx, uint32 values_shm_id, uint32 values_shm_offset) {
- gles2::VertexAttrib4fv& c = GetCmdSpace<gles2::VertexAttrib4fv>();
- c.Init(indx, values_shm_id, values_shm_offset);
- }
-
- void VertexAttrib4fvImmediate(GLuint indx, const GLfloat* values) {
- const uint32 size = gles2::VertexAttrib4fvImmediate::ComputeSize();
- gles2::VertexAttrib4fvImmediate& c =
- GetImmediateCmdSpaceTotalSize<gles2::VertexAttrib4fvImmediate>(size);
- c.Init(indx, values);
- }
-
- void VertexAttribPointer(
- GLuint indx, GLint size, GLenum type, GLboolean normalized,
- GLsizei stride, GLuint offset) {
- gles2::VertexAttribPointer& c = GetCmdSpace<gles2::VertexAttribPointer>();
- c.Init(indx, size, type, normalized, stride, offset);
- }
-
- void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) {
- gles2::Viewport& c = GetCmdSpace<gles2::Viewport>();
- c.Init(x, y, width, height);
- }
-
- void SwapBuffers() {
- gles2::SwapBuffers& c = GetCmdSpace<gles2::SwapBuffers>();
- c.Init();
- }
-
diff --git a/gpu/command_buffer/client/gles2_demo.cc b/gpu/command_buffer/client/gles2_demo.cc
deleted file mode 100644
index 04419c3..0000000
--- a/gpu/command_buffer/client/gles2_demo.cc
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (c) 2006-2009 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 is here so other GLES2 related files can have a common set of
-// includes where appropriate.
-
-#include <windows.h>
-#include <windowsx.h>
-#include <shellapi.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "base/ref_counted.h"
-#include "base/shared_memory.h"
-#include "base/scoped_ptr.h"
-#include "gpu/command_buffer/service/gpu_processor.h"
-#include "gpu/command_buffer/service/command_buffer_service.h"
-#include "gpu/np_utils/np_utils.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "gpu/command_buffer/client/gles2_lib.h"
-#include "gpu/command_buffer/client/gles2_demo_c.h"
-#include "gpu/command_buffer/client/gles2_demo_cc.h"
-
-using base::SharedMemory;
-using command_buffer::GPUProcessor;
-using command_buffer::CommandBufferService;
-using command_buffer::gles2::GLES2CmdHelper;
-using command_buffer::gles2::GLES2Implementation;
-
-class GLES2Demo {
- public:
- GLES2Demo();
-
- bool GLES2Demo::Setup(NPP npp, void* hwnd, int32 size);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(GLES2Demo);
-};
-
-GLES2Demo::GLES2Demo() {
-}
-
-bool GLES2Demo::Setup(NPP npp, void* hwnd, int32 size) {
- scoped_ptr<SharedMemory> ring_buffer(new SharedMemory);
- if (!ring_buffer->Create(std::wstring(), false, false, size)) {
- return NULL;
- }
-
- if (!ring_buffer->Map(size)) {
- return NULL;
- }
-
- scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService);
- if (!command_buffer->Initialize(ring_buffer.release())) {
- return NULL;
- }
-
- scoped_refptr<GPUProcessor> gpu_processor(
- new GPUProcessor(npp, command_buffer.get()));
- if (!gpu_processor->Initialize(reinterpret_cast<HWND>(hwnd))) {
- return NULL;
- }
-
- command_buffer->SetPutOffsetChangeCallback(
- NewCallback(gpu_processor.get(), &GPUProcessor::ProcessCommands));
-
- GLES2CmdHelper* helper = new GLES2CmdHelper(command_buffer.get());
- if (!helper->Initialize()) {
- // TODO(gman): cleanup.
- return false;
- }
-
- size_t transfer_buffer_size = 512 * 1024;
- int32 transfer_buffer_id =
- command_buffer->CreateTransferBuffer(transfer_buffer_size);
- void* transfer_buffer =
- command_buffer->GetTransferBuffer(transfer_buffer_id);
-
- gles2::g_gl_impl = new GLES2Implementation(helper,
- transfer_buffer,
- transfer_buffer_id);
-
- return command_buffer.release() != NULL;
-}
-
-#if defined(OS_WIN)
-LRESULT CALLBACK WindowProc(
- HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
- switch (msg) {
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
- case WM_PAINT: {
- GLFromCPPTestFunction();
- GLFromCTestFunction();
- // TODO(gman): Not sure how SwapBuffer should be exposed.
- gles2::GetGLContext()->SwapBuffers();
- break;
- }
- default:
- return ::DefWindowProc(hwnd, msg, w_param, l_param);
- }
- return 0;
-}
-
-HINSTANCE GetInstance(void) {
- HWND hwnd = GetConsoleWindow();
- return reinterpret_cast<HINSTANCE>(GetWindowLong(hwnd, GWL_HINSTANCE));
-}
-
-void ProcessMessages(void* in_hwnd) {
- HWND hwnd = reinterpret_cast<HWND>(in_hwnd);
- MSG msg;
-
- bool done = false;
- while (!done) {
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- if (msg.message == WM_QUIT) {
- done = true;
- }
- // dispatch the message
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- if (!done) {
- InvalidateRect(hwnd, NULL, TRUE);
- }
- }
-}
-
-#endif
-
-void* SetupWindow() {
-#if defined(OS_WIN)
- HINSTANCE instance = GetInstance();
- WNDCLASSEX wc = {0};
- wc.lpszClassName = L"MY_WINDOWS_CLASS";
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = ::WindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = instance;
- wc.hIcon = ::LoadIcon(instance, IDI_APPLICATION);
- wc.hIconSm = NULL;
- wc.hCursor = ::LoadCursor(instance, IDC_ARROW);
- wc.hbrBackground = static_cast<HBRUSH>(::GetStockObject(BLACK_BRUSH));
- wc.lpszMenuName = NULL;
-
- if (!::RegisterClassEx(&wc))
- return false;
-
- // Leaving this window onscreen leads to a redraw error which makes it
- // a hassle to debug tests in an IDE, so we place the window somewhere that
- // won't happen.
- HWND hwnd = ::CreateWindowExW(
- NULL,
- wc.lpszClassName,
- L"",
- WS_OVERLAPPEDWINDOW,
- 10,
- 0,
- 512,
- 512,
- 0,
- 0,
- instance,
- 0);
-
- if (hwnd == NULL) {
- return false;
- }
-
- ::ShowWindow(hwnd, SW_SHOWNORMAL);
-
-
- return hwnd;
-#else
-#error Need code.
-#endif
-}
-
-int main(int argc, const char** argv) {
- const int32 kCommandBufferSize = 1024 * 1024;
- GLES2Demo* demo = new GLES2Demo();
-
- void* hwnd = SetupWindow();
- if (!hwnd) {
- ::fprintf(stdout, "Could not setup window.\n");
- return EXIT_FAILURE;
- }
-
- demo->Setup(NULL, hwnd, kCommandBufferSize);
-
- ProcessMessages(hwnd);
-
- return EXIT_SUCCESS;
-}
-
-
diff --git a/gpu/command_buffer/client/gles2_demo_c.c b/gpu/command_buffer/client/gles2_demo_c.c
deleted file mode 100644
index 44b2c57..0000000
--- a/gpu/command_buffer/client/gles2_demo_c.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (c) 2006-2009 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 is here so other GLES2 related files can have a common set of
-// includes where appropriate.
-
-#include <GLES2/gl2.h>
-#include "gpu/command_buffer/client/gles2_demo_c.h"
-
-void GLFromCTestFunction() {
- glClear(GL_COLOR_BUFFER_BIT);
-}
-
-
diff --git a/gpu/command_buffer/client/gles2_demo_c.h b/gpu/command_buffer/client/gles2_demo_c.h
deleted file mode 100644
index 0cd1478..0000000
--- a/gpu/command_buffer/client/gles2_demo_c.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2006-2009 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.
-
-// A Test that we can access GL from c.
-
-#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_DEMO_C_H
-#define GPU_COMMAND_BUFFER_CLIENT_GLES2_DEMO_C_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void GLFromCTestFunction();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_DEMO_C_H
-
-
diff --git a/gpu/command_buffer/client/gles2_demo_cc.cc b/gpu/command_buffer/client/gles2_demo_cc.cc
deleted file mode 100644
index d7a023c..0000000
--- a/gpu/command_buffer/client/gles2_demo_cc.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2006-2009 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 is here so other GLES2 related files can have a common set of
-// includes where appropriate.
-
-#include <GLES2/gl2.h>
-#include "gpu/command_buffer/client/gles2_demo_cc.h"
-
-void GLFromCPPTestFunction() {
- static bool foo = true;
- foo = !foo;
- glClearColor(
- foo ? 1.0f : 0.0f,
- foo ? 0.0f : 1.0f,
- 1.0f,
- 1.0f);
-}
-
-
diff --git a/gpu/command_buffer/client/gles2_demo_cc.h b/gpu/command_buffer/client/gles2_demo_cc.h
deleted file mode 100644
index 7f88d0e..0000000
--- a/gpu/command_buffer/client/gles2_demo_cc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2006-2009 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.
-
-// A Test that we can access GL from C++.
-
-#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_DEMO_CC_H
-#define GPU_COMMAND_BUFFER_CLIENT_GLES2_DEMO_CC_H
-
-void GLFromCPPTestFunction();
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_DEMO_CC_H
-
-
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
deleted file mode 100644
index e60e68b..0000000
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) 2006-2009 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.
-
-// A class to emluate GLES2 over command buffers.
-
-#include "gpu/command_buffer/client/gles2_implementation.h"
-// TODO(gman): remove when all functions have been implemented.
-#include "gpu/command_buffer/client/gles2_implementation_gen.h"
-#include "gpu/command_buffer/common/gles2_cmd_utils.h"
-
-namespace command_buffer {
-namespace gles2 {
-
-GLES2Implementation::GLES2Implementation(
- GLES2CmdHelper* helper,
- void* transfer_buffer,
- int transfer_buffer_id)
- : util_(0), // TODO(gman): Get real number of compressed texture formats.
- helper_(helper),
- shared_memory_(transfer_buffer, transfer_buffer_id),
- pack_alignment_(4),
- unpack_alignment_(4) {
-}
-
-void GLES2Implementation::MakeIds(GLsizei n, GLuint* ids) {
- for (GLsizei ii = 0; ii < n; ++ii) {
- ids[ii] = id_allocator_.AllocateID();
- }
-}
-
-void GLES2Implementation::FreeIds(GLsizei n, const GLuint* ids) {
- for (GLsizei ii = 0; ii < n; ++ii) {
- id_allocator_.FreeID(ids[ii]);
- }
-}
-
-void GLES2Implementation::DrawElements(
- GLenum mode, GLsizei count, GLenum type, const void* indices) {
- helper_->DrawElements(mode, count, type, reinterpret_cast<GLuint>(indices));
-}
-
-void GLES2Implementation::VertexAttribPointer(
- GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
- const void* ptr) {
- helper_->VertexAttribPointer(index, size, type, normalized, stride,
- reinterpret_cast<GLuint>(ptr));
-}
-
-void GLES2Implementation::ShaderSource(
- GLuint shader, GLsizei count, const char** string, const GLint* length) {
- // TODO(gman): change to use buckets and check that there is enough room.
- uint32* offsets = shared_memory_.GetAddressAs<uint32*>(0);
- char* strings = reinterpret_cast<char*>(offsets + count);
-
- uint32 offset = count * sizeof(*offsets);
- for (GLsizei ii = 0; ii < count; ++ii) {
- uint32 len = length ? length[ii] : strlen(string[ii]);
- memcpy(strings + offset, string[ii], len);
- offset += len;
- offsets[ii] = offset;
- }
-
- helper_->ShaderSource(shader, count, shared_memory_.GetId(), 0, offset);
- // TODO(gman): Should insert token but not wait until we need shared memory
- // again. Really, I should implement a shared memory manager that puts
- // things in the next unused part of shared memory and only blocks
- // when it needs more memory.
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
-}
-
-void GLES2Implementation::BufferData(
- GLenum target, GLsizeiptr size, const void* data, GLenum usage) {
- // TODO(gman): Switch to use buckets alwayst or at least if no room in shared
- // memory.
- memcpy(shared_memory_.GetAddress(0), data, size);
- helper_->BufferData(target, size, shared_memory_.GetId(), 0, usage);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
-}
-
-void GLES2Implementation::BufferSubData(
- GLenum target, GLintptr offset, GLsizeiptr size, const void* data) {
- // TODO(gman): Switch to use buckets alwayst or at least if no room in shared
- // memory.
- memcpy(shared_memory_.GetAddress(0), data, size);
- helper_->BufferSubData(target, offset, size, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
-}
-
-void GLES2Implementation::CompressedTexImage2D(
- GLenum target, GLint level, GLenum internalformat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize, const void* data) {
- // TODO(gman): Switch to use buckets alwayst or at least if no room in shared
- // memory.
- memcpy(shared_memory_.GetAddress(0), data, imageSize);
- helper_->CompressedTexImage2D(
- target, level, internalformat, width, height, border, imageSize,
- shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
-}
-
-void GLES2Implementation::CompressedTexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLsizei imageSize, const void* data) {
- // TODO(gman): Switch to use buckets alwayst or at least if no room in shared
- // memory.
- memcpy(shared_memory_.GetAddress(0), data, imageSize);
- helper_->CompressedTexSubImage2D(
- target, level, xoffset, yoffset, width, height, format, imageSize,
- shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
-}
-
-void GLES2Implementation::TexImage2D(
- GLenum target, GLint level, GLint internalformat, GLsizei width,
- GLsizei height, GLint border, GLenum format, GLenum type,
- const void* pixels) {
- // TODO(gman): Switch to use buckets alwayst or at least if no room in shared
- // memory.
- uint32 pixels_size = GLES2Util::ComputeImageDataSize(
- width, height, format, type, unpack_alignment_);
- memcpy(shared_memory_.GetAddress(0), pixels, pixels_size);
- helper_->TexImage2D(
- target, level, internalformat, width, height, border, format, type,
- shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
-}
-
-void GLES2Implementation::TexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLenum type, const void* pixels) {
- // TODO(gman): Switch to use buckets alwayst or at least if no room in shared
- // memory.
- uint32 pixels_size = GLES2Util::ComputeImageDataSize(
- width, height, format, type, unpack_alignment_);
- memcpy(shared_memory_.GetAddress(0), pixels, pixels_size);
- helper_->TexSubImage2D(
- target, level, xoffset, yoffset, width, height, format, type,
- shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
-}
-
-
-} // namespace gles2
-} // namespace command_buffer
-
-
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
deleted file mode 100644
index 2df52ca..0000000
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2006-2009 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_CLIENT_GLES2_IMPLEMENTATION_H
-#define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H
-
-#include "base/shared_memory.h"
-#include "gpu/command_buffer/common/gles2_cmd_utils.h"
-#include "gpu/command_buffer/client/gles2_cmd_helper.h"
-#include "gpu/command_buffer/client/id_allocator.h"
-
-namespace command_buffer {
-namespace gles2 {
-
-// A class to help with shared memory.
-class SharedMemoryHelper {
- public:
- SharedMemoryHelper(void* address, int id)
- : address_(address),
- id_(id) {
- }
-
- unsigned int GetOffset(void* address) const {
- return static_cast<int8*>(address) -
- static_cast<int8*>(address_);
- }
-
- void* GetAddress(unsigned int offset) const {
- return static_cast<int8*>(address_) + offset;
- }
-
- template <typename T>
- T GetAddressAs(unsigned int offset) const {
- return static_cast<T>(GetAddress(offset));
- }
-
- unsigned int GetId() const {
- return id_;
- }
-
- private:
- void* address_;
- int id_;
-
- DISALLOW_COPY_AND_ASSIGN(SharedMemoryHelper);
-};
-
-// This class emulates GLES2 over command buffers. It can be used by a client
-// program so that the program does not need deal with shared memory and command
-// buffer management. See gl2_lib.h. Note that there is a performance gain to
-// be had by changing your code to use command buffers directly by using the
-// GLES2CmdHelper but that entails changing your code to use and deal with
-// shared memory and synchronization issues.
-class GLES2Implementation {
- public:
- GLES2Implementation(
- GLES2CmdHelper* helper,
- void* transfer_buffer,
- int transfer_buffer_id); // TODO: add size.
-
- // Include the auto-generated part of this class. We split this because
- // it means we can easily edit the non-auto generated parts right here in
- // this file instead of having to edit some template or the code generator.
- #include "gpu/command_buffer/client/gles2_implementation_autogen.h"
-
- private:
- // Makes a set of Ids for glGen___ functions.
- void MakeIds(GLsizei n, GLuint* ids);
-
- // Frees a set of Ids for glDelete___ functions.
- void FreeIds(GLsizei n, const GLuint* ids);
-
- GLES2Util util_;
- GLES2CmdHelper* helper_;
- IdAllocator id_allocator_;
- SharedMemoryHelper shared_memory_; // TODO(gman): rename transfer_buffer_.
-
- // pack alignment as last set by glPixelStorei
- GLint pack_alignment_;
-
- // unpack alignment as last set by glPixelStorei
- GLint unpack_alignment_;
-
- DISALLOW_COPY_AND_ASSIGN(GLES2Implementation);
-};
-
-
-} // namespace gles2
-} // namespace command_buffer
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_H
-
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
deleted file mode 100644
index 940454b..0000000
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ /dev/null
@@ -1,684 +0,0 @@
-// This file is auto-generated. DO NOT EDIT!
-
-// This file is included by gles2_implementation.h to declare the
-// GL api functions.
-void ActiveTexture(GLenum texture) {
- helper_->ActiveTexture(texture);
-}
-
-void AttachShader(GLuint program, GLuint shader) {
- helper_->AttachShader(program, shader);
-}
-
-void BindAttribLocation(GLuint program, GLuint index, const char* name) {
- // TODO(gman): This needs to change to use SendString.
- helper_->BindAttribLocationImmediate(program, index, name);
-}
-
-void BindBuffer(GLenum target, GLuint buffer) {
- helper_->BindBuffer(target, buffer);
-}
-
-void BindFramebuffer(GLenum target, GLuint framebuffer) {
- helper_->BindFramebuffer(target, framebuffer);
-}
-
-void BindRenderbuffer(GLenum target, GLuint renderbuffer) {
- helper_->BindRenderbuffer(target, renderbuffer);
-}
-
-void BindTexture(GLenum target, GLuint texture) {
- helper_->BindTexture(target, texture);
-}
-
-void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- helper_->BlendColor(red, green, blue, alpha);
-}
-
-void BlendEquation(GLenum mode) {
- helper_->BlendEquation(mode);
-}
-
-void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) {
- helper_->BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-void BlendFunc(GLenum sfactor, GLenum dfactor) {
- helper_->BlendFunc(sfactor, dfactor);
-}
-
-void BlendFuncSeparate(
- GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) {
- helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-void BufferData(
- GLenum target, GLsizeiptr size, const void* data, GLenum usage);
-
-void BufferSubData(
- GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
-
-GLenum CheckFramebufferStatus(GLenum target);
-
-void Clear(GLbitfield mask) {
- helper_->Clear(mask);
-}
-
-void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
- helper_->ClearColor(red, green, blue, alpha);
-}
-
-void ClearDepthf(GLclampf depth) {
- helper_->ClearDepthf(depth);
-}
-
-void ClearStencil(GLint s) {
- helper_->ClearStencil(s);
-}
-
-void ColorMask(
- GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) {
- helper_->ColorMask(red, green, blue, alpha);
-}
-
-void CompileShader(GLuint shader) {
- helper_->CompileShader(shader);
-}
-
-void CompressedTexImage2D(
- GLenum target, GLint level, GLenum internalformat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize, const void* data);
-
-void CompressedTexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLsizei imageSize, const void* data);
-
-void CopyTexImage2D(
- GLenum target, GLint level, GLenum internalformat, GLint x, GLint y,
- GLsizei width, GLsizei height, GLint border) {
- helper_->CopyTexImage2D(
- target, level, internalformat, x, y, width, height, border);
-}
-
-void CopyTexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y,
- GLsizei width, GLsizei height) {
- helper_->CopyTexSubImage2D(
- target, level, xoffset, yoffset, x, y, width, height);
-}
-
-GLuint CreateProgram() {
- GLuint client_id;
- MakeIds(1, &client_id);
- helper_->CreateProgram(client_id);
- return client_id;
-}
-
-GLuint CreateShader(GLenum type) {
- GLuint client_id;
- MakeIds(1, &client_id);
- helper_->CreateShader(type, client_id);
- return client_id;
-}
-
-void CullFace(GLenum mode) {
- helper_->CullFace(mode);
-}
-
-void DeleteBuffers(GLsizei n, const GLuint* buffers) {
- FreeIds(n, buffers);
- helper_->DeleteBuffersImmediate(n, buffers);
-}
-
-void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) {
- FreeIds(n, framebuffers);
- helper_->DeleteFramebuffersImmediate(n, framebuffers);
-}
-
-void DeleteProgram(GLuint program) {
- helper_->DeleteProgram(program);
-}
-
-void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) {
- FreeIds(n, renderbuffers);
- helper_->DeleteRenderbuffersImmediate(n, renderbuffers);
-}
-
-void DeleteShader(GLuint shader) {
- helper_->DeleteShader(shader);
-}
-
-void DeleteTextures(GLsizei n, const GLuint* textures) {
- FreeIds(n, textures);
- helper_->DeleteTexturesImmediate(n, textures);
-}
-
-void DepthFunc(GLenum func) {
- helper_->DepthFunc(func);
-}
-
-void DepthMask(GLboolean flag) {
- helper_->DepthMask(flag);
-}
-
-void DepthRangef(GLclampf zNear, GLclampf zFar) {
- helper_->DepthRangef(zNear, zFar);
-}
-
-void DetachShader(GLuint program, GLuint shader) {
- helper_->DetachShader(program, shader);
-}
-
-void Disable(GLenum cap) {
- helper_->Disable(cap);
-}
-
-void DisableVertexAttribArray(GLuint index) {
- helper_->DisableVertexAttribArray(index);
-}
-
-void DrawArrays(GLenum mode, GLint first, GLsizei count) {
- helper_->DrawArrays(mode, first, count);
-}
-
-void DrawElements(
- GLenum mode, GLsizei count, GLenum type, const void* indices);
-
-void Enable(GLenum cap) {
- helper_->Enable(cap);
-}
-
-void EnableVertexAttribArray(GLuint index) {
- helper_->EnableVertexAttribArray(index);
-}
-
-void Finish() {
- helper_->Finish();
-}
-
-void Flush() {
- helper_->Flush();
-}
-
-void FramebufferRenderbuffer(
- GLenum target, GLenum attachment, GLenum renderbuffertarget,
- GLuint renderbuffer) {
- helper_->FramebufferRenderbuffer(
- target, attachment, renderbuffertarget, renderbuffer);
-}
-
-void FramebufferTexture2D(
- GLenum target, GLenum attachment, GLenum textarget, GLuint texture,
- GLint level) {
- helper_->FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-void FrontFace(GLenum mode) {
- helper_->FrontFace(mode);
-}
-
-void GenBuffers(GLsizei n, GLuint* buffers) {
- MakeIds(n, buffers);
- helper_->GenBuffersImmediate(n, buffers);
-}
-
-void GenerateMipmap(GLenum target) {
- helper_->GenerateMipmap(target);
-}
-
-void GenFramebuffers(GLsizei n, GLuint* framebuffers) {
- MakeIds(n, framebuffers);
- helper_->GenFramebuffersImmediate(n, framebuffers);
-}
-
-void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
- MakeIds(n, renderbuffers);
- helper_->GenRenderbuffersImmediate(n, renderbuffers);
-}
-
-void GenTextures(GLsizei n, GLuint* textures) {
- MakeIds(n, textures);
- helper_->GenTexturesImmediate(n, textures);
-}
-
-void GetActiveAttrib(
- GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
- GLenum* type, char* name);
-
-void GetActiveUniform(
- GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
- GLenum* type, char* name);
-
-void GetAttachedShaders(
- GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-
-int GetAttribLocation(GLuint program, const char* name) {
- // TODO(gman): This needs to change to use SendString.
- GLint* result = shared_memory_.GetAddressAs<GLint*>(0);
- DCHECK(false); // pass in shared memory
- helper_->GetAttribLocationImmediate(program, name);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *result;
-}
-
-void GetBooleanv(GLenum pname, GLboolean* params) {
- helper_->GetBooleanv(pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) {
- helper_->GetBufferParameteriv(target, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-GLenum GetError() {
- helper_->GetError(shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *shared_memory_.GetAddressAs<GLenum*>(0);
-}
-
-void GetFloatv(GLenum pname, GLfloat* params) {
- helper_->GetFloatv(pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetFramebufferAttachmentParameteriv(
- GLenum target, GLenum attachment, GLenum pname, GLint* params) {
- helper_->GetFramebufferAttachmentParameteriv(
- target, attachment, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetIntegerv(GLenum pname, GLint* params) {
- helper_->GetIntegerv(pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetProgramiv(GLuint program, GLenum pname, GLint* params) {
- helper_->GetProgramiv(program, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-// TODO(gman): Implement this
-void GetProgramInfoLog(
- GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
-
-void GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) {
- helper_->GetRenderbufferParameteriv(
- target, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetShaderiv(GLuint shader, GLenum pname, GLint* params) {
- helper_->GetShaderiv(shader, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-// TODO(gman): Implement this
-void GetShaderInfoLog(
- GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
-
-void GetShaderPrecisionFormat(
- GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
-
-// TODO(gman): Implement this
-void GetShaderSource(
- GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
-
-const GLubyte* GetString(GLenum name);
-
-void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) {
- helper_->GetTexParameterfv(target, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) {
- helper_->GetTexParameteriv(target, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetUniformfv(GLuint program, GLint location, GLfloat* params);
-
-void GetUniformiv(GLuint program, GLint location, GLint* params);
-
-int GetUniformLocation(GLuint program, const char* name) {
- // TODO(gman): This needs to change to use SendString.
- GLint* result = shared_memory_.GetAddressAs<GLint*>(0);
- DCHECK(false); // pass in shared memory
- helper_->GetUniformLocationImmediate(program, name);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *result;
-}
-
-void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) {
- helper_->GetVertexAttribfv(index, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) {
- helper_->GetVertexAttribiv(index, pname, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- GLsizei num_values = util_.GLGetNumValuesReturned(pname);
- memcpy(params, shared_memory_.GetAddress(0),
- num_values * sizeof(*params));
-}
-
-void GetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer);
-
-void Hint(GLenum target, GLenum mode) {
- helper_->Hint(target, mode);
-}
-
-GLboolean IsBuffer(GLuint buffer) {
- helper_->IsBuffer(buffer, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *shared_memory_.GetAddressAs<GLboolean*>(0);
-}
-
-GLboolean IsEnabled(GLenum cap) {
- helper_->IsEnabled(cap, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *shared_memory_.GetAddressAs<GLboolean*>(0);
-}
-
-GLboolean IsFramebuffer(GLuint framebuffer) {
- helper_->IsFramebuffer(framebuffer, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *shared_memory_.GetAddressAs<GLboolean*>(0);
-}
-
-GLboolean IsProgram(GLuint program) {
- helper_->IsProgram(program, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *shared_memory_.GetAddressAs<GLboolean*>(0);
-}
-
-GLboolean IsRenderbuffer(GLuint renderbuffer) {
- helper_->IsRenderbuffer(renderbuffer, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *shared_memory_.GetAddressAs<GLboolean*>(0);
-}
-
-GLboolean IsShader(GLuint shader) {
- helper_->IsShader(shader, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *shared_memory_.GetAddressAs<GLboolean*>(0);
-}
-
-GLboolean IsTexture(GLuint texture) {
- helper_->IsTexture(texture, shared_memory_.GetId(), 0);
- int32 token = helper_->InsertToken();
- helper_->WaitForToken(token);
- return *shared_memory_.GetAddressAs<GLboolean*>(0);
-}
-
-void LineWidth(GLfloat width) {
- helper_->LineWidth(width);
-}
-
-void LinkProgram(GLuint program) {
- helper_->LinkProgram(program);
-}
-
-void PixelStorei(GLenum pname, GLint param) {
- helper_->PixelStorei(pname, param);
-}
-
-void PolygonOffset(GLfloat factor, GLfloat units) {
- helper_->PolygonOffset(factor, units);
-}
-
-void ReadPixels(
- GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- void* pixels);
-
-void RenderbufferStorage(
- GLenum target, GLenum internalformat, GLsizei width, GLsizei height) {
- helper_->RenderbufferStorage(target, internalformat, width, height);
-}
-
-void SampleCoverage(GLclampf value, GLboolean invert) {
- helper_->SampleCoverage(value, invert);
-}
-
-void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) {
- helper_->Scissor(x, y, width, height);
-}
-
-void ShaderSource(
- GLuint shader, GLsizei count, const char** string, const GLint* length);
-
-void StencilFunc(GLenum func, GLint ref, GLuint mask) {
- helper_->StencilFunc(func, ref, mask);
-}
-
-void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) {
- helper_->StencilFuncSeparate(face, func, ref, mask);
-}
-
-void StencilMask(GLuint mask) {
- helper_->StencilMask(mask);
-}
-
-void StencilMaskSeparate(GLenum face, GLuint mask) {
- helper_->StencilMaskSeparate(face, mask);
-}
-
-void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) {
- helper_->StencilOp(fail, zfail, zpass);
-}
-
-void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) {
- helper_->StencilOpSeparate(face, fail, zfail, zpass);
-}
-
-void TexImage2D(
- GLenum target, GLint level, GLint internalformat, GLsizei width,
- GLsizei height, GLint border, GLenum format, GLenum type,
- const void* pixels);
-
-void TexParameterf(GLenum target, GLenum pname, GLfloat param) {
- helper_->TexParameterf(target, pname, param);
-}
-
-void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params) {
- helper_->TexParameterfvImmediate(target, pname, params);
-}
-
-void TexParameteri(GLenum target, GLenum pname, GLint param) {
- helper_->TexParameteri(target, pname, param);
-}
-
-void TexParameteriv(GLenum target, GLenum pname, const GLint* params) {
- helper_->TexParameterivImmediate(target, pname, params);
-}
-
-void TexSubImage2D(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLenum type, const void* pixels);
-
-void Uniform1f(GLint location, GLfloat x) {
- helper_->Uniform1f(location, x);
-}
-
-void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) {
- helper_->Uniform1fvImmediate(location, count, v);
-}
-
-void Uniform1i(GLint location, GLint x) {
- helper_->Uniform1i(location, x);
-}
-
-void Uniform1iv(GLint location, GLsizei count, const GLint* v) {
- helper_->Uniform1ivImmediate(location, count, v);
-}
-
-void Uniform2f(GLint location, GLfloat x, GLfloat y) {
- helper_->Uniform2f(location, x, y);
-}
-
-void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) {
- helper_->Uniform2fvImmediate(location, count, v);
-}
-
-void Uniform2i(GLint location, GLint x, GLint y) {
- helper_->Uniform2i(location, x, y);
-}
-
-void Uniform2iv(GLint location, GLsizei count, const GLint* v) {
- helper_->Uniform2ivImmediate(location, count, v);
-}
-
-void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) {
- helper_->Uniform3f(location, x, y, z);
-}
-
-void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) {
- helper_->Uniform3fvImmediate(location, count, v);
-}
-
-void Uniform3i(GLint location, GLint x, GLint y, GLint z) {
- helper_->Uniform3i(location, x, y, z);
-}
-
-void Uniform3iv(GLint location, GLsizei count, const GLint* v) {
- helper_->Uniform3ivImmediate(location, count, v);
-}
-
-void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- helper_->Uniform4f(location, x, y, z, w);
-}
-
-void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) {
- helper_->Uniform4fvImmediate(location, count, v);
-}
-
-void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) {
- helper_->Uniform4i(location, x, y, z, w);
-}
-
-void Uniform4iv(GLint location, GLsizei count, const GLint* v) {
- helper_->Uniform4ivImmediate(location, count, v);
-}
-
-void UniformMatrix2fv(
- GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- helper_->UniformMatrix2fvImmediate(location, count, transpose, value);
-}
-
-void UniformMatrix3fv(
- GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- helper_->UniformMatrix3fvImmediate(location, count, transpose, value);
-}
-
-void UniformMatrix4fv(
- GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
- helper_->UniformMatrix4fvImmediate(location, count, transpose, value);
-}
-
-void UseProgram(GLuint program) {
- helper_->UseProgram(program);
-}
-
-void ValidateProgram(GLuint program) {
- helper_->ValidateProgram(program);
-}
-
-void VertexAttrib1f(GLuint indx, GLfloat x) {
- helper_->VertexAttrib1f(indx, x);
-}
-
-void VertexAttrib1fv(GLuint indx, const GLfloat* values) {
- helper_->VertexAttrib1fvImmediate(indx, values);
-}
-
-void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) {
- helper_->VertexAttrib2f(indx, x, y);
-}
-
-void VertexAttrib2fv(GLuint indx, const GLfloat* values) {
- helper_->VertexAttrib2fvImmediate(indx, values);
-}
-
-void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) {
- helper_->VertexAttrib3f(indx, x, y, z);
-}
-
-void VertexAttrib3fv(GLuint indx, const GLfloat* values) {
- helper_->VertexAttrib3fvImmediate(indx, values);
-}
-
-void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
- helper_->VertexAttrib4f(indx, x, y, z, w);
-}
-
-void VertexAttrib4fv(GLuint indx, const GLfloat* values) {
- helper_->VertexAttrib4fvImmediate(indx, values);
-}
-
-void VertexAttribPointer(
- GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
- const void* ptr);
-
-void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) {
- helper_->Viewport(x, y, width, height);
-}
-
-void SwapBuffers() {
- helper_->SwapBuffers();
-}
-
diff --git a/gpu/command_buffer/client/gles2_implementation_gen.h b/gpu/command_buffer/client/gles2_implementation_gen.h
deleted file mode 100644
index d385f8f..0000000
--- a/gpu/command_buffer/client/gles2_implementation_gen.h
+++ /dev/null
@@ -1,72 +0,0 @@
-
-// Copyright (c) 2006-2008 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.
-
-
-// A class to emluate GLES2 over command buffers.
-
-#include "gpu/command_buffer/client/gles2_implementation.h"
-
-namespace command_buffer {
-namespace gles2 {
-
-GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) {
- return 0;
-}
-
-void GLES2Implementation::GetActiveAttrib(
- GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
- GLenum* type, char* name) {
-}
-
-void GLES2Implementation::GetActiveUniform(
- GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size,
- GLenum* type, char* name) {
-}
-
-void GLES2Implementation::GetAttachedShaders(
- GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
-}
-
-void GLES2Implementation::GetProgramInfoLog(
- GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) {
-}
-
-void GLES2Implementation::GetShaderInfoLog(
- GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) {
-}
-
-void GLES2Implementation::GetShaderPrecisionFormat(
- GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
-}
-
-void GLES2Implementation::GetShaderSource(
- GLuint shader, GLsizei bufsize, GLsizei* length, char* source) {
-}
-
-const GLubyte* GLES2Implementation::GetString(GLenum name) {
- return 0;
-}
-
-void GLES2Implementation::GetUniformfv(
- GLuint program, GLint location, GLfloat* params) {
-}
-
-void GLES2Implementation::GetUniformiv(
- GLuint program, GLint location, GLint* params) {
-}
-
-void GLES2Implementation::GetVertexAttribPointerv(
- GLuint index, GLenum pname, void** pointer) {
-}
-
-void GLES2Implementation::ReadPixels(
- GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
- void* pixels) {
-}
-
-
-} // namespace gles2
-} // namespace command_buffer
-
diff --git a/gpu/command_buffer/client/gles2_lib.cc b/gpu/command_buffer/client/gles2_lib.cc
deleted file mode 100644
index 681f7ad..0000000
--- a/gpu/command_buffer/client/gles2_lib.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2006-2009 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_lib.h"
-
-namespace gles2 {
-
-::command_buffer::gles2::GLES2Implementation* g_gl_impl;
-
-bool InitGLES2Lib() {
- // TODO(gman): Encapulate initalizing the GLES2 library for client apps.
- return false;
-}
-
-} // namespace gles2
-
-
-
-
diff --git a/gpu/command_buffer/client/gles2_lib.h b/gpu/command_buffer/client/gles2_lib.h
deleted file mode 100644
index 589d2050..0000000
--- a/gpu/command_buffer/client/gles2_lib.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2006-2009 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.
-
-// These functions emluate GLES2 over command buffers.
-
-#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_LIB_H
-#define GPU_COMMAND_BUFFER_CLIENT_GLES2_LIB_H
-
-#include "gpu/command_buffer/client/gles2_implementation.h"
-
-namespace gles2 {
-
-extern ::command_buffer::gles2::GLES2Implementation* g_gl_impl;
-
-inline ::command_buffer::gles2::GLES2Implementation* GetGLContext() {
- return g_gl_impl;
-}
-
-// Initializes the GLES2 library.
-bool InitGLES2Lib();
-
-} // namespace gles2
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_LIB_H
-
diff --git a/gpu/command_buffer/client/id_allocator.cc b/gpu/command_buffer/client/id_allocator.cc
deleted file mode 100644
index 49104e5..0000000
--- a/gpu/command_buffer/client/id_allocator.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// This file contains the implementation of IdAllocator.
-
-#include "gpu/command_buffer/client/id_allocator.h"
-
-namespace command_buffer {
-
-IdAllocator::IdAllocator() : bitmap_(1) { bitmap_[0] = 0; }
-
-static const unsigned int kBitsPerUint32 = sizeof(Uint32) * 8; // NOLINT
-
-// Looks for the first non-full entry, and return the first free bit in that
-// entry. If all the entries are full, it will return the first bit of an entry
-// that would be appended, but doesn't actually append that entry to the vector.
-unsigned int IdAllocator::FindFirstFree() const {
- size_t size = bitmap_.size();
- for (unsigned int i = 0; i < size; ++i) {
- Uint32 value = bitmap_[i];
- if (value != 0xffffffffU) {
- for (unsigned int j = 0; j < kBitsPerUint32; ++j) {
- if (!(value & (1 << j))) return i * kBitsPerUint32 + j;
- }
- DLOG(FATAL) << "Code should not reach here.";
- }
- }
- return size*kBitsPerUint32;
-}
-
-// Sets the correct bit in the proper entry, resizing the vector if needed.
-void IdAllocator::SetBit(unsigned int bit, bool value) {
- size_t size = bitmap_.size();
- if (bit >= size * kBitsPerUint32) {
- size_t newsize = bit / kBitsPerUint32 + 1;
- bitmap_.resize(newsize);
- for (size_t i = size; i < newsize; ++i) bitmap_[i] = 0;
- }
- Uint32 mask = 1U << (bit % kBitsPerUint32);
- if (value) {
- bitmap_[bit / kBitsPerUint32] |= mask;
- } else {
- bitmap_[bit / kBitsPerUint32] &= ~mask;
- }
-}
-
-// Gets the bit from the proper entry. This doesn't resize the vector, just
-// returns false if the bit is beyond the last entry.
-bool IdAllocator::GetBit(unsigned int bit) const {
- size_t size = bitmap_.size();
- if (bit / kBitsPerUint32 >= size) return false;
- Uint32 mask = 1U << (bit % kBitsPerUint32);
- return (bitmap_[bit / kBitsPerUint32] & mask) != 0;
-}
-
-} // namespace command_buffer
diff --git a/gpu/command_buffer/client/id_allocator.h b/gpu/command_buffer/client/id_allocator.h
deleted file mode 100644
index b2b14b9..0000000
--- a/gpu/command_buffer/client/id_allocator.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// This file contains the definition of the IdAllocator class.
-
-#ifndef GPU_COMMAND_BUFFER_CLIENT_CROSS_ID_ALLOCATOR_H_
-#define GPU_COMMAND_BUFFER_CLIENT_CROSS_ID_ALLOCATOR_H_
-
-#include <vector>
-#include "base/basictypes.h"
-#include "gpu/command_buffer/common/types.h"
-#include "gpu/command_buffer/common/resource.h"
-
-namespace command_buffer {
-
-// A class to manage the allocation of resource IDs. It uses a bitfield stored
-// into a vector of unsigned ints.
-class IdAllocator {
- public:
- IdAllocator();
-
- // Allocates a new resource ID.
- command_buffer::ResourceId AllocateID() {
- unsigned int bit = FindFirstFree();
- SetBit(bit, true);
- return bit;
- }
-
- // Frees a resource ID.
- void FreeID(command_buffer::ResourceId id) {
- SetBit(id, false);
- }
-
- // Checks whether or not a resource ID is in use.
- bool InUse(command_buffer::ResourceId id) {
- return GetBit(id);
- }
- private:
- void SetBit(unsigned int bit, bool value);
- bool GetBit(unsigned int bit) const;
- unsigned int FindFirstFree() const;
-
- std::vector<Uint32> bitmap_;
- DISALLOW_COPY_AND_ASSIGN(IdAllocator);
-};
-
-} // namespace command_buffer
-
-#endif // GPU_COMMAND_BUFFER_CLIENT_CROSS_ID_ALLOCATOR_H_
diff --git a/gpu/command_buffer/client/id_allocator_test.cc b/gpu/command_buffer/client/id_allocator_test.cc
deleted file mode 100644
index bb8d5f9b..0000000
--- a/gpu/command_buffer/client/id_allocator_test.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2009, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-// This file has the unit tests for the IdAllocator class.
-
-#include "gpu/command_buffer/client/id_allocator.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace command_buffer {
-
-using command_buffer::ResourceId;
-
-class IdAllocatorTest : public testing::Test {
- protected:
- virtual void SetUp() {}
- virtual void TearDown() {}
-
- IdAllocator* id_allocator() { return &id_allocator_; }
-
- private:
- IdAllocator id_allocator_;
-};
-
-// Checks basic functionality: AllocateID, FreeID, InUse.
-TEST_F(IdAllocatorTest, TestBasic) {
- IdAllocator *allocator = id_allocator();
- // Check that resource 0 is not in use
- EXPECT_FALSE(allocator->InUse(0));
-
- // Allocate an ID, check that it's in use.
- ResourceId id1 = allocator->AllocateID();
- EXPECT_TRUE(allocator->InUse(id1));
-
- // Allocate another ID, check that it's in use, and different from the first
- // one.
- ResourceId id2 = allocator->AllocateID();
- EXPECT_TRUE(allocator->InUse(id2));
- EXPECT_NE(id1, id2);
-
- // Free one of the IDs, check that it's not in use any more.
- allocator->FreeID(id1);
- EXPECT_FALSE(allocator->InUse(id1));
-
- // Frees the other ID, check that it's not in use any more.
- allocator->FreeID(id2);
- EXPECT_FALSE(allocator->InUse(id2));
-}
-
-// Checks that the resource IDs are allocated conservatively, and re-used after
-// being freed.
-TEST_F(IdAllocatorTest, TestAdvanced) {
- IdAllocator *allocator = id_allocator();
-
- // Allocate a significant number of resources.
- const unsigned int kNumResources = 100;
- ResourceId ids[kNumResources];
- for (unsigned int i = 0; i < kNumResources; ++i) {
- ids[i] = allocator->AllocateID();
- EXPECT_TRUE(allocator->InUse(ids[i]));
- }
-
- // Check that the allocation is conservative with resource IDs, that is that
- // the resource IDs don't go over kNumResources - so that the service doesn't
- // have to allocate too many internal structures when the resources are used.
- for (unsigned int i = 0; i < kNumResources; ++i) {
- EXPECT_GT(kNumResources, ids[i]);
- }
-
- // Check that the next resources are still free.
- for (unsigned int i = 0; i < kNumResources; ++i) {
- EXPECT_FALSE(allocator->InUse(kNumResources + i));
- }
-
- // Check that a new allocation re-uses the resource we just freed.
- ResourceId id1 = ids[kNumResources / 2];
- allocator->FreeID(id1);
- EXPECT_FALSE(allocator->InUse(id1));
- ResourceId id2 = allocator->AllocateID();
- EXPECT_TRUE(allocator->InUse(id2));
- EXPECT_EQ(id1, id2);
-}
-
-} // namespace command_buffer