diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-08 14:30:41 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-08-12 13:49:54 +0200 |
commit | ab0a50979b9eb4dfa3320eff7e187e41efedf7a9 (patch) | |
tree | 498dfb8a97ff3361a9f7486863a52bb4e26bb898 /chromium/gpu/command_buffer/client | |
parent | 4ce69f7403811819800e7c5ae1318b2647e778d1 (diff) |
Update Chromium to beta version 37.0.2062.68
Change-Id: I188e3b5aff1bec75566014291b654eb19f5bc8ca
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/gpu/command_buffer/client')
52 files changed, 9564 insertions, 5689 deletions
diff --git a/chromium/gpu/command_buffer/client/BUILD.gn b/chromium/gpu/command_buffer/client/BUILD.gn new file mode 100644 index 00000000000..91dcddbc9e6 --- /dev/null +++ b/chromium/gpu/command_buffer/client/BUILD.gn @@ -0,0 +1,165 @@ +# Copyright (c) 2013 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. + +source_set("client") { + sources = [ + "cmd_buffer_helper.cc", + "cmd_buffer_helper.h", + "fenced_allocator.cc", + "fenced_allocator.h", + "gpu_control.h", + "mapped_memory.cc", + "mapped_memory.h", + "ring_buffer.cc", + "ring_buffer.h", + "transfer_buffer.cc", + "transfer_buffer.h", + ] + + if (is_win) { + # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. + cflags = [ "/wd4267" ] # size_t to int truncation. + } + + all_dependent_configs = [ "//third_party/khronos:khronos_headers" ] + + deps = [ + "//gpu/command_buffer/common", + ] +} + +source_set("gles2_cmd_helper") { + sources = [ + "gles2_cmd_helper.cc", + "gles2_cmd_helper.h", + "gles2_cmd_helper_autogen.h", + ] + + if (is_win) { + # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. + cflags = [ "/wd4267" ] # size_t to int truncation. + } + + deps = [ ":client" ] +} + +gles2_c_lib_source_files = [ + "gles2_c_lib.cc", + "gles2_c_lib_autogen.h", + "gles2_c_lib_export.h", + "gles2_lib.h", + "gles2_lib.cc", +] + +gles2_implementation_source_files = [ + "buffer_tracker.cc", + "buffer_tracker.h", + "client_context_state.h", + "client_context_state.cc", + "client_context_state_autogen.h", + "client_context_state_impl_autogen.h", + "gles2_impl_export.h", + "gles2_implementation_autogen.h", + "gles2_implementation.cc", + "gles2_implementation.h", + "gles2_implementation_impl_autogen.h", + "gles2_interface.h", + "gles2_trace_implementation_autogen.h", + "gles2_trace_implementation.cc", + "gles2_trace_implementation.h", + "gles2_trace_implementation_impl_autogen.h", + "gpu_memory_buffer_factory.h", + "gpu_memory_buffer_tracker.cc", + "gpu_memory_buffer_tracker.h", + "program_info_manager.cc", + "program_info_manager.h", + "query_tracker.cc", + "query_tracker.h", + "share_group.cc", + "share_group.h", + "vertex_array_object_manager.cc", + "vertex_array_object_manager.h", +] + +# Library emulates GLES2 using command_buffers. +component("gles2_implementation") { + sources = gles2_implementation_source_files + + defines = [ "GLES2_IMPL_IMPLEMENTATION" ] + all_dependent_configs = [ "//third_party/khronos:khronos_headers" ] + + if (is_win) { + # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. + cflags = [ "/wd4267" ] # size_t to int truncation. + } + + deps = [ + ":gles2_cmd_helper", + "//base", + "//gpu/command_buffer/common", + "//ui/gfx/geometry", + "//ui/gl", + ] +} + +# Library emulates GLES2 using command_buffers. +component("gles2_implementation_client_side_arrays") { + sources = gles2_implementation_source_files + + defines = [ + "GLES2_IMPL_IMPLEMENTATION", + "GLES2_SUPPORT_CLIENT_SIDE_ARRAYS=1", + ] + all_dependent_configs = [ "//third_party/khronos:khronos_headers" ] + + if (is_win) { + # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. + cflags = [ "/wd4267" ] # size_t to int truncation. + } + + deps = [ + ":gles2_cmd_helper", + "//base", + "//gpu/command_buffer/common", + "//ui/gfx/geometry", + "//ui/gl", + ] +} + +component("gl_in_process_context") { + sources = [ + "gl_in_process_context.h", + "gl_in_process_context.cc", + "gl_in_process_context_export.h", + ] + + defines = [ "GL_IN_PROCESS_CONTEXT_IMPLEMENTATION" ] + + deps = [ + ":gles2_implementation", + "//gpu", + "//base", + "//base/third_party/dynamic_annotations", + "//ui/gfx/geometry", + "//ui/gl", + ] +} + +component("gles2_c_lib") { + sources = gles2_c_lib_source_files + defines = [ "GLES2_C_LIB_IMPLEMENTATION" ] + + if (is_win) { + # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. + cflags = [ "/wd4267" ] # size_t to int truncation. + } + + deps = [ + ":client", + "//base", + "//base/third_party/dynamic_annotations", + "//gpu/command_buffer/common", + ] +} + diff --git a/chromium/gpu/command_buffer/client/buffer_tracker.cc b/chromium/gpu/command_buffer/client/buffer_tracker.cc index 18cedb975d0..5887e52a71c 100644 --- a/chromium/gpu/command_buffer/client/buffer_tracker.cc +++ b/chromium/gpu/command_buffer/client/buffer_tracker.cc @@ -60,8 +60,30 @@ void BufferTracker::FreePendingToken(Buffer* buffer, int32 token) { buffer->shm_id_ = 0; buffer->shm_offset_ = 0; buffer->address_ = NULL; + buffer->last_usage_token_ = 0; + buffer->last_async_upload_token_ = 0; } +void BufferTracker::Unmanage(Buffer* buffer) { + buffer->size_ = 0; + buffer->shm_id_ = 0; + buffer->shm_offset_ = 0; + buffer->address_ = NULL; + buffer->last_usage_token_ = 0; + buffer->last_async_upload_token_ = 0; +} + +void BufferTracker::Free(Buffer* buffer) { + if (buffer->address_) + mapped_memory_->Free(buffer->address_); + + buffer->size_ = 0; + buffer->shm_id_ = 0; + buffer->shm_offset_ = 0; + buffer->address_ = NULL; + buffer->last_usage_token_ = 0; + buffer->last_async_upload_token_ = 0; +} } // namespace gles2 } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/buffer_tracker.h b/chromium/gpu/command_buffer/client/buffer_tracker.h index 3e50364317d..33bd94b0456 100644 --- a/chromium/gpu/command_buffer/client/buffer_tracker.h +++ b/chromium/gpu/command_buffer/client/buffer_tracker.h @@ -35,7 +35,8 @@ class GLES2_IMPL_EXPORT BufferTracker { shm_offset_(shm_offset), address_(address), mapped_(false), - transfer_ready_token_(0) { + last_usage_token_(0), + last_async_upload_token_(0) { } GLenum id() const { @@ -66,12 +67,20 @@ class GLES2_IMPL_EXPORT BufferTracker { return mapped_; } - void set_transfer_ready_token(int token) { - transfer_ready_token_ = token; + void set_last_usage_token(int token) { + last_usage_token_ = token; } - uint32 transfer_ready_token() const { - return transfer_ready_token_; + int last_usage_token() const { + return last_usage_token_; + } + + void set_last_async_upload_token(uint32 async_token) { + last_async_upload_token_ = async_token; + } + + GLuint last_async_upload_token() const { + return last_async_upload_token_; } private: @@ -84,7 +93,8 @@ class GLES2_IMPL_EXPORT BufferTracker { uint32 shm_offset_; void* address_; bool mapped_; - int32 transfer_ready_token_; + int32 last_usage_token_; + GLuint last_async_upload_token_; }; BufferTracker(MappedMemoryManager* manager); @@ -96,7 +106,9 @@ class GLES2_IMPL_EXPORT BufferTracker { // Frees the block of memory associated with buffer, pending the passage // of a token. - void FreePendingToken(Buffer*, int32 token); + void FreePendingToken(Buffer* buffer, int32 token); + void Unmanage(Buffer* buffer); + void Free(Buffer* buffer); private: typedef base::hash_map<GLuint, Buffer*> BufferMap; diff --git a/chromium/gpu/command_buffer/client/buffer_tracker_unittest.cc b/chromium/gpu/command_buffer/client/buffer_tracker_unittest.cc index 51f4f944e1e..f6174c0802b 100644 --- a/chromium/gpu/command_buffer/client/buffer_tracker_unittest.cc +++ b/chromium/gpu/command_buffer/client/buffer_tracker_unittest.cc @@ -25,10 +25,11 @@ class MockClientCommandBufferImpl : public MockClientCommandBuffer { context_lost_(false) {} virtual ~MockClientCommandBufferImpl() {} - virtual Buffer CreateTransferBuffer(size_t size, int32* id) OVERRIDE { + virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, + int32* id) OVERRIDE { if (context_lost_) { *id = -1; - return gpu::Buffer(); + return NULL; } return MockClientCommandBuffer::CreateTransferBuffer(size, id); } @@ -41,6 +42,11 @@ class MockClientCommandBufferImpl : public MockClientCommandBuffer { bool context_lost_; }; +namespace { +void EmptyPoll() { +} +} + class BufferTrackerTest : public testing::Test { protected: static const int32 kNumCommandEntries = 400; @@ -52,7 +58,7 @@ class BufferTrackerTest : public testing::Test { helper_.reset(new GLES2CmdHelper(command_buffer_.get())); helper_->Initialize(kCommandBufferSizeBytes); mapped_memory_.reset(new MappedMemoryManager( - helper_.get(), MappedMemoryManager::kNoLimit)); + helper_.get(), base::Bind(&EmptyPoll), MappedMemoryManager::kNoLimit)); buffer_tracker_.reset(new BufferTracker(mapped_memory_.get())); } @@ -126,5 +132,22 @@ TEST_F(BufferTrackerTest, LostContext) { buffer_tracker_->RemoveBuffer(kId); } +TEST_F(BufferTrackerTest, Unmanage) { + const GLuint kId = 123; + const GLsizeiptr size = 64; + + BufferTracker::Buffer* buffer = buffer_tracker_->CreateBuffer(kId, size); + ASSERT_TRUE(buffer != NULL); + EXPECT_EQ(mapped_memory_->bytes_in_use(), static_cast<size_t>(size)); + + void* mem = buffer->address(); + buffer_tracker_->Unmanage(buffer); + buffer_tracker_->RemoveBuffer(kId); + EXPECT_EQ(mapped_memory_->bytes_in_use(), static_cast<size_t>(size)); + + mapped_memory_->Free(mem); + EXPECT_EQ(mapped_memory_->bytes_in_use(), static_cast<size_t>(0)); +} + } // namespace gles2 } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/client_context_state_autogen.h b/chromium/gpu/command_buffer/client/client_context_state_autogen.h index 1714b2b5ce9..72a4f72ed03 100644 --- a/chromium/gpu/command_buffer/client/client_context_state_autogen.h +++ b/chromium/gpu/command_buffer/client/client_context_state_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // It is included by client_context_state.h @@ -24,4 +26,3 @@ struct EnableFlags { }; #endif // GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/client_context_state_impl_autogen.h b/chromium/gpu/command_buffer/client/client_context_state_impl_autogen.h index 150816d04e3..cff14f7a82c 100644 --- a/chromium/gpu/command_buffer/client/client_context_state_impl_autogen.h +++ b/chromium/gpu/command_buffer/client/client_context_state_impl_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // It is included by client_context_state.cc @@ -22,71 +24,70 @@ ClientContextState::EnableFlags::EnableFlags() stencil_test(false) { } - -bool ClientContextState::SetCapabilityState( - GLenum cap, bool enabled, bool* changed) { +bool ClientContextState::SetCapabilityState(GLenum cap, + bool enabled, + bool* changed) { *changed = false; switch (cap) { case GL_BLEND: if (enable_flags.blend != enabled) { - *changed = true; - enable_flags.blend = enabled; + *changed = true; + enable_flags.blend = enabled; } return true; case GL_CULL_FACE: if (enable_flags.cull_face != enabled) { - *changed = true; - enable_flags.cull_face = enabled; + *changed = true; + enable_flags.cull_face = enabled; } return true; case GL_DEPTH_TEST: if (enable_flags.depth_test != enabled) { - *changed = true; - enable_flags.depth_test = enabled; + *changed = true; + enable_flags.depth_test = enabled; } return true; case GL_DITHER: if (enable_flags.dither != enabled) { - *changed = true; - enable_flags.dither = enabled; + *changed = true; + enable_flags.dither = enabled; } return true; case GL_POLYGON_OFFSET_FILL: if (enable_flags.polygon_offset_fill != enabled) { - *changed = true; - enable_flags.polygon_offset_fill = enabled; + *changed = true; + enable_flags.polygon_offset_fill = enabled; } return true; case GL_SAMPLE_ALPHA_TO_COVERAGE: if (enable_flags.sample_alpha_to_coverage != enabled) { - *changed = true; - enable_flags.sample_alpha_to_coverage = enabled; + *changed = true; + enable_flags.sample_alpha_to_coverage = enabled; } return true; case GL_SAMPLE_COVERAGE: if (enable_flags.sample_coverage != enabled) { - *changed = true; - enable_flags.sample_coverage = enabled; + *changed = true; + enable_flags.sample_coverage = enabled; } return true; case GL_SCISSOR_TEST: if (enable_flags.scissor_test != enabled) { - *changed = true; - enable_flags.scissor_test = enabled; + *changed = true; + enable_flags.scissor_test = enabled; } return true; case GL_STENCIL_TEST: if (enable_flags.stencil_test != enabled) { - *changed = true; - enable_flags.stencil_test = enabled; + *changed = true; + enable_flags.stencil_test = enabled; } return true; default: return false; } } -bool ClientContextState::GetEnabled( - GLenum cap, bool* enabled) const { +bool ClientContextState::GetEnabled(GLenum cap, bool* enabled) const { switch (cap) { case GL_BLEND: *enabled = enable_flags.blend; @@ -120,4 +121,3 @@ bool ClientContextState::GetEnabled( } } #endif // GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_IMPL_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/client_test_helper.cc b/chromium/gpu/command_buffer/client/client_test_helper.cc index db191ce5eba..8c633efebe1 100644 --- a/chromium/gpu/command_buffer/client/client_test_helper.cc +++ b/chromium/gpu/command_buffer/client/client_test_helper.cc @@ -15,6 +15,9 @@ using ::testing::Invoke; namespace gpu { +MockCommandBufferBase::MockCommandBufferBase() { +} + MockCommandBufferBase::~MockCommandBufferBase() { } @@ -22,10 +25,6 @@ bool MockCommandBufferBase::Initialize() { return true; } -CommandBuffer::State MockCommandBufferBase::GetState() { - return state_; -} - CommandBuffer::State MockCommandBufferBase::GetLastState() { return state_; } @@ -38,39 +37,42 @@ void MockCommandBufferBase::SetGetOffset(int32 get_offset) { state_.get_offset = get_offset; } -CommandBuffer::State MockCommandBufferBase::FlushSync( - int32 put_offset, int32 last_known_get) { - state_.put_offset = put_offset; - state_.get_offset = put_offset; +void MockCommandBufferBase::WaitForTokenInRange(int32 start, int32 end) {} + +void MockCommandBufferBase::WaitForGetOffsetInRange(int32 start, int32 end) { + state_.get_offset = state_.put_offset; OnFlush(); - return state_; } void MockCommandBufferBase::SetGetBuffer(int transfer_buffer_id) { ring_buffer_buffer_ = GetTransferBuffer(transfer_buffer_id); - ring_buffer_ = static_cast<CommandBufferEntry*>(ring_buffer_buffer_.ptr); - state_.num_entries = ring_buffer_buffer_.size / sizeof(ring_buffer_[0]); + ring_buffer_ = + static_cast<CommandBufferEntry*>(ring_buffer_buffer_->memory()); + state_.num_entries = ring_buffer_buffer_->size() / sizeof(ring_buffer_[0]); state_.token = 10000; // All token checks in the tests should pass. } // Get's the Id of the next transfer buffer that will be returned // by CreateTransferBuffer. This is useful for testing expected ids. int32 MockCommandBufferBase::GetNextFreeTransferBufferId() { - for (size_t ii = 0; ii < arraysize(transfer_buffers_); ++ii) { - if (!transfer_buffers_[ii].get()) { + for (size_t ii = 0; ii < arraysize(transfer_buffer_buffers_); ++ii) { + if (!transfer_buffer_buffers_[ii].get()) { return kTransferBufferBaseId + ii; } } return -1; } -Buffer MockCommandBufferBase::CreateTransferBuffer(size_t size, int32* id) { +scoped_refptr<gpu::Buffer> MockCommandBufferBase::CreateTransferBuffer( + size_t size, + int32* id) { *id = GetNextFreeTransferBufferId(); if (*id >= 0) { int32 ndx = *id - kTransferBufferBaseId; - transfer_buffers_[ndx].reset(new int8[size]); - transfer_buffer_buffers_[ndx].ptr = transfer_buffers_[ndx].get(); - transfer_buffer_buffers_[ndx].size = size; + scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); + shared_memory->CreateAndMapAnonymous(size); + transfer_buffer_buffers_[ndx] = + MakeBufferFromSharedMemory(shared_memory.Pass(), size); } return GetTransferBuffer(*id); } @@ -79,11 +81,10 @@ void MockCommandBufferBase::DestroyTransferBufferHelper(int32 id) { DCHECK_GE(id, kTransferBufferBaseId); DCHECK_LT(id, kTransferBufferBaseId + kMaxTransferBuffers); id -= kTransferBufferBaseId; - transfer_buffers_[id].reset(); - transfer_buffer_buffers_[id] = Buffer(); + transfer_buffer_buffers_[id] = NULL; } -Buffer MockCommandBufferBase::GetTransferBuffer(int32 id) { +scoped_refptr<Buffer> MockCommandBufferBase::GetTransferBuffer(int32 id) { DCHECK_GE(id, kTransferBufferBaseId); DCHECK_LT(id, kTransferBufferBaseId + kMaxTransferBuffers); return transfer_buffer_buffers_[id - kTransferBufferBaseId]; diff --git a/chromium/gpu/command_buffer/client/client_test_helper.h b/chromium/gpu/command_buffer/client/client_test_helper.h index e071f5a7482..f2c2e6b7ce5 100644 --- a/chromium/gpu/command_buffer/client/client_test_helper.h +++ b/chromium/gpu/command_buffer/client/client_test_helper.h @@ -9,10 +9,10 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "gpu/command_buffer/client/gpu_control.h" #include "gpu/command_buffer/common/cmd_buffer_common.h" -#include "gpu/command_buffer/common/command_buffer.h" -#include "gpu/command_buffer/common/gpu_control.h" #include "gpu/command_buffer/common/gpu_memory_allocation.h" +#include "gpu/command_buffer/service/command_buffer_service.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -20,23 +20,24 @@ namespace gpu { class CommandBufferHelper; -class MockCommandBufferBase : public CommandBuffer { +class MockCommandBufferBase : public CommandBufferServiceBase { public: static const int32 kTransferBufferBaseId = 0x123; static const int32 kMaxTransferBuffers = 6; - MockCommandBufferBase() { } + MockCommandBufferBase(); virtual ~MockCommandBufferBase(); virtual bool Initialize() OVERRIDE; - virtual State GetState() OVERRIDE; virtual State GetLastState() OVERRIDE; virtual int32 GetLastToken() OVERRIDE; - virtual State FlushSync(int32 put_offset, int32 last_known_get) OVERRIDE; + virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; + virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; virtual void SetGetBuffer(int transfer_buffer_id) OVERRIDE; virtual void SetGetOffset(int32 get_offset) OVERRIDE; - virtual Buffer CreateTransferBuffer(size_t size, int32* id) OVERRIDE; - virtual Buffer GetTransferBuffer(int32 id) OVERRIDE; + virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, + int32* id) OVERRIDE; + virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) OVERRIDE; virtual void SetToken(int32 token) OVERRIDE; virtual void SetParseError(error::Error error) OVERRIDE; virtual void SetContextLostReason(error::ContextLostReason reason) OVERRIDE; @@ -51,10 +52,9 @@ class MockCommandBufferBase : public CommandBuffer { virtual void OnFlush() = 0; private: - scoped_ptr<int8[]> transfer_buffers_[kMaxTransferBuffers]; - Buffer transfer_buffer_buffers_[kMaxTransferBuffers]; + scoped_refptr<Buffer> transfer_buffer_buffers_[kMaxTransferBuffers]; CommandBufferEntry* ring_buffer_; - Buffer ring_buffer_buffer_; + scoped_refptr<Buffer> ring_buffer_buffer_; State state_; }; @@ -88,14 +88,13 @@ class MockClientGpuControl : public GpuControl { virtual ~MockClientGpuControl(); MOCK_METHOD0(GetCapabilities, Capabilities()); - MOCK_METHOD4(CreateGpuMemoryBuffer, + MOCK_METHOD5(CreateGpuMemoryBuffer, gfx::GpuMemoryBuffer*(size_t width, size_t height, unsigned internalformat, + unsigned usage, int32* id)); MOCK_METHOD1(DestroyGpuMemoryBuffer, void(int32 id)); - MOCK_METHOD2(GenerateMailboxNames, bool(unsigned num, - std::vector<gpu::Mailbox>* names)); MOCK_METHOD0(InsertSyncPoint, uint32()); MOCK_METHOD2(SignalSyncPoint, void(uint32 id, const base::Closure& callback)); @@ -103,8 +102,7 @@ class MockClientGpuControl : public GpuControl { MOCK_METHOD2(SignalQuery, void(uint32 query, const base::Closure& callback)); MOCK_METHOD1(SetSurfaceVisible, void(bool visible)); - MOCK_METHOD1(SendManagedMemoryStats, - void(const ManagedMemoryStats& stats)); + MOCK_METHOD1(CreateStreamTexture, uint32(uint32)); private: DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl); diff --git a/chromium/gpu/command_buffer/client/cmd_buffer_helper.cc b/chromium/gpu/command_buffer/client/cmd_buffer_helper.cc index 11219ede664..b50527a8dce 100644 --- a/chromium/gpu/command_buffer/client/cmd_buffer_helper.cc +++ b/chromium/gpu/command_buffer/client/cmd_buffer_helper.cc @@ -12,30 +12,29 @@ namespace gpu { -const int kCommandsPerFlushCheck = 100; - -#if !defined(OS_ANDROID) -const double kFlushDelay = 1.0 / (5.0 * 60.0); -#endif - CommandBufferHelper::CommandBufferHelper(CommandBuffer* command_buffer) : command_buffer_(command_buffer), ring_buffer_id_(-1), ring_buffer_size_(0), entries_(NULL), total_entry_count_(0), + immediate_entry_count_(0), token_(0), put_(0), last_put_sent_(0), +#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) commands_issued_(0), +#endif usable_(true), context_lost_(false), flush_automatically_(true), - last_flush_time_(0) { + last_flush_time_(0), + flush_generation_(0) { } void CommandBufferHelper::SetAutomaticFlushes(bool enabled) { flush_automatically_ = enabled; + CalcImmediateEntries(0); } bool CommandBufferHelper::IsContextLost() { @@ -45,6 +44,47 @@ bool CommandBufferHelper::IsContextLost() { return context_lost_; } +void CommandBufferHelper::CalcImmediateEntries(int waiting_count) { + DCHECK_GE(waiting_count, 0); + + // Check if usable & allocated. + if (!usable() || !HaveRingBuffer()) { + immediate_entry_count_ = 0; + return; + } + + // Get maximum safe contiguous entries. + const int32 curr_get = get_offset(); + if (curr_get > put_) { + immediate_entry_count_ = curr_get - put_ - 1; + } else { + immediate_entry_count_ = + total_entry_count_ - put_ - (curr_get == 0 ? 1 : 0); + } + + // Limit entry count to force early flushing. + if (flush_automatically_) { + int32 limit = + total_entry_count_ / + ((curr_get == last_put_sent_) ? kAutoFlushSmall : kAutoFlushBig); + + int32 pending = + (put_ + total_entry_count_ - last_put_sent_) % total_entry_count_; + + if (pending > 0 && pending >= limit) { + // Time to force flush. + immediate_entry_count_ = 0; + } else { + // Limit remaining entries, but not lower than waiting_count entries to + // prevent deadlock when command size is greater than the flush limit. + limit -= pending; + limit = limit < waiting_count ? waiting_count : limit; + immediate_entry_count_ = + immediate_entry_count_ > limit ? limit : immediate_entry_count_; + } + } +} + bool CommandBufferHelper::AllocateRingBuffer() { if (!usable()) { return false; @@ -55,7 +95,8 @@ bool CommandBufferHelper::AllocateRingBuffer() { } int32 id = -1; - Buffer buffer = command_buffer_->CreateTransferBuffer(ring_buffer_size_, &id); + scoped_refptr<Buffer> buffer = + command_buffer_->CreateTransferBuffer(ring_buffer_size_, &id); if (id < 0) { ClearUsable(); return false; @@ -64,20 +105,12 @@ bool CommandBufferHelper::AllocateRingBuffer() { ring_buffer_ = buffer; ring_buffer_id_ = id; command_buffer_->SetGetBuffer(id); - - // TODO(gman): Do we really need to call GetState here? We know get & put = 0 - // Also do we need to check state.num_entries? - CommandBuffer::State state = command_buffer_->GetState(); - entries_ = static_cast<CommandBufferEntry*>(ring_buffer_.ptr); - int32 num_ring_buffer_entries = - ring_buffer_size_ / sizeof(CommandBufferEntry); - if (num_ring_buffer_entries > state.num_entries) { - ClearUsable(); - return false; - } - - total_entry_count_ = num_ring_buffer_entries; - put_ = state.put_offset; + entries_ = static_cast<CommandBufferEntry*>(ring_buffer_->memory()); + total_entry_count_ = ring_buffer_size_ / sizeof(CommandBufferEntry); + // Call to SetGetBuffer(id) above resets get and put offsets to 0. + // No need to query it through IPC. + put_ = 0; + CalcImmediateEntries(0); return true; } @@ -85,6 +118,7 @@ void CommandBufferHelper::FreeResources() { if (HaveRingBuffer()) { command_buffer_->DestroyTransferBuffer(ring_buffer_id_); ring_buffer_id_ = -1; + CalcImmediateEntries(0); } } @@ -103,24 +137,36 @@ CommandBufferHelper::~CommandBufferHelper() { FreeResources(); } -bool CommandBufferHelper::FlushSync() { +bool CommandBufferHelper::WaitForGetOffsetInRange(int32 start, int32 end) { if (!usable()) { return false; } - last_flush_time_ = clock(); - last_put_sent_ = put_; - CommandBuffer::State state = command_buffer_->FlushSync(put_, get_offset()); - return state.error == error::kNoError; + command_buffer_->WaitForGetOffsetInRange(start, end); + return command_buffer_->GetLastError() == gpu::error::kNoError; } void CommandBufferHelper::Flush() { + // Wrap put_ before flush. + if (put_ == total_entry_count_) + put_ = 0; + if (usable() && last_put_sent_ != put_) { last_flush_time_ = clock(); last_put_sent_ = put_; command_buffer_->Flush(put_); + ++flush_generation_; + CalcImmediateEntries(0); } } +#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) +void CommandBufferHelper::PeriodicFlushCheck() { + clock_t current_time = clock(); + if (current_time - last_flush_time_ > kPeriodicFlushDelay * CLOCKS_PER_SEC) + Flush(); +} +#endif + // Calls Flush() and then waits until the buffer is empty. Break early if the // error is set. bool CommandBufferHelper::Finish() { @@ -133,12 +179,12 @@ bool CommandBufferHelper::Finish() { return true; } DCHECK(HaveRingBuffer()); - do { - // Do not loop forever if the flush fails, meaning the command buffer reader - // has shutdown. - if (!FlushSync()) - return false; - } while (put_ != get_offset()); + Flush(); + if (!WaitForGetOffsetInRange(put_, put_)) + return false; + DCHECK_EQ(get_offset(), put_); + + CalcImmediateEntries(0); return true; } @@ -179,16 +225,10 @@ void CommandBufferHelper::WaitForToken(int32 token) { if (token < 0) return; if (token > token_) return; // we wrapped - while (last_token_read() < token) { - if (get_offset() == 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 (!FlushSync()) - return; - } + if (last_token_read() >= token) + return; + Flush(); + command_buffer_->WaitForTokenInRange(token, token_); } // Waits for available entries, basically waiting until get >= put + count + 1. @@ -209,14 +249,15 @@ void CommandBufferHelper::WaitForAvailableEntries(int32 count) { // 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_); - if (get_offset() > put_ || get_offset() == 0) { + int32 curr_get = get_offset(); + if (curr_get > put_ || curr_get == 0) { TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries"); - while (get_offset() > put_ || get_offset() == 0) { - // Do not loop forever if the flush fails, meaning the command buffer - // reader has shutdown. - if (!FlushSync()) - return; - } + Flush(); + if (!WaitForGetOffsetInRange(1, put_)) + return; + curr_get = get_offset(); + DCHECK_LE(curr_get, put_); + DCHECK_NE(0, curr_get); } // Insert Noops to fill out the buffer. int32 num_entries = total_entry_count_ - put_; @@ -228,52 +269,23 @@ void CommandBufferHelper::WaitForAvailableEntries(int32 count) { } put_ = 0; } - if (AvailableEntries() < count) { - TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries1"); - while (AvailableEntries() < count) { - // Do not loop forever if the flush fails, meaning the command buffer - // reader has shutdown. - if (!FlushSync()) + + // Try to get 'count' entries without flushing. + CalcImmediateEntries(count); + if (immediate_entry_count_ < count) { + // Try again with a shallow Flush(). + Flush(); + CalcImmediateEntries(count); + if (immediate_entry_count_ < count) { + // Buffer is full. Need to wait for entries. + TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForAvailableEntries1"); + if (!WaitForGetOffsetInRange(put_ + count + 1, put_)) return; + CalcImmediateEntries(count); + DCHECK_GE(immediate_entry_count_, count); } } - // Force a flush if the buffer is getting half full, or even earlier if the - // reader is known to be idle. - int32 pending = - (put_ + total_entry_count_ - last_put_sent_) % total_entry_count_; - int32 limit = total_entry_count_ / - ((get_offset() == last_put_sent_) ? 16 : 2); - if (pending > limit) { - Flush(); - } else if (flush_automatically_ && - (commands_issued_ % kCommandsPerFlushCheck == 0)) { -#if !defined(OS_ANDROID) - // Allow this command buffer to be pre-empted by another if a "reasonable" - // amount of work has been done. On highend machines, this reduces the - // latency of GPU commands. However, on Android, this can cause the - // kernel to thrash between generating GPU commands and executing them. - clock_t current_time = clock(); - if (current_time - last_flush_time_ > kFlushDelay * CLOCKS_PER_SEC) - Flush(); -#endif - } } -CommandBufferEntry* CommandBufferHelper::GetSpace(uint32 entries) { - AllocateRingBuffer(); - if (!usable()) { - return NULL; - } - DCHECK(HaveRingBuffer()); - ++commands_issued_; - WaitForAvailableEntries(entries); - CommandBufferEntry* space = &entries_[put_]; - put_ += entries; - DCHECK_LE(put_, total_entry_count_); - if (put_ == total_entry_count_) { - put_ = 0; - } - return space; -} } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/cmd_buffer_helper.h b/chromium/gpu/command_buffer/client/cmd_buffer_helper.h index a50dc7bfe4e..86d3c3bf6c1 100644 --- a/chromium/gpu/command_buffer/client/cmd_buffer_helper.h +++ b/chromium/gpu/command_buffer/client/cmd_buffer_helper.h @@ -17,6 +17,15 @@ namespace gpu { +#if !defined(OS_ANDROID) +#define CMD_HELPER_PERIODIC_FLUSH_CHECK +const int kCommandsPerFlushCheck = 100; +const float kPeriodicFlushDelay = 1.0f / (5.0f * 60.0f); +#endif + +const int kAutoFlushSmall = 16; // 1/16 of the buffer +const int kAutoFlushBig = 2; // 1/2 of the 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 @@ -55,14 +64,6 @@ class GPU_EXPORT CommandBufferHelper { // returns, the command buffer service is aware of all pending commands. void Flush(); - // 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 FlushSync(); - // Waits until all the commands have been executed. Returns whether it // was successful. The function will fail if the command buffer service has // disconnected. @@ -83,6 +84,15 @@ class GPU_EXPORT CommandBufferHelper { // shutdown. int32 InsertToken(); + // Returns true if the token has passed. + // Parameters: + // the value of the token to check whether it has passed + bool HasTokenPassed(int32 token) const { + if (token > token_) + return true; // we wrapped + return last_token_read() >= token; + } + // 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. @@ -92,34 +102,78 @@ class GPU_EXPORT CommandBufferHelper { // Called prior to each command being issued. Waits for a certain amount of // space to be available. Returns address of space. - CommandBufferEntry* GetSpace(uint32 entries); + void* GetSpace(int32 entries) { +#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) + // Allow this command buffer to be pre-empted by another if a "reasonable" + // amount of work has been done. On highend machines, this reduces the + // latency of GPU commands. However, on Android, this can cause the + // kernel to thrash between generating GPU commands and executing them. + ++commands_issued_; + if (flush_automatically_ && + (commands_issued_ % kCommandsPerFlushCheck == 0)) { + PeriodicFlushCheck(); + } +#endif + + // Test for immediate entries. + if (entries > immediate_entry_count_) { + WaitForAvailableEntries(entries); + if (entries > immediate_entry_count_) + return NULL; + } + + DCHECK_LE(entries, immediate_entry_count_); + + // Allocate space and advance put_. + CommandBufferEntry* space = &entries_[put_]; + put_ += entries; + immediate_entry_count_ -= entries; + + DCHECK_LE(put_, total_entry_count_); + return space; + } + + template <typename T> + void ForceNullCheck(T* data) { +#if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) + // 64-bit MSVC's alias analysis was determining that the command buffer + // entry couldn't be NULL, so it optimized out the NULL check. + // Dereferencing the same datatype through a volatile pointer seems to + // prevent that from happening. http://crbug.com/361936 + if (data) + static_cast<volatile T*>(data)->header; +#endif + } // 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); + int32 space_needed = ComputeNumEntries(sizeof(T)); + T* data = static_cast<T*>(GetSpace(space_needed)); + ForceNullCheck(data); + return 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); + int32 space_needed = ComputeNumEntries(sizeof(T) + data_space); + T* data = static_cast<T*>(GetSpace(space_needed)); + ForceNullCheck(data); + return 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); + int32 space_needed = ComputeNumEntries(total_space); + T* data = static_cast<T*>(GetSpace(space_needed)); + ForceNullCheck(data); + return data; } int32 last_token_read() const { @@ -214,9 +268,9 @@ class GPU_EXPORT CommandBufferHelper { return command_buffer_; } - Buffer get_ring_buffer() const { - return ring_buffer_; - } + scoped_refptr<Buffer> get_ring_buffer() const { return ring_buffer_; } + + uint32 flush_generation() const { return flush_generation_; } void FreeRingBuffer(); @@ -230,30 +284,43 @@ class GPU_EXPORT CommandBufferHelper { void ClearUsable() { usable_ = false; + CalcImmediateEntries(0); } 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_offset() - put_ - 1 + total_entry_count_) % total_entry_count_; } + void CalcImmediateEntries(int waiting_count); bool AllocateRingBuffer(); void FreeResources(); + // Waits for the get offset to be in a specific range, inclusive. Returns + // false if there was an error. + bool WaitForGetOffsetInRange(int32 start, int32 end); + +#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) + // Calls Flush if automatic flush conditions are met. + void PeriodicFlushCheck(); +#endif + CommandBuffer* command_buffer_; int32 ring_buffer_id_; int32 ring_buffer_size_; - Buffer ring_buffer_; + scoped_refptr<gpu::Buffer> ring_buffer_; CommandBufferEntry* entries_; int32 total_entry_count_; // the total number of entries + int32 immediate_entry_count_; int32 token_; int32 put_; int32 last_put_sent_; + +#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) int commands_issued_; +#endif + bool usable_; bool context_lost_; bool flush_automatically_; @@ -261,6 +328,10 @@ class GPU_EXPORT CommandBufferHelper { // Using C runtime instead of base because this file cannot depend on base. clock_t last_flush_time_; + // Incremented every time the helper flushes the command buffer. + // Can be used to track when prior commands have been flushed. + uint32 flush_generation_; + friend class CommandBufferHelperTest; DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); }; diff --git a/chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc index bd0e86e3f45..c2d1361555a 100644 --- a/chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc +++ b/chromium/gpu/command_buffer/client/cmd_buffer_helper_test.cc @@ -4,8 +4,11 @@ // Tests for the Command Buffer Helper. +#include <list> + #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/memory/linked_ptr.h" #include "base/message_loop/message_loop.h" #include "gpu/command_buffer/client/cmd_buffer_helper.h" #include "gpu/command_buffer/service/command_buffer_service.h" @@ -28,11 +31,54 @@ using testing::DoAll; using testing::Invoke; using testing::_; -const int32 kTotalNumCommandEntries = 10; +const int32 kTotalNumCommandEntries = 32; const int32 kCommandBufferSizeBytes = kTotalNumCommandEntries * sizeof(CommandBufferEntry); const int32 kUnusedCommandId = 5; // we use 0 and 2 currently. +// Override CommandBufferService::Flush() to lock flushing and simulate +// the buffer becoming full in asynchronous mode. +class CommandBufferServiceLocked : public CommandBufferService { + public: + explicit CommandBufferServiceLocked( + TransferBufferManagerInterface* transfer_buffer_manager) + : CommandBufferService(transfer_buffer_manager), + flush_locked_(false), + last_flush_(-1), + flush_count_(0) {} + virtual ~CommandBufferServiceLocked() {} + + virtual void Flush(int32 put_offset) OVERRIDE { + flush_count_++; + if (!flush_locked_) { + last_flush_ = -1; + CommandBufferService::Flush(put_offset); + } else { + last_flush_ = put_offset; + } + } + + void LockFlush() { flush_locked_ = true; } + + void UnlockFlush() { flush_locked_ = false; } + + int FlushCount() { return flush_count_; } + + virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE { + if (last_flush_ != -1) { + CommandBufferService::Flush(last_flush_); + last_flush_ = -1; + } + CommandBufferService::WaitForGetOffsetInRange(start, end); + } + + private: + bool flush_locked_; + int last_flush_; + int flush_count_; + DISALLOW_COPY_AND_ASSIGN(CommandBufferServiceLocked); +}; + // 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). @@ -51,7 +97,7 @@ class CommandBufferHelperTest : public testing::Test { EXPECT_TRUE(manager->Initialize()); } command_buffer_.reset( - new CommandBufferService(transfer_buffer_manager_.get())); + new CommandBufferServiceLocked(transfer_buffer_manager_.get())); EXPECT_TRUE(command_buffer_->Initialize()); gpu_scheduler_.reset(new GpuScheduler( @@ -65,17 +111,22 @@ class CommandBufferHelperTest : public testing::Test { helper_.reset(new CommandBufferHelper(command_buffer_.get())); helper_->Initialize(kCommandBufferSizeBytes); + + test_command_next_id_ = kUnusedCommandId; } virtual void TearDown() { // If the GpuScheduler posts any tasks, this forces them to run. base::MessageLoop::current()->RunUntilIdle(); + test_command_args_.clear(); } const CommandParser* GetParser() const { return gpu_scheduler_->parser(); } + int32 ImmediateEntryCount() const { return helper_->immediate_entry_count_; } + // Adds a command to the buffer through the helper, while adding it as an // expected call on the API mock. void AddCommandWithExpect(error::Error _return, @@ -85,7 +136,8 @@ class CommandBufferHelperTest : public testing::Test { CommandHeader header; header.size = arg_count + 1; header.command = command; - CommandBufferEntry* cmds = helper_->GetSpace(arg_count + 1); + CommandBufferEntry* cmds = + static_cast<CommandBufferEntry*>(helper_->GetSpace(arg_count + 1)); CommandBufferOffset put = 0; cmds[put++].value_header = header; for (int ii = 0; ii < arg_count; ++ii) { @@ -98,6 +150,68 @@ class CommandBufferHelperTest : public testing::Test { .WillOnce(Return(_return)); } + void AddUniqueCommandWithExpect(error::Error _return, int cmd_size) { + EXPECT_GE(cmd_size, 1); + EXPECT_LT(cmd_size, kTotalNumCommandEntries); + int arg_count = cmd_size - 1; + + // Allocate array for args. + linked_ptr<std::vector<CommandBufferEntry> > args_ptr( + new std::vector<CommandBufferEntry>(arg_count ? arg_count : 1)); + + for (int32 ii = 0; ii < arg_count; ++ii) { + (*args_ptr)[ii].value_uint32 = 0xF00DF00D + ii; + } + + // Add command and save args in test_command_args_ until the test completes. + AddCommandWithExpect( + _return, test_command_next_id_++, arg_count, &(*args_ptr)[0]); + test_command_args_.insert(test_command_args_.end(), args_ptr); + } + + void TestCommandWrappingFull(int32 cmd_size, int32 start_commands) { + const int32 num_args = cmd_size - 1; + EXPECT_EQ(kTotalNumCommandEntries % cmd_size, 0); + + std::vector<CommandBufferEntry> args(num_args); + for (int32 ii = 0; ii < num_args; ++ii) { + args[ii].value_uint32 = ii + 1; + } + + // Initially insert commands up to start_commands and Finish(). + for (int32 ii = 0; ii < start_commands; ++ii) { + AddCommandWithExpect( + error::kNoError, ii + kUnusedCommandId, num_args, &args[0]); + } + helper_->Finish(); + + EXPECT_EQ(GetParser()->put(), + (start_commands * cmd_size) % kTotalNumCommandEntries); + EXPECT_EQ(GetParser()->get(), + (start_commands * cmd_size) % kTotalNumCommandEntries); + + // Lock flushing to force the buffer to get full. + command_buffer_->LockFlush(); + + // Add enough commands to over fill the buffer. + for (int32 ii = 0; ii < kTotalNumCommandEntries / cmd_size + 2; ++ii) { + AddCommandWithExpect(error::kNoError, + start_commands + ii + kUnusedCommandId, + num_args, + &args[0]); + } + + // Flush all commands. + command_buffer_->UnlockFlush(); + helper_->Finish(); + + // Check that the commands did happen. + Mock::VerifyAndClearExpectations(api_mock_.get()); + + // Check the error status. + EXPECT_EQ(error::kNoError, GetError()); + } + // Checks that the buffer from put to put+size is free in the parser. void CheckFreeSpace(CommandBufferOffset put, unsigned int size) { CommandBufferOffset parser_put = GetParser()->put(); @@ -122,15 +236,21 @@ class CommandBufferHelperTest : public testing::Test { } int32 GetGetOffset() { - return command_buffer_->GetState().get_offset; + return command_buffer_->GetLastState().get_offset; } int32 GetPutOffset() { - return command_buffer_->GetState().put_offset; + return command_buffer_->GetLastState().put_offset; } + int32 GetHelperGetOffset() { return helper_->get_offset(); } + + int32 GetHelperPutOffset() { return helper_->put_; } + + uint32 GetHelperFlushGeneration() { return helper_->flush_generation(); } + error::Error GetError() { - return command_buffer_->GetState().error; + return command_buffer_->GetLastState().error; } CommandBufferOffset get_helper_put() { return helper_->put_; } @@ -141,12 +261,176 @@ class CommandBufferHelperTest : public testing::Test { base::MessageLoop message_loop_; scoped_ptr<AsyncAPIMock> api_mock_; scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; - scoped_ptr<CommandBufferService> command_buffer_; + scoped_ptr<CommandBufferServiceLocked> command_buffer_; scoped_ptr<GpuScheduler> gpu_scheduler_; scoped_ptr<CommandBufferHelper> helper_; + std::list<linked_ptr<std::vector<CommandBufferEntry> > > test_command_args_; + unsigned int test_command_next_id_; Sequence sequence_; }; +// Checks immediate_entry_count_ changes based on 'usable' state. +TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesNotUsable) { + // Auto flushing mode is tested separately. + helper_->SetAutomaticFlushes(false); + EXPECT_EQ(helper_->usable(), true); + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries - 1); + helper_->ClearUsable(); + EXPECT_EQ(ImmediateEntryCount(), 0); +} + +// Checks immediate_entry_count_ changes based on RingBuffer state. +TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesNoRingBuffer) { + helper_->SetAutomaticFlushes(false); + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries - 1); + helper_->FreeRingBuffer(); + EXPECT_EQ(ImmediateEntryCount(), 0); +} + +// Checks immediate_entry_count_ calc when Put >= Get and Get == 0. +TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesGetAtZero) { + // No internal auto flushing. + helper_->SetAutomaticFlushes(false); + command_buffer_->LockFlush(); + + // Start at Get = Put = 0. + EXPECT_EQ(GetHelperPutOffset(), 0); + EXPECT_EQ(GetHelperGetOffset(), 0); + + // Immediate count should be 1 less than the end of the buffer. + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries - 1); + AddUniqueCommandWithExpect(error::kNoError, 2); + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries - 3); + + helper_->Finish(); + + // Check that the commands did happen. + Mock::VerifyAndClearExpectations(api_mock_.get()); + + // Check the error status. + EXPECT_EQ(error::kNoError, GetError()); +} + +// Checks immediate_entry_count_ calc when Put >= Get and Get > 0. +TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesGetInMiddle) { + // No internal auto flushing. + helper_->SetAutomaticFlushes(false); + command_buffer_->LockFlush(); + + // Move to Get = Put = 2. + AddUniqueCommandWithExpect(error::kNoError, 2); + helper_->Finish(); + EXPECT_EQ(GetHelperPutOffset(), 2); + EXPECT_EQ(GetHelperGetOffset(), 2); + + // Immediate count should be up to the end of the buffer. + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries - 2); + AddUniqueCommandWithExpect(error::kNoError, 2); + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries - 4); + + helper_->Finish(); + + // Check that the commands did happen. + Mock::VerifyAndClearExpectations(api_mock_.get()); + + // Check the error status. + EXPECT_EQ(error::kNoError, GetError()); +} + +// Checks immediate_entry_count_ calc when Put < Get. +TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesGetBeforePut) { + // Move to Get = kTotalNumCommandEntries / 4, Put = 0. + const int kInitGetOffset = kTotalNumCommandEntries / 4; + helper_->SetAutomaticFlushes(false); + command_buffer_->LockFlush(); + AddUniqueCommandWithExpect(error::kNoError, kInitGetOffset); + helper_->Finish(); + AddUniqueCommandWithExpect(error::kNoError, + kTotalNumCommandEntries - kInitGetOffset); + + // Flush instead of Finish will let Put wrap without the command buffer + // immediately processing the data between Get and Put. + helper_->Flush(); + + EXPECT_EQ(GetHelperGetOffset(), kInitGetOffset); + EXPECT_EQ(GetHelperPutOffset(), 0); + + // Immediate count should be up to Get - 1. + EXPECT_EQ(ImmediateEntryCount(), kInitGetOffset - 1); + AddUniqueCommandWithExpect(error::kNoError, 2); + EXPECT_EQ(ImmediateEntryCount(), kInitGetOffset - 3); + + helper_->Finish(); + // Check that the commands did happen. + Mock::VerifyAndClearExpectations(api_mock_.get()); + + // Check the error status. + EXPECT_EQ(error::kNoError, GetError()); +} + +// Checks immediate_entry_count_ calc when automatic flushing is enabled. +TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesAutoFlushing) { + command_buffer_->LockFlush(); + + // Start at Get = Put = 0. + EXPECT_EQ(GetHelperPutOffset(), 0); + EXPECT_EQ(GetHelperGetOffset(), 0); + + // Without auto flushes, up to kTotalNumCommandEntries - 1 is available. + helper_->SetAutomaticFlushes(false); + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries - 1); + + // With auto flushes, and Get == Last Put, + // up to kTotalNumCommandEntries / kAutoFlushSmall is available. + helper_->SetAutomaticFlushes(true); + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries / kAutoFlushSmall); + + // With auto flushes, and Get != Last Put, + // up to kTotalNumCommandEntries / kAutoFlushBig is available. + AddUniqueCommandWithExpect(error::kNoError, 2); + helper_->Flush(); + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries / kAutoFlushBig); + + helper_->Finish(); + // Check that the commands did happen. + Mock::VerifyAndClearExpectations(api_mock_.get()); + + // Check the error status. + EXPECT_EQ(error::kNoError, GetError()); +} + +// Checks immediate_entry_count_ calc when automatic flushing is enabled, and +// we allocate commands over the immediate_entry_count_ size. +TEST_F(CommandBufferHelperTest, TestCalcImmediateEntriesOverFlushLimit) { + // Lock internal flushing. + command_buffer_->LockFlush(); + + // Start at Get = Put = 0. + EXPECT_EQ(GetHelperPutOffset(), 0); + EXPECT_EQ(GetHelperGetOffset(), 0); + + // Pre-check ImmediateEntryCount is limited with automatic flushing enabled. + helper_->SetAutomaticFlushes(true); + EXPECT_EQ(ImmediateEntryCount(), kTotalNumCommandEntries / kAutoFlushSmall); + + // Add a command larger than ImmediateEntryCount(). + AddUniqueCommandWithExpect(error::kNoError, ImmediateEntryCount() + 1); + + // ImmediateEntryCount() should now be 0, to force a flush check on the next + // command. + EXPECT_EQ(ImmediateEntryCount(), 0); + + // Add a command when ImmediateEntryCount() == 0. + AddUniqueCommandWithExpect(error::kNoError, ImmediateEntryCount() + 1); + + helper_->Finish(); + // Check that the commands did happen. + Mock::VerifyAndClearExpectations(api_mock_.get()); + + // Check the error status. + EXPECT_EQ(error::kNoError, GetError()); +} + // Checks that commands in the buffer are properly executed, and that the // status/error stay valid. TEST_F(CommandBufferHelperTest, TestCommandProcessing) { @@ -184,12 +468,16 @@ TEST_F(CommandBufferHelperTest, TestCommandProcessing) { // 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. + // Add num_commands * commands of size 3 through the helper to make sure we + // do wrap. kTotalNumCommandEntries must not be a multiple of 3. + COMPILE_ASSERT(kTotalNumCommandEntries % 3 != 0, + Is_multiple_of_num_command_entries); + const int kNumCommands = (kTotalNumCommandEntries / 3) * 2; CommandBufferEntry args1[2]; args1[0].value_uint32 = 5; args1[1].value_float = 4.f; - for (unsigned int i = 0; i < 5; ++i) { + for (int i = 0; i < kNumCommands; ++i) { AddCommandWithExpect(error::kNoError, kUnusedCommandId + i, 2, args1); } @@ -204,13 +492,13 @@ TEST_F(CommandBufferHelperTest, TestCommandWrapping) { // Checks the case where the command inserted exactly matches the space left in // the command buffer. TEST_F(CommandBufferHelperTest, TestCommandWrappingExactMultiple) { - const int32 kCommandSize = 5; + const int32 kCommandSize = kTotalNumCommandEntries / 2; const size_t kNumArgs = kCommandSize - 1; COMPILE_ASSERT(kTotalNumCommandEntries % kCommandSize == 0, Not_multiple_of_num_command_entries); CommandBufferEntry args1[kNumArgs]; for (size_t ii = 0; ii < kNumArgs; ++ii) { - args1[0].value_uint32 = ii + 1; + args1[ii].value_uint32 = ii + 1; } for (unsigned int i = 0; i < 5; ++i) { @@ -226,6 +514,22 @@ TEST_F(CommandBufferHelperTest, TestCommandWrappingExactMultiple) { EXPECT_EQ(error::kNoError, GetError()); } +// Checks exact wrapping condition with Get = 0. +TEST_F(CommandBufferHelperTest, TestCommandWrappingFullAtStart) { + TestCommandWrappingFull(2, 0); +} + +// Checks exact wrapping condition with 0 < Get < kTotalNumCommandEntries. +TEST_F(CommandBufferHelperTest, TestCommandWrappingFullInMiddle) { + TestCommandWrappingFull(2, 1); +} + +// Checks exact wrapping condition with Get = kTotalNumCommandEntries. +// Get should wrap back to 0, but making sure. +TEST_F(CommandBufferHelperTest, TestCommandWrappingFullAtEnd) { + TestCommandWrappingFull(2, kTotalNumCommandEntries / 2); +} + // Checks that asking for available entries work, and that the parser // effectively won't use that space. TEST_F(CommandBufferHelperTest, TestAvailableEntries) { @@ -287,6 +591,46 @@ TEST_F(CommandBufferHelperTest, TestToken) { EXPECT_EQ(error::kNoError, GetError()); } +// Checks WaitForToken doesn't Flush if token is already read. +TEST_F(CommandBufferHelperTest, TestWaitForTokenFlush) { + CommandBufferEntry args[2]; + args[0].value_uint32 = 3; + args[1].value_float = 4.f; + + // Add a first command. + AddCommandWithExpect(error::kNoError, kUnusedCommandId + 3, 2, args); + int32 token = helper_->InsertToken(); + + EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) + .WillOnce(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken), + Return(error::kNoError))); + + int flush_count = command_buffer_->FlushCount(); + + // Test that waiting for pending token causes a Flush. + helper_->WaitForToken(token); + EXPECT_EQ(command_buffer_->FlushCount(), flush_count + 1); + + // Test that we don't Flush repeatedly. + helper_->WaitForToken(token); + EXPECT_EQ(command_buffer_->FlushCount(), flush_count + 1); + + // Add another command. + AddCommandWithExpect(error::kNoError, kUnusedCommandId + 4, 2, args); + + // Test that we don't Flush repeatedly even if commands are pending. + helper_->WaitForToken(token); + EXPECT_EQ(command_buffer_->FlushCount(), flush_count + 1); + + helper_->Finish(); + + // Check that the commands did happen. + Mock::VerifyAndClearExpectations(api_mock_.get()); + + // Check the error status. + EXPECT_EQ(error::kNoError, GetError()); +} + TEST_F(CommandBufferHelperTest, FreeRingBuffer) { EXPECT_TRUE(helper_->HaveRingBuffer()); @@ -330,4 +674,38 @@ TEST_F(CommandBufferHelperTest, IsContextLost) { EXPECT_TRUE(helper_->IsContextLost()); } +// Checks helper's 'flush generation' updates. +TEST_F(CommandBufferHelperTest, TestFlushGeneration) { + // Explicit flushing only. + helper_->SetAutomaticFlushes(false); + + // Generation should change after Flush() but not before. + uint32 gen1, gen2, gen3; + + gen1 = GetHelperFlushGeneration(); + AddUniqueCommandWithExpect(error::kNoError, 2); + gen2 = GetHelperFlushGeneration(); + helper_->Flush(); + gen3 = GetHelperFlushGeneration(); + EXPECT_EQ(gen2, gen1); + EXPECT_NE(gen3, gen2); + + // Generation should change after Finish() but not before. + gen1 = GetHelperFlushGeneration(); + AddUniqueCommandWithExpect(error::kNoError, 2); + gen2 = GetHelperFlushGeneration(); + helper_->Finish(); + gen3 = GetHelperFlushGeneration(); + EXPECT_EQ(gen2, gen1); + EXPECT_NE(gen3, gen2); + + helper_->Finish(); + + // Check that the commands did happen. + Mock::VerifyAndClearExpectations(api_mock_.get()); + + // Check the error status. + EXPECT_EQ(error::kNoError, GetError()); +} + } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/context_support.h b/chromium/gpu/command_buffer/client/context_support.h index 6a8972081ca..cba31aa856c 100644 --- a/chromium/gpu/command_buffer/client/context_support.h +++ b/chromium/gpu/command_buffer/client/context_support.h @@ -6,10 +6,10 @@ #define GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_ #include "base/callback.h" +#include "ui/gfx/overlay_transform.h" #include "ui/gfx/rect.h" namespace gpu { -struct ManagedMemoryStats; class ContextSupport { public: @@ -25,14 +25,21 @@ class ContextSupport { // Clients aren't expected to draw to an invisible surface. virtual void SetSurfaceVisible(bool visible) = 0; - virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) = 0; - virtual void Swap() = 0; - virtual void PartialSwapBuffers(gfx::Rect sub_buffer) = 0; + virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) = 0; virtual void SetSwapBuffersCompleteCallback( const base::Closure& callback) = 0; + // Schedule a texture to be presented as an overlay synchronously with the + // primary surface during the next buffer swap. + // This method is not stateful and needs to be re-scheduled every frame. + virtual void ScheduleOverlayPlane(int plane_z_order, + gfx::OverlayTransform plane_transform, + unsigned overlay_texture_id, + const gfx::Rect& display_bounds, + const gfx::RectF& uv_rect) = 0; + protected: ContextSupport() {} virtual ~ContextSupport() {} diff --git a/chromium/gpu/command_buffer/client/fenced_allocator.cc b/chromium/gpu/command_buffer/client/fenced_allocator.cc index 0e90bf385b4..80038571be9 100644 --- a/chromium/gpu/command_buffer/client/fenced_allocator.cc +++ b/chromium/gpu/command_buffer/client/fenced_allocator.cc @@ -34,8 +34,10 @@ const FencedAllocator::Offset FencedAllocator::kInvalidOffset; #endif FencedAllocator::FencedAllocator(unsigned int size, - CommandBufferHelper *helper) + CommandBufferHelper* helper, + const base::Closure& poll_callback) : helper_(helper), + poll_callback_(poll_callback), bytes_in_use_(0) { Block block = { FREE, 0, RoundDown(size), kUnusedToken }; blocks_.push_back(block); @@ -48,9 +50,9 @@ FencedAllocator::~FencedAllocator() { i = WaitForTokenAndFreeBlock(i); } } - // These checks are not valid if the service has crashed or lost the context. - // DCHECK_EQ(blocks_.size(), 1u); - // DCHECK_EQ(blocks_[0].state, FREE); + + 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 @@ -203,10 +205,13 @@ FencedAllocator::BlockIndex FencedAllocator::WaitForTokenAndFreeBlock( // Frees any blocks pending a token for which the token has been read. void FencedAllocator::FreeUnused() { - int32 last_token_read = helper_->last_token_read(); + // Free any potential blocks that has its lifetime handled outside. + poll_callback_.Run(); + for (unsigned int i = 0; i < blocks_.size();) { Block& block = blocks_[i]; - if (block.state == FREE_PENDING_TOKEN && block.token <= last_token_read) { + if (block.state == FREE_PENDING_TOKEN && + helper_->HasTokenPassed(block.token)) { block.state = FREE; i = CollapseFreeBlock(i); } else { diff --git a/chromium/gpu/command_buffer/client/fenced_allocator.h b/chromium/gpu/command_buffer/client/fenced_allocator.h index bb5c55170ab..8e222e135bf 100644 --- a/chromium/gpu/command_buffer/client/fenced_allocator.h +++ b/chromium/gpu/command_buffer/client/fenced_allocator.h @@ -7,10 +7,13 @@ #ifndef GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ #define GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ +#include <stdint.h> + #include <vector> +#include "base/bind.h" #include "base/logging.h" -#include "gpu/command_buffer/common/types.h" +#include "base/macros.h" #include "gpu/gpu_export.h" namespace gpu { @@ -35,7 +38,8 @@ class GPU_EXPORT FencedAllocator { // 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); + CommandBufferHelper *helper, + const base::Closure& poll_callback); ~FencedAllocator(); @@ -99,7 +103,7 @@ class GPU_EXPORT FencedAllocator { State state; Offset offset; unsigned int size; - int32 token; // token to wait for in the FREE_PENDING_TOKEN case. + int32_t token; // token to wait for in the FREE_PENDING_TOKEN case. }; // Comparison functor for memory block sorting. @@ -113,7 +117,7 @@ class GPU_EXPORT FencedAllocator { typedef std::vector<Block> Container; typedef unsigned int BlockIndex; - static const int32 kUnusedToken = 0; + static const int32_t kUnusedToken = 0; // Gets the index of a memory block, given its offset. BlockIndex GetBlockByOffset(Offset offset); @@ -136,6 +140,7 @@ class GPU_EXPORT FencedAllocator { Offset AllocInBlock(BlockIndex index, unsigned int size); CommandBufferHelper *helper_; + base::Closure poll_callback_; Container blocks_; size_t bytes_in_use_; @@ -148,8 +153,9 @@ class FencedAllocatorWrapper { public: FencedAllocatorWrapper(unsigned int size, CommandBufferHelper* helper, + const base::Closure& poll_callback, void* base) - : allocator_(size, helper), + : allocator_(size, helper, poll_callback), base_(base) { } // Allocates a block of memory. If the buffer is out of directly available diff --git a/chromium/gpu/command_buffer/client/fenced_allocator_test.cc b/chromium/gpu/command_buffer/client/fenced_allocator_test.cc index cc99ed36522..7ac35d4435e 100644 --- a/chromium/gpu/command_buffer/client/fenced_allocator_test.cc +++ b/chromium/gpu/command_buffer/client/fenced_allocator_test.cc @@ -29,6 +29,7 @@ using testing::Truly; using testing::Sequence; using testing::DoAll; using testing::Invoke; +using testing::InvokeWithoutArgs; using testing::_; class BaseFencedAllocatorTest : public testing::Test { @@ -70,7 +71,7 @@ class BaseFencedAllocatorTest : public testing::Test { } int32 GetToken() { - return command_buffer_->GetState().token; + return command_buffer_->GetLastState().token; } #if defined(OS_MACOSX) @@ -88,6 +89,11 @@ class BaseFencedAllocatorTest : public testing::Test { const unsigned int BaseFencedAllocatorTest::kBufferSize; #endif +namespace { +void EmptyPoll() { +} +} + // 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 @@ -96,7 +102,9 @@ class FencedAllocatorTest : public BaseFencedAllocatorTest { protected: virtual void SetUp() { BaseFencedAllocatorTest::SetUp(); - allocator_.reset(new FencedAllocator(kBufferSize, helper_.get())); + allocator_.reset(new FencedAllocator(kBufferSize, + helper_.get(), + base::Bind(&EmptyPoll))); } virtual void TearDown() { @@ -391,6 +399,63 @@ TEST_F(FencedAllocatorTest, TestGetLargestFreeOrPendingSize) { EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeSize()); } +class FencedAllocatorPollTest : public BaseFencedAllocatorTest { + public: + static const unsigned int kAllocSize = 128; + + MOCK_METHOD0(MockedPoll, void()); + + protected: + virtual void TearDown() { + // If the GpuScheduler posts any tasks, this forces them to run. + base::MessageLoop::current()->RunUntilIdle(); + + BaseFencedAllocatorTest::TearDown(); + } +}; + +TEST_F(FencedAllocatorPollTest, TestPoll) { + scoped_ptr<FencedAllocator> allocator( + new FencedAllocator(kBufferSize, + helper_.get(), + base::Bind(&FencedAllocatorPollTest::MockedPoll, + base::Unretained(this)))); + + FencedAllocator::Offset mem1 = allocator->Alloc(kAllocSize); + FencedAllocator::Offset mem2 = allocator->Alloc(kAllocSize); + EXPECT_NE(mem1, FencedAllocator::kInvalidOffset); + EXPECT_NE(mem2, FencedAllocator::kInvalidOffset); + EXPECT_TRUE(allocator->CheckConsistency()); + EXPECT_EQ(allocator->bytes_in_use(), kAllocSize * 2); + + // Check that no-op Poll doesn't affect the state. + EXPECT_CALL(*this, MockedPoll()).RetiresOnSaturation(); + allocator->FreeUnused(); + EXPECT_TRUE(allocator->CheckConsistency()); + EXPECT_EQ(allocator->bytes_in_use(), kAllocSize * 2); + + // Check that freeing in Poll works. + base::Closure free_mem1_closure = + base::Bind(&FencedAllocator::Free, + base::Unretained(allocator.get()), + mem1); + EXPECT_CALL(*this, MockedPoll()) + .WillOnce(InvokeWithoutArgs(&free_mem1_closure, &base::Closure::Run)) + .RetiresOnSaturation(); + allocator->FreeUnused(); + EXPECT_TRUE(allocator->CheckConsistency()); + EXPECT_EQ(allocator->bytes_in_use(), kAllocSize * 1); + + // Check that freeing still works. + EXPECT_CALL(*this, MockedPoll()).RetiresOnSaturation(); + allocator->Free(mem2); + allocator->FreeUnused(); + EXPECT_TRUE(allocator->CheckConsistency()); + EXPECT_EQ(allocator->bytes_in_use(), 0u); + + allocator.reset(); +} + // Test fixture for FencedAllocatorWrapper test - Creates a // FencedAllocatorWrapper, using a CommandBufferHelper with a mock // AsyncAPIInterface for its interface (calling it directly, not through the @@ -406,7 +471,9 @@ class FencedAllocatorWrapperTest : public BaseFencedAllocatorTest { // something. buffer_.reset(static_cast<char*>(base::AlignedAlloc( kBufferSize, kAllocAlignment))); - allocator_.reset(new FencedAllocatorWrapper(kBufferSize, helper_.get(), + allocator_.reset(new FencedAllocatorWrapper(kBufferSize, + helper_.get(), + base::Bind(&EmptyPoll), buffer_.get())); } @@ -420,7 +487,7 @@ class FencedAllocatorWrapperTest : public BaseFencedAllocatorTest { } scoped_ptr<FencedAllocatorWrapper> allocator_; - scoped_ptr_malloc<char, base::ScopedPtrAlignedFree> buffer_; + scoped_ptr<char, base::AlignedFreeDeleter> buffer_; }; // Checks basic alloc and free. diff --git a/chromium/gpu/command_buffer/client/gl_in_process_context.cc b/chromium/gpu/command_buffer/client/gl_in_process_context.cc index 1bd4c625457..33d41563dea 100644 --- a/chromium/gpu/command_buffer/client/gl_in_process_context.cc +++ b/chromium/gpu/command_buffer/client/gl_in_process_context.cc @@ -26,7 +26,6 @@ #include "gpu/command_buffer/client/transfer_buffer.h" #include "gpu/command_buffer/common/command_buffer.h" #include "gpu/command_buffer/common/constants.h" -#include "gpu/command_buffer/service/in_process_command_buffer.h" #include "ui/gfx/size.h" #include "ui/gl/gl_image.h" @@ -52,13 +51,16 @@ class GLInProcessContextImpl explicit GLInProcessContextImpl(); virtual ~GLInProcessContextImpl(); - bool Initialize(scoped_refptr<gfx::GLSurface> surface, - bool is_offscreen, - bool share_resources, - gfx::AcceleratedWidget window, - const gfx::Size& size, - const GLInProcessContextAttribs& attribs, - gfx::GpuPreference gpu_preference); + bool Initialize( + scoped_refptr<gfx::GLSurface> surface, + bool is_offscreen, + bool use_global_share_group, + GLInProcessContext* share_context, + gfx::AcceleratedWidget window, + const gfx::Size& size, + const GLInProcessContextAttribs& attribs, + gfx::GpuPreference gpu_preference, + const scoped_refptr<InProcessCommandBuffer::Service>& service); // GLInProcessContext implementation: virtual void SetContextLostCallback(const base::Closure& callback) OVERRIDE; @@ -79,7 +81,6 @@ class GLInProcessContextImpl scoped_ptr<gles2::GLES2Implementation> gles2_implementation_; scoped_ptr<InProcessCommandBuffer> command_buffer_; - unsigned int share_group_id_; bool context_lost_; base::Closure context_lost_callback_; @@ -92,7 +93,7 @@ base::LazyInstance<std::set<GLInProcessContextImpl*> > g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; GLInProcessContextImpl::GLInProcessContextImpl() - : share_group_id_(0), context_lost_(false) {} + : context_lost_(false) {} GLInProcessContextImpl::~GLInProcessContextImpl() { { @@ -121,11 +122,14 @@ void GLInProcessContextImpl::OnContextLost() { bool GLInProcessContextImpl::Initialize( scoped_refptr<gfx::GLSurface> surface, bool is_offscreen, - bool share_resources, + bool use_global_share_group, + GLInProcessContext* share_context, gfx::AcceleratedWidget window, const gfx::Size& size, const GLInProcessContextAttribs& attribs, - gfx::GpuPreference gpu_preference) { + gfx::GpuPreference gpu_preference, + const scoped_refptr<InProcessCommandBuffer::Service>& service) { + DCHECK(!use_global_share_group || !share_context); DCHECK(size.width() >= 0 && size.height() >= 0); // Changes to these values should also be copied to @@ -143,6 +147,7 @@ bool GLInProcessContextImpl::Initialize( // Chromium-specific attributes const int32 FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002; + const int32 LOSE_CONTEXT_WHEN_OUT_OF_MEMORY = 0x10003; std::vector<int32> attrib_vector; if (attribs.alpha_size >= 0) { @@ -181,15 +186,20 @@ bool GLInProcessContextImpl::Initialize( attrib_vector.push_back(FAIL_IF_MAJOR_PERF_CAVEAT); attrib_vector.push_back(attribs.fail_if_major_perf_caveat); } + if (attribs.lose_context_when_out_of_memory > 0) { + attrib_vector.push_back(LOSE_CONTEXT_WHEN_OUT_OF_MEMORY); + attrib_vector.push_back(attribs.lose_context_when_out_of_memory); + } attrib_vector.push_back(NONE); base::Closure wrapped_callback = base::Bind(&GLInProcessContextImpl::OnContextLost, AsWeakPtr()); - command_buffer_.reset(new InProcessCommandBuffer()); + command_buffer_.reset(new InProcessCommandBuffer(service)); scoped_ptr<base::AutoLock> scoped_shared_context_lock; scoped_refptr<gles2::ShareGroup> share_group; - if (share_resources) { + InProcessCommandBuffer* share_command_buffer = NULL; + if (use_global_share_group) { scoped_shared_context_lock.reset( new base::AutoLock(g_all_shared_contexts_lock.Get())); for (std::set<GLInProcessContextImpl*>::const_iterator it = @@ -199,24 +209,29 @@ bool GLInProcessContextImpl::Initialize( const GLInProcessContextImpl* context = *it; if (!context->context_lost_) { share_group = context->gles2_implementation_->share_group(); + share_command_buffer = context->command_buffer_.get(); DCHECK(share_group); - share_group_id_ = context->share_group_id_; + DCHECK(share_command_buffer); break; } - share_group_id_ = std::max(share_group_id_, context->share_group_id_); } - if (!share_group && !++share_group_id_) - ++share_group_id_; + } else if (share_context) { + GLInProcessContextImpl* impl = + static_cast<GLInProcessContextImpl*>(share_context); + share_group = impl->gles2_implementation_->share_group(); + share_command_buffer = impl->command_buffer_.get(); + DCHECK(share_group); + DCHECK(share_command_buffer); } + if (!command_buffer_->Initialize(surface, is_offscreen, - share_resources, window, size, attrib_vector, gpu_preference, wrapped_callback, - share_group_id_)) { + share_command_buffer)) { LOG(ERROR) << "Failed to initialize InProcessCommmandBuffer"; return false; } @@ -233,7 +248,6 @@ bool GLInProcessContextImpl::Initialize( transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); bool bind_generates_resources = false; - bool free_everything_when_invisible = false; // Create the object exposing the OpenGL API. gles2_implementation_.reset(new gles2::GLES2Implementation( @@ -241,10 +255,10 @@ bool GLInProcessContextImpl::Initialize( share_group, transfer_buffer_.get(), bind_generates_resources, - free_everything_when_invisible, + attribs.lose_context_when_out_of_memory > 0, command_buffer_.get())); - if (share_resources) { + if (use_global_share_group) { g_all_shared_contexts.Get().insert(this); scoped_shared_context_lock.reset(); } @@ -294,7 +308,9 @@ GLInProcessContextAttribs::GLInProcessContextAttribs() depth_size(-1), stencil_size(-1), samples(-1), - sample_buffers(-1) {} + sample_buffers(-1), + fail_if_major_perf_caveat(-1), + lose_context_when_out_of_memory(-1) {} // static GLInProcessContext* GLInProcessContext::CreateContext( @@ -310,31 +326,44 @@ GLInProcessContext* GLInProcessContext::CreateContext( NULL /* surface */, is_offscreen, share_resources, + NULL, window, size, attribs, - gpu_preference)) + gpu_preference, + scoped_refptr<InProcessCommandBuffer::Service>())) return NULL; return context.release(); } -// static -GLInProcessContext* GLInProcessContext::CreateWithSurface( +GLInProcessContext* GLInProcessContext::Create( + scoped_refptr<gpu::InProcessCommandBuffer::Service> service, scoped_refptr<gfx::GLSurface> surface, - bool share_resources, + bool is_offscreen, + gfx::AcceleratedWidget window, + const gfx::Size& size, + GLInProcessContext* share_context, + bool use_global_share_group, const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference) { - scoped_ptr<GLInProcessContextImpl> context( - new GLInProcessContextImpl()); - if (!context->Initialize( - surface, - surface->IsOffscreen(), - share_resources, - gfx::kNullAcceleratedWidget, - surface->GetSize(), - attribs, - gpu_preference)) + DCHECK(!use_global_share_group || !share_context); + if (surface.get()) { + DCHECK_EQ(surface->IsOffscreen(), is_offscreen); + DCHECK(surface->GetSize() == size); + DCHECK_EQ(gfx::kNullAcceleratedWidget, window); + } + + scoped_ptr<GLInProcessContextImpl> context(new GLInProcessContextImpl()); + if (!context->Initialize(surface, + is_offscreen, + use_global_share_group, + share_context, + gfx::kNullAcceleratedWidget, + size, + attribs, + gpu_preference, + service)) return NULL; return context.release(); diff --git a/chromium/gpu/command_buffer/client/gl_in_process_context.h b/chromium/gpu/command_buffer/client/gl_in_process_context.h index 6d96f131554..c1478b11135 100644 --- a/chromium/gpu/command_buffer/client/gl_in_process_context.h +++ b/chromium/gpu/command_buffer/client/gl_in_process_context.h @@ -7,7 +7,8 @@ #include "base/callback.h" #include "base/compiler_specific.h" -#include "gles2_impl_export.h" +#include "gl_in_process_context_export.h" +#include "gpu/command_buffer/service/in_process_command_buffer.h" #include "ui/gfx/native_widget_types.h" #include "ui/gl/gl_surface.h" #include "ui/gl/gpu_preference.h" @@ -29,7 +30,7 @@ class GLES2Implementation; } // The default uninitialized value is -1. -struct GLES2_IMPL_EXPORT GLInProcessContextAttribs { +struct GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContextAttribs { GLInProcessContextAttribs(); int32 alpha_size; @@ -41,15 +42,17 @@ struct GLES2_IMPL_EXPORT GLInProcessContextAttribs { int32 samples; int32 sample_buffers; int32 fail_if_major_perf_caveat; + int32 lose_context_when_out_of_memory; }; -class GLES2_IMPL_EXPORT GLInProcessContext { +class GL_IN_PROCESS_CONTEXT_EXPORT GLInProcessContext { public: virtual ~GLInProcessContext() {} // Create a GLInProcessContext, if |is_offscreen| is true, renders to an // offscreen context. |attrib_list| must be NULL or a NONE-terminated list // of attribute/value pairs. + // TODO(boliu): Fix all callsites to use Create and remove this. static GLInProcessContext* CreateContext( bool is_offscreen, gfx::AcceleratedWidget window, @@ -58,13 +61,21 @@ class GLES2_IMPL_EXPORT GLInProcessContext { const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference); - // Create context with the provided GLSurface. All other arguments match - // CreateContext factory above. Can only be called if the command buffer - // service runs on the same thread as this client because GLSurface is not - // thread safe. - static GLInProcessContext* CreateWithSurface( + // If |surface| is not NULL, then it must match |is_offscreen| and |size|, + // |window| must be gfx::kNullAcceleratedWidget, and the command buffer + // service must run on the same thread as this client because GLSurface is + // not thread safe. If |surface| is NULL, then the other parameters are used + // to correctly create a surface. + // Only one of |share_context| and |use_global_share_group| can be used at + // the same time. + static GLInProcessContext* Create( + scoped_refptr<gpu::InProcessCommandBuffer::Service> service, scoped_refptr<gfx::GLSurface> surface, - bool share_resources, + bool is_offscreen, + gfx::AcceleratedWidget window, + const gfx::Size& size, + GLInProcessContext* share_context, + bool use_global_share_group, const GLInProcessContextAttribs& attribs, gfx::GpuPreference gpu_preference); diff --git a/chromium/gpu/command_buffer/client/gl_in_process_context_export.h b/chromium/gpu/command_buffer/client/gl_in_process_context_export.h new file mode 100644 index 00000000000..36c4a34df9d --- /dev/null +++ b/chromium/gpu/command_buffer/client/gl_in_process_context_export.h @@ -0,0 +1,29 @@ +// Copyright 2014 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 GL_IN_PROCESS_CONTEXT_EXPORT_H_ +#define GL_IN_PROCESS_CONTEXT_EXPORT_H_ + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(GL_IN_PROCESS_CONTEXT_IMPLEMENTATION) +#define GL_IN_PROCESS_CONTEXT_EXPORT __declspec(dllexport) +#else +#define GL_IN_PROCESS_CONTEXT_EXPORT __declspec(dllimport) +#endif // defined(GL_IN_PROCESS_CONTEXT_IMPLEMENTATION) + +#else // defined(WIN32) +#if defined(GL_IN_PROCESS_CONTEXT_IMPLEMENTATION) +#define GL_IN_PROCESS_CONTEXT_EXPORT __attribute__((visibility("default"))) +#else +#define GL_IN_PROCESS_CONTEXT_EXPORT +#endif +#endif + +#else // defined(COMPONENT_BUILD) +#define GL_IN_PROCESS_CONTEXT_EXPORT +#endif + +#endif // GL_IN_PROCESS_CONTEXT_EXPORT_H_ diff --git a/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h b/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h index f2eb83746e7..f59157d14e2 100644 --- a/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // These functions emulate GLES2 over command buffers. @@ -31,8 +33,10 @@ void GLES2BindRenderbuffer(GLenum target, GLuint renderbuffer) { void GLES2BindTexture(GLenum target, GLuint texture) { gles2::GetGLContext()->BindTexture(target, texture); } -void GLES2BlendColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { +void GLES2BlendColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { gles2::GetGLContext()->BlendColor(red, green, blue, alpha); } void GLES2BlendEquation(GLenum mode) { @@ -44,16 +48,22 @@ void GLES2BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { void GLES2BlendFunc(GLenum sfactor, GLenum dfactor) { gles2::GetGLContext()->BlendFunc(sfactor, dfactor); } -void GLES2BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { +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) { +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) { +void GLES2BufferSubData(GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data) { gles2::GetGLContext()->BufferSubData(target, offset, size, data); } GLenum GLES2CheckFramebufferStatus(GLenum target) { @@ -62,8 +72,10 @@ GLenum GLES2CheckFramebufferStatus(GLenum target) { void GLES2Clear(GLbitfield mask) { gles2::GetGLContext()->Clear(mask); } -void GLES2ClearColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { +void GLES2ClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { gles2::GetGLContext()->ClearColor(red, green, blue, alpha); } void GLES2ClearDepthf(GLclampf depth) { @@ -72,34 +84,57 @@ void GLES2ClearDepthf(GLclampf depth) { void GLES2ClearStencil(GLint s) { gles2::GetGLContext()->ClearStencil(s); } -void GLES2ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { +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) { +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) { +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) { +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) { +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); } @@ -151,8 +186,10 @@ void GLES2DisableVertexAttribArray(GLuint 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) { +void GLES2DrawElements(GLenum mode, + GLsizei count, + GLenum type, + const void* indices) { gles2::GetGLContext()->DrawElements(mode, count, type, indices); } void GLES2Enable(GLenum cap) { @@ -167,15 +204,18 @@ void GLES2Finish() { void GLES2Flush() { gles2::GetGLContext()->Flush(); } -void GLES2FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, - GLuint renderbuffer) { +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) { +void GLES2FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) { gles2::GetGLContext()->FramebufferTexture2D( target, attachment, textarget, texture, level); } @@ -197,20 +237,30 @@ void GLES2GenRenderbuffers(GLsizei n, GLuint* 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) { +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) { +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) { +void GLES2GetAttachedShaders(GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders) { gles2::GetGLContext()->GetAttachedShaders(program, maxcount, count, shaders); } GLint GLES2GetAttribLocation(GLuint program, const char* name) { @@ -228,8 +278,10 @@ GLenum GLES2GetError() { void GLES2GetFloatv(GLenum pname, GLfloat* params) { gles2::GetGLContext()->GetFloatv(pname, params); } -void GLES2GetFramebufferAttachmentParameteriv( - GLenum target, GLenum attachment, GLenum pname, GLint* params) { +void GLES2GetFramebufferAttachmentParameteriv(GLenum target, + GLenum attachment, + GLenum pname, + GLint* params) { gles2::GetGLContext()->GetFramebufferAttachmentParameteriv( target, attachment, pname, params); } @@ -239,28 +291,37 @@ void GLES2GetIntegerv(GLenum pname, GLint* 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) { +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) { +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) { +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) { +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) { +void GLES2GetShaderSource(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) { gles2::GetGLContext()->GetShaderSource(shader, bufsize, length, source); } const GLubyte* GLES2GetString(GLenum name) { @@ -326,16 +387,22 @@ void GLES2PixelStorei(GLenum pname, GLint 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) { +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 GLES2ReleaseShaderCompiler() { gles2::GetGLContext()->ReleaseShaderCompiler(); } -void GLES2RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { +void GLES2RenderbufferStorage(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) { gles2::GetGLContext()->RenderbufferStorage( target, internalformat, width, height); } @@ -345,15 +412,17 @@ void GLES2SampleCoverage(GLclampf value, GLboolean invert) { void GLES2Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { gles2::GetGLContext()->Scissor(x, y, width, height); } -void GLES2ShaderBinary( - GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, - GLsizei length) { - gles2::GetGLContext()->ShaderBinary( - n, shaders, binaryformat, binary, length); -} -void GLES2ShaderSource( - GLuint shader, GLsizei count, const GLchar* const* str, - const GLint* length) { +void GLES2ShaderBinary(GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length) { + gles2::GetGLContext()->ShaderBinary(n, shaders, binaryformat, binary, length); +} +void GLES2ShaderSource(GLuint shader, + GLsizei count, + const GLchar* const* str, + const GLint* length) { gles2::GetGLContext()->ShaderSource(shader, count, str, length); } void GLES2ShallowFinishCHROMIUM() { @@ -365,8 +434,10 @@ void GLES2ShallowFlushCHROMIUM() { void GLES2StencilFunc(GLenum func, GLint ref, GLuint mask) { gles2::GetGLContext()->StencilFunc(func, ref, mask); } -void GLES2StencilFuncSeparate( - GLenum face, GLenum func, GLint ref, GLuint mask) { +void GLES2StencilFuncSeparate(GLenum face, + GLenum func, + GLint ref, + GLuint mask) { gles2::GetGLContext()->StencilFuncSeparate(face, func, ref, mask); } void GLES2StencilMask(GLuint mask) { @@ -378,17 +449,30 @@ void GLES2StencilMaskSeparate(GLenum face, GLuint 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) { +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 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); @@ -402,9 +486,15 @@ void GLES2TexParameteri(GLenum target, GLenum pname, GLint 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) { +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); } @@ -444,8 +534,11 @@ void GLES2Uniform3i(GLint location, GLint x, GLint y, GLint 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) { +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) { @@ -457,16 +550,22 @@ void GLES2Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint 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) { +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) { +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) { +void GLES2UniformMatrix4fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { gles2::GetGLContext()->UniformMatrix4fv(location, count, transpose, value); } void GLES2UseProgram(GLuint program) { @@ -493,49 +592,71 @@ void GLES2VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat 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) { +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) { +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 GLES2BlitFramebufferCHROMIUM( - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, - GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { +void GLES2BlitFramebufferCHROMIUM(GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) { gles2::GetGLContext()->BlitFramebufferCHROMIUM( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } -void GLES2RenderbufferStorageMultisampleCHROMIUM( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) { +void GLES2RenderbufferStorageMultisampleCHROMIUM(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) { gles2::GetGLContext()->RenderbufferStorageMultisampleCHROMIUM( target, samples, internalformat, width, height); } -void GLES2RenderbufferStorageMultisampleEXT( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) { +void GLES2RenderbufferStorageMultisampleEXT(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) { gles2::GetGLContext()->RenderbufferStorageMultisampleEXT( target, samples, internalformat, width, height); } -void GLES2FramebufferTexture2DMultisampleEXT( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLsizei samples) { +void GLES2FramebufferTexture2DMultisampleEXT(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples) { gles2::GetGLContext()->FramebufferTexture2DMultisampleEXT( target, attachment, textarget, texture, level, samples); } -void GLES2TexStorage2DEXT( - GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, - GLsizei height) { +void GLES2TexStorage2DEXT(GLenum target, + GLsizei levels, + GLenum internalFormat, + GLsizei width, + GLsizei height) { gles2::GetGLContext()->TexStorage2DEXT( target, levels, internalFormat, width, height); } @@ -584,21 +705,27 @@ void GLES2BindVertexArrayOES(GLuint array) { void GLES2SwapBuffers() { gles2::GetGLContext()->SwapBuffers(); } -GLuint GLES2GetMaxValueInBufferCHROMIUM( - GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { +GLuint GLES2GetMaxValueInBufferCHROMIUM(GLuint buffer_id, + GLsizei count, + GLenum type, + GLuint offset) { return gles2::GetGLContext()->GetMaxValueInBufferCHROMIUM( buffer_id, count, type, offset); } -void GLES2GenSharedIdsCHROMIUM( - GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { +void GLES2GenSharedIdsCHROMIUM(GLuint namespace_id, + GLuint id_offset, + GLsizei n, + GLuint* ids) { gles2::GetGLContext()->GenSharedIdsCHROMIUM(namespace_id, id_offset, n, ids); } -void GLES2DeleteSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) { +void GLES2DeleteSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) { gles2::GetGLContext()->DeleteSharedIdsCHROMIUM(namespace_id, n, ids); } -void GLES2RegisterSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) { +void GLES2RegisterSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) { gles2::GetGLContext()->RegisterSharedIdsCHROMIUM(namespace_id, n, ids); } GLboolean GLES2EnableFeatureCHROMIUM(const char* feature) { @@ -610,23 +737,31 @@ void* GLES2MapBufferCHROMIUM(GLuint target, GLenum access) { GLboolean GLES2UnmapBufferCHROMIUM(GLuint target) { return gles2::GetGLContext()->UnmapBufferCHROMIUM(target); } -void* GLES2MapImageCHROMIUM(GLuint image_id, GLenum access) { - return gles2::GetGLContext()->MapImageCHROMIUM(image_id, access); +void* GLES2MapImageCHROMIUM(GLuint image_id) { + return gles2::GetGLContext()->MapImageCHROMIUM(image_id); } void GLES2UnmapImageCHROMIUM(GLuint image_id) { gles2::GetGLContext()->UnmapImageCHROMIUM(image_id); } -void* GLES2MapBufferSubDataCHROMIUM( - GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { +void* GLES2MapBufferSubDataCHROMIUM(GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access) { return gles2::GetGLContext()->MapBufferSubDataCHROMIUM( target, offset, size, access); } void GLES2UnmapBufferSubDataCHROMIUM(const void* mem) { gles2::GetGLContext()->UnmapBufferSubDataCHROMIUM(mem); } -void* GLES2MapTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, GLenum access) { +void* GLES2MapTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access) { return gles2::GetGLContext()->MapTexSubImage2DCHROMIUM( target, level, xoffset, yoffset, width, height, format, type, access); } @@ -645,61 +780,76 @@ void GLES2RequestExtensionCHROMIUM(const char* extension) { void GLES2RateLimitOffscreenContextCHROMIUM() { gles2::GetGLContext()->RateLimitOffscreenContextCHROMIUM(); } -void GLES2GetMultipleIntegervCHROMIUM( - const GLenum* pnames, GLuint count, GLint* results, GLsizeiptr size) { +void GLES2GetMultipleIntegervCHROMIUM(const GLenum* pnames, + GLuint count, + GLint* results, + GLsizeiptr size) { gles2::GetGLContext()->GetMultipleIntegervCHROMIUM( pnames, count, results, size); } -void GLES2GetProgramInfoCHROMIUM( - GLuint program, GLsizei bufsize, GLsizei* size, void* info) { +void GLES2GetProgramInfoCHROMIUM(GLuint program, + GLsizei bufsize, + GLsizei* size, + void* info) { gles2::GetGLContext()->GetProgramInfoCHROMIUM(program, bufsize, size, info); } GLuint GLES2CreateStreamTextureCHROMIUM(GLuint texture) { return gles2::GetGLContext()->CreateStreamTextureCHROMIUM(texture); } -void GLES2DestroyStreamTextureCHROMIUM(GLuint texture) { - gles2::GetGLContext()->DestroyStreamTextureCHROMIUM(texture); -} -GLuint GLES2CreateImageCHROMIUM( - GLsizei width, GLsizei height, GLenum internalformat) { +GLuint GLES2CreateImageCHROMIUM(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) { return gles2::GetGLContext()->CreateImageCHROMIUM( - width, height, internalformat); + width, height, internalformat, usage); } void GLES2DestroyImageCHROMIUM(GLuint image_id) { gles2::GetGLContext()->DestroyImageCHROMIUM(image_id); } -void GLES2GetImageParameterivCHROMIUM( - GLuint image_id, GLenum pname, GLint* params) { +void GLES2GetImageParameterivCHROMIUM(GLuint image_id, + GLenum pname, + GLint* params) { gles2::GetGLContext()->GetImageParameterivCHROMIUM(image_id, pname, params); } -void GLES2GetTranslatedShaderSourceANGLE( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { +void GLES2GetTranslatedShaderSourceANGLE(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) { gles2::GetGLContext()->GetTranslatedShaderSourceANGLE( shader, bufsize, length, source); } void GLES2PostSubBufferCHROMIUM(GLint x, GLint y, GLint width, GLint height) { gles2::GetGLContext()->PostSubBufferCHROMIUM(x, y, width, height); } -void GLES2TexImageIOSurface2DCHROMIUM( - GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, - GLuint plane) { +void GLES2TexImageIOSurface2DCHROMIUM(GLenum target, + GLsizei width, + GLsizei height, + GLuint ioSurfaceId, + GLuint plane) { gles2::GetGLContext()->TexImageIOSurface2DCHROMIUM( target, width, height, ioSurfaceId, plane); } -void GLES2CopyTextureCHROMIUM( - GLenum target, GLenum source_id, GLenum dest_id, GLint level, - GLint internalformat, GLenum dest_type) { +void GLES2CopyTextureCHROMIUM(GLenum target, + GLenum source_id, + GLenum dest_id, + GLint level, + GLint internalformat, + GLenum dest_type) { gles2::GetGLContext()->CopyTextureCHROMIUM( target, source_id, dest_id, level, internalformat, dest_type); } -void GLES2DrawArraysInstancedANGLE( - GLenum mode, GLint first, GLsizei count, GLsizei primcount) { +void GLES2DrawArraysInstancedANGLE(GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) { gles2::GetGLContext()->DrawArraysInstancedANGLE( mode, first, count, primcount); } -void GLES2DrawElementsInstancedANGLE( - GLenum mode, GLsizei count, GLenum type, const void* indices, - GLsizei primcount) { +void GLES2DrawElementsInstancedANGLE(GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount) { gles2::GetGLContext()->DrawElementsInstancedANGLE( mode, count, type, indices, primcount); } @@ -712,11 +862,22 @@ void GLES2GenMailboxCHROMIUM(GLbyte* mailbox) { void GLES2ProduceTextureCHROMIUM(GLenum target, const GLbyte* mailbox) { gles2::GetGLContext()->ProduceTextureCHROMIUM(target, mailbox); } +void GLES2ProduceTextureDirectCHROMIUM(GLuint texture, + GLenum target, + const GLbyte* mailbox) { + gles2::GetGLContext()->ProduceTextureDirectCHROMIUM(texture, target, mailbox); +} void GLES2ConsumeTextureCHROMIUM(GLenum target, const GLbyte* mailbox) { gles2::GetGLContext()->ConsumeTextureCHROMIUM(target, mailbox); } -void GLES2BindUniformLocationCHROMIUM( - GLuint program, GLint location, const char* name) { +GLuint GLES2CreateAndConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) { + return gles2::GetGLContext()->CreateAndConsumeTextureCHROMIUM(target, + mailbox); +} +void GLES2BindUniformLocationCHROMIUM(GLuint program, + GLint location, + const char* name) { gles2::GetGLContext()->BindUniformLocationCHROMIUM(program, location, name); } void GLES2BindTexImage2DCHROMIUM(GLenum target, GLint imageId) { @@ -731,25 +892,46 @@ void GLES2TraceBeginCHROMIUM(const char* name) { void GLES2TraceEndCHROMIUM() { gles2::GetGLContext()->TraceEndCHROMIUM(); } -void GLES2AsyncTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* data) { +void GLES2AsyncTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* data) { gles2::GetGLContext()->AsyncTexSubImage2DCHROMIUM( target, level, xoffset, yoffset, width, height, format, type, data); } -void GLES2AsyncTexImage2DCHROMIUM( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) { - gles2::GetGLContext()->AsyncTexImage2DCHROMIUM( - target, level, internalformat, width, height, border, format, type, - pixels); +void GLES2AsyncTexImage2DCHROMIUM(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) { + gles2::GetGLContext()->AsyncTexImage2DCHROMIUM(target, + level, + internalformat, + width, + height, + border, + format, + type, + pixels); } void GLES2WaitAsyncTexImage2DCHROMIUM(GLenum target) { gles2::GetGLContext()->WaitAsyncTexImage2DCHROMIUM(target); } -void GLES2DiscardFramebufferEXT( - GLenum target, GLsizei count, const GLenum* attachments) { +void GLES2WaitAllAsyncTexImage2DCHROMIUM() { + gles2::GetGLContext()->WaitAllAsyncTexImage2DCHROMIUM(); +} +void GLES2DiscardFramebufferEXT(GLenum target, + GLsizei count, + const GLenum* attachments) { gles2::GetGLContext()->DiscardFramebufferEXT(target, count, attachments); } void GLES2LoseContextCHROMIUM(GLenum current, GLenum other) { @@ -767,368 +949,813 @@ void GLES2DrawBuffersEXT(GLsizei count, const GLenum* bufs) { void GLES2DiscardBackbufferCHROMIUM() { gles2::GetGLContext()->DiscardBackbufferCHROMIUM(); } +void GLES2ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order, + GLenum plane_transform, + GLuint overlay_texture_id, + GLint bounds_x, + GLint bounds_y, + GLint bounds_width, + GLint bounds_height, + GLfloat uv_x, + GLfloat uv_y, + GLfloat uv_width, + GLfloat uv_height) { + gles2::GetGLContext()->ScheduleOverlayPlaneCHROMIUM(plane_z_order, + plane_transform, + overlay_texture_id, + bounds_x, + bounds_y, + bounds_width, + bounds_height, + uv_x, + uv_y, + uv_width, + uv_height); +} namespace gles2 { extern const NameToFunc g_gles2_function_table[] = { - { "glActiveTexture", reinterpret_cast<GLES2FunctionPointer>( - glActiveTexture), }, - { "glAttachShader", reinterpret_cast<GLES2FunctionPointer>( - glAttachShader), }, - { "glBindAttribLocation", reinterpret_cast<GLES2FunctionPointer>( - glBindAttribLocation), }, - { "glBindBuffer", reinterpret_cast<GLES2FunctionPointer>(glBindBuffer), }, - { "glBindFramebuffer", reinterpret_cast<GLES2FunctionPointer>( - glBindFramebuffer), }, - { "glBindRenderbuffer", reinterpret_cast<GLES2FunctionPointer>( - glBindRenderbuffer), }, - { "glBindTexture", reinterpret_cast<GLES2FunctionPointer>(glBindTexture), }, - { "glBlendColor", reinterpret_cast<GLES2FunctionPointer>(glBlendColor), }, - { "glBlendEquation", reinterpret_cast<GLES2FunctionPointer>( - glBlendEquation), }, - { "glBlendEquationSeparate", reinterpret_cast<GLES2FunctionPointer>( - glBlendEquationSeparate), }, - { "glBlendFunc", reinterpret_cast<GLES2FunctionPointer>(glBlendFunc), }, - { "glBlendFuncSeparate", reinterpret_cast<GLES2FunctionPointer>( - glBlendFuncSeparate), }, - { "glBufferData", reinterpret_cast<GLES2FunctionPointer>(glBufferData), }, - { "glBufferSubData", reinterpret_cast<GLES2FunctionPointer>( - glBufferSubData), }, - { "glCheckFramebufferStatus", reinterpret_cast<GLES2FunctionPointer>( - glCheckFramebufferStatus), }, - { "glClear", reinterpret_cast<GLES2FunctionPointer>(glClear), }, - { "glClearColor", reinterpret_cast<GLES2FunctionPointer>(glClearColor), }, - { "glClearDepthf", reinterpret_cast<GLES2FunctionPointer>(glClearDepthf), }, - { "glClearStencil", reinterpret_cast<GLES2FunctionPointer>( - glClearStencil), }, - { "glColorMask", reinterpret_cast<GLES2FunctionPointer>(glColorMask), }, - { "glCompileShader", reinterpret_cast<GLES2FunctionPointer>( - glCompileShader), }, - { "glCompressedTexImage2D", reinterpret_cast<GLES2FunctionPointer>( - glCompressedTexImage2D), }, - { "glCompressedTexSubImage2D", reinterpret_cast<GLES2FunctionPointer>( - glCompressedTexSubImage2D), }, - { "glCopyTexImage2D", reinterpret_cast<GLES2FunctionPointer>( - glCopyTexImage2D), }, - { "glCopyTexSubImage2D", reinterpret_cast<GLES2FunctionPointer>( - glCopyTexSubImage2D), }, - { "glCreateProgram", reinterpret_cast<GLES2FunctionPointer>( - glCreateProgram), }, - { "glCreateShader", reinterpret_cast<GLES2FunctionPointer>( - glCreateShader), }, - { "glCullFace", reinterpret_cast<GLES2FunctionPointer>(glCullFace), }, - { "glDeleteBuffers", reinterpret_cast<GLES2FunctionPointer>( - glDeleteBuffers), }, - { "glDeleteFramebuffers", reinterpret_cast<GLES2FunctionPointer>( - glDeleteFramebuffers), }, - { "glDeleteProgram", reinterpret_cast<GLES2FunctionPointer>( - glDeleteProgram), }, - { "glDeleteRenderbuffers", reinterpret_cast<GLES2FunctionPointer>( - glDeleteRenderbuffers), }, - { "glDeleteShader", reinterpret_cast<GLES2FunctionPointer>( - glDeleteShader), }, - { "glDeleteTextures", reinterpret_cast<GLES2FunctionPointer>( - glDeleteTextures), }, - { "glDepthFunc", reinterpret_cast<GLES2FunctionPointer>(glDepthFunc), }, - { "glDepthMask", reinterpret_cast<GLES2FunctionPointer>(glDepthMask), }, - { "glDepthRangef", reinterpret_cast<GLES2FunctionPointer>(glDepthRangef), }, - { "glDetachShader", reinterpret_cast<GLES2FunctionPointer>( - glDetachShader), }, - { "glDisable", reinterpret_cast<GLES2FunctionPointer>(glDisable), }, - { "glDisableVertexAttribArray", reinterpret_cast<GLES2FunctionPointer>( - glDisableVertexAttribArray), }, - { "glDrawArrays", reinterpret_cast<GLES2FunctionPointer>(glDrawArrays), }, - { "glDrawElements", reinterpret_cast<GLES2FunctionPointer>( - glDrawElements), }, - { "glEnable", reinterpret_cast<GLES2FunctionPointer>(glEnable), }, - { "glEnableVertexAttribArray", reinterpret_cast<GLES2FunctionPointer>( - glEnableVertexAttribArray), }, - { "glFinish", reinterpret_cast<GLES2FunctionPointer>(glFinish), }, - { "glFlush", reinterpret_cast<GLES2FunctionPointer>(glFlush), }, - { "glFramebufferRenderbuffer", reinterpret_cast<GLES2FunctionPointer>( - glFramebufferRenderbuffer), }, - { "glFramebufferTexture2D", reinterpret_cast<GLES2FunctionPointer>( - glFramebufferTexture2D), }, - { "glFrontFace", reinterpret_cast<GLES2FunctionPointer>(glFrontFace), }, - { "glGenBuffers", reinterpret_cast<GLES2FunctionPointer>(glGenBuffers), }, - { "glGenerateMipmap", reinterpret_cast<GLES2FunctionPointer>( - glGenerateMipmap), }, - { "glGenFramebuffers", reinterpret_cast<GLES2FunctionPointer>( - glGenFramebuffers), }, - { "glGenRenderbuffers", reinterpret_cast<GLES2FunctionPointer>( - glGenRenderbuffers), }, - { "glGenTextures", reinterpret_cast<GLES2FunctionPointer>(glGenTextures), }, - { "glGetActiveAttrib", reinterpret_cast<GLES2FunctionPointer>( - glGetActiveAttrib), }, - { "glGetActiveUniform", reinterpret_cast<GLES2FunctionPointer>( - glGetActiveUniform), }, - { "glGetAttachedShaders", reinterpret_cast<GLES2FunctionPointer>( - glGetAttachedShaders), }, - { "glGetAttribLocation", reinterpret_cast<GLES2FunctionPointer>( - glGetAttribLocation), }, - { "glGetBooleanv", reinterpret_cast<GLES2FunctionPointer>(glGetBooleanv), }, - { "glGetBufferParameteriv", reinterpret_cast<GLES2FunctionPointer>( - glGetBufferParameteriv), }, - { "glGetError", reinterpret_cast<GLES2FunctionPointer>(glGetError), }, - { "glGetFloatv", reinterpret_cast<GLES2FunctionPointer>(glGetFloatv), }, - { "glGetFramebufferAttachmentParameteriv", reinterpret_cast<GLES2FunctionPointer>(glGetFramebufferAttachmentParameteriv), }, // NOLINT - { "glGetIntegerv", reinterpret_cast<GLES2FunctionPointer>(glGetIntegerv), }, - { "glGetProgramiv", reinterpret_cast<GLES2FunctionPointer>( - glGetProgramiv), }, - { "glGetProgramInfoLog", reinterpret_cast<GLES2FunctionPointer>( - glGetProgramInfoLog), }, - { "glGetRenderbufferParameteriv", reinterpret_cast<GLES2FunctionPointer>( - glGetRenderbufferParameteriv), }, - { "glGetShaderiv", reinterpret_cast<GLES2FunctionPointer>(glGetShaderiv), }, - { "glGetShaderInfoLog", reinterpret_cast<GLES2FunctionPointer>( - glGetShaderInfoLog), }, - { "glGetShaderPrecisionFormat", reinterpret_cast<GLES2FunctionPointer>( - glGetShaderPrecisionFormat), }, - { "glGetShaderSource", reinterpret_cast<GLES2FunctionPointer>( - glGetShaderSource), }, - { "glGetString", reinterpret_cast<GLES2FunctionPointer>(glGetString), }, - { "glGetTexParameterfv", reinterpret_cast<GLES2FunctionPointer>( - glGetTexParameterfv), }, - { "glGetTexParameteriv", reinterpret_cast<GLES2FunctionPointer>( - glGetTexParameteriv), }, - { "glGetUniformfv", reinterpret_cast<GLES2FunctionPointer>( - glGetUniformfv), }, - { "glGetUniformiv", reinterpret_cast<GLES2FunctionPointer>( - glGetUniformiv), }, - { "glGetUniformLocation", reinterpret_cast<GLES2FunctionPointer>( - glGetUniformLocation), }, - { "glGetVertexAttribfv", reinterpret_cast<GLES2FunctionPointer>( - glGetVertexAttribfv), }, - { "glGetVertexAttribiv", reinterpret_cast<GLES2FunctionPointer>( - glGetVertexAttribiv), }, - { "glGetVertexAttribPointerv", reinterpret_cast<GLES2FunctionPointer>( - glGetVertexAttribPointerv), }, - { "glHint", reinterpret_cast<GLES2FunctionPointer>(glHint), }, - { "glIsBuffer", reinterpret_cast<GLES2FunctionPointer>(glIsBuffer), }, - { "glIsEnabled", reinterpret_cast<GLES2FunctionPointer>(glIsEnabled), }, - { "glIsFramebuffer", reinterpret_cast<GLES2FunctionPointer>( - glIsFramebuffer), }, - { "glIsProgram", reinterpret_cast<GLES2FunctionPointer>(glIsProgram), }, - { "glIsRenderbuffer", reinterpret_cast<GLES2FunctionPointer>( - glIsRenderbuffer), }, - { "glIsShader", reinterpret_cast<GLES2FunctionPointer>(glIsShader), }, - { "glIsTexture", reinterpret_cast<GLES2FunctionPointer>(glIsTexture), }, - { "glLineWidth", reinterpret_cast<GLES2FunctionPointer>(glLineWidth), }, - { "glLinkProgram", reinterpret_cast<GLES2FunctionPointer>(glLinkProgram), }, - { "glPixelStorei", reinterpret_cast<GLES2FunctionPointer>(glPixelStorei), }, - { "glPolygonOffset", reinterpret_cast<GLES2FunctionPointer>( - glPolygonOffset), }, - { "glReadPixels", reinterpret_cast<GLES2FunctionPointer>(glReadPixels), }, - { "glReleaseShaderCompiler", reinterpret_cast<GLES2FunctionPointer>( - glReleaseShaderCompiler), }, - { "glRenderbufferStorage", reinterpret_cast<GLES2FunctionPointer>( - glRenderbufferStorage), }, - { "glSampleCoverage", reinterpret_cast<GLES2FunctionPointer>( - glSampleCoverage), }, - { "glScissor", reinterpret_cast<GLES2FunctionPointer>(glScissor), }, - { "glShaderBinary", reinterpret_cast<GLES2FunctionPointer>( - glShaderBinary), }, - { "glShaderSource", reinterpret_cast<GLES2FunctionPointer>( - glShaderSource), }, - { "glShallowFinishCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glShallowFinishCHROMIUM), }, - { "glShallowFlushCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glShallowFlushCHROMIUM), }, - { "glStencilFunc", reinterpret_cast<GLES2FunctionPointer>(glStencilFunc), }, - { "glStencilFuncSeparate", reinterpret_cast<GLES2FunctionPointer>( - glStencilFuncSeparate), }, - { "glStencilMask", reinterpret_cast<GLES2FunctionPointer>(glStencilMask), }, - { "glStencilMaskSeparate", reinterpret_cast<GLES2FunctionPointer>( - glStencilMaskSeparate), }, - { "glStencilOp", reinterpret_cast<GLES2FunctionPointer>(glStencilOp), }, - { "glStencilOpSeparate", reinterpret_cast<GLES2FunctionPointer>( - glStencilOpSeparate), }, - { "glTexImage2D", reinterpret_cast<GLES2FunctionPointer>(glTexImage2D), }, - { "glTexParameterf", reinterpret_cast<GLES2FunctionPointer>( - glTexParameterf), }, - { "glTexParameterfv", reinterpret_cast<GLES2FunctionPointer>( - glTexParameterfv), }, - { "glTexParameteri", reinterpret_cast<GLES2FunctionPointer>( - glTexParameteri), }, - { "glTexParameteriv", reinterpret_cast<GLES2FunctionPointer>( - glTexParameteriv), }, - { "glTexSubImage2D", reinterpret_cast<GLES2FunctionPointer>( - glTexSubImage2D), }, - { "glUniform1f", reinterpret_cast<GLES2FunctionPointer>(glUniform1f), }, - { "glUniform1fv", reinterpret_cast<GLES2FunctionPointer>(glUniform1fv), }, - { "glUniform1i", reinterpret_cast<GLES2FunctionPointer>(glUniform1i), }, - { "glUniform1iv", reinterpret_cast<GLES2FunctionPointer>(glUniform1iv), }, - { "glUniform2f", reinterpret_cast<GLES2FunctionPointer>(glUniform2f), }, - { "glUniform2fv", reinterpret_cast<GLES2FunctionPointer>(glUniform2fv), }, - { "glUniform2i", reinterpret_cast<GLES2FunctionPointer>(glUniform2i), }, - { "glUniform2iv", reinterpret_cast<GLES2FunctionPointer>(glUniform2iv), }, - { "glUniform3f", reinterpret_cast<GLES2FunctionPointer>(glUniform3f), }, - { "glUniform3fv", reinterpret_cast<GLES2FunctionPointer>(glUniform3fv), }, - { "glUniform3i", reinterpret_cast<GLES2FunctionPointer>(glUniform3i), }, - { "glUniform3iv", reinterpret_cast<GLES2FunctionPointer>(glUniform3iv), }, - { "glUniform4f", reinterpret_cast<GLES2FunctionPointer>(glUniform4f), }, - { "glUniform4fv", reinterpret_cast<GLES2FunctionPointer>(glUniform4fv), }, - { "glUniform4i", reinterpret_cast<GLES2FunctionPointer>(glUniform4i), }, - { "glUniform4iv", reinterpret_cast<GLES2FunctionPointer>(glUniform4iv), }, - { "glUniformMatrix2fv", reinterpret_cast<GLES2FunctionPointer>( - glUniformMatrix2fv), }, - { "glUniformMatrix3fv", reinterpret_cast<GLES2FunctionPointer>( - glUniformMatrix3fv), }, - { "glUniformMatrix4fv", reinterpret_cast<GLES2FunctionPointer>( - glUniformMatrix4fv), }, - { "glUseProgram", reinterpret_cast<GLES2FunctionPointer>(glUseProgram), }, - { "glValidateProgram", reinterpret_cast<GLES2FunctionPointer>( - glValidateProgram), }, - { "glVertexAttrib1f", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttrib1f), }, - { "glVertexAttrib1fv", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttrib1fv), }, - { "glVertexAttrib2f", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttrib2f), }, - { "glVertexAttrib2fv", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttrib2fv), }, - { "glVertexAttrib3f", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttrib3f), }, - { "glVertexAttrib3fv", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttrib3fv), }, - { "glVertexAttrib4f", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttrib4f), }, - { "glVertexAttrib4fv", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttrib4fv), }, - { "glVertexAttribPointer", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttribPointer), }, - { "glViewport", reinterpret_cast<GLES2FunctionPointer>(glViewport), }, - { "glBlitFramebufferCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glBlitFramebufferCHROMIUM), }, - { "glRenderbufferStorageMultisampleCHROMIUM", reinterpret_cast<GLES2FunctionPointer>(glRenderbufferStorageMultisampleCHROMIUM), }, // NOLINT - { "glRenderbufferStorageMultisampleEXT", reinterpret_cast<GLES2FunctionPointer>(glRenderbufferStorageMultisampleEXT), }, // NOLINT - { "glFramebufferTexture2DMultisampleEXT", reinterpret_cast<GLES2FunctionPointer>(glFramebufferTexture2DMultisampleEXT), }, // NOLINT - { "glTexStorage2DEXT", reinterpret_cast<GLES2FunctionPointer>( - glTexStorage2DEXT), }, - { "glGenQueriesEXT", reinterpret_cast<GLES2FunctionPointer>( - glGenQueriesEXT), }, - { "glDeleteQueriesEXT", reinterpret_cast<GLES2FunctionPointer>( - glDeleteQueriesEXT), }, - { "glIsQueryEXT", reinterpret_cast<GLES2FunctionPointer>(glIsQueryEXT), }, - { "glBeginQueryEXT", reinterpret_cast<GLES2FunctionPointer>( - glBeginQueryEXT), }, - { "glEndQueryEXT", reinterpret_cast<GLES2FunctionPointer>(glEndQueryEXT), }, - { "glGetQueryivEXT", reinterpret_cast<GLES2FunctionPointer>( - glGetQueryivEXT), }, - { "glGetQueryObjectuivEXT", reinterpret_cast<GLES2FunctionPointer>( - glGetQueryObjectuivEXT), }, - { "glInsertEventMarkerEXT", reinterpret_cast<GLES2FunctionPointer>( - glInsertEventMarkerEXT), }, - { "glPushGroupMarkerEXT", reinterpret_cast<GLES2FunctionPointer>( - glPushGroupMarkerEXT), }, - { "glPopGroupMarkerEXT", reinterpret_cast<GLES2FunctionPointer>( - glPopGroupMarkerEXT), }, - { "glGenVertexArraysOES", reinterpret_cast<GLES2FunctionPointer>( - glGenVertexArraysOES), }, - { "glDeleteVertexArraysOES", reinterpret_cast<GLES2FunctionPointer>( - glDeleteVertexArraysOES), }, - { "glIsVertexArrayOES", reinterpret_cast<GLES2FunctionPointer>( - glIsVertexArrayOES), }, - { "glBindVertexArrayOES", reinterpret_cast<GLES2FunctionPointer>( - glBindVertexArrayOES), }, - { "glSwapBuffers", reinterpret_cast<GLES2FunctionPointer>(glSwapBuffers), }, - { "glGetMaxValueInBufferCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glGetMaxValueInBufferCHROMIUM), }, - { "glGenSharedIdsCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glGenSharedIdsCHROMIUM), }, - { "glDeleteSharedIdsCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glDeleteSharedIdsCHROMIUM), }, - { "glRegisterSharedIdsCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glRegisterSharedIdsCHROMIUM), }, - { "glEnableFeatureCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glEnableFeatureCHROMIUM), }, - { "glMapBufferCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glMapBufferCHROMIUM), }, - { "glUnmapBufferCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glUnmapBufferCHROMIUM), }, - { "glMapImageCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glMapImageCHROMIUM), }, - { "glUnmapImageCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glUnmapImageCHROMIUM), }, - { "glMapBufferSubDataCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glMapBufferSubDataCHROMIUM), }, - { "glUnmapBufferSubDataCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glUnmapBufferSubDataCHROMIUM), }, - { "glMapTexSubImage2DCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glMapTexSubImage2DCHROMIUM), }, - { "glUnmapTexSubImage2DCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glUnmapTexSubImage2DCHROMIUM), }, - { "glResizeCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glResizeCHROMIUM), }, - { "glGetRequestableExtensionsCHROMIUM", reinterpret_cast<GLES2FunctionPointer>(glGetRequestableExtensionsCHROMIUM), }, // NOLINT - { "glRequestExtensionCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glRequestExtensionCHROMIUM), }, - { "glRateLimitOffscreenContextCHROMIUM", reinterpret_cast<GLES2FunctionPointer>(glRateLimitOffscreenContextCHROMIUM), }, // NOLINT - { "glGetMultipleIntegervCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glGetMultipleIntegervCHROMIUM), }, - { "glGetProgramInfoCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glGetProgramInfoCHROMIUM), }, - { "glCreateStreamTextureCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glCreateStreamTextureCHROMIUM), }, - { "glDestroyStreamTextureCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glDestroyStreamTextureCHROMIUM), }, - { "glCreateImageCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glCreateImageCHROMIUM), }, - { "glDestroyImageCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glDestroyImageCHROMIUM), }, - { "glGetImageParameterivCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glGetImageParameterivCHROMIUM), }, - { "glGetTranslatedShaderSourceANGLE", reinterpret_cast<GLES2FunctionPointer>( - glGetTranslatedShaderSourceANGLE), }, - { "glPostSubBufferCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glPostSubBufferCHROMIUM), }, - { "glTexImageIOSurface2DCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glTexImageIOSurface2DCHROMIUM), }, - { "glCopyTextureCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glCopyTextureCHROMIUM), }, - { "glDrawArraysInstancedANGLE", reinterpret_cast<GLES2FunctionPointer>( - glDrawArraysInstancedANGLE), }, - { "glDrawElementsInstancedANGLE", reinterpret_cast<GLES2FunctionPointer>( - glDrawElementsInstancedANGLE), }, - { "glVertexAttribDivisorANGLE", reinterpret_cast<GLES2FunctionPointer>( - glVertexAttribDivisorANGLE), }, - { "glGenMailboxCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glGenMailboxCHROMIUM), }, - { "glProduceTextureCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glProduceTextureCHROMIUM), }, - { "glConsumeTextureCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glConsumeTextureCHROMIUM), }, - { "glBindUniformLocationCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glBindUniformLocationCHROMIUM), }, - { "glBindTexImage2DCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glBindTexImage2DCHROMIUM), }, - { "glReleaseTexImage2DCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glReleaseTexImage2DCHROMIUM), }, - { "glTraceBeginCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glTraceBeginCHROMIUM), }, - { "glTraceEndCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glTraceEndCHROMIUM), }, - { "glAsyncTexSubImage2DCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glAsyncTexSubImage2DCHROMIUM), }, - { "glAsyncTexImage2DCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glAsyncTexImage2DCHROMIUM), }, - { "glWaitAsyncTexImage2DCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glWaitAsyncTexImage2DCHROMIUM), }, - { "glDiscardFramebufferEXT", reinterpret_cast<GLES2FunctionPointer>( - glDiscardFramebufferEXT), }, - { "glLoseContextCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glLoseContextCHROMIUM), }, - { "glInsertSyncPointCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glInsertSyncPointCHROMIUM), }, - { "glWaitSyncPointCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glWaitSyncPointCHROMIUM), }, - { "glDrawBuffersEXT", reinterpret_cast<GLES2FunctionPointer>( - glDrawBuffersEXT), }, - { "glDiscardBackbufferCHROMIUM", reinterpret_cast<GLES2FunctionPointer>( - glDiscardBackbufferCHROMIUM), }, - { NULL, NULL, }, + { + "glActiveTexture", reinterpret_cast<GLES2FunctionPointer>(glActiveTexture), + }, + { + "glAttachShader", reinterpret_cast<GLES2FunctionPointer>(glAttachShader), + }, + { + "glBindAttribLocation", + reinterpret_cast<GLES2FunctionPointer>(glBindAttribLocation), + }, + { + "glBindBuffer", reinterpret_cast<GLES2FunctionPointer>(glBindBuffer), + }, + { + "glBindFramebuffer", + reinterpret_cast<GLES2FunctionPointer>(glBindFramebuffer), + }, + { + "glBindRenderbuffer", + reinterpret_cast<GLES2FunctionPointer>(glBindRenderbuffer), + }, + { + "glBindTexture", reinterpret_cast<GLES2FunctionPointer>(glBindTexture), + }, + { + "glBlendColor", reinterpret_cast<GLES2FunctionPointer>(glBlendColor), + }, + { + "glBlendEquation", reinterpret_cast<GLES2FunctionPointer>(glBlendEquation), + }, + { + "glBlendEquationSeparate", + reinterpret_cast<GLES2FunctionPointer>(glBlendEquationSeparate), + }, + { + "glBlendFunc", reinterpret_cast<GLES2FunctionPointer>(glBlendFunc), + }, + { + "glBlendFuncSeparate", + reinterpret_cast<GLES2FunctionPointer>(glBlendFuncSeparate), + }, + { + "glBufferData", reinterpret_cast<GLES2FunctionPointer>(glBufferData), + }, + { + "glBufferSubData", reinterpret_cast<GLES2FunctionPointer>(glBufferSubData), + }, + { + "glCheckFramebufferStatus", + reinterpret_cast<GLES2FunctionPointer>(glCheckFramebufferStatus), + }, + { + "glClear", reinterpret_cast<GLES2FunctionPointer>(glClear), + }, + { + "glClearColor", reinterpret_cast<GLES2FunctionPointer>(glClearColor), + }, + { + "glClearDepthf", reinterpret_cast<GLES2FunctionPointer>(glClearDepthf), + }, + { + "glClearStencil", reinterpret_cast<GLES2FunctionPointer>(glClearStencil), + }, + { + "glColorMask", reinterpret_cast<GLES2FunctionPointer>(glColorMask), + }, + { + "glCompileShader", reinterpret_cast<GLES2FunctionPointer>(glCompileShader), + }, + { + "glCompressedTexImage2D", + reinterpret_cast<GLES2FunctionPointer>(glCompressedTexImage2D), + }, + { + "glCompressedTexSubImage2D", + reinterpret_cast<GLES2FunctionPointer>(glCompressedTexSubImage2D), + }, + { + "glCopyTexImage2D", + reinterpret_cast<GLES2FunctionPointer>(glCopyTexImage2D), + }, + { + "glCopyTexSubImage2D", + reinterpret_cast<GLES2FunctionPointer>(glCopyTexSubImage2D), + }, + { + "glCreateProgram", reinterpret_cast<GLES2FunctionPointer>(glCreateProgram), + }, + { + "glCreateShader", reinterpret_cast<GLES2FunctionPointer>(glCreateShader), + }, + { + "glCullFace", reinterpret_cast<GLES2FunctionPointer>(glCullFace), + }, + { + "glDeleteBuffers", reinterpret_cast<GLES2FunctionPointer>(glDeleteBuffers), + }, + { + "glDeleteFramebuffers", + reinterpret_cast<GLES2FunctionPointer>(glDeleteFramebuffers), + }, + { + "glDeleteProgram", reinterpret_cast<GLES2FunctionPointer>(glDeleteProgram), + }, + { + "glDeleteRenderbuffers", + reinterpret_cast<GLES2FunctionPointer>(glDeleteRenderbuffers), + }, + { + "glDeleteShader", reinterpret_cast<GLES2FunctionPointer>(glDeleteShader), + }, + { + "glDeleteTextures", + reinterpret_cast<GLES2FunctionPointer>(glDeleteTextures), + }, + { + "glDepthFunc", reinterpret_cast<GLES2FunctionPointer>(glDepthFunc), + }, + { + "glDepthMask", reinterpret_cast<GLES2FunctionPointer>(glDepthMask), + }, + { + "glDepthRangef", reinterpret_cast<GLES2FunctionPointer>(glDepthRangef), + }, + { + "glDetachShader", reinterpret_cast<GLES2FunctionPointer>(glDetachShader), + }, + { + "glDisable", reinterpret_cast<GLES2FunctionPointer>(glDisable), + }, + { + "glDisableVertexAttribArray", + reinterpret_cast<GLES2FunctionPointer>(glDisableVertexAttribArray), + }, + { + "glDrawArrays", reinterpret_cast<GLES2FunctionPointer>(glDrawArrays), + }, + { + "glDrawElements", reinterpret_cast<GLES2FunctionPointer>(glDrawElements), + }, + { + "glEnable", reinterpret_cast<GLES2FunctionPointer>(glEnable), + }, + { + "glEnableVertexAttribArray", + reinterpret_cast<GLES2FunctionPointer>(glEnableVertexAttribArray), + }, + { + "glFinish", reinterpret_cast<GLES2FunctionPointer>(glFinish), + }, + { + "glFlush", reinterpret_cast<GLES2FunctionPointer>(glFlush), + }, + { + "glFramebufferRenderbuffer", + reinterpret_cast<GLES2FunctionPointer>(glFramebufferRenderbuffer), + }, + { + "glFramebufferTexture2D", + reinterpret_cast<GLES2FunctionPointer>(glFramebufferTexture2D), + }, + { + "glFrontFace", reinterpret_cast<GLES2FunctionPointer>(glFrontFace), + }, + { + "glGenBuffers", reinterpret_cast<GLES2FunctionPointer>(glGenBuffers), + }, + { + "glGenerateMipmap", + reinterpret_cast<GLES2FunctionPointer>(glGenerateMipmap), + }, + { + "glGenFramebuffers", + reinterpret_cast<GLES2FunctionPointer>(glGenFramebuffers), + }, + { + "glGenRenderbuffers", + reinterpret_cast<GLES2FunctionPointer>(glGenRenderbuffers), + }, + { + "glGenTextures", reinterpret_cast<GLES2FunctionPointer>(glGenTextures), + }, + { + "glGetActiveAttrib", + reinterpret_cast<GLES2FunctionPointer>(glGetActiveAttrib), + }, + { + "glGetActiveUniform", + reinterpret_cast<GLES2FunctionPointer>(glGetActiveUniform), + }, + { + "glGetAttachedShaders", + reinterpret_cast<GLES2FunctionPointer>(glGetAttachedShaders), + }, + { + "glGetAttribLocation", + reinterpret_cast<GLES2FunctionPointer>(glGetAttribLocation), + }, + { + "glGetBooleanv", reinterpret_cast<GLES2FunctionPointer>(glGetBooleanv), + }, + { + "glGetBufferParameteriv", + reinterpret_cast<GLES2FunctionPointer>(glGetBufferParameteriv), + }, + { + "glGetError", reinterpret_cast<GLES2FunctionPointer>(glGetError), + }, + { + "glGetFloatv", reinterpret_cast<GLES2FunctionPointer>(glGetFloatv), + }, + { + "glGetFramebufferAttachmentParameteriv", + reinterpret_cast<GLES2FunctionPointer>( + glGetFramebufferAttachmentParameteriv), + }, + { + "glGetIntegerv", reinterpret_cast<GLES2FunctionPointer>(glGetIntegerv), + }, + { + "glGetProgramiv", reinterpret_cast<GLES2FunctionPointer>(glGetProgramiv), + }, + { + "glGetProgramInfoLog", + reinterpret_cast<GLES2FunctionPointer>(glGetProgramInfoLog), + }, + { + "glGetRenderbufferParameteriv", + reinterpret_cast<GLES2FunctionPointer>(glGetRenderbufferParameteriv), + }, + { + "glGetShaderiv", reinterpret_cast<GLES2FunctionPointer>(glGetShaderiv), + }, + { + "glGetShaderInfoLog", + reinterpret_cast<GLES2FunctionPointer>(glGetShaderInfoLog), + }, + { + "glGetShaderPrecisionFormat", + reinterpret_cast<GLES2FunctionPointer>(glGetShaderPrecisionFormat), + }, + { + "glGetShaderSource", + reinterpret_cast<GLES2FunctionPointer>(glGetShaderSource), + }, + { + "glGetString", reinterpret_cast<GLES2FunctionPointer>(glGetString), + }, + { + "glGetTexParameterfv", + reinterpret_cast<GLES2FunctionPointer>(glGetTexParameterfv), + }, + { + "glGetTexParameteriv", + reinterpret_cast<GLES2FunctionPointer>(glGetTexParameteriv), + }, + { + "glGetUniformfv", reinterpret_cast<GLES2FunctionPointer>(glGetUniformfv), + }, + { + "glGetUniformiv", reinterpret_cast<GLES2FunctionPointer>(glGetUniformiv), + }, + { + "glGetUniformLocation", + reinterpret_cast<GLES2FunctionPointer>(glGetUniformLocation), + }, + { + "glGetVertexAttribfv", + reinterpret_cast<GLES2FunctionPointer>(glGetVertexAttribfv), + }, + { + "glGetVertexAttribiv", + reinterpret_cast<GLES2FunctionPointer>(glGetVertexAttribiv), + }, + { + "glGetVertexAttribPointerv", + reinterpret_cast<GLES2FunctionPointer>(glGetVertexAttribPointerv), + }, + { + "glHint", reinterpret_cast<GLES2FunctionPointer>(glHint), + }, + { + "glIsBuffer", reinterpret_cast<GLES2FunctionPointer>(glIsBuffer), + }, + { + "glIsEnabled", reinterpret_cast<GLES2FunctionPointer>(glIsEnabled), + }, + { + "glIsFramebuffer", reinterpret_cast<GLES2FunctionPointer>(glIsFramebuffer), + }, + { + "glIsProgram", reinterpret_cast<GLES2FunctionPointer>(glIsProgram), + }, + { + "glIsRenderbuffer", + reinterpret_cast<GLES2FunctionPointer>(glIsRenderbuffer), + }, + { + "glIsShader", reinterpret_cast<GLES2FunctionPointer>(glIsShader), + }, + { + "glIsTexture", reinterpret_cast<GLES2FunctionPointer>(glIsTexture), + }, + { + "glLineWidth", reinterpret_cast<GLES2FunctionPointer>(glLineWidth), + }, + { + "glLinkProgram", reinterpret_cast<GLES2FunctionPointer>(glLinkProgram), + }, + { + "glPixelStorei", reinterpret_cast<GLES2FunctionPointer>(glPixelStorei), + }, + { + "glPolygonOffset", reinterpret_cast<GLES2FunctionPointer>(glPolygonOffset), + }, + { + "glReadPixels", reinterpret_cast<GLES2FunctionPointer>(glReadPixels), + }, + { + "glReleaseShaderCompiler", + reinterpret_cast<GLES2FunctionPointer>(glReleaseShaderCompiler), + }, + { + "glRenderbufferStorage", + reinterpret_cast<GLES2FunctionPointer>(glRenderbufferStorage), + }, + { + "glSampleCoverage", + reinterpret_cast<GLES2FunctionPointer>(glSampleCoverage), + }, + { + "glScissor", reinterpret_cast<GLES2FunctionPointer>(glScissor), + }, + { + "glShaderBinary", reinterpret_cast<GLES2FunctionPointer>(glShaderBinary), + }, + { + "glShaderSource", reinterpret_cast<GLES2FunctionPointer>(glShaderSource), + }, + { + "glShallowFinishCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glShallowFinishCHROMIUM), + }, + { + "glShallowFlushCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glShallowFlushCHROMIUM), + }, + { + "glStencilFunc", reinterpret_cast<GLES2FunctionPointer>(glStencilFunc), + }, + { + "glStencilFuncSeparate", + reinterpret_cast<GLES2FunctionPointer>(glStencilFuncSeparate), + }, + { + "glStencilMask", reinterpret_cast<GLES2FunctionPointer>(glStencilMask), + }, + { + "glStencilMaskSeparate", + reinterpret_cast<GLES2FunctionPointer>(glStencilMaskSeparate), + }, + { + "glStencilOp", reinterpret_cast<GLES2FunctionPointer>(glStencilOp), + }, + { + "glStencilOpSeparate", + reinterpret_cast<GLES2FunctionPointer>(glStencilOpSeparate), + }, + { + "glTexImage2D", reinterpret_cast<GLES2FunctionPointer>(glTexImage2D), + }, + { + "glTexParameterf", reinterpret_cast<GLES2FunctionPointer>(glTexParameterf), + }, + { + "glTexParameterfv", + reinterpret_cast<GLES2FunctionPointer>(glTexParameterfv), + }, + { + "glTexParameteri", reinterpret_cast<GLES2FunctionPointer>(glTexParameteri), + }, + { + "glTexParameteriv", + reinterpret_cast<GLES2FunctionPointer>(glTexParameteriv), + }, + { + "glTexSubImage2D", reinterpret_cast<GLES2FunctionPointer>(glTexSubImage2D), + }, + { + "glUniform1f", reinterpret_cast<GLES2FunctionPointer>(glUniform1f), + }, + { + "glUniform1fv", reinterpret_cast<GLES2FunctionPointer>(glUniform1fv), + }, + { + "glUniform1i", reinterpret_cast<GLES2FunctionPointer>(glUniform1i), + }, + { + "glUniform1iv", reinterpret_cast<GLES2FunctionPointer>(glUniform1iv), + }, + { + "glUniform2f", reinterpret_cast<GLES2FunctionPointer>(glUniform2f), + }, + { + "glUniform2fv", reinterpret_cast<GLES2FunctionPointer>(glUniform2fv), + }, + { + "glUniform2i", reinterpret_cast<GLES2FunctionPointer>(glUniform2i), + }, + { + "glUniform2iv", reinterpret_cast<GLES2FunctionPointer>(glUniform2iv), + }, + { + "glUniform3f", reinterpret_cast<GLES2FunctionPointer>(glUniform3f), + }, + { + "glUniform3fv", reinterpret_cast<GLES2FunctionPointer>(glUniform3fv), + }, + { + "glUniform3i", reinterpret_cast<GLES2FunctionPointer>(glUniform3i), + }, + { + "glUniform3iv", reinterpret_cast<GLES2FunctionPointer>(glUniform3iv), + }, + { + "glUniform4f", reinterpret_cast<GLES2FunctionPointer>(glUniform4f), + }, + { + "glUniform4fv", reinterpret_cast<GLES2FunctionPointer>(glUniform4fv), + }, + { + "glUniform4i", reinterpret_cast<GLES2FunctionPointer>(glUniform4i), + }, + { + "glUniform4iv", reinterpret_cast<GLES2FunctionPointer>(glUniform4iv), + }, + { + "glUniformMatrix2fv", + reinterpret_cast<GLES2FunctionPointer>(glUniformMatrix2fv), + }, + { + "glUniformMatrix3fv", + reinterpret_cast<GLES2FunctionPointer>(glUniformMatrix3fv), + }, + { + "glUniformMatrix4fv", + reinterpret_cast<GLES2FunctionPointer>(glUniformMatrix4fv), + }, + { + "glUseProgram", reinterpret_cast<GLES2FunctionPointer>(glUseProgram), + }, + { + "glValidateProgram", + reinterpret_cast<GLES2FunctionPointer>(glValidateProgram), + }, + { + "glVertexAttrib1f", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttrib1f), + }, + { + "glVertexAttrib1fv", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttrib1fv), + }, + { + "glVertexAttrib2f", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttrib2f), + }, + { + "glVertexAttrib2fv", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttrib2fv), + }, + { + "glVertexAttrib3f", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttrib3f), + }, + { + "glVertexAttrib3fv", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttrib3fv), + }, + { + "glVertexAttrib4f", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttrib4f), + }, + { + "glVertexAttrib4fv", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttrib4fv), + }, + { + "glVertexAttribPointer", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttribPointer), + }, + { + "glViewport", reinterpret_cast<GLES2FunctionPointer>(glViewport), + }, + { + "glBlitFramebufferCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glBlitFramebufferCHROMIUM), + }, + { + "glRenderbufferStorageMultisampleCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>( + glRenderbufferStorageMultisampleCHROMIUM), + }, + { + "glRenderbufferStorageMultisampleEXT", + reinterpret_cast<GLES2FunctionPointer>( + glRenderbufferStorageMultisampleEXT), + }, + { + "glFramebufferTexture2DMultisampleEXT", + reinterpret_cast<GLES2FunctionPointer>( + glFramebufferTexture2DMultisampleEXT), + }, + { + "glTexStorage2DEXT", + reinterpret_cast<GLES2FunctionPointer>(glTexStorage2DEXT), + }, + { + "glGenQueriesEXT", reinterpret_cast<GLES2FunctionPointer>(glGenQueriesEXT), + }, + { + "glDeleteQueriesEXT", + reinterpret_cast<GLES2FunctionPointer>(glDeleteQueriesEXT), + }, + { + "glIsQueryEXT", reinterpret_cast<GLES2FunctionPointer>(glIsQueryEXT), + }, + { + "glBeginQueryEXT", reinterpret_cast<GLES2FunctionPointer>(glBeginQueryEXT), + }, + { + "glEndQueryEXT", reinterpret_cast<GLES2FunctionPointer>(glEndQueryEXT), + }, + { + "glGetQueryivEXT", reinterpret_cast<GLES2FunctionPointer>(glGetQueryivEXT), + }, + { + "glGetQueryObjectuivEXT", + reinterpret_cast<GLES2FunctionPointer>(glGetQueryObjectuivEXT), + }, + { + "glInsertEventMarkerEXT", + reinterpret_cast<GLES2FunctionPointer>(glInsertEventMarkerEXT), + }, + { + "glPushGroupMarkerEXT", + reinterpret_cast<GLES2FunctionPointer>(glPushGroupMarkerEXT), + }, + { + "glPopGroupMarkerEXT", + reinterpret_cast<GLES2FunctionPointer>(glPopGroupMarkerEXT), + }, + { + "glGenVertexArraysOES", + reinterpret_cast<GLES2FunctionPointer>(glGenVertexArraysOES), + }, + { + "glDeleteVertexArraysOES", + reinterpret_cast<GLES2FunctionPointer>(glDeleteVertexArraysOES), + }, + { + "glIsVertexArrayOES", + reinterpret_cast<GLES2FunctionPointer>(glIsVertexArrayOES), + }, + { + "glBindVertexArrayOES", + reinterpret_cast<GLES2FunctionPointer>(glBindVertexArrayOES), + }, + { + "glSwapBuffers", reinterpret_cast<GLES2FunctionPointer>(glSwapBuffers), + }, + { + "glGetMaxValueInBufferCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glGetMaxValueInBufferCHROMIUM), + }, + { + "glGenSharedIdsCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glGenSharedIdsCHROMIUM), + }, + { + "glDeleteSharedIdsCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glDeleteSharedIdsCHROMIUM), + }, + { + "glRegisterSharedIdsCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glRegisterSharedIdsCHROMIUM), + }, + { + "glEnableFeatureCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glEnableFeatureCHROMIUM), + }, + { + "glMapBufferCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glMapBufferCHROMIUM), + }, + { + "glUnmapBufferCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glUnmapBufferCHROMIUM), + }, + { + "glMapImageCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glMapImageCHROMIUM), + }, + { + "glUnmapImageCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glUnmapImageCHROMIUM), + }, + { + "glMapBufferSubDataCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glMapBufferSubDataCHROMIUM), + }, + { + "glUnmapBufferSubDataCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glUnmapBufferSubDataCHROMIUM), + }, + { + "glMapTexSubImage2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glMapTexSubImage2DCHROMIUM), + }, + { + "glUnmapTexSubImage2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glUnmapTexSubImage2DCHROMIUM), + }, + { + "glResizeCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glResizeCHROMIUM), + }, + { + "glGetRequestableExtensionsCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glGetRequestableExtensionsCHROMIUM), + }, + { + "glRequestExtensionCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glRequestExtensionCHROMIUM), + }, + { + "glRateLimitOffscreenContextCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>( + glRateLimitOffscreenContextCHROMIUM), + }, + { + "glGetMultipleIntegervCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glGetMultipleIntegervCHROMIUM), + }, + { + "glGetProgramInfoCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glGetProgramInfoCHROMIUM), + }, + { + "glCreateStreamTextureCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glCreateStreamTextureCHROMIUM), + }, + { + "glCreateImageCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glCreateImageCHROMIUM), + }, + { + "glDestroyImageCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glDestroyImageCHROMIUM), + }, + { + "glGetImageParameterivCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glGetImageParameterivCHROMIUM), + }, + { + "glGetTranslatedShaderSourceANGLE", + reinterpret_cast<GLES2FunctionPointer>(glGetTranslatedShaderSourceANGLE), + }, + { + "glPostSubBufferCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glPostSubBufferCHROMIUM), + }, + { + "glTexImageIOSurface2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glTexImageIOSurface2DCHROMIUM), + }, + { + "glCopyTextureCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glCopyTextureCHROMIUM), + }, + { + "glDrawArraysInstancedANGLE", + reinterpret_cast<GLES2FunctionPointer>(glDrawArraysInstancedANGLE), + }, + { + "glDrawElementsInstancedANGLE", + reinterpret_cast<GLES2FunctionPointer>(glDrawElementsInstancedANGLE), + }, + { + "glVertexAttribDivisorANGLE", + reinterpret_cast<GLES2FunctionPointer>(glVertexAttribDivisorANGLE), + }, + { + "glGenMailboxCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glGenMailboxCHROMIUM), + }, + { + "glProduceTextureCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glProduceTextureCHROMIUM), + }, + { + "glProduceTextureDirectCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glProduceTextureDirectCHROMIUM), + }, + { + "glConsumeTextureCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glConsumeTextureCHROMIUM), + }, + { + "glCreateAndConsumeTextureCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glCreateAndConsumeTextureCHROMIUM), + }, + { + "glBindUniformLocationCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glBindUniformLocationCHROMIUM), + }, + { + "glBindTexImage2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glBindTexImage2DCHROMIUM), + }, + { + "glReleaseTexImage2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glReleaseTexImage2DCHROMIUM), + }, + { + "glTraceBeginCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glTraceBeginCHROMIUM), + }, + { + "glTraceEndCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glTraceEndCHROMIUM), + }, + { + "glAsyncTexSubImage2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glAsyncTexSubImage2DCHROMIUM), + }, + { + "glAsyncTexImage2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glAsyncTexImage2DCHROMIUM), + }, + { + "glWaitAsyncTexImage2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glWaitAsyncTexImage2DCHROMIUM), + }, + { + "glWaitAllAsyncTexImage2DCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glWaitAllAsyncTexImage2DCHROMIUM), + }, + { + "glDiscardFramebufferEXT", + reinterpret_cast<GLES2FunctionPointer>(glDiscardFramebufferEXT), + }, + { + "glLoseContextCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glLoseContextCHROMIUM), + }, + { + "glInsertSyncPointCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glInsertSyncPointCHROMIUM), + }, + { + "glWaitSyncPointCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glWaitSyncPointCHROMIUM), + }, + { + "glDrawBuffersEXT", + reinterpret_cast<GLES2FunctionPointer>(glDrawBuffersEXT), + }, + { + "glDiscardBackbufferCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glDiscardBackbufferCHROMIUM), + }, + { + "glScheduleOverlayPlaneCHROMIUM", + reinterpret_cast<GLES2FunctionPointer>(glScheduleOverlayPlaneCHROMIUM), + }, + { + NULL, NULL, + }, }; } // namespace gles2 #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_C_LIB_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/gles2_cmd_helper.h b/chromium/gpu/command_buffer/client/gles2_cmd_helper.h index 72fae315b34..0726fbb4d4c 100644 --- a/chromium/gpu/command_buffer/client/gles2_cmd_helper.h +++ b/chromium/gpu/command_buffer/client/gles2_cmd_helper.h @@ -25,48 +25,36 @@ class GPU_EXPORT GLES2CmdHelper : public CommandBufferHelper { // Helpers that could not be auto-generated. // TODO(gman): Auto generate these. - void GetAttribLocation( - GLuint program, uint32 name_shm_id, uint32 name_shm_offset, - uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) { - gles2::cmds::GetAttribLocation* c = - GetCmdSpace<gles2::cmds::GetAttribLocation>(); - if (c) { - c->Init( - program, name_shm_id, name_shm_offset, location_shm_id, - location_shm_offset, data_size); - } - } - - void GetAttribLocationBucket( GLuint program, uint32 name_bucket_id, uint32 location_shm_id, uint32 location_shm_offset) { - gles2::cmds::GetAttribLocationBucket* c = - GetCmdSpace<gles2::cmds::GetAttribLocationBucket>(); + gles2::cmds::GetAttribLocation* c = + GetCmdSpace<gles2::cmds::GetAttribLocation>(); if (c) { c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); } } void GetUniformLocation( - GLuint program, uint32 name_shm_id, uint32 name_shm_offset, - uint32 location_shm_id, uint32 location_shm_offset, uint32 data_size) { + GLuint program, uint32 name_bucket_id, + uint32 location_shm_id, uint32 location_shm_offset) { gles2::cmds::GetUniformLocation* c = GetCmdSpace<gles2::cmds::GetUniformLocation>(); if (c) { - c->Init( - program, name_shm_id, name_shm_offset, location_shm_id, - location_shm_offset, data_size); + c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); } } - void GetUniformLocationBucket( - GLuint program, uint32 name_bucket_id, - uint32 location_shm_id, uint32 location_shm_offset) { - gles2::cmds::GetUniformLocationBucket* c = - GetCmdSpace<gles2::cmds::GetUniformLocationBucket>(); + void CreateAndConsumeTextureCHROMIUMImmediate(GLenum target, + uint32_t client_id, + const GLbyte* _mailbox) { + const uint32_t size = + gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate::ComputeSize(); + gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate* c = + GetImmediateCmdSpaceTotalSize< + gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate>(size); if (c) { - c->Init(program, name_bucket_id, location_shm_id, location_shm_offset); + c->Init(target, client_id, _mailbox); } } diff --git a/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h index 76a9f4a1267..49d03362a31 100644 --- a/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -1,2026 +1,1925 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_AUTOGEN_H_ #define GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_AUTOGEN_H_ - void ActiveTexture(GLenum texture) { - gles2::cmds::ActiveTexture* c = GetCmdSpace<gles2::cmds::ActiveTexture>(); - if (c) { - c->Init(texture); - } +void ActiveTexture(GLenum texture) { + gles2::cmds::ActiveTexture* c = GetCmdSpace<gles2::cmds::ActiveTexture>(); + if (c) { + c->Init(texture); } +} - void AttachShader(GLuint program, GLuint shader) { - gles2::cmds::AttachShader* c = GetCmdSpace<gles2::cmds::AttachShader>(); - if (c) { - c->Init(program, shader); - } - } - - void BindAttribLocation( - GLuint program, GLuint index, uint32 name_shm_id, uint32 name_shm_offset, - uint32 data_size) { - gles2::cmds::BindAttribLocation* c = - GetCmdSpace<gles2::cmds::BindAttribLocation>(); - if (c) { - c->Init(program, index, name_shm_id, name_shm_offset, data_size); - } - } - - void BindAttribLocationBucket( - GLuint program, GLuint index, uint32 name_bucket_id) { - gles2::cmds::BindAttribLocationBucket* c = - GetCmdSpace<gles2::cmds::BindAttribLocationBucket>(); - if (c) { - c->Init(program, index, name_bucket_id); - } - } - - void BindBuffer(GLenum target, GLuint buffer) { - gles2::cmds::BindBuffer* c = GetCmdSpace<gles2::cmds::BindBuffer>(); - if (c) { - c->Init(target, buffer); - } - } - - void BindFramebuffer(GLenum target, GLuint framebuffer) { - gles2::cmds::BindFramebuffer* c = - GetCmdSpace<gles2::cmds::BindFramebuffer>(); - if (c) { - c->Init(target, framebuffer); - } - } - - void BindRenderbuffer(GLenum target, GLuint renderbuffer) { - gles2::cmds::BindRenderbuffer* c = - GetCmdSpace<gles2::cmds::BindRenderbuffer>(); - if (c) { - c->Init(target, renderbuffer); - } - } - - void BindTexture(GLenum target, GLuint texture) { - gles2::cmds::BindTexture* c = GetCmdSpace<gles2::cmds::BindTexture>(); - if (c) { - c->Init(target, texture); - } - } - - void BlendColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - gles2::cmds::BlendColor* c = GetCmdSpace<gles2::cmds::BlendColor>(); - if (c) { - c->Init(red, green, blue, alpha); - } - } - - void BlendEquation(GLenum mode) { - gles2::cmds::BlendEquation* c = GetCmdSpace<gles2::cmds::BlendEquation>(); - if (c) { - c->Init(mode); - } - } - - void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { - gles2::cmds::BlendEquationSeparate* c = - GetCmdSpace<gles2::cmds::BlendEquationSeparate>(); - if (c) { - c->Init(modeRGB, modeAlpha); - } - } - - void BlendFunc(GLenum sfactor, GLenum dfactor) { - gles2::cmds::BlendFunc* c = GetCmdSpace<gles2::cmds::BlendFunc>(); - if (c) { - c->Init(sfactor, dfactor); - } - } - - void BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { - gles2::cmds::BlendFuncSeparate* c = - GetCmdSpace<gles2::cmds::BlendFuncSeparate>(); - if (c) { - c->Init(srcRGB, dstRGB, srcAlpha, dstAlpha); - } - } - - void BufferData( - GLenum target, GLsizeiptr size, uint32 data_shm_id, - uint32 data_shm_offset, GLenum usage) { - gles2::cmds::BufferData* c = GetCmdSpace<gles2::cmds::BufferData>(); - if (c) { - c->Init(target, size, data_shm_id, data_shm_offset, usage); - } - } - - void BufferSubData( - GLenum target, GLintptr offset, GLsizeiptr size, uint32 data_shm_id, - uint32 data_shm_offset) { - gles2::cmds::BufferSubData* c = GetCmdSpace<gles2::cmds::BufferSubData>(); - if (c) { - c->Init(target, offset, size, data_shm_id, data_shm_offset); - } - } - - void CheckFramebufferStatus( - GLenum target, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::CheckFramebufferStatus* c = - GetCmdSpace<gles2::cmds::CheckFramebufferStatus>(); - if (c) { - c->Init(target, result_shm_id, result_shm_offset); - } - } - - void Clear(GLbitfield mask) { - gles2::cmds::Clear* c = GetCmdSpace<gles2::cmds::Clear>(); - if (c) { - c->Init(mask); - } - } - - void ClearColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - gles2::cmds::ClearColor* c = GetCmdSpace<gles2::cmds::ClearColor>(); - if (c) { - c->Init(red, green, blue, alpha); - } - } - - void ClearDepthf(GLclampf depth) { - gles2::cmds::ClearDepthf* c = GetCmdSpace<gles2::cmds::ClearDepthf>(); - if (c) { - c->Init(depth); - } - } - - void ClearStencil(GLint s) { - gles2::cmds::ClearStencil* c = GetCmdSpace<gles2::cmds::ClearStencil>(); - if (c) { - c->Init(s); - } - } - - void ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { - gles2::cmds::ColorMask* c = GetCmdSpace<gles2::cmds::ColorMask>(); - if (c) { - c->Init(red, green, blue, alpha); - } - } - - void CompileShader(GLuint shader) { - gles2::cmds::CompileShader* c = GetCmdSpace<gles2::cmds::CompileShader>(); - if (c) { - 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::cmds::CompressedTexImage2D* c = - GetCmdSpace<gles2::cmds::CompressedTexImage2D>(); - if (c) { - c->Init( - target, level, internalformat, width, height, border, imageSize, - data_shm_id, data_shm_offset); - } - } - - void CompressedTexImage2DBucket( - GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, GLuint bucket_id) { - gles2::cmds::CompressedTexImage2DBucket* c = - GetCmdSpace<gles2::cmds::CompressedTexImage2DBucket>(); - if (c) { - c->Init(target, level, internalformat, width, height, border, bucket_id); - } - } - - 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::cmds::CompressedTexSubImage2D* c = - GetCmdSpace<gles2::cmds::CompressedTexSubImage2D>(); - if (c) { - c->Init( - target, level, xoffset, yoffset, width, height, format, imageSize, - data_shm_id, data_shm_offset); - } - } - - void CompressedTexSubImage2DBucket( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLuint bucket_id) { - gles2::cmds::CompressedTexSubImage2DBucket* c = - GetCmdSpace<gles2::cmds::CompressedTexSubImage2DBucket>(); - if (c) { - c->Init( - target, level, xoffset, yoffset, width, height, format, bucket_id); - } - } - - void CopyTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border) { - gles2::cmds::CopyTexImage2D* c = - GetCmdSpace<gles2::cmds::CopyTexImage2D>(); - if (c) { - 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::cmds::CopyTexSubImage2D* c = - GetCmdSpace<gles2::cmds::CopyTexSubImage2D>(); - if (c) { - c->Init(target, level, xoffset, yoffset, x, y, width, height); - } - } - - void CreateProgram(uint32 client_id) { - gles2::cmds::CreateProgram* c = GetCmdSpace<gles2::cmds::CreateProgram>(); - if (c) { - c->Init(client_id); - } - } - - void CreateShader(GLenum type, uint32 client_id) { - gles2::cmds::CreateShader* c = GetCmdSpace<gles2::cmds::CreateShader>(); - if (c) { - c->Init(type, client_id); - } - } - - void CullFace(GLenum mode) { - gles2::cmds::CullFace* c = GetCmdSpace<gles2::cmds::CullFace>(); - if (c) { - c->Init(mode); - } - } - - void DeleteBuffers( - GLsizei n, uint32 buffers_shm_id, uint32 buffers_shm_offset) { - gles2::cmds::DeleteBuffers* c = GetCmdSpace<gles2::cmds::DeleteBuffers>(); - if (c) { - c->Init(n, buffers_shm_id, buffers_shm_offset); - } - } - - void DeleteBuffersImmediate(GLsizei n, const GLuint* buffers) { - const uint32 size = gles2::cmds::DeleteBuffersImmediate::ComputeSize(n); - gles2::cmds::DeleteBuffersImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteBuffersImmediate>( - size); - if (c) { - c->Init(n, buffers); - } - } - - void DeleteFramebuffers( - GLsizei n, uint32 framebuffers_shm_id, uint32 framebuffers_shm_offset) { - gles2::cmds::DeleteFramebuffers* c = - GetCmdSpace<gles2::cmds::DeleteFramebuffers>(); - if (c) { - c->Init(n, framebuffers_shm_id, framebuffers_shm_offset); - } - } - - void DeleteFramebuffersImmediate(GLsizei n, const GLuint* framebuffers) { - const uint32 size = - gles2::cmds::DeleteFramebuffersImmediate::ComputeSize(n); - gles2::cmds::DeleteFramebuffersImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteFramebuffersImmediate>( - size); - if (c) { - c->Init(n, framebuffers); - } - } - - void DeleteProgram(GLuint program) { - gles2::cmds::DeleteProgram* c = GetCmdSpace<gles2::cmds::DeleteProgram>(); - if (c) { - c->Init(program); - } - } - - void DeleteRenderbuffers( - GLsizei n, uint32 renderbuffers_shm_id, - uint32 renderbuffers_shm_offset) { - gles2::cmds::DeleteRenderbuffers* c = - GetCmdSpace<gles2::cmds::DeleteRenderbuffers>(); - if (c) { - c->Init(n, renderbuffers_shm_id, renderbuffers_shm_offset); - } - } - - void DeleteRenderbuffersImmediate(GLsizei n, const GLuint* renderbuffers) { - const uint32 size = - gles2::cmds::DeleteRenderbuffersImmediate::ComputeSize(n); - gles2::cmds::DeleteRenderbuffersImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteRenderbuffersImmediate>(size); // NOLINT - if (c) { - c->Init(n, renderbuffers); - } - } - - void DeleteShader(GLuint shader) { - gles2::cmds::DeleteShader* c = GetCmdSpace<gles2::cmds::DeleteShader>(); - if (c) { - c->Init(shader); - } - } - - void DeleteTextures( - GLsizei n, uint32 textures_shm_id, uint32 textures_shm_offset) { - gles2::cmds::DeleteTextures* c = - GetCmdSpace<gles2::cmds::DeleteTextures>(); - if (c) { - c->Init(n, textures_shm_id, textures_shm_offset); - } - } - - void DeleteTexturesImmediate(GLsizei n, const GLuint* textures) { - const uint32 size = gles2::cmds::DeleteTexturesImmediate::ComputeSize(n); - gles2::cmds::DeleteTexturesImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteTexturesImmediate>( - size); - if (c) { - c->Init(n, textures); - } - } - - void DepthFunc(GLenum func) { - gles2::cmds::DepthFunc* c = GetCmdSpace<gles2::cmds::DepthFunc>(); - if (c) { - c->Init(func); - } - } - - void DepthMask(GLboolean flag) { - gles2::cmds::DepthMask* c = GetCmdSpace<gles2::cmds::DepthMask>(); - if (c) { - c->Init(flag); - } - } - - void DepthRangef(GLclampf zNear, GLclampf zFar) { - gles2::cmds::DepthRangef* c = GetCmdSpace<gles2::cmds::DepthRangef>(); - if (c) { - c->Init(zNear, zFar); - } - } - - void DetachShader(GLuint program, GLuint shader) { - gles2::cmds::DetachShader* c = GetCmdSpace<gles2::cmds::DetachShader>(); - if (c) { - c->Init(program, shader); - } - } - - void Disable(GLenum cap) { - gles2::cmds::Disable* c = GetCmdSpace<gles2::cmds::Disable>(); - if (c) { - c->Init(cap); - } - } - - void DisableVertexAttribArray(GLuint index) { - gles2::cmds::DisableVertexAttribArray* c = - GetCmdSpace<gles2::cmds::DisableVertexAttribArray>(); - if (c) { - c->Init(index); - } - } - - void DrawArrays(GLenum mode, GLint first, GLsizei count) { - gles2::cmds::DrawArrays* c = GetCmdSpace<gles2::cmds::DrawArrays>(); - if (c) { - c->Init(mode, first, count); - } - } - - void DrawElements( - GLenum mode, GLsizei count, GLenum type, GLuint index_offset) { - gles2::cmds::DrawElements* c = GetCmdSpace<gles2::cmds::DrawElements>(); - if (c) { - c->Init(mode, count, type, index_offset); - } - } - - void Enable(GLenum cap) { - gles2::cmds::Enable* c = GetCmdSpace<gles2::cmds::Enable>(); - if (c) { - c->Init(cap); - } - } - - void EnableVertexAttribArray(GLuint index) { - gles2::cmds::EnableVertexAttribArray* c = - GetCmdSpace<gles2::cmds::EnableVertexAttribArray>(); - if (c) { - c->Init(index); - } - } - - void Finish() { - gles2::cmds::Finish* c = GetCmdSpace<gles2::cmds::Finish>(); - if (c) { - c->Init(); - } - } - - void Flush() { - gles2::cmds::Flush* c = GetCmdSpace<gles2::cmds::Flush>(); - if (c) { - c->Init(); - } - } - - void FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, - GLuint renderbuffer) { - gles2::cmds::FramebufferRenderbuffer* c = - GetCmdSpace<gles2::cmds::FramebufferRenderbuffer>(); - if (c) { - c->Init(target, attachment, renderbuffertarget, renderbuffer); - } - } - - void FramebufferTexture2D( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level) { - gles2::cmds::FramebufferTexture2D* c = - GetCmdSpace<gles2::cmds::FramebufferTexture2D>(); - if (c) { - c->Init(target, attachment, textarget, texture, level); - } - } - - void FrontFace(GLenum mode) { - gles2::cmds::FrontFace* c = GetCmdSpace<gles2::cmds::FrontFace>(); - if (c) { - c->Init(mode); - } - } - - void GenBuffers( - GLsizei n, uint32 buffers_shm_id, uint32 buffers_shm_offset) { - gles2::cmds::GenBuffers* c = GetCmdSpace<gles2::cmds::GenBuffers>(); - if (c) { - c->Init(n, buffers_shm_id, buffers_shm_offset); - } - } - - void GenBuffersImmediate(GLsizei n, GLuint* buffers) { - const uint32 size = gles2::cmds::GenBuffersImmediate::ComputeSize(n); - gles2::cmds::GenBuffersImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::GenBuffersImmediate>(size); - if (c) { - c->Init(n, buffers); - } - } - - void GenerateMipmap(GLenum target) { - gles2::cmds::GenerateMipmap* c = - GetCmdSpace<gles2::cmds::GenerateMipmap>(); - if (c) { - c->Init(target); - } - } - - void GenFramebuffers( - GLsizei n, uint32 framebuffers_shm_id, uint32 framebuffers_shm_offset) { - gles2::cmds::GenFramebuffers* c = - GetCmdSpace<gles2::cmds::GenFramebuffers>(); - if (c) { - c->Init(n, framebuffers_shm_id, framebuffers_shm_offset); - } - } - - void GenFramebuffersImmediate(GLsizei n, GLuint* framebuffers) { - const uint32 size = gles2::cmds::GenFramebuffersImmediate::ComputeSize(n); - gles2::cmds::GenFramebuffersImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::GenFramebuffersImmediate>( - size); - if (c) { - c->Init(n, framebuffers); - } - } - - void GenRenderbuffers( - GLsizei n, uint32 renderbuffers_shm_id, - uint32 renderbuffers_shm_offset) { - gles2::cmds::GenRenderbuffers* c = - GetCmdSpace<gles2::cmds::GenRenderbuffers>(); - if (c) { - c->Init(n, renderbuffers_shm_id, renderbuffers_shm_offset); - } - } - - void GenRenderbuffersImmediate(GLsizei n, GLuint* renderbuffers) { - const uint32 size = gles2::cmds::GenRenderbuffersImmediate::ComputeSize(n); - gles2::cmds::GenRenderbuffersImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::GenRenderbuffersImmediate>( - size); - if (c) { - c->Init(n, renderbuffers); - } - } - - void GenTextures( - GLsizei n, uint32 textures_shm_id, uint32 textures_shm_offset) { - gles2::cmds::GenTextures* c = GetCmdSpace<gles2::cmds::GenTextures>(); - if (c) { - c->Init(n, textures_shm_id, textures_shm_offset); - } - } - - void GenTexturesImmediate(GLsizei n, GLuint* textures) { - const uint32 size = gles2::cmds::GenTexturesImmediate::ComputeSize(n); - gles2::cmds::GenTexturesImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::GenTexturesImmediate>(size); - if (c) { - c->Init(n, textures); - } - } - - void GetActiveAttrib( - GLuint program, GLuint index, uint32 name_bucket_id, uint32 result_shm_id, - uint32 result_shm_offset) { - gles2::cmds::GetActiveAttrib* c = - GetCmdSpace<gles2::cmds::GetActiveAttrib>(); - if (c) { - c->Init( - program, index, name_bucket_id, result_shm_id, result_shm_offset); - } - } - - void GetActiveUniform( - GLuint program, GLuint index, uint32 name_bucket_id, uint32 result_shm_id, - uint32 result_shm_offset) { - gles2::cmds::GetActiveUniform* c = - GetCmdSpace<gles2::cmds::GetActiveUniform>(); - if (c) { - c->Init( - program, index, name_bucket_id, result_shm_id, result_shm_offset); - } - } - - void GetAttachedShaders( - GLuint program, uint32 result_shm_id, uint32 result_shm_offset, - uint32 result_size) { - gles2::cmds::GetAttachedShaders* c = - GetCmdSpace<gles2::cmds::GetAttachedShaders>(); - if (c) { - c->Init(program, result_shm_id, result_shm_offset, result_size); - } - } - - void GetBooleanv( - GLenum pname, uint32 params_shm_id, uint32 params_shm_offset) { - gles2::cmds::GetBooleanv* c = GetCmdSpace<gles2::cmds::GetBooleanv>(); - if (c) { - c->Init(pname, params_shm_id, params_shm_offset); - } - } - - void GetBufferParameteriv( - GLenum target, GLenum pname, uint32 params_shm_id, - uint32 params_shm_offset) { - gles2::cmds::GetBufferParameteriv* c = - GetCmdSpace<gles2::cmds::GetBufferParameteriv>(); - if (c) { - c->Init(target, pname, params_shm_id, params_shm_offset); - } - } - - void GetError(uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::GetError* c = GetCmdSpace<gles2::cmds::GetError>(); - if (c) { - c->Init(result_shm_id, result_shm_offset); - } - } - - void GetFloatv( - GLenum pname, uint32 params_shm_id, uint32 params_shm_offset) { - gles2::cmds::GetFloatv* c = GetCmdSpace<gles2::cmds::GetFloatv>(); - if (c) { - 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::cmds::GetFramebufferAttachmentParameteriv* c = - GetCmdSpace<gles2::cmds::GetFramebufferAttachmentParameteriv>(); - if (c) { - c->Init(target, attachment, pname, params_shm_id, params_shm_offset); - } - } - - void GetIntegerv( - GLenum pname, uint32 params_shm_id, uint32 params_shm_offset) { - gles2::cmds::GetIntegerv* c = GetCmdSpace<gles2::cmds::GetIntegerv>(); - if (c) { - c->Init(pname, params_shm_id, params_shm_offset); - } - } - - void GetProgramiv( - GLuint program, GLenum pname, uint32 params_shm_id, - uint32 params_shm_offset) { - gles2::cmds::GetProgramiv* c = GetCmdSpace<gles2::cmds::GetProgramiv>(); - if (c) { - c->Init(program, pname, params_shm_id, params_shm_offset); - } - } - - void GetProgramInfoLog(GLuint program, uint32 bucket_id) { - gles2::cmds::GetProgramInfoLog* c = - GetCmdSpace<gles2::cmds::GetProgramInfoLog>(); - if (c) { - c->Init(program, bucket_id); - } - } - - void GetRenderbufferParameteriv( - GLenum target, GLenum pname, uint32 params_shm_id, - uint32 params_shm_offset) { - gles2::cmds::GetRenderbufferParameteriv* c = - GetCmdSpace<gles2::cmds::GetRenderbufferParameteriv>(); - if (c) { - 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::cmds::GetShaderiv* c = GetCmdSpace<gles2::cmds::GetShaderiv>(); - if (c) { - c->Init(shader, pname, params_shm_id, params_shm_offset); - } - } - - void GetShaderInfoLog(GLuint shader, uint32 bucket_id) { - gles2::cmds::GetShaderInfoLog* c = - GetCmdSpace<gles2::cmds::GetShaderInfoLog>(); - if (c) { - c->Init(shader, bucket_id); - } - } - - void GetShaderPrecisionFormat( - GLenum shadertype, GLenum precisiontype, uint32 result_shm_id, - uint32 result_shm_offset) { - gles2::cmds::GetShaderPrecisionFormat* c = - GetCmdSpace<gles2::cmds::GetShaderPrecisionFormat>(); - if (c) { - c->Init(shadertype, precisiontype, result_shm_id, result_shm_offset); - } - } - - void GetShaderSource(GLuint shader, uint32 bucket_id) { - gles2::cmds::GetShaderSource* c = - GetCmdSpace<gles2::cmds::GetShaderSource>(); - if (c) { - c->Init(shader, bucket_id); - } - } - - void GetString(GLenum name, uint32 bucket_id) { - gles2::cmds::GetString* c = GetCmdSpace<gles2::cmds::GetString>(); - if (c) { - c->Init(name, bucket_id); - } - } - - void GetTexParameterfv( - GLenum target, GLenum pname, uint32 params_shm_id, - uint32 params_shm_offset) { - gles2::cmds::GetTexParameterfv* c = - GetCmdSpace<gles2::cmds::GetTexParameterfv>(); - if (c) { - 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::cmds::GetTexParameteriv* c = - GetCmdSpace<gles2::cmds::GetTexParameteriv>(); - if (c) { - 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::cmds::GetUniformfv* c = GetCmdSpace<gles2::cmds::GetUniformfv>(); - if (c) { - 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::cmds::GetUniformiv* c = GetCmdSpace<gles2::cmds::GetUniformiv>(); - if (c) { - c->Init(program, location, params_shm_id, params_shm_offset); - } - } - - void GetVertexAttribfv( - GLuint index, GLenum pname, uint32 params_shm_id, - uint32 params_shm_offset) { - gles2::cmds::GetVertexAttribfv* c = - GetCmdSpace<gles2::cmds::GetVertexAttribfv>(); - if (c) { - 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::cmds::GetVertexAttribiv* c = - GetCmdSpace<gles2::cmds::GetVertexAttribiv>(); - if (c) { - 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::cmds::GetVertexAttribPointerv* c = - GetCmdSpace<gles2::cmds::GetVertexAttribPointerv>(); - if (c) { - c->Init(index, pname, pointer_shm_id, pointer_shm_offset); - } - } - - void Hint(GLenum target, GLenum mode) { - gles2::cmds::Hint* c = GetCmdSpace<gles2::cmds::Hint>(); - if (c) { - c->Init(target, mode); - } - } - - void IsBuffer( - GLuint buffer, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::IsBuffer* c = GetCmdSpace<gles2::cmds::IsBuffer>(); - if (c) { - c->Init(buffer, result_shm_id, result_shm_offset); - } - } - - void IsEnabled(GLenum cap, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::IsEnabled* c = GetCmdSpace<gles2::cmds::IsEnabled>(); - if (c) { - c->Init(cap, result_shm_id, result_shm_offset); - } - } - - void IsFramebuffer( - GLuint framebuffer, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::IsFramebuffer* c = GetCmdSpace<gles2::cmds::IsFramebuffer>(); - if (c) { - c->Init(framebuffer, result_shm_id, result_shm_offset); - } - } - - void IsProgram( - GLuint program, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::IsProgram* c = GetCmdSpace<gles2::cmds::IsProgram>(); - if (c) { - c->Init(program, result_shm_id, result_shm_offset); - } - } - - void IsRenderbuffer( - GLuint renderbuffer, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::IsRenderbuffer* c = - GetCmdSpace<gles2::cmds::IsRenderbuffer>(); - if (c) { - c->Init(renderbuffer, result_shm_id, result_shm_offset); - } - } - - void IsShader( - GLuint shader, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::IsShader* c = GetCmdSpace<gles2::cmds::IsShader>(); - if (c) { - c->Init(shader, result_shm_id, result_shm_offset); - } - } - - void IsTexture( - GLuint texture, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::IsTexture* c = GetCmdSpace<gles2::cmds::IsTexture>(); - if (c) { - c->Init(texture, result_shm_id, result_shm_offset); - } - } - - void LineWidth(GLfloat width) { - gles2::cmds::LineWidth* c = GetCmdSpace<gles2::cmds::LineWidth>(); - if (c) { - c->Init(width); - } - } - - void LinkProgram(GLuint program) { - gles2::cmds::LinkProgram* c = GetCmdSpace<gles2::cmds::LinkProgram>(); - if (c) { - c->Init(program); - } - } - - void PixelStorei(GLenum pname, GLint param) { - gles2::cmds::PixelStorei* c = GetCmdSpace<gles2::cmds::PixelStorei>(); - if (c) { - c->Init(pname, param); - } - } - - void PolygonOffset(GLfloat factor, GLfloat units) { - gles2::cmds::PolygonOffset* c = GetCmdSpace<gles2::cmds::PolygonOffset>(); - if (c) { - 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, - uint32 result_shm_id, uint32 result_shm_offset, GLboolean async) { - gles2::cmds::ReadPixels* c = GetCmdSpace<gles2::cmds::ReadPixels>(); - if (c) { - c->Init( - x, y, width, height, format, type, pixels_shm_id, pixels_shm_offset, - result_shm_id, result_shm_offset, async); - } - } - - void ReleaseShaderCompiler() { - gles2::cmds::ReleaseShaderCompiler* c = - GetCmdSpace<gles2::cmds::ReleaseShaderCompiler>(); - if (c) { - c->Init(); - } - } - - void RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { - gles2::cmds::RenderbufferStorage* c = - GetCmdSpace<gles2::cmds::RenderbufferStorage>(); - if (c) { - c->Init(target, internalformat, width, height); - } - } - - void SampleCoverage(GLclampf value, GLboolean invert) { - gles2::cmds::SampleCoverage* c = - GetCmdSpace<gles2::cmds::SampleCoverage>(); - if (c) { - c->Init(value, invert); - } - } - - void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { - gles2::cmds::Scissor* c = GetCmdSpace<gles2::cmds::Scissor>(); - if (c) { - c->Init(x, y, width, height); - } - } - - void ShaderBinary( - GLsizei n, uint32 shaders_shm_id, uint32 shaders_shm_offset, - GLenum binaryformat, uint32 binary_shm_id, uint32 binary_shm_offset, - GLsizei length) { - gles2::cmds::ShaderBinary* c = GetCmdSpace<gles2::cmds::ShaderBinary>(); - if (c) { - c->Init( - n, shaders_shm_id, shaders_shm_offset, binaryformat, binary_shm_id, - binary_shm_offset, length); - } - } - - void ShaderSource( - GLuint shader, uint32 data_shm_id, uint32 data_shm_offset, - uint32 data_size) { - gles2::cmds::ShaderSource* c = GetCmdSpace<gles2::cmds::ShaderSource>(); - if (c) { - c->Init(shader, data_shm_id, data_shm_offset, data_size); - } - } - - void ShaderSourceBucket(GLuint shader, uint32 data_bucket_id) { - gles2::cmds::ShaderSourceBucket* c = - GetCmdSpace<gles2::cmds::ShaderSourceBucket>(); - if (c) { - c->Init(shader, data_bucket_id); - } - } - - void StencilFunc(GLenum func, GLint ref, GLuint mask) { - gles2::cmds::StencilFunc* c = GetCmdSpace<gles2::cmds::StencilFunc>(); - if (c) { - c->Init(func, ref, mask); - } - } - - void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { - gles2::cmds::StencilFuncSeparate* c = - GetCmdSpace<gles2::cmds::StencilFuncSeparate>(); - if (c) { - c->Init(face, func, ref, mask); - } - } - - void StencilMask(GLuint mask) { - gles2::cmds::StencilMask* c = GetCmdSpace<gles2::cmds::StencilMask>(); - if (c) { - c->Init(mask); - } - } - - void StencilMaskSeparate(GLenum face, GLuint mask) { - gles2::cmds::StencilMaskSeparate* c = - GetCmdSpace<gles2::cmds::StencilMaskSeparate>(); - if (c) { - c->Init(face, mask); - } - } - - void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { - gles2::cmds::StencilOp* c = GetCmdSpace<gles2::cmds::StencilOp>(); - if (c) { - c->Init(fail, zfail, zpass); - } - } - - void StencilOpSeparate( - GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { - gles2::cmds::StencilOpSeparate* c = - GetCmdSpace<gles2::cmds::StencilOpSeparate>(); - if (c) { - 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::cmds::TexImage2D* c = GetCmdSpace<gles2::cmds::TexImage2D>(); - if (c) { - c->Init( - target, level, internalformat, width, height, border, format, type, - pixels_shm_id, pixels_shm_offset); - } - } - - void TexParameterf(GLenum target, GLenum pname, GLfloat param) { - gles2::cmds::TexParameterf* c = GetCmdSpace<gles2::cmds::TexParameterf>(); - if (c) { - c->Init(target, pname, param); - } - } - - void TexParameterfv( - GLenum target, GLenum pname, uint32 params_shm_id, - uint32 params_shm_offset) { - gles2::cmds::TexParameterfv* c = - GetCmdSpace<gles2::cmds::TexParameterfv>(); - if (c) { - c->Init(target, pname, params_shm_id, params_shm_offset); - } - } - - void TexParameterfvImmediate( - GLenum target, GLenum pname, const GLfloat* params) { - const uint32 size = gles2::cmds::TexParameterfvImmediate::ComputeSize(); - gles2::cmds::TexParameterfvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::TexParameterfvImmediate>( - size); - if (c) { - c->Init(target, pname, params); - } - } +void AttachShader(GLuint program, GLuint shader) { + gles2::cmds::AttachShader* c = GetCmdSpace<gles2::cmds::AttachShader>(); + if (c) { + c->Init(program, shader); + } +} - void TexParameteri(GLenum target, GLenum pname, GLint param) { - gles2::cmds::TexParameteri* c = GetCmdSpace<gles2::cmds::TexParameteri>(); - if (c) { - c->Init(target, pname, param); - } - } +void BindAttribLocationBucket(GLuint program, + GLuint index, + uint32_t name_bucket_id) { + gles2::cmds::BindAttribLocationBucket* c = + GetCmdSpace<gles2::cmds::BindAttribLocationBucket>(); + if (c) { + c->Init(program, index, name_bucket_id); + } +} + +void BindBuffer(GLenum target, GLuint buffer) { + gles2::cmds::BindBuffer* c = GetCmdSpace<gles2::cmds::BindBuffer>(); + if (c) { + c->Init(target, buffer); + } +} + +void BindFramebuffer(GLenum target, GLuint framebuffer) { + gles2::cmds::BindFramebuffer* c = GetCmdSpace<gles2::cmds::BindFramebuffer>(); + if (c) { + c->Init(target, framebuffer); + } +} - void TexParameteriv( - GLenum target, GLenum pname, uint32 params_shm_id, - uint32 params_shm_offset) { - gles2::cmds::TexParameteriv* c = - GetCmdSpace<gles2::cmds::TexParameteriv>(); - if (c) { - c->Init(target, pname, params_shm_id, params_shm_offset); - } +void BindRenderbuffer(GLenum target, GLuint renderbuffer) { + gles2::cmds::BindRenderbuffer* c = + GetCmdSpace<gles2::cmds::BindRenderbuffer>(); + if (c) { + c->Init(target, renderbuffer); } +} - void TexParameterivImmediate( - GLenum target, GLenum pname, const GLint* params) { - const uint32 size = gles2::cmds::TexParameterivImmediate::ComputeSize(); - gles2::cmds::TexParameterivImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::TexParameterivImmediate>( - size); - if (c) { - c->Init(target, pname, params); - } +void BindTexture(GLenum target, GLuint texture) { + gles2::cmds::BindTexture* c = GetCmdSpace<gles2::cmds::BindTexture>(); + if (c) { + c->Init(target, texture); } +} - 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, GLboolean internal) { - gles2::cmds::TexSubImage2D* c = GetCmdSpace<gles2::cmds::TexSubImage2D>(); - if (c) { - c->Init( - target, level, xoffset, yoffset, width, height, format, type, - pixels_shm_id, pixels_shm_offset, internal); - } - } - - void Uniform1f(GLint location, GLfloat x) { - gles2::cmds::Uniform1f* c = GetCmdSpace<gles2::cmds::Uniform1f>(); - if (c) { - c->Init(location, x); - } - } - - void Uniform1fv( - GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) { - gles2::cmds::Uniform1fv* c = GetCmdSpace<gles2::cmds::Uniform1fv>(); - if (c) { - c->Init(location, count, v_shm_id, v_shm_offset); - } - } - - void Uniform1fvImmediate(GLint location, GLsizei count, const GLfloat* v) { - const uint32 size = gles2::cmds::Uniform1fvImmediate::ComputeSize(count); - gles2::cmds::Uniform1fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform1fvImmediate>(size); - if (c) { - c->Init(location, count, v); - } - } - - void Uniform1i(GLint location, GLint x) { - gles2::cmds::Uniform1i* c = GetCmdSpace<gles2::cmds::Uniform1i>(); - if (c) { - c->Init(location, x); - } +void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + gles2::cmds::BlendColor* c = GetCmdSpace<gles2::cmds::BlendColor>(); + if (c) { + c->Init(red, green, blue, alpha); } - - void Uniform1iv( - GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) { - gles2::cmds::Uniform1iv* c = GetCmdSpace<gles2::cmds::Uniform1iv>(); - if (c) { - c->Init(location, count, v_shm_id, v_shm_offset); - } +} + +void BlendEquation(GLenum mode) { + gles2::cmds::BlendEquation* c = GetCmdSpace<gles2::cmds::BlendEquation>(); + if (c) { + c->Init(mode); } - - void Uniform1ivImmediate(GLint location, GLsizei count, const GLint* v) { - const uint32 size = gles2::cmds::Uniform1ivImmediate::ComputeSize(count); - gles2::cmds::Uniform1ivImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform1ivImmediate>(size); - if (c) { - c->Init(location, count, v); - } - } - - void Uniform2f(GLint location, GLfloat x, GLfloat y) { - gles2::cmds::Uniform2f* c = GetCmdSpace<gles2::cmds::Uniform2f>(); - if (c) { - c->Init(location, x, y); - } +} + +void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) { + gles2::cmds::BlendEquationSeparate* c = + GetCmdSpace<gles2::cmds::BlendEquationSeparate>(); + if (c) { + c->Init(modeRGB, modeAlpha); } - - void Uniform2fv( - GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) { - gles2::cmds::Uniform2fv* c = GetCmdSpace<gles2::cmds::Uniform2fv>(); - if (c) { - c->Init(location, count, v_shm_id, v_shm_offset); - } - } - - void Uniform2fvImmediate(GLint location, GLsizei count, const GLfloat* v) { - const uint32 size = gles2::cmds::Uniform2fvImmediate::ComputeSize(count); - gles2::cmds::Uniform2fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform2fvImmediate>(size); - if (c) { - c->Init(location, count, v); - } - } - - void Uniform2i(GLint location, GLint x, GLint y) { - gles2::cmds::Uniform2i* c = GetCmdSpace<gles2::cmds::Uniform2i>(); - if (c) { - c->Init(location, x, y); - } - } - - void Uniform2iv( - GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) { - gles2::cmds::Uniform2iv* c = GetCmdSpace<gles2::cmds::Uniform2iv>(); - if (c) { - c->Init(location, count, v_shm_id, v_shm_offset); - } +} + +void BlendFunc(GLenum sfactor, GLenum dfactor) { + gles2::cmds::BlendFunc* c = GetCmdSpace<gles2::cmds::BlendFunc>(); + if (c) { + c->Init(sfactor, dfactor); + } +} + +void BlendFuncSeparate(GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) { + gles2::cmds::BlendFuncSeparate* c = + GetCmdSpace<gles2::cmds::BlendFuncSeparate>(); + if (c) { + c->Init(srcRGB, dstRGB, srcAlpha, dstAlpha); + } +} + +void BufferData(GLenum target, + GLsizeiptr size, + uint32_t data_shm_id, + uint32_t data_shm_offset, + GLenum usage) { + gles2::cmds::BufferData* c = GetCmdSpace<gles2::cmds::BufferData>(); + if (c) { + c->Init(target, size, data_shm_id, data_shm_offset, usage); + } +} + +void BufferSubData(GLenum target, + GLintptr offset, + GLsizeiptr size, + uint32_t data_shm_id, + uint32_t data_shm_offset) { + gles2::cmds::BufferSubData* c = GetCmdSpace<gles2::cmds::BufferSubData>(); + if (c) { + c->Init(target, offset, size, data_shm_id, data_shm_offset); + } +} + +void CheckFramebufferStatus(GLenum target, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::CheckFramebufferStatus* c = + GetCmdSpace<gles2::cmds::CheckFramebufferStatus>(); + if (c) { + c->Init(target, result_shm_id, result_shm_offset); + } +} + +void Clear(GLbitfield mask) { + gles2::cmds::Clear* c = GetCmdSpace<gles2::cmds::Clear>(); + if (c) { + c->Init(mask); + } +} + +void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + gles2::cmds::ClearColor* c = GetCmdSpace<gles2::cmds::ClearColor>(); + if (c) { + c->Init(red, green, blue, alpha); + } +} + +void ClearDepthf(GLclampf depth) { + gles2::cmds::ClearDepthf* c = GetCmdSpace<gles2::cmds::ClearDepthf>(); + if (c) { + c->Init(depth); + } +} + +void ClearStencil(GLint s) { + gles2::cmds::ClearStencil* c = GetCmdSpace<gles2::cmds::ClearStencil>(); + if (c) { + c->Init(s); + } +} + +void ColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) { + gles2::cmds::ColorMask* c = GetCmdSpace<gles2::cmds::ColorMask>(); + if (c) { + c->Init(red, green, blue, alpha); + } +} + +void CompileShader(GLuint shader) { + gles2::cmds::CompileShader* c = GetCmdSpace<gles2::cmds::CompileShader>(); + if (c) { + c->Init(shader); + } +} + +void CompressedTexImage2DBucket(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLuint bucket_id) { + gles2::cmds::CompressedTexImage2DBucket* c = + GetCmdSpace<gles2::cmds::CompressedTexImage2DBucket>(); + if (c) { + c->Init(target, level, internalformat, width, height, bucket_id); + } +} + +void CompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLsizei imageSize, + uint32_t data_shm_id, + uint32_t data_shm_offset) { + gles2::cmds::CompressedTexImage2D* c = + GetCmdSpace<gles2::cmds::CompressedTexImage2D>(); + if (c) { + c->Init(target, + level, + internalformat, + width, + height, + imageSize, + data_shm_id, + data_shm_offset); + } +} + +void CompressedTexSubImage2DBucket(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLuint bucket_id) { + gles2::cmds::CompressedTexSubImage2DBucket* c = + GetCmdSpace<gles2::cmds::CompressedTexSubImage2DBucket>(); + if (c) { + c->Init(target, level, xoffset, yoffset, width, height, format, bucket_id); + } +} + +void CompressedTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + uint32_t data_shm_id, + uint32_t data_shm_offset) { + gles2::cmds::CompressedTexSubImage2D* c = + GetCmdSpace<gles2::cmds::CompressedTexSubImage2D>(); + if (c) { + c->Init(target, + level, + xoffset, + yoffset, + width, + height, + format, + imageSize, + data_shm_id, + data_shm_offset); + } +} + +void CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { + gles2::cmds::CopyTexImage2D* c = GetCmdSpace<gles2::cmds::CopyTexImage2D>(); + if (c) { + c->Init(target, level, internalformat, x, y, width, height); + } +} + +void CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { + gles2::cmds::CopyTexSubImage2D* c = + GetCmdSpace<gles2::cmds::CopyTexSubImage2D>(); + if (c) { + c->Init(target, level, xoffset, yoffset, x, y, width, height); + } +} + +void CreateProgram(uint32_t client_id) { + gles2::cmds::CreateProgram* c = GetCmdSpace<gles2::cmds::CreateProgram>(); + if (c) { + c->Init(client_id); + } +} + +void CreateShader(GLenum type, uint32_t client_id) { + gles2::cmds::CreateShader* c = GetCmdSpace<gles2::cmds::CreateShader>(); + if (c) { + c->Init(type, client_id); + } +} + +void CullFace(GLenum mode) { + gles2::cmds::CullFace* c = GetCmdSpace<gles2::cmds::CullFace>(); + if (c) { + c->Init(mode); + } +} + +void DeleteBuffersImmediate(GLsizei n, const GLuint* buffers) { + const uint32_t size = gles2::cmds::DeleteBuffersImmediate::ComputeSize(n); + gles2::cmds::DeleteBuffersImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteBuffersImmediate>(size); + if (c) { + c->Init(n, buffers); + } +} + +void DeleteFramebuffersImmediate(GLsizei n, const GLuint* framebuffers) { + const uint32_t size = + gles2::cmds::DeleteFramebuffersImmediate::ComputeSize(n); + gles2::cmds::DeleteFramebuffersImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteFramebuffersImmediate>( + size); + if (c) { + c->Init(n, framebuffers); + } +} + +void DeleteProgram(GLuint program) { + gles2::cmds::DeleteProgram* c = GetCmdSpace<gles2::cmds::DeleteProgram>(); + if (c) { + c->Init(program); + } +} + +void DeleteRenderbuffersImmediate(GLsizei n, const GLuint* renderbuffers) { + const uint32_t size = + gles2::cmds::DeleteRenderbuffersImmediate::ComputeSize(n); + gles2::cmds::DeleteRenderbuffersImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteRenderbuffersImmediate>( + size); + if (c) { + c->Init(n, renderbuffers); + } +} + +void DeleteShader(GLuint shader) { + gles2::cmds::DeleteShader* c = GetCmdSpace<gles2::cmds::DeleteShader>(); + if (c) { + c->Init(shader); + } +} + +void DeleteTexturesImmediate(GLsizei n, const GLuint* textures) { + const uint32_t size = gles2::cmds::DeleteTexturesImmediate::ComputeSize(n); + gles2::cmds::DeleteTexturesImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteTexturesImmediate>(size); + if (c) { + c->Init(n, textures); + } +} + +void DepthFunc(GLenum func) { + gles2::cmds::DepthFunc* c = GetCmdSpace<gles2::cmds::DepthFunc>(); + if (c) { + c->Init(func); + } +} + +void DepthMask(GLboolean flag) { + gles2::cmds::DepthMask* c = GetCmdSpace<gles2::cmds::DepthMask>(); + if (c) { + c->Init(flag); + } +} + +void DepthRangef(GLclampf zNear, GLclampf zFar) { + gles2::cmds::DepthRangef* c = GetCmdSpace<gles2::cmds::DepthRangef>(); + if (c) { + c->Init(zNear, zFar); } +} - void Uniform2ivImmediate(GLint location, GLsizei count, const GLint* v) { - const uint32 size = gles2::cmds::Uniform2ivImmediate::ComputeSize(count); - gles2::cmds::Uniform2ivImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform2ivImmediate>(size); - if (c) { - c->Init(location, count, v); - } - } +void DetachShader(GLuint program, GLuint shader) { + gles2::cmds::DetachShader* c = GetCmdSpace<gles2::cmds::DetachShader>(); + if (c) { + c->Init(program, shader); + } +} - void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { - gles2::cmds::Uniform3f* c = GetCmdSpace<gles2::cmds::Uniform3f>(); - if (c) { - c->Init(location, x, y, z); - } - } +void Disable(GLenum cap) { + gles2::cmds::Disable* c = GetCmdSpace<gles2::cmds::Disable>(); + if (c) { + c->Init(cap); + } +} - void Uniform3fv( - GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) { - gles2::cmds::Uniform3fv* c = GetCmdSpace<gles2::cmds::Uniform3fv>(); - if (c) { - c->Init(location, count, v_shm_id, v_shm_offset); - } - } - - void Uniform3fvImmediate(GLint location, GLsizei count, const GLfloat* v) { - const uint32 size = gles2::cmds::Uniform3fvImmediate::ComputeSize(count); - gles2::cmds::Uniform3fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform3fvImmediate>(size); - if (c) { - c->Init(location, count, v); - } - } - - void Uniform3i(GLint location, GLint x, GLint y, GLint z) { - gles2::cmds::Uniform3i* c = GetCmdSpace<gles2::cmds::Uniform3i>(); - if (c) { - c->Init(location, x, y, z); - } - } - - void Uniform3iv( - GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) { - gles2::cmds::Uniform3iv* c = GetCmdSpace<gles2::cmds::Uniform3iv>(); - if (c) { - c->Init(location, count, v_shm_id, v_shm_offset); - } - } - - void Uniform3ivImmediate(GLint location, GLsizei count, const GLint* v) { - const uint32 size = gles2::cmds::Uniform3ivImmediate::ComputeSize(count); - gles2::cmds::Uniform3ivImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform3ivImmediate>(size); - if (c) { - c->Init(location, count, v); - } - } - - void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - gles2::cmds::Uniform4f* c = GetCmdSpace<gles2::cmds::Uniform4f>(); - if (c) { - c->Init(location, x, y, z, w); - } - } - - void Uniform4fv( - GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) { - gles2::cmds::Uniform4fv* c = GetCmdSpace<gles2::cmds::Uniform4fv>(); - if (c) { - c->Init(location, count, v_shm_id, v_shm_offset); - } - } - - void Uniform4fvImmediate(GLint location, GLsizei count, const GLfloat* v) { - const uint32 size = gles2::cmds::Uniform4fvImmediate::ComputeSize(count); - gles2::cmds::Uniform4fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform4fvImmediate>(size); - if (c) { - c->Init(location, count, v); - } - } - - void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { - gles2::cmds::Uniform4i* c = GetCmdSpace<gles2::cmds::Uniform4i>(); - if (c) { - c->Init(location, x, y, z, w); - } - } - - void Uniform4iv( - GLint location, GLsizei count, uint32 v_shm_id, uint32 v_shm_offset) { - gles2::cmds::Uniform4iv* c = GetCmdSpace<gles2::cmds::Uniform4iv>(); - if (c) { - c->Init(location, count, v_shm_id, v_shm_offset); - } - } - - void Uniform4ivImmediate(GLint location, GLsizei count, const GLint* v) { - const uint32 size = gles2::cmds::Uniform4ivImmediate::ComputeSize(count); - gles2::cmds::Uniform4ivImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform4ivImmediate>(size); - if (c) { - c->Init(location, count, v); - } - } - - void UniformMatrix2fv( - GLint location, GLsizei count, GLboolean transpose, uint32 value_shm_id, - uint32 value_shm_offset) { - gles2::cmds::UniformMatrix2fv* c = - GetCmdSpace<gles2::cmds::UniformMatrix2fv>(); - if (c) { - 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::cmds::UniformMatrix2fvImmediate::ComputeSize(count); - gles2::cmds::UniformMatrix2fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix2fvImmediate>( - size); - if (c) { - c->Init(location, count, transpose, value); - } - } - - void UniformMatrix3fv( - GLint location, GLsizei count, GLboolean transpose, uint32 value_shm_id, - uint32 value_shm_offset) { - gles2::cmds::UniformMatrix3fv* c = - GetCmdSpace<gles2::cmds::UniformMatrix3fv>(); - if (c) { - 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::cmds::UniformMatrix3fvImmediate::ComputeSize(count); - gles2::cmds::UniformMatrix3fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix3fvImmediate>( +void DisableVertexAttribArray(GLuint index) { + gles2::cmds::DisableVertexAttribArray* c = + GetCmdSpace<gles2::cmds::DisableVertexAttribArray>(); + if (c) { + c->Init(index); + } +} + +void DrawArrays(GLenum mode, GLint first, GLsizei count) { + gles2::cmds::DrawArrays* c = GetCmdSpace<gles2::cmds::DrawArrays>(); + if (c) { + c->Init(mode, first, count); + } +} + +void DrawElements(GLenum mode, + GLsizei count, + GLenum type, + GLuint index_offset) { + gles2::cmds::DrawElements* c = GetCmdSpace<gles2::cmds::DrawElements>(); + if (c) { + c->Init(mode, count, type, index_offset); + } +} + +void Enable(GLenum cap) { + gles2::cmds::Enable* c = GetCmdSpace<gles2::cmds::Enable>(); + if (c) { + c->Init(cap); + } +} + +void EnableVertexAttribArray(GLuint index) { + gles2::cmds::EnableVertexAttribArray* c = + GetCmdSpace<gles2::cmds::EnableVertexAttribArray>(); + if (c) { + c->Init(index); + } +} + +void Finish() { + gles2::cmds::Finish* c = GetCmdSpace<gles2::cmds::Finish>(); + if (c) { + c->Init(); + } +} + +void Flush() { + gles2::cmds::Flush* c = GetCmdSpace<gles2::cmds::Flush>(); + if (c) { + c->Init(); + } +} + +void FramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) { + gles2::cmds::FramebufferRenderbuffer* c = + GetCmdSpace<gles2::cmds::FramebufferRenderbuffer>(); + if (c) { + c->Init(target, attachment, renderbuffertarget, renderbuffer); + } +} + +void FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture) { + gles2::cmds::FramebufferTexture2D* c = + GetCmdSpace<gles2::cmds::FramebufferTexture2D>(); + if (c) { + c->Init(target, attachment, textarget, texture); + } +} + +void FrontFace(GLenum mode) { + gles2::cmds::FrontFace* c = GetCmdSpace<gles2::cmds::FrontFace>(); + if (c) { + c->Init(mode); + } +} + +void GenBuffersImmediate(GLsizei n, GLuint* buffers) { + const uint32_t size = gles2::cmds::GenBuffersImmediate::ComputeSize(n); + gles2::cmds::GenBuffersImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::GenBuffersImmediate>(size); + if (c) { + c->Init(n, buffers); + } +} + +void GenerateMipmap(GLenum target) { + gles2::cmds::GenerateMipmap* c = GetCmdSpace<gles2::cmds::GenerateMipmap>(); + if (c) { + c->Init(target); + } +} + +void GenFramebuffersImmediate(GLsizei n, GLuint* framebuffers) { + const uint32_t size = gles2::cmds::GenFramebuffersImmediate::ComputeSize(n); + gles2::cmds::GenFramebuffersImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::GenFramebuffersImmediate>( + size); + if (c) { + c->Init(n, framebuffers); + } +} + +void GenRenderbuffersImmediate(GLsizei n, GLuint* renderbuffers) { + const uint32_t size = gles2::cmds::GenRenderbuffersImmediate::ComputeSize(n); + gles2::cmds::GenRenderbuffersImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::GenRenderbuffersImmediate>( + size); + if (c) { + c->Init(n, renderbuffers); + } +} + +void GenTexturesImmediate(GLsizei n, GLuint* textures) { + const uint32_t size = gles2::cmds::GenTexturesImmediate::ComputeSize(n); + gles2::cmds::GenTexturesImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::GenTexturesImmediate>(size); + if (c) { + c->Init(n, textures); + } +} + +void GetActiveAttrib(GLuint program, + GLuint index, + uint32_t name_bucket_id, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::GetActiveAttrib* c = GetCmdSpace<gles2::cmds::GetActiveAttrib>(); + if (c) { + c->Init(program, index, name_bucket_id, result_shm_id, result_shm_offset); + } +} + +void GetActiveUniform(GLuint program, + GLuint index, + uint32_t name_bucket_id, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::GetActiveUniform* c = + GetCmdSpace<gles2::cmds::GetActiveUniform>(); + if (c) { + c->Init(program, index, name_bucket_id, result_shm_id, result_shm_offset); + } +} + +void GetAttachedShaders(GLuint program, + uint32_t result_shm_id, + uint32_t result_shm_offset, + uint32_t result_size) { + gles2::cmds::GetAttachedShaders* c = + GetCmdSpace<gles2::cmds::GetAttachedShaders>(); + if (c) { + c->Init(program, result_shm_id, result_shm_offset, result_size); + } +} + +void GetBooleanv(GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetBooleanv* c = GetCmdSpace<gles2::cmds::GetBooleanv>(); + if (c) { + c->Init(pname, params_shm_id, params_shm_offset); + } +} + +void GetBufferParameteriv(GLenum target, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetBufferParameteriv* c = + GetCmdSpace<gles2::cmds::GetBufferParameteriv>(); + if (c) { + c->Init(target, pname, params_shm_id, params_shm_offset); + } +} + +void GetError(uint32_t result_shm_id, uint32_t result_shm_offset) { + gles2::cmds::GetError* c = GetCmdSpace<gles2::cmds::GetError>(); + if (c) { + c->Init(result_shm_id, result_shm_offset); + } +} + +void GetFloatv(GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetFloatv* c = GetCmdSpace<gles2::cmds::GetFloatv>(); + if (c) { + c->Init(pname, params_shm_id, params_shm_offset); + } +} + +void GetFramebufferAttachmentParameteriv(GLenum target, + GLenum attachment, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetFramebufferAttachmentParameteriv* c = + GetCmdSpace<gles2::cmds::GetFramebufferAttachmentParameteriv>(); + if (c) { + c->Init(target, attachment, pname, params_shm_id, params_shm_offset); + } +} + +void GetIntegerv(GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetIntegerv* c = GetCmdSpace<gles2::cmds::GetIntegerv>(); + if (c) { + c->Init(pname, params_shm_id, params_shm_offset); + } +} + +void GetProgramiv(GLuint program, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetProgramiv* c = GetCmdSpace<gles2::cmds::GetProgramiv>(); + if (c) { + c->Init(program, pname, params_shm_id, params_shm_offset); + } +} + +void GetProgramInfoLog(GLuint program, uint32_t bucket_id) { + gles2::cmds::GetProgramInfoLog* c = + GetCmdSpace<gles2::cmds::GetProgramInfoLog>(); + if (c) { + c->Init(program, bucket_id); + } +} + +void GetRenderbufferParameteriv(GLenum target, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetRenderbufferParameteriv* c = + GetCmdSpace<gles2::cmds::GetRenderbufferParameteriv>(); + if (c) { + c->Init(target, pname, params_shm_id, params_shm_offset); + } +} + +void GetShaderiv(GLuint shader, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetShaderiv* c = GetCmdSpace<gles2::cmds::GetShaderiv>(); + if (c) { + c->Init(shader, pname, params_shm_id, params_shm_offset); + } +} + +void GetShaderInfoLog(GLuint shader, uint32_t bucket_id) { + gles2::cmds::GetShaderInfoLog* c = + GetCmdSpace<gles2::cmds::GetShaderInfoLog>(); + if (c) { + c->Init(shader, bucket_id); + } +} + +void GetShaderPrecisionFormat(GLenum shadertype, + GLenum precisiontype, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::GetShaderPrecisionFormat* c = + GetCmdSpace<gles2::cmds::GetShaderPrecisionFormat>(); + if (c) { + c->Init(shadertype, precisiontype, result_shm_id, result_shm_offset); + } +} + +void GetShaderSource(GLuint shader, uint32_t bucket_id) { + gles2::cmds::GetShaderSource* c = GetCmdSpace<gles2::cmds::GetShaderSource>(); + if (c) { + c->Init(shader, bucket_id); + } +} + +void GetString(GLenum name, uint32_t bucket_id) { + gles2::cmds::GetString* c = GetCmdSpace<gles2::cmds::GetString>(); + if (c) { + c->Init(name, bucket_id); + } +} + +void GetTexParameterfv(GLenum target, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetTexParameterfv* c = + GetCmdSpace<gles2::cmds::GetTexParameterfv>(); + if (c) { + c->Init(target, pname, params_shm_id, params_shm_offset); + } +} + +void GetTexParameteriv(GLenum target, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetTexParameteriv* c = + GetCmdSpace<gles2::cmds::GetTexParameteriv>(); + if (c) { + c->Init(target, pname, params_shm_id, params_shm_offset); + } +} + +void GetUniformfv(GLuint program, + GLint location, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetUniformfv* c = GetCmdSpace<gles2::cmds::GetUniformfv>(); + if (c) { + c->Init(program, location, params_shm_id, params_shm_offset); + } +} + +void GetUniformiv(GLuint program, + GLint location, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetUniformiv* c = GetCmdSpace<gles2::cmds::GetUniformiv>(); + if (c) { + c->Init(program, location, params_shm_id, params_shm_offset); + } +} + +void GetVertexAttribfv(GLuint index, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetVertexAttribfv* c = + GetCmdSpace<gles2::cmds::GetVertexAttribfv>(); + if (c) { + c->Init(index, pname, params_shm_id, params_shm_offset); + } +} + +void GetVertexAttribiv(GLuint index, + GLenum pname, + uint32_t params_shm_id, + uint32_t params_shm_offset) { + gles2::cmds::GetVertexAttribiv* c = + GetCmdSpace<gles2::cmds::GetVertexAttribiv>(); + if (c) { + c->Init(index, pname, params_shm_id, params_shm_offset); + } +} + +void GetVertexAttribPointerv(GLuint index, + GLenum pname, + uint32_t pointer_shm_id, + uint32_t pointer_shm_offset) { + gles2::cmds::GetVertexAttribPointerv* c = + GetCmdSpace<gles2::cmds::GetVertexAttribPointerv>(); + if (c) { + c->Init(index, pname, pointer_shm_id, pointer_shm_offset); + } +} + +void Hint(GLenum target, GLenum mode) { + gles2::cmds::Hint* c = GetCmdSpace<gles2::cmds::Hint>(); + if (c) { + c->Init(target, mode); + } +} + +void IsBuffer(GLuint buffer, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::IsBuffer* c = GetCmdSpace<gles2::cmds::IsBuffer>(); + if (c) { + c->Init(buffer, result_shm_id, result_shm_offset); + } +} + +void IsEnabled(GLenum cap, uint32_t result_shm_id, uint32_t result_shm_offset) { + gles2::cmds::IsEnabled* c = GetCmdSpace<gles2::cmds::IsEnabled>(); + if (c) { + c->Init(cap, result_shm_id, result_shm_offset); + } +} + +void IsFramebuffer(GLuint framebuffer, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::IsFramebuffer* c = GetCmdSpace<gles2::cmds::IsFramebuffer>(); + if (c) { + c->Init(framebuffer, result_shm_id, result_shm_offset); + } +} + +void IsProgram(GLuint program, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::IsProgram* c = GetCmdSpace<gles2::cmds::IsProgram>(); + if (c) { + c->Init(program, result_shm_id, result_shm_offset); + } +} + +void IsRenderbuffer(GLuint renderbuffer, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::IsRenderbuffer* c = GetCmdSpace<gles2::cmds::IsRenderbuffer>(); + if (c) { + c->Init(renderbuffer, result_shm_id, result_shm_offset); + } +} + +void IsShader(GLuint shader, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::IsShader* c = GetCmdSpace<gles2::cmds::IsShader>(); + if (c) { + c->Init(shader, result_shm_id, result_shm_offset); + } +} + +void IsTexture(GLuint texture, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::IsTexture* c = GetCmdSpace<gles2::cmds::IsTexture>(); + if (c) { + c->Init(texture, result_shm_id, result_shm_offset); + } +} + +void LineWidth(GLfloat width) { + gles2::cmds::LineWidth* c = GetCmdSpace<gles2::cmds::LineWidth>(); + if (c) { + c->Init(width); + } +} + +void LinkProgram(GLuint program) { + gles2::cmds::LinkProgram* c = GetCmdSpace<gles2::cmds::LinkProgram>(); + if (c) { + c->Init(program); + } +} + +void PixelStorei(GLenum pname, GLint param) { + gles2::cmds::PixelStorei* c = GetCmdSpace<gles2::cmds::PixelStorei>(); + if (c) { + c->Init(pname, param); + } +} + +void PolygonOffset(GLfloat factor, GLfloat units) { + gles2::cmds::PolygonOffset* c = GetCmdSpace<gles2::cmds::PolygonOffset>(); + if (c) { + c->Init(factor, units); + } +} + +void ReadPixels(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + uint32_t pixels_shm_id, + uint32_t pixels_shm_offset, + uint32_t result_shm_id, + uint32_t result_shm_offset, + GLboolean async) { + gles2::cmds::ReadPixels* c = GetCmdSpace<gles2::cmds::ReadPixels>(); + if (c) { + c->Init(x, + y, + width, + height, + format, + type, + pixels_shm_id, + pixels_shm_offset, + result_shm_id, + result_shm_offset, + async); + } +} + +void ReleaseShaderCompiler() { + gles2::cmds::ReleaseShaderCompiler* c = + GetCmdSpace<gles2::cmds::ReleaseShaderCompiler>(); + if (c) { + c->Init(); + } +} + +void RenderbufferStorage(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) { + gles2::cmds::RenderbufferStorage* c = + GetCmdSpace<gles2::cmds::RenderbufferStorage>(); + if (c) { + c->Init(target, internalformat, width, height); + } +} + +void SampleCoverage(GLclampf value, GLboolean invert) { + gles2::cmds::SampleCoverage* c = GetCmdSpace<gles2::cmds::SampleCoverage>(); + if (c) { + c->Init(value, invert); + } +} + +void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) { + gles2::cmds::Scissor* c = GetCmdSpace<gles2::cmds::Scissor>(); + if (c) { + c->Init(x, y, width, height); + } +} + +void ShaderBinary(GLsizei n, + uint32_t shaders_shm_id, + uint32_t shaders_shm_offset, + GLenum binaryformat, + uint32_t binary_shm_id, + uint32_t binary_shm_offset, + GLsizei length) { + gles2::cmds::ShaderBinary* c = GetCmdSpace<gles2::cmds::ShaderBinary>(); + if (c) { + c->Init(n, + shaders_shm_id, + shaders_shm_offset, + binaryformat, + binary_shm_id, + binary_shm_offset, + length); + } +} + +void ShaderSourceBucket(GLuint shader, uint32_t data_bucket_id) { + gles2::cmds::ShaderSourceBucket* c = + GetCmdSpace<gles2::cmds::ShaderSourceBucket>(); + if (c) { + c->Init(shader, data_bucket_id); + } +} + +void StencilFunc(GLenum func, GLint ref, GLuint mask) { + gles2::cmds::StencilFunc* c = GetCmdSpace<gles2::cmds::StencilFunc>(); + if (c) { + c->Init(func, ref, mask); + } +} + +void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { + gles2::cmds::StencilFuncSeparate* c = + GetCmdSpace<gles2::cmds::StencilFuncSeparate>(); + if (c) { + c->Init(face, func, ref, mask); + } +} + +void StencilMask(GLuint mask) { + gles2::cmds::StencilMask* c = GetCmdSpace<gles2::cmds::StencilMask>(); + if (c) { + c->Init(mask); + } +} + +void StencilMaskSeparate(GLenum face, GLuint mask) { + gles2::cmds::StencilMaskSeparate* c = + GetCmdSpace<gles2::cmds::StencilMaskSeparate>(); + if (c) { + c->Init(face, mask); + } +} + +void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { + gles2::cmds::StencilOp* c = GetCmdSpace<gles2::cmds::StencilOp>(); + if (c) { + c->Init(fail, zfail, zpass); + } +} + +void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + gles2::cmds::StencilOpSeparate* c = + GetCmdSpace<gles2::cmds::StencilOpSeparate>(); + if (c) { + c->Init(face, fail, zfail, zpass); + } +} + +void TexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + uint32_t pixels_shm_id, + uint32_t pixels_shm_offset) { + gles2::cmds::TexImage2D* c = GetCmdSpace<gles2::cmds::TexImage2D>(); + if (c) { + c->Init(target, + level, + internalformat, + width, + height, + format, + type, + pixels_shm_id, + pixels_shm_offset); + } +} + +void TexParameterf(GLenum target, GLenum pname, GLfloat param) { + gles2::cmds::TexParameterf* c = GetCmdSpace<gles2::cmds::TexParameterf>(); + if (c) { + c->Init(target, pname, param); + } +} + +void TexParameterfvImmediate(GLenum target, + GLenum pname, + const GLfloat* params) { + const uint32_t size = gles2::cmds::TexParameterfvImmediate::ComputeSize(); + gles2::cmds::TexParameterfvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::TexParameterfvImmediate>(size); + if (c) { + c->Init(target, pname, params); + } +} + +void TexParameteri(GLenum target, GLenum pname, GLint param) { + gles2::cmds::TexParameteri* c = GetCmdSpace<gles2::cmds::TexParameteri>(); + if (c) { + c->Init(target, pname, param); + } +} + +void TexParameterivImmediate(GLenum target, GLenum pname, const GLint* params) { + const uint32_t size = gles2::cmds::TexParameterivImmediate::ComputeSize(); + gles2::cmds::TexParameterivImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::TexParameterivImmediate>(size); + if (c) { + c->Init(target, pname, params); + } +} + +void TexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + uint32_t pixels_shm_id, + uint32_t pixels_shm_offset, + GLboolean internal) { + gles2::cmds::TexSubImage2D* c = GetCmdSpace<gles2::cmds::TexSubImage2D>(); + if (c) { + c->Init(target, + level, + xoffset, + yoffset, + width, + height, + format, + type, + pixels_shm_id, + pixels_shm_offset, + internal); + } +} + +void Uniform1f(GLint location, GLfloat x) { + gles2::cmds::Uniform1f* c = GetCmdSpace<gles2::cmds::Uniform1f>(); + if (c) { + c->Init(location, x); + } +} + +void Uniform1fvImmediate(GLint location, GLsizei count, const GLfloat* v) { + const uint32_t size = gles2::cmds::Uniform1fvImmediate::ComputeSize(count); + gles2::cmds::Uniform1fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform1fvImmediate>(size); + if (c) { + c->Init(location, count, v); + } +} + +void Uniform1i(GLint location, GLint x) { + gles2::cmds::Uniform1i* c = GetCmdSpace<gles2::cmds::Uniform1i>(); + if (c) { + c->Init(location, x); + } +} + +void Uniform1ivImmediate(GLint location, GLsizei count, const GLint* v) { + const uint32_t size = gles2::cmds::Uniform1ivImmediate::ComputeSize(count); + gles2::cmds::Uniform1ivImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform1ivImmediate>(size); + if (c) { + c->Init(location, count, v); + } +} + +void Uniform2f(GLint location, GLfloat x, GLfloat y) { + gles2::cmds::Uniform2f* c = GetCmdSpace<gles2::cmds::Uniform2f>(); + if (c) { + c->Init(location, x, y); + } +} + +void Uniform2fvImmediate(GLint location, GLsizei count, const GLfloat* v) { + const uint32_t size = gles2::cmds::Uniform2fvImmediate::ComputeSize(count); + gles2::cmds::Uniform2fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform2fvImmediate>(size); + if (c) { + c->Init(location, count, v); + } +} + +void Uniform2i(GLint location, GLint x, GLint y) { + gles2::cmds::Uniform2i* c = GetCmdSpace<gles2::cmds::Uniform2i>(); + if (c) { + c->Init(location, x, y); + } +} + +void Uniform2ivImmediate(GLint location, GLsizei count, const GLint* v) { + const uint32_t size = gles2::cmds::Uniform2ivImmediate::ComputeSize(count); + gles2::cmds::Uniform2ivImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform2ivImmediate>(size); + if (c) { + c->Init(location, count, v); + } +} + +void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { + gles2::cmds::Uniform3f* c = GetCmdSpace<gles2::cmds::Uniform3f>(); + if (c) { + c->Init(location, x, y, z); + } +} + +void Uniform3fvImmediate(GLint location, GLsizei count, const GLfloat* v) { + const uint32_t size = gles2::cmds::Uniform3fvImmediate::ComputeSize(count); + gles2::cmds::Uniform3fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform3fvImmediate>(size); + if (c) { + c->Init(location, count, v); + } +} + +void Uniform3i(GLint location, GLint x, GLint y, GLint z) { + gles2::cmds::Uniform3i* c = GetCmdSpace<gles2::cmds::Uniform3i>(); + if (c) { + c->Init(location, x, y, z); + } +} + +void Uniform3ivImmediate(GLint location, GLsizei count, const GLint* v) { + const uint32_t size = gles2::cmds::Uniform3ivImmediate::ComputeSize(count); + gles2::cmds::Uniform3ivImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform3ivImmediate>(size); + if (c) { + c->Init(location, count, v); + } +} + +void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + gles2::cmds::Uniform4f* c = GetCmdSpace<gles2::cmds::Uniform4f>(); + if (c) { + c->Init(location, x, y, z, w); + } +} + +void Uniform4fvImmediate(GLint location, GLsizei count, const GLfloat* v) { + const uint32_t size = gles2::cmds::Uniform4fvImmediate::ComputeSize(count); + gles2::cmds::Uniform4fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform4fvImmediate>(size); + if (c) { + c->Init(location, count, v); + } +} + +void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { + gles2::cmds::Uniform4i* c = GetCmdSpace<gles2::cmds::Uniform4i>(); + if (c) { + c->Init(location, x, y, z, w); + } +} + +void Uniform4ivImmediate(GLint location, GLsizei count, const GLint* v) { + const uint32_t size = gles2::cmds::Uniform4ivImmediate::ComputeSize(count); + gles2::cmds::Uniform4ivImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::Uniform4ivImmediate>(size); + if (c) { + c->Init(location, count, v); + } +} + +void UniformMatrix2fvImmediate(GLint location, + GLsizei count, + const GLfloat* value) { + const uint32_t size = + gles2::cmds::UniformMatrix2fvImmediate::ComputeSize(count); + gles2::cmds::UniformMatrix2fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix2fvImmediate>( + size); + if (c) { + c->Init(location, count, value); + } +} + +void UniformMatrix3fvImmediate(GLint location, + GLsizei count, + const GLfloat* value) { + const uint32_t size = + gles2::cmds::UniformMatrix3fvImmediate::ComputeSize(count); + gles2::cmds::UniformMatrix3fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix3fvImmediate>( + size); + if (c) { + c->Init(location, count, value); + } +} + +void UniformMatrix4fvImmediate(GLint location, + GLsizei count, + const GLfloat* value) { + const uint32_t size = + gles2::cmds::UniformMatrix4fvImmediate::ComputeSize(count); + gles2::cmds::UniformMatrix4fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix4fvImmediate>( + size); + if (c) { + c->Init(location, count, value); + } +} + +void UseProgram(GLuint program) { + gles2::cmds::UseProgram* c = GetCmdSpace<gles2::cmds::UseProgram>(); + if (c) { + c->Init(program); + } +} + +void ValidateProgram(GLuint program) { + gles2::cmds::ValidateProgram* c = GetCmdSpace<gles2::cmds::ValidateProgram>(); + if (c) { + c->Init(program); + } +} + +void VertexAttrib1f(GLuint indx, GLfloat x) { + gles2::cmds::VertexAttrib1f* c = GetCmdSpace<gles2::cmds::VertexAttrib1f>(); + if (c) { + c->Init(indx, x); + } +} + +void VertexAttrib1fvImmediate(GLuint indx, const GLfloat* values) { + const uint32_t size = gles2::cmds::VertexAttrib1fvImmediate::ComputeSize(); + gles2::cmds::VertexAttrib1fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::VertexAttrib1fvImmediate>( + size); + if (c) { + c->Init(indx, values); + } +} + +void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { + gles2::cmds::VertexAttrib2f* c = GetCmdSpace<gles2::cmds::VertexAttrib2f>(); + if (c) { + c->Init(indx, x, y); + } +} + +void VertexAttrib2fvImmediate(GLuint indx, const GLfloat* values) { + const uint32_t size = gles2::cmds::VertexAttrib2fvImmediate::ComputeSize(); + gles2::cmds::VertexAttrib2fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::VertexAttrib2fvImmediate>( + size); + if (c) { + c->Init(indx, values); + } +} + +void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + gles2::cmds::VertexAttrib3f* c = GetCmdSpace<gles2::cmds::VertexAttrib3f>(); + if (c) { + c->Init(indx, x, y, z); + } +} + +void VertexAttrib3fvImmediate(GLuint indx, const GLfloat* values) { + const uint32_t size = gles2::cmds::VertexAttrib3fvImmediate::ComputeSize(); + gles2::cmds::VertexAttrib3fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::VertexAttrib3fvImmediate>( + size); + if (c) { + c->Init(indx, values); + } +} + +void VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + gles2::cmds::VertexAttrib4f* c = GetCmdSpace<gles2::cmds::VertexAttrib4f>(); + if (c) { + c->Init(indx, x, y, z, w); + } +} + +void VertexAttrib4fvImmediate(GLuint indx, const GLfloat* values) { + const uint32_t size = gles2::cmds::VertexAttrib4fvImmediate::ComputeSize(); + gles2::cmds::VertexAttrib4fvImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::VertexAttrib4fvImmediate>( + size); + if (c) { + c->Init(indx, values); + } +} + +void VertexAttribPointer(GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + GLuint offset) { + gles2::cmds::VertexAttribPointer* c = + GetCmdSpace<gles2::cmds::VertexAttribPointer>(); + if (c) { + c->Init(indx, size, type, normalized, stride, offset); + } +} + +void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { + gles2::cmds::Viewport* c = GetCmdSpace<gles2::cmds::Viewport>(); + if (c) { + c->Init(x, y, width, height); + } +} + +void BlitFramebufferCHROMIUM(GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) { + gles2::cmds::BlitFramebufferCHROMIUM* c = + GetCmdSpace<gles2::cmds::BlitFramebufferCHROMIUM>(); + if (c) { + c->Init( + srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + } +} + +void RenderbufferStorageMultisampleCHROMIUM(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) { + gles2::cmds::RenderbufferStorageMultisampleCHROMIUM* c = + GetCmdSpace<gles2::cmds::RenderbufferStorageMultisampleCHROMIUM>(); + if (c) { + c->Init(target, samples, internalformat, width, height); + } +} + +void RenderbufferStorageMultisampleEXT(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) { + gles2::cmds::RenderbufferStorageMultisampleEXT* c = + GetCmdSpace<gles2::cmds::RenderbufferStorageMultisampleEXT>(); + if (c) { + c->Init(target, samples, internalformat, width, height); + } +} + +void FramebufferTexture2DMultisampleEXT(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLsizei samples) { + gles2::cmds::FramebufferTexture2DMultisampleEXT* c = + GetCmdSpace<gles2::cmds::FramebufferTexture2DMultisampleEXT>(); + if (c) { + c->Init(target, attachment, textarget, texture, samples); + } +} + +void TexStorage2DEXT(GLenum target, + GLsizei levels, + GLenum internalFormat, + GLsizei width, + GLsizei height) { + gles2::cmds::TexStorage2DEXT* c = GetCmdSpace<gles2::cmds::TexStorage2DEXT>(); + if (c) { + c->Init(target, levels, internalFormat, width, height); + } +} + +void GenQueriesEXTImmediate(GLsizei n, GLuint* queries) { + const uint32_t size = gles2::cmds::GenQueriesEXTImmediate::ComputeSize(n); + gles2::cmds::GenQueriesEXTImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::GenQueriesEXTImmediate>(size); + if (c) { + c->Init(n, queries); + } +} + +void DeleteQueriesEXTImmediate(GLsizei n, const GLuint* queries) { + const uint32_t size = gles2::cmds::DeleteQueriesEXTImmediate::ComputeSize(n); + gles2::cmds::DeleteQueriesEXTImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteQueriesEXTImmediate>( + size); + if (c) { + c->Init(n, queries); + } +} + +void BeginQueryEXT(GLenum target, + GLuint id, + uint32_t sync_data_shm_id, + uint32_t sync_data_shm_offset) { + gles2::cmds::BeginQueryEXT* c = GetCmdSpace<gles2::cmds::BeginQueryEXT>(); + if (c) { + c->Init(target, id, sync_data_shm_id, sync_data_shm_offset); + } +} + +void EndQueryEXT(GLenum target, GLuint submit_count) { + gles2::cmds::EndQueryEXT* c = GetCmdSpace<gles2::cmds::EndQueryEXT>(); + if (c) { + c->Init(target, submit_count); + } +} + +void InsertEventMarkerEXT(GLuint bucket_id) { + gles2::cmds::InsertEventMarkerEXT* c = + GetCmdSpace<gles2::cmds::InsertEventMarkerEXT>(); + if (c) { + c->Init(bucket_id); + } +} + +void PushGroupMarkerEXT(GLuint bucket_id) { + gles2::cmds::PushGroupMarkerEXT* c = + GetCmdSpace<gles2::cmds::PushGroupMarkerEXT>(); + if (c) { + c->Init(bucket_id); + } +} + +void PopGroupMarkerEXT() { + gles2::cmds::PopGroupMarkerEXT* c = + GetCmdSpace<gles2::cmds::PopGroupMarkerEXT>(); + if (c) { + c->Init(); + } +} + +void GenVertexArraysOESImmediate(GLsizei n, GLuint* arrays) { + const uint32_t size = + gles2::cmds::GenVertexArraysOESImmediate::ComputeSize(n); + gles2::cmds::GenVertexArraysOESImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::GenVertexArraysOESImmediate>( + size); + if (c) { + c->Init(n, arrays); + } +} + +void DeleteVertexArraysOESImmediate(GLsizei n, const GLuint* arrays) { + const uint32_t size = + gles2::cmds::DeleteVertexArraysOESImmediate::ComputeSize(n); + gles2::cmds::DeleteVertexArraysOESImmediate* c = + GetImmediateCmdSpaceTotalSize< + gles2::cmds::DeleteVertexArraysOESImmediate>(size); + if (c) { + c->Init(n, arrays); + } +} + +void IsVertexArrayOES(GLuint array, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::IsVertexArrayOES* c = + GetCmdSpace<gles2::cmds::IsVertexArrayOES>(); + if (c) { + c->Init(array, result_shm_id, result_shm_offset); + } +} + +void BindVertexArrayOES(GLuint array) { + gles2::cmds::BindVertexArrayOES* c = + GetCmdSpace<gles2::cmds::BindVertexArrayOES>(); + if (c) { + c->Init(array); + } +} + +void SwapBuffers() { + gles2::cmds::SwapBuffers* c = GetCmdSpace<gles2::cmds::SwapBuffers>(); + if (c) { + c->Init(); + } +} + +void GetMaxValueInBufferCHROMIUM(GLuint buffer_id, + GLsizei count, + GLenum type, + GLuint offset, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::GetMaxValueInBufferCHROMIUM* c = + GetCmdSpace<gles2::cmds::GetMaxValueInBufferCHROMIUM>(); + if (c) { + c->Init(buffer_id, count, type, offset, result_shm_id, result_shm_offset); + } +} + +void GenSharedIdsCHROMIUM(GLuint namespace_id, + GLuint id_offset, + GLsizei n, + uint32_t ids_shm_id, + uint32_t ids_shm_offset) { + gles2::cmds::GenSharedIdsCHROMIUM* c = + GetCmdSpace<gles2::cmds::GenSharedIdsCHROMIUM>(); + if (c) { + c->Init(namespace_id, id_offset, n, ids_shm_id, ids_shm_offset); + } +} + +void DeleteSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + uint32_t ids_shm_id, + uint32_t ids_shm_offset) { + gles2::cmds::DeleteSharedIdsCHROMIUM* c = + GetCmdSpace<gles2::cmds::DeleteSharedIdsCHROMIUM>(); + if (c) { + c->Init(namespace_id, n, ids_shm_id, ids_shm_offset); + } +} + +void RegisterSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + uint32_t ids_shm_id, + uint32_t ids_shm_offset) { + gles2::cmds::RegisterSharedIdsCHROMIUM* c = + GetCmdSpace<gles2::cmds::RegisterSharedIdsCHROMIUM>(); + if (c) { + c->Init(namespace_id, n, ids_shm_id, ids_shm_offset); + } +} + +void EnableFeatureCHROMIUM(GLuint bucket_id, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::EnableFeatureCHROMIUM* c = + GetCmdSpace<gles2::cmds::EnableFeatureCHROMIUM>(); + if (c) { + c->Init(bucket_id, result_shm_id, result_shm_offset); + } +} + +void ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) { + gles2::cmds::ResizeCHROMIUM* c = GetCmdSpace<gles2::cmds::ResizeCHROMIUM>(); + if (c) { + c->Init(width, height, scale_factor); + } +} + +void GetRequestableExtensionsCHROMIUM(uint32_t bucket_id) { + gles2::cmds::GetRequestableExtensionsCHROMIUM* c = + GetCmdSpace<gles2::cmds::GetRequestableExtensionsCHROMIUM>(); + if (c) { + c->Init(bucket_id); + } +} + +void RequestExtensionCHROMIUM(uint32_t bucket_id) { + gles2::cmds::RequestExtensionCHROMIUM* c = + GetCmdSpace<gles2::cmds::RequestExtensionCHROMIUM>(); + if (c) { + c->Init(bucket_id); + } +} + +void GetMultipleIntegervCHROMIUM(uint32_t pnames_shm_id, + uint32_t pnames_shm_offset, + GLuint count, + uint32_t results_shm_id, + uint32_t results_shm_offset, + GLsizeiptr size) { + gles2::cmds::GetMultipleIntegervCHROMIUM* c = + GetCmdSpace<gles2::cmds::GetMultipleIntegervCHROMIUM>(); + if (c) { + c->Init(pnames_shm_id, + pnames_shm_offset, + count, + results_shm_id, + results_shm_offset, size); - if (c) { - c->Init(location, count, transpose, value); - } - } - - void UniformMatrix4fv( - GLint location, GLsizei count, GLboolean transpose, uint32 value_shm_id, - uint32 value_shm_offset) { - gles2::cmds::UniformMatrix4fv* c = - GetCmdSpace<gles2::cmds::UniformMatrix4fv>(); - if (c) { - 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::cmds::UniformMatrix4fvImmediate::ComputeSize(count); - gles2::cmds::UniformMatrix4fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::UniformMatrix4fvImmediate>( - size); - if (c) { - c->Init(location, count, transpose, value); - } - } - - void UseProgram(GLuint program) { - gles2::cmds::UseProgram* c = GetCmdSpace<gles2::cmds::UseProgram>(); - if (c) { - c->Init(program); - } - } - - void ValidateProgram(GLuint program) { - gles2::cmds::ValidateProgram* c = - GetCmdSpace<gles2::cmds::ValidateProgram>(); - if (c) { - c->Init(program); - } - } - - void VertexAttrib1f(GLuint indx, GLfloat x) { - gles2::cmds::VertexAttrib1f* c = - GetCmdSpace<gles2::cmds::VertexAttrib1f>(); - if (c) { - c->Init(indx, x); - } - } - - void VertexAttrib1fv( - GLuint indx, uint32 values_shm_id, uint32 values_shm_offset) { - gles2::cmds::VertexAttrib1fv* c = - GetCmdSpace<gles2::cmds::VertexAttrib1fv>(); - if (c) { - c->Init(indx, values_shm_id, values_shm_offset); - } - } - - void VertexAttrib1fvImmediate(GLuint indx, const GLfloat* values) { - const uint32 size = gles2::cmds::VertexAttrib1fvImmediate::ComputeSize(); - gles2::cmds::VertexAttrib1fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::VertexAttrib1fvImmediate>( - size); - if (c) { - c->Init(indx, values); - } - } - - void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { - gles2::cmds::VertexAttrib2f* c = - GetCmdSpace<gles2::cmds::VertexAttrib2f>(); - if (c) { - c->Init(indx, x, y); - } - } - - void VertexAttrib2fv( - GLuint indx, uint32 values_shm_id, uint32 values_shm_offset) { - gles2::cmds::VertexAttrib2fv* c = - GetCmdSpace<gles2::cmds::VertexAttrib2fv>(); - if (c) { - c->Init(indx, values_shm_id, values_shm_offset); - } - } - - void VertexAttrib2fvImmediate(GLuint indx, const GLfloat* values) { - const uint32 size = gles2::cmds::VertexAttrib2fvImmediate::ComputeSize(); - gles2::cmds::VertexAttrib2fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::VertexAttrib2fvImmediate>( - size); - if (c) { - c->Init(indx, values); - } - } - - void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { - gles2::cmds::VertexAttrib3f* c = - GetCmdSpace<gles2::cmds::VertexAttrib3f>(); - if (c) { - c->Init(indx, x, y, z); - } - } - - void VertexAttrib3fv( - GLuint indx, uint32 values_shm_id, uint32 values_shm_offset) { - gles2::cmds::VertexAttrib3fv* c = - GetCmdSpace<gles2::cmds::VertexAttrib3fv>(); - if (c) { - c->Init(indx, values_shm_id, values_shm_offset); - } - } - - void VertexAttrib3fvImmediate(GLuint indx, const GLfloat* values) { - const uint32 size = gles2::cmds::VertexAttrib3fvImmediate::ComputeSize(); - gles2::cmds::VertexAttrib3fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::VertexAttrib3fvImmediate>( - size); - if (c) { - c->Init(indx, values); - } - } - - void VertexAttrib4f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - gles2::cmds::VertexAttrib4f* c = - GetCmdSpace<gles2::cmds::VertexAttrib4f>(); - if (c) { - c->Init(indx, x, y, z, w); - } - } - - void VertexAttrib4fv( - GLuint indx, uint32 values_shm_id, uint32 values_shm_offset) { - gles2::cmds::VertexAttrib4fv* c = - GetCmdSpace<gles2::cmds::VertexAttrib4fv>(); - if (c) { - c->Init(indx, values_shm_id, values_shm_offset); - } - } - - void VertexAttrib4fvImmediate(GLuint indx, const GLfloat* values) { - const uint32 size = gles2::cmds::VertexAttrib4fvImmediate::ComputeSize(); - gles2::cmds::VertexAttrib4fvImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::VertexAttrib4fvImmediate>( - size); - if (c) { - c->Init(indx, values); - } - } - - void VertexAttribPointer( - GLuint indx, GLint size, GLenum type, GLboolean normalized, - GLsizei stride, GLuint offset) { - gles2::cmds::VertexAttribPointer* c = - GetCmdSpace<gles2::cmds::VertexAttribPointer>(); - if (c) { - c->Init(indx, size, type, normalized, stride, offset); - } - } - - void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) { - gles2::cmds::Viewport* c = GetCmdSpace<gles2::cmds::Viewport>(); - if (c) { - c->Init(x, y, width, height); - } - } - - void BlitFramebufferCHROMIUM( - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, - GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { - gles2::cmds::BlitFramebufferCHROMIUM* c = - GetCmdSpace<gles2::cmds::BlitFramebufferCHROMIUM>(); - if (c) { - c->Init( - srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, - filter); - } - } - - void RenderbufferStorageMultisampleCHROMIUM( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) { - gles2::cmds::RenderbufferStorageMultisampleCHROMIUM* c = - GetCmdSpace<gles2::cmds::RenderbufferStorageMultisampleCHROMIUM>(); - if (c) { - c->Init(target, samples, internalformat, width, height); - } - } - - void RenderbufferStorageMultisampleEXT( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) { - gles2::cmds::RenderbufferStorageMultisampleEXT* c = - GetCmdSpace<gles2::cmds::RenderbufferStorageMultisampleEXT>(); - if (c) { - c->Init(target, samples, internalformat, width, height); - } - } - - void FramebufferTexture2DMultisampleEXT( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLsizei samples) { - gles2::cmds::FramebufferTexture2DMultisampleEXT* c = - GetCmdSpace<gles2::cmds::FramebufferTexture2DMultisampleEXT>(); - if (c) { - c->Init(target, attachment, textarget, texture, level, samples); - } - } - - void TexStorage2DEXT( - GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, - GLsizei height) { - gles2::cmds::TexStorage2DEXT* c = - GetCmdSpace<gles2::cmds::TexStorage2DEXT>(); - if (c) { - c->Init(target, levels, internalFormat, width, height); - } - } - - void GenQueriesEXT( - GLsizei n, uint32 queries_shm_id, uint32 queries_shm_offset) { - gles2::cmds::GenQueriesEXT* c = GetCmdSpace<gles2::cmds::GenQueriesEXT>(); - if (c) { - c->Init(n, queries_shm_id, queries_shm_offset); - } - } - - void GenQueriesEXTImmediate(GLsizei n, GLuint* queries) { - const uint32 size = gles2::cmds::GenQueriesEXTImmediate::ComputeSize(n); - gles2::cmds::GenQueriesEXTImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::GenQueriesEXTImmediate>( - size); - if (c) { - c->Init(n, queries); - } - } - - void DeleteQueriesEXT( - GLsizei n, uint32 queries_shm_id, uint32 queries_shm_offset) { - gles2::cmds::DeleteQueriesEXT* c = - GetCmdSpace<gles2::cmds::DeleteQueriesEXT>(); - if (c) { - c->Init(n, queries_shm_id, queries_shm_offset); - } - } - - void DeleteQueriesEXTImmediate(GLsizei n, const GLuint* queries) { - const uint32 size = gles2::cmds::DeleteQueriesEXTImmediate::ComputeSize(n); - gles2::cmds::DeleteQueriesEXTImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteQueriesEXTImmediate>( - size); - if (c) { - c->Init(n, queries); - } - } - - void BeginQueryEXT( - GLenum target, GLuint id, uint32 sync_data_shm_id, - uint32 sync_data_shm_offset) { - gles2::cmds::BeginQueryEXT* c = GetCmdSpace<gles2::cmds::BeginQueryEXT>(); - if (c) { - c->Init(target, id, sync_data_shm_id, sync_data_shm_offset); - } - } - - void EndQueryEXT(GLenum target, GLuint submit_count) { - gles2::cmds::EndQueryEXT* c = GetCmdSpace<gles2::cmds::EndQueryEXT>(); - if (c) { - c->Init(target, submit_count); - } - } - - void InsertEventMarkerEXT(GLuint bucket_id) { - gles2::cmds::InsertEventMarkerEXT* c = - GetCmdSpace<gles2::cmds::InsertEventMarkerEXT>(); - if (c) { - c->Init(bucket_id); - } - } - - void PushGroupMarkerEXT(GLuint bucket_id) { - gles2::cmds::PushGroupMarkerEXT* c = - GetCmdSpace<gles2::cmds::PushGroupMarkerEXT>(); - if (c) { - c->Init(bucket_id); - } - } - - void PopGroupMarkerEXT() { - gles2::cmds::PopGroupMarkerEXT* c = - GetCmdSpace<gles2::cmds::PopGroupMarkerEXT>(); - if (c) { - c->Init(); - } - } - - void GenVertexArraysOES( - GLsizei n, uint32 arrays_shm_id, uint32 arrays_shm_offset) { - gles2::cmds::GenVertexArraysOES* c = - GetCmdSpace<gles2::cmds::GenVertexArraysOES>(); - if (c) { - c->Init(n, arrays_shm_id, arrays_shm_offset); - } - } - - void GenVertexArraysOESImmediate(GLsizei n, GLuint* arrays) { - const uint32 size = - gles2::cmds::GenVertexArraysOESImmediate::ComputeSize(n); - gles2::cmds::GenVertexArraysOESImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::GenVertexArraysOESImmediate>( - size); - if (c) { - c->Init(n, arrays); - } - } - - void DeleteVertexArraysOES( - GLsizei n, uint32 arrays_shm_id, uint32 arrays_shm_offset) { - gles2::cmds::DeleteVertexArraysOES* c = - GetCmdSpace<gles2::cmds::DeleteVertexArraysOES>(); - if (c) { - c->Init(n, arrays_shm_id, arrays_shm_offset); - } - } - - void DeleteVertexArraysOESImmediate(GLsizei n, const GLuint* arrays) { - const uint32 size = - gles2::cmds::DeleteVertexArraysOESImmediate::ComputeSize(n); - gles2::cmds::DeleteVertexArraysOESImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::DeleteVertexArraysOESImmediate>(size); // NOLINT - if (c) { - c->Init(n, arrays); - } - } - - void IsVertexArrayOES( - GLuint array, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::IsVertexArrayOES* c = - GetCmdSpace<gles2::cmds::IsVertexArrayOES>(); - if (c) { - c->Init(array, result_shm_id, result_shm_offset); - } - } - - void BindVertexArrayOES(GLuint array) { - gles2::cmds::BindVertexArrayOES* c = - GetCmdSpace<gles2::cmds::BindVertexArrayOES>(); - if (c) { - c->Init(array); - } - } - - void SwapBuffers() { - gles2::cmds::SwapBuffers* c = GetCmdSpace<gles2::cmds::SwapBuffers>(); - if (c) { - c->Init(); - } - } - - void GetMaxValueInBufferCHROMIUM( - GLuint buffer_id, GLsizei count, GLenum type, GLuint offset, - uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::GetMaxValueInBufferCHROMIUM* c = - GetCmdSpace<gles2::cmds::GetMaxValueInBufferCHROMIUM>(); - if (c) { - c->Init( - buffer_id, count, type, offset, result_shm_id, result_shm_offset); - } - } - - void GenSharedIdsCHROMIUM( - GLuint namespace_id, GLuint id_offset, GLsizei n, uint32 ids_shm_id, - uint32 ids_shm_offset) { - gles2::cmds::GenSharedIdsCHROMIUM* c = - GetCmdSpace<gles2::cmds::GenSharedIdsCHROMIUM>(); - if (c) { - c->Init(namespace_id, id_offset, n, ids_shm_id, ids_shm_offset); - } - } - - void DeleteSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, uint32 ids_shm_id, - uint32 ids_shm_offset) { - gles2::cmds::DeleteSharedIdsCHROMIUM* c = - GetCmdSpace<gles2::cmds::DeleteSharedIdsCHROMIUM>(); - if (c) { - c->Init(namespace_id, n, ids_shm_id, ids_shm_offset); - } - } - - void RegisterSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, uint32 ids_shm_id, - uint32 ids_shm_offset) { - gles2::cmds::RegisterSharedIdsCHROMIUM* c = - GetCmdSpace<gles2::cmds::RegisterSharedIdsCHROMIUM>(); - if (c) { - c->Init(namespace_id, n, ids_shm_id, ids_shm_offset); - } - } - - void EnableFeatureCHROMIUM( - GLuint bucket_id, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::EnableFeatureCHROMIUM* c = - GetCmdSpace<gles2::cmds::EnableFeatureCHROMIUM>(); - if (c) { - c->Init(bucket_id, result_shm_id, result_shm_offset); - } - } - - void ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) { - gles2::cmds::ResizeCHROMIUM* c = - GetCmdSpace<gles2::cmds::ResizeCHROMIUM>(); - if (c) { - c->Init(width, height, scale_factor); - } - } - - void GetRequestableExtensionsCHROMIUM(uint32 bucket_id) { - gles2::cmds::GetRequestableExtensionsCHROMIUM* c = - GetCmdSpace<gles2::cmds::GetRequestableExtensionsCHROMIUM>(); - if (c) { - c->Init(bucket_id); - } - } - - void RequestExtensionCHROMIUM(uint32 bucket_id) { - gles2::cmds::RequestExtensionCHROMIUM* c = - GetCmdSpace<gles2::cmds::RequestExtensionCHROMIUM>(); - if (c) { - c->Init(bucket_id); - } - } - - void GetMultipleIntegervCHROMIUM( - uint32 pnames_shm_id, uint32 pnames_shm_offset, GLuint count, - uint32 results_shm_id, uint32 results_shm_offset, GLsizeiptr size) { - gles2::cmds::GetMultipleIntegervCHROMIUM* c = - GetCmdSpace<gles2::cmds::GetMultipleIntegervCHROMIUM>(); - if (c) { - c->Init( - pnames_shm_id, pnames_shm_offset, count, results_shm_id, - results_shm_offset, size); - } - } - - void GetProgramInfoCHROMIUM(GLuint program, uint32 bucket_id) { - gles2::cmds::GetProgramInfoCHROMIUM* c = - GetCmdSpace<gles2::cmds::GetProgramInfoCHROMIUM>(); - if (c) { - c->Init(program, bucket_id); - } - } - - void CreateStreamTextureCHROMIUM( - GLuint client_id, uint32 result_shm_id, uint32 result_shm_offset) { - gles2::cmds::CreateStreamTextureCHROMIUM* c = - GetCmdSpace<gles2::cmds::CreateStreamTextureCHROMIUM>(); - if (c) { - c->Init(client_id, result_shm_id, result_shm_offset); - } - } - - void DestroyStreamTextureCHROMIUM(GLuint texture) { - gles2::cmds::DestroyStreamTextureCHROMIUM* c = - GetCmdSpace<gles2::cmds::DestroyStreamTextureCHROMIUM>(); - if (c) { - c->Init(texture); - } - } - - void GetTranslatedShaderSourceANGLE(GLuint shader, uint32 bucket_id) { - gles2::cmds::GetTranslatedShaderSourceANGLE* c = - GetCmdSpace<gles2::cmds::GetTranslatedShaderSourceANGLE>(); - if (c) { - c->Init(shader, bucket_id); - } - } - - void PostSubBufferCHROMIUM(GLint x, GLint y, GLint width, GLint height) { - gles2::cmds::PostSubBufferCHROMIUM* c = - GetCmdSpace<gles2::cmds::PostSubBufferCHROMIUM>(); - if (c) { - c->Init(x, y, width, height); - } - } - - void TexImageIOSurface2DCHROMIUM( - GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, - GLuint plane) { - gles2::cmds::TexImageIOSurface2DCHROMIUM* c = - GetCmdSpace<gles2::cmds::TexImageIOSurface2DCHROMIUM>(); - if (c) { - c->Init(target, width, height, ioSurfaceId, plane); - } - } - - void CopyTextureCHROMIUM( - GLenum target, GLenum source_id, GLenum dest_id, GLint level, - GLint internalformat, GLenum dest_type) { - gles2::cmds::CopyTextureCHROMIUM* c = - GetCmdSpace<gles2::cmds::CopyTextureCHROMIUM>(); - if (c) { - c->Init(target, source_id, dest_id, level, internalformat, dest_type); - } - } - - void DrawArraysInstancedANGLE( - GLenum mode, GLint first, GLsizei count, GLsizei primcount) { - gles2::cmds::DrawArraysInstancedANGLE* c = - GetCmdSpace<gles2::cmds::DrawArraysInstancedANGLE>(); - if (c) { - c->Init(mode, first, count, primcount); - } - } - - void DrawElementsInstancedANGLE( - GLenum mode, GLsizei count, GLenum type, GLuint index_offset, - GLsizei primcount) { - gles2::cmds::DrawElementsInstancedANGLE* c = - GetCmdSpace<gles2::cmds::DrawElementsInstancedANGLE>(); - if (c) { - c->Init(mode, count, type, index_offset, primcount); - } - } - - void VertexAttribDivisorANGLE(GLuint index, GLuint divisor) { - gles2::cmds::VertexAttribDivisorANGLE* c = - GetCmdSpace<gles2::cmds::VertexAttribDivisorANGLE>(); - if (c) { - c->Init(index, divisor); - } - } - - void ProduceTextureCHROMIUM( - GLenum target, uint32 mailbox_shm_id, uint32 mailbox_shm_offset) { - gles2::cmds::ProduceTextureCHROMIUM* c = - GetCmdSpace<gles2::cmds::ProduceTextureCHROMIUM>(); - if (c) { - c->Init(target, mailbox_shm_id, mailbox_shm_offset); - } - } - - void ProduceTextureCHROMIUMImmediate(GLenum target, const GLbyte* mailbox) { - const uint32 size = - gles2::cmds::ProduceTextureCHROMIUMImmediate::ComputeSize(); - gles2::cmds::ProduceTextureCHROMIUMImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::ProduceTextureCHROMIUMImmediate>(size); // NOLINT - if (c) { - c->Init(target, mailbox); - } - } - - void ConsumeTextureCHROMIUM( - GLenum target, uint32 mailbox_shm_id, uint32 mailbox_shm_offset) { - gles2::cmds::ConsumeTextureCHROMIUM* c = - GetCmdSpace<gles2::cmds::ConsumeTextureCHROMIUM>(); - if (c) { - c->Init(target, mailbox_shm_id, mailbox_shm_offset); - } - } - - void ConsumeTextureCHROMIUMImmediate(GLenum target, const GLbyte* mailbox) { - const uint32 size = - gles2::cmds::ConsumeTextureCHROMIUMImmediate::ComputeSize(); - gles2::cmds::ConsumeTextureCHROMIUMImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::ConsumeTextureCHROMIUMImmediate>(size); // NOLINT - if (c) { - c->Init(target, mailbox); - } - } - - void BindUniformLocationCHROMIUM( - GLuint program, GLint location, uint32 name_shm_id, - uint32 name_shm_offset, uint32 data_size) { - gles2::cmds::BindUniformLocationCHROMIUM* c = - GetCmdSpace<gles2::cmds::BindUniformLocationCHROMIUM>(); - if (c) { - c->Init(program, location, name_shm_id, name_shm_offset, data_size); - } - } - - void BindUniformLocationCHROMIUMBucket( - GLuint program, GLint location, uint32 name_bucket_id) { - gles2::cmds::BindUniformLocationCHROMIUMBucket* c = - GetCmdSpace<gles2::cmds::BindUniformLocationCHROMIUMBucket>(); - if (c) { - c->Init(program, location, name_bucket_id); - } - } - - void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) { - gles2::cmds::BindTexImage2DCHROMIUM* c = - GetCmdSpace<gles2::cmds::BindTexImage2DCHROMIUM>(); - if (c) { - c->Init(target, imageId); - } - } - - void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) { - gles2::cmds::ReleaseTexImage2DCHROMIUM* c = - GetCmdSpace<gles2::cmds::ReleaseTexImage2DCHROMIUM>(); - if (c) { - c->Init(target, imageId); - } - } - - void TraceBeginCHROMIUM(GLuint bucket_id) { - gles2::cmds::TraceBeginCHROMIUM* c = - GetCmdSpace<gles2::cmds::TraceBeginCHROMIUM>(); - if (c) { - c->Init(bucket_id); - } - } - - void TraceEndCHROMIUM() { - gles2::cmds::TraceEndCHROMIUM* c = - GetCmdSpace<gles2::cmds::TraceEndCHROMIUM>(); - if (c) { - c->Init(); - } - } - - void AsyncTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, uint32 data_shm_id, - uint32 data_shm_offset) { - gles2::cmds::AsyncTexSubImage2DCHROMIUM* c = - GetCmdSpace<gles2::cmds::AsyncTexSubImage2DCHROMIUM>(); - if (c) { - c->Init( - target, level, xoffset, yoffset, width, height, format, type, - data_shm_id, data_shm_offset); - } - } - - void AsyncTexImage2DCHROMIUM( - 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::cmds::AsyncTexImage2DCHROMIUM* c = - GetCmdSpace<gles2::cmds::AsyncTexImage2DCHROMIUM>(); - if (c) { - c->Init( - target, level, internalformat, width, height, border, format, type, - pixels_shm_id, pixels_shm_offset); - } - } - - void WaitAsyncTexImage2DCHROMIUM(GLenum target) { - gles2::cmds::WaitAsyncTexImage2DCHROMIUM* c = - GetCmdSpace<gles2::cmds::WaitAsyncTexImage2DCHROMIUM>(); - if (c) { - c->Init(target); - } - } - - void DiscardFramebufferEXT( - GLenum target, GLsizei count, uint32 attachments_shm_id, - uint32 attachments_shm_offset) { - gles2::cmds::DiscardFramebufferEXT* c = - GetCmdSpace<gles2::cmds::DiscardFramebufferEXT>(); - if (c) { - c->Init(target, count, attachments_shm_id, attachments_shm_offset); - } - } - - void DiscardFramebufferEXTImmediate( - GLenum target, GLsizei count, const GLenum* attachments) { - const uint32 size = - gles2::cmds::DiscardFramebufferEXTImmediate::ComputeSize(count); - gles2::cmds::DiscardFramebufferEXTImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::DiscardFramebufferEXTImmediate>(size); // NOLINT - if (c) { - c->Init(target, count, attachments); - } - } - - void LoseContextCHROMIUM(GLenum current, GLenum other) { - gles2::cmds::LoseContextCHROMIUM* c = - GetCmdSpace<gles2::cmds::LoseContextCHROMIUM>(); - if (c) { - c->Init(current, other); - } - } - - void WaitSyncPointCHROMIUM(GLuint sync_point) { - gles2::cmds::WaitSyncPointCHROMIUM* c = - GetCmdSpace<gles2::cmds::WaitSyncPointCHROMIUM>(); - if (c) { - c->Init(sync_point); - } - } - - void DrawBuffersEXT( - GLsizei count, uint32 bufs_shm_id, uint32 bufs_shm_offset) { - gles2::cmds::DrawBuffersEXT* c = - GetCmdSpace<gles2::cmds::DrawBuffersEXT>(); - if (c) { - c->Init(count, bufs_shm_id, bufs_shm_offset); - } - } - - void DrawBuffersEXTImmediate(GLsizei count, const GLenum* bufs) { - const uint32 size = - gles2::cmds::DrawBuffersEXTImmediate::ComputeSize(count); - gles2::cmds::DrawBuffersEXTImmediate* c = - GetImmediateCmdSpaceTotalSize<gles2::cmds::DrawBuffersEXTImmediate>( - size); - if (c) { - c->Init(count, bufs); - } - } - - void DiscardBackbufferCHROMIUM() { - gles2::cmds::DiscardBackbufferCHROMIUM* c = - GetCmdSpace<gles2::cmds::DiscardBackbufferCHROMIUM>(); - if (c) { - c->Init(); - } } +} + +void GetProgramInfoCHROMIUM(GLuint program, uint32_t bucket_id) { + gles2::cmds::GetProgramInfoCHROMIUM* c = + GetCmdSpace<gles2::cmds::GetProgramInfoCHROMIUM>(); + if (c) { + c->Init(program, bucket_id); + } +} + +void GetTranslatedShaderSourceANGLE(GLuint shader, uint32_t bucket_id) { + gles2::cmds::GetTranslatedShaderSourceANGLE* c = + GetCmdSpace<gles2::cmds::GetTranslatedShaderSourceANGLE>(); + if (c) { + c->Init(shader, bucket_id); + } +} + +void PostSubBufferCHROMIUM(GLint x, GLint y, GLint width, GLint height) { + gles2::cmds::PostSubBufferCHROMIUM* c = + GetCmdSpace<gles2::cmds::PostSubBufferCHROMIUM>(); + if (c) { + c->Init(x, y, width, height); + } +} + +void TexImageIOSurface2DCHROMIUM(GLenum target, + GLsizei width, + GLsizei height, + GLuint ioSurfaceId, + GLuint plane) { + gles2::cmds::TexImageIOSurface2DCHROMIUM* c = + GetCmdSpace<gles2::cmds::TexImageIOSurface2DCHROMIUM>(); + if (c) { + c->Init(target, width, height, ioSurfaceId, plane); + } +} + +void CopyTextureCHROMIUM(GLenum target, + GLenum source_id, + GLenum dest_id, + GLint level, + GLint internalformat, + GLenum dest_type) { + gles2::cmds::CopyTextureCHROMIUM* c = + GetCmdSpace<gles2::cmds::CopyTextureCHROMIUM>(); + if (c) { + c->Init(target, source_id, dest_id, level, internalformat, dest_type); + } +} + +void DrawArraysInstancedANGLE(GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) { + gles2::cmds::DrawArraysInstancedANGLE* c = + GetCmdSpace<gles2::cmds::DrawArraysInstancedANGLE>(); + if (c) { + c->Init(mode, first, count, primcount); + } +} + +void DrawElementsInstancedANGLE(GLenum mode, + GLsizei count, + GLenum type, + GLuint index_offset, + GLsizei primcount) { + gles2::cmds::DrawElementsInstancedANGLE* c = + GetCmdSpace<gles2::cmds::DrawElementsInstancedANGLE>(); + if (c) { + c->Init(mode, count, type, index_offset, primcount); + } +} + +void VertexAttribDivisorANGLE(GLuint index, GLuint divisor) { + gles2::cmds::VertexAttribDivisorANGLE* c = + GetCmdSpace<gles2::cmds::VertexAttribDivisorANGLE>(); + if (c) { + c->Init(index, divisor); + } +} + +void ProduceTextureCHROMIUMImmediate(GLenum target, const GLbyte* mailbox) { + const uint32_t size = + gles2::cmds::ProduceTextureCHROMIUMImmediate::ComputeSize(); + gles2::cmds::ProduceTextureCHROMIUMImmediate* c = + GetImmediateCmdSpaceTotalSize< + gles2::cmds::ProduceTextureCHROMIUMImmediate>(size); + if (c) { + c->Init(target, mailbox); + } +} + +void ProduceTextureDirectCHROMIUMImmediate(GLuint texture, + GLenum target, + const GLbyte* mailbox) { + const uint32_t size = + gles2::cmds::ProduceTextureDirectCHROMIUMImmediate::ComputeSize(); + gles2::cmds::ProduceTextureDirectCHROMIUMImmediate* c = + GetImmediateCmdSpaceTotalSize< + gles2::cmds::ProduceTextureDirectCHROMIUMImmediate>(size); + if (c) { + c->Init(texture, target, mailbox); + } +} + +void ConsumeTextureCHROMIUMImmediate(GLenum target, const GLbyte* mailbox) { + const uint32_t size = + gles2::cmds::ConsumeTextureCHROMIUMImmediate::ComputeSize(); + gles2::cmds::ConsumeTextureCHROMIUMImmediate* c = + GetImmediateCmdSpaceTotalSize< + gles2::cmds::ConsumeTextureCHROMIUMImmediate>(size); + if (c) { + c->Init(target, mailbox); + } +} + +void BindUniformLocationCHROMIUMBucket(GLuint program, + GLint location, + uint32_t name_bucket_id) { + gles2::cmds::BindUniformLocationCHROMIUMBucket* c = + GetCmdSpace<gles2::cmds::BindUniformLocationCHROMIUMBucket>(); + if (c) { + c->Init(program, location, name_bucket_id); + } +} + +void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) { + gles2::cmds::BindTexImage2DCHROMIUM* c = + GetCmdSpace<gles2::cmds::BindTexImage2DCHROMIUM>(); + if (c) { + c->Init(target, imageId); + } +} + +void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) { + gles2::cmds::ReleaseTexImage2DCHROMIUM* c = + GetCmdSpace<gles2::cmds::ReleaseTexImage2DCHROMIUM>(); + if (c) { + c->Init(target, imageId); + } +} + +void TraceBeginCHROMIUM(GLuint bucket_id) { + gles2::cmds::TraceBeginCHROMIUM* c = + GetCmdSpace<gles2::cmds::TraceBeginCHROMIUM>(); + if (c) { + c->Init(bucket_id); + } +} + +void TraceEndCHROMIUM() { + gles2::cmds::TraceEndCHROMIUM* c = + GetCmdSpace<gles2::cmds::TraceEndCHROMIUM>(); + if (c) { + c->Init(); + } +} + +void AsyncTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + uint32_t data_shm_id, + uint32_t data_shm_offset, + uint32_t async_upload_token, + uint32_t sync_data_shm_id, + uint32_t sync_data_shm_offset) { + gles2::cmds::AsyncTexSubImage2DCHROMIUM* c = + GetCmdSpace<gles2::cmds::AsyncTexSubImage2DCHROMIUM>(); + if (c) { + c->Init(target, + level, + xoffset, + yoffset, + width, + height, + format, + type, + data_shm_id, + data_shm_offset, + async_upload_token, + sync_data_shm_id, + sync_data_shm_offset); + } +} + +void AsyncTexImage2DCHROMIUM(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + uint32_t pixels_shm_id, + uint32_t pixels_shm_offset, + uint32_t async_upload_token, + uint32_t sync_data_shm_id, + uint32_t sync_data_shm_offset) { + gles2::cmds::AsyncTexImage2DCHROMIUM* c = + GetCmdSpace<gles2::cmds::AsyncTexImage2DCHROMIUM>(); + if (c) { + c->Init(target, + level, + internalformat, + width, + height, + format, + type, + pixels_shm_id, + pixels_shm_offset, + async_upload_token, + sync_data_shm_id, + sync_data_shm_offset); + } +} + +void WaitAsyncTexImage2DCHROMIUM(GLenum target) { + gles2::cmds::WaitAsyncTexImage2DCHROMIUM* c = + GetCmdSpace<gles2::cmds::WaitAsyncTexImage2DCHROMIUM>(); + if (c) { + c->Init(target); + } +} + +void WaitAllAsyncTexImage2DCHROMIUM() { + gles2::cmds::WaitAllAsyncTexImage2DCHROMIUM* c = + GetCmdSpace<gles2::cmds::WaitAllAsyncTexImage2DCHROMIUM>(); + if (c) { + c->Init(); + } +} + +void DiscardFramebufferEXTImmediate(GLenum target, + GLsizei count, + const GLenum* attachments) { + const uint32_t size = + gles2::cmds::DiscardFramebufferEXTImmediate::ComputeSize(count); + gles2::cmds::DiscardFramebufferEXTImmediate* c = + GetImmediateCmdSpaceTotalSize< + gles2::cmds::DiscardFramebufferEXTImmediate>(size); + if (c) { + c->Init(target, count, attachments); + } +} + +void LoseContextCHROMIUM(GLenum current, GLenum other) { + gles2::cmds::LoseContextCHROMIUM* c = + GetCmdSpace<gles2::cmds::LoseContextCHROMIUM>(); + if (c) { + c->Init(current, other); + } +} + +void WaitSyncPointCHROMIUM(GLuint sync_point) { + gles2::cmds::WaitSyncPointCHROMIUM* c = + GetCmdSpace<gles2::cmds::WaitSyncPointCHROMIUM>(); + if (c) { + c->Init(sync_point); + } +} + +void DrawBuffersEXTImmediate(GLsizei count, const GLenum* bufs) { + const uint32_t size = + gles2::cmds::DrawBuffersEXTImmediate::ComputeSize(count); + gles2::cmds::DrawBuffersEXTImmediate* c = + GetImmediateCmdSpaceTotalSize<gles2::cmds::DrawBuffersEXTImmediate>(size); + if (c) { + c->Init(count, bufs); + } +} + +void DiscardBackbufferCHROMIUM() { + gles2::cmds::DiscardBackbufferCHROMIUM* c = + GetCmdSpace<gles2::cmds::DiscardBackbufferCHROMIUM>(); + if (c) { + c->Init(); + } +} + +void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order, + GLenum plane_transform, + GLuint overlay_texture_id, + GLint bounds_x, + GLint bounds_y, + GLint bounds_width, + GLint bounds_height, + GLfloat uv_x, + GLfloat uv_y, + GLfloat uv_width, + GLfloat uv_height) { + gles2::cmds::ScheduleOverlayPlaneCHROMIUM* c = + GetCmdSpace<gles2::cmds::ScheduleOverlayPlaneCHROMIUM>(); + if (c) { + c->Init(plane_z_order, + plane_transform, + overlay_texture_id, + bounds_x, + bounds_y, + bounds_width, + bounds_height, + uv_x, + uv_y, + uv_width, + uv_height); + } +} #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/gles2_implementation.cc b/chromium/gpu/command_buffer/client/gles2_implementation.cc index b0efc3769da..716fb55fbc2 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation.cc +++ b/chromium/gpu/command_buffer/client/gles2_implementation.cc @@ -6,23 +6,24 @@ #include "gpu/command_buffer/client/gles2_implementation.h" +#include <GLES2/gl2ext.h> +#include <GLES2/gl2extchromium.h> #include <algorithm> +#include <limits> #include <map> #include <queue> #include <set> -#include <limits> -#include <stdio.h> -#include <string.h> -#include <GLES2/gl2ext.h> -#include <GLES2/gl2extchromium.h> +#include <sstream> +#include <string> +#include "base/bind.h" #include "gpu/command_buffer/client/buffer_tracker.h" +#include "gpu/command_buffer/client/gpu_control.h" #include "gpu/command_buffer/client/gpu_memory_buffer_tracker.h" #include "gpu/command_buffer/client/program_info_manager.h" #include "gpu/command_buffer/client/query_tracker.h" #include "gpu/command_buffer/client/transfer_buffer.h" #include "gpu/command_buffer/client/vertex_array_object_manager.h" #include "gpu/command_buffer/common/gles2_cmd_utils.h" -#include "gpu/command_buffer/common/gpu_control.h" #include "gpu/command_buffer/common/trace_event.h" #include "ui/gfx/gpu_memory_buffer.h" @@ -31,8 +32,8 @@ #endif #if defined(GPU_CLIENT_DEBUG) -#include "ui/gl/gl_switches.h" #include "base/command_line.h" +#include "ui/gl/gl_switches.h" #endif namespace gpu { @@ -66,8 +67,8 @@ GLES2Implementation::GLStaticState::IntState::IntState() max_vertex_texture_image_units(0), max_vertex_uniform_vectors(0), num_compressed_texture_formats(0), - num_shader_binary_formats(0) { -} + num_shader_binary_formats(0), + bind_generates_resource_chromium(0) {} GLES2Implementation::SingleThreadChecker::SingleThreadChecker( GLES2Implementation* gles2_implementation) @@ -82,12 +83,12 @@ GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() { } GLES2Implementation::GLES2Implementation( - GLES2CmdHelper* helper, - ShareGroup* share_group, - TransferBufferInterface* transfer_buffer, - bool bind_generates_resource, - bool free_everything_when_invisible, - GpuControl* gpu_control) + GLES2CmdHelper* helper, + ShareGroup* share_group, + TransferBufferInterface* transfer_buffer, + bool bind_generates_resource, + bool lose_context_when_out_of_memory, + GpuControl* gpu_control) : helper_(helper), transfer_buffer_(transfer_buffer), angle_pack_reverse_row_order_status_(kUnknownExtensionStatus), @@ -107,23 +108,25 @@ GLES2Implementation::GLES2Implementation( bound_array_buffer_id_(0), bound_pixel_pack_transfer_buffer_id_(0), bound_pixel_unpack_transfer_buffer_id_(0), + async_upload_token_(0), + async_upload_sync_(NULL), + async_upload_sync_shm_id_(0), + async_upload_sync_shm_offset_(0), error_bits_(0), debug_(false), + lose_context_when_out_of_memory_(lose_context_when_out_of_memory), use_count_(0), - current_query_(NULL), error_message_callback_(NULL), gpu_control_(gpu_control), - surface_visible_(true), - free_everything_when_invisible_(free_everything_when_invisible), capabilities_(gpu_control->GetCapabilities()), weak_ptr_factory_(this) { DCHECK(helper); DCHECK(transfer_buffer); DCHECK(gpu_control); - char temp[128]; - sprintf(temp, "%p", static_cast<void*>(this)); - this_in_hex_ = std::string(temp); + std::stringstream ss; + ss << std::hex << this; + this_in_hex_ = ss.str(); GPU_CLIENT_LOG_CODE_BLOCK({ debug_ = CommandLine::ForCurrentProcess()->HasSwitch( @@ -141,6 +144,7 @@ bool GLES2Implementation::Initialize( unsigned int min_transfer_buffer_size, unsigned int max_transfer_buffer_size, unsigned int mapped_memory_limit) { + TRACE_EVENT0("gpu", "GLES2Implementation::Initialize"); DCHECK_GE(starting_transfer_buffer_size, min_transfer_buffer_size); DCHECK_LE(starting_transfer_buffer_size, max_transfer_buffer_size); DCHECK_GE(min_transfer_buffer_size, kStartingOffset); @@ -155,7 +159,15 @@ bool GLES2Implementation::Initialize( return false; } - mapped_memory_.reset(new MappedMemoryManager(helper_, mapped_memory_limit)); + mapped_memory_.reset( + new MappedMemoryManager( + helper_, + base::Bind(&GLES2Implementation::PollAsyncUploads, + // The mapped memory manager is owned by |this| here, and + // since its destroyed before before we destroy ourselves + // we don't need extra safety measures for this closure. + base::Unretained(this)), + mapped_memory_limit)); unsigned chunk_size = 2 * 1024 * 1024; if (mapped_memory_limit != kNoLimit) { @@ -190,10 +202,21 @@ bool GLES2Implementation::Initialize( reserved_ids_[0], reserved_ids_[1])); + // GL_BIND_GENERATES_RESOURCE_CHROMIUM state must be the same + // on Client & Service. + if (static_state_.int_state.bind_generates_resource_chromium != + (share_group_->bind_generates_resource() ? 1 : 0)) { + SetGLError(GL_INVALID_OPERATION, + "Initialize", + "Service bind_generates_resource mismatch."); + return false; + } + return true; } bool GLES2Implementation::QueryAndCacheStaticState() { + TRACE_EVENT0("gpu", "GLES2Implementation::QueryAndCacheStaticState"); // Setup query for multiple GetIntegerv's static const GLenum pnames[] = { GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, @@ -208,6 +231,7 @@ bool GLES2Implementation::QueryAndCacheStaticState() { GL_MAX_VERTEX_UNIFORM_VECTORS, GL_NUM_COMPRESSED_TEXTURE_FORMATS, GL_NUM_SHADER_BINARY_FORMATS, + GL_BIND_GENERATES_RESOURCE_CHROMIUM, }; GetMultipleIntegervState integerv_state( @@ -276,8 +300,19 @@ GLES2Implementation::~GLES2Implementation() { #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) DeleteBuffers(arraysize(reserved_ids_), &reserved_ids_[0]); #endif + + // Release any per-context data in share group. + share_group_->FreeContext(this); + buffer_tracker_.reset(); + FreeAllAsyncUploadBuffers(); + + if (async_upload_sync_) { + mapped_memory_->Free(async_upload_sync_); + async_upload_sync_ = NULL; + } + // Make sure the commands make it the service. WaitForCmd(); } @@ -307,6 +342,7 @@ void GLES2Implementation::FreeUnusedSharedMemory() { } void GLES2Implementation::FreeEverything() { + FreeAllAsyncUploadBuffers(); WaitForCmd(); query_tracker_->Shrink(); FreeUnusedSharedMemory(); @@ -341,19 +377,15 @@ void GLES2Implementation::SignalQuery(uint32 query, } void GLES2Implementation::SetSurfaceVisible(bool visible) { + TRACE_EVENT1( + "gpu", "GLES2Implementation::SetSurfaceVisible", "visible", visible); // TODO(piman): This probably should be ShallowFlushCHROMIUM(). Flush(); - surface_visible_ = visible; gpu_control_->SetSurfaceVisible(visible); if (!visible) FreeEverything(); } -void GLES2Implementation::SendManagedMemoryStats( - const ManagedMemoryStats& stats) { - gpu_control_->SendManagedMemoryStats(stats); -} - void GLES2Implementation::WaitForCmd() { TRACE_EVENT0("gpu", "GLES2::WaitForCmd"); helper_->CommandBufferHelper::Finish(); @@ -484,6 +516,11 @@ void GLES2Implementation::SetGLError( error_message_callback_->OnErrorMessage(temp.c_str(), 0); } error_bits_ |= GLES2Util::GLErrorToErrorBit(error); + + if (error == GL_OUT_OF_MEMORY && lose_context_when_out_of_memory_) { + helper_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, + GL_UNKNOWN_CONTEXT_RESET_ARB); + } } void GLES2Implementation::SetGLErrorInvalidEnum( @@ -827,6 +864,10 @@ void GLES2Implementation::DrawElements( if (count == 0) { return; } + if (vertex_array_object_manager_->bound_element_array_buffer() != 0 && + !ValidateOffset("glDrawElements", reinterpret_cast<GLintptr>(indices))) { + return; + } GLuint offset = 0; bool simulated = false; if (!vertex_array_object_manager_->SetupSimulatedIndexAndClientSideBuffers( @@ -847,8 +888,6 @@ void GLES2Implementation::Flush() { // Flush our command buffer // (tell the service to execute up to the flush cmd.) helper_->CommandBufferHelper::Flush(); - if (!surface_visible_ && free_everything_when_invisible_) - FreeEverything(); } void GLES2Implementation::ShallowFlushCHROMIUM() { @@ -863,27 +902,16 @@ void GLES2Implementation::ShallowFlushCHROMIUM() { void GLES2Implementation::Finish() { GPU_CLIENT_SINGLE_THREAD_CHECK(); FinishHelper(); - if (!surface_visible_ && free_everything_when_invisible_) - FreeEverything(); } void GLES2Implementation::ShallowFinishCHROMIUM() { GPU_CLIENT_SINGLE_THREAD_CHECK(); + TRACE_EVENT0("gpu", "GLES2::ShallowFinishCHROMIUM"); // Flush our command buffer (tell the service to execute up to the flush cmd // and don't return until it completes). helper_->CommandBufferHelper::Finish(); } -bool GLES2Implementation::MustBeContextLost() { - bool context_lost = helper_->IsContextLost(); - if (!context_lost) { - WaitForCmd(); - context_lost = helper_->IsContextLost(); - } - CHECK(context_lost); - return context_lost; -} - void GLES2Implementation::FinishHelper() { GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFinish()"); TRACE_EVENT0("gpu", "GLES2::Finish"); @@ -1090,14 +1118,14 @@ void GLES2Implementation::DeleteShaderStub( GLint GLES2Implementation::GetAttribLocationHelper( GLuint program, const char* name) { - typedef cmds::GetAttribLocationBucket::Result Result; + typedef cmds::GetAttribLocation::Result Result; Result* result = GetResultAs<Result*>(); if (!result) { return -1; } *result = -1; SetBucketAsCString(kResultBucketId, name); - helper_->GetAttribLocationBucket( + helper_->GetAttribLocation( program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); helper_->SetBucketSize(kResultBucketId, 0); @@ -1119,14 +1147,14 @@ GLint GLES2Implementation::GetAttribLocation( GLint GLES2Implementation::GetUniformLocationHelper( GLuint program, const char* name) { - typedef cmds::GetUniformLocationBucket::Result Result; + typedef cmds::GetUniformLocation::Result Result; Result* result = GetResultAs<Result*>(); if (!result) { return -1; } *result = -1; SetBucketAsCString(kResultBucketId, name); - helper_->GetUniformLocationBucket(program, kResultBucketId, + helper_->GetUniformLocation(program, kResultBucketId, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); helper_->SetBucketSize(kResultBucketId, 0); @@ -1146,16 +1174,6 @@ GLint GLES2Implementation::GetUniformLocation( return loc; } -void GLES2Implementation::UseProgram(GLuint program) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program << ")"); - if (current_program_ != program) { - current_program_ = program; - helper_->UseProgram(program); - } - CheckGLError(); -} - bool GLES2Implementation::GetProgramivHelper( GLuint program, GLenum pname, GLint* params) { bool got_value = share_group_->program_info_manager()->GetProgramiv( @@ -1228,13 +1246,13 @@ void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { case GL_UNPACK_ALIGNMENT: unpack_alignment_ = param; break; - case GL_UNPACK_ROW_LENGTH: + case GL_UNPACK_ROW_LENGTH_EXT: unpack_row_length_ = param; return; - case GL_UNPACK_SKIP_ROWS: + case GL_UNPACK_SKIP_ROWS_EXT: unpack_skip_rows_ = param; return; - case GL_UNPACK_SKIP_PIXELS: + case GL_UNPACK_SKIP_PIXELS_EXT: unpack_skip_pixels_ = param; return; case GL_UNPACK_FLIP_Y_CHROMIUM: @@ -1251,7 +1269,6 @@ void GLES2Implementation::PixelStorei(GLenum pname, GLint param) { CheckGLError(); } - void GLES2Implementation::VertexAttribPointer( GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { @@ -1273,10 +1290,18 @@ void GLES2Implementation::VertexAttribPointer( #if defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) if (bound_array_buffer_id_ != 0) { // Only report NON client side buffers to the service. + if (!ValidateOffset("glVertexAttribPointer", + reinterpret_cast<GLintptr>(ptr))) { + return; + } helper_->VertexAttribPointer(index, size, type, normalized, stride, ToGLuint(ptr)); } #else // !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) + if (!ValidateOffset("glVertexAttribPointer", + reinterpret_cast<GLintptr>(ptr))) { + return; + } helper_->VertexAttribPointer(index, size, type, normalized, stride, ToGLuint(ptr)); #endif // !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) @@ -1366,10 +1391,8 @@ void GLES2Implementation::ShaderSource( void GLES2Implementation::BufferDataHelper( GLenum target, GLsizeiptr size, const void* data, GLenum usage) { - if (size < 0) { - SetGLError(GL_INVALID_VALUE, "glBufferData", "size < 0"); + if (!ValidateSize("glBufferData", size)) return; - } GLuint buffer_id; if (GetBoundPixelTransferBuffer(target, "glBufferData", &buffer_id)) { @@ -1378,13 +1401,8 @@ void GLES2Implementation::BufferDataHelper( } BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffer_id); - if (buffer) { - // Free buffer memory, pending the passage of a token. - buffer_tracker_->FreePendingToken(buffer, helper_->InsertToken()); - - // Remove old buffer. - buffer_tracker_->RemoveBuffer(buffer_id); - } + if (buffer) + RemoveTransferBuffer(buffer); // Create new buffer. buffer = buffer_tracker_->CreateBuffer(buffer_id, size); @@ -1445,8 +1463,8 @@ void GLES2Implementation::BufferSubDataHelper( return; } - if (size < 0) { - SetGLError(GL_INVALID_VALUE, "glBufferSubData", "size < 0"); + if (!ValidateSize("glBufferSubData", size) || + !ValidateOffset("glBufferSubData", offset)) { return; } @@ -1512,6 +1530,30 @@ void GLES2Implementation::BufferSubData( CheckGLError(); } +void GLES2Implementation::RemoveTransferBuffer(BufferTracker::Buffer* buffer) { + int32 token = buffer->last_usage_token(); + uint32 async_token = buffer->last_async_upload_token(); + + if (async_token) { + if (HasAsyncUploadTokenPassed(async_token)) { + buffer_tracker_->Free(buffer); + } else { + detached_async_upload_memory_.push_back( + std::make_pair(buffer->address(), async_token)); + buffer_tracker_->Unmanage(buffer); + } + } else if (token) { + if (helper_->HasTokenPassed(token)) + buffer_tracker_->Free(buffer); + else + buffer_tracker_->FreePendingToken(buffer, token); + } else { + buffer_tracker_->Free(buffer); + } + + buffer_tracker_->RemoveBuffer(buffer->id()); +} + bool GLES2Implementation::GetBoundPixelTransferBuffer( GLenum target, const char* function_name, @@ -1573,6 +1615,10 @@ void GLES2Implementation::CompressedTexImage2D( SetGLError(GL_INVALID_VALUE, "glCompressedTexImage2D", "dimension < 0"); return; } + if (border != 0) { + SetGLError(GL_INVALID_VALUE, "glCompressedTexImage2D", "border != 0"); + return; + } if (height == 0 || width == 0) { return; } @@ -1585,15 +1631,15 @@ void GLES2Implementation::CompressedTexImage2D( "glCompressedTexImage2D", offset, image_size); if (buffer && buffer->shm_id() != -1) { helper_->CompressedTexImage2D( - target, level, internalformat, width, height, border, image_size, + target, level, internalformat, width, height, image_size, buffer->shm_id(), buffer->shm_offset() + offset); - buffer->set_transfer_ready_token(helper_->InsertToken()); + buffer->set_last_usage_token(helper_->InsertToken()); } return; } SetBucketContents(kResultBucketId, data, image_size); helper_->CompressedTexImage2DBucket( - target, level, internalformat, width, height, border, kResultBucketId); + target, level, internalformat, width, height, kResultBucketId); // Free the bucket. This is not required but it does free up the memory. // and we don't have to wait for the result so from the client's perspective // it's cheap. @@ -1628,7 +1674,7 @@ void GLES2Implementation::CompressedTexSubImage2D( helper_->CompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, image_size, buffer->shm_id(), buffer->shm_offset() + offset); - buffer->set_transfer_ready_token(helper_->InsertToken()); + buffer->set_last_usage_token(helper_->InsertToken()); CheckGLError(); } return; @@ -1695,6 +1741,10 @@ void GLES2Implementation::TexImage2D( SetGLError(GL_INVALID_VALUE, "glTexImage2D", "dimension < 0"); return; } + if (border != 0) { + SetGLError(GL_INVALID_VALUE, "glTexImage2D", "border != 0"); + return; + } uint32 size; uint32 unpadded_row_size; uint32 padded_row_size; @@ -1713,9 +1763,9 @@ void GLES2Implementation::TexImage2D( "glTexImage2D", offset, size); if (buffer && buffer->shm_id() != -1) { helper_->TexImage2D( - target, level, internalformat, width, height, border, format, type, + target, level, internalformat, width, height, format, type, buffer->shm_id(), buffer->shm_offset() + offset); - buffer->set_transfer_ready_token(helper_->InsertToken()); + buffer->set_last_usage_token(helper_->InsertToken()); CheckGLError(); } return; @@ -1724,7 +1774,7 @@ void GLES2Implementation::TexImage2D( // If there's no data just issue TexImage2D if (!pixels) { helper_->TexImage2D( - target, level, internalformat, width, height, border, format, type, + target, level, internalformat, width, height, format, type, 0, 0); CheckGLError(); return; @@ -1764,7 +1814,7 @@ void GLES2Implementation::TexImage2D( pixels, height, unpadded_row_size, src_padded_row_size, unpack_flip_y_, buffer.address(), padded_row_size); helper_->TexImage2D( - target, level, internalformat, width, height, border, format, type, + target, level, internalformat, width, height, format, type, buffer.shm_id(), buffer.offset()); CheckGLError(); return; @@ -1772,7 +1822,7 @@ void GLES2Implementation::TexImage2D( // No, so send it using TexSubImage2D. helper_->TexImage2D( - target, level, internalformat, width, height, border, format, type, + target, level, internalformat, width, height, format, type, 0, 0); TexSubImage2DImpl( target, level, 0, 0, width, height, format, type, unpadded_row_size, @@ -1821,7 +1871,7 @@ void GLES2Implementation::TexSubImage2D( helper_->TexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, buffer->shm_id(), buffer->shm_offset() + offset, false); - buffer->set_transfer_ready_token(helper_->InsertToken()); + buffer->set_last_usage_token(helper_->InsertToken()); CheckGLError(); } return; @@ -1859,9 +1909,9 @@ void GLES2Implementation::TexSubImage2D( } static GLint ComputeNumRowsThatFitInBuffer( - GLsizeiptr padded_row_size, GLsizeiptr unpadded_row_size, + uint32 padded_row_size, uint32 unpadded_row_size, unsigned int size) { - DCHECK_GE(unpadded_row_size, 0); + DCHECK_GE(unpadded_row_size, 0u); if (padded_row_size == 0) { return 1; } @@ -2146,7 +2196,8 @@ const GLubyte* GLES2Implementation::GetStringHelper(GLenum name) { case GL_EXTENSIONS: str += std::string(str.empty() ? "" : " ") + "GL_CHROMIUM_flipy " - "GL_EXT_unpack_subimage"; + "GL_EXT_unpack_subimage " + "GL_CHROMIUM_map_sub"; if (capabilities_.map_image) { // The first space character is intentional. str += " GL_CHROMIUM_map_image"; @@ -2404,24 +2455,24 @@ void GLES2Implementation::GenQueriesEXTHelper( // deleted the resource. bool GLES2Implementation::BindBufferHelper( - GLenum target, GLuint buffer) { + GLenum target, GLuint buffer_id) { // TODO(gman): See note #1 above. bool changed = false; switch (target) { case GL_ARRAY_BUFFER: - if (bound_array_buffer_id_ != buffer) { - bound_array_buffer_id_ = buffer; + if (bound_array_buffer_id_ != buffer_id) { + bound_array_buffer_id_ = buffer_id; changed = true; } break; case GL_ELEMENT_ARRAY_BUFFER: - changed = vertex_array_object_manager_->BindElementArray(buffer); + changed = vertex_array_object_manager_->BindElementArray(buffer_id); break; case GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM: - bound_pixel_pack_transfer_buffer_id_ = buffer; + bound_pixel_pack_transfer_buffer_id_ = buffer_id; break; case GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM: - bound_pixel_unpack_transfer_buffer_id_ = buffer; + bound_pixel_unpack_transfer_buffer_id_ = buffer_id; break; default: changed = true; @@ -2429,7 +2480,7 @@ bool GLES2Implementation::BindBufferHelper( } // TODO(gman): There's a bug here. If the target is invalid the ID will not be // used even though it's marked it as used here. - GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind(buffer); + GetIdHandler(id_namespaces::kBuffers)->MarkAsUsedForBind(buffer_id); return changed; } @@ -2530,7 +2581,7 @@ bool GLES2Implementation::BindTextureHelper(GLenum target, GLuint texture) { return changed; } -bool GLES2Implementation::BindVertexArrayHelper(GLuint array) { +bool GLES2Implementation::BindVertexArrayOESHelper(GLuint array) { // TODO(gman): See note #1 above. bool changed = false; if (!vertex_array_object_manager_->BindVertexArray(array, &changed)) { @@ -2545,6 +2596,15 @@ bool GLES2Implementation::BindVertexArrayHelper(GLuint array) { return changed; } +bool GLES2Implementation::UseProgramHelper(GLuint program) { + bool changed = false; + if (current_program_ != program) { + current_program_ = program; + changed = true; + } + return changed; +} + bool GLES2Implementation::IsBufferReservedId(GLuint id) { return vertex_array_object_manager_->IsReservedId(id); } @@ -2563,13 +2623,11 @@ void GLES2Implementation::DeleteBuffersHelper( bound_array_buffer_id_ = 0; } vertex_array_object_manager_->UnbindBuffer(buffers[ii]); + BufferTracker::Buffer* buffer = buffer_tracker_->GetBuffer(buffers[ii]); - if (buffer) { - // Free buffer memory, pending the passage of a token. - buffer_tracker_->FreePendingToken(buffer, helper_->InsertToken()); - // Remove buffer. - buffer_tracker_->RemoveBuffer(buffers[ii]); - } + if (buffer) + RemoveTransferBuffer(buffer); + if (buffers[ii] == bound_pixel_unpack_transfer_buffer_id_) { bound_pixel_unpack_transfer_buffer_id_ = 0; } @@ -2782,7 +2840,7 @@ void GLES2Implementation::Swap() { weak_ptr_factory_.GetWeakPtr())); } -void GLES2Implementation::PartialSwapBuffers(gfx::Rect sub_buffer) { +void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) { PostSubBufferCHROMIUM(sub_buffer.x(), sub_buffer.y(), sub_buffer.width(), @@ -2796,6 +2854,46 @@ void GLES2Implementation::SetSwapBuffersCompleteCallback( swap_buffers_complete_callback_ = swap_buffers_complete_callback; } +static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { + switch (plane_transform) { + case gfx::OVERLAY_TRANSFORM_INVALID: + break; + case gfx::OVERLAY_TRANSFORM_NONE: + return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; + case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL: + return GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM; + case gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL: + return GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM; + case gfx::OVERLAY_TRANSFORM_ROTATE_90: + return GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM; + case gfx::OVERLAY_TRANSFORM_ROTATE_180: + return GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM; + case gfx::OVERLAY_TRANSFORM_ROTATE_270: + return GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM; + } + NOTREACHED(); + return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; +} + +void GLES2Implementation::ScheduleOverlayPlane( + int plane_z_order, + gfx::OverlayTransform plane_transform, + unsigned overlay_texture_id, + const gfx::Rect& display_bounds, + const gfx::RectF& uv_rect) { + ScheduleOverlayPlaneCHROMIUM(plane_z_order, + GetGLESOverlayTransform(plane_transform), + overlay_texture_id, + display_bounds.x(), + display_bounds.y(), + display_bounds.width(), + display_bounds.height(), + uv_rect.x(), + uv_rect.y(), + uv_rect.width(), + uv_rect.height()); +} + void GLES2Implementation::OnSwapBuffersComplete() { if (!swap_buffers_complete_callback_.is_null()) swap_buffers_complete_callback_.Run(); @@ -2835,10 +2933,11 @@ void* GLES2Implementation::MapBufferSubDataCHROMIUM( "glMapBufferSubDataCHROMIUM", access, "access"); return NULL; } - if (offset < 0 || size < 0) { - SetGLError(GL_INVALID_VALUE, "glMapBufferSubDataCHROMIUM", "bad range"); + if (!ValidateSize("glMapBufferSubDataCHROMIUM", size) || + !ValidateOffset("glMapBufferSubDataCHROMIUM", offset)) { return NULL; } + int32 shm_id; unsigned int shm_offset; void* mem = mapped_memory_->Alloc(size, &shm_id, &shm_offset); @@ -3048,6 +3147,7 @@ void GLES2Implementation::GetMultipleIntegervCHROMIUM( " " << i << ": " << GLES2Util::GetStringGLState(pnames[i])); } }); + DCHECK(size >= 0 && FitInt32NonNegative<GLsizeiptr>(size)); GetMultipleIntegervState state(pnames, count, results, size); if (!GetMultipleIntegervSetup(&state)) { @@ -3208,29 +3308,8 @@ GLuint GLES2Implementation::CreateStreamTextureCHROMIUM(GLuint texture) { GPU_CLIENT_LOG("[" << GetLogPrefix() << "] CreateStreamTextureCHROMIUM(" << texture << ")"); TRACE_EVENT0("gpu", "GLES2::CreateStreamTextureCHROMIUM"); - typedef cmds::CreateStreamTextureCHROMIUM::Result Result; - Result* result = GetResultAs<Result*>(); - if (!result) { - return GL_ZERO; - } - *result = GL_ZERO; - - helper_->CreateStreamTextureCHROMIUM(texture, - GetResultShmId(), - GetResultShmOffset()); - WaitForCmd(); - GLuint result_value = *result; - CheckGLError(); - return result_value; -} - -void GLES2Implementation::DestroyStreamTextureCHROMIUM(GLuint texture) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] DestroyStreamTextureCHROMIUM(" - << texture << ")"); - TRACE_EVENT0("gpu", "GLES2::DestroyStreamTextureCHROMIUM"); - helper_->DestroyStreamTextureCHROMIUM(texture); - CheckGLError(); + helper_->CommandBufferHelper::Flush(); + return gpu_control_->CreateStreamTexture(texture); } void GLES2Implementation::PostSubBufferCHROMIUM( @@ -3290,7 +3369,8 @@ void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) { << ", " << id << ")"); // if any outstanding queries INV_OP - if (current_query_) { + QueryMap::iterator it = current_queries_.find(target); + if (it != current_queries_.end()) { SetGLError( GL_INVALID_OPERATION, "glBeginQueryEXT", "query already in progress"); return; @@ -3309,7 +3389,9 @@ void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) { if (!query) { query = query_tracker_->CreateQuery(id, target); if (!query) { - MustBeContextLost(); + SetGLError(GL_OUT_OF_MEMORY, + "glBeginQueryEXT", + "transfer buffer allocation failed"); return; } } else if (query->target() != target) { @@ -3318,7 +3400,7 @@ void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) { return; } - current_query_ = query; + current_queries_[target] = query; query->Begin(this); CheckGLError(); @@ -3333,19 +3415,15 @@ void GLES2Implementation::EndQueryEXT(GLenum target) { return; } - if (!current_query_) { + QueryMap::iterator it = current_queries_.find(target); + if (it == current_queries_.end()) { SetGLError(GL_INVALID_OPERATION, "glEndQueryEXT", "no active query"); return; } - if (current_query_->target() != target) { - SetGLError(GL_INVALID_OPERATION, - "glEndQueryEXT", "target does not match active query"); - return; - } - - current_query_->End(this); - current_query_ = NULL; + QueryTracker::Query* query = it->second; + query->End(this); + current_queries_.erase(it); CheckGLError(); } @@ -3361,8 +3439,13 @@ void GLES2Implementation::GetQueryivEXT( SetGLErrorInvalidEnum("glGetQueryivEXT", pname, "pname"); return; } - *params = (current_query_ && current_query_->target() == target) ? - current_query_->id() : 0; + QueryMap::iterator it = current_queries_.find(target); + if (it != current_queries_.end()) { + QueryTracker::Query* query = it->second; + *params = query->id(); + } else { + *params = 0; + } GPU_CLIENT_LOG(" " << *params); CheckGLError(); } @@ -3380,7 +3463,8 @@ void GLES2Implementation::GetQueryObjectuivEXT( return; } - if (query == current_query_) { + QueryMap::iterator it = current_queries_.find(query->target()); + if (it != current_queries_.end()) { SetGLError( GL_INVALID_OPERATION, "glQueryObjectuivEXT", "query active. Did you to call glEndQueryEXT?"); @@ -3399,8 +3483,7 @@ void GLES2Implementation::GetQueryObjectuivEXT( if (!query->CheckResultsAvailable(helper_)) { helper_->WaitForToken(query->token()); if (!query->CheckResultsAvailable(helper_)) { - // TODO(gman): Speed this up. - WaitForCmd(); + FinishHelper(); CHECK(query->CheckResultsAvailable(helper_)); } } @@ -3471,6 +3554,11 @@ void GLES2Implementation::DrawElementsInstancedANGLE( if (primcount == 0) { return; } + if (vertex_array_object_manager_->bound_element_array_buffer() != 0 && + !ValidateOffset("glDrawElementsInstancedANGLE", + reinterpret_cast<GLintptr>(indices))) { + return; + } GLuint offset = 0; bool simulated = false; if (!vertex_array_object_manager_->SetupSimulatedIndexAndClientSideBuffers( @@ -3490,12 +3578,66 @@ void GLES2Implementation::GenMailboxCHROMIUM( << static_cast<const void*>(mailbox) << ")"); TRACE_EVENT0("gpu", "GLES2::GenMailboxCHROMIUM"); - std::vector<gpu::Mailbox> names; - if (!gpu_control_->GenerateMailboxNames(1, &names)) { - SetGLError(GL_OUT_OF_MEMORY, "glGenMailboxCHROMIUM", "Generate failed."); - return; - } - memcpy(mailbox, names[0].name, GL_MAILBOX_SIZE_CHROMIUM); + gpu::Mailbox result = gpu::Mailbox::Generate(); + memcpy(mailbox, result.name, sizeof(result.name)); +} + +void GLES2Implementation::ProduceTextureCHROMIUM(GLenum target, + const GLbyte* data) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glProduceTextureCHROMIUM(" + << static_cast<const void*>(data) << ")"); + const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); + DCHECK(mailbox.Verify()) << "ProduceTextureCHROMIUM was passed a " + "mailbox that was not generated by " + "GenMailboxCHROMIUM."; + helper_->ProduceTextureCHROMIUMImmediate(target, data); + CheckGLError(); +} + +void GLES2Implementation::ProduceTextureDirectCHROMIUM( + GLuint texture, GLenum target, const GLbyte* data) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glProduceTextureDirectCHROMIUM(" + << static_cast<const void*>(data) << ")"); + const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); + DCHECK(mailbox.Verify()) << "ProduceTextureDirectCHROMIUM was passed a " + "mailbox that was not generated by " + "GenMailboxCHROMIUM."; + helper_->ProduceTextureDirectCHROMIUMImmediate(texture, target, data); + CheckGLError(); +} + +void GLES2Implementation::ConsumeTextureCHROMIUM(GLenum target, + const GLbyte* data) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glConsumeTextureCHROMIUM(" + << static_cast<const void*>(data) << ")"); + const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); + DCHECK(mailbox.Verify()) << "ConsumeTextureCHROMIUM was passed a " + "mailbox that was not generated by " + "GenMailboxCHROMIUM."; + helper_->ConsumeTextureCHROMIUMImmediate(target, data); + CheckGLError(); +} + +GLuint GLES2Implementation::CreateAndConsumeTextureCHROMIUM( + GLenum target, const GLbyte* data) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateAndConsumeTextureCHROMIUM(" + << static_cast<const void*>(data) << ")"); + const Mailbox& mailbox = *reinterpret_cast<const Mailbox*>(data); + DCHECK(mailbox.Verify()) << "CreateAndConsumeTextureCHROMIUM was passed a " + "mailbox that was not generated by " + "GenMailboxCHROMIUM."; + GLuint client_id; + GetIdHandler(id_namespaces::kTextures)->MakeIds(this, 0, 1, &client_id); + helper_->CreateAndConsumeTextureCHROMIUMImmediate(target, + client_id, data); + if (share_group_->bind_generates_resource()) + helper_->CommandBufferHelper::Flush(); + CheckGLError(); + return client_id; } void GLES2Implementation::PushGroupMarkerEXT( @@ -3609,9 +3751,9 @@ void* GLES2Implementation::MapBufferCHROMIUM(GLuint target, GLenum access) { // with this method of synchronization. Until this is fixed, // MapBufferCHROMIUM will not block even if the transfer is not ready // for these calls. - if (buffer->transfer_ready_token()) { - helper_->WaitForToken(buffer->transfer_ready_token()); - buffer->set_transfer_ready_token(0); + if (buffer->last_usage_token()) { + helper_->WaitForToken(buffer->last_usage_token()); + buffer->set_last_usage_token(0); } buffer->set_mapped(true); @@ -3645,8 +3787,73 @@ GLboolean GLES2Implementation::UnmapBufferCHROMIUM(GLuint target) { return true; } +bool GLES2Implementation::EnsureAsyncUploadSync() { + if (async_upload_sync_) + return true; + + int32 shm_id; + unsigned int shm_offset; + void* mem = mapped_memory_->Alloc(sizeof(AsyncUploadSync), + &shm_id, + &shm_offset); + if (!mem) + return false; + + async_upload_sync_shm_id_ = shm_id; + async_upload_sync_shm_offset_ = shm_offset; + async_upload_sync_ = static_cast<AsyncUploadSync*>(mem); + async_upload_sync_->Reset(); + + return true; +} + +uint32 GLES2Implementation::NextAsyncUploadToken() { + async_upload_token_++; + if (async_upload_token_ == 0) + async_upload_token_++; + return async_upload_token_; +} + +void GLES2Implementation::PollAsyncUploads() { + if (!async_upload_sync_) + return; + + if (helper_->IsContextLost()) { + DetachedAsyncUploadMemoryList::iterator it = + detached_async_upload_memory_.begin(); + while (it != detached_async_upload_memory_.end()) { + mapped_memory_->Free(it->first); + it = detached_async_upload_memory_.erase(it); + } + return; + } + + DetachedAsyncUploadMemoryList::iterator it = + detached_async_upload_memory_.begin(); + while (it != detached_async_upload_memory_.end()) { + if (HasAsyncUploadTokenPassed(it->second)) { + mapped_memory_->Free(it->first); + it = detached_async_upload_memory_.erase(it); + } else { + break; + } + } +} + +void GLES2Implementation::FreeAllAsyncUploadBuffers() { + // Free all completed unmanaged async uploads buffers. + PollAsyncUploads(); + + // Synchronously free rest of the unmanaged async upload buffers. + if (!detached_async_upload_memory_.empty()) { + WaitAllAsyncTexImage2DCHROMIUM(); + WaitForCmd(); + PollAsyncUploads(); + } +} + void GLES2Implementation::AsyncTexImage2DCHROMIUM( - GLenum target, GLint level, GLint internalformat, GLsizei width, + GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { GPU_CLIENT_SINGLE_THREAD_CHECK(); @@ -3662,6 +3869,10 @@ void GLES2Implementation::AsyncTexImage2DCHROMIUM( SetGLError(GL_INVALID_VALUE, "glTexImage2D", "dimension < 0"); return; } + if (border != 0) { + SetGLError(GL_INVALID_VALUE, "glTexImage2D", "border != 0"); + return; + } uint32 size; uint32 unpadded_row_size; uint32 padded_row_size; @@ -3675,8 +3886,13 @@ void GLES2Implementation::AsyncTexImage2DCHROMIUM( // If there's no data/buffer just issue the AsyncTexImage2D if (!pixels && !bound_pixel_unpack_transfer_buffer_id_) { helper_->AsyncTexImage2DCHROMIUM( - target, level, internalformat, width, height, border, format, type, - 0, 0); + target, level, internalformat, width, height, format, type, + 0, 0, 0, 0, 0); + return; + } + + if (!EnsureAsyncUploadSync()) { + SetGLError(GL_OUT_OF_MEMORY, "glTexImage2D", "out of memory"); return; } @@ -3689,9 +3905,13 @@ void GLES2Implementation::AsyncTexImage2DCHROMIUM( bound_pixel_unpack_transfer_buffer_id_, "glAsyncTexImage2DCHROMIUM", offset, size); if (buffer && buffer->shm_id() != -1) { + uint32 async_token = NextAsyncUploadToken(); + buffer->set_last_async_upload_token(async_token); helper_->AsyncTexImage2DCHROMIUM( - target, level, internalformat, width, height, border, format, type, - buffer->shm_id(), buffer->shm_offset() + offset); + target, level, internalformat, width, height, format, type, + buffer->shm_id(), buffer->shm_offset() + offset, + async_token, + async_upload_sync_shm_id_, async_upload_sync_shm_offset_); } } @@ -3724,6 +3944,11 @@ void GLES2Implementation::AsyncTexSubImage2DCHROMIUM( return; } + if (!EnsureAsyncUploadSync()) { + SetGLError(GL_OUT_OF_MEMORY, "glTexImage2D", "out of memory"); + return; + } + // Async uploads require a transfer buffer to be bound. // TODO(hubbe): Make MapBufferCHROMIUM block if someone tries to re-use // the buffer before the transfer is finished. (Currently such @@ -3733,9 +3958,13 @@ void GLES2Implementation::AsyncTexSubImage2DCHROMIUM( bound_pixel_unpack_transfer_buffer_id_, "glAsyncTexSubImage2DCHROMIUM", offset, size); if (buffer && buffer->shm_id() != -1) { + uint32 async_token = NextAsyncUploadToken(); + buffer->set_last_async_upload_token(async_token); helper_->AsyncTexSubImage2DCHROMIUM( target, level, xoffset, yoffset, width, height, format, type, - buffer->shm_id(), buffer->shm_offset() + offset); + buffer->shm_id(), buffer->shm_offset() + offset, + async_token, + async_upload_sync_shm_id_, async_upload_sync_shm_offset_); } } @@ -3747,6 +3976,14 @@ void GLES2Implementation::WaitAsyncTexImage2DCHROMIUM(GLenum target) { CheckGLError(); } +void GLES2Implementation::WaitAllAsyncTexImage2DCHROMIUM() { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() + << "] glWaitAllAsyncTexImage2DCHROMIUM()"); + helper_->WaitAllAsyncTexImage2DCHROMIUM(); + CheckGLError(); +} + GLuint GLES2Implementation::InsertSyncPointCHROMIUM() { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertSyncPointCHROMIUM"); @@ -3754,8 +3991,10 @@ GLuint GLES2Implementation::InsertSyncPointCHROMIUM() { return gpu_control_->InsertSyncPoint(); } -GLuint GLES2Implementation::CreateImageCHROMIUMHelper( - GLsizei width, GLsizei height, GLenum internalformat) { +GLuint GLES2Implementation::CreateImageCHROMIUMHelper(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) { if (width <= 0) { SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0"); return 0; @@ -3771,7 +4010,7 @@ GLuint GLES2Implementation::CreateImageCHROMIUMHelper( // Create new buffer. GLuint buffer_id = gpu_memory_buffer_tracker_->CreateBuffer( - width, height, internalformat); + width, height, internalformat, usage); if (buffer_id == 0) { SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "out of GPU memory."); return 0; @@ -3779,14 +4018,18 @@ GLuint GLES2Implementation::CreateImageCHROMIUMHelper( return buffer_id; } -GLuint GLES2Implementation::CreateImageCHROMIUM( - GLsizei width, GLsizei height, GLenum internalformat) { +GLuint GLES2Implementation::CreateImageCHROMIUM(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" - << width << ", " - << height << ", " - << GLES2Util::GetStringTextureInternalFormat(internalformat) << ")"); - GLuint image_id = CreateImageCHROMIUMHelper(width, height, internalformat); + GPU_CLIENT_LOG( + "[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width << ", " + << height << ", " + << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " + << GLES2Util::GetStringTextureInternalFormat(usage) << ")"); + GLuint image_id = + CreateImageCHROMIUMHelper(width, height, internalformat, usage); CheckGLError(); return image_id; } @@ -3837,49 +4080,28 @@ void GLES2Implementation::UnmapImageCHROMIUM(GLuint image_id) { CheckGLError(); } -void* GLES2Implementation::MapImageCHROMIUMHelper(GLuint image_id, - GLenum access) { +void* GLES2Implementation::MapImageCHROMIUMHelper(GLuint image_id) { gfx::GpuMemoryBuffer* gpu_buffer = gpu_memory_buffer_tracker_->GetBuffer( image_id); if (!gpu_buffer) { SetGLError(GL_INVALID_OPERATION, "glMapImageCHROMIUM", "invalid image"); return NULL; } - gfx::GpuMemoryBuffer::AccessMode mode; - switch(access) { - case GL_WRITE_ONLY: - mode = gfx::GpuMemoryBuffer::WRITE_ONLY; - break; - case GL_READ_ONLY: - mode = gfx::GpuMemoryBuffer::READ_ONLY; - break; - case GL_READ_WRITE: - mode = gfx::GpuMemoryBuffer::READ_WRITE; - break; - default: - SetGLError(GL_INVALID_ENUM, "glMapImageCHROMIUM", - "invalid GPU access mode"); - return NULL; - } if (gpu_buffer->IsMapped()) { SetGLError(GL_INVALID_OPERATION, "glMapImageCHROMIUM", "already mapped"); return NULL; } - void* mapped_buffer = NULL; - gpu_buffer->Map(mode, &mapped_buffer); - return mapped_buffer; + return gpu_buffer->Map(); } -void* GLES2Implementation::MapImageCHROMIUM( - GLuint image_id, GLenum access) { +void* GLES2Implementation::MapImageCHROMIUM(GLuint image_id) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMapImageCHROMIUM(" - << image_id << ", " - << GLES2Util::GetStringEnum(access) << ")"); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMapImageCHROMIUM(" << image_id + << ")"); - void* mapped = MapImageCHROMIUMHelper(image_id, access); + void* mapped = MapImageCHROMIUMHelper(image_id); CheckGLError(); return mapped; } @@ -3900,6 +4122,12 @@ void GLES2Implementation::GetImageParameterivCHROMIUMHelper( return; } + if (!gpu_buffer->IsMapped()) { + SetGLError( + GL_INVALID_OPERATION, "glGetImageParameterivCHROMIUM", "not mapped"); + return; + } + *params = gpu_buffer->GetStride(); } @@ -3915,6 +4143,30 @@ void GLES2Implementation::GetImageParameterivCHROMIUM( CheckGLError(); } +bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) { + if (size < 0) { + SetGLError(GL_INVALID_VALUE, func, "size < 0"); + return false; + } + if (!FitInt32NonNegative<GLsizeiptr>(size)) { + SetGLError(GL_INVALID_OPERATION, func, "size more than 32-bit"); + return false; + } + return true; +} + +bool GLES2Implementation::ValidateOffset(const char* func, GLintptr offset) { + if (offset < 0) { + SetGLError(GL_INVALID_VALUE, func, "offset < 0"); + return false; + } + if (!FitInt32NonNegative<GLintptr>(offset)) { + SetGLError(GL_INVALID_OPERATION, func, "offset more than 32-bit"); + return false; + } + return true; +} + // 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. diff --git a/chromium/gpu/command_buffer/client/gles2_implementation.h b/chromium/gpu/command_buffer/client/gles2_implementation.h index 6b6877f18b3..55d42d5a436 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation.h +++ b/chromium/gpu/command_buffer/client/gles2_implementation.h @@ -110,6 +110,12 @@ namespace gles2 { class ImageFactory; class VertexArrayObjectManager; +class GLES2ImplementationErrorMessageCallback { + public: + virtual ~GLES2ImplementationErrorMessageCallback() { } + virtual void OnErrorMessage(const char* msg, int id) = 0; +}; + // 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 @@ -123,11 +129,6 @@ class GLES2_IMPL_EXPORT GLES2Implementation enum MappedMemoryLimit { kNoLimit = MappedMemoryManager::kNoLimit, }; - class ErrorMessageCallback { - public: - virtual ~ErrorMessageCallback() { } - virtual void OnErrorMessage(const char* msg, int id) = 0; - }; // Stores GL state that never changes. struct GLES2_IMPL_EXPORT GLStaticState { @@ -148,6 +149,7 @@ class GLES2_IMPL_EXPORT GLES2Implementation GLint max_vertex_uniform_vectors; GLint num_compressed_texture_formats; GLint num_shader_binary_formats; + GLint bind_generates_resource_chromium; }; IntState int_state; @@ -180,13 +182,12 @@ class GLES2_IMPL_EXPORT GLES2Implementation // Number of swap buffers allowed before waiting. static const size_t kMaxSwapBuffers = 2; - GLES2Implementation( - GLES2CmdHelper* helper, - ShareGroup* share_group, - TransferBufferInterface* transfer_buffer, - bool bind_generates_resource, - bool free_everything_when_invisible, - GpuControl* gpu_control); + GLES2Implementation(GLES2CmdHelper* helper, + ShareGroup* share_group, + TransferBufferInterface* transfer_buffer, + bool bind_generates_resource, + bool lose_context_when_out_of_memory, + GpuControl* gpu_control); virtual ~GLES2Implementation(); @@ -217,10 +218,15 @@ class GLES2_IMPL_EXPORT GLES2Implementation // ContextSupport implementation. virtual void Swap() OVERRIDE; - virtual void PartialSwapBuffers(gfx::Rect sub_buffer) OVERRIDE; + virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) OVERRIDE; virtual void SetSwapBuffersCompleteCallback( const base::Closure& swap_buffers_complete_callback) OVERRIDE; + virtual void ScheduleOverlayPlane(int plane_z_order, + gfx::OverlayTransform plane_transform, + unsigned overlay_texture_id, + const gfx::Rect& display_bounds, + const gfx::RectF& uv_rect) OVERRIDE; void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result); GLint GetAttribLocationHelper(GLuint program, const char* name); @@ -241,10 +247,9 @@ class GLES2_IMPL_EXPORT GLES2Implementation virtual void SignalQuery(uint32 query, const base::Closure& callback) OVERRIDE; virtual void SetSurfaceVisible(bool visible) OVERRIDE; - virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) - OVERRIDE; - void SetErrorMessageCallback(ErrorMessageCallback* callback) { + void SetErrorMessageCallback( + GLES2ImplementationErrorMessageCallback* callback) { error_message_callback_ = callback; } @@ -260,6 +265,10 @@ class GLES2_IMPL_EXPORT GLES2Implementation return gpu_control_; } + ShareGroupContextData* share_group_context_data() { + return &share_group_context_data_; + } + private: friend class GLES2ImplementationTest; friend class VertexArrayObjectManager; @@ -491,12 +500,14 @@ class GLES2_IMPL_EXPORT GLES2Implementation bool IsRenderbufferReservedId(GLuint id) { return false; } bool IsTextureReservedId(GLuint id) { return false; } bool IsVertexArrayReservedId(GLuint id) { return false; } + bool IsProgramReservedId(GLuint id) { return false; } bool BindBufferHelper(GLenum target, GLuint texture); bool BindFramebufferHelper(GLenum target, GLuint texture); bool BindRenderbufferHelper(GLenum target, GLuint texture); bool BindTextureHelper(GLenum target, GLuint texture); - bool BindVertexArrayHelper(GLuint array); + bool BindVertexArrayOESHelper(GLuint array); + bool UseProgramHelper(GLuint program); void GenBuffersHelper(GLsizei n, const GLuint* buffers); void GenFramebuffersHelper(GLsizei n, const GLuint* framebuffers); @@ -532,10 +543,12 @@ class GLES2_IMPL_EXPORT GLES2Implementation GLenum target, GLintptr offset, GLsizeiptr size, const void* data, ScopedTransferBufferPtr* buffer); - GLuint CreateImageCHROMIUMHelper( - GLsizei width, GLsizei height, GLenum internalformat); + GLuint CreateImageCHROMIUMHelper(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage); void DestroyImageCHROMIUMHelper(GLuint image_id); - void* MapImageCHROMIUMHelper(GLuint image_id, GLenum access); + void* MapImageCHROMIUMHelper(GLuint image_id); void UnmapImageCHROMIUMHelper(GLuint image_id); void GetImageParameterivCHROMIUMHelper( GLuint image_id, GLenum pname, GLint* params); @@ -582,15 +595,50 @@ class GLES2_IMPL_EXPORT GLES2Implementation void FinishHelper(); - // Asserts that the context is lost. - // NOTE: This is an expensive call and should only be called - // for error checking. - bool MustBeContextLost(); - void RunIfContextNotLost(const base::Closure& callback); void OnSwapBuffersComplete(); + // Validate if an offset is valid, i.e., non-negative and fit into 32-bit. + // If not, generate an approriate error, and return false. + bool ValidateOffset(const char* func, GLintptr offset); + + // Validate if a size is valid, i.e., non-negative and fit into 32-bit. + // If not, generate an approriate error, and return false. + bool ValidateSize(const char* func, GLsizeiptr offset); + + // Remove the transfer buffer from the buffer tracker. For buffers used + // asynchronously the memory is free:ed if the upload has completed. For + // other buffers, the memory is either free:ed immediately or free:ed pending + // a token. + void RemoveTransferBuffer(BufferTracker::Buffer* buffer); + + // Returns true if the async upload token has passed. + // + // NOTE: This will detect wrapped async tokens by checking if the most + // significant bit of async token to check is 1 but the last read is 0, i.e. + // the uint32 wrapped. + bool HasAsyncUploadTokenPassed(uint32 token) const { + return async_upload_sync_->HasAsyncUploadTokenPassed(token); + } + + // Get the next async upload token. + uint32 NextAsyncUploadToken(); + + // Ensure that the shared memory used for synchronizing async upload tokens + // has been mapped. + // + // Returns false on error, true on success. + bool EnsureAsyncUploadSync(); + + // Checks the last read asynchronously upload token and frees any unmanaged + // transfer buffer that has its async token passed. + void PollAsyncUploads(); + + // Free every async upload buffer. If some async upload buffer is still in use + // wait for them to finish before freeing. + void FreeAllAsyncUploadBuffers(); + bool GetBoundPixelTransferBuffer( GLenum target, const char* function_name, GLuint* buffer_id); BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid( @@ -663,6 +711,18 @@ class GLES2_IMPL_EXPORT GLES2Implementation GLuint bound_pixel_pack_transfer_buffer_id_; GLuint bound_pixel_unpack_transfer_buffer_id_; + // The current asynchronous pixel buffer upload token. + uint32 async_upload_token_; + + // The shared memory used for synchronizing asynchronous upload tokens. + AsyncUploadSync* async_upload_sync_; + int32 async_upload_sync_shm_id_; + unsigned int async_upload_sync_shm_offset_; + + // Unmanaged pixel transfer buffer memory pending asynchronous upload token. + typedef std::list<std::pair<void*, uint32> > DetachedAsyncUploadMemoryList; + DetachedAsyncUploadMemoryList detached_async_upload_memory_; + // Client side management for vertex array objects. Needed to correctly // track client side arrays. scoped_ptr<VertexArrayObjectManager> vertex_array_object_manager_; @@ -675,6 +735,9 @@ class GLES2_IMPL_EXPORT GLES2Implementation // Whether or not to print debugging info. bool debug_; + // When true, the context is lost when a GL_OUT_OF_MEMORY error occurs. + bool lose_context_when_out_of_memory_; + // Used to check for single threaded access. int use_count_; @@ -696,26 +759,24 @@ class GLES2_IMPL_EXPORT GLES2Implementation scoped_ptr<MappedMemoryManager> mapped_memory_; scoped_refptr<ShareGroup> share_group_; + ShareGroupContextData share_group_context_data_; scoped_ptr<QueryTracker> query_tracker_; - QueryTracker::Query* current_query_; + typedef std::map<GLuint, QueryTracker::Query*> QueryMap; + QueryMap current_queries_; scoped_ptr<BufferTracker> buffer_tracker_; scoped_ptr<GpuMemoryBufferTracker> gpu_memory_buffer_tracker_; - ErrorMessageCallback* error_message_callback_; + GLES2ImplementationErrorMessageCallback* error_message_callback_; scoped_ptr<std::string> current_trace_name_; GpuControl* gpu_control_; - bool surface_visible_; - bool free_everything_when_invisible_; - Capabilities capabilities_; - bool use_echo_for_swap_ack_; base::Closure swap_buffers_complete_callback_; base::WeakPtrFactory<GLES2Implementation> weak_ptr_factory_; diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h b/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h index 5703956e415..db6760e162f 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // This file is included by gles2_implementation.h to declare the @@ -15,8 +17,9 @@ virtual void ActiveTexture(GLenum texture) OVERRIDE; virtual void AttachShader(GLuint program, GLuint shader) OVERRIDE; -virtual void BindAttribLocation( - GLuint program, GLuint index, const char* name) OVERRIDE; +virtual void BindAttribLocation(GLuint program, + GLuint index, + const char* name) OVERRIDE; virtual void BindBuffer(GLenum target, GLuint buffer) OVERRIDE; @@ -26,8 +29,10 @@ virtual void BindRenderbuffer(GLenum target, GLuint renderbuffer) OVERRIDE; virtual void BindTexture(GLenum target, GLuint texture) OVERRIDE; -virtual void BlendColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) OVERRIDE; +virtual void BlendColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) OVERRIDE; virtual void BlendEquation(GLenum mode) OVERRIDE; @@ -35,49 +40,77 @@ virtual void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) OVERRIDE; virtual void BlendFunc(GLenum sfactor, GLenum dfactor) OVERRIDE; -virtual void BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) OVERRIDE; +virtual void BlendFuncSeparate(GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) OVERRIDE; -virtual void BufferData( - GLenum target, GLsizeiptr size, const void* data, GLenum usage) OVERRIDE; +virtual void BufferData(GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage) OVERRIDE; -virtual void BufferSubData( - GLenum target, GLintptr offset, GLsizeiptr size, - const void* data) OVERRIDE; +virtual void BufferSubData(GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data) OVERRIDE; virtual GLenum CheckFramebufferStatus(GLenum target) OVERRIDE; virtual void Clear(GLbitfield mask) OVERRIDE; -virtual void ClearColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) OVERRIDE; +virtual void ClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) OVERRIDE; virtual void ClearDepthf(GLclampf depth) OVERRIDE; virtual void ClearStencil(GLint s) OVERRIDE; -virtual void ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) OVERRIDE; +virtual void ColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) OVERRIDE; virtual void CompileShader(GLuint shader) OVERRIDE; -virtual void CompressedTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, GLsizei imageSize, - const void* data) OVERRIDE; - -virtual void CompressedTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLsizei imageSize, - const void* data) OVERRIDE; - -virtual void CopyTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border) OVERRIDE; - -virtual void CopyTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height) OVERRIDE; +virtual void CompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data) OVERRIDE; + +virtual void CompressedTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data) OVERRIDE; + +virtual void CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) OVERRIDE; + +virtual void CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) OVERRIDE; virtual GLuint CreateProgram() OVERRIDE; @@ -87,13 +120,12 @@ virtual void CullFace(GLenum mode) OVERRIDE; virtual void DeleteBuffers(GLsizei n, const GLuint* buffers) OVERRIDE; -virtual void DeleteFramebuffers( - GLsizei n, const GLuint* framebuffers) OVERRIDE; +virtual void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) OVERRIDE; virtual void DeleteProgram(GLuint program) OVERRIDE; -virtual void DeleteRenderbuffers( - GLsizei n, const GLuint* renderbuffers) OVERRIDE; +virtual void DeleteRenderbuffers(GLsizei n, + const GLuint* renderbuffers) OVERRIDE; virtual void DeleteShader(GLuint shader) OVERRIDE; @@ -111,8 +143,10 @@ virtual void Disable(GLenum cap) OVERRIDE; virtual void DrawArrays(GLenum mode, GLint first, GLsizei count) OVERRIDE; -virtual void DrawElements( - GLenum mode, GLsizei count, GLenum type, const void* indices) OVERRIDE; +virtual void DrawElements(GLenum mode, + GLsizei count, + GLenum type, + const void* indices) OVERRIDE; virtual void Enable(GLenum cap) OVERRIDE; @@ -120,13 +154,16 @@ virtual void Finish() OVERRIDE; virtual void Flush() OVERRIDE; -virtual void FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, - GLuint renderbuffer) OVERRIDE; +virtual void FramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) OVERRIDE; -virtual void FramebufferTexture2D( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level) OVERRIDE; +virtual void FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) OVERRIDE; virtual void FrontFace(GLenum mode) OVERRIDE; @@ -140,73 +177,97 @@ virtual void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) OVERRIDE; virtual void GenTextures(GLsizei n, GLuint* textures) OVERRIDE; -virtual void GetActiveAttrib( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) OVERRIDE; - -virtual void GetActiveUniform( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) OVERRIDE; - -virtual void GetAttachedShaders( - GLuint program, GLsizei maxcount, GLsizei* count, - GLuint* shaders) OVERRIDE; +virtual void GetActiveAttrib(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) OVERRIDE; + +virtual void GetActiveUniform(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) OVERRIDE; + +virtual void GetAttachedShaders(GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders) OVERRIDE; virtual GLint GetAttribLocation(GLuint program, const char* name) OVERRIDE; virtual void GetBooleanv(GLenum pname, GLboolean* params) OVERRIDE; -virtual void GetBufferParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetBufferParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; virtual GLenum GetError() OVERRIDE; virtual void GetFloatv(GLenum pname, GLfloat* params) OVERRIDE; -virtual void GetFramebufferAttachmentParameteriv( - GLenum target, GLenum attachment, GLenum pname, GLint* params) OVERRIDE; +virtual void GetFramebufferAttachmentParameteriv(GLenum target, + GLenum attachment, + GLenum pname, + GLint* params) OVERRIDE; virtual void GetIntegerv(GLenum pname, GLint* params) OVERRIDE; -virtual void GetProgramiv( - GLuint program, GLenum pname, GLint* params) OVERRIDE; +virtual void GetProgramiv(GLuint program, GLenum pname, GLint* params) OVERRIDE; -virtual void GetProgramInfoLog( - GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) OVERRIDE; +virtual void GetProgramInfoLog(GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog) OVERRIDE; -virtual void GetRenderbufferParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetRenderbufferParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; virtual void GetShaderiv(GLuint shader, GLenum pname, GLint* params) OVERRIDE; -virtual void GetShaderInfoLog( - GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) OVERRIDE; +virtual void GetShaderInfoLog(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog) OVERRIDE; -virtual void GetShaderPrecisionFormat( - GLenum shadertype, GLenum precisiontype, GLint* range, - GLint* precision) OVERRIDE; +virtual void GetShaderPrecisionFormat(GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision) OVERRIDE; -virtual void GetShaderSource( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) OVERRIDE; +virtual void GetShaderSource(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) OVERRIDE; virtual const GLubyte* GetString(GLenum name) OVERRIDE; -virtual void GetTexParameterfv( - GLenum target, GLenum pname, GLfloat* params) OVERRIDE; +virtual void GetTexParameterfv(GLenum target, + GLenum pname, + GLfloat* params) OVERRIDE; -virtual void GetTexParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetTexParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; -virtual void GetUniformfv( - GLuint program, GLint location, GLfloat* params) OVERRIDE; +virtual void GetUniformfv(GLuint program, + GLint location, + GLfloat* params) OVERRIDE; -virtual void GetUniformiv( - GLuint program, GLint location, GLint* params) OVERRIDE; +virtual void GetUniformiv(GLuint program, + GLint location, + GLint* params) OVERRIDE; virtual GLint GetUniformLocation(GLuint program, const char* name) OVERRIDE; -virtual void GetVertexAttribPointerv( - GLuint index, GLenum pname, void** pointer) OVERRIDE; +virtual void GetVertexAttribPointerv(GLuint index, + GLenum pname, + void** pointer) OVERRIDE; virtual void Hint(GLenum target, GLenum mode) OVERRIDE; @@ -232,27 +293,35 @@ virtual void PixelStorei(GLenum pname, GLint param) OVERRIDE; virtual void PolygonOffset(GLfloat factor, GLfloat units) OVERRIDE; -virtual void ReadPixels( - GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - void* pixels) OVERRIDE; +virtual void ReadPixels(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels) OVERRIDE; virtual void ReleaseShaderCompiler() OVERRIDE; -virtual void RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; +virtual void RenderbufferStorage(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; virtual void SampleCoverage(GLclampf value, GLboolean invert) OVERRIDE; virtual void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; -virtual void ShaderBinary( - GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, - GLsizei length) OVERRIDE; +virtual void ShaderBinary(GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length) OVERRIDE; -virtual void ShaderSource( - GLuint shader, GLsizei count, const GLchar* const* str, - const GLint* length) OVERRIDE; +virtual void ShaderSource(GLuint shader, + GLsizei count, + const GLchar* const* str, + const GLint* length) OVERRIDE; virtual void ShallowFinishCHROMIUM() OVERRIDE; @@ -260,8 +329,10 @@ virtual void ShallowFlushCHROMIUM() OVERRIDE; virtual void StencilFunc(GLenum func, GLint ref, GLuint mask) OVERRIDE; -virtual void StencilFuncSeparate( - GLenum face, GLenum func, GLint ref, GLuint mask) OVERRIDE; +virtual void StencilFuncSeparate(GLenum face, + GLenum func, + GLint ref, + GLuint mask) OVERRIDE; virtual void StencilMask(GLuint mask) OVERRIDE; @@ -269,83 +340,108 @@ virtual void StencilMaskSeparate(GLenum face, GLuint mask) OVERRIDE; virtual void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) OVERRIDE; -virtual void StencilOpSeparate( - GLenum face, GLenum fail, GLenum zfail, GLenum zpass) OVERRIDE; +virtual void StencilOpSeparate(GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass) OVERRIDE; -virtual void TexImage2D( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) OVERRIDE; +virtual void TexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; -virtual void TexParameterf( - GLenum target, GLenum pname, GLfloat param) OVERRIDE; +virtual void TexParameterf(GLenum target, GLenum pname, GLfloat param) OVERRIDE; -virtual void TexParameterfv( - GLenum target, GLenum pname, const GLfloat* params) OVERRIDE; +virtual void TexParameterfv(GLenum target, + GLenum pname, + const GLfloat* params) OVERRIDE; virtual void TexParameteri(GLenum target, GLenum pname, GLint param) OVERRIDE; -virtual void TexParameteriv( - GLenum target, GLenum pname, const GLint* params) OVERRIDE; +virtual void TexParameteriv(GLenum target, + GLenum pname, + const GLint* params) OVERRIDE; -virtual void TexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* pixels) OVERRIDE; +virtual void TexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; virtual void Uniform1f(GLint location, GLfloat x) OVERRIDE; -virtual void Uniform1fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform1fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform1i(GLint location, GLint x) OVERRIDE; -virtual void Uniform1iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform1iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; virtual void Uniform2f(GLint location, GLfloat x, GLfloat y) OVERRIDE; -virtual void Uniform2fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform2fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform2i(GLint location, GLint x, GLint y) OVERRIDE; -virtual void Uniform2iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform2iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void Uniform3f( - GLint location, GLfloat x, GLfloat y, GLfloat z) OVERRIDE; +virtual void Uniform3f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z) OVERRIDE; -virtual void Uniform3fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform3fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform3i(GLint location, GLint x, GLint y, GLint z) OVERRIDE; -virtual void Uniform3iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform3iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void Uniform4f( - GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) OVERRIDE; +virtual void Uniform4f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) OVERRIDE; -virtual void Uniform4fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform4fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; -virtual void Uniform4i( - GLint location, GLint x, GLint y, GLint z, GLint w) OVERRIDE; +virtual void Uniform4i(GLint location, + GLint x, + GLint y, + GLint z, + GLint w) OVERRIDE; -virtual void Uniform4iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform4iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void UniformMatrix2fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; +virtual void UniformMatrix2fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; -virtual void UniformMatrix3fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; +virtual void UniformMatrix3fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; -virtual void UniformMatrix4fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; +virtual void UniformMatrix4fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; virtual void UseProgram(GLuint program) OVERRIDE; @@ -359,43 +455,65 @@ virtual void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) OVERRIDE; virtual void VertexAttrib2fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttrib3f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z) OVERRIDE; +virtual void VertexAttrib3f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z) OVERRIDE; virtual void VertexAttrib3fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttrib4f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) OVERRIDE; +virtual void VertexAttrib4f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) OVERRIDE; virtual void VertexAttrib4fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttribPointer( - GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, - const void* ptr) OVERRIDE; - -virtual void Viewport( - GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; - -virtual void BlitFramebufferCHROMIUM( - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, - GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, - GLenum filter) OVERRIDE; - -virtual void RenderbufferStorageMultisampleCHROMIUM( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; - -virtual void RenderbufferStorageMultisampleEXT( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; - -virtual void FramebufferTexture2DMultisampleEXT( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLsizei samples) OVERRIDE; - -virtual void TexStorage2DEXT( - GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, - GLsizei height) OVERRIDE; +virtual void VertexAttribPointer(GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr) OVERRIDE; + +virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; + +virtual void BlitFramebufferCHROMIUM(GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) OVERRIDE; + +virtual void RenderbufferStorageMultisampleCHROMIUM(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; + +virtual void RenderbufferStorageMultisampleEXT(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; + +virtual void FramebufferTexture2DMultisampleEXT(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples) OVERRIDE; + +virtual void TexStorage2DEXT(GLenum target, + GLsizei levels, + GLenum internalFormat, + GLsizei width, + GLsizei height) OVERRIDE; virtual void GenQueriesEXT(GLsizei n, GLuint* queries) OVERRIDE; @@ -407,14 +525,14 @@ virtual void BeginQueryEXT(GLenum target, GLuint id) OVERRIDE; virtual void EndQueryEXT(GLenum target) OVERRIDE; -virtual void GetQueryivEXT( - GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetQueryivEXT(GLenum target, GLenum pname, GLint* params) OVERRIDE; -virtual void GetQueryObjectuivEXT( - GLuint id, GLenum pname, GLuint* params) OVERRIDE; +virtual void GetQueryObjectuivEXT(GLuint id, + GLenum pname, + GLuint* params) OVERRIDE; -virtual void InsertEventMarkerEXT( - GLsizei length, const GLchar* marker) OVERRIDE; +virtual void InsertEventMarkerEXT(GLsizei length, + const GLchar* marker) OVERRIDE; virtual void PushGroupMarkerEXT(GLsizei length, const GLchar* marker) OVERRIDE; @@ -430,17 +548,23 @@ virtual void BindVertexArrayOES(GLuint array) OVERRIDE; virtual void SwapBuffers() OVERRIDE; -virtual GLuint GetMaxValueInBufferCHROMIUM( - GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) OVERRIDE; +virtual GLuint GetMaxValueInBufferCHROMIUM(GLuint buffer_id, + GLsizei count, + GLenum type, + GLuint offset) OVERRIDE; -virtual void GenSharedIdsCHROMIUM( - GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) OVERRIDE; +virtual void GenSharedIdsCHROMIUM(GLuint namespace_id, + GLuint id_offset, + GLsizei n, + GLuint* ids) OVERRIDE; -virtual void DeleteSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) OVERRIDE; +virtual void DeleteSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) OVERRIDE; -virtual void RegisterSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) OVERRIDE; +virtual void RegisterSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) OVERRIDE; virtual GLboolean EnableFeatureCHROMIUM(const char* feature) OVERRIDE; @@ -448,23 +572,32 @@ virtual void* MapBufferCHROMIUM(GLuint target, GLenum access) OVERRIDE; virtual GLboolean UnmapBufferCHROMIUM(GLuint target) OVERRIDE; -virtual void* MapImageCHROMIUM(GLuint image_id, GLenum access) OVERRIDE; +virtual void* MapImageCHROMIUM(GLuint image_id) OVERRIDE; virtual void UnmapImageCHROMIUM(GLuint image_id) OVERRIDE; -virtual void* MapBufferSubDataCHROMIUM( - GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) OVERRIDE; +virtual void* MapBufferSubDataCHROMIUM(GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access) OVERRIDE; virtual void UnmapBufferSubDataCHROMIUM(const void* mem) OVERRIDE; -virtual void* MapTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, GLenum access) OVERRIDE; +virtual void* MapTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access) OVERRIDE; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM( - GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; +virtual void ResizeCHROMIUM(GLuint width, + GLuint height, + GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; @@ -472,58 +605,83 @@ virtual void RequestExtensionCHROMIUM(const char* extension) OVERRIDE; virtual void RateLimitOffscreenContextCHROMIUM() OVERRIDE; -virtual void GetMultipleIntegervCHROMIUM( - const GLenum* pnames, GLuint count, GLint* results, - GLsizeiptr size) OVERRIDE; +virtual void GetMultipleIntegervCHROMIUM(const GLenum* pnames, + GLuint count, + GLint* results, + GLsizeiptr size) OVERRIDE; -virtual void GetProgramInfoCHROMIUM( - GLuint program, GLsizei bufsize, GLsizei* size, void* info) OVERRIDE; +virtual void GetProgramInfoCHROMIUM(GLuint program, + GLsizei bufsize, + GLsizei* size, + void* info) OVERRIDE; virtual GLuint CreateStreamTextureCHROMIUM(GLuint texture) OVERRIDE; -virtual void DestroyStreamTextureCHROMIUM(GLuint texture) OVERRIDE; - -virtual GLuint CreateImageCHROMIUM( - GLsizei width, GLsizei height, GLenum internalformat) OVERRIDE; +virtual GLuint CreateImageCHROMIUM(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) OVERRIDE; virtual void DestroyImageCHROMIUM(GLuint image_id) OVERRIDE; -virtual void GetImageParameterivCHROMIUM( - GLuint image_id, GLenum pname, GLint* params) OVERRIDE; - -virtual void GetTranslatedShaderSourceANGLE( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) OVERRIDE; - -virtual void PostSubBufferCHROMIUM( - GLint x, GLint y, GLint width, GLint height) OVERRIDE; - -virtual void TexImageIOSurface2DCHROMIUM( - GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, - GLuint plane) OVERRIDE; - -virtual void CopyTextureCHROMIUM( - GLenum target, GLenum source_id, GLenum dest_id, GLint level, - GLint internalformat, GLenum dest_type) OVERRIDE; - -virtual void DrawArraysInstancedANGLE( - GLenum mode, GLint first, GLsizei count, GLsizei primcount) OVERRIDE; - -virtual void DrawElementsInstancedANGLE( - GLenum mode, GLsizei count, GLenum type, const void* indices, - GLsizei primcount) OVERRIDE; +virtual void GetImageParameterivCHROMIUM(GLuint image_id, + GLenum pname, + GLint* params) OVERRIDE; + +virtual void GetTranslatedShaderSourceANGLE(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) OVERRIDE; + +virtual void PostSubBufferCHROMIUM(GLint x, + GLint y, + GLint width, + GLint height) OVERRIDE; + +virtual void TexImageIOSurface2DCHROMIUM(GLenum target, + GLsizei width, + GLsizei height, + GLuint ioSurfaceId, + GLuint plane) OVERRIDE; + +virtual void CopyTextureCHROMIUM(GLenum target, + GLenum source_id, + GLenum dest_id, + GLint level, + GLint internalformat, + GLenum dest_type) OVERRIDE; + +virtual void DrawArraysInstancedANGLE(GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) OVERRIDE; + +virtual void DrawElementsInstancedANGLE(GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount) OVERRIDE; virtual void VertexAttribDivisorANGLE(GLuint index, GLuint divisor) OVERRIDE; virtual void GenMailboxCHROMIUM(GLbyte* mailbox) OVERRIDE; -virtual void ProduceTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) OVERRIDE; +virtual void ProduceTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; -virtual void ConsumeTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) OVERRIDE; +virtual void ProduceTextureDirectCHROMIUM(GLuint texture, + GLenum target, + const GLbyte* mailbox) OVERRIDE; -virtual void BindUniformLocationCHROMIUM( - GLuint program, GLint location, const char* name) OVERRIDE; +virtual void ConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; + +virtual GLuint CreateAndConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; + +virtual void BindUniformLocationCHROMIUM(GLuint program, + GLint location, + const char* name) OVERRIDE; virtual void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) OVERRIDE; @@ -533,19 +691,33 @@ virtual void TraceBeginCHROMIUM(const char* name) OVERRIDE; virtual void TraceEndCHROMIUM() OVERRIDE; -virtual void AsyncTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* data) OVERRIDE; - -virtual void AsyncTexImage2DCHROMIUM( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) OVERRIDE; +virtual void AsyncTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* data) OVERRIDE; + +virtual void AsyncTexImage2DCHROMIUM(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) OVERRIDE; -virtual void DiscardFramebufferEXT( - GLenum target, GLsizei count, const GLenum* attachments) OVERRIDE; +virtual void WaitAllAsyncTexImage2DCHROMIUM() OVERRIDE; + +virtual void DiscardFramebufferEXT(GLenum target, + GLsizei count, + const GLenum* attachments) OVERRIDE; virtual void LoseContextCHROMIUM(GLenum current, GLenum other) OVERRIDE; @@ -557,5 +729,16 @@ virtual void DrawBuffersEXT(GLsizei count, const GLenum* bufs) OVERRIDE; virtual void DiscardBackbufferCHROMIUM() OVERRIDE; -#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_ +virtual void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order, + GLenum plane_transform, + GLuint overlay_texture_id, + GLint bounds_x, + GLint bounds_y, + GLint bounds_width, + GLint bounds_height, + GLfloat uv_x, + GLfloat uv_y, + GLfloat uv_width, + GLfloat uv_height) OVERRIDE; +#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_ diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h index 3b92eb2933e..4f721a8d1cd 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // This file is included by gles2_implementation.cc to define the @@ -13,14 +15,17 @@ void GLES2Implementation::AttachShader(GLuint program, GLuint shader) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAttachShader(" << program << ", " << shader << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glAttachShader(" << program << ", " + << shader << ")"); helper_->AttachShader(program, shader); CheckGLError(); } void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBuffer(" << GLES2Util::GetStringBufferTarget(target) << ", " << buffer << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindBuffer(" + << GLES2Util::GetStringBufferTarget(target) << ", " + << buffer << ")"); if (IsBufferReservedId(buffer)) { SetGLError(GL_INVALID_OPERATION, "BindBuffer", "buffer reserved id"); return; @@ -33,7 +38,9 @@ void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) { void GLES2Implementation::BindFramebuffer(GLenum target, GLuint framebuffer) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << framebuffer << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindFramebuffer(" + << GLES2Util::GetStringFrameBufferTarget(target) << ", " + << framebuffer << ")"); if (IsFramebufferReservedId(framebuffer)) { SetGLError( GL_INVALID_OPERATION, "BindFramebuffer", "framebuffer reserved id"); @@ -45,10 +52,11 @@ void GLES2Implementation::BindFramebuffer(GLenum target, GLuint framebuffer) { CheckGLError(); } -void GLES2Implementation::BindRenderbuffer( - GLenum target, GLuint renderbuffer) { +void GLES2Implementation::BindRenderbuffer(GLenum target, GLuint renderbuffer) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << renderbuffer << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindRenderbuffer(" + << GLES2Util::GetStringRenderBufferTarget(target) << ", " + << renderbuffer << ")"); if (IsRenderbufferReservedId(renderbuffer)) { SetGLError( GL_INVALID_OPERATION, "BindRenderbuffer", "renderbuffer reserved id"); @@ -62,7 +70,9 @@ void GLES2Implementation::BindRenderbuffer( void GLES2Implementation::BindTexture(GLenum target, GLuint texture) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << texture << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexture(" + << GLES2Util::GetStringTextureBindTarget(target) << ", " + << texture << ")"); if (IsTextureReservedId(texture)) { SetGLError(GL_INVALID_OPERATION, "BindTexture", "texture reserved id"); return; @@ -73,40 +83,54 @@ void GLES2Implementation::BindTexture(GLenum target, GLuint texture) { CheckGLError(); } -void GLES2Implementation::BlendColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { +void GLES2Implementation::BlendColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendColor(" << red << ", " + << green << ", " << blue << ", " << alpha << ")"); helper_->BlendColor(red, green, blue, alpha); CheckGLError(); } void GLES2Implementation::BlendEquation(GLenum mode) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation(" << GLES2Util::GetStringEquation(mode) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquation(" + << GLES2Util::GetStringEquation(mode) << ")"); helper_->BlendEquation(mode); CheckGLError(); } -void GLES2Implementation::BlendEquationSeparate( - GLenum modeRGB, GLenum modeAlpha) { +void GLES2Implementation::BlendEquationSeparate(GLenum modeRGB, + GLenum modeAlpha) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate(" << GLES2Util::GetStringEquation(modeRGB) << ", " << GLES2Util::GetStringEquation(modeAlpha) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparate(" + << GLES2Util::GetStringEquation(modeRGB) << ", " + << GLES2Util::GetStringEquation(modeAlpha) << ")"); helper_->BlendEquationSeparate(modeRGB, modeAlpha); CheckGLError(); } void GLES2Implementation::BlendFunc(GLenum sfactor, GLenum dfactor) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc(" << GLES2Util::GetStringSrcBlendFactor(sfactor) << ", " << GLES2Util::GetStringDstBlendFactor(dfactor) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunc(" + << GLES2Util::GetStringSrcBlendFactor(sfactor) << ", " + << GLES2Util::GetStringDstBlendFactor(dfactor) << ")"); helper_->BlendFunc(sfactor, dfactor); CheckGLError(); } -void GLES2Implementation::BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { +void GLES2Implementation::BlendFuncSeparate(GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate(" << GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", " << GLES2Util::GetStringDstBlendFactor(dstRGB) << ", " << GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", " << GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparate(" + << GLES2Util::GetStringSrcBlendFactor(srcRGB) << ", " + << GLES2Util::GetStringDstBlendFactor(dstRGB) << ", " + << GLES2Util::GetStringSrcBlendFactor(srcAlpha) << ", " + << GLES2Util::GetStringDstBlendFactor(dstAlpha) << ")"); helper_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); CheckGLError(); } @@ -114,7 +138,8 @@ void GLES2Implementation::BlendFuncSeparate( GLenum GLES2Implementation::CheckFramebufferStatus(GLenum target) { GPU_CLIENT_SINGLE_THREAD_CHECK(); TRACE_EVENT0("gpu", "GLES2Implementation::CheckFramebufferStatus"); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus(" << GLES2Util::GetStringFrameBufferTarget(target) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCheckFramebufferStatus(" + << GLES2Util::GetStringFrameBufferTarget(target) << ")"); typedef cmds::CheckFramebufferStatus::Result Result; Result* result = GetResultAs<Result*>(); if (!result) { @@ -137,10 +162,13 @@ void GLES2Implementation::Clear(GLbitfield mask) { CheckGLError(); } -void GLES2Implementation::ClearColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { +void GLES2Implementation::ClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red << ", " << green << ", " << blue << ", " << alpha << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClearColor(" << red << ", " + << green << ", " << blue << ", " << alpha << ")"); helper_->ClearColor(red, green, blue, alpha); CheckGLError(); } @@ -159,26 +187,43 @@ void GLES2Implementation::ClearStencil(GLint s) { CheckGLError(); } -void GLES2Implementation::ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { +void GLES2Implementation::ColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask(" << GLES2Util::GetStringBool(red) << ", " << GLES2Util::GetStringBool(green) << ", " << GLES2Util::GetStringBool(blue) << ", " << GLES2Util::GetStringBool(alpha) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMask(" + << GLES2Util::GetStringBool(red) << ", " + << GLES2Util::GetStringBool(green) << ", " + << GLES2Util::GetStringBool(blue) << ", " + << GLES2Util::GetStringBool(alpha) << ")"); helper_->ColorMask(red, green, blue, alpha); CheckGLError(); } void GLES2Implementation::CompileShader(GLuint shader) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompileShader(" << shader + << ")"); helper_->CompileShader(shader); CheckGLError(); } -void GLES2Implementation::CopyTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border) { +void GLES2Implementation::CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " << x << ", " << y << ", " << width << ", " << height << ", " << border << ")"); // NOLINT + GPU_CLIENT_LOG( + "[" << GetLogPrefix() << "] glCopyTexImage2D(" + << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " + << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", " + << x << ", " << y << ", " << width << ", " << height << ", " << border + << ")"); if (width < 0) { SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "width < 0"); return; @@ -187,16 +232,27 @@ void GLES2Implementation::CopyTexImage2D( SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "height < 0"); return; } - helper_->CopyTexImage2D( - target, level, internalformat, x, y, width, height, border); + if (border != 0) { + SetGLError(GL_INVALID_VALUE, "glCopyTexImage2D", "border GL_INVALID_VALUE"); + return; + } + helper_->CopyTexImage2D(target, level, internalformat, x, y, width, height); CheckGLError(); } -void GLES2Implementation::CopyTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height) { +void GLES2Implementation::CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D(" << GLES2Util::GetStringTextureTarget(target) << ", " << level << ", " << xoffset << ", " << yoffset << ", " << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTexSubImage2D(" + << GLES2Util::GetStringTextureTarget(target) << ", " + << level << ", " << xoffset << ", " << yoffset << ", " << x + << ", " << y << ", " << width << ", " << height << ")"); if (width < 0) { SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D", "width < 0"); return; @@ -212,10 +268,11 @@ void GLES2Implementation::CopyTexSubImage2D( GLuint GLES2Implementation::CreateProgram() { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram(" << ")"); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateProgram(" + << ")"); GLuint client_id; - GetIdHandler(id_namespaces::kProgramsAndShaders)-> - MakeIds(this, 0, 1, &client_id); + GetIdHandler(id_namespaces::kProgramsAndShaders) + ->MakeIds(this, 0, 1, &client_id); helper_->CreateProgram(client_id); GPU_CLIENT_LOG("returned " << client_id); CheckGLError(); @@ -224,10 +281,11 @@ GLuint GLES2Implementation::CreateProgram() { GLuint GLES2Implementation::CreateShader(GLenum type) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader(" << GLES2Util::GetStringShaderType(type) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateShader(" + << GLES2Util::GetStringShaderType(type) << ")"); GLuint client_id; - GetIdHandler(id_namespaces::kProgramsAndShaders)-> - MakeIds(this, 0, 1, &client_id); + GetIdHandler(id_namespaces::kProgramsAndShaders) + ->MakeIds(this, 0, 1, &client_id); helper_->CreateShader(type, client_id); GPU_CLIENT_LOG("returned " << client_id); CheckGLError(); @@ -236,14 +294,16 @@ GLuint GLES2Implementation::CreateShader(GLenum type) { void GLES2Implementation::CullFace(GLenum mode) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace(" << GLES2Util::GetStringFaceType(mode) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCullFace(" + << GLES2Util::GetStringFaceType(mode) << ")"); helper_->CullFace(mode); CheckGLError(); } void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n << ", " << static_cast<const void*>(buffers) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteBuffers(" << n << ", " + << static_cast<const void*>(buffers) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << buffers[i]); @@ -262,10 +322,11 @@ void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) { CheckGLError(); } -void GLES2Implementation::DeleteFramebuffers( - GLsizei n, const GLuint* framebuffers) { +void GLES2Implementation::DeleteFramebuffers(GLsizei n, + const GLuint* framebuffers) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n << ", " << static_cast<const void*>(framebuffers) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteFramebuffers(" << n << ", " + << static_cast<const void*>(framebuffers) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]); @@ -286,16 +347,18 @@ void GLES2Implementation::DeleteFramebuffers( void GLES2Implementation::DeleteProgram(GLuint program) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteProgram(" << program + << ")"); GPU_CLIENT_DCHECK(program != 0); DeleteProgramHelper(program); CheckGLError(); } -void GLES2Implementation::DeleteRenderbuffers( - GLsizei n, const GLuint* renderbuffers) { +void GLES2Implementation::DeleteRenderbuffers(GLsizei n, + const GLuint* renderbuffers) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n << ", " << static_cast<const void*>(renderbuffers) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteRenderbuffers(" << n + << ", " << static_cast<const void*>(renderbuffers) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]); @@ -324,7 +387,8 @@ void GLES2Implementation::DeleteShader(GLuint shader) { void GLES2Implementation::DeleteTextures(GLsizei n, const GLuint* textures) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n << ", " << static_cast<const void*>(textures) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteTextures(" << n << ", " + << static_cast<const void*>(textures) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << textures[i]); @@ -345,70 +409,92 @@ void GLES2Implementation::DeleteTextures(GLsizei n, const GLuint* textures) { void GLES2Implementation::DepthFunc(GLenum func) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc(" << GLES2Util::GetStringCmpFunction(func) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthFunc(" + << GLES2Util::GetStringCmpFunction(func) << ")"); helper_->DepthFunc(func); CheckGLError(); } void GLES2Implementation::DepthMask(GLboolean flag) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask(" << GLES2Util::GetStringBool(flag) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthMask(" + << GLES2Util::GetStringBool(flag) << ")"); helper_->DepthMask(flag); CheckGLError(); } void GLES2Implementation::DepthRangef(GLclampf zNear, GLclampf zFar) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear << ", " << zFar << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDepthRangef(" << zNear << ", " + << zFar << ")"); helper_->DepthRangef(zNear, zFar); CheckGLError(); } void GLES2Implementation::DetachShader(GLuint program, GLuint shader) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program << ", " << shader << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDetachShader(" << program << ", " + << shader << ")"); helper_->DetachShader(program, shader); CheckGLError(); } -void GLES2Implementation::FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, - GLuint renderbuffer) { +void GLES2Implementation::FramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferRenderbuffer(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringRenderBufferTarget(renderbuffertarget) << ", " << renderbuffer << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferRenderbuffer(" + << GLES2Util::GetStringFrameBufferTarget(target) << ", " + << GLES2Util::GetStringAttachment(attachment) << ", " + << GLES2Util::GetStringRenderBufferTarget( + renderbuffertarget) << ", " << renderbuffer << ")"); helper_->FramebufferRenderbuffer( target, attachment, renderbuffertarget, renderbuffer); CheckGLError(); } -void GLES2Implementation::FramebufferTexture2D( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level) { +void GLES2Implementation::FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringTextureTarget(textarget) << ", " << texture << ", " << level << ")"); // NOLINT - helper_->FramebufferTexture2D(target, attachment, textarget, texture, level); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2D(" + << GLES2Util::GetStringFrameBufferTarget(target) << ", " + << GLES2Util::GetStringAttachment(attachment) << ", " + << GLES2Util::GetStringTextureTarget(textarget) << ", " + << texture << ", " << level << ")"); + if (level != 0) { + SetGLError( + GL_INVALID_VALUE, "glFramebufferTexture2D", "level GL_INVALID_VALUE"); + return; + } + helper_->FramebufferTexture2D(target, attachment, textarget, texture); CheckGLError(); } void GLES2Implementation::FrontFace(GLenum mode) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace(" << GLES2Util::GetStringFaceMode(mode) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFrontFace(" + << GLES2Util::GetStringFaceMode(mode) << ")"); helper_->FrontFace(mode); CheckGLError(); } void GLES2Implementation::GenBuffers(GLsizei n, GLuint* buffers) { - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n << ", " << static_cast<const void*>(buffers) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenBuffers(" << n << ", " + << static_cast<const void*>(buffers) << ")"); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenBuffers", "n < 0"); return; } GPU_CLIENT_SINGLE_THREAD_CHECK(); - GetIdHandler(id_namespaces::kBuffers)-> - MakeIds(this, 0, n, buffers); + GetIdHandler(id_namespaces::kBuffers)->MakeIds(this, 0, n, buffers); GenBuffersHelper(n, buffers); helper_->GenBuffersImmediate(n, buffers); - helper_->CommandBufferHelper::Flush(); + if (share_group_->bind_generates_resource()) + helper_->CommandBufferHelper::Flush(); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << buffers[i]); @@ -419,23 +505,25 @@ void GLES2Implementation::GenBuffers(GLsizei n, GLuint* buffers) { void GLES2Implementation::GenerateMipmap(GLenum target) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap(" << GLES2Util::GetStringTextureBindTarget(target) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenerateMipmap(" + << GLES2Util::GetStringTextureBindTarget(target) << ")"); helper_->GenerateMipmap(target); CheckGLError(); } void GLES2Implementation::GenFramebuffers(GLsizei n, GLuint* framebuffers) { - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n << ", " << static_cast<const void*>(framebuffers) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenFramebuffers(" << n << ", " + << static_cast<const void*>(framebuffers) << ")"); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenFramebuffers", "n < 0"); return; } GPU_CLIENT_SINGLE_THREAD_CHECK(); - GetIdHandler(id_namespaces::kFramebuffers)-> - MakeIds(this, 0, n, framebuffers); + GetIdHandler(id_namespaces::kFramebuffers)->MakeIds(this, 0, n, framebuffers); GenFramebuffersHelper(n, framebuffers); helper_->GenFramebuffersImmediate(n, framebuffers); - helper_->CommandBufferHelper::Flush(); + if (share_group_->bind_generates_resource()) + helper_->CommandBufferHelper::Flush(); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << framebuffers[i]); @@ -445,17 +533,19 @@ void GLES2Implementation::GenFramebuffers(GLsizei n, GLuint* framebuffers) { } void GLES2Implementation::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) { - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n << ", " << static_cast<const void*>(renderbuffers) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenRenderbuffers(" << n << ", " + << static_cast<const void*>(renderbuffers) << ")"); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers", "n < 0"); return; } GPU_CLIENT_SINGLE_THREAD_CHECK(); - GetIdHandler(id_namespaces::kRenderbuffers)-> - MakeIds(this, 0, n, renderbuffers); + GetIdHandler(id_namespaces::kRenderbuffers) + ->MakeIds(this, 0, n, renderbuffers); GenRenderbuffersHelper(n, renderbuffers); helper_->GenRenderbuffersImmediate(n, renderbuffers); - helper_->CommandBufferHelper::Flush(); + if (share_group_->bind_generates_resource()) + helper_->CommandBufferHelper::Flush(); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << renderbuffers[i]); @@ -465,17 +555,18 @@ void GLES2Implementation::GenRenderbuffers(GLsizei n, GLuint* renderbuffers) { } void GLES2Implementation::GenTextures(GLsizei n, GLuint* textures) { - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n << ", " << static_cast<const void*>(textures) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenTextures(" << n << ", " + << static_cast<const void*>(textures) << ")"); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenTextures", "n < 0"); return; } GPU_CLIENT_SINGLE_THREAD_CHECK(); - GetIdHandler(id_namespaces::kTextures)-> - MakeIds(this, 0, n, textures); + GetIdHandler(id_namespaces::kTextures)->MakeIds(this, 0, n, textures); GenTexturesHelper(n, textures); helper_->GenTexturesImmediate(n, textures); - helper_->CommandBufferHelper::Flush(); + if (share_group_->bind_generates_resource()) + helper_->CommandBufferHelper::Flush(); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << textures[i]); @@ -487,7 +578,9 @@ void GLES2Implementation::GenTextures(GLsizei n, GLuint* textures) { void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleanv(" + << GLES2Util::GetStringGLState(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleanv"); if (GetBooleanvHelper(pname, params)) { return; @@ -498,22 +591,25 @@ void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) { return; } result->SetNumResults(0); - helper_->GetBooleanv(pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetBooleanv(pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); CheckGLError(); } -void GLES2Implementation::GetBufferParameteriv( - GLenum target, GLenum pname, GLint* params) { +void GLES2Implementation::GetBufferParameteriv(GLenum target, + GLenum pname, + GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv(" << GLES2Util::GetStringBufferTarget(target) << ", " << GLES2Util::GetStringBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBufferParameteriv(" + << GLES2Util::GetStringBufferTarget(target) << ", " + << GLES2Util::GetStringBufferParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetBufferParameteriv"); if (GetBufferParameterivHelper(target, pname, params)) { return; @@ -524,12 +620,12 @@ void GLES2Implementation::GetBufferParameteriv( return; } result->SetNumResults(0); - helper_->GetBufferParameteriv(target, pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetBufferParameteriv( + target, pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); @@ -537,7 +633,9 @@ void GLES2Implementation::GetBufferParameteriv( } void GLES2Implementation::GetFloatv(GLenum pname, GLfloat* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFloatv(" + << GLES2Util::GetStringGLState(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetFloatv"); if (GetFloatvHelper(pname, params)) { return; @@ -548,25 +646,32 @@ void GLES2Implementation::GetFloatv(GLenum pname, GLfloat* params) { return; } result->SetNumResults(0); - helper_->GetFloatv(pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetFloatv(pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); CheckGLError(); } -void GLES2Implementation::GetFramebufferAttachmentParameteriv( - GLenum target, GLenum attachment, GLenum pname, GLint* params) { +void GLES2Implementation::GetFramebufferAttachmentParameteriv(GLenum target, + GLenum attachment, + GLenum pname, + GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetFramebufferAttachmentParameteriv(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringFrameBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT - TRACE_EVENT0("gpu", "GLES2Implementation::GetFramebufferAttachmentParameteriv"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() + << "] glGetFramebufferAttachmentParameteriv(" + << GLES2Util::GetStringFrameBufferTarget(target) << ", " + << GLES2Util::GetStringAttachment(attachment) << ", " + << GLES2Util::GetStringFrameBufferParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); + TRACE_EVENT0("gpu", + "GLES2Implementation::GetFramebufferAttachmentParameteriv"); if (GetFramebufferAttachmentParameterivHelper( - target, attachment, pname, params)) { + target, attachment, pname, params)) { return; } typedef cmds::GetFramebufferAttachmentParameteriv::Result Result; @@ -575,12 +680,12 @@ void GLES2Implementation::GetFramebufferAttachmentParameteriv( return; } result->SetNumResults(0); - helper_->GetFramebufferAttachmentParameteriv(target, attachment, pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetFramebufferAttachmentParameteriv( + target, attachment, pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); @@ -589,7 +694,9 @@ void GLES2Implementation::GetFramebufferAttachmentParameteriv( void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv(" << GLES2Util::GetStringGLState(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetIntegerv(" + << GLES2Util::GetStringGLState(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetIntegerv"); if (GetIntegervHelper(pname, params)) { return; @@ -600,22 +707,24 @@ void GLES2Implementation::GetIntegerv(GLenum pname, GLint* params) { return; } result->SetNumResults(0); - helper_->GetIntegerv(pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetIntegerv(pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); CheckGLError(); } -void GLES2Implementation::GetProgramiv( - GLuint program, GLenum pname, GLint* params) { +void GLES2Implementation::GetProgramiv(GLuint program, + GLenum pname, + GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", " << GLES2Util::GetStringProgramParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramiv(" << program << ", " + << GLES2Util::GetStringProgramParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetProgramiv"); if (GetProgramivHelper(program, pname, params)) { return; @@ -626,35 +735,33 @@ void GLES2Implementation::GetProgramiv( return; } result->SetNumResults(0); - helper_->GetProgramiv(program, pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetProgramiv(program, pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); CheckGLError(); } -void GLES2Implementation::GetProgramInfoLog( - GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { +void GLES2Implementation::GetProgramInfoLog(GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length); - GPU_CLIENT_LOG("[" << GetLogPrefix() - << "] glGetProgramInfoLog" << "(" - << program << ", " - << bufsize << ", " - << static_cast<void*>(length) << ", " - << static_cast<void*>(infolog) << ")"); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetProgramInfoLog" + << "(" << program << ", " << bufsize << ", " + << static_cast<void*>(length) << ", " + << static_cast<void*>(infolog) << ")"); helper_->SetBucketSize(kResultBucketId, 0); helper_->GetProgramInfoLog(program, kResultBucketId); std::string str; GLsizei max_size = 0; if (GetBucketAsString(kResultBucketId, &str)) { if (bufsize > 0) { - max_size = - std::min(static_cast<size_t>(bufsize) - 1, str.size()); + max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size()); memcpy(infolog, str.c_str(), max_size); infolog[max_size] = '\0'; GPU_CLIENT_LOG("------\n" << infolog << "\n------"); @@ -665,11 +772,15 @@ void GLES2Implementation::GetProgramInfoLog( } CheckGLError(); } -void GLES2Implementation::GetRenderbufferParameteriv( - GLenum target, GLenum pname, GLint* params) { +void GLES2Implementation::GetRenderbufferParameteriv(GLenum target, + GLenum pname, + GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << GLES2Util::GetStringRenderBufferParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetRenderbufferParameteriv(" + << GLES2Util::GetStringRenderBufferTarget(target) << ", " + << GLES2Util::GetStringRenderBufferParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetRenderbufferParameteriv"); if (GetRenderbufferParameterivHelper(target, pname, params)) { return; @@ -680,22 +791,25 @@ void GLES2Implementation::GetRenderbufferParameteriv( return; } result->SetNumResults(0); - helper_->GetRenderbufferParameteriv(target, pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetRenderbufferParameteriv( + target, pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); CheckGLError(); } -void GLES2Implementation::GetShaderiv( - GLuint shader, GLenum pname, GLint* params) { +void GLES2Implementation::GetShaderiv(GLuint shader, + GLenum pname, + GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader << ", " << GLES2Util::GetStringShaderParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderiv(" << shader << ", " + << GLES2Util::GetStringShaderParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetShaderiv"); if (GetShaderivHelper(shader, pname, params)) { return; @@ -706,35 +820,33 @@ void GLES2Implementation::GetShaderiv( return; } result->SetNumResults(0); - helper_->GetShaderiv(shader, pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetShaderiv(shader, pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); CheckGLError(); } -void GLES2Implementation::GetShaderInfoLog( - GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { +void GLES2Implementation::GetShaderInfoLog(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length); - GPU_CLIENT_LOG("[" << GetLogPrefix() - << "] glGetShaderInfoLog" << "(" - << shader << ", " - << bufsize << ", " - << static_cast<void*>(length) << ", " - << static_cast<void*>(infolog) << ")"); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderInfoLog" + << "(" << shader << ", " << bufsize << ", " + << static_cast<void*>(length) << ", " + << static_cast<void*>(infolog) << ")"); helper_->SetBucketSize(kResultBucketId, 0); helper_->GetShaderInfoLog(shader, kResultBucketId); std::string str; GLsizei max_size = 0; if (GetBucketAsString(kResultBucketId, &str)) { if (bufsize > 0) { - max_size = - std::min(static_cast<size_t>(bufsize) - 1, str.size()); + max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size()); memcpy(infolog, str.c_str(), max_size); infolog[max_size] = '\0'; GPU_CLIENT_LOG("------\n" << infolog << "\n------"); @@ -745,24 +857,23 @@ void GLES2Implementation::GetShaderInfoLog( } CheckGLError(); } -void GLES2Implementation::GetShaderSource( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { +void GLES2Implementation::GetShaderSource(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length); - GPU_CLIENT_LOG("[" << GetLogPrefix() - << "] glGetShaderSource" << "(" - << shader << ", " - << bufsize << ", " - << static_cast<void*>(length) << ", " - << static_cast<void*>(source) << ")"); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetShaderSource" + << "(" << shader << ", " << bufsize << ", " + << static_cast<void*>(length) << ", " + << static_cast<void*>(source) << ")"); helper_->SetBucketSize(kResultBucketId, 0); helper_->GetShaderSource(shader, kResultBucketId); std::string str; GLsizei max_size = 0; if (GetBucketAsString(kResultBucketId, &str)) { if (bufsize > 0) { - max_size = - std::min(static_cast<size_t>(bufsize) - 1, str.size()); + max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size()); memcpy(source, str.c_str(), max_size); source[max_size] = '\0'; GPU_CLIENT_LOG("------\n" << source << "\n------"); @@ -773,10 +884,14 @@ void GLES2Implementation::GetShaderSource( } CheckGLError(); } -void GLES2Implementation::GetTexParameterfv( - GLenum target, GLenum pname, GLfloat* params) { +void GLES2Implementation::GetTexParameterfv(GLenum target, + GLenum pname, + GLfloat* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv(" << GLES2Util::GetStringGetTexParamTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameterfv(" + << GLES2Util::GetStringGetTexParamTarget(target) << ", " + << GLES2Util::GetStringTextureParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameterfv"); if (GetTexParameterfvHelper(target, pname, params)) { return; @@ -787,22 +902,26 @@ void GLES2Implementation::GetTexParameterfv( return; } result->SetNumResults(0); - helper_->GetTexParameterfv(target, pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetTexParameterfv( + target, pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); CheckGLError(); } -void GLES2Implementation::GetTexParameteriv( - GLenum target, GLenum pname, GLint* params) { +void GLES2Implementation::GetTexParameteriv(GLenum target, + GLenum pname, + GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLint, params); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv(" << GLES2Util::GetStringGetTexParamTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTexParameteriv(" + << GLES2Util::GetStringGetTexParamTarget(target) << ", " + << GLES2Util::GetStringTextureParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); TRACE_EVENT0("gpu", "GLES2Implementation::GetTexParameteriv"); if (GetTexParameterivHelper(target, pname, params)) { return; @@ -813,12 +932,12 @@ void GLES2Implementation::GetTexParameteriv( return; } result->SetNumResults(0); - helper_->GetTexParameteriv(target, pname, - GetResultShmId(), GetResultShmOffset()); + helper_->GetTexParameteriv( + target, pname, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); result->CopyResult(params); GPU_CLIENT_LOG_CODE_BLOCK({ - for (int32 i = 0; i < result->GetNumResults(); ++i) { + for (int32_t i = 0; i < result->GetNumResults(); ++i) { GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); } }); @@ -826,7 +945,9 @@ void GLES2Implementation::GetTexParameteriv( } void GLES2Implementation::Hint(GLenum target, GLenum mode) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint(" << GLES2Util::GetStringHintTarget(target) << ", " << GLES2Util::GetStringHintMode(mode) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glHint(" + << GLES2Util::GetStringHintTarget(target) << ", " + << GLES2Util::GetStringHintMode(mode) << ")"); helper_->Hint(target, mode); CheckGLError(); } @@ -852,7 +973,8 @@ GLboolean GLES2Implementation::IsBuffer(GLuint buffer) { GLboolean GLES2Implementation::IsFramebuffer(GLuint framebuffer) { GPU_CLIENT_SINGLE_THREAD_CHECK(); TRACE_EVENT0("gpu", "GLES2Implementation::IsFramebuffer"); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsFramebuffer(" << framebuffer + << ")"); typedef cmds::IsFramebuffer::Result Result; Result* result = GetResultAs<Result*>(); if (!result) { @@ -888,15 +1010,15 @@ GLboolean GLES2Implementation::IsProgram(GLuint program) { GLboolean GLES2Implementation::IsRenderbuffer(GLuint renderbuffer) { GPU_CLIENT_SINGLE_THREAD_CHECK(); TRACE_EVENT0("gpu", "GLES2Implementation::IsRenderbuffer"); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsRenderbuffer(" << renderbuffer + << ")"); typedef cmds::IsRenderbuffer::Result Result; Result* result = GetResultAs<Result*>(); if (!result) { return GL_FALSE; } *result = 0; - helper_->IsRenderbuffer( - renderbuffer, GetResultShmId(), GetResultShmOffset()); + helper_->IsRenderbuffer(renderbuffer, GetResultShmId(), GetResultShmOffset()); WaitForCmd(); GLboolean result_value = *result; GPU_CLIENT_LOG("returned " << result_value); @@ -949,22 +1071,29 @@ void GLES2Implementation::LineWidth(GLfloat width) { void GLES2Implementation::PolygonOffset(GLfloat factor, GLfloat units) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", " << units << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glPolygonOffset(" << factor << ", " + << units << ")"); helper_->PolygonOffset(factor, units); CheckGLError(); } void GLES2Implementation::ReleaseShaderCompiler() { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler(" << ")"); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseShaderCompiler(" + << ")"); helper_->ReleaseShaderCompiler(); CheckGLError(); } -void GLES2Implementation::RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { +void GLES2Implementation::RenderbufferStorage(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorage(" + << GLES2Util::GetStringRenderBufferTarget(target) << ", " + << GLES2Util::GetStringRenderBufferFormat(internalformat) + << ", " << width << ", " << height << ")"); if (width < 0) { SetGLError(GL_INVALID_VALUE, "glRenderbufferStorage", "width < 0"); return; @@ -979,15 +1108,19 @@ void GLES2Implementation::RenderbufferStorage( void GLES2Implementation::SampleCoverage(GLclampf value, GLboolean invert) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", " << GLES2Util::GetStringBool(invert) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glSampleCoverage(" << value << ", " + << GLES2Util::GetStringBool(invert) << ")"); helper_->SampleCoverage(value, invert); CheckGLError(); } -void GLES2Implementation::Scissor( - GLint x, GLint y, GLsizei width, GLsizei height) { +void GLES2Implementation::Scissor(GLint x, + GLint y, + GLsizei width, + GLsizei height) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glScissor(" << x << ", " << y + << ", " << width << ", " << height << ")"); if (width < 0) { SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0"); return; @@ -1002,15 +1135,22 @@ void GLES2Implementation::Scissor( void GLES2Implementation::StencilFunc(GLenum func, GLint ref, GLuint mask) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc(" << GLES2Util::GetStringCmpFunction(func) << ", " << ref << ", " << mask << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFunc(" + << GLES2Util::GetStringCmpFunction(func) << ", " << ref + << ", " << mask << ")"); helper_->StencilFunc(func, ref, mask); CheckGLError(); } -void GLES2Implementation::StencilFuncSeparate( - GLenum face, GLenum func, GLint ref, GLuint mask) { +void GLES2Implementation::StencilFuncSeparate(GLenum face, + GLenum func, + GLint ref, + GLuint mask) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << GLES2Util::GetStringCmpFunction(func) << ", " << ref << ", " << mask << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilFuncSeparate(" + << GLES2Util::GetStringFaceType(face) << ", " + << GLES2Util::GetStringCmpFunction(func) << ", " << ref + << ", " << mask << ")"); helper_->StencilFuncSeparate(face, func, ref, mask); CheckGLError(); } @@ -1024,55 +1164,82 @@ void GLES2Implementation::StencilMask(GLuint mask) { void GLES2Implementation::StencilMaskSeparate(GLenum face, GLuint mask) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << mask << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilMaskSeparate(" + << GLES2Util::GetStringFaceType(face) << ", " << mask + << ")"); helper_->StencilMaskSeparate(face, mask); CheckGLError(); } void GLES2Implementation::StencilOp(GLenum fail, GLenum zfail, GLenum zpass) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp(" << GLES2Util::GetStringStencilOp(fail) << ", " << GLES2Util::GetStringStencilOp(zfail) << ", " << GLES2Util::GetStringStencilOp(zpass) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOp(" + << GLES2Util::GetStringStencilOp(fail) << ", " + << GLES2Util::GetStringStencilOp(zfail) << ", " + << GLES2Util::GetStringStencilOp(zpass) << ")"); helper_->StencilOp(fail, zfail, zpass); CheckGLError(); } -void GLES2Implementation::StencilOpSeparate( - GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { +void GLES2Implementation::StencilOpSeparate(GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate(" << GLES2Util::GetStringFaceType(face) << ", " << GLES2Util::GetStringStencilOp(fail) << ", " << GLES2Util::GetStringStencilOp(zfail) << ", " << GLES2Util::GetStringStencilOp(zpass) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glStencilOpSeparate(" + << GLES2Util::GetStringFaceType(face) << ", " + << GLES2Util::GetStringStencilOp(fail) << ", " + << GLES2Util::GetStringStencilOp(zfail) << ", " + << GLES2Util::GetStringStencilOp(zpass) << ")"); helper_->StencilOpSeparate(face, fail, zfail, zpass); CheckGLError(); } -void GLES2Implementation::TexParameterf( - GLenum target, GLenum pname, GLfloat param) { +void GLES2Implementation::TexParameterf(GLenum target, + GLenum pname, + GLfloat param) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << param << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterf(" + << GLES2Util::GetStringTextureBindTarget(target) << ", " + << GLES2Util::GetStringTextureParameter(pname) << ", " + << param << ")"); helper_->TexParameterf(target, pname, param); CheckGLError(); } -void GLES2Implementation::TexParameterfv( - GLenum target, GLenum pname, const GLfloat* params) { +void GLES2Implementation::TexParameterfv(GLenum target, + GLenum pname, + const GLfloat* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameterfv(" + << GLES2Util::GetStringTextureBindTarget(target) << ", " + << GLES2Util::GetStringTextureParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); GPU_CLIENT_LOG("values: " << params[0]); helper_->TexParameterfvImmediate(target, pname, params); CheckGLError(); } -void GLES2Implementation::TexParameteri( - GLenum target, GLenum pname, GLint param) { +void GLES2Implementation::TexParameteri(GLenum target, + GLenum pname, + GLint param) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << param << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteri(" + << GLES2Util::GetStringTextureBindTarget(target) << ", " + << GLES2Util::GetStringTextureParameter(pname) << ", " + << param << ")"); helper_->TexParameteri(target, pname, param); CheckGLError(); } -void GLES2Implementation::TexParameteriv( - GLenum target, GLenum pname, const GLint* params) { +void GLES2Implementation::TexParameteriv(GLenum target, + GLenum pname, + const GLint* params) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << GLES2Util::GetStringTextureParameter(pname) << ", " << static_cast<const void*>(params) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexParameteriv(" + << GLES2Util::GetStringTextureBindTarget(target) << ", " + << GLES2Util::GetStringTextureParameter(pname) << ", " + << static_cast<const void*>(params) << ")"); GPU_CLIENT_LOG("values: " << params[0]); helper_->TexParameterivImmediate(target, pname, params); CheckGLError(); @@ -1080,18 +1247,21 @@ void GLES2Implementation::TexParameteriv( void GLES2Implementation::Uniform1f(GLint location, GLfloat x) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", " << x << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1f(" << location << ", " + << x << ")"); helper_->Uniform1f(location, x); CheckGLError(); } -void GLES2Implementation::Uniform1fv( - GLint location, GLsizei count, const GLfloat* v) { +void GLES2Implementation::Uniform1fv(GLint location, + GLsizei count, + const GLfloat* v) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1fv(" << location << ", " + << count << ", " << static_cast<const void*>(v) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]); + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]); } }); if (count < 0) { @@ -1104,18 +1274,21 @@ void GLES2Implementation::Uniform1fv( void GLES2Implementation::Uniform1i(GLint location, GLint x) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", " << x << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1i(" << location << ", " + << x << ")"); helper_->Uniform1i(location, x); CheckGLError(); } -void GLES2Implementation::Uniform1iv( - GLint location, GLsizei count, const GLint* v) { +void GLES2Implementation::Uniform1iv(GLint location, + GLsizei count, + const GLint* v) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform1iv(" << location << ", " + << count << ", " << static_cast<const void*>(v) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]); + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 1]); } }); if (count < 0) { @@ -1128,18 +1301,21 @@ void GLES2Implementation::Uniform1iv( void GLES2Implementation::Uniform2f(GLint location, GLfloat x, GLfloat y) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", " << x << ", " << y << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2f(" << location << ", " + << x << ", " << y << ")"); helper_->Uniform2f(location, x, y); CheckGLError(); } -void GLES2Implementation::Uniform2fv( - GLint location, GLsizei count, const GLfloat* v) { +void GLES2Implementation::Uniform2fv(GLint location, + GLsizei count, + const GLfloat* v) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2fv(" << location << ", " + << count << ", " << static_cast<const void*>(v) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]); // NOLINT + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]); } }); if (count < 0) { @@ -1152,18 +1328,21 @@ void GLES2Implementation::Uniform2fv( void GLES2Implementation::Uniform2i(GLint location, GLint x, GLint y) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", " << x << ", " << y << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2i(" << location << ", " + << x << ", " << y << ")"); helper_->Uniform2i(location, x, y); CheckGLError(); } -void GLES2Implementation::Uniform2iv( - GLint location, GLsizei count, const GLint* v) { +void GLES2Implementation::Uniform2iv(GLint location, + GLsizei count, + const GLint* v) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform2iv(" << location << ", " + << count << ", " << static_cast<const void*>(v) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]); // NOLINT + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 2] << ", " << v[1 + i * 2]); } }); if (count < 0) { @@ -1174,21 +1353,27 @@ void GLES2Implementation::Uniform2iv( CheckGLError(); } -void GLES2Implementation::Uniform3f( - GLint location, GLfloat x, GLfloat y, GLfloat z) { +void GLES2Implementation::Uniform3f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3f(" << location << ", " + << x << ", " << y << ", " << z << ")"); helper_->Uniform3f(location, x, y, z); CheckGLError(); } -void GLES2Implementation::Uniform3fv( - GLint location, GLsizei count, const GLfloat* v) { +void GLES2Implementation::Uniform3fv(GLint location, + GLsizei count, + const GLfloat* v) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3fv(" << location << ", " + << count << ", " << static_cast<const void*>(v) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3] << ", " << v[2 + i * 3]); // NOLINT + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3] + << ", " << v[2 + i * 3]); } }); if (count < 0) { @@ -1199,21 +1384,24 @@ void GLES2Implementation::Uniform3fv( CheckGLError(); } -void GLES2Implementation::Uniform3i( - GLint location, GLint x, GLint y, GLint z) { +void GLES2Implementation::Uniform3i(GLint location, GLint x, GLint y, GLint z) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", " << x << ", " << y << ", " << z << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3i(" << location << ", " + << x << ", " << y << ", " << z << ")"); helper_->Uniform3i(location, x, y, z); CheckGLError(); } -void GLES2Implementation::Uniform3iv( - GLint location, GLsizei count, const GLint* v) { +void GLES2Implementation::Uniform3iv(GLint location, + GLsizei count, + const GLint* v) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform3iv(" << location << ", " + << count << ", " << static_cast<const void*>(v) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3] << ", " << v[2 + i * 3]); // NOLINT + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 3] << ", " << v[1 + i * 3] + << ", " << v[2 + i * 3]); } }); if (count < 0) { @@ -1224,21 +1412,28 @@ void GLES2Implementation::Uniform3iv( CheckGLError(); } -void GLES2Implementation::Uniform4f( - GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { +void GLES2Implementation::Uniform4f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4f(" << location << ", " + << x << ", " << y << ", " << z << ", " << w << ")"); helper_->Uniform4f(location, x, y, z, w); CheckGLError(); } -void GLES2Implementation::Uniform4fv( - GLint location, GLsizei count, const GLfloat* v) { +void GLES2Implementation::Uniform4fv(GLint location, + GLsizei count, + const GLfloat* v) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4fv(" << location << ", " + << count << ", " << static_cast<const void*>(v) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4] << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]); // NOLINT + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4] + << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]); } }); if (count < 0) { @@ -1249,21 +1444,28 @@ void GLES2Implementation::Uniform4fv( CheckGLError(); } -void GLES2Implementation::Uniform4i( - GLint location, GLint x, GLint y, GLint z, GLint w) { +void GLES2Implementation::Uniform4i(GLint location, + GLint x, + GLint y, + GLint z, + GLint w) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4i(" << location << ", " + << x << ", " << y << ", " << z << ", " << w << ")"); helper_->Uniform4i(location, x, y, z, w); CheckGLError(); } -void GLES2Implementation::Uniform4iv( - GLint location, GLsizei count, const GLint* v) { +void GLES2Implementation::Uniform4iv(GLint location, + GLsizei count, + const GLint* v) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", " << count << ", " << static_cast<const void*>(v) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniform4iv(" << location << ", " + << count << ", " << static_cast<const void*>(v) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4] << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]); // NOLINT + GPU_CLIENT_LOG(" " << i << ": " << v[0 + i * 4] << ", " << v[1 + i * 4] + << ", " << v[2 + i * 4] << ", " << v[3 + i * 4]); } }); if (count < 0) { @@ -1274,74 +1476,135 @@ void GLES2Implementation::Uniform4iv( CheckGLError(); } -void GLES2Implementation::UniformMatrix2fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { +void GLES2Implementation::UniformMatrix2fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix2fv(" << location + << ", " << count << ", " + << GLES2Util::GetStringBool(transpose) << ", " + << static_cast<const void*>(value) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", " << value[1 + i * 4] << ", " << value[2 + i * 4] << ", " << value[3 + i * 4]); // NOLINT + GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 4] << ", " + << value[1 + i * 4] << ", " << value[2 + i * 4] + << ", " << value[3 + i * 4]); } }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniformMatrix2fv", "count < 0"); return; } - helper_->UniformMatrix2fvImmediate(location, count, transpose, value); + if (transpose != false) { + SetGLError( + GL_INVALID_VALUE, "glUniformMatrix2fv", "transpose GL_INVALID_VALUE"); + return; + } + helper_->UniformMatrix2fvImmediate(location, count, value); CheckGLError(); } -void GLES2Implementation::UniformMatrix3fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { +void GLES2Implementation::UniformMatrix3fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix3fv(" << location + << ", " << count << ", " + << GLES2Util::GetStringBool(transpose) << ", " + << static_cast<const void*>(value) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", " << value[1 + i * 9] << ", " << value[2 + i * 9] << ", " << value[3 + i * 9] << ", " << value[4 + i * 9] << ", " << value[5 + i * 9] << ", " << value[6 + i * 9] << ", " << value[7 + i * 9] << ", " << value[8 + i * 9]); // NOLINT + GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 9] << ", " + << value[1 + i * 9] << ", " << value[2 + i * 9] + << ", " << value[3 + i * 9] << ", " + << value[4 + i * 9] << ", " << value[5 + i * 9] + << ", " << value[6 + i * 9] << ", " + << value[7 + i * 9] << ", " << value[8 + i * 9]); } }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniformMatrix3fv", "count < 0"); return; } - helper_->UniformMatrix3fvImmediate(location, count, transpose, value); + if (transpose != false) { + SetGLError( + GL_INVALID_VALUE, "glUniformMatrix3fv", "transpose GL_INVALID_VALUE"); + return; + } + helper_->UniformMatrix3fvImmediate(location, count, value); CheckGLError(); } -void GLES2Implementation::UniformMatrix4fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { +void GLES2Implementation::UniformMatrix4fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location << ", " << count << ", " << GLES2Util::GetStringBool(transpose) << ", " << static_cast<const void*>(value) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUniformMatrix4fv(" << location + << ", " << count << ", " + << GLES2Util::GetStringBool(transpose) << ", " + << static_cast<const void*>(value) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16] << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", " << value[4 + i * 16] << ", " << value[5 + i * 16] << ", " << value[6 + i * 16] << ", " << value[7 + i * 16] << ", " << value[8 + i * 16] << ", " << value[9 + i * 16] << ", " << value[10 + i * 16] << ", " << value[11 + i * 16] << ", " << value[12 + i * 16] << ", " << value[13 + i * 16] << ", " << value[14 + i * 16] << ", " << value[15 + i * 16]); // NOLINT + GPU_CLIENT_LOG( + " " << i << ": " << value[0 + i * 16] << ", " << value[1 + i * 16] + << ", " << value[2 + i * 16] << ", " << value[3 + i * 16] << ", " + << value[4 + i * 16] << ", " << value[5 + i * 16] << ", " + << value[6 + i * 16] << ", " << value[7 + i * 16] << ", " + << value[8 + i * 16] << ", " << value[9 + i * 16] << ", " + << value[10 + i * 16] << ", " << value[11 + i * 16] << ", " + << value[12 + i * 16] << ", " << value[13 + i * 16] << ", " + << value[14 + i * 16] << ", " << value[15 + i * 16]); } }); if (count < 0) { SetGLError(GL_INVALID_VALUE, "glUniformMatrix4fv", "count < 0"); return; } - helper_->UniformMatrix4fvImmediate(location, count, transpose, value); + if (transpose != false) { + SetGLError( + GL_INVALID_VALUE, "glUniformMatrix4fv", "transpose GL_INVALID_VALUE"); + return; + } + helper_->UniformMatrix4fvImmediate(location, count, value); + CheckGLError(); +} + +void GLES2Implementation::UseProgram(GLuint program) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glUseProgram(" << program << ")"); + if (IsProgramReservedId(program)) { + SetGLError(GL_INVALID_OPERATION, "UseProgram", "program reserved id"); + return; + } + if (UseProgramHelper(program)) { + helper_->UseProgram(program); + } CheckGLError(); } void GLES2Implementation::ValidateProgram(GLuint program) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glValidateProgram(" << program + << ")"); helper_->ValidateProgram(program); CheckGLError(); } void GLES2Implementation::VertexAttrib1f(GLuint indx, GLfloat x) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", " << x << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1f(" << indx << ", " + << x << ")"); helper_->VertexAttrib1f(indx, x); CheckGLError(); } void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib1fv(" << indx << ", " + << static_cast<const void*>(values) << ")"); GPU_CLIENT_LOG("values: " << values[0]); helper_->VertexAttrib1fvImmediate(indx, values); CheckGLError(); @@ -1349,55 +1612,71 @@ void GLES2Implementation::VertexAttrib1fv(GLuint indx, const GLfloat* values) { void GLES2Implementation::VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", " << x << ", " << y << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2f(" << indx << ", " + << x << ", " << y << ")"); helper_->VertexAttrib2f(indx, x, y); CheckGLError(); } void GLES2Implementation::VertexAttrib2fv(GLuint indx, const GLfloat* values) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib2fv(" << indx << ", " + << static_cast<const void*>(values) << ")"); GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1]); helper_->VertexAttrib2fvImmediate(indx, values); CheckGLError(); } -void GLES2Implementation::VertexAttrib3f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z) { +void GLES2Implementation::VertexAttrib3f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", " << x << ", " << y << ", " << z << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3f(" << indx << ", " + << x << ", " << y << ", " << z << ")"); helper_->VertexAttrib3f(indx, x, y, z); CheckGLError(); } void GLES2Implementation::VertexAttrib3fv(GLuint indx, const GLfloat* values) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT - GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " << values[2]); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib3fv(" << indx << ", " + << static_cast<const void*>(values) << ")"); + GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " + << values[2]); helper_->VertexAttrib3fvImmediate(indx, values); CheckGLError(); } -void GLES2Implementation::VertexAttrib4f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { +void GLES2Implementation::VertexAttrib4f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", " << x << ", " << y << ", " << z << ", " << w << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4f(" << indx << ", " + << x << ", " << y << ", " << z << ", " << w << ")"); helper_->VertexAttrib4f(indx, x, y, z, w); CheckGLError(); } void GLES2Implementation::VertexAttrib4fv(GLuint indx, const GLfloat* values) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", " << static_cast<const void*>(values) << ")"); // NOLINT - GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " << values[2] << ", " << values[3]); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttrib4fv(" << indx << ", " + << static_cast<const void*>(values) << ")"); + GPU_CLIENT_LOG("values: " << values[0] << ", " << values[1] << ", " + << values[2] << ", " << values[3]); helper_->VertexAttrib4fvImmediate(indx, values); CheckGLError(); } -void GLES2Implementation::Viewport( - GLint x, GLint y, GLsizei width, GLsizei height) { +void GLES2Implementation::Viewport(GLint x, + GLint y, + GLsizei width, + GLsizei height) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y << ", " << width << ", " << height << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y + << ", " << width << ", " << height << ")"); if (width < 0) { SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0"); return; @@ -1410,34 +1689,55 @@ void GLES2Implementation::Viewport( CheckGLError(); } -void GLES2Implementation::BlitFramebufferCHROMIUM( - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, - GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { +void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM(" << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1 << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", " << dstY1 << ", " << mask << ", " << GLES2Util::GetStringBlitFilter(filter) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlitFramebufferCHROMIUM(" + << srcX0 << ", " << srcY0 << ", " << srcX1 << ", " << srcY1 + << ", " << dstX0 << ", " << dstY0 << ", " << dstX1 << ", " + << dstY1 << ", " << mask << ", " + << GLES2Util::GetStringBlitFilter(filter) << ")"); helper_->BlitFramebufferCHROMIUM( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); CheckGLError(); } void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, GLsizei height) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT + GPU_CLIENT_LOG( + "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleCHROMIUM(" + << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples + << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) + << ", " << width << ", " << height << ")"); if (samples < 0) { - SetGLError( - GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM", "samples < 0"); // NOLINT + SetGLError(GL_INVALID_VALUE, + "glRenderbufferStorageMultisampleCHROMIUM", + "samples < 0"); return; } if (width < 0) { - SetGLError( - GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM", "width < 0"); // NOLINT + SetGLError(GL_INVALID_VALUE, + "glRenderbufferStorageMultisampleCHROMIUM", + "width < 0"); return; } if (height < 0) { - SetGLError( - GL_INVALID_VALUE, "glRenderbufferStorageMultisampleCHROMIUM", "height < 0"); // NOLINT + SetGLError(GL_INVALID_VALUE, + "glRenderbufferStorageMultisampleCHROMIUM", + "height < 0"); return; } helper_->RenderbufferStorageMultisampleCHROMIUM( @@ -1446,10 +1746,17 @@ void GLES2Implementation::RenderbufferStorageMultisampleCHROMIUM( } void GLES2Implementation::RenderbufferStorageMultisampleEXT( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, GLsizei height) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT(" << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) << ", " << width << ", " << height << ")"); // NOLINT + GPU_CLIENT_LOG( + "[" << GetLogPrefix() << "] glRenderbufferStorageMultisampleEXT(" + << GLES2Util::GetStringRenderBufferTarget(target) << ", " << samples + << ", " << GLES2Util::GetStringRenderBufferFormat(internalformat) + << ", " << width << ", " << height << ")"); if (samples < 0) { SetGLError( GL_INVALID_VALUE, "glRenderbufferStorageMultisampleEXT", "samples < 0"); @@ -1470,26 +1777,47 @@ void GLES2Implementation::RenderbufferStorageMultisampleEXT( CheckGLError(); } -void GLES2Implementation::FramebufferTexture2DMultisampleEXT( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLsizei samples) { +void GLES2Implementation::FramebufferTexture2DMultisampleEXT(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFramebufferTexture2DMultisampleEXT(" << GLES2Util::GetStringFrameBufferTarget(target) << ", " << GLES2Util::GetStringAttachment(attachment) << ", " << GLES2Util::GetStringTextureTarget(textarget) << ", " << texture << ", " << level << ", " << samples << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() + << "] glFramebufferTexture2DMultisampleEXT(" + << GLES2Util::GetStringFrameBufferTarget(target) << ", " + << GLES2Util::GetStringAttachment(attachment) << ", " + << GLES2Util::GetStringTextureTarget(textarget) << ", " + << texture << ", " << level << ", " << samples << ")"); + if (level != 0) { + SetGLError(GL_INVALID_VALUE, + "glFramebufferTexture2DMultisampleEXT", + "level GL_INVALID_VALUE"); + return; + } if (samples < 0) { - SetGLError( - GL_INVALID_VALUE, "glFramebufferTexture2DMultisampleEXT", "samples < 0"); // NOLINT + SetGLError(GL_INVALID_VALUE, + "glFramebufferTexture2DMultisampleEXT", + "samples < 0"); return; } helper_->FramebufferTexture2DMultisampleEXT( - target, attachment, textarget, texture, level, samples); + target, attachment, textarget, texture, samples); CheckGLError(); } -void GLES2Implementation::TexStorage2DEXT( - GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, - GLsizei height) { +void GLES2Implementation::TexStorage2DEXT(GLenum target, + GLsizei levels, + GLenum internalFormat, + GLsizei width, + GLsizei height) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexStorage2DEXT(" << GLES2Util::GetStringTextureTarget(target) << ", " << levels << ", " << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat) << ", " << width << ", " << height << ")"); // NOLINT + GPU_CLIENT_LOG( + "[" << GetLogPrefix() << "] glTexStorage2DEXT(" + << GLES2Util::GetStringTextureTarget(target) << ", " << levels << ", " + << GLES2Util::GetStringTextureInternalFormatStorage(internalFormat) + << ", " << width << ", " << height << ")"); if (levels < 0) { SetGLError(GL_INVALID_VALUE, "glTexStorage2DEXT", "levels < 0"); return; @@ -1507,17 +1835,18 @@ void GLES2Implementation::TexStorage2DEXT( } void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) { - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", " << static_cast<const void*>(queries) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenQueriesEXT(" << n << ", " + << static_cast<const void*>(queries) << ")"); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenQueriesEXT", "n < 0"); return; } GPU_CLIENT_SINGLE_THREAD_CHECK(); - GetIdHandler(id_namespaces::kQueries)-> - MakeIds(this, 0, n, queries); + GetIdHandler(id_namespaces::kQueries)->MakeIds(this, 0, n, queries); GenQueriesEXTHelper(n, queries); helper_->GenQueriesEXTImmediate(n, queries); - helper_->CommandBufferHelper::Flush(); + if (share_group_->bind_generates_resource()) + helper_->CommandBufferHelper::Flush(); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << queries[i]); @@ -1528,7 +1857,8 @@ void GLES2Implementation::GenQueriesEXT(GLsizei n, GLuint* queries) { void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", " << static_cast<const void*>(queries) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteQueriesEXT(" << n << ", " + << static_cast<const void*>(queries) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << queries[i]); @@ -1548,17 +1878,18 @@ void GLES2Implementation::DeleteQueriesEXT(GLsizei n, const GLuint* queries) { } void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) { - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", " << static_cast<const void*>(arrays) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGenVertexArraysOES(" << n << ", " + << static_cast<const void*>(arrays) << ")"); if (n < 0) { SetGLError(GL_INVALID_VALUE, "glGenVertexArraysOES", "n < 0"); return; } GPU_CLIENT_SINGLE_THREAD_CHECK(); - GetIdHandler(id_namespaces::kVertexArrays)-> - MakeIds(this, 0, n, arrays); + GetIdHandler(id_namespaces::kVertexArrays)->MakeIds(this, 0, n, arrays); GenVertexArraysOESHelper(n, arrays); helper_->GenVertexArraysOESImmediate(n, arrays); - helper_->CommandBufferHelper::Flush(); + if (share_group_->bind_generates_resource()) + helper_->CommandBufferHelper::Flush(); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << arrays[i]); @@ -1567,10 +1898,11 @@ void GLES2Implementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) { CheckGLError(); } -void GLES2Implementation::DeleteVertexArraysOES( - GLsizei n, const GLuint* arrays) { +void GLES2Implementation::DeleteVertexArraysOES(GLsizei n, + const GLuint* arrays) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n << ", " << static_cast<const void*>(arrays) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDeleteVertexArraysOES(" << n + << ", " << static_cast<const void*>(arrays) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < n; ++i) { GPU_CLIENT_LOG(" " << i << ": " << arrays[i]); @@ -1592,7 +1924,8 @@ void GLES2Implementation::DeleteVertexArraysOES( GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) { GPU_CLIENT_SINGLE_THREAD_CHECK(); TRACE_EVENT0("gpu", "GLES2Implementation::IsVertexArrayOES"); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsVertexArrayOES(" << array + << ")"); typedef cmds::IsVertexArrayOES::Result Result; Result* result = GetResultAs<Result*>(); if (!result) { @@ -1609,36 +1942,35 @@ GLboolean GLES2Implementation::IsVertexArrayOES(GLuint array) { void GLES2Implementation::BindVertexArrayOES(GLuint array) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindVertexArrayOES(" << array + << ")"); if (IsVertexArrayReservedId(array)) { - SetGLError( - GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id"); + SetGLError(GL_INVALID_OPERATION, "BindVertexArrayOES", "array reserved id"); return; } - if (BindVertexArrayHelper(array)) { + if (BindVertexArrayOESHelper(array)) { helper_->BindVertexArrayOES(array); } CheckGLError(); } -void GLES2Implementation::GetTranslatedShaderSourceANGLE( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { +void GLES2Implementation::GetTranslatedShaderSourceANGLE(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_VALIDATE_DESTINATION_OPTIONAL_INITALIZATION(GLsizei, length); - GPU_CLIENT_LOG("[" << GetLogPrefix() - << "] glGetTranslatedShaderSourceANGLE" << "(" - << shader << ", " - << bufsize << ", " - << static_cast<void*>(length) << ", " - << static_cast<void*>(source) << ")"); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetTranslatedShaderSourceANGLE" + << "(" << shader << ", " << bufsize << ", " + << static_cast<void*>(length) << ", " + << static_cast<void*>(source) << ")"); helper_->SetBucketSize(kResultBucketId, 0); helper_->GetTranslatedShaderSourceANGLE(shader, kResultBucketId); std::string str; GLsizei max_size = 0; if (GetBucketAsString(kResultBucketId, &str)) { if (bufsize > 0) { - max_size = - std::min(static_cast<size_t>(bufsize) - 1, str.size()); + max_size = std::min(static_cast<size_t>(bufsize) - 1, str.size()); memcpy(source, str.c_str(), max_size); source[max_size] = '\0'; GPU_CLIENT_LOG("------\n" << source << "\n------"); @@ -1649,18 +1981,22 @@ void GLES2Implementation::GetTranslatedShaderSourceANGLE( } CheckGLError(); } -void GLES2Implementation::TexImageIOSurface2DCHROMIUM( - GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, - GLuint plane) { +void GLES2Implementation::TexImageIOSurface2DCHROMIUM(GLenum target, + GLsizei width, + GLsizei height, + GLuint ioSurfaceId, + GLuint plane) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << width << ", " << height << ", " << ioSurfaceId << ", " << plane << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glTexImageIOSurface2DCHROMIUM(" + << GLES2Util::GetStringTextureBindTarget(target) << ", " + << width << ", " << height << ", " << ioSurfaceId << ", " + << plane << ")"); if (width < 0) { SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "width < 0"); return; } if (height < 0) { - SetGLError( - GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0"); + SetGLError(GL_INVALID_VALUE, "glTexImageIOSurface2DCHROMIUM", "height < 0"); return; } helper_->TexImageIOSurface2DCHROMIUM( @@ -1668,57 +2004,53 @@ void GLES2Implementation::TexImageIOSurface2DCHROMIUM( CheckGLError(); } -void GLES2Implementation::CopyTextureCHROMIUM( - GLenum target, GLenum source_id, GLenum dest_id, GLint level, - GLint internalformat, GLenum dest_type) { +void GLES2Implementation::CopyTextureCHROMIUM(GLenum target, + GLenum source_id, + GLenum dest_id, + GLint level, + GLint internalformat, + GLenum dest_type) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM(" << GLES2Util::GetStringEnum(target) << ", " << GLES2Util::GetStringEnum(source_id) << ", " << GLES2Util::GetStringEnum(dest_id) << ", " << level << ", " << internalformat << ", " << GLES2Util::GetStringPixelType(dest_type) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCopyTextureCHROMIUM(" + << GLES2Util::GetStringEnum(target) << ", " + << GLES2Util::GetStringEnum(source_id) << ", " + << GLES2Util::GetStringEnum(dest_id) << ", " << level + << ", " << internalformat << ", " + << GLES2Util::GetStringPixelType(dest_type) << ")"); helper_->CopyTextureCHROMIUM( target, source_id, dest_id, level, internalformat, dest_type); CheckGLError(); } -void GLES2Implementation::ProduceTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) { +void GLES2Implementation::BindTexImage2DCHROMIUM(GLenum target, GLint imageId) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glProduceTextureCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << static_cast<const void*>(mailbox) << ")"); // NOLINT - GPU_CLIENT_LOG("values: " << mailbox[0] << ", " << mailbox[1] << ", " << mailbox[2] << ", " << mailbox[3] << ", " << mailbox[4] << ", " << mailbox[5] << ", " << mailbox[6] << ", " << mailbox[7] << ", " << mailbox[8] << ", " << mailbox[9] << ", " << mailbox[10] << ", " << mailbox[11] << ", " << mailbox[12] << ", " << mailbox[13] << ", " << mailbox[14] << ", " << mailbox[15] << ", " << mailbox[16] << ", " << mailbox[17] << ", " << mailbox[18] << ", " << mailbox[19] << ", " << mailbox[20] << ", " << mailbox[21] << ", " << mailbox[22] << ", " << mailbox[23] << ", " << mailbox[24] << ", " << mailbox[25] << ", " << mailbox[26] << ", " << mailbox[27] << ", " << mailbox[28] << ", " << mailbox[29] << ", " << mailbox[30] << ", " << mailbox[31] << ", " << mailbox[32] << ", " << mailbox[33] << ", " << mailbox[34] << ", " << mailbox[35] << ", " << mailbox[36] << ", " << mailbox[37] << ", " << mailbox[38] << ", " << mailbox[39] << ", " << mailbox[40] << ", " << mailbox[41] << ", " << mailbox[42] << ", " << mailbox[43] << ", " << mailbox[44] << ", " << mailbox[45] << ", " << mailbox[46] << ", " << mailbox[47] << ", " << mailbox[48] << ", " << mailbox[49] << ", " << mailbox[50] << ", " << mailbox[51] << ", " << mailbox[52] << ", " << mailbox[53] << ", " << mailbox[54] << ", " << mailbox[55] << ", " << mailbox[56] << ", " << mailbox[57] << ", " << mailbox[58] << ", " << mailbox[59] << ", " << mailbox[60] << ", " << mailbox[61] << ", " << mailbox[62] << ", " << mailbox[63]); // NOLINT - helper_->ProduceTextureCHROMIUMImmediate(target, mailbox); - CheckGLError(); -} - -void GLES2Implementation::ConsumeTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glConsumeTextureCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << static_cast<const void*>(mailbox) << ")"); // NOLINT - GPU_CLIENT_LOG("values: " << mailbox[0] << ", " << mailbox[1] << ", " << mailbox[2] << ", " << mailbox[3] << ", " << mailbox[4] << ", " << mailbox[5] << ", " << mailbox[6] << ", " << mailbox[7] << ", " << mailbox[8] << ", " << mailbox[9] << ", " << mailbox[10] << ", " << mailbox[11] << ", " << mailbox[12] << ", " << mailbox[13] << ", " << mailbox[14] << ", " << mailbox[15] << ", " << mailbox[16] << ", " << mailbox[17] << ", " << mailbox[18] << ", " << mailbox[19] << ", " << mailbox[20] << ", " << mailbox[21] << ", " << mailbox[22] << ", " << mailbox[23] << ", " << mailbox[24] << ", " << mailbox[25] << ", " << mailbox[26] << ", " << mailbox[27] << ", " << mailbox[28] << ", " << mailbox[29] << ", " << mailbox[30] << ", " << mailbox[31] << ", " << mailbox[32] << ", " << mailbox[33] << ", " << mailbox[34] << ", " << mailbox[35] << ", " << mailbox[36] << ", " << mailbox[37] << ", " << mailbox[38] << ", " << mailbox[39] << ", " << mailbox[40] << ", " << mailbox[41] << ", " << mailbox[42] << ", " << mailbox[43] << ", " << mailbox[44] << ", " << mailbox[45] << ", " << mailbox[46] << ", " << mailbox[47] << ", " << mailbox[48] << ", " << mailbox[49] << ", " << mailbox[50] << ", " << mailbox[51] << ", " << mailbox[52] << ", " << mailbox[53] << ", " << mailbox[54] << ", " << mailbox[55] << ", " << mailbox[56] << ", " << mailbox[57] << ", " << mailbox[58] << ", " << mailbox[59] << ", " << mailbox[60] << ", " << mailbox[61] << ", " << mailbox[62] << ", " << mailbox[63]); // NOLINT - helper_->ConsumeTextureCHROMIUMImmediate(target, mailbox); - CheckGLError(); -} - -void GLES2Implementation::BindTexImage2DCHROMIUM( - GLenum target, GLint imageId) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << imageId << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBindTexImage2DCHROMIUM(" + << GLES2Util::GetStringTextureBindTarget(target) << ", " + << imageId << ")"); helper_->BindTexImage2DCHROMIUM(target, imageId); CheckGLError(); } -void GLES2Implementation::ReleaseTexImage2DCHROMIUM( - GLenum target, GLint imageId) { +void GLES2Implementation::ReleaseTexImage2DCHROMIUM(GLenum target, + GLint imageId) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << imageId << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glReleaseTexImage2DCHROMIUM(" + << GLES2Util::GetStringTextureBindTarget(target) << ", " + << imageId << ")"); helper_->ReleaseTexImage2DCHROMIUM(target, imageId); CheckGLError(); } -void GLES2Implementation::DiscardFramebufferEXT( - GLenum target, GLsizei count, const GLenum* attachments) { +void GLES2Implementation::DiscardFramebufferEXT(GLenum target, + GLsizei count, + const GLenum* attachments) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT(" << GLES2Util::GetStringEnum(target) << ", " << count << ", " << static_cast<const void*>(attachments) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardFramebufferEXT(" + << GLES2Util::GetStringEnum(target) << ", " << count + << ", " << static_cast<const void*>(attachments) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]); + GPU_CLIENT_LOG(" " << i << ": " << attachments[0 + i * 1]); } }); if (count < 0) { @@ -1731,24 +2063,28 @@ void GLES2Implementation::DiscardFramebufferEXT( void GLES2Implementation::LoseContextCHROMIUM(GLenum current, GLenum other) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM(" << GLES2Util::GetStringEnum(current) << ", " << GLES2Util::GetStringEnum(other) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glLoseContextCHROMIUM(" + << GLES2Util::GetStringResetStatus(current) << ", " + << GLES2Util::GetStringResetStatus(other) << ")"); helper_->LoseContextCHROMIUM(current, other); CheckGLError(); } void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM(" << sync_point << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSyncPointCHROMIUM(" + << sync_point << ")"); helper_->WaitSyncPointCHROMIUM(sync_point); CheckGLError(); } void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", " << static_cast<const void*>(bufs) << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDrawBuffersEXT(" << count << ", " + << static_cast<const void*>(bufs) << ")"); GPU_CLIENT_LOG_CODE_BLOCK({ for (GLsizei i = 0; i < count; ++i) { - GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]); + GPU_CLIENT_LOG(" " << i << ": " << bufs[0 + i * 1]); } }); if (count < 0) { @@ -1761,10 +2097,43 @@ void GLES2Implementation::DrawBuffersEXT(GLsizei count, const GLenum* bufs) { void GLES2Implementation::DiscardBackbufferCHROMIUM() { GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM(" << ")"); // NOLINT + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDiscardBackbufferCHROMIUM(" + << ")"); helper_->DiscardBackbufferCHROMIUM(); CheckGLError(); } -#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_ +void GLES2Implementation::ScheduleOverlayPlaneCHROMIUM( + GLint plane_z_order, + GLenum plane_transform, + GLuint overlay_texture_id, + GLint bounds_x, + GLint bounds_y, + GLint bounds_width, + GLint bounds_height, + GLfloat uv_x, + GLfloat uv_y, + GLfloat uv_width, + GLfloat uv_height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG( + "[" << GetLogPrefix() << "] glScheduleOverlayPlaneCHROMIUM(" + << plane_z_order << ", " << GLES2Util::GetStringEnum(plane_transform) + << ", " << overlay_texture_id << ", " << bounds_x << ", " << bounds_y + << ", " << bounds_width << ", " << bounds_height << ", " << uv_x + << ", " << uv_y << ", " << uv_width << ", " << uv_height << ")"); + helper_->ScheduleOverlayPlaneCHROMIUM(plane_z_order, + plane_transform, + overlay_texture_id, + bounds_x, + bounds_y, + bounds_width, + bounds_height, + uv_x, + uv_y, + uv_width, + uv_height); + CheckGLError(); +} +#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_AUTOGEN_H_ diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc b/chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc index e6e0861d188..a318ab8f33f 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc +++ b/chromium/gpu/command_buffer/client/gles2_implementation_unittest.cc @@ -6,6 +6,8 @@ #include "gpu/command_buffer/client/gles2_implementation.h" +#include <limits> + #include <GLES2/gl2ext.h> #include <GLES2/gl2extchromium.h> #include "base/compiler_specific.h" @@ -167,11 +169,11 @@ class MockTransferBuffer : public TransferBufferInterface { static const int kNumBuffers = 2; uint8* actual_buffer() const { - return static_cast<uint8*>(buffers_[actual_buffer_index_].ptr); + return static_cast<uint8*>(buffers_[actual_buffer_index_]->memory()); } uint8* expected_buffer() const { - return static_cast<uint8*>(buffers_[expected_buffer_index_].ptr); + return static_cast<uint8*>(buffers_[expected_buffer_index_]->memory()); } uint32 AllocateExpectedTransferBuffer(size_t size) { @@ -214,7 +216,7 @@ class MockTransferBuffer : public TransferBufferInterface { size_t result_size_; uint32 alignment_; int buffer_ids_[kNumBuffers]; - gpu::Buffer buffers_[kNumBuffers]; + scoped_refptr<Buffer> buffers_[kNumBuffers]; int actual_buffer_index_; int expected_buffer_index_; void* last_alloc_; @@ -297,8 +299,65 @@ void MockTransferBuffer::FreePendingToken(void* p, unsigned int /* token */) { last_alloc_ = NULL; } +// API wrapper for Buffers. +class GenBuffersAPI { + public: + static void Gen(GLES2Implementation* gl_impl, GLsizei n, GLuint* ids) { + gl_impl->GenBuffers(n, ids); + } + + static void Delete(GLES2Implementation* gl_impl, + GLsizei n, + const GLuint* ids) { + gl_impl->DeleteBuffers(n, ids); + } +}; + +// API wrapper for Framebuffers. +class GenFramebuffersAPI { + public: + static void Gen(GLES2Implementation* gl_impl, GLsizei n, GLuint* ids) { + gl_impl->GenFramebuffers(n, ids); + } + + static void Delete(GLES2Implementation* gl_impl, + GLsizei n, + const GLuint* ids) { + gl_impl->DeleteFramebuffers(n, ids); + } +}; + +// API wrapper for Renderbuffers. +class GenRenderbuffersAPI { + public: + static void Gen(GLES2Implementation* gl_impl, GLsizei n, GLuint* ids) { + gl_impl->GenRenderbuffers(n, ids); + } + + static void Delete(GLES2Implementation* gl_impl, + GLsizei n, + const GLuint* ids) { + gl_impl->DeleteRenderbuffers(n, ids); + } +}; + +// API wrapper for Textures. +class GenTexturesAPI { + public: + static void Gen(GLES2Implementation* gl_impl, GLsizei n, GLuint* ids) { + gl_impl->GenTextures(n, ids); + } + + static void Delete(GLES2Implementation* gl_impl, + GLsizei n, + const GLuint* ids) { + gl_impl->DeleteTextures(n, ids); + } +}; + class GLES2ImplementationTest : public testing::Test { protected: + static const int kNumTestContexts = 2; static const uint8 kInitialValue = 0xBD; static const int32 kNumCommandEntries = 500; static const int32 kCommandBufferSizeBytes = @@ -319,7 +378,7 @@ class GLES2ImplementationTest : public testing::Test { static const GLint kNumShaderBinaryFormats = 0; static const GLuint kStartId = 1024; static const GLuint kBuffersStartId = - GLES2Implementation::kClientSideArrayId + 2; + GLES2Implementation::kClientSideArrayId + 2 * kNumTestContexts; static const GLuint kFramebuffersStartId = 1; static const GLuint kProgramsAndShadersStartId = 1; static const GLuint kRenderbuffersStartId = 1; @@ -329,18 +388,130 @@ class GLES2ImplementationTest : public testing::Test { typedef MockTransferBuffer::ExpectedMemoryInfo ExpectedMemoryInfo; - GLES2ImplementationTest() - : commands_(NULL), - token_(0) { - } + class TestContext { + public: + TestContext() : commands_(NULL), token_(0) {} + + bool Initialize(ShareGroup* share_group, + bool bind_generates_resource, + bool lose_context_when_out_of_memory) { + command_buffer_.reset(new StrictMock<MockClientCommandBuffer>()); + if (!command_buffer_->Initialize()) + return false; + + transfer_buffer_.reset( + new MockTransferBuffer(command_buffer_.get(), + kTransferBufferSize, + GLES2Implementation::kStartingOffset, + GLES2Implementation::kAlignment)); + + helper_.reset(new GLES2CmdHelper(command_buffer())); + helper_->Initialize(kCommandBufferSizeBytes); + + gpu_control_.reset(new StrictMock<MockClientGpuControl>()); + EXPECT_CALL(*gpu_control_, GetCapabilities()) + .WillOnce(testing::Return(Capabilities())); + + GLES2Implementation::GLStaticState state; + GLES2Implementation::GLStaticState::IntState& int_state = state.int_state; + int_state.max_combined_texture_image_units = + kMaxCombinedTextureImageUnits; + int_state.max_cube_map_texture_size = kMaxCubeMapTextureSize; + int_state.max_fragment_uniform_vectors = kMaxFragmentUniformVectors; + int_state.max_renderbuffer_size = kMaxRenderbufferSize; + int_state.max_texture_image_units = kMaxTextureImageUnits; + int_state.max_texture_size = kMaxTextureSize; + int_state.max_varying_vectors = kMaxVaryingVectors; + int_state.max_vertex_attribs = kMaxVertexAttribs; + int_state.max_vertex_texture_image_units = kMaxVertexTextureImageUnits; + int_state.max_vertex_uniform_vectors = kMaxVertexUniformVectors; + int_state.num_compressed_texture_formats = kNumCompressedTextureFormats; + int_state.num_shader_binary_formats = kNumShaderBinaryFormats; + int_state.bind_generates_resource_chromium = + bind_generates_resource ? 1 : 0; + + // This just happens to work for now because IntState has 1 GLint per + // state. + // If IntState gets more complicated this code will need to get more + // complicated. + ExpectedMemoryInfo mem1 = transfer_buffer_->GetExpectedMemory( + sizeof(GLES2Implementation::GLStaticState::IntState) * 2 + + sizeof(cmds::GetShaderPrecisionFormat::Result) * 12); + + { + InSequence sequence; + + EXPECT_CALL(*command_buffer_, OnFlush()) + .WillOnce(SetMemory(mem1.ptr + sizeof(int_state), int_state)) + .RetiresOnSaturation(); + GetNextToken(); // eat the token that starting up will use. + + gl_.reset(new GLES2Implementation(helper_.get(), + share_group, + transfer_buffer_.get(), + bind_generates_resource, + lose_context_when_out_of_memory, + gpu_control_.get())); + + if (!gl_->Initialize(kTransferBufferSize, + kTransferBufferSize, + kTransferBufferSize, + GLES2Implementation::kNoLimit)) + return false; + } + + EXPECT_CALL(*command_buffer_, OnFlush()).Times(1).RetiresOnSaturation(); + helper_->CommandBufferHelper::Finish(); + ::testing::Mock::VerifyAndClearExpectations(gl_.get()); + + scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); + commands_ = static_cast<CommandBufferEntry*>(ring_buffer->memory()) + + command_buffer()->GetLastState().put_offset; + ClearCommands(); + EXPECT_TRUE(transfer_buffer_->InSync()); + + ::testing::Mock::VerifyAndClearExpectations(command_buffer()); + return true; + } + + void TearDown() { + Mock::VerifyAndClear(gl_.get()); + EXPECT_CALL(*command_buffer(), OnFlush()).Times(AnyNumber()); + // For command buffer. + EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_)) + .Times(AtLeast(1)); + gl_.reset(); + } + + MockClientCommandBuffer* command_buffer() const { + return command_buffer_.get(); + } + + int GetNextToken() { return ++token_; } + + void ClearCommands() { + scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); + memset(ring_buffer->memory(), kInitialValue, ring_buffer->size()); + } + + scoped_ptr<MockClientCommandBuffer> command_buffer_; + scoped_ptr<MockClientGpuControl> gpu_control_; + scoped_ptr<GLES2CmdHelper> helper_; + scoped_ptr<MockTransferBuffer> transfer_buffer_; + scoped_ptr<GLES2Implementation> gl_; + CommandBufferEntry* commands_; + int token_; + }; + + GLES2ImplementationTest() : commands_(NULL) {} virtual void SetUp() OVERRIDE; virtual void TearDown() OVERRIDE; bool NoCommandsWritten() { - Buffer ring_buffer = helper_->get_ring_buffer(); - const uint8* cmds = reinterpret_cast<const uint8*>(ring_buffer.ptr); - const uint8* end = cmds + ring_buffer.size; + scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); + const uint8* cmds = reinterpret_cast<const uint8*>(ring_buffer->memory()); + const uint8* end = cmds + ring_buffer->size(); for (; cmds < end; ++cmds) { if (*cmds != kInitialValue) { return false; @@ -353,97 +524,51 @@ class GLES2ImplementationTest : public testing::Test { return gl_->query_tracker_->GetQuery(id); } - void Initialize(bool bind_generates_resource) { - command_buffer_.reset(new StrictMock<MockClientCommandBuffer>()); - ASSERT_TRUE(command_buffer_->Initialize()); - - transfer_buffer_.reset(new MockTransferBuffer( - command_buffer(), - kTransferBufferSize, - GLES2Implementation::kStartingOffset, - GLES2Implementation::kAlignment)); - - helper_.reset(new GLES2CmdHelper(command_buffer())); - helper_->Initialize(kCommandBufferSizeBytes); - - gpu_control_.reset(new StrictMock<MockClientGpuControl>()); - EXPECT_CALL(*gpu_control_, GetCapabilities()) - .WillOnce(testing::Return(Capabilities())); - - GLES2Implementation::GLStaticState state; - GLES2Implementation::GLStaticState::IntState& int_state = state.int_state; - int_state.max_combined_texture_image_units = kMaxCombinedTextureImageUnits; - int_state.max_cube_map_texture_size = kMaxCubeMapTextureSize; - int_state.max_fragment_uniform_vectors = kMaxFragmentUniformVectors; - int_state.max_renderbuffer_size = kMaxRenderbufferSize; - int_state.max_texture_image_units = kMaxTextureImageUnits; - int_state.max_texture_size = kMaxTextureSize; - int_state.max_varying_vectors = kMaxVaryingVectors; - int_state.max_vertex_attribs = kMaxVertexAttribs; - int_state.max_vertex_texture_image_units = kMaxVertexTextureImageUnits; - int_state.max_vertex_uniform_vectors = kMaxVertexUniformVectors; - int_state.num_compressed_texture_formats = kNumCompressedTextureFormats; - int_state.num_shader_binary_formats = kNumShaderBinaryFormats; - - // This just happens to work for now because IntState has 1 GLint per state. - // If IntState gets more complicated this code will need to get more - // complicated. - ExpectedMemoryInfo mem1 = GetExpectedMemory( - sizeof(GLES2Implementation::GLStaticState::IntState) * 2 + - sizeof(cmds::GetShaderPrecisionFormat::Result) * 12); - - { - InSequence sequence; - - EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(mem1.ptr + sizeof(int_state), int_state)) - .RetiresOnSaturation(); - GetNextToken(); // eat the token that starting up will use. - - gl_.reset(new GLES2Implementation( - helper_.get(), - NULL, - transfer_buffer_.get(), - bind_generates_resource, - false /* free_everything_when_invisible */, - gpu_control_.get())); - ASSERT_TRUE(gl_->Initialize( - kTransferBufferSize, - kTransferBufferSize, - kTransferBufferSize, - GLES2Implementation::kNoLimit)); - } + struct ContextInitOptions { + ContextInitOptions() + : bind_generates_resource_client(true), + bind_generates_resource_service(true), + lose_context_when_out_of_memory(false) {} - EXPECT_CALL(*command_buffer(), OnFlush()) - .Times(1) - .RetiresOnSaturation(); - helper_->CommandBufferHelper::Finish(); - ::testing::Mock::VerifyAndClearExpectations(gl_.get()); + bool bind_generates_resource_client; + bool bind_generates_resource_service; + bool lose_context_when_out_of_memory; + }; - Buffer ring_buffer = helper_->get_ring_buffer(); - commands_ = static_cast<CommandBufferEntry*>(ring_buffer.ptr) + - command_buffer()->GetState().put_offset; - ClearCommands(); - EXPECT_TRUE(transfer_buffer_->InSync()); + bool Initialize(const ContextInitOptions& init_options) { + bool success = true; + share_group_ = new ShareGroup(init_options.bind_generates_resource_service); - ::testing::Mock::VerifyAndClearExpectations(command_buffer()); + for (int i = 0; i < kNumTestContexts; i++) { + if (!test_contexts_[i].Initialize( + share_group_.get(), + init_options.bind_generates_resource_client, + init_options.lose_context_when_out_of_memory)) + success = false; + } + + // Default to test context 0. + gpu_control_ = test_contexts_[0].gpu_control_.get(); + helper_ = test_contexts_[0].helper_.get(); + transfer_buffer_ = test_contexts_[0].transfer_buffer_.get(); + gl_ = test_contexts_[0].gl_.get(); + commands_ = test_contexts_[0].commands_; + return success; } MockClientCommandBuffer* command_buffer() const { - return command_buffer_.get(); + return test_contexts_[0].command_buffer_.get(); } - int GetNextToken() { - return ++token_; - } + int GetNextToken() { return test_contexts_[0].GetNextToken(); } const void* GetPut() { return helper_->GetSpace(0); } void ClearCommands() { - Buffer ring_buffer = helper_->get_ring_buffer(); - memset(ring_buffer.ptr, kInitialValue, ring_buffer.size); + scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); + memset(ring_buffer->memory(), kInitialValue, ring_buffer->size()); } size_t MaxTransferBufferSize() { @@ -473,40 +598,133 @@ class GLES2ImplementationTest : public testing::Test { return gl_->GetError(); } + const std::string& GetLastError() { + return gl_->GetLastError(); + } + bool GetBucketContents(uint32 bucket_id, std::vector<int8>* data) { return gl_->GetBucketContents(bucket_id, data); } - Sequence sequence_; - scoped_ptr<MockClientCommandBuffer> command_buffer_; - scoped_ptr<MockClientGpuControl> gpu_control_; - scoped_ptr<GLES2CmdHelper> helper_; - scoped_ptr<MockTransferBuffer> transfer_buffer_; - scoped_ptr<GLES2Implementation> gl_; + TestContext test_contexts_[kNumTestContexts]; + + scoped_refptr<ShareGroup> share_group_; + MockClientGpuControl* gpu_control_; + GLES2CmdHelper* helper_; + MockTransferBuffer* transfer_buffer_; + GLES2Implementation* gl_; CommandBufferEntry* commands_; - int token_; }; void GLES2ImplementationTest::SetUp() { - Initialize(true); + ContextInitOptions init_options; + ASSERT_TRUE(Initialize(init_options)); } void GLES2ImplementationTest::TearDown() { - Mock::VerifyAndClear(gl_.get()); - EXPECT_CALL(*command_buffer(), OnFlush()).Times(AnyNumber()); - // For command buffer. - EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_)) - .Times(AtLeast(1)); - gl_.reset(); + for (int i = 0; i < kNumTestContexts; i++) + test_contexts_[i].TearDown(); } +class GLES2ImplementationManualInitTest : public GLES2ImplementationTest { + protected: + virtual void SetUp() OVERRIDE {} +}; + class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest { protected: virtual void SetUp() OVERRIDE; + + template <class ResApi> + void FlushGenerationTest() { + GLuint id1, id2, id3; + + // Generate valid id. + ResApi::Gen(gl_, 1, &id1); + EXPECT_NE(id1, 0u); + + // Delete id1 and generate id2. id1 should not be reused. + ResApi::Delete(gl_, 1, &id1); + ResApi::Gen(gl_, 1, &id2); + EXPECT_NE(id2, 0u); + EXPECT_NE(id2, id1); + + // Expect id1 reuse after Flush. + gl_->Flush(); + ResApi::Gen(gl_, 1, &id3); + EXPECT_EQ(id3, id1); + } + + // Ids should not be reused unless the |Deleting| context does a Flush() + // AND triggers a lazy release after that. + template <class ResApi> + void CrossContextGenerationTest() { + GLES2Implementation* gl1 = test_contexts_[0].gl_.get(); + GLES2Implementation* gl2 = test_contexts_[1].gl_.get(); + GLuint id1, id2, id3; + + // Delete, no flush on context 1. No reuse. + ResApi::Gen(gl1, 1, &id1); + ResApi::Delete(gl1, 1, &id1); + ResApi::Gen(gl1, 1, &id2); + EXPECT_NE(id1, id2); + + // Flush context 2. Still no reuse. + gl2->Flush(); + ResApi::Gen(gl2, 1, &id3); + EXPECT_NE(id1, id3); + EXPECT_NE(id2, id3); + + // Flush on context 1, but no lazy release. Still no reuse. + gl1->Flush(); + ResApi::Gen(gl2, 1, &id3); + EXPECT_NE(id1, id3); + + // Lazy release triggered by another Delete. Should reuse id1. + ResApi::Delete(gl1, 1, &id2); + ResApi::Gen(gl2, 1, &id3); + EXPECT_EQ(id1, id3); + } + + // Same as CrossContextGenerationTest(), but triggers an Auto Flush on + // the Delete(). Tests an edge case regression. + template <class ResApi> + void CrossContextGenerationAutoFlushTest() { + GLES2Implementation* gl1 = test_contexts_[0].gl_.get(); + GLES2Implementation* gl2 = test_contexts_[1].gl_.get(); + GLuint id1, id2, id3; + + // Delete, no flush on context 1. No reuse. + // By half filling the buffer, an internal flush is forced on the Delete(). + ResApi::Gen(gl1, 1, &id1); + gl1->helper()->Noop(kNumCommandEntries / 2); + ResApi::Delete(gl1, 1, &id1); + ResApi::Gen(gl1, 1, &id2); + EXPECT_NE(id1, id2); + + // Flush context 2. Still no reuse. + gl2->Flush(); + ResApi::Gen(gl2, 1, &id3); + EXPECT_NE(id1, id3); + EXPECT_NE(id2, id3); + + // Flush on context 1, but no lazy release. Still no reuse. + gl1->Flush(); + ResApi::Gen(gl2, 1, &id3); + EXPECT_NE(id1, id3); + + // Lazy release triggered by another Delete. Should reuse id1. + ResApi::Delete(gl1, 1, &id2); + ResApi::Gen(gl2, 1, &id3); + EXPECT_EQ(id1, id3); + } }; void GLES2ImplementationStrictSharedTest::SetUp() { - Initialize(false); + ContextInitOptions init_options; + init_options.bind_generates_resource_client = false; + init_options.bind_generates_resource_service = false; + ASSERT_TRUE(Initialize(init_options)); } // GCC requires these declarations, but MSVC requires they not be present @@ -2091,7 +2309,7 @@ TEST_F(GLES2ImplementationTest, TexImage2D) { Cmds expected; expected.tex_image_2d.Init( - kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, + kTarget, kLevel, kFormat, kWidth, kHeight, kFormat, kType, mem1.id, mem1.offset); expected.set_token.Init(GetNextToken()); gl_->TexImage2D( @@ -2108,7 +2326,7 @@ TEST_F(GLES2ImplementationTest, TexImage2D) { ExpectedMemoryInfo mem2 = GetExpectedMemory(sizeof(pixels)); Cmds2 expected2; expected2.tex_image_2d.Init( - kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, + kTarget, kLevel, kFormat, kWidth, kHeight, kFormat, kType, mem2.id, mem2.offset); expected2.set_token.Init(GetNextToken()); const void* commands2 = GetPut(); @@ -2163,7 +2381,7 @@ TEST_F(GLES2ImplementationTest, TexImage2D2Writes) { Cmds expected; expected.tex_image_2d.Init( - kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, + kTarget, kLevel, kFormat, kWidth, kHeight, kFormat, kType, 0, 0); expected.tex_sub_image_2d1.Init( kTarget, kLevel, 0, 0, kWidth, kHeight / 2, kFormat, kType, @@ -2196,7 +2414,7 @@ TEST_F(GLES2ImplementationTest, TexImage2D2Writes) { ExpectedMemoryInfo mem3 = GetExpectedMemory(half_size); ExpectedMemoryInfo mem4 = GetExpectedMemory(half_size); expected.tex_image_2d.Init( - kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, + kTarget, kLevel, kFormat, kWidth, kHeight, kFormat, kType, 0, 0); expected.tex_sub_image_2d1.Init( kTarget, kLevel, 0, kHeight / 2, kWidth, kHeight / 2, kFormat, kType, @@ -2260,7 +2478,7 @@ TEST_F(GLES2ImplementationTest, TexSubImage2DFlipY) { Cmds expected; expected.pixel_store_i1.Init(GL_UNPACK_ALIGNMENT, kPixelStoreUnpackAlignment); expected.tex_image_2d.Init( - kTarget, kLevel, kFormat, kTextureWidth, kTextureHeight, kBorder, kFormat, + kTarget, kLevel, kFormat, kTextureWidth, kTextureHeight, kFormat, kType, 0, 0); expected.pixel_store_i2.Init(GL_UNPACK_FLIP_Y_CHROMIUM, GL_TRUE); expected.tex_sub_image_2d1.Init(kTarget, kLevel, kSubImageXOffset, @@ -2355,9 +2573,9 @@ TEST_F(GLES2ImplementationTest, SubImageUnpack) { const void* commands = GetPut(); gl_->PixelStorei(GL_UNPACK_ALIGNMENT, alignment); - gl_->PixelStorei(GL_UNPACK_ROW_LENGTH, kSrcWidth); - gl_->PixelStorei(GL_UNPACK_SKIP_PIXELS, kSrcSubImageX0); - gl_->PixelStorei(GL_UNPACK_SKIP_ROWS, kSrcSubImageY0); + gl_->PixelStorei(GL_UNPACK_ROW_LENGTH_EXT, kSrcWidth); + gl_->PixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, kSrcSubImageX0); + gl_->PixelStorei(GL_UNPACK_SKIP_ROWS_EXT, kSrcSubImageY0); gl_->PixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); if (sub) { gl_->TexImage2D( @@ -2372,7 +2590,7 @@ TEST_F(GLES2ImplementationTest, SubImageUnpack) { texSubImageExpected.pixel_store_i2.Init( GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); texSubImageExpected.tex_image_2d.Init( - GL_TEXTURE_2D, kLevel, kFormat, kTexWidth, kTexHeight, kBorder, + GL_TEXTURE_2D, kLevel, kFormat, kTexWidth, kTexHeight, kFormat, kType, 0, 0); texSubImageExpected.tex_sub_image_2d.Init( GL_TEXTURE_2D, kLevel, kTexSubXOffset, kTexSubYOffset, @@ -2390,7 +2608,7 @@ TEST_F(GLES2ImplementationTest, SubImageUnpack) { GL_UNPACK_FLIP_Y_CHROMIUM, flip_y); texImageExpected.tex_image_2d.Init( GL_TEXTURE_2D, kLevel, kFormat, kSrcSubImageWidth, - kSrcSubImageHeight, kBorder, kFormat, kType, mem.id, mem.offset); + kSrcSubImageHeight, kFormat, kType, mem.id, mem.offset); EXPECT_EQ(0, memcmp( &texImageExpected, commands, sizeof(texImageExpected))); } @@ -2413,6 +2631,93 @@ TEST_F(GLES2ImplementationTest, SubImageUnpack) { } } +// Test texture related calls with invalid arguments. +TEST_F(GLES2ImplementationTest, TextureInvalidArguments) { + struct Cmds { + cmds::TexImage2D tex_image_2d; + cmd::SetToken set_token; + }; + const GLenum kTarget = GL_TEXTURE_2D; + const GLint kLevel = 0; + const GLenum kFormat = GL_RGB; + const GLsizei kWidth = 3; + const GLsizei kHeight = 4; + const GLint kBorder = 0; + const GLint kInvalidBorder = 1; + const GLenum kType = GL_UNSIGNED_BYTE; + const GLint kPixelStoreUnpackAlignment = 4; + static uint8 pixels[] = { + 11, 12, 13, 13, 14, 15, 15, 16, 17, 101, 102, 103, + 21, 22, 23, 23, 24, 25, 25, 26, 27, 201, 202, 203, + 31, 32, 33, 33, 34, 35, 35, 36, 37, 123, 124, 125, + 41, 42, 43, 43, 44, 45, 45, 46, 47, + }; + + // Verify that something works. + + ExpectedMemoryInfo mem1 = GetExpectedMemory(sizeof(pixels)); + + Cmds expected; + expected.tex_image_2d.Init( + kTarget, kLevel, kFormat, kWidth, kHeight, kFormat, kType, + mem1.id, mem1.offset); + expected.set_token.Init(GetNextToken()); + gl_->TexImage2D( + kTarget, kLevel, kFormat, kWidth, kHeight, kBorder, kFormat, kType, + pixels); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); + EXPECT_TRUE(CheckRect( + kWidth, kHeight, kFormat, kType, kPixelStoreUnpackAlignment, false, + pixels, mem1.ptr)); + + ClearCommands(); + + // Use invalid border. + gl_->TexImage2D( + kTarget, kLevel, kFormat, kWidth, kHeight, kInvalidBorder, kFormat, kType, + pixels); + + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + + ClearCommands(); + + gl_->AsyncTexImage2DCHROMIUM( + kTarget, kLevel, kFormat, kWidth, kHeight, kInvalidBorder, kFormat, kType, + NULL); + + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); + + ClearCommands(); + + // Checking for CompressedTexImage2D argument validation is a bit tricky due + // to (runtime-detected) compression formats. Try to infer the error with an + // aux check. + const GLenum kCompressedFormat = GL_ETC1_RGB8_OES; + gl_->CompressedTexImage2D( + kTarget, kLevel, kCompressedFormat, kWidth, kHeight, kBorder, + arraysize(pixels), pixels); + + // In the above, kCompressedFormat and arraysize(pixels) are possibly wrong + // values. First ensure that these do not cause failures at the client. If + // this check ever fails, it probably means that client checks more than at + // the time of writing of this test. In this case, more code needs to be + // written for this test. + EXPECT_FALSE(NoCommandsWritten()); + + ClearCommands(); + + // Changing border to invalid border should make the call fail at the client + // checks. + gl_->CompressedTexImage2D( + kTarget, kLevel, kCompressedFormat, kWidth, kHeight, kInvalidBorder, + arraysize(pixels), pixels); + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); +} + + // Binds can not be cached with bind_generates_resource = false because // our id might not be valid. More specifically if you bind on contextA then // delete on contextB the resource is still bound on contextA but GetInterger @@ -2444,32 +2749,56 @@ TEST_F(GLES2ImplementationStrictSharedTest, BindsNotCached) { } } -TEST_F(GLES2ImplementationTest, CreateStreamTextureCHROMIUM) { - const GLuint kTextureId = 123; - const GLuint kResult = 456; - - struct Cmds { - cmds::CreateStreamTextureCHROMIUM create_stream; - }; - - ExpectedMemoryInfo result1 = - GetExpectedResultMemory( - sizeof(cmds::CreateStreamTextureCHROMIUM::Result)); - ExpectedMemoryInfo result2 = - GetExpectedResultMemory(sizeof(cmds::GetError::Result)); - - Cmds expected; - expected.create_stream.Init(kTextureId, result1.id, result1.offset); +// glGen* Ids must not be reused until glDelete* commands have been +// flushed by glFlush. +TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestBuffers) { + FlushGenerationTest<GenBuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestFramebuffers) { + FlushGenerationTest<GenFramebuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestRenderbuffers) { + FlushGenerationTest<GenRenderbuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, FlushGenerationTestTextures) { + FlushGenerationTest<GenTexturesAPI>(); +} - EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, kResult)) - .WillOnce(SetMemory(result2.ptr, GLuint(GL_NO_ERROR))) - .RetiresOnSaturation(); +// glGen* Ids must not be reused cross-context until glDelete* commands are +// flushed by glFlush, and the Ids are lazily freed after. +TEST_F(GLES2ImplementationStrictSharedTest, CrossContextGenerationTestBuffers) { + CrossContextGenerationTest<GenBuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, + CrossContextGenerationTestFramebuffers) { + CrossContextGenerationTest<GenFramebuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, + CrossContextGenerationTestRenderbuffers) { + CrossContextGenerationTest<GenRenderbuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, + CrossContextGenerationTestTextures) { + CrossContextGenerationTest<GenTexturesAPI>(); +} - GLuint handle = gl_->CreateStreamTextureCHROMIUM(kTextureId); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); - EXPECT_EQ(handle, kResult); - EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError()); +// Test Delete which causes auto flush. Tests a regression case that occurred +// in testing. +TEST_F(GLES2ImplementationStrictSharedTest, + CrossContextGenerationAutoFlushTestBuffers) { + CrossContextGenerationAutoFlushTest<GenBuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, + CrossContextGenerationAutoFlushTestFramebuffers) { + CrossContextGenerationAutoFlushTest<GenFramebuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, + CrossContextGenerationAutoFlushTestRenderbuffers) { + CrossContextGenerationAutoFlushTest<GenRenderbuffersAPI>(); +} +TEST_F(GLES2ImplementationStrictSharedTest, + CrossContextGenerationAutoFlushTestTextures) { + CrossContextGenerationAutoFlushTest<GenTexturesAPI>(); } TEST_F(GLES2ImplementationTest, GetString) { @@ -2480,7 +2809,8 @@ TEST_F(GLES2ImplementationTest, GetString) { const char* expected_str = "foobar " "GL_CHROMIUM_flipy " - "GL_EXT_unpack_subimage"; + "GL_EXT_unpack_subimage " + "GL_CHROMIUM_map_sub"; const char kBad = 0x12; struct Cmds { cmd::SetBucketSize set_bucket_size1; @@ -2668,9 +2998,6 @@ TEST_F(GLES2ImplementationTest, BeginEndQueryEXT) { EXPECT_TRUE(NoCommandsWritten()); EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); - // Test BeginQueryEXT fails if id not GENed. - // TODO(gman): - // Test BeginQueryEXT inserts command. struct BeginCmds { cmds::BeginQueryEXT begin_query; @@ -2724,7 +3051,7 @@ TEST_F(GLES2ImplementationTest, BeginEndQueryEXT) { EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); // Test 2nd Begin/End increments count. - uint32 old_submit_count = query->submit_count(); + base::subtle::Atomic32 old_submit_count = query->submit_count(); gl_->BeginQueryEXT(GL_ANY_SAMPLES_PASSED_EXT, id1); EXPECT_NE(old_submit_count, query->submit_count()); expected_end_cmds.end_query.Init( @@ -2758,7 +3085,6 @@ TEST_F(GLES2ImplementationTest, BeginEndQueryEXT) { // Test GetQueryObjectuivEXT CheckResultsAvailable ClearCommands(); gl_->GetQueryObjectuivEXT(id1, GL_QUERY_RESULT_AVAILABLE_EXT, &available); - EXPECT_TRUE(NoCommandsWritten()); EXPECT_EQ(0u, available); } @@ -2873,6 +3199,212 @@ TEST_F(GLES2ImplementationTest, Enable) { EXPECT_TRUE(NoCommandsWritten()); } +TEST_F(GLES2ImplementationTest, ConsumeTextureCHROMIUM) { + struct Cmds { + cmds::ConsumeTextureCHROMIUMImmediate cmd; + GLbyte data[64]; + }; + + Mailbox mailbox = Mailbox::Generate(); + Cmds expected; + expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); + gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, CreateAndConsumeTextureCHROMIUM) { + struct Cmds { + cmds::CreateAndConsumeTextureCHROMIUMImmediate cmd; + GLbyte data[64]; + }; + + Mailbox mailbox = Mailbox::Generate(); + Cmds expected; + expected.cmd.Init(GL_TEXTURE_2D, kTexturesStartId, mailbox.name); + GLuint id = gl_->CreateAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); + EXPECT_EQ(kTexturesStartId, id); +} + +TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) { + struct Cmds { + cmds::ProduceTextureCHROMIUMImmediate cmd; + GLbyte data[64]; + }; + + Mailbox mailbox = Mailbox::Generate(); + Cmds expected; + expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); + gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, ProduceTextureDirectCHROMIUM) { + struct Cmds { + cmds::ProduceTextureDirectCHROMIUMImmediate cmd; + GLbyte data[64]; + }; + + Mailbox mailbox = Mailbox::Generate(); + Cmds expected; + expected.cmd.Init(kTexturesStartId, GL_TEXTURE_2D, mailbox.name); + gl_->ProduceTextureDirectCHROMIUM( + kTexturesStartId, GL_TEXTURE_2D, mailbox.name); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, LimitSizeAndOffsetTo32Bit) { + GLsizeiptr size; + GLintptr offset; + if (sizeof(size) <= 4 || sizeof(offset) <= 4) + return; + // The below two casts should be no-op, as we return early if + // it's 32-bit system. + int64 value64 = 0x100000000; + size = static_cast<GLsizeiptr>(value64); + offset = static_cast<GLintptr>(value64); + + const char kSizeOverflowMessage[] = "size more than 32-bit"; + const char kOffsetOverflowMessage[] = "offset more than 32-bit"; + + const GLfloat buf[] = { 1.0, 1.0, 1.0, 1.0 }; + const GLubyte indices[] = { 0 }; + + const GLuint kClientArrayBufferId = 0x789; + const GLuint kClientElementArrayBufferId = 0x790; + gl_->BindBuffer(GL_ARRAY_BUFFER, kClientArrayBufferId); + gl_->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, kClientElementArrayBufferId); + EXPECT_EQ(GL_NO_ERROR, CheckError()); + + // Call BufferData() should succeed with legal paramaters. + gl_->BufferData(GL_ARRAY_BUFFER, sizeof(buf), buf, GL_DYNAMIC_DRAW); + gl_->BufferData( + GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_DYNAMIC_DRAW); + EXPECT_EQ(GL_NO_ERROR, CheckError()); + + // BufferData: size + gl_->BufferData(GL_ARRAY_BUFFER, size, buf, GL_DYNAMIC_DRAW); + EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); + EXPECT_STREQ(kSizeOverflowMessage, GetLastError().c_str()); + + // Call BufferSubData() should succeed with legal paramaters. + gl_->BufferSubData(GL_ARRAY_BUFFER, 0, sizeof(buf[0]), buf); + EXPECT_EQ(GL_NO_ERROR, CheckError()); + + // BufferSubData: offset + gl_->BufferSubData(GL_ARRAY_BUFFER, offset, 1, buf); + EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); + EXPECT_STREQ(kOffsetOverflowMessage, GetLastError().c_str()); + + // BufferSubData: size + EXPECT_EQ(GL_NO_ERROR, CheckError()); + gl_->BufferSubData(GL_ARRAY_BUFFER, 0, size, buf); + EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); + EXPECT_STREQ(kSizeOverflowMessage, GetLastError().c_str()); + + // Call MapBufferSubDataCHROMIUM() should succeed with legal paramaters. + void* mem = + gl_->MapBufferSubDataCHROMIUM(GL_ARRAY_BUFFER, 0, 1, GL_WRITE_ONLY); + EXPECT_TRUE(NULL != mem); + EXPECT_EQ(GL_NO_ERROR, CheckError()); + gl_->UnmapBufferSubDataCHROMIUM(mem); + + // MapBufferSubDataCHROMIUM: offset + EXPECT_TRUE(NULL == gl_->MapBufferSubDataCHROMIUM( + GL_ARRAY_BUFFER, offset, 1, GL_WRITE_ONLY)); + EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); + EXPECT_STREQ(kOffsetOverflowMessage, GetLastError().c_str()); + + // MapBufferSubDataCHROMIUM: size + EXPECT_EQ(GL_NO_ERROR, CheckError()); + EXPECT_TRUE(NULL == gl_->MapBufferSubDataCHROMIUM( + GL_ARRAY_BUFFER, 0, size, GL_WRITE_ONLY)); + EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); + EXPECT_STREQ(kSizeOverflowMessage, GetLastError().c_str()); + + // Call DrawElements() should succeed with legal paramaters. + gl_->DrawElements(GL_POINTS, 1, GL_UNSIGNED_BYTE, NULL); + EXPECT_EQ(GL_NO_ERROR, CheckError()); + + // DrawElements: offset + gl_->DrawElements( + GL_POINTS, 1, GL_UNSIGNED_BYTE, reinterpret_cast<void*>(offset)); + EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); + EXPECT_STREQ(kOffsetOverflowMessage, GetLastError().c_str()); + + // Call DrawElementsInstancedANGLE() should succeed with legal paramaters. + gl_->DrawElementsInstancedANGLE(GL_POINTS, 1, GL_UNSIGNED_BYTE, NULL, 1); + EXPECT_EQ(GL_NO_ERROR, CheckError()); + + // DrawElementsInstancedANGLE: offset + gl_->DrawElementsInstancedANGLE( + GL_POINTS, 1, GL_UNSIGNED_BYTE, reinterpret_cast<void*>(offset), 1); + EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); + EXPECT_STREQ(kOffsetOverflowMessage, GetLastError().c_str()); + + // Call VertexAttribPointer() should succeed with legal paramaters. + const GLuint kAttribIndex = 1; + const GLsizei kStride = 4; + gl_->VertexAttribPointer( + kAttribIndex, 1, GL_FLOAT, GL_FALSE, kStride, NULL); + EXPECT_EQ(GL_NO_ERROR, CheckError()); + + // VertexAttribPointer: offset + gl_->VertexAttribPointer( + kAttribIndex, 1, GL_FLOAT, GL_FALSE, kStride, + reinterpret_cast<void*>(offset)); + EXPECT_EQ(GL_INVALID_OPERATION, CheckError()); + EXPECT_STREQ(kOffsetOverflowMessage, GetLastError().c_str()); +} + +TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { + ContextInitOptions init_options; + init_options.lose_context_when_out_of_memory = true; + ASSERT_TRUE(Initialize(init_options)); + + struct Cmds { + cmds::LoseContextCHROMIUM cmd; + }; + + GLsizei max = std::numeric_limits<GLsizei>::max(); + EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _, _)) + .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); + gl_->CreateImageCHROMIUM(max, max, 0, GL_IMAGE_MAP_CHROMIUM); + // The context should be lost. + Cmds expected; + expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) { + ContextInitOptions init_options; + ASSERT_TRUE(Initialize(init_options)); + + struct Cmds { + cmds::LoseContextCHROMIUM cmd; + }; + + GLsizei max = std::numeric_limits<GLsizei>::max(); + EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _, _)) + .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); + gl_->CreateImageCHROMIUM(max, max, 0, GL_IMAGE_MAP_CHROMIUM); + // The context should not be lost. + EXPECT_TRUE(NoCommandsWritten()); +} + +TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch1) { + ContextInitOptions init_options; + init_options.bind_generates_resource_client = false; + init_options.bind_generates_resource_service = true; + EXPECT_FALSE(Initialize(init_options)); +} + +TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch2) { + ContextInitOptions init_options; + init_options.bind_generates_resource_client = true; + init_options.bind_generates_resource_service = false; + EXPECT_FALSE(Initialize(init_options)); +} #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h b/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h index 38e32a69b25..d75697e357e 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // This file is included by gles2_implementation.h to declare the @@ -11,7 +13,6 @@ #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ - TEST_F(GLES2ImplementationTest, AttachShader) { struct Cmds { cmds::AttachShader cmd; @@ -126,14 +127,13 @@ TEST_F(GLES2ImplementationTest, CheckFramebufferStatus) { cmds::CheckFramebufferStatus cmd; }; - typedef cmds::CheckFramebufferStatus::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::CheckFramebufferStatus::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->CheckFramebufferStatus(1); @@ -168,9 +168,9 @@ TEST_F(GLES2ImplementationTest, ClearDepthf) { cmds::ClearDepthf cmd; }; Cmds expected; - expected.cmd.Init(1); + expected.cmd.Init(0.5f); - gl_->ClearDepthf(1); + gl_->ClearDepthf(0.5f); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } @@ -214,12 +214,18 @@ TEST_F(GLES2ImplementationTest, CopyTexImage2D) { cmds::CopyTexImage2D cmd; }; Cmds expected; - expected.cmd.Init(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 0); + expected.cmd.Init(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7); gl_->CopyTexImage2D(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 0); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } +TEST_F(GLES2ImplementationTest, CopyTexImage2DInvalidConstantArg7) { + gl_->CopyTexImage2D(GL_TEXTURE_2D, 2, GL_ALPHA, 4, 5, 6, 7, 1); + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); +} + TEST_F(GLES2ImplementationTest, CopyTexSubImage2D) { struct Cmds { cmds::CopyTexSubImage2D cmd; @@ -243,7 +249,7 @@ TEST_F(GLES2ImplementationTest, CullFace) { } TEST_F(GLES2ImplementationTest, DeleteBuffers) { - GLuint ids[2] = { kBuffersStartId, kBuffersStartId + 1 }; + GLuint ids[2] = {kBuffersStartId, kBuffersStartId + 1}; struct Cmds { cmds::DeleteBuffersImmediate del; GLuint data[2]; @@ -257,7 +263,7 @@ TEST_F(GLES2ImplementationTest, DeleteBuffers) { } TEST_F(GLES2ImplementationTest, DeleteFramebuffers) { - GLuint ids[2] = { kFramebuffersStartId, kFramebuffersStartId + 1 }; + GLuint ids[2] = {kFramebuffersStartId, kFramebuffersStartId + 1}; struct Cmds { cmds::DeleteFramebuffersImmediate del; GLuint data[2]; @@ -282,7 +288,7 @@ TEST_F(GLES2ImplementationTest, DeleteProgram) { } TEST_F(GLES2ImplementationTest, DeleteRenderbuffers) { - GLuint ids[2] = { kRenderbuffersStartId, kRenderbuffersStartId + 1 }; + GLuint ids[2] = {kRenderbuffersStartId, kRenderbuffersStartId + 1}; struct Cmds { cmds::DeleteRenderbuffersImmediate del; GLuint data[2]; @@ -307,7 +313,7 @@ TEST_F(GLES2ImplementationTest, DeleteShader) { } TEST_F(GLES2ImplementationTest, DeleteTextures) { - GLuint ids[2] = { kTexturesStartId, kTexturesStartId + 1 }; + GLuint ids[2] = {kTexturesStartId, kTexturesStartId + 1}; struct Cmds { cmds::DeleteTexturesImmediate del; GLuint data[2]; @@ -425,13 +431,20 @@ TEST_F(GLES2ImplementationTest, FramebufferTexture2D) { cmds::FramebufferTexture2D cmd; }; Cmds expected; - expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0); + expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4); gl_->FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } +TEST_F(GLES2ImplementationTest, FramebufferTexture2DInvalidConstantArg4) { + gl_->FramebufferTexture2D( + GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 1); + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); +} + TEST_F(GLES2ImplementationTest, FrontFace) { struct Cmds { cmds::FrontFace cmd; @@ -444,7 +457,9 @@ TEST_F(GLES2ImplementationTest, FrontFace) { } TEST_F(GLES2ImplementationTest, GenBuffers) { - GLuint ids[2] = { 0, }; + GLuint ids[2] = { + 0, + }; struct Cmds { cmds::GenBuffersImmediate gen; GLuint data[2]; @@ -471,7 +486,9 @@ TEST_F(GLES2ImplementationTest, GenerateMipmap) { } TEST_F(GLES2ImplementationTest, GenFramebuffers) { - GLuint ids[2] = { 0, }; + GLuint ids[2] = { + 0, + }; struct Cmds { cmds::GenFramebuffersImmediate gen; GLuint data[2]; @@ -487,7 +504,9 @@ TEST_F(GLES2ImplementationTest, GenFramebuffers) { } TEST_F(GLES2ImplementationTest, GenRenderbuffers) { - GLuint ids[2] = { 0, }; + GLuint ids[2] = { + 0, + }; struct Cmds { cmds::GenRenderbuffersImmediate gen; GLuint data[2]; @@ -503,7 +522,9 @@ TEST_F(GLES2ImplementationTest, GenRenderbuffers) { } TEST_F(GLES2ImplementationTest, GenTextures) { - GLuint ids[2] = { 0, }; + GLuint ids[2] = { + 0, + }; struct Cmds { cmds::GenTexturesImmediate gen; GLuint data[2]; @@ -581,14 +602,18 @@ TEST_F(GLES2ImplementationTest, GetFramebufferAttachmentParameteriv) { Result::Type result = 0; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(4); - expected.cmd.Init( - 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, - result1.id, result1.offset); + expected.cmd.Init(123, + GL_COLOR_ATTACHMENT0, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, + result1.id, + result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) .WillOnce(SetMemory(result1.ptr, SizedResultHelper<Result::Type>(1))) .RetiresOnSaturation(); gl_->GetFramebufferAttachmentParameteriv( - 123, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, + 123, + GL_COLOR_ATTACHMENT0, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &result); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); EXPECT_EQ(static_cast<Result::Type>(1), result); @@ -754,14 +779,13 @@ TEST_F(GLES2ImplementationTest, IsBuffer) { cmds::IsBuffer cmd; }; - typedef cmds::IsBuffer::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::IsBuffer::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->IsBuffer(1); @@ -774,14 +798,13 @@ TEST_F(GLES2ImplementationTest, IsEnabled) { cmds::IsEnabled cmd; }; - typedef cmds::IsEnabled::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::IsEnabled::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->IsEnabled(1); @@ -794,14 +817,13 @@ TEST_F(GLES2ImplementationTest, IsFramebuffer) { cmds::IsFramebuffer cmd; }; - typedef cmds::IsFramebuffer::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::IsFramebuffer::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->IsFramebuffer(1); @@ -814,14 +836,13 @@ TEST_F(GLES2ImplementationTest, IsProgram) { cmds::IsProgram cmd; }; - typedef cmds::IsProgram::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::IsProgram::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->IsProgram(1); @@ -834,14 +855,13 @@ TEST_F(GLES2ImplementationTest, IsRenderbuffer) { cmds::IsRenderbuffer cmd; }; - typedef cmds::IsRenderbuffer::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::IsRenderbuffer::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->IsRenderbuffer(1); @@ -854,14 +874,13 @@ TEST_F(GLES2ImplementationTest, IsShader) { cmds::IsShader cmd; }; - typedef cmds::IsShader::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::IsShader::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->IsShader(1); @@ -874,14 +893,13 @@ TEST_F(GLES2ImplementationTest, IsTexture) { cmds::IsTexture cmd; }; - typedef cmds::IsTexture::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::IsTexture::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->IsTexture(1); @@ -894,9 +912,9 @@ TEST_F(GLES2ImplementationTest, LineWidth) { cmds::LineWidth cmd; }; Cmds expected; - expected.cmd.Init(1); + expected.cmd.Init(0.5f); - gl_->LineWidth(1); + gl_->LineWidth(0.5f); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } @@ -1048,9 +1066,9 @@ TEST_F(GLES2ImplementationTest, TexParameterf) { cmds::TexParameterf cmd; }; Cmds expected; - expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); + expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - gl_->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); + gl_->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } @@ -1075,9 +1093,9 @@ TEST_F(GLES2ImplementationTest, TexParameteri) { cmds::TexParameteri cmd; }; Cmds expected; - expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); + expected.cmd.Init(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, 3); + gl_->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } @@ -1342,11 +1360,23 @@ TEST_F(GLES2ImplementationTest, UniformMatrix2fv) { data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj); } } - expected.cmd.Init(1, 2, false, &data[0][0]); + expected.cmd.Init(1, 2, &data[0][0]); gl_->UniformMatrix2fv(1, 2, false, &data[0][0]); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } +TEST_F(GLES2ImplementationTest, UniformMatrix2fvInvalidConstantArg2) { + GLfloat data[2][4] = {{0}}; + for (int ii = 0; ii < 2; ++ii) { + for (int jj = 0; jj < 4; ++jj) { + data[ii][jj] = static_cast<GLfloat>(ii * 4 + jj); + } + } + gl_->UniformMatrix2fv(1, 2, true, &data[0][0]); + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); +} + TEST_F(GLES2ImplementationTest, UniformMatrix3fv) { GLfloat data[2][9] = {{0}}; struct Cmds { @@ -1360,11 +1390,23 @@ TEST_F(GLES2ImplementationTest, UniformMatrix3fv) { data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj); } } - expected.cmd.Init(1, 2, false, &data[0][0]); + expected.cmd.Init(1, 2, &data[0][0]); gl_->UniformMatrix3fv(1, 2, false, &data[0][0]); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } +TEST_F(GLES2ImplementationTest, UniformMatrix3fvInvalidConstantArg2) { + GLfloat data[2][9] = {{0}}; + for (int ii = 0; ii < 2; ++ii) { + for (int jj = 0; jj < 9; ++jj) { + data[ii][jj] = static_cast<GLfloat>(ii * 9 + jj); + } + } + gl_->UniformMatrix3fv(1, 2, true, &data[0][0]); + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); +} + TEST_F(GLES2ImplementationTest, UniformMatrix4fv) { GLfloat data[2][16] = {{0}}; struct Cmds { @@ -1378,11 +1420,23 @@ TEST_F(GLES2ImplementationTest, UniformMatrix4fv) { data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj); } } - expected.cmd.Init(1, 2, false, &data[0][0]); + expected.cmd.Init(1, 2, &data[0][0]); gl_->UniformMatrix4fv(1, 2, false, &data[0][0]); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } +TEST_F(GLES2ImplementationTest, UniformMatrix4fvInvalidConstantArg2) { + GLfloat data[2][16] = {{0}}; + for (int ii = 0; ii < 2; ++ii) { + for (int jj = 0; jj < 16; ++jj) { + data[ii][jj] = static_cast<GLfloat>(ii * 16 + jj); + } + } + gl_->UniformMatrix4fv(1, 2, true, &data[0][0]); + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); +} + TEST_F(GLES2ImplementationTest, UseProgram) { struct Cmds { cmds::UseProgram cmd; @@ -1392,6 +1446,9 @@ TEST_F(GLES2ImplementationTest, UseProgram) { gl_->UseProgram(1); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); + ClearCommands(); + gl_->UseProgram(1); + EXPECT_TRUE(NoCommandsWritten()); } TEST_F(GLES2ImplementationTest, ValidateProgram) { @@ -1563,14 +1620,21 @@ TEST_F(GLES2ImplementationTest, FramebufferTexture2DMultisampleEXT) { cmds::FramebufferTexture2DMultisampleEXT cmd; }; Cmds expected; - expected.cmd.Init( - GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0, 6); + expected.cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 6); gl_->FramebufferTexture2DMultisampleEXT( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 0, 6); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } +TEST_F(GLES2ImplementationTest, + FramebufferTexture2DMultisampleEXTInvalidConstantArg4) { + gl_->FramebufferTexture2DMultisampleEXT( + GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 4, 1, 6); + EXPECT_TRUE(NoCommandsWritten()); + EXPECT_EQ(GL_INVALID_VALUE, CheckError()); +} + TEST_F(GLES2ImplementationTest, TexStorage2DEXT) { struct Cmds { cmds::TexStorage2DEXT cmd; @@ -1583,7 +1647,9 @@ TEST_F(GLES2ImplementationTest, TexStorage2DEXT) { } TEST_F(GLES2ImplementationTest, GenQueriesEXT) { - GLuint ids[2] = { 0, }; + GLuint ids[2] = { + 0, + }; struct Cmds { cmds::GenQueriesEXTImmediate gen; GLuint data[2]; @@ -1599,7 +1665,7 @@ TEST_F(GLES2ImplementationTest, GenQueriesEXT) { } TEST_F(GLES2ImplementationTest, DeleteQueriesEXT) { - GLuint ids[2] = { kQueriesStartId, kQueriesStartId + 1 }; + GLuint ids[2] = {kQueriesStartId, kQueriesStartId + 1}; struct Cmds { cmds::DeleteQueriesEXTImmediate del; GLuint data[2]; @@ -1627,7 +1693,9 @@ TEST_F(GLES2ImplementationTest, PopGroupMarkerEXT) { } TEST_F(GLES2ImplementationTest, GenVertexArraysOES) { - GLuint ids[2] = { 0, }; + GLuint ids[2] = { + 0, + }; struct Cmds { cmds::GenVertexArraysOESImmediate gen; GLuint data[2]; @@ -1643,7 +1711,7 @@ TEST_F(GLES2ImplementationTest, GenVertexArraysOES) { } TEST_F(GLES2ImplementationTest, DeleteVertexArraysOES) { - GLuint ids[2] = { kVertexArraysStartId, kVertexArraysStartId + 1 }; + GLuint ids[2] = {kVertexArraysStartId, kVertexArraysStartId + 1}; struct Cmds { cmds::DeleteVertexArraysOESImmediate del; GLuint data[2]; @@ -1661,14 +1729,13 @@ TEST_F(GLES2ImplementationTest, IsVertexArrayOES) { cmds::IsVertexArrayOES cmd; }; - typedef cmds::IsVertexArrayOES::Result Result; Cmds expected; ExpectedMemoryInfo result1 = GetExpectedResultMemory(sizeof(cmds::IsVertexArrayOES::Result)); expected.cmd.Init(1, result1.id, result1.offset); EXPECT_CALL(*command_buffer(), OnFlush()) - .WillOnce(SetMemory(result1.ptr, uint32(1))) + .WillOnce(SetMemory(result1.ptr, uint32_t(1))) .RetiresOnSaturation(); GLboolean result = gl_->IsVertexArrayOES(1); @@ -1691,17 +1758,7 @@ TEST_F(GLES2ImplementationTest, ResizeCHROMIUM) { EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } // TODO: Implement unit test for GetRequestableExtensionsCHROMIUM - -TEST_F(GLES2ImplementationTest, DestroyStreamTextureCHROMIUM) { - struct Cmds { - cmds::DestroyStreamTextureCHROMIUM cmd; - }; - Cmds expected; - expected.cmd.Init(1); - - gl_->DestroyStreamTextureCHROMIUM(1); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} +// TODO: Implement unit test for CreateStreamTextureCHROMIUM // TODO: Implement unit test for GetTranslatedShaderSourceANGLE TEST_F(GLES2ImplementationTest, TexImageIOSurface2DCHROMIUM) { @@ -1748,38 +1805,6 @@ TEST_F(GLES2ImplementationTest, VertexAttribDivisorANGLE) { EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } // TODO: Implement unit test for GenMailboxCHROMIUM - -TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) { - GLbyte data[64] = {0}; - struct Cmds { - cmds::ProduceTextureCHROMIUMImmediate cmd; - GLbyte data[64]; - }; - - for (int jj = 0; jj < 64; ++jj) { - data[jj] = static_cast<GLbyte>(jj); - } - Cmds expected; - expected.cmd.Init(GL_TEXTURE_2D, &data[0]); - gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, &data[0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} - -TEST_F(GLES2ImplementationTest, ConsumeTextureCHROMIUM) { - GLbyte data[64] = {0}; - struct Cmds { - cmds::ConsumeTextureCHROMIUMImmediate cmd; - GLbyte data[64]; - }; - - for (int jj = 0; jj < 64; ++jj) { - data[jj] = static_cast<GLbyte>(jj); - } - Cmds expected; - expected.cmd.Init(GL_TEXTURE_2D, &data[0]); - gl_->ConsumeTextureCHROMIUM(GL_TEXTURE_2D, &data[0]); - EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); -} // TODO: Implement unit test for BindUniformLocationCHROMIUM TEST_F(GLES2ImplementationTest, BindTexImage2DCHROMIUM) { @@ -1827,9 +1852,10 @@ TEST_F(GLES2ImplementationTest, LoseContextCHROMIUM) { cmds::LoseContextCHROMIUM cmd; }; Cmds expected; - expected.cmd.Init(1, 2); + expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_GUILTY_CONTEXT_RESET_ARB); - gl_->LoseContextCHROMIUM(1, 2); + gl_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, + GL_GUILTY_CONTEXT_RESET_ARB); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } // TODO: Implement unit test for InsertSyncPointCHROMIUM @@ -1874,4 +1900,3 @@ TEST_F(GLES2ImplementationTest, DiscardBackbufferCHROMIUM) { EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_UNITTEST_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/gles2_interface_autogen.h b/chromium/gpu/command_buffer/client/gles2_interface_autogen.h index 029bf691bc1..ad0a418ff2e 100644 --- a/chromium/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_interface_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // This file is included by gles2_interface.h to declare the @@ -13,44 +15,78 @@ virtual void ActiveTexture(GLenum texture) = 0; virtual void AttachShader(GLuint program, GLuint shader) = 0; -virtual void BindAttribLocation( - GLuint program, GLuint index, const char* name) = 0; +virtual void BindAttribLocation(GLuint program, + GLuint index, + const char* name) = 0; virtual void BindBuffer(GLenum target, GLuint buffer) = 0; virtual void BindFramebuffer(GLenum target, GLuint framebuffer) = 0; virtual void BindRenderbuffer(GLenum target, GLuint renderbuffer) = 0; virtual void BindTexture(GLenum target, GLuint texture) = 0; -virtual void BlendColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) = 0; +virtual void BlendColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) = 0; virtual void BlendEquation(GLenum mode) = 0; virtual void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) = 0; virtual void BlendFunc(GLenum sfactor, GLenum dfactor) = 0; -virtual void BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) = 0; -virtual void BufferData( - GLenum target, GLsizeiptr size, const void* data, GLenum usage) = 0; -virtual void BufferSubData( - GLenum target, GLintptr offset, GLsizeiptr size, const void* data) = 0; +virtual void BlendFuncSeparate(GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) = 0; +virtual void BufferData(GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage) = 0; +virtual void BufferSubData(GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data) = 0; virtual GLenum CheckFramebufferStatus(GLenum target) = 0; virtual void Clear(GLbitfield mask) = 0; -virtual void ClearColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) = 0; +virtual void ClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) = 0; virtual void ClearDepthf(GLclampf depth) = 0; virtual void ClearStencil(GLint s) = 0; -virtual void ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) = 0; +virtual void ColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) = 0; virtual void CompileShader(GLuint shader) = 0; -virtual void CompressedTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, GLsizei imageSize, const void* data) = 0; -virtual void CompressedTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLsizei imageSize, const void* data) = 0; -virtual void CopyTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border) = 0; -virtual void CopyTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height) = 0; +virtual void CompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data) = 0; +virtual void CompressedTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data) = 0; +virtual void CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) = 0; +virtual void CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) = 0; virtual GLuint CreateProgram() = 0; virtual GLuint CreateShader(GLenum type) = 0; virtual void CullFace(GLenum mode) = 0; @@ -67,66 +103,93 @@ virtual void DetachShader(GLuint program, GLuint shader) = 0; virtual void Disable(GLenum cap) = 0; virtual void DisableVertexAttribArray(GLuint index) = 0; virtual void DrawArrays(GLenum mode, GLint first, GLsizei count) = 0; -virtual void DrawElements( - GLenum mode, GLsizei count, GLenum type, const void* indices) = 0; +virtual void DrawElements(GLenum mode, + GLsizei count, + GLenum type, + const void* indices) = 0; virtual void Enable(GLenum cap) = 0; virtual void EnableVertexAttribArray(GLuint index) = 0; virtual void Finish() = 0; virtual void Flush() = 0; -virtual void FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, - GLuint renderbuffer) = 0; -virtual void FramebufferTexture2D( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level) = 0; +virtual void FramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) = 0; +virtual void FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) = 0; virtual void FrontFace(GLenum mode) = 0; virtual void GenBuffers(GLsizei n, GLuint* buffers) = 0; virtual void GenerateMipmap(GLenum target) = 0; virtual void GenFramebuffers(GLsizei n, GLuint* framebuffers) = 0; virtual void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) = 0; virtual void GenTextures(GLsizei n, GLuint* textures) = 0; -virtual void GetActiveAttrib( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) = 0; -virtual void GetActiveUniform( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) = 0; -virtual void GetAttachedShaders( - GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) = 0; +virtual void GetActiveAttrib(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) = 0; +virtual void GetActiveUniform(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) = 0; +virtual void GetAttachedShaders(GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders) = 0; virtual GLint GetAttribLocation(GLuint program, const char* name) = 0; virtual void GetBooleanv(GLenum pname, GLboolean* params) = 0; -virtual void GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) = - 0; +virtual void GetBufferParameteriv(GLenum target, + GLenum pname, + GLint* params) = 0; virtual GLenum GetError() = 0; virtual void GetFloatv(GLenum pname, GLfloat* params) = 0; -virtual void GetFramebufferAttachmentParameteriv( - GLenum target, GLenum attachment, GLenum pname, GLint* params) = 0; +virtual void GetFramebufferAttachmentParameteriv(GLenum target, + GLenum attachment, + GLenum pname, + GLint* params) = 0; virtual void GetIntegerv(GLenum pname, GLint* params) = 0; virtual void GetProgramiv(GLuint program, GLenum pname, GLint* params) = 0; -virtual void GetProgramInfoLog( - GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) = 0; -virtual void GetRenderbufferParameteriv( - GLenum target, GLenum pname, GLint* params) = 0; +virtual void GetProgramInfoLog(GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog) = 0; +virtual void GetRenderbufferParameteriv(GLenum target, + GLenum pname, + GLint* params) = 0; virtual void GetShaderiv(GLuint shader, GLenum pname, GLint* params) = 0; -virtual void GetShaderInfoLog( - GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) = 0; -virtual void GetShaderPrecisionFormat( - GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) = - 0; -virtual void GetShaderSource( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) = 0; +virtual void GetShaderInfoLog(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog) = 0; +virtual void GetShaderPrecisionFormat(GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision) = 0; +virtual void GetShaderSource(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) = 0; virtual const GLubyte* GetString(GLenum name) = 0; -virtual void GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) = - 0; +virtual void GetTexParameterfv(GLenum target, + GLenum pname, + GLfloat* params) = 0; virtual void GetTexParameteriv(GLenum target, GLenum pname, GLint* params) = 0; virtual void GetUniformfv(GLuint program, GLint location, GLfloat* params) = 0; virtual void GetUniformiv(GLuint program, GLint location, GLint* params) = 0; virtual GLint GetUniformLocation(GLuint program, const char* name) = 0; -virtual void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) = - 0; +virtual void GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) = 0; virtual void GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) = 0; -virtual void GetVertexAttribPointerv( - GLuint index, GLenum pname, void** pointer) = 0; +virtual void GetVertexAttribPointerv(GLuint index, + GLenum pname, + void** pointer) = 0; virtual void Hint(GLenum target, GLenum mode) = 0; virtual GLboolean IsBuffer(GLuint buffer) = 0; virtual GLboolean IsEnabled(GLenum cap) = 0; @@ -139,43 +202,69 @@ virtual void LineWidth(GLfloat width) = 0; virtual void LinkProgram(GLuint program) = 0; virtual void PixelStorei(GLenum pname, GLint param) = 0; virtual void PolygonOffset(GLfloat factor, GLfloat units) = 0; -virtual void ReadPixels( - GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - void* pixels) = 0; +virtual void ReadPixels(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels) = 0; virtual void ReleaseShaderCompiler() = 0; -virtual void RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, GLsizei height) = 0; +virtual void RenderbufferStorage(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) = 0; virtual void SampleCoverage(GLclampf value, GLboolean invert) = 0; virtual void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) = 0; -virtual void ShaderBinary( - GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, - GLsizei length) = 0; -virtual void ShaderSource( - GLuint shader, GLsizei count, const GLchar* const* str, - const GLint* length) = 0; +virtual void ShaderBinary(GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length) = 0; +virtual void ShaderSource(GLuint shader, + GLsizei count, + const GLchar* const* str, + const GLint* length) = 0; virtual void ShallowFinishCHROMIUM() = 0; virtual void ShallowFlushCHROMIUM() = 0; virtual void StencilFunc(GLenum func, GLint ref, GLuint mask) = 0; -virtual void StencilFuncSeparate( - GLenum face, GLenum func, GLint ref, GLuint mask) = 0; +virtual void StencilFuncSeparate(GLenum face, + GLenum func, + GLint ref, + GLuint mask) = 0; virtual void StencilMask(GLuint mask) = 0; virtual void StencilMaskSeparate(GLenum face, GLuint mask) = 0; virtual void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) = 0; -virtual void StencilOpSeparate( - GLenum face, GLenum fail, GLenum zfail, GLenum zpass) = 0; -virtual void TexImage2D( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) = 0; +virtual void StencilOpSeparate(GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass) = 0; +virtual void TexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) = 0; virtual void TexParameterf(GLenum target, GLenum pname, GLfloat param) = 0; -virtual void TexParameterfv( - GLenum target, GLenum pname, const GLfloat* params) = 0; +virtual void TexParameterfv(GLenum target, + GLenum pname, + const GLfloat* params) = 0; virtual void TexParameteri(GLenum target, GLenum pname, GLint param) = 0; -virtual void TexParameteriv(GLenum target, GLenum pname, const GLint* params) = - 0; -virtual void TexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* pixels) = 0; +virtual void TexParameteriv(GLenum target, + GLenum pname, + const GLint* params) = 0; +virtual void TexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels) = 0; virtual void Uniform1f(GLint location, GLfloat x) = 0; virtual void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) = 0; virtual void Uniform1i(GLint location, GLint x) = 0; @@ -188,20 +277,26 @@ virtual void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) = 0; virtual void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) = 0; virtual void Uniform3i(GLint location, GLint x, GLint y, GLint z) = 0; virtual void Uniform3iv(GLint location, GLsizei count, const GLint* v) = 0; -virtual void Uniform4f( - GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) = 0; +virtual void Uniform4f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) = 0; virtual void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) = 0; virtual void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) = 0; virtual void Uniform4iv(GLint location, GLsizei count, const GLint* v) = 0; -virtual void UniformMatrix2fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = - 0; -virtual void UniformMatrix3fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = - 0; -virtual void UniformMatrix4fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = - 0; +virtual void UniformMatrix2fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) = 0; +virtual void UniformMatrix3fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) = 0; +virtual void UniformMatrix4fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) = 0; virtual void UseProgram(GLuint program) = 0; virtual void ValidateProgram(GLuint program) = 0; virtual void VertexAttrib1f(GLuint indx, GLfloat x) = 0; @@ -210,28 +305,50 @@ virtual void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) = 0; virtual void VertexAttrib2fv(GLuint indx, const GLfloat* values) = 0; virtual void VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) = 0; virtual void VertexAttrib3fv(GLuint indx, const GLfloat* values) = 0; -virtual void VertexAttrib4f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) = 0; +virtual void VertexAttrib4f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) = 0; virtual void VertexAttrib4fv(GLuint indx, const GLfloat* values) = 0; -virtual void VertexAttribPointer( - GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, - const void* ptr) = 0; +virtual void VertexAttribPointer(GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr) = 0; virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) = 0; -virtual void BlitFramebufferCHROMIUM( - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, - GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) = 0; -virtual void RenderbufferStorageMultisampleCHROMIUM( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) = 0; -virtual void RenderbufferStorageMultisampleEXT( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) = 0; -virtual void FramebufferTexture2DMultisampleEXT( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLsizei samples) = 0; -virtual void TexStorage2DEXT( - GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, - GLsizei height) = 0; +virtual void BlitFramebufferCHROMIUM(GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) = 0; +virtual void RenderbufferStorageMultisampleCHROMIUM(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) = 0; +virtual void RenderbufferStorageMultisampleEXT(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) = 0; +virtual void FramebufferTexture2DMultisampleEXT(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples) = 0; +virtual void TexStorage2DEXT(GLenum target, + GLsizei levels, + GLenum internalFormat, + GLsizei width, + GLsizei height) = 0; virtual void GenQueriesEXT(GLsizei n, GLuint* queries) = 0; virtual void DeleteQueriesEXT(GLsizei n, const GLuint* queries) = 0; virtual GLboolean IsQueryEXT(GLuint id) = 0; @@ -247,81 +364,144 @@ virtual void DeleteVertexArraysOES(GLsizei n, const GLuint* arrays) = 0; virtual GLboolean IsVertexArrayOES(GLuint array) = 0; virtual void BindVertexArrayOES(GLuint array) = 0; virtual void SwapBuffers() = 0; -virtual GLuint GetMaxValueInBufferCHROMIUM( - GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) = 0; -virtual void GenSharedIdsCHROMIUM( - GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) = 0; -virtual void DeleteSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) = 0; -virtual void RegisterSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) = 0; +virtual GLuint GetMaxValueInBufferCHROMIUM(GLuint buffer_id, + GLsizei count, + GLenum type, + GLuint offset) = 0; +virtual void GenSharedIdsCHROMIUM(GLuint namespace_id, + GLuint id_offset, + GLsizei n, + GLuint* ids) = 0; +virtual void DeleteSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) = 0; +virtual void RegisterSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) = 0; virtual GLboolean EnableFeatureCHROMIUM(const char* feature) = 0; virtual void* MapBufferCHROMIUM(GLuint target, GLenum access) = 0; virtual GLboolean UnmapBufferCHROMIUM(GLuint target) = 0; -virtual void* MapImageCHROMIUM(GLuint image_id, GLenum access) = 0; +virtual void* MapImageCHROMIUM(GLuint image_id) = 0; virtual void UnmapImageCHROMIUM(GLuint image_id) = 0; -virtual void* MapBufferSubDataCHROMIUM( - GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) = 0; +virtual void* MapBufferSubDataCHROMIUM(GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access) = 0; virtual void UnmapBufferSubDataCHROMIUM(const void* mem) = 0; -virtual void* MapTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, GLenum access) = 0; +virtual void* MapTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access) = 0; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) = 0; -virtual void ResizeCHROMIUM(GLuint width, GLuint height, GLfloat scale_factor) = - 0; +virtual void ResizeCHROMIUM(GLuint width, + GLuint height, + GLfloat scale_factor) = 0; virtual const GLchar* GetRequestableExtensionsCHROMIUM() = 0; virtual void RequestExtensionCHROMIUM(const char* extension) = 0; virtual void RateLimitOffscreenContextCHROMIUM() = 0; -virtual void GetMultipleIntegervCHROMIUM( - const GLenum* pnames, GLuint count, GLint* results, GLsizeiptr size) = 0; -virtual void GetProgramInfoCHROMIUM( - GLuint program, GLsizei bufsize, GLsizei* size, void* info) = 0; +virtual void GetMultipleIntegervCHROMIUM(const GLenum* pnames, + GLuint count, + GLint* results, + GLsizeiptr size) = 0; +virtual void GetProgramInfoCHROMIUM(GLuint program, + GLsizei bufsize, + GLsizei* size, + void* info) = 0; virtual GLuint CreateStreamTextureCHROMIUM(GLuint texture) = 0; -virtual void DestroyStreamTextureCHROMIUM(GLuint texture) = 0; -virtual GLuint CreateImageCHROMIUM( - GLsizei width, GLsizei height, GLenum internalformat) = 0; +virtual GLuint CreateImageCHROMIUM(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) = 0; virtual void DestroyImageCHROMIUM(GLuint image_id) = 0; -virtual void GetImageParameterivCHROMIUM( - GLuint image_id, GLenum pname, GLint* params) = 0; -virtual void GetTranslatedShaderSourceANGLE( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) = 0; -virtual void PostSubBufferCHROMIUM( - GLint x, GLint y, GLint width, GLint height) = 0; -virtual void TexImageIOSurface2DCHROMIUM( - GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, - GLuint plane) = 0; -virtual void CopyTextureCHROMIUM( - GLenum target, GLenum source_id, GLenum dest_id, GLint level, - GLint internalformat, GLenum dest_type) = 0; -virtual void DrawArraysInstancedANGLE( - GLenum mode, GLint first, GLsizei count, GLsizei primcount) = 0; -virtual void DrawElementsInstancedANGLE( - GLenum mode, GLsizei count, GLenum type, const void* indices, - GLsizei primcount) = 0; +virtual void GetImageParameterivCHROMIUM(GLuint image_id, + GLenum pname, + GLint* params) = 0; +virtual void GetTranslatedShaderSourceANGLE(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) = 0; +virtual void PostSubBufferCHROMIUM(GLint x, + GLint y, + GLint width, + GLint height) = 0; +virtual void TexImageIOSurface2DCHROMIUM(GLenum target, + GLsizei width, + GLsizei height, + GLuint ioSurfaceId, + GLuint plane) = 0; +virtual void CopyTextureCHROMIUM(GLenum target, + GLenum source_id, + GLenum dest_id, + GLint level, + GLint internalformat, + GLenum dest_type) = 0; +virtual void DrawArraysInstancedANGLE(GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) = 0; +virtual void DrawElementsInstancedANGLE(GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount) = 0; virtual void VertexAttribDivisorANGLE(GLuint index, GLuint divisor) = 0; virtual void GenMailboxCHROMIUM(GLbyte* mailbox) = 0; virtual void ProduceTextureCHROMIUM(GLenum target, const GLbyte* mailbox) = 0; +virtual void ProduceTextureDirectCHROMIUM(GLuint texture, + GLenum target, + const GLbyte* mailbox) = 0; virtual void ConsumeTextureCHROMIUM(GLenum target, const GLbyte* mailbox) = 0; -virtual void BindUniformLocationCHROMIUM( - GLuint program, GLint location, const char* name) = 0; +virtual GLuint CreateAndConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) = 0; +virtual void BindUniformLocationCHROMIUM(GLuint program, + GLint location, + const char* name) = 0; virtual void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) = 0; virtual void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) = 0; virtual void TraceBeginCHROMIUM(const char* name) = 0; virtual void TraceEndCHROMIUM() = 0; -virtual void AsyncTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* data) = 0; -virtual void AsyncTexImage2DCHROMIUM( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) = 0; +virtual void AsyncTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* data) = 0; +virtual void AsyncTexImage2DCHROMIUM(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) = 0; virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) = 0; -virtual void DiscardFramebufferEXT( - GLenum target, GLsizei count, const GLenum* attachments) = 0; +virtual void WaitAllAsyncTexImage2DCHROMIUM() = 0; +virtual void DiscardFramebufferEXT(GLenum target, + GLsizei count, + const GLenum* attachments) = 0; virtual void LoseContextCHROMIUM(GLenum current, GLenum other) = 0; virtual GLuint InsertSyncPointCHROMIUM() = 0; virtual void WaitSyncPointCHROMIUM(GLuint sync_point) = 0; virtual void DrawBuffersEXT(GLsizei count, const GLenum* bufs) = 0; virtual void DiscardBackbufferCHROMIUM() = 0; +virtual void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order, + GLenum plane_transform, + GLuint overlay_texture_id, + GLint bounds_x, + GLint bounds_y, + GLint bounds_width, + GLint bounds_height, + GLfloat uv_x, + GLfloat uv_y, + GLfloat uv_width, + GLfloat uv_height) = 0; #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h index 59c0ce9e8fb..25bdd96c126 100644 --- a/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // This file is included by gles2_interface_stub.h. @@ -12,56 +14,86 @@ virtual void ActiveTexture(GLenum texture) OVERRIDE; virtual void AttachShader(GLuint program, GLuint shader) OVERRIDE; -virtual void BindAttribLocation( - GLuint program, GLuint index, const char* name) OVERRIDE; +virtual void BindAttribLocation(GLuint program, + GLuint index, + const char* name) OVERRIDE; virtual void BindBuffer(GLenum target, GLuint buffer) OVERRIDE; virtual void BindFramebuffer(GLenum target, GLuint framebuffer) OVERRIDE; virtual void BindRenderbuffer(GLenum target, GLuint renderbuffer) OVERRIDE; virtual void BindTexture(GLenum target, GLuint texture) OVERRIDE; -virtual void BlendColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) OVERRIDE; +virtual void BlendColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) OVERRIDE; virtual void BlendEquation(GLenum mode) OVERRIDE; virtual void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) OVERRIDE; virtual void BlendFunc(GLenum sfactor, GLenum dfactor) OVERRIDE; -virtual void BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) OVERRIDE; -virtual void BufferData( - GLenum target, GLsizeiptr size, const void* data, GLenum usage) OVERRIDE; -virtual void BufferSubData( - GLenum target, GLintptr offset, GLsizeiptr size, - const void* data) OVERRIDE; +virtual void BlendFuncSeparate(GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) OVERRIDE; +virtual void BufferData(GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage) OVERRIDE; +virtual void BufferSubData(GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data) OVERRIDE; virtual GLenum CheckFramebufferStatus(GLenum target) OVERRIDE; virtual void Clear(GLbitfield mask) OVERRIDE; -virtual void ClearColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) OVERRIDE; +virtual void ClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) OVERRIDE; virtual void ClearDepthf(GLclampf depth) OVERRIDE; virtual void ClearStencil(GLint s) OVERRIDE; -virtual void ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) OVERRIDE; +virtual void ColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) OVERRIDE; virtual void CompileShader(GLuint shader) OVERRIDE; -virtual void CompressedTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, GLsizei imageSize, - const void* data) OVERRIDE; -virtual void CompressedTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLsizei imageSize, - const void* data) OVERRIDE; -virtual void CopyTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border) OVERRIDE; -virtual void CopyTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height) OVERRIDE; +virtual void CompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data) OVERRIDE; +virtual void CompressedTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data) OVERRIDE; +virtual void CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) OVERRIDE; +virtual void CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) OVERRIDE; virtual GLuint CreateProgram() OVERRIDE; virtual GLuint CreateShader(GLenum type) OVERRIDE; virtual void CullFace(GLenum mode) OVERRIDE; virtual void DeleteBuffers(GLsizei n, const GLuint* buffers) OVERRIDE; -virtual void DeleteFramebuffers( - GLsizei n, const GLuint* framebuffers) OVERRIDE; +virtual void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) OVERRIDE; virtual void DeleteProgram(GLuint program) OVERRIDE; -virtual void DeleteRenderbuffers( - GLsizei n, const GLuint* renderbuffers) OVERRIDE; +virtual void DeleteRenderbuffers(GLsizei n, + const GLuint* renderbuffers) OVERRIDE; virtual void DeleteShader(GLuint shader) OVERRIDE; virtual void DeleteTextures(GLsizei n, const GLuint* textures) OVERRIDE; virtual void DepthFunc(GLenum func) OVERRIDE; @@ -71,72 +103,103 @@ virtual void DetachShader(GLuint program, GLuint shader) OVERRIDE; virtual void Disable(GLenum cap) OVERRIDE; virtual void DisableVertexAttribArray(GLuint index) OVERRIDE; virtual void DrawArrays(GLenum mode, GLint first, GLsizei count) OVERRIDE; -virtual void DrawElements( - GLenum mode, GLsizei count, GLenum type, const void* indices) OVERRIDE; +virtual void DrawElements(GLenum mode, + GLsizei count, + GLenum type, + const void* indices) OVERRIDE; virtual void Enable(GLenum cap) OVERRIDE; virtual void EnableVertexAttribArray(GLuint index) OVERRIDE; virtual void Finish() OVERRIDE; virtual void Flush() OVERRIDE; -virtual void FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, - GLuint renderbuffer) OVERRIDE; -virtual void FramebufferTexture2D( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level) OVERRIDE; +virtual void FramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) OVERRIDE; +virtual void FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) OVERRIDE; virtual void FrontFace(GLenum mode) OVERRIDE; virtual void GenBuffers(GLsizei n, GLuint* buffers) OVERRIDE; virtual void GenerateMipmap(GLenum target) OVERRIDE; virtual void GenFramebuffers(GLsizei n, GLuint* framebuffers) OVERRIDE; virtual void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) OVERRIDE; virtual void GenTextures(GLsizei n, GLuint* textures) OVERRIDE; -virtual void GetActiveAttrib( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) OVERRIDE; -virtual void GetActiveUniform( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) OVERRIDE; -virtual void GetAttachedShaders( - GLuint program, GLsizei maxcount, GLsizei* count, - GLuint* shaders) OVERRIDE; +virtual void GetActiveAttrib(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) OVERRIDE; +virtual void GetActiveUniform(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) OVERRIDE; +virtual void GetAttachedShaders(GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders) OVERRIDE; virtual GLint GetAttribLocation(GLuint program, const char* name) OVERRIDE; virtual void GetBooleanv(GLenum pname, GLboolean* params) OVERRIDE; -virtual void GetBufferParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetBufferParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; virtual GLenum GetError() OVERRIDE; virtual void GetFloatv(GLenum pname, GLfloat* params) OVERRIDE; -virtual void GetFramebufferAttachmentParameteriv( - GLenum target, GLenum attachment, GLenum pname, GLint* params) OVERRIDE; +virtual void GetFramebufferAttachmentParameteriv(GLenum target, + GLenum attachment, + GLenum pname, + GLint* params) OVERRIDE; virtual void GetIntegerv(GLenum pname, GLint* params) OVERRIDE; -virtual void GetProgramiv( - GLuint program, GLenum pname, GLint* params) OVERRIDE; -virtual void GetProgramInfoLog( - GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) OVERRIDE; -virtual void GetRenderbufferParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetProgramiv(GLuint program, GLenum pname, GLint* params) OVERRIDE; +virtual void GetProgramInfoLog(GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog) OVERRIDE; +virtual void GetRenderbufferParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; virtual void GetShaderiv(GLuint shader, GLenum pname, GLint* params) OVERRIDE; -virtual void GetShaderInfoLog( - GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) OVERRIDE; -virtual void GetShaderPrecisionFormat( - GLenum shadertype, GLenum precisiontype, GLint* range, - GLint* precision) OVERRIDE; -virtual void GetShaderSource( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) OVERRIDE; +virtual void GetShaderInfoLog(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog) OVERRIDE; +virtual void GetShaderPrecisionFormat(GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision) OVERRIDE; +virtual void GetShaderSource(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) OVERRIDE; virtual const GLubyte* GetString(GLenum name) OVERRIDE; -virtual void GetTexParameterfv( - GLenum target, GLenum pname, GLfloat* params) OVERRIDE; -virtual void GetTexParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; -virtual void GetUniformfv( - GLuint program, GLint location, GLfloat* params) OVERRIDE; -virtual void GetUniformiv( - GLuint program, GLint location, GLint* params) OVERRIDE; +virtual void GetTexParameterfv(GLenum target, + GLenum pname, + GLfloat* params) OVERRIDE; +virtual void GetTexParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; +virtual void GetUniformfv(GLuint program, + GLint location, + GLfloat* params) OVERRIDE; +virtual void GetUniformiv(GLuint program, + GLint location, + GLint* params) OVERRIDE; virtual GLint GetUniformLocation(GLuint program, const char* name) OVERRIDE; -virtual void GetVertexAttribfv( - GLuint index, GLenum pname, GLfloat* params) OVERRIDE; -virtual void GetVertexAttribiv( - GLuint index, GLenum pname, GLint* params) OVERRIDE; -virtual void GetVertexAttribPointerv( - GLuint index, GLenum pname, void** pointer) OVERRIDE; +virtual void GetVertexAttribfv(GLuint index, + GLenum pname, + GLfloat* params) OVERRIDE; +virtual void GetVertexAttribiv(GLuint index, + GLenum pname, + GLint* params) OVERRIDE; +virtual void GetVertexAttribPointerv(GLuint index, + GLenum pname, + void** pointer) OVERRIDE; virtual void Hint(GLenum target, GLenum mode) OVERRIDE; virtual GLboolean IsBuffer(GLuint buffer) OVERRIDE; virtual GLboolean IsEnabled(GLenum cap) OVERRIDE; @@ -149,125 +212,182 @@ virtual void LineWidth(GLfloat width) OVERRIDE; virtual void LinkProgram(GLuint program) OVERRIDE; virtual void PixelStorei(GLenum pname, GLint param) OVERRIDE; virtual void PolygonOffset(GLfloat factor, GLfloat units) OVERRIDE; -virtual void ReadPixels( - GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - void* pixels) OVERRIDE; +virtual void ReadPixels(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels) OVERRIDE; virtual void ReleaseShaderCompiler() OVERRIDE; -virtual void RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; +virtual void RenderbufferStorage(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; virtual void SampleCoverage(GLclampf value, GLboolean invert) OVERRIDE; virtual void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; -virtual void ShaderBinary( - GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, - GLsizei length) OVERRIDE; -virtual void ShaderSource( - GLuint shader, GLsizei count, const GLchar* const* str, - const GLint* length) OVERRIDE; +virtual void ShaderBinary(GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length) OVERRIDE; +virtual void ShaderSource(GLuint shader, + GLsizei count, + const GLchar* const* str, + const GLint* length) OVERRIDE; virtual void ShallowFinishCHROMIUM() OVERRIDE; virtual void ShallowFlushCHROMIUM() OVERRIDE; virtual void StencilFunc(GLenum func, GLint ref, GLuint mask) OVERRIDE; -virtual void StencilFuncSeparate( - GLenum face, GLenum func, GLint ref, GLuint mask) OVERRIDE; +virtual void StencilFuncSeparate(GLenum face, + GLenum func, + GLint ref, + GLuint mask) OVERRIDE; virtual void StencilMask(GLuint mask) OVERRIDE; virtual void StencilMaskSeparate(GLenum face, GLuint mask) OVERRIDE; virtual void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) OVERRIDE; -virtual void StencilOpSeparate( - GLenum face, GLenum fail, GLenum zfail, GLenum zpass) OVERRIDE; -virtual void TexImage2D( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) OVERRIDE; -virtual void TexParameterf( - GLenum target, GLenum pname, GLfloat param) OVERRIDE; -virtual void TexParameterfv( - GLenum target, GLenum pname, const GLfloat* params) OVERRIDE; +virtual void StencilOpSeparate(GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass) OVERRIDE; +virtual void TexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; +virtual void TexParameterf(GLenum target, GLenum pname, GLfloat param) OVERRIDE; +virtual void TexParameterfv(GLenum target, + GLenum pname, + const GLfloat* params) OVERRIDE; virtual void TexParameteri(GLenum target, GLenum pname, GLint param) OVERRIDE; -virtual void TexParameteriv( - GLenum target, GLenum pname, const GLint* params) OVERRIDE; -virtual void TexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* pixels) OVERRIDE; +virtual void TexParameteriv(GLenum target, + GLenum pname, + const GLint* params) OVERRIDE; +virtual void TexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; virtual void Uniform1f(GLint location, GLfloat x) OVERRIDE; -virtual void Uniform1fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform1fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform1i(GLint location, GLint x) OVERRIDE; -virtual void Uniform1iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform1iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; virtual void Uniform2f(GLint location, GLfloat x, GLfloat y) OVERRIDE; -virtual void Uniform2fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform2fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform2i(GLint location, GLint x, GLint y) OVERRIDE; -virtual void Uniform2iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void Uniform3f( - GLint location, GLfloat x, GLfloat y, GLfloat z) OVERRIDE; -virtual void Uniform3fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform2iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform3f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z) OVERRIDE; +virtual void Uniform3fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform3i(GLint location, GLint x, GLint y, GLint z) OVERRIDE; -virtual void Uniform3iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void Uniform4f( - GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) OVERRIDE; -virtual void Uniform4fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; -virtual void Uniform4i( - GLint location, GLint x, GLint y, GLint z, GLint w) OVERRIDE; -virtual void Uniform4iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void UniformMatrix2fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; -virtual void UniformMatrix3fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; -virtual void UniformMatrix4fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; +virtual void Uniform3iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform4f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) OVERRIDE; +virtual void Uniform4fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; +virtual void Uniform4i(GLint location, + GLint x, + GLint y, + GLint z, + GLint w) OVERRIDE; +virtual void Uniform4iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void UniformMatrix2fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; +virtual void UniformMatrix3fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; +virtual void UniformMatrix4fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; virtual void UseProgram(GLuint program) OVERRIDE; virtual void ValidateProgram(GLuint program) OVERRIDE; virtual void VertexAttrib1f(GLuint indx, GLfloat x) OVERRIDE; virtual void VertexAttrib1fv(GLuint indx, const GLfloat* values) OVERRIDE; virtual void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) OVERRIDE; virtual void VertexAttrib2fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttrib3f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z) OVERRIDE; +virtual void VertexAttrib3f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z) OVERRIDE; virtual void VertexAttrib3fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttrib4f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) OVERRIDE; +virtual void VertexAttrib4f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) OVERRIDE; virtual void VertexAttrib4fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttribPointer( - GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, - const void* ptr) OVERRIDE; -virtual void Viewport( - GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; -virtual void BlitFramebufferCHROMIUM( - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, - GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, - GLenum filter) OVERRIDE; -virtual void RenderbufferStorageMultisampleCHROMIUM( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; -virtual void RenderbufferStorageMultisampleEXT( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; -virtual void FramebufferTexture2DMultisampleEXT( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLsizei samples) OVERRIDE; -virtual void TexStorage2DEXT( - GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, - GLsizei height) OVERRIDE; +virtual void VertexAttribPointer(GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr) OVERRIDE; +virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; +virtual void BlitFramebufferCHROMIUM(GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) OVERRIDE; +virtual void RenderbufferStorageMultisampleCHROMIUM(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; +virtual void RenderbufferStorageMultisampleEXT(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; +virtual void FramebufferTexture2DMultisampleEXT(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples) OVERRIDE; +virtual void TexStorage2DEXT(GLenum target, + GLsizei levels, + GLenum internalFormat, + GLsizei width, + GLsizei height) OVERRIDE; virtual void GenQueriesEXT(GLsizei n, GLuint* queries) OVERRIDE; virtual void DeleteQueriesEXT(GLsizei n, const GLuint* queries) OVERRIDE; virtual GLboolean IsQueryEXT(GLuint id) OVERRIDE; virtual void BeginQueryEXT(GLenum target, GLuint id) OVERRIDE; virtual void EndQueryEXT(GLenum target) OVERRIDE; -virtual void GetQueryivEXT( - GLenum target, GLenum pname, GLint* params) OVERRIDE; -virtual void GetQueryObjectuivEXT( - GLuint id, GLenum pname, GLuint* params) OVERRIDE; -virtual void InsertEventMarkerEXT( - GLsizei length, const GLchar* marker) OVERRIDE; +virtual void GetQueryivEXT(GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetQueryObjectuivEXT(GLuint id, + GLenum pname, + GLuint* params) OVERRIDE; +virtual void InsertEventMarkerEXT(GLsizei length, + const GLchar* marker) OVERRIDE; virtual void PushGroupMarkerEXT(GLsizei length, const GLchar* marker) OVERRIDE; virtual void PopGroupMarkerEXT() OVERRIDE; virtual void GenVertexArraysOES(GLsizei n, GLuint* arrays) OVERRIDE; @@ -275,84 +395,146 @@ virtual void DeleteVertexArraysOES(GLsizei n, const GLuint* arrays) OVERRIDE; virtual GLboolean IsVertexArrayOES(GLuint array) OVERRIDE; virtual void BindVertexArrayOES(GLuint array) OVERRIDE; virtual void SwapBuffers() OVERRIDE; -virtual GLuint GetMaxValueInBufferCHROMIUM( - GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) OVERRIDE; -virtual void GenSharedIdsCHROMIUM( - GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) OVERRIDE; -virtual void DeleteSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) OVERRIDE; -virtual void RegisterSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) OVERRIDE; +virtual GLuint GetMaxValueInBufferCHROMIUM(GLuint buffer_id, + GLsizei count, + GLenum type, + GLuint offset) OVERRIDE; +virtual void GenSharedIdsCHROMIUM(GLuint namespace_id, + GLuint id_offset, + GLsizei n, + GLuint* ids) OVERRIDE; +virtual void DeleteSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) OVERRIDE; +virtual void RegisterSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) OVERRIDE; virtual GLboolean EnableFeatureCHROMIUM(const char* feature) OVERRIDE; virtual void* MapBufferCHROMIUM(GLuint target, GLenum access) OVERRIDE; virtual GLboolean UnmapBufferCHROMIUM(GLuint target) OVERRIDE; -virtual void* MapImageCHROMIUM(GLuint image_id, GLenum access) OVERRIDE; +virtual void* MapImageCHROMIUM(GLuint image_id) OVERRIDE; virtual void UnmapImageCHROMIUM(GLuint image_id) OVERRIDE; -virtual void* MapBufferSubDataCHROMIUM( - GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) OVERRIDE; +virtual void* MapBufferSubDataCHROMIUM(GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access) OVERRIDE; virtual void UnmapBufferSubDataCHROMIUM(const void* mem) OVERRIDE; -virtual void* MapTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, GLenum access) OVERRIDE; +virtual void* MapTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access) OVERRIDE; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM( - GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; +virtual void ResizeCHROMIUM(GLuint width, + GLuint height, + GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; virtual void RequestExtensionCHROMIUM(const char* extension) OVERRIDE; virtual void RateLimitOffscreenContextCHROMIUM() OVERRIDE; -virtual void GetMultipleIntegervCHROMIUM( - const GLenum* pnames, GLuint count, GLint* results, - GLsizeiptr size) OVERRIDE; -virtual void GetProgramInfoCHROMIUM( - GLuint program, GLsizei bufsize, GLsizei* size, void* info) OVERRIDE; +virtual void GetMultipleIntegervCHROMIUM(const GLenum* pnames, + GLuint count, + GLint* results, + GLsizeiptr size) OVERRIDE; +virtual void GetProgramInfoCHROMIUM(GLuint program, + GLsizei bufsize, + GLsizei* size, + void* info) OVERRIDE; virtual GLuint CreateStreamTextureCHROMIUM(GLuint texture) OVERRIDE; -virtual void DestroyStreamTextureCHROMIUM(GLuint texture) OVERRIDE; -virtual GLuint CreateImageCHROMIUM( - GLsizei width, GLsizei height, GLenum internalformat) OVERRIDE; +virtual GLuint CreateImageCHROMIUM(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) OVERRIDE; virtual void DestroyImageCHROMIUM(GLuint image_id) OVERRIDE; -virtual void GetImageParameterivCHROMIUM( - GLuint image_id, GLenum pname, GLint* params) OVERRIDE; -virtual void GetTranslatedShaderSourceANGLE( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) OVERRIDE; -virtual void PostSubBufferCHROMIUM( - GLint x, GLint y, GLint width, GLint height) OVERRIDE; -virtual void TexImageIOSurface2DCHROMIUM( - GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, - GLuint plane) OVERRIDE; -virtual void CopyTextureCHROMIUM( - GLenum target, GLenum source_id, GLenum dest_id, GLint level, - GLint internalformat, GLenum dest_type) OVERRIDE; -virtual void DrawArraysInstancedANGLE( - GLenum mode, GLint first, GLsizei count, GLsizei primcount) OVERRIDE; -virtual void DrawElementsInstancedANGLE( - GLenum mode, GLsizei count, GLenum type, const void* indices, - GLsizei primcount) OVERRIDE; +virtual void GetImageParameterivCHROMIUM(GLuint image_id, + GLenum pname, + GLint* params) OVERRIDE; +virtual void GetTranslatedShaderSourceANGLE(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) OVERRIDE; +virtual void PostSubBufferCHROMIUM(GLint x, + GLint y, + GLint width, + GLint height) OVERRIDE; +virtual void TexImageIOSurface2DCHROMIUM(GLenum target, + GLsizei width, + GLsizei height, + GLuint ioSurfaceId, + GLuint plane) OVERRIDE; +virtual void CopyTextureCHROMIUM(GLenum target, + GLenum source_id, + GLenum dest_id, + GLint level, + GLint internalformat, + GLenum dest_type) OVERRIDE; +virtual void DrawArraysInstancedANGLE(GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) OVERRIDE; +virtual void DrawElementsInstancedANGLE(GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount) OVERRIDE; virtual void VertexAttribDivisorANGLE(GLuint index, GLuint divisor) OVERRIDE; virtual void GenMailboxCHROMIUM(GLbyte* mailbox) OVERRIDE; -virtual void ProduceTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) OVERRIDE; -virtual void ConsumeTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) OVERRIDE; -virtual void BindUniformLocationCHROMIUM( - GLuint program, GLint location, const char* name) OVERRIDE; +virtual void ProduceTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; +virtual void ProduceTextureDirectCHROMIUM(GLuint texture, + GLenum target, + const GLbyte* mailbox) OVERRIDE; +virtual void ConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; +virtual GLuint CreateAndConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; +virtual void BindUniformLocationCHROMIUM(GLuint program, + GLint location, + const char* name) OVERRIDE; virtual void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) OVERRIDE; virtual void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) OVERRIDE; virtual void TraceBeginCHROMIUM(const char* name) OVERRIDE; virtual void TraceEndCHROMIUM() OVERRIDE; -virtual void AsyncTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* data) OVERRIDE; -virtual void AsyncTexImage2DCHROMIUM( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) OVERRIDE; +virtual void AsyncTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* data) OVERRIDE; +virtual void AsyncTexImage2DCHROMIUM(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) OVERRIDE; -virtual void DiscardFramebufferEXT( - GLenum target, GLsizei count, const GLenum* attachments) OVERRIDE; +virtual void WaitAllAsyncTexImage2DCHROMIUM() OVERRIDE; +virtual void DiscardFramebufferEXT(GLenum target, + GLsizei count, + const GLenum* attachments) OVERRIDE; virtual void LoseContextCHROMIUM(GLenum current, GLenum other) OVERRIDE; virtual GLuint InsertSyncPointCHROMIUM() OVERRIDE; virtual void WaitSyncPointCHROMIUM(GLuint sync_point) OVERRIDE; virtual void DrawBuffersEXT(GLsizei count, const GLenum* bufs) OVERRIDE; virtual void DiscardBackbufferCHROMIUM() OVERRIDE; +virtual void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order, + GLenum plane_transform, + GLuint overlay_texture_id, + GLint bounds_x, + GLint bounds_y, + GLint bounds_width, + GLint bounds_height, + GLfloat uv_x, + GLfloat uv_y, + GLfloat uv_width, + GLfloat uv_height) OVERRIDE; #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h index e6a26d43d40..4e83921be4e 100644 --- a/chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // This file is included by gles2_interface_stub.cc. @@ -12,85 +14,108 @@ void GLES2InterfaceStub::ActiveTexture(GLenum /* texture */) { } -void GLES2InterfaceStub::AttachShader( - GLuint /* program */, GLuint /* shader */) { +void GLES2InterfaceStub::AttachShader(GLuint /* program */, + GLuint /* shader */) { } -void GLES2InterfaceStub::BindAttribLocation( - GLuint /* program */, GLuint /* index */, const char* /* name */) { +void GLES2InterfaceStub::BindAttribLocation(GLuint /* program */, + GLuint /* index */, + const char* /* name */) { } void GLES2InterfaceStub::BindBuffer(GLenum /* target */, GLuint /* buffer */) { } -void GLES2InterfaceStub::BindFramebuffer( - GLenum /* target */, GLuint /* framebuffer */) { +void GLES2InterfaceStub::BindFramebuffer(GLenum /* target */, + GLuint /* framebuffer */) { } -void GLES2InterfaceStub::BindRenderbuffer( - GLenum /* target */, GLuint /* renderbuffer */) { +void GLES2InterfaceStub::BindRenderbuffer(GLenum /* target */, + GLuint /* renderbuffer */) { } -void GLES2InterfaceStub::BindTexture( - GLenum /* target */, GLuint /* texture */) { +void GLES2InterfaceStub::BindTexture(GLenum /* target */, + GLuint /* texture */) { } -void GLES2InterfaceStub::BlendColor( - GLclampf /* red */, GLclampf /* green */, GLclampf /* blue */, - GLclampf /* alpha */) { +void GLES2InterfaceStub::BlendColor(GLclampf /* red */, + GLclampf /* green */, + GLclampf /* blue */, + GLclampf /* alpha */) { } void GLES2InterfaceStub::BlendEquation(GLenum /* mode */) { } -void GLES2InterfaceStub::BlendEquationSeparate( - GLenum /* modeRGB */, GLenum /* modeAlpha */) { +void GLES2InterfaceStub::BlendEquationSeparate(GLenum /* modeRGB */, + GLenum /* modeAlpha */) { } -void GLES2InterfaceStub::BlendFunc( - GLenum /* sfactor */, GLenum /* dfactor */) { +void GLES2InterfaceStub::BlendFunc(GLenum /* sfactor */, GLenum /* dfactor */) { } -void GLES2InterfaceStub::BlendFuncSeparate( - GLenum /* srcRGB */, GLenum /* dstRGB */, GLenum /* srcAlpha */, - GLenum /* dstAlpha */) { +void GLES2InterfaceStub::BlendFuncSeparate(GLenum /* srcRGB */, + GLenum /* dstRGB */, + GLenum /* srcAlpha */, + GLenum /* dstAlpha */) { } -void GLES2InterfaceStub::BufferData( - GLenum /* target */, GLsizeiptr /* size */, const void* /* data */, - GLenum /* usage */) { +void GLES2InterfaceStub::BufferData(GLenum /* target */, + GLsizeiptr /* size */, + const void* /* data */, + GLenum /* usage */) { } -void GLES2InterfaceStub::BufferSubData( - GLenum /* target */, GLintptr /* offset */, GLsizeiptr /* size */, - const void* /* data */) { +void GLES2InterfaceStub::BufferSubData(GLenum /* target */, + GLintptr /* offset */, + GLsizeiptr /* size */, + const void* /* data */) { } GLenum GLES2InterfaceStub::CheckFramebufferStatus(GLenum /* target */) { return 0; } void GLES2InterfaceStub::Clear(GLbitfield /* mask */) { } -void GLES2InterfaceStub::ClearColor( - GLclampf /* red */, GLclampf /* green */, GLclampf /* blue */, - GLclampf /* alpha */) { +void GLES2InterfaceStub::ClearColor(GLclampf /* red */, + GLclampf /* green */, + GLclampf /* blue */, + GLclampf /* alpha */) { } void GLES2InterfaceStub::ClearDepthf(GLclampf /* depth */) { } void GLES2InterfaceStub::ClearStencil(GLint /* s */) { } -void GLES2InterfaceStub::ColorMask( - GLboolean /* red */, GLboolean /* green */, GLboolean /* blue */, - GLboolean /* alpha */) { +void GLES2InterfaceStub::ColorMask(GLboolean /* red */, + GLboolean /* green */, + GLboolean /* blue */, + GLboolean /* alpha */) { } void GLES2InterfaceStub::CompileShader(GLuint /* shader */) { } -void GLES2InterfaceStub::CompressedTexImage2D( - GLenum /* target */, GLint /* level */, GLenum /* internalformat */, - GLsizei /* width */, GLsizei /* height */, GLint /* border */, - GLsizei /* imageSize */, const void* /* data */) { -} -void GLES2InterfaceStub::CompressedTexSubImage2D( - GLenum /* target */, GLint /* level */, GLint /* xoffset */, - GLint /* yoffset */, GLsizei /* width */, GLsizei /* height */, - GLenum /* format */, GLsizei /* imageSize */, const void* /* data */) { -} -void GLES2InterfaceStub::CopyTexImage2D( - GLenum /* target */, GLint /* level */, GLenum /* internalformat */, - GLint /* x */, GLint /* y */, GLsizei /* width */, GLsizei /* height */, - GLint /* border */) { -} -void GLES2InterfaceStub::CopyTexSubImage2D( - GLenum /* target */, GLint /* level */, GLint /* xoffset */, - GLint /* yoffset */, GLint /* x */, GLint /* y */, GLsizei /* width */, - GLsizei /* height */) { +void GLES2InterfaceStub::CompressedTexImage2D(GLenum /* target */, + GLint /* level */, + GLenum /* internalformat */, + GLsizei /* width */, + GLsizei /* height */, + GLint /* border */, + GLsizei /* imageSize */, + const void* /* data */) { +} +void GLES2InterfaceStub::CompressedTexSubImage2D(GLenum /* target */, + GLint /* level */, + GLint /* xoffset */, + GLint /* yoffset */, + GLsizei /* width */, + GLsizei /* height */, + GLenum /* format */, + GLsizei /* imageSize */, + const void* /* data */) { +} +void GLES2InterfaceStub::CopyTexImage2D(GLenum /* target */, + GLint /* level */, + GLenum /* internalformat */, + GLint /* x */, + GLint /* y */, + GLsizei /* width */, + GLsizei /* height */, + GLint /* border */) { +} +void GLES2InterfaceStub::CopyTexSubImage2D(GLenum /* target */, + GLint /* level */, + GLint /* xoffset */, + GLint /* yoffset */, + GLint /* x */, + GLint /* y */, + GLsizei /* width */, + GLsizei /* height */) { } GLuint GLES2InterfaceStub::CreateProgram() { return 0; @@ -100,42 +125,45 @@ GLuint GLES2InterfaceStub::CreateShader(GLenum /* type */) { } void GLES2InterfaceStub::CullFace(GLenum /* mode */) { } -void GLES2InterfaceStub::DeleteBuffers( - GLsizei /* n */, const GLuint* /* buffers */) { +void GLES2InterfaceStub::DeleteBuffers(GLsizei /* n */, + const GLuint* /* buffers */) { } -void GLES2InterfaceStub::DeleteFramebuffers( - GLsizei /* n */, const GLuint* /* framebuffers */) { +void GLES2InterfaceStub::DeleteFramebuffers(GLsizei /* n */, + const GLuint* /* framebuffers */) { } void GLES2InterfaceStub::DeleteProgram(GLuint /* program */) { } void GLES2InterfaceStub::DeleteRenderbuffers( - GLsizei /* n */, const GLuint* /* renderbuffers */) { + GLsizei /* n */, + const GLuint* /* renderbuffers */) { } void GLES2InterfaceStub::DeleteShader(GLuint /* shader */) { } -void GLES2InterfaceStub::DeleteTextures( - GLsizei /* n */, const GLuint* /* textures */) { +void GLES2InterfaceStub::DeleteTextures(GLsizei /* n */, + const GLuint* /* textures */) { } void GLES2InterfaceStub::DepthFunc(GLenum /* func */) { } void GLES2InterfaceStub::DepthMask(GLboolean /* flag */) { } -void GLES2InterfaceStub::DepthRangef( - GLclampf /* zNear */, GLclampf /* zFar */) { +void GLES2InterfaceStub::DepthRangef(GLclampf /* zNear */, + GLclampf /* zFar */) { } -void GLES2InterfaceStub::DetachShader( - GLuint /* program */, GLuint /* shader */) { +void GLES2InterfaceStub::DetachShader(GLuint /* program */, + GLuint /* shader */) { } void GLES2InterfaceStub::Disable(GLenum /* cap */) { } void GLES2InterfaceStub::DisableVertexAttribArray(GLuint /* index */) { } -void GLES2InterfaceStub::DrawArrays( - GLenum /* mode */, GLint /* first */, GLsizei /* count */) { +void GLES2InterfaceStub::DrawArrays(GLenum /* mode */, + GLint /* first */, + GLsizei /* count */) { } -void GLES2InterfaceStub::DrawElements( - GLenum /* mode */, GLsizei /* count */, GLenum /* type */, - const void* /* indices */) { +void GLES2InterfaceStub::DrawElements(GLenum /* mode */, + GLsizei /* count */, + GLenum /* type */, + const void* /* indices */) { } void GLES2InterfaceStub::Enable(GLenum /* cap */) { } @@ -146,12 +174,16 @@ void GLES2InterfaceStub::Finish() { void GLES2InterfaceStub::Flush() { } void GLES2InterfaceStub::FramebufferRenderbuffer( - GLenum /* target */, GLenum /* attachment */, - GLenum /* renderbuffertarget */, GLuint /* renderbuffer */) { + GLenum /* target */, + GLenum /* attachment */, + GLenum /* renderbuffertarget */, + GLuint /* renderbuffer */) { } -void GLES2InterfaceStub::FramebufferTexture2D( - GLenum /* target */, GLenum /* attachment */, GLenum /* textarget */, - GLuint /* texture */, GLint /* level */) { +void GLES2InterfaceStub::FramebufferTexture2D(GLenum /* target */, + GLenum /* attachment */, + GLenum /* textarget */, + GLuint /* texture */, + GLint /* level */) { } void GLES2InterfaceStub::FrontFace(GLenum /* mode */) { } @@ -159,37 +191,45 @@ void GLES2InterfaceStub::GenBuffers(GLsizei /* n */, GLuint* /* buffers */) { } void GLES2InterfaceStub::GenerateMipmap(GLenum /* target */) { } -void GLES2InterfaceStub::GenFramebuffers( - GLsizei /* n */, GLuint* /* framebuffers */) { +void GLES2InterfaceStub::GenFramebuffers(GLsizei /* n */, + GLuint* /* framebuffers */) { } -void GLES2InterfaceStub::GenRenderbuffers( - GLsizei /* n */, GLuint* /* renderbuffers */) { +void GLES2InterfaceStub::GenRenderbuffers(GLsizei /* n */, + GLuint* /* renderbuffers */) { } void GLES2InterfaceStub::GenTextures(GLsizei /* n */, GLuint* /* textures */) { } -void GLES2InterfaceStub::GetActiveAttrib( - GLuint /* program */, GLuint /* index */, GLsizei /* bufsize */, - GLsizei* /* length */, GLint* /* size */, GLenum* /* type */, - char* /* name */) { -} -void GLES2InterfaceStub::GetActiveUniform( - GLuint /* program */, GLuint /* index */, GLsizei /* bufsize */, - GLsizei* /* length */, GLint* /* size */, GLenum* /* type */, - char* /* name */) { -} -void GLES2InterfaceStub::GetAttachedShaders( - GLuint /* program */, GLsizei /* maxcount */, GLsizei* /* count */, - GLuint* /* shaders */) { -} -GLint GLES2InterfaceStub::GetAttribLocation( - GLuint /* program */, const char* /* name */) { +void GLES2InterfaceStub::GetActiveAttrib(GLuint /* program */, + GLuint /* index */, + GLsizei /* bufsize */, + GLsizei* /* length */, + GLint* /* size */, + GLenum* /* type */, + char* /* name */) { +} +void GLES2InterfaceStub::GetActiveUniform(GLuint /* program */, + GLuint /* index */, + GLsizei /* bufsize */, + GLsizei* /* length */, + GLint* /* size */, + GLenum* /* type */, + char* /* name */) { +} +void GLES2InterfaceStub::GetAttachedShaders(GLuint /* program */, + GLsizei /* maxcount */, + GLsizei* /* count */, + GLuint* /* shaders */) { +} +GLint GLES2InterfaceStub::GetAttribLocation(GLuint /* program */, + const char* /* name */) { return 0; } -void GLES2InterfaceStub::GetBooleanv( - GLenum /* pname */, GLboolean* /* params */) { +void GLES2InterfaceStub::GetBooleanv(GLenum /* pname */, + GLboolean* /* params */) { } -void GLES2InterfaceStub::GetBufferParameteriv( - GLenum /* target */, GLenum /* pname */, GLint* /* params */) { +void GLES2InterfaceStub::GetBufferParameteriv(GLenum /* target */, + GLenum /* pname */, + GLint* /* params */) { } GLenum GLES2InterfaceStub::GetError() { return 0; @@ -197,63 +237,79 @@ GLenum GLES2InterfaceStub::GetError() { void GLES2InterfaceStub::GetFloatv(GLenum /* pname */, GLfloat* /* params */) { } void GLES2InterfaceStub::GetFramebufferAttachmentParameteriv( - GLenum /* target */, GLenum /* attachment */, GLenum /* pname */, + GLenum /* target */, + GLenum /* attachment */, + GLenum /* pname */, GLint* /* params */) { } void GLES2InterfaceStub::GetIntegerv(GLenum /* pname */, GLint* /* params */) { } -void GLES2InterfaceStub::GetProgramiv( - GLuint /* program */, GLenum /* pname */, GLint* /* params */) { +void GLES2InterfaceStub::GetProgramiv(GLuint /* program */, + GLenum /* pname */, + GLint* /* params */) { } -void GLES2InterfaceStub::GetProgramInfoLog( - GLuint /* program */, GLsizei /* bufsize */, GLsizei* /* length */, - char* /* infolog */) { +void GLES2InterfaceStub::GetProgramInfoLog(GLuint /* program */, + GLsizei /* bufsize */, + GLsizei* /* length */, + char* /* infolog */) { } -void GLES2InterfaceStub::GetRenderbufferParameteriv( - GLenum /* target */, GLenum /* pname */, GLint* /* params */) { +void GLES2InterfaceStub::GetRenderbufferParameteriv(GLenum /* target */, + GLenum /* pname */, + GLint* /* params */) { } -void GLES2InterfaceStub::GetShaderiv( - GLuint /* shader */, GLenum /* pname */, GLint* /* params */) { +void GLES2InterfaceStub::GetShaderiv(GLuint /* shader */, + GLenum /* pname */, + GLint* /* params */) { } -void GLES2InterfaceStub::GetShaderInfoLog( - GLuint /* shader */, GLsizei /* bufsize */, GLsizei* /* length */, - char* /* infolog */) { +void GLES2InterfaceStub::GetShaderInfoLog(GLuint /* shader */, + GLsizei /* bufsize */, + GLsizei* /* length */, + char* /* infolog */) { } -void GLES2InterfaceStub::GetShaderPrecisionFormat( - GLenum /* shadertype */, GLenum /* precisiontype */, GLint* /* range */, - GLint* /* precision */) { +void GLES2InterfaceStub::GetShaderPrecisionFormat(GLenum /* shadertype */, + GLenum /* precisiontype */, + GLint* /* range */, + GLint* /* precision */) { } -void GLES2InterfaceStub::GetShaderSource( - GLuint /* shader */, GLsizei /* bufsize */, GLsizei* /* length */, - char* /* source */) { +void GLES2InterfaceStub::GetShaderSource(GLuint /* shader */, + GLsizei /* bufsize */, + GLsizei* /* length */, + char* /* source */) { } const GLubyte* GLES2InterfaceStub::GetString(GLenum /* name */) { return 0; } -void GLES2InterfaceStub::GetTexParameterfv( - GLenum /* target */, GLenum /* pname */, GLfloat* /* params */) { +void GLES2InterfaceStub::GetTexParameterfv(GLenum /* target */, + GLenum /* pname */, + GLfloat* /* params */) { } -void GLES2InterfaceStub::GetTexParameteriv( - GLenum /* target */, GLenum /* pname */, GLint* /* params */) { +void GLES2InterfaceStub::GetTexParameteriv(GLenum /* target */, + GLenum /* pname */, + GLint* /* params */) { } -void GLES2InterfaceStub::GetUniformfv( - GLuint /* program */, GLint /* location */, GLfloat* /* params */) { +void GLES2InterfaceStub::GetUniformfv(GLuint /* program */, + GLint /* location */, + GLfloat* /* params */) { } -void GLES2InterfaceStub::GetUniformiv( - GLuint /* program */, GLint /* location */, GLint* /* params */) { +void GLES2InterfaceStub::GetUniformiv(GLuint /* program */, + GLint /* location */, + GLint* /* params */) { } -GLint GLES2InterfaceStub::GetUniformLocation( - GLuint /* program */, const char* /* name */) { +GLint GLES2InterfaceStub::GetUniformLocation(GLuint /* program */, + const char* /* name */) { return 0; } -void GLES2InterfaceStub::GetVertexAttribfv( - GLuint /* index */, GLenum /* pname */, GLfloat* /* params */) { +void GLES2InterfaceStub::GetVertexAttribfv(GLuint /* index */, + GLenum /* pname */, + GLfloat* /* params */) { } -void GLES2InterfaceStub::GetVertexAttribiv( - GLuint /* index */, GLenum /* pname */, GLint* /* params */) { +void GLES2InterfaceStub::GetVertexAttribiv(GLuint /* index */, + GLenum /* pname */, + GLint* /* params */) { } -void GLES2InterfaceStub::GetVertexAttribPointerv( - GLuint /* index */, GLenum /* pname */, void** /* pointer */) { +void GLES2InterfaceStub::GetVertexAttribPointerv(GLuint /* index */, + GLenum /* pname */, + void** /* pointer */) { } void GLES2InterfaceStub::Hint(GLenum /* target */, GLenum /* mode */) { } @@ -284,136 +340,186 @@ void GLES2InterfaceStub::LinkProgram(GLuint /* program */) { } void GLES2InterfaceStub::PixelStorei(GLenum /* pname */, GLint /* param */) { } -void GLES2InterfaceStub::PolygonOffset( - GLfloat /* factor */, GLfloat /* units */) { +void GLES2InterfaceStub::PolygonOffset(GLfloat /* factor */, + GLfloat /* units */) { } -void GLES2InterfaceStub::ReadPixels( - GLint /* x */, GLint /* y */, GLsizei /* width */, GLsizei /* height */, - GLenum /* format */, GLenum /* type */, void* /* pixels */) { +void GLES2InterfaceStub::ReadPixels(GLint /* x */, + GLint /* y */, + GLsizei /* width */, + GLsizei /* height */, + GLenum /* format */, + GLenum /* type */, + void* /* pixels */) { } void GLES2InterfaceStub::ReleaseShaderCompiler() { } -void GLES2InterfaceStub::RenderbufferStorage( - GLenum /* target */, GLenum /* internalformat */, GLsizei /* width */, - GLsizei /* height */) { +void GLES2InterfaceStub::RenderbufferStorage(GLenum /* target */, + GLenum /* internalformat */, + GLsizei /* width */, + GLsizei /* height */) { } -void GLES2InterfaceStub::SampleCoverage( - GLclampf /* value */, GLboolean /* invert */) { +void GLES2InterfaceStub::SampleCoverage(GLclampf /* value */, + GLboolean /* invert */) { } -void GLES2InterfaceStub::Scissor( - GLint /* x */, GLint /* y */, GLsizei /* width */, GLsizei /* height */) { +void GLES2InterfaceStub::Scissor(GLint /* x */, + GLint /* y */, + GLsizei /* width */, + GLsizei /* height */) { } -void GLES2InterfaceStub::ShaderBinary( - GLsizei /* n */, const GLuint* /* shaders */, GLenum /* binaryformat */, - const void* /* binary */, GLsizei /* length */) { +void GLES2InterfaceStub::ShaderBinary(GLsizei /* n */, + const GLuint* /* shaders */, + GLenum /* binaryformat */, + const void* /* binary */, + GLsizei /* length */) { } -void GLES2InterfaceStub::ShaderSource( - GLuint /* shader */, GLsizei /* count */, const GLchar* const* /* str */, - const GLint* /* length */) { +void GLES2InterfaceStub::ShaderSource(GLuint /* shader */, + GLsizei /* count */, + const GLchar* const* /* str */, + const GLint* /* length */) { } void GLES2InterfaceStub::ShallowFinishCHROMIUM() { } void GLES2InterfaceStub::ShallowFlushCHROMIUM() { } -void GLES2InterfaceStub::StencilFunc( - GLenum /* func */, GLint /* ref */, GLuint /* mask */) { +void GLES2InterfaceStub::StencilFunc(GLenum /* func */, + GLint /* ref */, + GLuint /* mask */) { } -void GLES2InterfaceStub::StencilFuncSeparate( - GLenum /* face */, GLenum /* func */, GLint /* ref */, GLuint /* mask */) { +void GLES2InterfaceStub::StencilFuncSeparate(GLenum /* face */, + GLenum /* func */, + GLint /* ref */, + GLuint /* mask */) { } void GLES2InterfaceStub::StencilMask(GLuint /* mask */) { } -void GLES2InterfaceStub::StencilMaskSeparate( - GLenum /* face */, GLuint /* mask */) { -} -void GLES2InterfaceStub::StencilOp( - GLenum /* fail */, GLenum /* zfail */, GLenum /* zpass */) { -} -void GLES2InterfaceStub::StencilOpSeparate( - GLenum /* face */, GLenum /* fail */, GLenum /* zfail */, - GLenum /* zpass */) { -} -void GLES2InterfaceStub::TexImage2D( - GLenum /* target */, GLint /* level */, GLint /* internalformat */, - GLsizei /* width */, GLsizei /* height */, GLint /* border */, - GLenum /* format */, GLenum /* type */, const void* /* pixels */) { -} -void GLES2InterfaceStub::TexParameterf( - GLenum /* target */, GLenum /* pname */, GLfloat /* param */) { -} -void GLES2InterfaceStub::TexParameterfv( - GLenum /* target */, GLenum /* pname */, const GLfloat* /* params */) { -} -void GLES2InterfaceStub::TexParameteri( - GLenum /* target */, GLenum /* pname */, GLint /* param */) { -} -void GLES2InterfaceStub::TexParameteriv( - GLenum /* target */, GLenum /* pname */, const GLint* /* params */) { -} -void GLES2InterfaceStub::TexSubImage2D( - GLenum /* target */, GLint /* level */, GLint /* xoffset */, - GLint /* yoffset */, GLsizei /* width */, GLsizei /* height */, - GLenum /* format */, GLenum /* type */, const void* /* pixels */) { +void GLES2InterfaceStub::StencilMaskSeparate(GLenum /* face */, + GLuint /* mask */) { +} +void GLES2InterfaceStub::StencilOp(GLenum /* fail */, + GLenum /* zfail */, + GLenum /* zpass */) { +} +void GLES2InterfaceStub::StencilOpSeparate(GLenum /* face */, + GLenum /* fail */, + GLenum /* zfail */, + GLenum /* zpass */) { +} +void GLES2InterfaceStub::TexImage2D(GLenum /* target */, + GLint /* level */, + GLint /* internalformat */, + GLsizei /* width */, + GLsizei /* height */, + GLint /* border */, + GLenum /* format */, + GLenum /* type */, + const void* /* pixels */) { +} +void GLES2InterfaceStub::TexParameterf(GLenum /* target */, + GLenum /* pname */, + GLfloat /* param */) { +} +void GLES2InterfaceStub::TexParameterfv(GLenum /* target */, + GLenum /* pname */, + const GLfloat* /* params */) { +} +void GLES2InterfaceStub::TexParameteri(GLenum /* target */, + GLenum /* pname */, + GLint /* param */) { +} +void GLES2InterfaceStub::TexParameteriv(GLenum /* target */, + GLenum /* pname */, + const GLint* /* params */) { +} +void GLES2InterfaceStub::TexSubImage2D(GLenum /* target */, + GLint /* level */, + GLint /* xoffset */, + GLint /* yoffset */, + GLsizei /* width */, + GLsizei /* height */, + GLenum /* format */, + GLenum /* type */, + const void* /* pixels */) { } void GLES2InterfaceStub::Uniform1f(GLint /* location */, GLfloat /* x */) { } -void GLES2InterfaceStub::Uniform1fv( - GLint /* location */, GLsizei /* count */, const GLfloat* /* v */) { +void GLES2InterfaceStub::Uniform1fv(GLint /* location */, + GLsizei /* count */, + const GLfloat* /* v */) { } void GLES2InterfaceStub::Uniform1i(GLint /* location */, GLint /* x */) { } -void GLES2InterfaceStub::Uniform1iv( - GLint /* location */, GLsizei /* count */, const GLint* /* v */) { -} -void GLES2InterfaceStub::Uniform2f( - GLint /* location */, GLfloat /* x */, GLfloat /* y */) { -} -void GLES2InterfaceStub::Uniform2fv( - GLint /* location */, GLsizei /* count */, const GLfloat* /* v */) { -} -void GLES2InterfaceStub::Uniform2i( - GLint /* location */, GLint /* x */, GLint /* y */) { -} -void GLES2InterfaceStub::Uniform2iv( - GLint /* location */, GLsizei /* count */, const GLint* /* v */) { -} -void GLES2InterfaceStub::Uniform3f( - GLint /* location */, GLfloat /* x */, GLfloat /* y */, GLfloat /* z */) { -} -void GLES2InterfaceStub::Uniform3fv( - GLint /* location */, GLsizei /* count */, const GLfloat* /* v */) { -} -void GLES2InterfaceStub::Uniform3i( - GLint /* location */, GLint /* x */, GLint /* y */, GLint /* z */) { -} -void GLES2InterfaceStub::Uniform3iv( - GLint /* location */, GLsizei /* count */, const GLint* /* v */) { -} -void GLES2InterfaceStub::Uniform4f( - GLint /* location */, GLfloat /* x */, GLfloat /* y */, GLfloat /* z */, - GLfloat /* w */) { -} -void GLES2InterfaceStub::Uniform4fv( - GLint /* location */, GLsizei /* count */, const GLfloat* /* v */) { -} -void GLES2InterfaceStub::Uniform4i( - GLint /* location */, GLint /* x */, GLint /* y */, GLint /* z */, - GLint /* w */) { -} -void GLES2InterfaceStub::Uniform4iv( - GLint /* location */, GLsizei /* count */, const GLint* /* v */) { -} -void GLES2InterfaceStub::UniformMatrix2fv( - GLint /* location */, GLsizei /* count */, GLboolean /* transpose */, - const GLfloat* /* value */) { -} -void GLES2InterfaceStub::UniformMatrix3fv( - GLint /* location */, GLsizei /* count */, GLboolean /* transpose */, - const GLfloat* /* value */) { -} -void GLES2InterfaceStub::UniformMatrix4fv( - GLint /* location */, GLsizei /* count */, GLboolean /* transpose */, - const GLfloat* /* value */) { +void GLES2InterfaceStub::Uniform1iv(GLint /* location */, + GLsizei /* count */, + const GLint* /* v */) { +} +void GLES2InterfaceStub::Uniform2f(GLint /* location */, + GLfloat /* x */, + GLfloat /* y */) { +} +void GLES2InterfaceStub::Uniform2fv(GLint /* location */, + GLsizei /* count */, + const GLfloat* /* v */) { +} +void GLES2InterfaceStub::Uniform2i(GLint /* location */, + GLint /* x */, + GLint /* y */) { +} +void GLES2InterfaceStub::Uniform2iv(GLint /* location */, + GLsizei /* count */, + const GLint* /* v */) { +} +void GLES2InterfaceStub::Uniform3f(GLint /* location */, + GLfloat /* x */, + GLfloat /* y */, + GLfloat /* z */) { +} +void GLES2InterfaceStub::Uniform3fv(GLint /* location */, + GLsizei /* count */, + const GLfloat* /* v */) { +} +void GLES2InterfaceStub::Uniform3i(GLint /* location */, + GLint /* x */, + GLint /* y */, + GLint /* z */) { +} +void GLES2InterfaceStub::Uniform3iv(GLint /* location */, + GLsizei /* count */, + const GLint* /* v */) { +} +void GLES2InterfaceStub::Uniform4f(GLint /* location */, + GLfloat /* x */, + GLfloat /* y */, + GLfloat /* z */, + GLfloat /* w */) { +} +void GLES2InterfaceStub::Uniform4fv(GLint /* location */, + GLsizei /* count */, + const GLfloat* /* v */) { +} +void GLES2InterfaceStub::Uniform4i(GLint /* location */, + GLint /* x */, + GLint /* y */, + GLint /* z */, + GLint /* w */) { +} +void GLES2InterfaceStub::Uniform4iv(GLint /* location */, + GLsizei /* count */, + const GLint* /* v */) { +} +void GLES2InterfaceStub::UniformMatrix2fv(GLint /* location */, + GLsizei /* count */, + GLboolean /* transpose */, + const GLfloat* /* value */) { +} +void GLES2InterfaceStub::UniformMatrix3fv(GLint /* location */, + GLsizei /* count */, + GLboolean /* transpose */, + const GLfloat* /* value */) { +} +void GLES2InterfaceStub::UniformMatrix4fv(GLint /* location */, + GLsizei /* count */, + GLboolean /* transpose */, + const GLfloat* /* value */) { } void GLES2InterfaceStub::UseProgram(GLuint /* program */) { } @@ -421,61 +527,88 @@ void GLES2InterfaceStub::ValidateProgram(GLuint /* program */) { } void GLES2InterfaceStub::VertexAttrib1f(GLuint /* indx */, GLfloat /* x */) { } -void GLES2InterfaceStub::VertexAttrib1fv( - GLuint /* indx */, const GLfloat* /* values */) { -} -void GLES2InterfaceStub::VertexAttrib2f( - GLuint /* indx */, GLfloat /* x */, GLfloat /* y */) { -} -void GLES2InterfaceStub::VertexAttrib2fv( - GLuint /* indx */, const GLfloat* /* values */) { -} -void GLES2InterfaceStub::VertexAttrib3f( - GLuint /* indx */, GLfloat /* x */, GLfloat /* y */, GLfloat /* z */) { -} -void GLES2InterfaceStub::VertexAttrib3fv( - GLuint /* indx */, const GLfloat* /* values */) { -} -void GLES2InterfaceStub::VertexAttrib4f( - GLuint /* indx */, GLfloat /* x */, GLfloat /* y */, GLfloat /* z */, - GLfloat /* w */) { -} -void GLES2InterfaceStub::VertexAttrib4fv( - GLuint /* indx */, const GLfloat* /* values */) { -} -void GLES2InterfaceStub::VertexAttribPointer( - GLuint /* indx */, GLint /* size */, GLenum /* type */, - GLboolean /* normalized */, GLsizei /* stride */, const void* /* ptr */) { -} -void GLES2InterfaceStub::Viewport( - GLint /* x */, GLint /* y */, GLsizei /* width */, GLsizei /* height */) { -} -void GLES2InterfaceStub::BlitFramebufferCHROMIUM( - GLint /* srcX0 */, GLint /* srcY0 */, GLint /* srcX1 */, GLint /* srcY1 */, - GLint /* dstX0 */, GLint /* dstY0 */, GLint /* dstX1 */, GLint /* dstY1 */, - GLbitfield /* mask */, GLenum /* filter */) { +void GLES2InterfaceStub::VertexAttrib1fv(GLuint /* indx */, + const GLfloat* /* values */) { +} +void GLES2InterfaceStub::VertexAttrib2f(GLuint /* indx */, + GLfloat /* x */, + GLfloat /* y */) { +} +void GLES2InterfaceStub::VertexAttrib2fv(GLuint /* indx */, + const GLfloat* /* values */) { +} +void GLES2InterfaceStub::VertexAttrib3f(GLuint /* indx */, + GLfloat /* x */, + GLfloat /* y */, + GLfloat /* z */) { +} +void GLES2InterfaceStub::VertexAttrib3fv(GLuint /* indx */, + const GLfloat* /* values */) { +} +void GLES2InterfaceStub::VertexAttrib4f(GLuint /* indx */, + GLfloat /* x */, + GLfloat /* y */, + GLfloat /* z */, + GLfloat /* w */) { +} +void GLES2InterfaceStub::VertexAttrib4fv(GLuint /* indx */, + const GLfloat* /* values */) { +} +void GLES2InterfaceStub::VertexAttribPointer(GLuint /* indx */, + GLint /* size */, + GLenum /* type */, + GLboolean /* normalized */, + GLsizei /* stride */, + const void* /* ptr */) { +} +void GLES2InterfaceStub::Viewport(GLint /* x */, + GLint /* y */, + GLsizei /* width */, + GLsizei /* height */) { +} +void GLES2InterfaceStub::BlitFramebufferCHROMIUM(GLint /* srcX0 */, + GLint /* srcY0 */, + GLint /* srcX1 */, + GLint /* srcY1 */, + GLint /* dstX0 */, + GLint /* dstY0 */, + GLint /* dstX1 */, + GLint /* dstY1 */, + GLbitfield /* mask */, + GLenum /* filter */) { } void GLES2InterfaceStub::RenderbufferStorageMultisampleCHROMIUM( - GLenum /* target */, GLsizei /* samples */, GLenum /* internalformat */, - GLsizei /* width */, GLsizei /* height */) { + GLenum /* target */, + GLsizei /* samples */, + GLenum /* internalformat */, + GLsizei /* width */, + GLsizei /* height */) { } void GLES2InterfaceStub::RenderbufferStorageMultisampleEXT( - GLenum /* target */, GLsizei /* samples */, GLenum /* internalformat */, - GLsizei /* width */, GLsizei /* height */) { + GLenum /* target */, + GLsizei /* samples */, + GLenum /* internalformat */, + GLsizei /* width */, + GLsizei /* height */) { } void GLES2InterfaceStub::FramebufferTexture2DMultisampleEXT( - GLenum /* target */, GLenum /* attachment */, GLenum /* textarget */, - GLuint /* texture */, GLint /* level */, GLsizei /* samples */) { + GLenum /* target */, + GLenum /* attachment */, + GLenum /* textarget */, + GLuint /* texture */, + GLint /* level */, + GLsizei /* samples */) { } -void GLES2InterfaceStub::TexStorage2DEXT( - GLenum /* target */, GLsizei /* levels */, GLenum /* internalFormat */, - GLsizei /* width */, GLsizei /* height */) { +void GLES2InterfaceStub::TexStorage2DEXT(GLenum /* target */, + GLsizei /* levels */, + GLenum /* internalFormat */, + GLsizei /* width */, + GLsizei /* height */) { } -void GLES2InterfaceStub::GenQueriesEXT( - GLsizei /* n */, GLuint* /* queries */) { +void GLES2InterfaceStub::GenQueriesEXT(GLsizei /* n */, GLuint* /* queries */) { } -void GLES2InterfaceStub::DeleteQueriesEXT( - GLsizei /* n */, const GLuint* /* queries */) { +void GLES2InterfaceStub::DeleteQueriesEXT(GLsizei /* n */, + const GLuint* /* queries */) { } GLboolean GLES2InterfaceStub::IsQueryEXT(GLuint /* id */) { return 0; @@ -484,25 +617,27 @@ void GLES2InterfaceStub::BeginQueryEXT(GLenum /* target */, GLuint /* id */) { } void GLES2InterfaceStub::EndQueryEXT(GLenum /* target */) { } -void GLES2InterfaceStub::GetQueryivEXT( - GLenum /* target */, GLenum /* pname */, GLint* /* params */) { +void GLES2InterfaceStub::GetQueryivEXT(GLenum /* target */, + GLenum /* pname */, + GLint* /* params */) { } -void GLES2InterfaceStub::GetQueryObjectuivEXT( - GLuint /* id */, GLenum /* pname */, GLuint* /* params */) { +void GLES2InterfaceStub::GetQueryObjectuivEXT(GLuint /* id */, + GLenum /* pname */, + GLuint* /* params */) { } -void GLES2InterfaceStub::InsertEventMarkerEXT( - GLsizei /* length */, const GLchar* /* marker */) { +void GLES2InterfaceStub::InsertEventMarkerEXT(GLsizei /* length */, + const GLchar* /* marker */) { } -void GLES2InterfaceStub::PushGroupMarkerEXT( - GLsizei /* length */, const GLchar* /* marker */) { +void GLES2InterfaceStub::PushGroupMarkerEXT(GLsizei /* length */, + const GLchar* /* marker */) { } void GLES2InterfaceStub::PopGroupMarkerEXT() { } -void GLES2InterfaceStub::GenVertexArraysOES( - GLsizei /* n */, GLuint* /* arrays */) { +void GLES2InterfaceStub::GenVertexArraysOES(GLsizei /* n */, + GLuint* /* arrays */) { } -void GLES2InterfaceStub::DeleteVertexArraysOES( - GLsizei /* n */, const GLuint* /* arrays */) { +void GLES2InterfaceStub::DeleteVertexArraysOES(GLsizei /* n */, + const GLuint* /* arrays */) { } GLboolean GLES2InterfaceStub::IsVertexArrayOES(GLuint /* array */) { return 0; @@ -511,161 +646,219 @@ void GLES2InterfaceStub::BindVertexArrayOES(GLuint /* array */) { } void GLES2InterfaceStub::SwapBuffers() { } -GLuint GLES2InterfaceStub::GetMaxValueInBufferCHROMIUM( - GLuint /* buffer_id */, GLsizei /* count */, GLenum /* type */, - GLuint /* offset */) { +GLuint GLES2InterfaceStub::GetMaxValueInBufferCHROMIUM(GLuint /* buffer_id */, + GLsizei /* count */, + GLenum /* type */, + GLuint /* offset */) { return 0; } -void GLES2InterfaceStub::GenSharedIdsCHROMIUM( - GLuint /* namespace_id */, GLuint /* id_offset */, GLsizei /* n */, - GLuint* /* ids */) { +void GLES2InterfaceStub::GenSharedIdsCHROMIUM(GLuint /* namespace_id */, + GLuint /* id_offset */, + GLsizei /* n */, + GLuint* /* ids */) { } -void GLES2InterfaceStub::DeleteSharedIdsCHROMIUM( - GLuint /* namespace_id */, GLsizei /* n */, const GLuint* /* ids */) { +void GLES2InterfaceStub::DeleteSharedIdsCHROMIUM(GLuint /* namespace_id */, + GLsizei /* n */, + const GLuint* /* ids */) { } -void GLES2InterfaceStub::RegisterSharedIdsCHROMIUM( - GLuint /* namespace_id */, GLsizei /* n */, const GLuint* /* ids */) { +void GLES2InterfaceStub::RegisterSharedIdsCHROMIUM(GLuint /* namespace_id */, + GLsizei /* n */, + const GLuint* /* ids */) { } -GLboolean GLES2InterfaceStub::EnableFeatureCHROMIUM( - const char* /* feature */) { +GLboolean GLES2InterfaceStub::EnableFeatureCHROMIUM(const char* /* feature */) { return 0; } -void* GLES2InterfaceStub::MapBufferCHROMIUM( - GLuint /* target */, GLenum /* access */) { +void* GLES2InterfaceStub::MapBufferCHROMIUM(GLuint /* target */, + GLenum /* access */) { return 0; } GLboolean GLES2InterfaceStub::UnmapBufferCHROMIUM(GLuint /* target */) { return 0; } -void* GLES2InterfaceStub::MapImageCHROMIUM( - GLuint /* image_id */, GLenum /* access */) { +void* GLES2InterfaceStub::MapImageCHROMIUM(GLuint /* image_id */) { return 0; } void GLES2InterfaceStub::UnmapImageCHROMIUM(GLuint /* image_id */) { } -void* GLES2InterfaceStub::MapBufferSubDataCHROMIUM( - GLuint /* target */, GLintptr /* offset */, GLsizeiptr /* size */, - GLenum /* access */) { +void* GLES2InterfaceStub::MapBufferSubDataCHROMIUM(GLuint /* target */, + GLintptr /* offset */, + GLsizeiptr /* size */, + GLenum /* access */) { return 0; } void GLES2InterfaceStub::UnmapBufferSubDataCHROMIUM(const void* /* mem */) { } -void* GLES2InterfaceStub::MapTexSubImage2DCHROMIUM( - GLenum /* target */, GLint /* level */, GLint /* xoffset */, - GLint /* yoffset */, GLsizei /* width */, GLsizei /* height */, - GLenum /* format */, GLenum /* type */, GLenum /* access */) { +void* GLES2InterfaceStub::MapTexSubImage2DCHROMIUM(GLenum /* target */, + GLint /* level */, + GLint /* xoffset */, + GLint /* yoffset */, + GLsizei /* width */, + GLsizei /* height */, + GLenum /* format */, + GLenum /* type */, + GLenum /* access */) { return 0; } void GLES2InterfaceStub::UnmapTexSubImage2DCHROMIUM(const void* /* mem */) { } -void GLES2InterfaceStub::ResizeCHROMIUM( - GLuint /* width */, GLuint /* height */, GLfloat /* scale_factor */) { +void GLES2InterfaceStub::ResizeCHROMIUM(GLuint /* width */, + GLuint /* height */, + GLfloat /* scale_factor */) { } const GLchar* GLES2InterfaceStub::GetRequestableExtensionsCHROMIUM() { return 0; } -void GLES2InterfaceStub::RequestExtensionCHROMIUM( - const char* /* extension */) { +void GLES2InterfaceStub::RequestExtensionCHROMIUM(const char* /* extension */) { } void GLES2InterfaceStub::RateLimitOffscreenContextCHROMIUM() { } -void GLES2InterfaceStub::GetMultipleIntegervCHROMIUM( - const GLenum* /* pnames */, GLuint /* count */, GLint* /* results */, - GLsizeiptr /* size */) { +void GLES2InterfaceStub::GetMultipleIntegervCHROMIUM(const GLenum* /* pnames */, + GLuint /* count */, + GLint* /* results */, + GLsizeiptr /* size */) { } -void GLES2InterfaceStub::GetProgramInfoCHROMIUM( - GLuint /* program */, GLsizei /* bufsize */, GLsizei* /* size */, - void* /* info */) { +void GLES2InterfaceStub::GetProgramInfoCHROMIUM(GLuint /* program */, + GLsizei /* bufsize */, + GLsizei* /* size */, + void* /* info */) { } GLuint GLES2InterfaceStub::CreateStreamTextureCHROMIUM(GLuint /* texture */) { return 0; } -void GLES2InterfaceStub::DestroyStreamTextureCHROMIUM(GLuint /* texture */) { -} -GLuint GLES2InterfaceStub::CreateImageCHROMIUM( - GLsizei /* width */, GLsizei /* height */, GLenum /* internalformat */) { +GLuint GLES2InterfaceStub::CreateImageCHROMIUM(GLsizei /* width */, + GLsizei /* height */, + GLenum /* internalformat */, + GLenum /* usage */) { return 0; } void GLES2InterfaceStub::DestroyImageCHROMIUM(GLuint /* image_id */) { } -void GLES2InterfaceStub::GetImageParameterivCHROMIUM( - GLuint /* image_id */, GLenum /* pname */, GLint* /* params */) { -} -void GLES2InterfaceStub::GetTranslatedShaderSourceANGLE( - GLuint /* shader */, GLsizei /* bufsize */, GLsizei* /* length */, - char* /* source */) { -} -void GLES2InterfaceStub::PostSubBufferCHROMIUM( - GLint /* x */, GLint /* y */, GLint /* width */, GLint /* height */) { -} -void GLES2InterfaceStub::TexImageIOSurface2DCHROMIUM( - GLenum /* target */, GLsizei /* width */, GLsizei /* height */, - GLuint /* ioSurfaceId */, GLuint /* plane */) { +void GLES2InterfaceStub::GetImageParameterivCHROMIUM(GLuint /* image_id */, + GLenum /* pname */, + GLint* /* params */) { +} +void GLES2InterfaceStub::GetTranslatedShaderSourceANGLE(GLuint /* shader */, + GLsizei /* bufsize */, + GLsizei* /* length */, + char* /* source */) { +} +void GLES2InterfaceStub::PostSubBufferCHROMIUM(GLint /* x */, + GLint /* y */, + GLint /* width */, + GLint /* height */) { +} +void GLES2InterfaceStub::TexImageIOSurface2DCHROMIUM(GLenum /* target */, + GLsizei /* width */, + GLsizei /* height */, + GLuint /* ioSurfaceId */, + GLuint /* plane */) { +} +void GLES2InterfaceStub::CopyTextureCHROMIUM(GLenum /* target */, + GLenum /* source_id */, + GLenum /* dest_id */, + GLint /* level */, + GLint /* internalformat */, + GLenum /* dest_type */) { +} +void GLES2InterfaceStub::DrawArraysInstancedANGLE(GLenum /* mode */, + GLint /* first */, + GLsizei /* count */, + GLsizei /* primcount */) { +} +void GLES2InterfaceStub::DrawElementsInstancedANGLE(GLenum /* mode */, + GLsizei /* count */, + GLenum /* type */, + const void* /* indices */, + GLsizei /* primcount */) { +} +void GLES2InterfaceStub::VertexAttribDivisorANGLE(GLuint /* index */, + GLuint /* divisor */) { } -void GLES2InterfaceStub::CopyTextureCHROMIUM( - GLenum /* target */, GLenum /* source_id */, GLenum /* dest_id */, - GLint /* level */, GLint /* internalformat */, GLenum /* dest_type */) { -} -void GLES2InterfaceStub::DrawArraysInstancedANGLE( - GLenum /* mode */, GLint /* first */, GLsizei /* count */, - GLsizei /* primcount */) { +void GLES2InterfaceStub::GenMailboxCHROMIUM(GLbyte* /* mailbox */) { } -void GLES2InterfaceStub::DrawElementsInstancedANGLE( - GLenum /* mode */, GLsizei /* count */, GLenum /* type */, - const void* /* indices */, GLsizei /* primcount */) { +void GLES2InterfaceStub::ProduceTextureCHROMIUM(GLenum /* target */, + const GLbyte* /* mailbox */) { } -void GLES2InterfaceStub::VertexAttribDivisorANGLE( - GLuint /* index */, GLuint /* divisor */) { +void GLES2InterfaceStub::ProduceTextureDirectCHROMIUM( + GLuint /* texture */, + GLenum /* target */, + const GLbyte* /* mailbox */) { } -void GLES2InterfaceStub::GenMailboxCHROMIUM(GLbyte* /* mailbox */) { +void GLES2InterfaceStub::ConsumeTextureCHROMIUM(GLenum /* target */, + const GLbyte* /* mailbox */) { } -void GLES2InterfaceStub::ProduceTextureCHROMIUM( - GLenum /* target */, const GLbyte* /* mailbox */) { -} -void GLES2InterfaceStub::ConsumeTextureCHROMIUM( - GLenum /* target */, const GLbyte* /* mailbox */) { +GLuint GLES2InterfaceStub::CreateAndConsumeTextureCHROMIUM( + GLenum /* target */, + const GLbyte* /* mailbox */) { + return 0; } -void GLES2InterfaceStub::BindUniformLocationCHROMIUM( - GLuint /* program */, GLint /* location */, const char* /* name */) { +void GLES2InterfaceStub::BindUniformLocationCHROMIUM(GLuint /* program */, + GLint /* location */, + const char* /* name */) { } -void GLES2InterfaceStub::BindTexImage2DCHROMIUM( - GLenum /* target */, GLint /* imageId */) { +void GLES2InterfaceStub::BindTexImage2DCHROMIUM(GLenum /* target */, + GLint /* imageId */) { } -void GLES2InterfaceStub::ReleaseTexImage2DCHROMIUM( - GLenum /* target */, GLint /* imageId */) { +void GLES2InterfaceStub::ReleaseTexImage2DCHROMIUM(GLenum /* target */, + GLint /* imageId */) { } void GLES2InterfaceStub::TraceBeginCHROMIUM(const char* /* name */) { } void GLES2InterfaceStub::TraceEndCHROMIUM() { } -void GLES2InterfaceStub::AsyncTexSubImage2DCHROMIUM( - GLenum /* target */, GLint /* level */, GLint /* xoffset */, - GLint /* yoffset */, GLsizei /* width */, GLsizei /* height */, - GLenum /* format */, GLenum /* type */, const void* /* data */) { -} -void GLES2InterfaceStub::AsyncTexImage2DCHROMIUM( - GLenum /* target */, GLint /* level */, GLint /* internalformat */, - GLsizei /* width */, GLsizei /* height */, GLint /* border */, - GLenum /* format */, GLenum /* type */, const void* /* pixels */) { +void GLES2InterfaceStub::AsyncTexSubImage2DCHROMIUM(GLenum /* target */, + GLint /* level */, + GLint /* xoffset */, + GLint /* yoffset */, + GLsizei /* width */, + GLsizei /* height */, + GLenum /* format */, + GLenum /* type */, + const void* /* data */) { +} +void GLES2InterfaceStub::AsyncTexImage2DCHROMIUM(GLenum /* target */, + GLint /* level */, + GLenum /* internalformat */, + GLsizei /* width */, + GLsizei /* height */, + GLint /* border */, + GLenum /* format */, + GLenum /* type */, + const void* /* pixels */) { } void GLES2InterfaceStub::WaitAsyncTexImage2DCHROMIUM(GLenum /* target */) { } +void GLES2InterfaceStub::WaitAllAsyncTexImage2DCHROMIUM() { +} void GLES2InterfaceStub::DiscardFramebufferEXT( - GLenum /* target */, GLsizei /* count */, + GLenum /* target */, + GLsizei /* count */, const GLenum* /* attachments */) { } -void GLES2InterfaceStub::LoseContextCHROMIUM( - GLenum /* current */, GLenum /* other */) { +void GLES2InterfaceStub::LoseContextCHROMIUM(GLenum /* current */, + GLenum /* other */) { } GLuint GLES2InterfaceStub::InsertSyncPointCHROMIUM() { return 0; } void GLES2InterfaceStub::WaitSyncPointCHROMIUM(GLuint /* sync_point */) { } -void GLES2InterfaceStub::DrawBuffersEXT( - GLsizei /* count */, const GLenum* /* bufs */) { +void GLES2InterfaceStub::DrawBuffersEXT(GLsizei /* count */, + const GLenum* /* bufs */) { } void GLES2InterfaceStub::DiscardBackbufferCHROMIUM() { } +void GLES2InterfaceStub::ScheduleOverlayPlaneCHROMIUM( + GLint /* plane_z_order */, + GLenum /* plane_transform */, + GLuint /* overlay_texture_id */, + GLint /* bounds_x */, + GLint /* bounds_y */, + GLint /* bounds_width */, + GLint /* bounds_height */, + GLfloat /* uv_x */, + GLfloat /* uv_y */, + GLfloat /* uv_width */, + GLfloat /* uv_height */) { +} #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_IMPL_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h index d811db571a8..b40ae9a46a2 100644 --- a/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // This file is included by gles2_trace_implementation.h @@ -12,56 +14,86 @@ virtual void ActiveTexture(GLenum texture) OVERRIDE; virtual void AttachShader(GLuint program, GLuint shader) OVERRIDE; -virtual void BindAttribLocation( - GLuint program, GLuint index, const char* name) OVERRIDE; +virtual void BindAttribLocation(GLuint program, + GLuint index, + const char* name) OVERRIDE; virtual void BindBuffer(GLenum target, GLuint buffer) OVERRIDE; virtual void BindFramebuffer(GLenum target, GLuint framebuffer) OVERRIDE; virtual void BindRenderbuffer(GLenum target, GLuint renderbuffer) OVERRIDE; virtual void BindTexture(GLenum target, GLuint texture) OVERRIDE; -virtual void BlendColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) OVERRIDE; +virtual void BlendColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) OVERRIDE; virtual void BlendEquation(GLenum mode) OVERRIDE; virtual void BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) OVERRIDE; virtual void BlendFunc(GLenum sfactor, GLenum dfactor) OVERRIDE; -virtual void BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) OVERRIDE; -virtual void BufferData( - GLenum target, GLsizeiptr size, const void* data, GLenum usage) OVERRIDE; -virtual void BufferSubData( - GLenum target, GLintptr offset, GLsizeiptr size, - const void* data) OVERRIDE; +virtual void BlendFuncSeparate(GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) OVERRIDE; +virtual void BufferData(GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage) OVERRIDE; +virtual void BufferSubData(GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data) OVERRIDE; virtual GLenum CheckFramebufferStatus(GLenum target) OVERRIDE; virtual void Clear(GLbitfield mask) OVERRIDE; -virtual void ClearColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) OVERRIDE; +virtual void ClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) OVERRIDE; virtual void ClearDepthf(GLclampf depth) OVERRIDE; virtual void ClearStencil(GLint s) OVERRIDE; -virtual void ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) OVERRIDE; +virtual void ColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) OVERRIDE; virtual void CompileShader(GLuint shader) OVERRIDE; -virtual void CompressedTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, GLsizei imageSize, - const void* data) OVERRIDE; -virtual void CompressedTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLsizei imageSize, - const void* data) OVERRIDE; -virtual void CopyTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border) OVERRIDE; -virtual void CopyTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height) OVERRIDE; +virtual void CompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data) OVERRIDE; +virtual void CompressedTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data) OVERRIDE; +virtual void CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) OVERRIDE; +virtual void CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) OVERRIDE; virtual GLuint CreateProgram() OVERRIDE; virtual GLuint CreateShader(GLenum type) OVERRIDE; virtual void CullFace(GLenum mode) OVERRIDE; virtual void DeleteBuffers(GLsizei n, const GLuint* buffers) OVERRIDE; -virtual void DeleteFramebuffers( - GLsizei n, const GLuint* framebuffers) OVERRIDE; +virtual void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) OVERRIDE; virtual void DeleteProgram(GLuint program) OVERRIDE; -virtual void DeleteRenderbuffers( - GLsizei n, const GLuint* renderbuffers) OVERRIDE; +virtual void DeleteRenderbuffers(GLsizei n, + const GLuint* renderbuffers) OVERRIDE; virtual void DeleteShader(GLuint shader) OVERRIDE; virtual void DeleteTextures(GLsizei n, const GLuint* textures) OVERRIDE; virtual void DepthFunc(GLenum func) OVERRIDE; @@ -71,72 +103,103 @@ virtual void DetachShader(GLuint program, GLuint shader) OVERRIDE; virtual void Disable(GLenum cap) OVERRIDE; virtual void DisableVertexAttribArray(GLuint index) OVERRIDE; virtual void DrawArrays(GLenum mode, GLint first, GLsizei count) OVERRIDE; -virtual void DrawElements( - GLenum mode, GLsizei count, GLenum type, const void* indices) OVERRIDE; +virtual void DrawElements(GLenum mode, + GLsizei count, + GLenum type, + const void* indices) OVERRIDE; virtual void Enable(GLenum cap) OVERRIDE; virtual void EnableVertexAttribArray(GLuint index) OVERRIDE; virtual void Finish() OVERRIDE; virtual void Flush() OVERRIDE; -virtual void FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, - GLuint renderbuffer) OVERRIDE; -virtual void FramebufferTexture2D( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level) OVERRIDE; +virtual void FramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) OVERRIDE; +virtual void FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) OVERRIDE; virtual void FrontFace(GLenum mode) OVERRIDE; virtual void GenBuffers(GLsizei n, GLuint* buffers) OVERRIDE; virtual void GenerateMipmap(GLenum target) OVERRIDE; virtual void GenFramebuffers(GLsizei n, GLuint* framebuffers) OVERRIDE; virtual void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) OVERRIDE; virtual void GenTextures(GLsizei n, GLuint* textures) OVERRIDE; -virtual void GetActiveAttrib( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) OVERRIDE; -virtual void GetActiveUniform( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) OVERRIDE; -virtual void GetAttachedShaders( - GLuint program, GLsizei maxcount, GLsizei* count, - GLuint* shaders) OVERRIDE; +virtual void GetActiveAttrib(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) OVERRIDE; +virtual void GetActiveUniform(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) OVERRIDE; +virtual void GetAttachedShaders(GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders) OVERRIDE; virtual GLint GetAttribLocation(GLuint program, const char* name) OVERRIDE; virtual void GetBooleanv(GLenum pname, GLboolean* params) OVERRIDE; -virtual void GetBufferParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetBufferParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; virtual GLenum GetError() OVERRIDE; virtual void GetFloatv(GLenum pname, GLfloat* params) OVERRIDE; -virtual void GetFramebufferAttachmentParameteriv( - GLenum target, GLenum attachment, GLenum pname, GLint* params) OVERRIDE; +virtual void GetFramebufferAttachmentParameteriv(GLenum target, + GLenum attachment, + GLenum pname, + GLint* params) OVERRIDE; virtual void GetIntegerv(GLenum pname, GLint* params) OVERRIDE; -virtual void GetProgramiv( - GLuint program, GLenum pname, GLint* params) OVERRIDE; -virtual void GetProgramInfoLog( - GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) OVERRIDE; -virtual void GetRenderbufferParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetProgramiv(GLuint program, GLenum pname, GLint* params) OVERRIDE; +virtual void GetProgramInfoLog(GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog) OVERRIDE; +virtual void GetRenderbufferParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; virtual void GetShaderiv(GLuint shader, GLenum pname, GLint* params) OVERRIDE; -virtual void GetShaderInfoLog( - GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) OVERRIDE; -virtual void GetShaderPrecisionFormat( - GLenum shadertype, GLenum precisiontype, GLint* range, - GLint* precision) OVERRIDE; -virtual void GetShaderSource( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) OVERRIDE; +virtual void GetShaderInfoLog(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog) OVERRIDE; +virtual void GetShaderPrecisionFormat(GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision) OVERRIDE; +virtual void GetShaderSource(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) OVERRIDE; virtual const GLubyte* GetString(GLenum name) OVERRIDE; -virtual void GetTexParameterfv( - GLenum target, GLenum pname, GLfloat* params) OVERRIDE; -virtual void GetTexParameteriv( - GLenum target, GLenum pname, GLint* params) OVERRIDE; -virtual void GetUniformfv( - GLuint program, GLint location, GLfloat* params) OVERRIDE; -virtual void GetUniformiv( - GLuint program, GLint location, GLint* params) OVERRIDE; +virtual void GetTexParameterfv(GLenum target, + GLenum pname, + GLfloat* params) OVERRIDE; +virtual void GetTexParameteriv(GLenum target, + GLenum pname, + GLint* params) OVERRIDE; +virtual void GetUniformfv(GLuint program, + GLint location, + GLfloat* params) OVERRIDE; +virtual void GetUniformiv(GLuint program, + GLint location, + GLint* params) OVERRIDE; virtual GLint GetUniformLocation(GLuint program, const char* name) OVERRIDE; -virtual void GetVertexAttribfv( - GLuint index, GLenum pname, GLfloat* params) OVERRIDE; -virtual void GetVertexAttribiv( - GLuint index, GLenum pname, GLint* params) OVERRIDE; -virtual void GetVertexAttribPointerv( - GLuint index, GLenum pname, void** pointer) OVERRIDE; +virtual void GetVertexAttribfv(GLuint index, + GLenum pname, + GLfloat* params) OVERRIDE; +virtual void GetVertexAttribiv(GLuint index, + GLenum pname, + GLint* params) OVERRIDE; +virtual void GetVertexAttribPointerv(GLuint index, + GLenum pname, + void** pointer) OVERRIDE; virtual void Hint(GLenum target, GLenum mode) OVERRIDE; virtual GLboolean IsBuffer(GLuint buffer) OVERRIDE; virtual GLboolean IsEnabled(GLenum cap) OVERRIDE; @@ -149,125 +212,182 @@ virtual void LineWidth(GLfloat width) OVERRIDE; virtual void LinkProgram(GLuint program) OVERRIDE; virtual void PixelStorei(GLenum pname, GLint param) OVERRIDE; virtual void PolygonOffset(GLfloat factor, GLfloat units) OVERRIDE; -virtual void ReadPixels( - GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - void* pixels) OVERRIDE; +virtual void ReadPixels(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels) OVERRIDE; virtual void ReleaseShaderCompiler() OVERRIDE; -virtual void RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; +virtual void RenderbufferStorage(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; virtual void SampleCoverage(GLclampf value, GLboolean invert) OVERRIDE; virtual void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; -virtual void ShaderBinary( - GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, - GLsizei length) OVERRIDE; -virtual void ShaderSource( - GLuint shader, GLsizei count, const GLchar* const* str, - const GLint* length) OVERRIDE; +virtual void ShaderBinary(GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length) OVERRIDE; +virtual void ShaderSource(GLuint shader, + GLsizei count, + const GLchar* const* str, + const GLint* length) OVERRIDE; virtual void ShallowFinishCHROMIUM() OVERRIDE; virtual void ShallowFlushCHROMIUM() OVERRIDE; virtual void StencilFunc(GLenum func, GLint ref, GLuint mask) OVERRIDE; -virtual void StencilFuncSeparate( - GLenum face, GLenum func, GLint ref, GLuint mask) OVERRIDE; +virtual void StencilFuncSeparate(GLenum face, + GLenum func, + GLint ref, + GLuint mask) OVERRIDE; virtual void StencilMask(GLuint mask) OVERRIDE; virtual void StencilMaskSeparate(GLenum face, GLuint mask) OVERRIDE; virtual void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) OVERRIDE; -virtual void StencilOpSeparate( - GLenum face, GLenum fail, GLenum zfail, GLenum zpass) OVERRIDE; -virtual void TexImage2D( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) OVERRIDE; -virtual void TexParameterf( - GLenum target, GLenum pname, GLfloat param) OVERRIDE; -virtual void TexParameterfv( - GLenum target, GLenum pname, const GLfloat* params) OVERRIDE; +virtual void StencilOpSeparate(GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass) OVERRIDE; +virtual void TexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; +virtual void TexParameterf(GLenum target, GLenum pname, GLfloat param) OVERRIDE; +virtual void TexParameterfv(GLenum target, + GLenum pname, + const GLfloat* params) OVERRIDE; virtual void TexParameteri(GLenum target, GLenum pname, GLint param) OVERRIDE; -virtual void TexParameteriv( - GLenum target, GLenum pname, const GLint* params) OVERRIDE; -virtual void TexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* pixels) OVERRIDE; +virtual void TexParameteriv(GLenum target, + GLenum pname, + const GLint* params) OVERRIDE; +virtual void TexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; virtual void Uniform1f(GLint location, GLfloat x) OVERRIDE; -virtual void Uniform1fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform1fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform1i(GLint location, GLint x) OVERRIDE; -virtual void Uniform1iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform1iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; virtual void Uniform2f(GLint location, GLfloat x, GLfloat y) OVERRIDE; -virtual void Uniform2fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform2fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform2i(GLint location, GLint x, GLint y) OVERRIDE; -virtual void Uniform2iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void Uniform3f( - GLint location, GLfloat x, GLfloat y, GLfloat z) OVERRIDE; -virtual void Uniform3fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; +virtual void Uniform2iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform3f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z) OVERRIDE; +virtual void Uniform3fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; virtual void Uniform3i(GLint location, GLint x, GLint y, GLint z) OVERRIDE; -virtual void Uniform3iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void Uniform4f( - GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) OVERRIDE; -virtual void Uniform4fv( - GLint location, GLsizei count, const GLfloat* v) OVERRIDE; -virtual void Uniform4i( - GLint location, GLint x, GLint y, GLint z, GLint w) OVERRIDE; -virtual void Uniform4iv( - GLint location, GLsizei count, const GLint* v) OVERRIDE; -virtual void UniformMatrix2fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; -virtual void UniformMatrix3fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; -virtual void UniformMatrix4fv( - GLint location, GLsizei count, GLboolean transpose, - const GLfloat* value) OVERRIDE; +virtual void Uniform3iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void Uniform4f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) OVERRIDE; +virtual void Uniform4fv(GLint location, + GLsizei count, + const GLfloat* v) OVERRIDE; +virtual void Uniform4i(GLint location, + GLint x, + GLint y, + GLint z, + GLint w) OVERRIDE; +virtual void Uniform4iv(GLint location, GLsizei count, const GLint* v) OVERRIDE; +virtual void UniformMatrix2fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; +virtual void UniformMatrix3fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; +virtual void UniformMatrix4fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) OVERRIDE; virtual void UseProgram(GLuint program) OVERRIDE; virtual void ValidateProgram(GLuint program) OVERRIDE; virtual void VertexAttrib1f(GLuint indx, GLfloat x) OVERRIDE; virtual void VertexAttrib1fv(GLuint indx, const GLfloat* values) OVERRIDE; virtual void VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) OVERRIDE; virtual void VertexAttrib2fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttrib3f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z) OVERRIDE; +virtual void VertexAttrib3f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z) OVERRIDE; virtual void VertexAttrib3fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttrib4f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) OVERRIDE; +virtual void VertexAttrib4f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) OVERRIDE; virtual void VertexAttrib4fv(GLuint indx, const GLfloat* values) OVERRIDE; -virtual void VertexAttribPointer( - GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, - const void* ptr) OVERRIDE; -virtual void Viewport( - GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; -virtual void BlitFramebufferCHROMIUM( - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, - GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, - GLenum filter) OVERRIDE; -virtual void RenderbufferStorageMultisampleCHROMIUM( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; -virtual void RenderbufferStorageMultisampleEXT( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, - GLsizei height) OVERRIDE; -virtual void FramebufferTexture2DMultisampleEXT( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLsizei samples) OVERRIDE; -virtual void TexStorage2DEXT( - GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, - GLsizei height) OVERRIDE; +virtual void VertexAttribPointer(GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr) OVERRIDE; +virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) OVERRIDE; +virtual void BlitFramebufferCHROMIUM(GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) OVERRIDE; +virtual void RenderbufferStorageMultisampleCHROMIUM(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; +virtual void RenderbufferStorageMultisampleEXT(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height) OVERRIDE; +virtual void FramebufferTexture2DMultisampleEXT(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples) OVERRIDE; +virtual void TexStorage2DEXT(GLenum target, + GLsizei levels, + GLenum internalFormat, + GLsizei width, + GLsizei height) OVERRIDE; virtual void GenQueriesEXT(GLsizei n, GLuint* queries) OVERRIDE; virtual void DeleteQueriesEXT(GLsizei n, const GLuint* queries) OVERRIDE; virtual GLboolean IsQueryEXT(GLuint id) OVERRIDE; virtual void BeginQueryEXT(GLenum target, GLuint id) OVERRIDE; virtual void EndQueryEXT(GLenum target) OVERRIDE; -virtual void GetQueryivEXT( - GLenum target, GLenum pname, GLint* params) OVERRIDE; -virtual void GetQueryObjectuivEXT( - GLuint id, GLenum pname, GLuint* params) OVERRIDE; -virtual void InsertEventMarkerEXT( - GLsizei length, const GLchar* marker) OVERRIDE; +virtual void GetQueryivEXT(GLenum target, GLenum pname, GLint* params) OVERRIDE; +virtual void GetQueryObjectuivEXT(GLuint id, + GLenum pname, + GLuint* params) OVERRIDE; +virtual void InsertEventMarkerEXT(GLsizei length, + const GLchar* marker) OVERRIDE; virtual void PushGroupMarkerEXT(GLsizei length, const GLchar* marker) OVERRIDE; virtual void PopGroupMarkerEXT() OVERRIDE; virtual void GenVertexArraysOES(GLsizei n, GLuint* arrays) OVERRIDE; @@ -275,84 +395,146 @@ virtual void DeleteVertexArraysOES(GLsizei n, const GLuint* arrays) OVERRIDE; virtual GLboolean IsVertexArrayOES(GLuint array) OVERRIDE; virtual void BindVertexArrayOES(GLuint array) OVERRIDE; virtual void SwapBuffers() OVERRIDE; -virtual GLuint GetMaxValueInBufferCHROMIUM( - GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) OVERRIDE; -virtual void GenSharedIdsCHROMIUM( - GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) OVERRIDE; -virtual void DeleteSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) OVERRIDE; -virtual void RegisterSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) OVERRIDE; +virtual GLuint GetMaxValueInBufferCHROMIUM(GLuint buffer_id, + GLsizei count, + GLenum type, + GLuint offset) OVERRIDE; +virtual void GenSharedIdsCHROMIUM(GLuint namespace_id, + GLuint id_offset, + GLsizei n, + GLuint* ids) OVERRIDE; +virtual void DeleteSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) OVERRIDE; +virtual void RegisterSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) OVERRIDE; virtual GLboolean EnableFeatureCHROMIUM(const char* feature) OVERRIDE; virtual void* MapBufferCHROMIUM(GLuint target, GLenum access) OVERRIDE; virtual GLboolean UnmapBufferCHROMIUM(GLuint target) OVERRIDE; -virtual void* MapImageCHROMIUM(GLuint image_id, GLenum access) OVERRIDE; +virtual void* MapImageCHROMIUM(GLuint image_id) OVERRIDE; virtual void UnmapImageCHROMIUM(GLuint image_id) OVERRIDE; -virtual void* MapBufferSubDataCHROMIUM( - GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) OVERRIDE; +virtual void* MapBufferSubDataCHROMIUM(GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access) OVERRIDE; virtual void UnmapBufferSubDataCHROMIUM(const void* mem) OVERRIDE; -virtual void* MapTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, GLenum access) OVERRIDE; +virtual void* MapTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access) OVERRIDE; virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; -virtual void ResizeCHROMIUM( - GLuint width, GLuint height, GLfloat scale_factor) OVERRIDE; +virtual void ResizeCHROMIUM(GLuint width, + GLuint height, + GLfloat scale_factor) OVERRIDE; virtual const GLchar* GetRequestableExtensionsCHROMIUM() OVERRIDE; virtual void RequestExtensionCHROMIUM(const char* extension) OVERRIDE; virtual void RateLimitOffscreenContextCHROMIUM() OVERRIDE; -virtual void GetMultipleIntegervCHROMIUM( - const GLenum* pnames, GLuint count, GLint* results, - GLsizeiptr size) OVERRIDE; -virtual void GetProgramInfoCHROMIUM( - GLuint program, GLsizei bufsize, GLsizei* size, void* info) OVERRIDE; +virtual void GetMultipleIntegervCHROMIUM(const GLenum* pnames, + GLuint count, + GLint* results, + GLsizeiptr size) OVERRIDE; +virtual void GetProgramInfoCHROMIUM(GLuint program, + GLsizei bufsize, + GLsizei* size, + void* info) OVERRIDE; virtual GLuint CreateStreamTextureCHROMIUM(GLuint texture) OVERRIDE; -virtual void DestroyStreamTextureCHROMIUM(GLuint texture) OVERRIDE; -virtual GLuint CreateImageCHROMIUM( - GLsizei width, GLsizei height, GLenum internalformat) OVERRIDE; +virtual GLuint CreateImageCHROMIUM(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) OVERRIDE; virtual void DestroyImageCHROMIUM(GLuint image_id) OVERRIDE; -virtual void GetImageParameterivCHROMIUM( - GLuint image_id, GLenum pname, GLint* params) OVERRIDE; -virtual void GetTranslatedShaderSourceANGLE( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) OVERRIDE; -virtual void PostSubBufferCHROMIUM( - GLint x, GLint y, GLint width, GLint height) OVERRIDE; -virtual void TexImageIOSurface2DCHROMIUM( - GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, - GLuint plane) OVERRIDE; -virtual void CopyTextureCHROMIUM( - GLenum target, GLenum source_id, GLenum dest_id, GLint level, - GLint internalformat, GLenum dest_type) OVERRIDE; -virtual void DrawArraysInstancedANGLE( - GLenum mode, GLint first, GLsizei count, GLsizei primcount) OVERRIDE; -virtual void DrawElementsInstancedANGLE( - GLenum mode, GLsizei count, GLenum type, const void* indices, - GLsizei primcount) OVERRIDE; +virtual void GetImageParameterivCHROMIUM(GLuint image_id, + GLenum pname, + GLint* params) OVERRIDE; +virtual void GetTranslatedShaderSourceANGLE(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) OVERRIDE; +virtual void PostSubBufferCHROMIUM(GLint x, + GLint y, + GLint width, + GLint height) OVERRIDE; +virtual void TexImageIOSurface2DCHROMIUM(GLenum target, + GLsizei width, + GLsizei height, + GLuint ioSurfaceId, + GLuint plane) OVERRIDE; +virtual void CopyTextureCHROMIUM(GLenum target, + GLenum source_id, + GLenum dest_id, + GLint level, + GLint internalformat, + GLenum dest_type) OVERRIDE; +virtual void DrawArraysInstancedANGLE(GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) OVERRIDE; +virtual void DrawElementsInstancedANGLE(GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount) OVERRIDE; virtual void VertexAttribDivisorANGLE(GLuint index, GLuint divisor) OVERRIDE; virtual void GenMailboxCHROMIUM(GLbyte* mailbox) OVERRIDE; -virtual void ProduceTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) OVERRIDE; -virtual void ConsumeTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) OVERRIDE; -virtual void BindUniformLocationCHROMIUM( - GLuint program, GLint location, const char* name) OVERRIDE; +virtual void ProduceTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; +virtual void ProduceTextureDirectCHROMIUM(GLuint texture, + GLenum target, + const GLbyte* mailbox) OVERRIDE; +virtual void ConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; +virtual GLuint CreateAndConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) OVERRIDE; +virtual void BindUniformLocationCHROMIUM(GLuint program, + GLint location, + const char* name) OVERRIDE; virtual void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) OVERRIDE; virtual void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) OVERRIDE; virtual void TraceBeginCHROMIUM(const char* name) OVERRIDE; virtual void TraceEndCHROMIUM() OVERRIDE; -virtual void AsyncTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* data) OVERRIDE; -virtual void AsyncTexImage2DCHROMIUM( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) OVERRIDE; +virtual void AsyncTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* data) OVERRIDE; +virtual void AsyncTexImage2DCHROMIUM(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) OVERRIDE; virtual void WaitAsyncTexImage2DCHROMIUM(GLenum target) OVERRIDE; -virtual void DiscardFramebufferEXT( - GLenum target, GLsizei count, const GLenum* attachments) OVERRIDE; +virtual void WaitAllAsyncTexImage2DCHROMIUM() OVERRIDE; +virtual void DiscardFramebufferEXT(GLenum target, + GLsizei count, + const GLenum* attachments) OVERRIDE; virtual void LoseContextCHROMIUM(GLenum current, GLenum other) OVERRIDE; virtual GLuint InsertSyncPointCHROMIUM() OVERRIDE; virtual void WaitSyncPointCHROMIUM(GLuint sync_point) OVERRIDE; virtual void DrawBuffersEXT(GLsizei count, const GLenum* bufs) OVERRIDE; virtual void DiscardBackbufferCHROMIUM() OVERRIDE; +virtual void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order, + GLenum plane_transform, + GLuint overlay_texture_id, + GLint bounds_x, + GLint bounds_y, + GLint bounds_width, + GLint bounds_height, + GLfloat uv_x, + GLfloat uv_y, + GLfloat uv_width, + GLfloat uv_height) OVERRIDE; #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_AUTOGEN_H_ - diff --git a/chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h index 49d7ab2a947..ec4a365b7a3 100644 --- a/chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h @@ -1,9 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 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 auto-generated from // gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename // DO NOT EDIT! // This file is included by gles2_trace_implementation.cc @@ -20,8 +22,9 @@ void GLES2TraceImplementation::AttachShader(GLuint program, GLuint shader) { gl_->AttachShader(program, shader); } -void GLES2TraceImplementation::BindAttribLocation( - GLuint program, GLuint index, const char* name) { +void GLES2TraceImplementation::BindAttribLocation(GLuint program, + GLuint index, + const char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BindAttribLocation"); gl_->BindAttribLocation(program, index, name); } @@ -31,14 +34,14 @@ void GLES2TraceImplementation::BindBuffer(GLenum target, GLuint buffer) { gl_->BindBuffer(target, buffer); } -void GLES2TraceImplementation::BindFramebuffer( - GLenum target, GLuint framebuffer) { +void GLES2TraceImplementation::BindFramebuffer(GLenum target, + GLuint framebuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BindFramebuffer"); gl_->BindFramebuffer(target, framebuffer); } -void GLES2TraceImplementation::BindRenderbuffer( - GLenum target, GLuint renderbuffer) { +void GLES2TraceImplementation::BindRenderbuffer(GLenum target, + GLuint renderbuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BindRenderbuffer"); gl_->BindRenderbuffer(target, renderbuffer); } @@ -48,8 +51,10 @@ void GLES2TraceImplementation::BindTexture(GLenum target, GLuint texture) { gl_->BindTexture(target, texture); } -void GLES2TraceImplementation::BlendColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { +void GLES2TraceImplementation::BlendColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlendColor"); gl_->BlendColor(red, green, blue, alpha); } @@ -59,8 +64,8 @@ void GLES2TraceImplementation::BlendEquation(GLenum mode) { gl_->BlendEquation(mode); } -void GLES2TraceImplementation::BlendEquationSeparate( - GLenum modeRGB, GLenum modeAlpha) { +void GLES2TraceImplementation::BlendEquationSeparate(GLenum modeRGB, + GLenum modeAlpha) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlendEquationSeparate"); gl_->BlendEquationSeparate(modeRGB, modeAlpha); } @@ -70,20 +75,26 @@ void GLES2TraceImplementation::BlendFunc(GLenum sfactor, GLenum dfactor) { gl_->BlendFunc(sfactor, dfactor); } -void GLES2TraceImplementation::BlendFuncSeparate( - GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { +void GLES2TraceImplementation::BlendFuncSeparate(GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlendFuncSeparate"); gl_->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } -void GLES2TraceImplementation::BufferData( - GLenum target, GLsizeiptr size, const void* data, GLenum usage) { +void GLES2TraceImplementation::BufferData(GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BufferData"); gl_->BufferData(target, size, data, usage); } -void GLES2TraceImplementation::BufferSubData( - GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { +void GLES2TraceImplementation::BufferSubData(GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BufferSubData"); gl_->BufferSubData(target, offset, size, data); } @@ -98,8 +109,10 @@ void GLES2TraceImplementation::Clear(GLbitfield mask) { gl_->Clear(mask); } -void GLES2TraceImplementation::ClearColor( - GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { +void GLES2TraceImplementation::ClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ClearColor"); gl_->ClearColor(red, green, blue, alpha); } @@ -114,8 +127,10 @@ void GLES2TraceImplementation::ClearStencil(GLint s) { gl_->ClearStencil(s); } -void GLES2TraceImplementation::ColorMask( - GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { +void GLES2TraceImplementation::ColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ColorMask"); gl_->ColorMask(red, green, blue, alpha); } @@ -125,33 +140,54 @@ void GLES2TraceImplementation::CompileShader(GLuint shader) { gl_->CompileShader(shader); } -void GLES2TraceImplementation::CompressedTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLsizei width, - GLsizei height, GLint border, GLsizei imageSize, const void* data) { +void GLES2TraceImplementation::CompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CompressedTexImage2D"); gl_->CompressedTexImage2D( target, level, internalformat, width, height, border, imageSize, data); } -void GLES2TraceImplementation::CompressedTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLsizei imageSize, const void* data) { +void GLES2TraceImplementation::CompressedTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CompressedTexSubImage2D"); gl_->CompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, imageSize, data); } -void GLES2TraceImplementation::CopyTexImage2D( - GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, - GLsizei width, GLsizei height, GLint border) { +void GLES2TraceImplementation::CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CopyTexImage2D"); gl_->CopyTexImage2D( target, level, internalformat, x, y, width, height, border); } -void GLES2TraceImplementation::CopyTexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, - GLsizei width, GLsizei height) { +void GLES2TraceImplementation::CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CopyTexSubImage2D"); gl_->CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); } @@ -171,14 +207,13 @@ void GLES2TraceImplementation::CullFace(GLenum mode) { gl_->CullFace(mode); } -void GLES2TraceImplementation::DeleteBuffers( - GLsizei n, const GLuint* buffers) { +void GLES2TraceImplementation::DeleteBuffers(GLsizei n, const GLuint* buffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DeleteBuffers"); gl_->DeleteBuffers(n, buffers); } -void GLES2TraceImplementation::DeleteFramebuffers( - GLsizei n, const GLuint* framebuffers) { +void GLES2TraceImplementation::DeleteFramebuffers(GLsizei n, + const GLuint* framebuffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DeleteFramebuffers"); gl_->DeleteFramebuffers(n, framebuffers); } @@ -189,7 +224,8 @@ void GLES2TraceImplementation::DeleteProgram(GLuint program) { } void GLES2TraceImplementation::DeleteRenderbuffers( - GLsizei n, const GLuint* renderbuffers) { + GLsizei n, + const GLuint* renderbuffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DeleteRenderbuffers"); gl_->DeleteRenderbuffers(n, renderbuffers); } @@ -199,8 +235,8 @@ void GLES2TraceImplementation::DeleteShader(GLuint shader) { gl_->DeleteShader(shader); } -void GLES2TraceImplementation::DeleteTextures( - GLsizei n, const GLuint* textures) { +void GLES2TraceImplementation::DeleteTextures(GLsizei n, + const GLuint* textures) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DeleteTextures"); gl_->DeleteTextures(n, textures); } @@ -235,14 +271,17 @@ void GLES2TraceImplementation::DisableVertexAttribArray(GLuint index) { gl_->DisableVertexAttribArray(index); } -void GLES2TraceImplementation::DrawArrays( - GLenum mode, GLint first, GLsizei count) { +void GLES2TraceImplementation::DrawArrays(GLenum mode, + GLint first, + GLsizei count) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DrawArrays"); gl_->DrawArrays(mode, first, count); } -void GLES2TraceImplementation::DrawElements( - GLenum mode, GLsizei count, GLenum type, const void* indices) { +void GLES2TraceImplementation::DrawElements(GLenum mode, + GLsizei count, + GLenum type, + const void* indices) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DrawElements"); gl_->DrawElements(mode, count, type, indices); } @@ -268,16 +307,20 @@ void GLES2TraceImplementation::Flush() { } void GLES2TraceImplementation::FramebufferRenderbuffer( - GLenum target, GLenum attachment, GLenum renderbuffertarget, + GLenum target, + GLenum attachment, + GLenum renderbuffertarget, GLuint renderbuffer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::FramebufferRenderbuffer"); gl_->FramebufferRenderbuffer( target, attachment, renderbuffertarget, renderbuffer); } -void GLES2TraceImplementation::FramebufferTexture2D( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level) { +void GLES2TraceImplementation::FramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::FramebufferTexture2D"); gl_->FramebufferTexture2D(target, attachment, textarget, texture, level); } @@ -297,14 +340,14 @@ void GLES2TraceImplementation::GenerateMipmap(GLenum target) { gl_->GenerateMipmap(target); } -void GLES2TraceImplementation::GenFramebuffers( - GLsizei n, GLuint* framebuffers) { +void GLES2TraceImplementation::GenFramebuffers(GLsizei n, + GLuint* framebuffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GenFramebuffers"); gl_->GenFramebuffers(n, framebuffers); } -void GLES2TraceImplementation::GenRenderbuffers( - GLsizei n, GLuint* renderbuffers) { +void GLES2TraceImplementation::GenRenderbuffers(GLsizei n, + GLuint* renderbuffers) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GenRenderbuffers"); gl_->GenRenderbuffers(n, renderbuffers); } @@ -314,28 +357,38 @@ void GLES2TraceImplementation::GenTextures(GLsizei n, GLuint* textures) { gl_->GenTextures(n, textures); } -void GLES2TraceImplementation::GetActiveAttrib( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) { +void GLES2TraceImplementation::GetActiveAttrib(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetActiveAttrib"); gl_->GetActiveAttrib(program, index, bufsize, length, size, type, name); } -void GLES2TraceImplementation::GetActiveUniform( - GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, - GLenum* type, char* name) { +void GLES2TraceImplementation::GetActiveUniform(GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetActiveUniform"); gl_->GetActiveUniform(program, index, bufsize, length, size, type, name); } -void GLES2TraceImplementation::GetAttachedShaders( - GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { +void GLES2TraceImplementation::GetAttachedShaders(GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetAttachedShaders"); gl_->GetAttachedShaders(program, maxcount, count, shaders); } -GLint GLES2TraceImplementation::GetAttribLocation( - GLuint program, const char* name) { +GLint GLES2TraceImplementation::GetAttribLocation(GLuint program, + const char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetAttribLocation"); return gl_->GetAttribLocation(program, name); } @@ -345,8 +398,9 @@ void GLES2TraceImplementation::GetBooleanv(GLenum pname, GLboolean* params) { gl_->GetBooleanv(pname, params); } -void GLES2TraceImplementation::GetBufferParameteriv( - GLenum target, GLenum pname, GLint* params) { +void GLES2TraceImplementation::GetBufferParameteriv(GLenum target, + GLenum pname, + GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetBufferParameteriv"); gl_->GetBufferParameteriv(target, pname, params); } @@ -362,8 +416,12 @@ void GLES2TraceImplementation::GetFloatv(GLenum pname, GLfloat* params) { } void GLES2TraceImplementation::GetFramebufferAttachmentParameteriv( - GLenum target, GLenum attachment, GLenum pname, GLint* params) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetFramebufferAttachmentParameteriv"); // NOLINT + GLenum target, + GLenum attachment, + GLenum pname, + GLint* params) { + TRACE_EVENT_BINARY_EFFICIENT0( + "gpu", "GLES2Trace::GetFramebufferAttachmentParameteriv"); gl_->GetFramebufferAttachmentParameteriv(target, attachment, pname, params); } @@ -372,44 +430,56 @@ void GLES2TraceImplementation::GetIntegerv(GLenum pname, GLint* params) { gl_->GetIntegerv(pname, params); } -void GLES2TraceImplementation::GetProgramiv( - GLuint program, GLenum pname, GLint* params) { +void GLES2TraceImplementation::GetProgramiv(GLuint program, + GLenum pname, + GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetProgramiv"); gl_->GetProgramiv(program, pname, params); } -void GLES2TraceImplementation::GetProgramInfoLog( - GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { +void GLES2TraceImplementation::GetProgramInfoLog(GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetProgramInfoLog"); gl_->GetProgramInfoLog(program, bufsize, length, infolog); } -void GLES2TraceImplementation::GetRenderbufferParameteriv( - GLenum target, GLenum pname, GLint* params) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetRenderbufferParameteriv"); // NOLINT +void GLES2TraceImplementation::GetRenderbufferParameteriv(GLenum target, + GLenum pname, + GLint* params) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::GetRenderbufferParameteriv"); gl_->GetRenderbufferParameteriv(target, pname, params); } -void GLES2TraceImplementation::GetShaderiv( - GLuint shader, GLenum pname, GLint* params) { +void GLES2TraceImplementation::GetShaderiv(GLuint shader, + GLenum pname, + GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetShaderiv"); gl_->GetShaderiv(shader, pname, params); } -void GLES2TraceImplementation::GetShaderInfoLog( - GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { +void GLES2TraceImplementation::GetShaderInfoLog(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetShaderInfoLog"); gl_->GetShaderInfoLog(shader, bufsize, length, infolog); } -void GLES2TraceImplementation::GetShaderPrecisionFormat( - GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { +void GLES2TraceImplementation::GetShaderPrecisionFormat(GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetShaderPrecisionFormat"); gl_->GetShaderPrecisionFormat(shadertype, precisiontype, range, precision); } -void GLES2TraceImplementation::GetShaderSource( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { +void GLES2TraceImplementation::GetShaderSource(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetShaderSource"); gl_->GetShaderSource(shader, bufsize, length, source); } @@ -419,50 +489,57 @@ const GLubyte* GLES2TraceImplementation::GetString(GLenum name) { return gl_->GetString(name); } -void GLES2TraceImplementation::GetTexParameterfv( - GLenum target, GLenum pname, GLfloat* params) { +void GLES2TraceImplementation::GetTexParameterfv(GLenum target, + GLenum pname, + GLfloat* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetTexParameterfv"); gl_->GetTexParameterfv(target, pname, params); } -void GLES2TraceImplementation::GetTexParameteriv( - GLenum target, GLenum pname, GLint* params) { +void GLES2TraceImplementation::GetTexParameteriv(GLenum target, + GLenum pname, + GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetTexParameteriv"); gl_->GetTexParameteriv(target, pname, params); } -void GLES2TraceImplementation::GetUniformfv( - GLuint program, GLint location, GLfloat* params) { +void GLES2TraceImplementation::GetUniformfv(GLuint program, + GLint location, + GLfloat* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetUniformfv"); gl_->GetUniformfv(program, location, params); } -void GLES2TraceImplementation::GetUniformiv( - GLuint program, GLint location, GLint* params) { +void GLES2TraceImplementation::GetUniformiv(GLuint program, + GLint location, + GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetUniformiv"); gl_->GetUniformiv(program, location, params); } -GLint GLES2TraceImplementation::GetUniformLocation( - GLuint program, const char* name) { +GLint GLES2TraceImplementation::GetUniformLocation(GLuint program, + const char* name) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetUniformLocation"); return gl_->GetUniformLocation(program, name); } -void GLES2TraceImplementation::GetVertexAttribfv( - GLuint index, GLenum pname, GLfloat* params) { +void GLES2TraceImplementation::GetVertexAttribfv(GLuint index, + GLenum pname, + GLfloat* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetVertexAttribfv"); gl_->GetVertexAttribfv(index, pname, params); } -void GLES2TraceImplementation::GetVertexAttribiv( - GLuint index, GLenum pname, GLint* params) { +void GLES2TraceImplementation::GetVertexAttribiv(GLuint index, + GLenum pname, + GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetVertexAttribiv"); gl_->GetVertexAttribiv(index, pname, params); } -void GLES2TraceImplementation::GetVertexAttribPointerv( - GLuint index, GLenum pname, void** pointer) { +void GLES2TraceImplementation::GetVertexAttribPointerv(GLuint index, + GLenum pname, + void** pointer) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetVertexAttribPointerv"); gl_->GetVertexAttribPointerv(index, pname, pointer); } @@ -527,9 +604,13 @@ void GLES2TraceImplementation::PolygonOffset(GLfloat factor, GLfloat units) { gl_->PolygonOffset(factor, units); } -void GLES2TraceImplementation::ReadPixels( - GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, - void* pixels) { +void GLES2TraceImplementation::ReadPixels(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ReadPixels"); gl_->ReadPixels(x, y, width, height, format, type, pixels); } @@ -539,34 +620,41 @@ void GLES2TraceImplementation::ReleaseShaderCompiler() { gl_->ReleaseShaderCompiler(); } -void GLES2TraceImplementation::RenderbufferStorage( - GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { +void GLES2TraceImplementation::RenderbufferStorage(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::RenderbufferStorage"); gl_->RenderbufferStorage(target, internalformat, width, height); } -void GLES2TraceImplementation::SampleCoverage( - GLclampf value, GLboolean invert) { +void GLES2TraceImplementation::SampleCoverage(GLclampf value, + GLboolean invert) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::SampleCoverage"); gl_->SampleCoverage(value, invert); } -void GLES2TraceImplementation::Scissor( - GLint x, GLint y, GLsizei width, GLsizei height) { +void GLES2TraceImplementation::Scissor(GLint x, + GLint y, + GLsizei width, + GLsizei height) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Scissor"); gl_->Scissor(x, y, width, height); } -void GLES2TraceImplementation::ShaderBinary( - GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, - GLsizei length) { +void GLES2TraceImplementation::ShaderBinary(GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ShaderBinary"); gl_->ShaderBinary(n, shaders, binaryformat, binary, length); } -void GLES2TraceImplementation::ShaderSource( - GLuint shader, GLsizei count, const GLchar* const* str, - const GLint* length) { +void GLES2TraceImplementation::ShaderSource(GLuint shader, + GLsizei count, + const GLchar* const* str, + const GLint* length) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ShaderSource"); gl_->ShaderSource(shader, count, str, length); } @@ -581,14 +669,17 @@ void GLES2TraceImplementation::ShallowFlushCHROMIUM() { gl_->ShallowFlushCHROMIUM(); } -void GLES2TraceImplementation::StencilFunc( - GLenum func, GLint ref, GLuint mask) { +void GLES2TraceImplementation::StencilFunc(GLenum func, + GLint ref, + GLuint mask) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::StencilFunc"); gl_->StencilFunc(func, ref, mask); } -void GLES2TraceImplementation::StencilFuncSeparate( - GLenum face, GLenum func, GLint ref, GLuint mask) { +void GLES2TraceImplementation::StencilFuncSeparate(GLenum face, + GLenum func, + GLint ref, + GLuint mask) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::StencilFuncSeparate"); gl_->StencilFuncSeparate(face, func, ref, mask); } @@ -603,55 +694,79 @@ void GLES2TraceImplementation::StencilMaskSeparate(GLenum face, GLuint mask) { gl_->StencilMaskSeparate(face, mask); } -void GLES2TraceImplementation::StencilOp( - GLenum fail, GLenum zfail, GLenum zpass) { +void GLES2TraceImplementation::StencilOp(GLenum fail, + GLenum zfail, + GLenum zpass) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::StencilOp"); gl_->StencilOp(fail, zfail, zpass); } -void GLES2TraceImplementation::StencilOpSeparate( - GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { +void GLES2TraceImplementation::StencilOpSeparate(GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::StencilOpSeparate"); gl_->StencilOpSeparate(face, fail, zfail, zpass); } -void GLES2TraceImplementation::TexImage2D( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) { +void GLES2TraceImplementation::TexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::TexImage2D"); - gl_->TexImage2D( - target, level, internalformat, width, height, border, format, type, - pixels); -} - -void GLES2TraceImplementation::TexParameterf( - GLenum target, GLenum pname, GLfloat param) { + gl_->TexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + pixels); +} + +void GLES2TraceImplementation::TexParameterf(GLenum target, + GLenum pname, + GLfloat param) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::TexParameterf"); gl_->TexParameterf(target, pname, param); } -void GLES2TraceImplementation::TexParameterfv( - GLenum target, GLenum pname, const GLfloat* params) { +void GLES2TraceImplementation::TexParameterfv(GLenum target, + GLenum pname, + const GLfloat* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::TexParameterfv"); gl_->TexParameterfv(target, pname, params); } -void GLES2TraceImplementation::TexParameteri( - GLenum target, GLenum pname, GLint param) { +void GLES2TraceImplementation::TexParameteri(GLenum target, + GLenum pname, + GLint param) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::TexParameteri"); gl_->TexParameteri(target, pname, param); } -void GLES2TraceImplementation::TexParameteriv( - GLenum target, GLenum pname, const GLint* params) { +void GLES2TraceImplementation::TexParameteriv(GLenum target, + GLenum pname, + const GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::TexParameteriv"); gl_->TexParameteriv(target, pname, params); } -void GLES2TraceImplementation::TexSubImage2D( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* pixels) { +void GLES2TraceImplementation::TexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::TexSubImage2D"); gl_->TexSubImage2D( target, level, xoffset, yoffset, width, height, format, type, pixels); @@ -662,8 +777,9 @@ void GLES2TraceImplementation::Uniform1f(GLint location, GLfloat x) { gl_->Uniform1f(location, x); } -void GLES2TraceImplementation::Uniform1fv( - GLint location, GLsizei count, const GLfloat* v) { +void GLES2TraceImplementation::Uniform1fv(GLint location, + GLsizei count, + const GLfloat* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform1fv"); gl_->Uniform1fv(location, count, v); } @@ -673,20 +789,21 @@ void GLES2TraceImplementation::Uniform1i(GLint location, GLint x) { gl_->Uniform1i(location, x); } -void GLES2TraceImplementation::Uniform1iv( - GLint location, GLsizei count, const GLint* v) { +void GLES2TraceImplementation::Uniform1iv(GLint location, + GLsizei count, + const GLint* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform1iv"); gl_->Uniform1iv(location, count, v); } -void GLES2TraceImplementation::Uniform2f( - GLint location, GLfloat x, GLfloat y) { +void GLES2TraceImplementation::Uniform2f(GLint location, GLfloat x, GLfloat y) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform2f"); gl_->Uniform2f(location, x, y); } -void GLES2TraceImplementation::Uniform2fv( - GLint location, GLsizei count, const GLfloat* v) { +void GLES2TraceImplementation::Uniform2fv(GLint location, + GLsizei count, + const GLfloat* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform2fv"); gl_->Uniform2fv(location, count, v); } @@ -696,74 +813,95 @@ void GLES2TraceImplementation::Uniform2i(GLint location, GLint x, GLint y) { gl_->Uniform2i(location, x, y); } -void GLES2TraceImplementation::Uniform2iv( - GLint location, GLsizei count, const GLint* v) { +void GLES2TraceImplementation::Uniform2iv(GLint location, + GLsizei count, + const GLint* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform2iv"); gl_->Uniform2iv(location, count, v); } -void GLES2TraceImplementation::Uniform3f( - GLint location, GLfloat x, GLfloat y, GLfloat z) { +void GLES2TraceImplementation::Uniform3f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform3f"); gl_->Uniform3f(location, x, y, z); } -void GLES2TraceImplementation::Uniform3fv( - GLint location, GLsizei count, const GLfloat* v) { +void GLES2TraceImplementation::Uniform3fv(GLint location, + GLsizei count, + const GLfloat* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform3fv"); gl_->Uniform3fv(location, count, v); } -void GLES2TraceImplementation::Uniform3i( - GLint location, GLint x, GLint y, GLint z) { +void GLES2TraceImplementation::Uniform3i(GLint location, + GLint x, + GLint y, + GLint z) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform3i"); gl_->Uniform3i(location, x, y, z); } -void GLES2TraceImplementation::Uniform3iv( - GLint location, GLsizei count, const GLint* v) { +void GLES2TraceImplementation::Uniform3iv(GLint location, + GLsizei count, + const GLint* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform3iv"); gl_->Uniform3iv(location, count, v); } -void GLES2TraceImplementation::Uniform4f( - GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { +void GLES2TraceImplementation::Uniform4f(GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform4f"); gl_->Uniform4f(location, x, y, z, w); } -void GLES2TraceImplementation::Uniform4fv( - GLint location, GLsizei count, const GLfloat* v) { +void GLES2TraceImplementation::Uniform4fv(GLint location, + GLsizei count, + const GLfloat* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform4fv"); gl_->Uniform4fv(location, count, v); } -void GLES2TraceImplementation::Uniform4i( - GLint location, GLint x, GLint y, GLint z, GLint w) { +void GLES2TraceImplementation::Uniform4i(GLint location, + GLint x, + GLint y, + GLint z, + GLint w) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform4i"); gl_->Uniform4i(location, x, y, z, w); } -void GLES2TraceImplementation::Uniform4iv( - GLint location, GLsizei count, const GLint* v) { +void GLES2TraceImplementation::Uniform4iv(GLint location, + GLsizei count, + const GLint* v) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Uniform4iv"); gl_->Uniform4iv(location, count, v); } -void GLES2TraceImplementation::UniformMatrix2fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { +void GLES2TraceImplementation::UniformMatrix2fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::UniformMatrix2fv"); gl_->UniformMatrix2fv(location, count, transpose, value); } -void GLES2TraceImplementation::UniformMatrix3fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { +void GLES2TraceImplementation::UniformMatrix3fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::UniformMatrix3fv"); gl_->UniformMatrix3fv(location, count, transpose, value); } -void GLES2TraceImplementation::UniformMatrix4fv( - GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { +void GLES2TraceImplementation::UniformMatrix4fv(GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::UniformMatrix4fv"); gl_->UniformMatrix4fv(location, count, transpose, value); } @@ -783,96 +921,129 @@ void GLES2TraceImplementation::VertexAttrib1f(GLuint indx, GLfloat x) { gl_->VertexAttrib1f(indx, x); } -void GLES2TraceImplementation::VertexAttrib1fv( - GLuint indx, const GLfloat* values) { +void GLES2TraceImplementation::VertexAttrib1fv(GLuint indx, + const GLfloat* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttrib1fv"); gl_->VertexAttrib1fv(indx, values); } -void GLES2TraceImplementation::VertexAttrib2f( - GLuint indx, GLfloat x, GLfloat y) { +void GLES2TraceImplementation::VertexAttrib2f(GLuint indx, + GLfloat x, + GLfloat y) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttrib2f"); gl_->VertexAttrib2f(indx, x, y); } -void GLES2TraceImplementation::VertexAttrib2fv( - GLuint indx, const GLfloat* values) { +void GLES2TraceImplementation::VertexAttrib2fv(GLuint indx, + const GLfloat* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttrib2fv"); gl_->VertexAttrib2fv(indx, values); } -void GLES2TraceImplementation::VertexAttrib3f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z) { +void GLES2TraceImplementation::VertexAttrib3f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttrib3f"); gl_->VertexAttrib3f(indx, x, y, z); } -void GLES2TraceImplementation::VertexAttrib3fv( - GLuint indx, const GLfloat* values) { +void GLES2TraceImplementation::VertexAttrib3fv(GLuint indx, + const GLfloat* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttrib3fv"); gl_->VertexAttrib3fv(indx, values); } -void GLES2TraceImplementation::VertexAttrib4f( - GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { +void GLES2TraceImplementation::VertexAttrib4f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttrib4f"); gl_->VertexAttrib4f(indx, x, y, z, w); } -void GLES2TraceImplementation::VertexAttrib4fv( - GLuint indx, const GLfloat* values) { +void GLES2TraceImplementation::VertexAttrib4fv(GLuint indx, + const GLfloat* values) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttrib4fv"); gl_->VertexAttrib4fv(indx, values); } -void GLES2TraceImplementation::VertexAttribPointer( - GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, - const void* ptr) { +void GLES2TraceImplementation::VertexAttribPointer(GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttribPointer"); gl_->VertexAttribPointer(indx, size, type, normalized, stride, ptr); } -void GLES2TraceImplementation::Viewport( - GLint x, GLint y, GLsizei width, GLsizei height) { +void GLES2TraceImplementation::Viewport(GLint x, + GLint y, + GLsizei width, + GLsizei height) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::Viewport"); gl_->Viewport(x, y, width, height); } -void GLES2TraceImplementation::BlitFramebufferCHROMIUM( - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, - GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { +void GLES2TraceImplementation::BlitFramebufferCHROMIUM(GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlitFramebufferCHROMIUM"); gl_->BlitFramebufferCHROMIUM( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } void GLES2TraceImplementation::RenderbufferStorageMultisampleCHROMIUM( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, GLsizei height) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::RenderbufferStorageMultisampleCHROMIUM"); // NOLINT + TRACE_EVENT_BINARY_EFFICIENT0( + "gpu", "GLES2Trace::RenderbufferStorageMultisampleCHROMIUM"); gl_->RenderbufferStorageMultisampleCHROMIUM( target, samples, internalformat, width, height); } void GLES2TraceImplementation::RenderbufferStorageMultisampleEXT( - GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, GLsizei height) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::RenderbufferStorageMultisampleEXT"); // NOLINT + TRACE_EVENT_BINARY_EFFICIENT0( + "gpu", "GLES2Trace::RenderbufferStorageMultisampleEXT"); gl_->RenderbufferStorageMultisampleEXT( target, samples, internalformat, width, height); } void GLES2TraceImplementation::FramebufferTexture2DMultisampleEXT( - GLenum target, GLenum attachment, GLenum textarget, GLuint texture, - GLint level, GLsizei samples) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::FramebufferTexture2DMultisampleEXT"); // NOLINT + GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level, + GLsizei samples) { + TRACE_EVENT_BINARY_EFFICIENT0( + "gpu", "GLES2Trace::FramebufferTexture2DMultisampleEXT"); gl_->FramebufferTexture2DMultisampleEXT( target, attachment, textarget, texture, level, samples); } -void GLES2TraceImplementation::TexStorage2DEXT( - GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, - GLsizei height) { +void GLES2TraceImplementation::TexStorage2DEXT(GLenum target, + GLsizei levels, + GLenum internalFormat, + GLsizei width, + GLsizei height) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::TexStorage2DEXT"); gl_->TexStorage2DEXT(target, levels, internalFormat, width, height); } @@ -882,8 +1053,8 @@ void GLES2TraceImplementation::GenQueriesEXT(GLsizei n, GLuint* queries) { gl_->GenQueriesEXT(n, queries); } -void GLES2TraceImplementation::DeleteQueriesEXT( - GLsizei n, const GLuint* queries) { +void GLES2TraceImplementation::DeleteQueriesEXT(GLsizei n, + const GLuint* queries) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DeleteQueriesEXT"); gl_->DeleteQueriesEXT(n, queries); } @@ -903,26 +1074,28 @@ void GLES2TraceImplementation::EndQueryEXT(GLenum target) { gl_->EndQueryEXT(target); } -void GLES2TraceImplementation::GetQueryivEXT( - GLenum target, GLenum pname, GLint* params) { +void GLES2TraceImplementation::GetQueryivEXT(GLenum target, + GLenum pname, + GLint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetQueryivEXT"); gl_->GetQueryivEXT(target, pname, params); } -void GLES2TraceImplementation::GetQueryObjectuivEXT( - GLuint id, GLenum pname, GLuint* params) { +void GLES2TraceImplementation::GetQueryObjectuivEXT(GLuint id, + GLenum pname, + GLuint* params) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetQueryObjectuivEXT"); gl_->GetQueryObjectuivEXT(id, pname, params); } -void GLES2TraceImplementation::InsertEventMarkerEXT( - GLsizei length, const GLchar* marker) { +void GLES2TraceImplementation::InsertEventMarkerEXT(GLsizei length, + const GLchar* marker) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::InsertEventMarkerEXT"); gl_->InsertEventMarkerEXT(length, marker); } -void GLES2TraceImplementation::PushGroupMarkerEXT( - GLsizei length, const GLchar* marker) { +void GLES2TraceImplementation::PushGroupMarkerEXT(GLsizei length, + const GLchar* marker) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::PushGroupMarkerEXT"); gl_->PushGroupMarkerEXT(length, marker); } @@ -937,8 +1110,8 @@ void GLES2TraceImplementation::GenVertexArraysOES(GLsizei n, GLuint* arrays) { gl_->GenVertexArraysOES(n, arrays); } -void GLES2TraceImplementation::DeleteVertexArraysOES( - GLsizei n, const GLuint* arrays) { +void GLES2TraceImplementation::DeleteVertexArraysOES(GLsizei n, + const GLuint* arrays) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DeleteVertexArraysOES"); gl_->DeleteVertexArraysOES(n, arrays); } @@ -958,38 +1131,44 @@ void GLES2TraceImplementation::SwapBuffers() { gl_->SwapBuffers(); } -GLuint GLES2TraceImplementation::GetMaxValueInBufferCHROMIUM( - GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetMaxValueInBufferCHROMIUM"); // NOLINT +GLuint GLES2TraceImplementation::GetMaxValueInBufferCHROMIUM(GLuint buffer_id, + GLsizei count, + GLenum type, + GLuint offset) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::GetMaxValueInBufferCHROMIUM"); return gl_->GetMaxValueInBufferCHROMIUM(buffer_id, count, type, offset); } -void GLES2TraceImplementation::GenSharedIdsCHROMIUM( - GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { +void GLES2TraceImplementation::GenSharedIdsCHROMIUM(GLuint namespace_id, + GLuint id_offset, + GLsizei n, + GLuint* ids) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GenSharedIdsCHROMIUM"); gl_->GenSharedIdsCHROMIUM(namespace_id, id_offset, n, ids); } -void GLES2TraceImplementation::DeleteSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) { +void GLES2TraceImplementation::DeleteSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DeleteSharedIdsCHROMIUM"); gl_->DeleteSharedIdsCHROMIUM(namespace_id, n, ids); } -void GLES2TraceImplementation::RegisterSharedIdsCHROMIUM( - GLuint namespace_id, GLsizei n, const GLuint* ids) { +void GLES2TraceImplementation::RegisterSharedIdsCHROMIUM(GLuint namespace_id, + GLsizei n, + const GLuint* ids) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::RegisterSharedIdsCHROMIUM"); gl_->RegisterSharedIdsCHROMIUM(namespace_id, n, ids); } -GLboolean GLES2TraceImplementation::EnableFeatureCHROMIUM( - const char* feature) { +GLboolean GLES2TraceImplementation::EnableFeatureCHROMIUM(const char* feature) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::EnableFeatureCHROMIUM"); return gl_->EnableFeatureCHROMIUM(feature); } -void* GLES2TraceImplementation::MapBufferCHROMIUM( - GLuint target, GLenum access) { +void* GLES2TraceImplementation::MapBufferCHROMIUM(GLuint target, + GLenum access) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::MapBufferCHROMIUM"); return gl_->MapBufferCHROMIUM(target, access); } @@ -999,10 +1178,9 @@ GLboolean GLES2TraceImplementation::UnmapBufferCHROMIUM(GLuint target) { return gl_->UnmapBufferCHROMIUM(target); } -void* GLES2TraceImplementation::MapImageCHROMIUM( - GLuint image_id, GLenum access) { +void* GLES2TraceImplementation::MapImageCHROMIUM(GLuint image_id) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::MapImageCHROMIUM"); - return gl_->MapImageCHROMIUM(image_id, access); + return gl_->MapImageCHROMIUM(image_id); } void GLES2TraceImplementation::UnmapImageCHROMIUM(GLuint image_id) { @@ -1010,78 +1188,93 @@ void GLES2TraceImplementation::UnmapImageCHROMIUM(GLuint image_id) { gl_->UnmapImageCHROMIUM(image_id); } -void* GLES2TraceImplementation::MapBufferSubDataCHROMIUM( - GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { +void* GLES2TraceImplementation::MapBufferSubDataCHROMIUM(GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::MapBufferSubDataCHROMIUM"); return gl_->MapBufferSubDataCHROMIUM(target, offset, size, access); } void GLES2TraceImplementation::UnmapBufferSubDataCHROMIUM(const void* mem) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::UnmapBufferSubDataCHROMIUM"); // NOLINT + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::UnmapBufferSubDataCHROMIUM"); gl_->UnmapBufferSubDataCHROMIUM(mem); } -void* GLES2TraceImplementation::MapTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, GLenum access) { +void* GLES2TraceImplementation::MapTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::MapTexSubImage2DCHROMIUM"); return gl_->MapTexSubImage2DCHROMIUM( target, level, xoffset, yoffset, width, height, format, type, access); } void GLES2TraceImplementation::UnmapTexSubImage2DCHROMIUM(const void* mem) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::UnmapTexSubImage2DCHROMIUM"); // NOLINT + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::UnmapTexSubImage2DCHROMIUM"); gl_->UnmapTexSubImage2DCHROMIUM(mem); } -void GLES2TraceImplementation::ResizeCHROMIUM( - GLuint width, GLuint height, GLfloat scale_factor) { +void GLES2TraceImplementation::ResizeCHROMIUM(GLuint width, + GLuint height, + GLfloat scale_factor) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ResizeCHROMIUM"); gl_->ResizeCHROMIUM(width, height, scale_factor); } const GLchar* GLES2TraceImplementation::GetRequestableExtensionsCHROMIUM() { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetRequestableExtensionsCHROMIUM"); // NOLINT + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::GetRequestableExtensionsCHROMIUM"); return gl_->GetRequestableExtensionsCHROMIUM(); } -void GLES2TraceImplementation::RequestExtensionCHROMIUM( - const char* extension) { +void GLES2TraceImplementation::RequestExtensionCHROMIUM(const char* extension) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::RequestExtensionCHROMIUM"); gl_->RequestExtensionCHROMIUM(extension); } void GLES2TraceImplementation::RateLimitOffscreenContextCHROMIUM() { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::RateLimitOffscreenContextCHROMIUM"); // NOLINT + TRACE_EVENT_BINARY_EFFICIENT0( + "gpu", "GLES2Trace::RateLimitOffscreenContextCHROMIUM"); gl_->RateLimitOffscreenContextCHROMIUM(); } -void GLES2TraceImplementation::GetMultipleIntegervCHROMIUM( - const GLenum* pnames, GLuint count, GLint* results, GLsizeiptr size) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetMultipleIntegervCHROMIUM"); // NOLINT +void GLES2TraceImplementation::GetMultipleIntegervCHROMIUM(const GLenum* pnames, + GLuint count, + GLint* results, + GLsizeiptr size) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::GetMultipleIntegervCHROMIUM"); gl_->GetMultipleIntegervCHROMIUM(pnames, count, results, size); } -void GLES2TraceImplementation::GetProgramInfoCHROMIUM( - GLuint program, GLsizei bufsize, GLsizei* size, void* info) { +void GLES2TraceImplementation::GetProgramInfoCHROMIUM(GLuint program, + GLsizei bufsize, + GLsizei* size, + void* info) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetProgramInfoCHROMIUM"); gl_->GetProgramInfoCHROMIUM(program, bufsize, size, info); } GLuint GLES2TraceImplementation::CreateStreamTextureCHROMIUM(GLuint texture) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CreateStreamTextureCHROMIUM"); // NOLINT + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::CreateStreamTextureCHROMIUM"); return gl_->CreateStreamTextureCHROMIUM(texture); } -void GLES2TraceImplementation::DestroyStreamTextureCHROMIUM(GLuint texture) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DestroyStreamTextureCHROMIUM"); // NOLINT - gl_->DestroyStreamTextureCHROMIUM(texture); -} - -GLuint GLES2TraceImplementation::CreateImageCHROMIUM( - GLsizei width, GLsizei height, GLenum internalformat) { +GLuint GLES2TraceImplementation::CreateImageCHROMIUM(GLsizei width, + GLsizei height, + GLenum internalformat, + GLenum usage) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CreateImageCHROMIUM"); - return gl_->CreateImageCHROMIUM(width, height, internalformat); + return gl_->CreateImageCHROMIUM(width, height, internalformat, usage); } void GLES2TraceImplementation::DestroyImageCHROMIUM(GLuint image_id) { @@ -1089,54 +1282,72 @@ void GLES2TraceImplementation::DestroyImageCHROMIUM(GLuint image_id) { gl_->DestroyImageCHROMIUM(image_id); } -void GLES2TraceImplementation::GetImageParameterivCHROMIUM( - GLuint image_id, GLenum pname, GLint* params) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetImageParameterivCHROMIUM"); // NOLINT +void GLES2TraceImplementation::GetImageParameterivCHROMIUM(GLuint image_id, + GLenum pname, + GLint* params) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::GetImageParameterivCHROMIUM"); gl_->GetImageParameterivCHROMIUM(image_id, pname, params); } -void GLES2TraceImplementation::GetTranslatedShaderSourceANGLE( - GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetTranslatedShaderSourceANGLE"); // NOLINT +void GLES2TraceImplementation::GetTranslatedShaderSourceANGLE(GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::GetTranslatedShaderSourceANGLE"); gl_->GetTranslatedShaderSourceANGLE(shader, bufsize, length, source); } -void GLES2TraceImplementation::PostSubBufferCHROMIUM( - GLint x, GLint y, GLint width, GLint height) { +void GLES2TraceImplementation::PostSubBufferCHROMIUM(GLint x, + GLint y, + GLint width, + GLint height) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::PostSubBufferCHROMIUM"); gl_->PostSubBufferCHROMIUM(x, y, width, height); } -void GLES2TraceImplementation::TexImageIOSurface2DCHROMIUM( - GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId, - GLuint plane) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::TexImageIOSurface2DCHROMIUM"); // NOLINT +void GLES2TraceImplementation::TexImageIOSurface2DCHROMIUM(GLenum target, + GLsizei width, + GLsizei height, + GLuint ioSurfaceId, + GLuint plane) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::TexImageIOSurface2DCHROMIUM"); gl_->TexImageIOSurface2DCHROMIUM(target, width, height, ioSurfaceId, plane); } -void GLES2TraceImplementation::CopyTextureCHROMIUM( - GLenum target, GLenum source_id, GLenum dest_id, GLint level, - GLint internalformat, GLenum dest_type) { +void GLES2TraceImplementation::CopyTextureCHROMIUM(GLenum target, + GLenum source_id, + GLenum dest_id, + GLint level, + GLint internalformat, + GLenum dest_type) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::CopyTextureCHROMIUM"); gl_->CopyTextureCHROMIUM( target, source_id, dest_id, level, internalformat, dest_type); } -void GLES2TraceImplementation::DrawArraysInstancedANGLE( - GLenum mode, GLint first, GLsizei count, GLsizei primcount) { +void GLES2TraceImplementation::DrawArraysInstancedANGLE(GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DrawArraysInstancedANGLE"); gl_->DrawArraysInstancedANGLE(mode, first, count, primcount); } -void GLES2TraceImplementation::DrawElementsInstancedANGLE( - GLenum mode, GLsizei count, GLenum type, const void* indices, - GLsizei primcount) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DrawElementsInstancedANGLE"); // NOLINT +void GLES2TraceImplementation::DrawElementsInstancedANGLE(GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::DrawElementsInstancedANGLE"); gl_->DrawElementsInstancedANGLE(mode, count, type, indices, primcount); } -void GLES2TraceImplementation::VertexAttribDivisorANGLE( - GLuint index, GLuint divisor) { +void GLES2TraceImplementation::VertexAttribDivisorANGLE(GLuint index, + GLuint divisor) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::VertexAttribDivisorANGLE"); gl_->VertexAttribDivisorANGLE(index, divisor); } @@ -1146,32 +1357,51 @@ void GLES2TraceImplementation::GenMailboxCHROMIUM(GLbyte* mailbox) { gl_->GenMailboxCHROMIUM(mailbox); } -void GLES2TraceImplementation::ProduceTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) { +void GLES2TraceImplementation::ProduceTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ProduceTextureCHROMIUM"); gl_->ProduceTextureCHROMIUM(target, mailbox); } -void GLES2TraceImplementation::ConsumeTextureCHROMIUM( - GLenum target, const GLbyte* mailbox) { +void GLES2TraceImplementation::ProduceTextureDirectCHROMIUM( + GLuint texture, + GLenum target, + const GLbyte* mailbox) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::ProduceTextureDirectCHROMIUM"); + gl_->ProduceTextureDirectCHROMIUM(texture, target, mailbox); +} + +void GLES2TraceImplementation::ConsumeTextureCHROMIUM(GLenum target, + const GLbyte* mailbox) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ConsumeTextureCHROMIUM"); gl_->ConsumeTextureCHROMIUM(target, mailbox); } -void GLES2TraceImplementation::BindUniformLocationCHROMIUM( - GLuint program, GLint location, const char* name) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BindUniformLocationCHROMIUM"); // NOLINT +GLuint GLES2TraceImplementation::CreateAndConsumeTextureCHROMIUM( + GLenum target, + const GLbyte* mailbox) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::CreateAndConsumeTextureCHROMIUM"); + return gl_->CreateAndConsumeTextureCHROMIUM(target, mailbox); +} + +void GLES2TraceImplementation::BindUniformLocationCHROMIUM(GLuint program, + GLint location, + const char* name) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::BindUniformLocationCHROMIUM"); gl_->BindUniformLocationCHROMIUM(program, location, name); } -void GLES2TraceImplementation::BindTexImage2DCHROMIUM( - GLenum target, GLint imageId) { +void GLES2TraceImplementation::BindTexImage2DCHROMIUM(GLenum target, + GLint imageId) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BindTexImage2DCHROMIUM"); gl_->BindTexImage2DCHROMIUM(target, imageId); } -void GLES2TraceImplementation::ReleaseTexImage2DCHROMIUM( - GLenum target, GLint imageId) { +void GLES2TraceImplementation::ReleaseTexImage2DCHROMIUM(GLenum target, + GLint imageId) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ReleaseTexImage2DCHROMIUM"); gl_->ReleaseTexImage2DCHROMIUM(target, imageId); } @@ -1186,37 +1416,64 @@ void GLES2TraceImplementation::TraceEndCHROMIUM() { gl_->TraceEndCHROMIUM(); } -void GLES2TraceImplementation::AsyncTexSubImage2DCHROMIUM( - GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, - GLsizei height, GLenum format, GLenum type, const void* data) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::AsyncTexSubImage2DCHROMIUM"); // NOLINT +void GLES2TraceImplementation::AsyncTexSubImage2DCHROMIUM(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* data) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::AsyncTexSubImage2DCHROMIUM"); gl_->AsyncTexSubImage2DCHROMIUM( target, level, xoffset, yoffset, width, height, format, type, data); } -void GLES2TraceImplementation::AsyncTexImage2DCHROMIUM( - GLenum target, GLint level, GLint internalformat, GLsizei width, - GLsizei height, GLint border, GLenum format, GLenum type, - const void* pixels) { +void GLES2TraceImplementation::AsyncTexImage2DCHROMIUM(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::AsyncTexImage2DCHROMIUM"); - gl_->AsyncTexImage2DCHROMIUM( - target, level, internalformat, width, height, border, format, type, - pixels); + gl_->AsyncTexImage2DCHROMIUM(target, + level, + internalformat, + width, + height, + border, + format, + type, + pixels); } void GLES2TraceImplementation::WaitAsyncTexImage2DCHROMIUM(GLenum target) { - TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::WaitAsyncTexImage2DCHROMIUM"); // NOLINT + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::WaitAsyncTexImage2DCHROMIUM"); gl_->WaitAsyncTexImage2DCHROMIUM(target); } +void GLES2TraceImplementation::WaitAllAsyncTexImage2DCHROMIUM() { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::WaitAllAsyncTexImage2DCHROMIUM"); + gl_->WaitAllAsyncTexImage2DCHROMIUM(); +} + void GLES2TraceImplementation::DiscardFramebufferEXT( - GLenum target, GLsizei count, const GLenum* attachments) { + GLenum target, + GLsizei count, + const GLenum* attachments) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DiscardFramebufferEXT"); gl_->DiscardFramebufferEXT(target, count, attachments); } -void GLES2TraceImplementation::LoseContextCHROMIUM( - GLenum current, GLenum other) { +void GLES2TraceImplementation::LoseContextCHROMIUM(GLenum current, + GLenum other) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::LoseContextCHROMIUM"); gl_->LoseContextCHROMIUM(current, other); } @@ -1231,8 +1488,8 @@ void GLES2TraceImplementation::WaitSyncPointCHROMIUM(GLuint sync_point) { gl_->WaitSyncPointCHROMIUM(sync_point); } -void GLES2TraceImplementation::DrawBuffersEXT( - GLsizei count, const GLenum* bufs) { +void GLES2TraceImplementation::DrawBuffersEXT(GLsizei count, + const GLenum* bufs) { TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DrawBuffersEXT"); gl_->DrawBuffersEXT(count, bufs); } @@ -1242,5 +1499,31 @@ void GLES2TraceImplementation::DiscardBackbufferCHROMIUM() { gl_->DiscardBackbufferCHROMIUM(); } -#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_IMPL_AUTOGEN_H_ +void GLES2TraceImplementation::ScheduleOverlayPlaneCHROMIUM( + GLint plane_z_order, + GLenum plane_transform, + GLuint overlay_texture_id, + GLint bounds_x, + GLint bounds_y, + GLint bounds_width, + GLint bounds_height, + GLfloat uv_x, + GLfloat uv_y, + GLfloat uv_width, + GLfloat uv_height) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", + "GLES2Trace::ScheduleOverlayPlaneCHROMIUM"); + gl_->ScheduleOverlayPlaneCHROMIUM(plane_z_order, + plane_transform, + overlay_texture_id, + bounds_x, + bounds_y, + bounds_width, + bounds_height, + uv_x, + uv_y, + uv_width, + uv_height); +} +#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_IMPL_AUTOGEN_H_ diff --git a/chromium/gpu/command_buffer/client/gpu_control.h b/chromium/gpu/command_buffer/client/gpu_control.h new file mode 100644 index 00000000000..664152d6663 --- /dev/null +++ b/chromium/gpu/command_buffer/client/gpu_control.h @@ -0,0 +1,71 @@ +// Copyright 2014 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_GPU_CONTROL_H_ +#define GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ + +#include <stdint.h> + +#include <vector> + +#include "base/callback.h" +#include "base/macros.h" +#include "gpu/command_buffer/common/capabilities.h" +#include "gpu/command_buffer/common/mailbox.h" +#include "gpu/gpu_export.h" + +namespace gfx { +class GpuMemoryBuffer; +} + +namespace gpu { + +// Common interface for GpuControl implementations. +class GPU_EXPORT GpuControl { + public: + GpuControl() {} + virtual ~GpuControl() {} + + virtual Capabilities GetCapabilities() = 0; + + // Create a gpu memory buffer of the given dimensions and format. Returns + // its ID or -1 on error. + virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( + size_t width, + size_t height, + unsigned internalformat, + unsigned usage, + int32_t* id) = 0; + + // Destroy a gpu memory buffer. The ID must be positive. + virtual void DestroyGpuMemoryBuffer(int32_t id) = 0; + + // Inserts a sync point, returning its ID. Sync point IDs are global and can + // be used for cross-context synchronization. + virtual uint32_t InsertSyncPoint() = 0; + + // Runs |callback| when a sync point is reached. + virtual void SignalSyncPoint(uint32_t sync_point, + const base::Closure& callback) = 0; + + // Runs |callback| when a query created via glCreateQueryEXT() has cleared + // passed the glEndQueryEXT() point. + virtual void SignalQuery(uint32_t query, const base::Closure& callback) = 0; + + virtual void SetSurfaceVisible(bool visible) = 0; + + // Invokes the callback once the context has been flushed. + virtual void Echo(const base::Closure& callback) = 0; + + // Attaches an external stream to the texture given by |texture_id| and + // returns a stream identifier. + virtual uint32_t CreateStreamTexture(uint32_t texture_id) = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(GpuControl); +}; + +} // namespace gpu + +#endif // GPU_COMMAND_BUFFER_CLIENT_GPU_CONTROL_H_ diff --git a/chromium/gpu/command_buffer/client/gpu_memory_buffer_factory.h b/chromium/gpu/command_buffer/client/gpu_memory_buffer_factory.h index 42dde409eaf..c7f0b4ca4e0 100644 --- a/chromium/gpu/command_buffer/client/gpu_memory_buffer_factory.h +++ b/chromium/gpu/command_buffer/client/gpu_memory_buffer_factory.h @@ -15,10 +15,10 @@ namespace gpu { class GPU_EXPORT GpuMemoryBufferFactory { public: - virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer( - size_t width, - size_t height, - unsigned internalformat) = 0; + virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, + size_t height, + unsigned internalformat, + unsigned usage) = 0; protected: virtual ~GpuMemoryBufferFactory() {} diff --git a/chromium/gpu/command_buffer/client/gpu_memory_buffer_tracker.cc b/chromium/gpu/command_buffer/client/gpu_memory_buffer_tracker.cc index 863028ad125..9ffe0e33e2d 100644 --- a/chromium/gpu/command_buffer/client/gpu_memory_buffer_tracker.cc +++ b/chromium/gpu/command_buffer/client/gpu_memory_buffer_tracker.cc @@ -6,7 +6,7 @@ #include "base/memory/scoped_ptr.h" #include "gpu/command_buffer/client/gles2_implementation.h" -#include "gpu/command_buffer/common/gpu_control.h" +#include "gpu/command_buffer/client/gpu_control.h" namespace gpu { namespace gles2 { @@ -21,12 +21,14 @@ GpuMemoryBufferTracker::~GpuMemoryBufferTracker() { } } -int32 GpuMemoryBufferTracker::CreateBuffer( - size_t width, size_t height, int32 internalformat) { +int32 GpuMemoryBufferTracker::CreateBuffer(size_t width, + size_t height, + int32 internalformat, + int32 usage) { int32 image_id = 0; DCHECK(gpu_control_); gfx::GpuMemoryBuffer* buffer = gpu_control_->CreateGpuMemoryBuffer( - width, height, internalformat, &image_id); + width, height, internalformat, usage, &image_id); if (!buffer) return 0; diff --git a/chromium/gpu/command_buffer/client/gpu_memory_buffer_tracker.h b/chromium/gpu/command_buffer/client/gpu_memory_buffer_tracker.h index 84158818a37..25ec9495897 100644 --- a/chromium/gpu/command_buffer/client/gpu_memory_buffer_tracker.h +++ b/chromium/gpu/command_buffer/client/gpu_memory_buffer_tracker.h @@ -24,7 +24,10 @@ class GLES2_IMPL_EXPORT GpuMemoryBufferTracker { explicit GpuMemoryBufferTracker(GpuControl* gpu_control); virtual ~GpuMemoryBufferTracker(); - int32 CreateBuffer(size_t width, size_t height, int32 internalformat); + int32 CreateBuffer(size_t width, + size_t height, + int32 internalformat, + int32 usage); gfx::GpuMemoryBuffer* GetBuffer(int32 image_id); void RemoveBuffer(int32 image_id); diff --git a/chromium/gpu/command_buffer/client/mapped_memory.cc b/chromium/gpu/command_buffer/client/mapped_memory.cc index 15584aaaf07..7166733c51c 100644 --- a/chromium/gpu/command_buffer/client/mapped_memory.cc +++ b/chromium/gpu/command_buffer/client/mapped_memory.cc @@ -13,17 +13,22 @@ namespace gpu { -MemoryChunk::MemoryChunk( - int32 shm_id, gpu::Buffer shm, CommandBufferHelper* helper) +MemoryChunk::MemoryChunk(int32 shm_id, + scoped_refptr<gpu::Buffer> shm, + CommandBufferHelper* helper, + const base::Closure& poll_callback) : shm_id_(shm_id), shm_(shm), - allocator_(shm.size, helper, shm.ptr) { -} + allocator_(shm->size(), helper, poll_callback, shm->memory()) {} + +MemoryChunk::~MemoryChunk() {} MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper, + const base::Closure& poll_callback, size_t unused_memory_reclaim_limit) : chunk_size_multiple_(1), helper_(helper), + poll_callback_(poll_callback), allocated_memory_(0), max_free_bytes_(unused_memory_reclaim_limit) { } @@ -82,10 +87,12 @@ void* MappedMemoryManager::Alloc( ((size + chunk_size_multiple_ - 1) / chunk_size_multiple_) * chunk_size_multiple_; int32 id = -1; - gpu::Buffer shm = cmd_buf->CreateTransferBuffer(chunk_size, &id); + scoped_refptr<gpu::Buffer> shm = + cmd_buf->CreateTransferBuffer(chunk_size, &id); if (id < 0) return NULL; - MemoryChunk* mc = new MemoryChunk(id, shm, helper_); + DCHECK(shm); + MemoryChunk* mc = new MemoryChunk(id, shm, helper_, poll_callback_); allocated_memory_ += mc->GetSize(); chunks_.push_back(mc); void* mem = mc->Alloc(size); diff --git a/chromium/gpu/command_buffer/client/mapped_memory.h b/chromium/gpu/command_buffer/client/mapped_memory.h index b8f3129eb4a..789e69cf7f8 100644 --- a/chromium/gpu/command_buffer/client/mapped_memory.h +++ b/chromium/gpu/command_buffer/client/mapped_memory.h @@ -5,10 +5,13 @@ #ifndef GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ +#include <stdint.h> + +#include "base/bind.h" +#include "base/macros.h" #include "base/memory/scoped_vector.h" #include "gpu/command_buffer/client/fenced_allocator.h" #include "gpu/command_buffer/common/buffer.h" -#include "gpu/command_buffer/common/types.h" #include "gpu/gpu_export.h" namespace gpu { @@ -18,7 +21,11 @@ class CommandBufferHelper; // Manages a shared memory segment. class GPU_EXPORT MemoryChunk { public: - MemoryChunk(int32 shm_id, gpu::Buffer shm, CommandBufferHelper* helper); + MemoryChunk(int32_t shm_id, + scoped_refptr<gpu::Buffer> shm, + CommandBufferHelper* helper, + const base::Closure& poll_callback); + ~MemoryChunk(); // Gets the size of the largest free block that is available without waiting. unsigned int GetLargestFreeSizeWithoutWaiting() { @@ -33,11 +40,11 @@ class GPU_EXPORT MemoryChunk { // Gets the size of the chunk. unsigned int GetSize() const { - return static_cast<unsigned int>(shm_.size); + return static_cast<unsigned int>(shm_->size()); } // The shared memory id for this chunk. - int32 shm_id() const { + int32_t shm_id() const { return shm_id_; } @@ -86,8 +93,9 @@ class GPU_EXPORT MemoryChunk { // Returns true if pointer is in the range of this block. bool IsInChunk(void* pointer) const { - return pointer >= shm_.ptr && - pointer < reinterpret_cast<const int8*>(shm_.ptr) + shm_.size; + return pointer >= shm_->memory() && + pointer < + reinterpret_cast<const int8_t*>(shm_->memory()) + shm_->size(); } // Returns true of any memory in this chunk is in use. @@ -100,8 +108,8 @@ class GPU_EXPORT MemoryChunk { } private: - int32 shm_id_; - gpu::Buffer shm_; + int32_t shm_id_; + scoped_refptr<gpu::Buffer> shm_; FencedAllocatorWrapper allocator_; DISALLOW_COPY_AND_ASSIGN(MemoryChunk); @@ -117,6 +125,7 @@ class GPU_EXPORT MappedMemoryManager { // |unused_memory_reclaim_limit|: When exceeded this causes pending memory // to be reclaimed before allocating more memory. MappedMemoryManager(CommandBufferHelper* helper, + const base::Closure& poll_callback, size_t unused_memory_reclaim_limit); ~MappedMemoryManager(); @@ -137,7 +146,7 @@ class GPU_EXPORT MappedMemoryManager { // Returns: // pointer to allocated block of memory. NULL if failure. void* Alloc( - unsigned int size, int32* shm_id, unsigned int* shm_offset); + unsigned int size, int32_t* shm_id, unsigned int* shm_offset); // Frees a block of memory. // @@ -151,7 +160,7 @@ class GPU_EXPORT MappedMemoryManager { // 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, int32 token); + void FreePendingToken(void* pointer, int32_t token); // Free Any Shared memory that is not in use. void FreeUnused(); @@ -161,6 +170,15 @@ class GPU_EXPORT MappedMemoryManager { return chunks_.size(); } + size_t bytes_in_use() const { + size_t bytes_in_use = 0; + for (size_t ii = 0; ii < chunks_.size(); ++ii) { + MemoryChunk* chunk = chunks_[ii]; + bytes_in_use += chunk->bytes_in_use(); + } + return bytes_in_use; + } + // Used for testing size_t allocated_memory() const { return allocated_memory_; @@ -172,6 +190,7 @@ class GPU_EXPORT MappedMemoryManager { // size a chunk is rounded up to. unsigned int chunk_size_multiple_; CommandBufferHelper* helper_; + base::Closure poll_callback_; MemoryChunkVector chunks_; size_t allocated_memory_; size_t max_free_bytes_; diff --git a/chromium/gpu/command_buffer/client/mapped_memory_unittest.cc b/chromium/gpu/command_buffer/client/mapped_memory_unittest.cc index 90d1ce7666b..2f3a9e73c65 100644 --- a/chromium/gpu/command_buffer/client/mapped_memory_unittest.cc +++ b/chromium/gpu/command_buffer/client/mapped_memory_unittest.cc @@ -4,6 +4,7 @@ #include "gpu/command_buffer/client/mapped_memory.h" +#include <list> #include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" @@ -67,7 +68,7 @@ class MappedMemoryTestBase : public testing::Test { } int32 GetToken() { - return command_buffer_->GetState().token; + return command_buffer_->GetLastState().token; } #if defined(OS_MACOSX) @@ -85,6 +86,11 @@ class MappedMemoryTestBase : public testing::Test { const unsigned int MappedMemoryTestBase::kBufferSize; #endif +namespace { +void EmptyPoll() { +} +} + // Test fixture for MemoryChunk test - Creates a MemoryChunk, using a // CommandBufferHelper with a mock AsyncAPIInterface for its interface (calling // it directly, not through the RPC mechanism), making sure Noops are ignored @@ -94,11 +100,13 @@ class MemoryChunkTest : public MappedMemoryTestBase { static const int32 kShmId = 123; virtual void SetUp() { MappedMemoryTestBase::SetUp(); - buffer_.reset(new uint8[kBufferSize]); - gpu::Buffer buf; - buf.size = kBufferSize; - buf.ptr = buffer_.get(); - chunk_.reset(new MemoryChunk(kShmId, buf, helper_.get())); + scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); + shared_memory->CreateAndMapAnonymous(kBufferSize); + buffer_ = MakeBufferFromSharedMemory(shared_memory.Pass(), kBufferSize); + chunk_.reset(new MemoryChunk(kShmId, + buffer_, + helper_.get(), + base::Bind(&EmptyPoll))); } virtual void TearDown() { @@ -108,8 +116,10 @@ class MemoryChunkTest : public MappedMemoryTestBase { MappedMemoryTestBase::TearDown(); } + uint8* buffer_memory() { return static_cast<uint8*>(buffer_->memory()); } + scoped_ptr<MemoryChunk> chunk_; - scoped_ptr<uint8[]> buffer_; + scoped_refptr<gpu::Buffer> buffer_; }; #ifndef _MSC_VER @@ -124,8 +134,9 @@ TEST_F(MemoryChunkTest, Basic) { EXPECT_EQ(kBufferSize, chunk_->GetSize()); void *pointer = chunk_->Alloc(kSize); ASSERT_TRUE(pointer); - EXPECT_LE(buffer_.get(), static_cast<uint8 *>(pointer)); - EXPECT_GE(kBufferSize, static_cast<uint8 *>(pointer) - buffer_.get() + kSize); + EXPECT_LE(buffer_->memory(), static_cast<uint8*>(pointer)); + EXPECT_GE(kBufferSize, + static_cast<uint8*>(pointer) - buffer_memory() + kSize); EXPECT_EQ(kBufferSize - kSize, chunk_->GetLargestFreeSizeWithoutWaiting()); EXPECT_EQ(kBufferSize - kSize, chunk_->GetLargestFreeSizeWithWaiting()); EXPECT_EQ(kBufferSize, chunk_->GetSize()); @@ -136,8 +147,8 @@ TEST_F(MemoryChunkTest, Basic) { uint8 *pointer_char = static_cast<uint8*>(chunk_->Alloc(kSize)); ASSERT_TRUE(pointer_char); - EXPECT_LE(buffer_.get(), pointer_char); - EXPECT_GE(buffer_.get() + kBufferSize, pointer_char + kSize); + EXPECT_LE(buffer_memory(), pointer_char); + EXPECT_GE(buffer_memory() + kBufferSize, pointer_char + kSize); EXPECT_EQ(kBufferSize - kSize, chunk_->GetLargestFreeSizeWithoutWaiting()); EXPECT_EQ(kBufferSize - kSize, chunk_->GetLargestFreeSizeWithWaiting()); chunk_->Free(pointer_char); @@ -146,11 +157,16 @@ TEST_F(MemoryChunkTest, Basic) { } class MappedMemoryManagerTest : public MappedMemoryTestBase { + public: + MappedMemoryManager* manager() const { + return manager_.get(); + } + protected: virtual void SetUp() { MappedMemoryTestBase::SetUp(); manager_.reset(new MappedMemoryManager( - helper_.get(), MappedMemoryManager::kNoLimit)); + helper_.get(), base::Bind(&EmptyPoll), MappedMemoryManager::kNoLimit)); } virtual void TearDown() { @@ -252,16 +268,6 @@ TEST_F(MappedMemoryManagerTest, FreePendingToken) { } } -// Check if we don't free we don't crash. -TEST_F(MappedMemoryManagerTest, DontFree) { - const unsigned int kSize = 1024; - // Check we can alloc. - int32 id1 = -1; - unsigned int offset1 = 0xFFFFFFFFU; - void* mem1 = manager_->Alloc(kSize, &id1, &offset1); - ASSERT_TRUE(mem1); -} - TEST_F(MappedMemoryManagerTest, FreeUnused) { int32 id = -1; unsigned int offset = 0xFFFFFFFFU; @@ -305,12 +311,17 @@ TEST_F(MappedMemoryManagerTest, ChunkSizeMultiple) { EXPECT_EQ(0u, offset1); EXPECT_EQ(kSize, offset2); EXPECT_EQ(0u, offset3); + + manager_->Free(mem1); + manager_->Free(mem2); + manager_->Free(mem3); } TEST_F(MappedMemoryManagerTest, UnusedMemoryLimit) { const unsigned int kChunkSize = 2048; // Reset the manager with a memory limit. - manager_.reset(new MappedMemoryManager(helper_.get(), kChunkSize)); + manager_.reset(new MappedMemoryManager( + helper_.get(), base::Bind(&EmptyPoll), kChunkSize)); manager_->set_chunk_size_multiple(kChunkSize); // Allocate one chunk worth of memory. @@ -333,12 +344,16 @@ TEST_F(MappedMemoryManagerTest, UnusedMemoryLimit) { // Expect two chunks to be allocated, exceeding the limit, // since all memory is in use. EXPECT_EQ(2 * kChunkSize, manager_->allocated_memory()); + + manager_->Free(mem1); + manager_->Free(mem2); } TEST_F(MappedMemoryManagerTest, MemoryLimitWithReuse) { const unsigned int kSize = 1024; // Reset the manager with a memory limit. - manager_.reset(new MappedMemoryManager(helper_.get(), kSize)); + manager_.reset(new MappedMemoryManager( + helper_.get(), base::Bind(&EmptyPoll), kSize)); const unsigned int kChunkSize = 2 * 1024; manager_->set_chunk_size_multiple(kChunkSize); @@ -382,6 +397,60 @@ TEST_F(MappedMemoryManagerTest, MemoryLimitWithReuse) { // Expect one chunk to be allocated EXPECT_EQ(1 * kChunkSize, manager_->allocated_memory()); + + manager_->Free(mem1); + manager_->Free(mem3); +} + +namespace { +void Poll(MappedMemoryManagerTest *test, std::list<void*>* list) { + std::list<void*>::iterator it = list->begin(); + while (it != list->end()) { + void* address = *it; + test->manager()->Free(address); + it = list->erase(it); + } +} +} + +TEST_F(MappedMemoryManagerTest, Poll) { + std::list<void*> unmanaged_memory_list; + + const unsigned int kSize = 1024; + // Reset the manager with a memory limit. + manager_.reset(new MappedMemoryManager( + helper_.get(), + base::Bind(&Poll, this, &unmanaged_memory_list), + kSize)); + + // Allocate kSize bytes. Don't add the address to + // the unmanaged memory list, so that it won't be free:ed just yet. + int32 id1; + unsigned int offset1; + void* mem1 = manager_->Alloc(kSize, &id1, &offset1); + EXPECT_EQ(manager_->bytes_in_use(), kSize); + + // Allocate kSize more bytes, and make sure we grew. + int32 id2; + unsigned int offset2; + void* mem2 = manager_->Alloc(kSize, &id2, &offset2); + EXPECT_EQ(manager_->bytes_in_use(), kSize * 2); + + // Make the unmanaged buffer be released next time FreeUnused() is called + // in MappedMemoryManager/FencedAllocator. This happens for example when + // allocating new memory. + unmanaged_memory_list.push_back(mem1); + + // Allocate kSize more bytes. This should poll unmanaged memory, which now + // should free the previously allocated unmanaged memory. + int32 id3; + unsigned int offset3; + void* mem3 = manager_->Alloc(kSize, &id3, &offset3); + EXPECT_EQ(manager_->bytes_in_use(), kSize * 2); + + manager_->Free(mem2); + manager_->Free(mem3); + EXPECT_EQ(manager_->bytes_in_use(), static_cast<size_t>(0)); } } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/program_info_manager.cc b/chromium/gpu/command_buffer/client/program_info_manager.cc index 1b5a348d6cc..d854aa01f75 100644 --- a/chromium/gpu/command_buffer/client/program_info_manager.cc +++ b/chromium/gpu/command_buffer/client/program_info_manager.cc @@ -383,6 +383,7 @@ CachedProgramInfoManager::~CachedProgramInfoManager() { CachedProgramInfoManager::Program* CachedProgramInfoManager::GetProgramInfo( GLES2Implementation* gl, GLuint program) { + lock_.AssertAcquired(); ProgramInfoMap::iterator it = program_infos_.find(program); if (it == program_infos_.end()) { return NULL; @@ -394,7 +395,7 @@ CachedProgramInfoManager::Program* void CachedProgramInfoManager::CreateInfo(GLuint program) { base::AutoLock auto_lock(lock_); - DeleteInfo(program); + program_infos_.erase(program); std::pair<ProgramInfoMap::iterator, bool> result = program_infos_.insert(std::make_pair(program, Program())); @@ -402,6 +403,7 @@ void CachedProgramInfoManager::CreateInfo(GLuint program) { } void CachedProgramInfoManager::DeleteInfo(GLuint program) { + base::AutoLock auto_lock(lock_); program_infos_.erase(program); } diff --git a/chromium/gpu/command_buffer/client/query_tracker.cc b/chromium/gpu/command_buffer/client/query_tracker.cc index 285560590b3..6395c047781 100644 --- a/chromium/gpu/command_buffer/client/query_tracker.cc +++ b/chromium/gpu/command_buffer/client/query_tracker.cc @@ -8,6 +8,7 @@ #include <GLES2/gl2ext.h> #include <GLES2/gl2extchromium.h> +#include "base/atomicops.h" #include "gpu/command_buffer/client/gles2_cmd_helper.h" #include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/command_buffer/client/mapped_memory.h" @@ -92,7 +93,7 @@ QueryTracker::Query::Query(GLuint id, GLenum target, state_(kUninitialized), submit_count_(0), token_(0), - flushed_(false), + flush_count_(0), client_begin_time_us_(0), result_(0) { } @@ -139,6 +140,7 @@ void QueryTracker::Query::End(GLES2Implementation* gl) { } } } + flush_count_ = gl->helper()->flush_generation(); gl->helper()->EndQueryEXT(target(), submit_count()); MarkAsPending(gl->helper()->InsertToken()); } @@ -146,11 +148,9 @@ void QueryTracker::Query::End(GLES2Implementation* gl) { bool QueryTracker::Query::CheckResultsAvailable( CommandBufferHelper* helper) { if (Pending()) { - if (info_.sync->process_count == submit_count_ || + if (base::subtle::Acquire_Load(&info_.sync->process_count) == + submit_count_ || helper->IsContextLost()) { - // Need a MemoryBarrier here so that sync->result read after - // sync->process_count. - base::subtle::MemoryBarrier(); switch (target()) { case GL_COMMANDS_ISSUED_CHROMIUM: result_ = std::min(info_.sync->result, @@ -169,12 +169,7 @@ bool QueryTracker::Query::CheckResultsAvailable( } state_ = kComplete; } else { - if (!flushed_) { - // TODO(gman): We could reduce the number of flushes by having a - // flush count, recording that count at the time we insert the - // EndQuery command and then only flushing here if we've have not - // passed that count yet. - flushed_ = true; + if ((helper->flush_generation() - flush_count_ - 1) >= 0x80000000) { helper->Flush(); } else { // Insert no-ops so that eventually the GPU process will see more work. @@ -249,7 +244,8 @@ void QueryTracker::FreeCompletedQueries() { while (it != removed_queries_.end()) { Query* query = *it; if (query->Pending() && - query->info_.sync->process_count != query->submit_count()) { + base::subtle::Acquire_Load(&query->info_.sync->process_count) != + query->submit_count()) { ++it; continue; } diff --git a/chromium/gpu/command_buffer/client/query_tracker.h b/chromium/gpu/command_buffer/client/query_tracker.h index 9e7f501768b..72e29e71c42 100644 --- a/chromium/gpu/command_buffer/client/query_tracker.h +++ b/chromium/gpu/command_buffer/client/query_tracker.h @@ -10,6 +10,7 @@ #include <deque> #include <list> +#include "base/atomicops.h" #include "base/containers/hash_tables.h" #include "gles2_impl_export.h" #include "gpu/command_buffer/common/gles2_cmd_format.h" @@ -105,17 +106,16 @@ class GLES2_IMPL_EXPORT QueryTracker { void MarkAsActive() { state_ = kActive; ++submit_count_; + if (submit_count_ == INT_MAX) + submit_count_ = 1; } void MarkAsPending(int32 token) { token_ = token; state_ = kPending; - flushed_ = false; } - uint32 submit_count() const { - return submit_count_; - } + base::subtle::Atomic32 submit_count() const { return submit_count_; } int32 token() const { return token_; @@ -144,9 +144,9 @@ class GLES2_IMPL_EXPORT QueryTracker { GLenum target_; QuerySyncManager::QueryInfo info_; State state_; - uint32 submit_count_; + base::subtle::Atomic32 submit_count_; int32 token_; - bool flushed_; + uint32 flush_count_; uint64 client_begin_time_us_; // Only used for latency query target. uint32 result_; }; diff --git a/chromium/gpu/command_buffer/client/query_tracker_unittest.cc b/chromium/gpu/command_buffer/client/query_tracker_unittest.cc index 800c479ec85..cd2ccf63297 100644 --- a/chromium/gpu/command_buffer/client/query_tracker_unittest.cc +++ b/chromium/gpu/command_buffer/client/query_tracker_unittest.cc @@ -18,6 +18,11 @@ namespace gpu { namespace gles2 { +namespace { +void EmptyPoll() { +} +} + class QuerySyncManagerTest : public testing::Test { protected: static const int32 kNumCommandEntries = 400; @@ -29,7 +34,7 @@ class QuerySyncManagerTest : public testing::Test { helper_.reset(new GLES2CmdHelper(command_buffer_.get())); helper_->Initialize(kCommandBufferSizeBytes); mapped_memory_.reset(new MappedMemoryManager( - helper_.get(), MappedMemoryManager::kNoLimit)); + helper_.get(), base::Bind(&EmptyPoll), MappedMemoryManager::kNoLimit)); sync_manager_.reset(new QuerySyncManager(mapped_memory_.get())); } @@ -54,7 +59,7 @@ TEST_F(QuerySyncManagerTest, Basic) { EXPECT_TRUE(sync_manager_->Alloc(&infos[ii])); EXPECT_NE(0, infos[ii].shm_id); ASSERT_TRUE(infos[ii].sync != NULL); - EXPECT_EQ(0u, infos[ii].sync->process_count); + EXPECT_EQ(0, infos[ii].sync->process_count); EXPECT_EQ(0u, infos[ii].sync->result); } @@ -83,7 +88,7 @@ class QueryTrackerTest : public testing::Test { helper_.reset(new GLES2CmdHelper(command_buffer_.get())); helper_->Initialize(kCommandBufferSizeBytes); mapped_memory_.reset(new MappedMemoryManager( - helper_.get(), MappedMemoryManager::kNoLimit)); + helper_.get(), base::Bind(&EmptyPoll), MappedMemoryManager::kNoLimit)); query_tracker_.reset(new QueryTracker(mapped_memory_.get())); } @@ -102,6 +107,8 @@ class QueryTrackerTest : public testing::Test { return query->info_.bucket; } + uint32 GetFlushGeneration() { return helper_->flush_generation(); } + scoped_ptr<CommandBuffer> command_buffer_; scoped_ptr<GLES2CmdHelper> helper_; scoped_ptr<MappedMemoryManager> mapped_memory_; @@ -138,27 +145,48 @@ TEST_F(QueryTrackerTest, Query) { EXPECT_TRUE(query->NeverUsed()); EXPECT_FALSE(query->Pending()); EXPECT_EQ(0, query->token()); - EXPECT_EQ(0u, query->submit_count()); + EXPECT_EQ(0, query->submit_count()); // Check MarkAsActive. query->MarkAsActive(); EXPECT_FALSE(query->NeverUsed()); EXPECT_FALSE(query->Pending()); EXPECT_EQ(0, query->token()); - EXPECT_EQ(1u, query->submit_count()); + EXPECT_EQ(1, query->submit_count()); // Check MarkAsPending. query->MarkAsPending(kToken); EXPECT_FALSE(query->NeverUsed()); EXPECT_TRUE(query->Pending()); EXPECT_EQ(kToken, query->token()); - EXPECT_EQ(1u, query->submit_count()); + EXPECT_EQ(1, query->submit_count()); // Check CheckResultsAvailable. EXPECT_FALSE(query->CheckResultsAvailable(helper_.get())); EXPECT_FALSE(query->NeverUsed()); EXPECT_TRUE(query->Pending()); + // Flush only once if no more flushes happened between a call to + // EndQuery command and CheckResultsAvailable + // Advance put_ so flush calls in CheckResultsAvailable go through + // and updates flush_generation count + helper_->Noop(1); + // Set Query in pending state_ to simulate EndQuery command is called + query->MarkAsPending(kToken); + EXPECT_TRUE(query->Pending()); + // Store FlushGeneration count after EndQuery is called + uint32 gen1 = GetFlushGeneration(); + EXPECT_FALSE(query->CheckResultsAvailable(helper_.get())); + uint32 gen2 = GetFlushGeneration(); + EXPECT_NE(gen1, gen2); + // Repeated calls to CheckResultsAvailable should not flush unnecessarily + EXPECT_FALSE(query->CheckResultsAvailable(helper_.get())); + gen1 = GetFlushGeneration(); + EXPECT_EQ(gen1, gen2); + EXPECT_FALSE(query->CheckResultsAvailable(helper_.get())); + gen1 = GetFlushGeneration(); + EXPECT_EQ(gen1, gen2); + // Simulate GPU process marking it as available. QuerySync* sync = GetSync(query); sync->process_count = query->submit_count(); diff --git a/chromium/gpu/command_buffer/client/ring_buffer.cc b/chromium/gpu/command_buffer/client/ring_buffer.cc index 25f63425d85..813bb348863 100644 --- a/chromium/gpu/command_buffer/client/ring_buffer.cc +++ b/chromium/gpu/command_buffer/client/ring_buffer.cc @@ -13,13 +13,16 @@ namespace gpu { -RingBuffer::RingBuffer( - Offset base_offset, unsigned int size, CommandBufferHelper* helper) +RingBuffer::RingBuffer(unsigned int alignment, Offset base_offset, + unsigned int size, CommandBufferHelper* helper, + void* base) : helper_(helper), base_offset_(base_offset), size_(size), free_offset_(0), - in_use_offset_(0) { + in_use_offset_(0), + alignment_(alignment), + base_(static_cast<int8*>(base) - base_offset) { } RingBuffer::~RingBuffer() { @@ -49,13 +52,16 @@ void RingBuffer::FreeOldestBlock() { blocks_.pop_front(); } -RingBuffer::Offset RingBuffer::Alloc(unsigned int size) { +void* RingBuffer::Alloc(unsigned int size) { DCHECK_LE(size, size_) << "attempt to allocate more than maximum memory"; DCHECK(blocks_.empty() || blocks_.back().state != IN_USE) << "Attempt to alloc another block before freeing the previous."; // Similarly to malloc, an allocation of 0 allocates at least 1 byte, to // return different pointers every time. if (size == 0) size = 1; + // Allocate rounded to alignment size so that the offsets are always + // memory-aligned. + size = RoundToAlignment(size); // Wait until there is enough room. while (size > GetLargestFreeSizeNoWaiting()) { @@ -74,11 +80,12 @@ RingBuffer::Offset RingBuffer::Alloc(unsigned int size) { if (free_offset_ == size_) { free_offset_ = 0; } - return offset + base_offset_; + return GetPointer(offset + base_offset_); } -void RingBuffer::FreePendingToken(RingBuffer::Offset offset, +void RingBuffer::FreePendingToken(void* pointer, unsigned int token) { + Offset offset = GetOffset(pointer); offset -= base_offset_; DCHECK(!blocks_.empty()) << "no allocations to free"; for (Container::reverse_iterator it = blocks_.rbegin(); diff --git a/chromium/gpu/command_buffer/client/ring_buffer.h b/chromium/gpu/command_buffer/client/ring_buffer.h index 81f1cddafa5..dfe16f7326e 100644 --- a/chromium/gpu/command_buffer/client/ring_buffer.h +++ b/chromium/gpu/command_buffer/client/ring_buffer.h @@ -10,7 +10,7 @@ #include <deque> #include "base/logging.h" -#include "gpu/command_buffer/common/types.h" +#include "base/macros.h" #include "gpu/gpu_export.h" namespace gpu { @@ -25,11 +25,13 @@ class GPU_EXPORT RingBuffer { // Creates a RingBuffer. // Parameters: + // alignment: Alignment for allocations. // base_offset: The offset of the start of the buffer. // size: The size of the buffer in bytes. // helper: A CommandBufferHelper for dealing with tokens. - RingBuffer( - Offset base_offset, unsigned int size, CommandBufferHelper* helper); + // base: The physical address that corresponds to base_offset. + RingBuffer(unsigned int alignment, Offset base_offset, + unsigned int size, CommandBufferHelper* helper, void* base); ~RingBuffer(); @@ -41,16 +43,16 @@ class GPU_EXPORT RingBuffer { // size: the size of the memory block to allocate. // // Returns: - // the offset of the allocated memory block. - Offset Alloc(unsigned int size); + // the pointer to the allocated memory block. + void* Alloc(unsigned int size); // 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. + // pointer: the pointer to the memory block to free. // token: the token value to wait for before re-using the memory. - void FreePendingToken(Offset offset, unsigned int token); + void FreePendingToken(void* pointer, unsigned int token); // Gets the size of the largest free block that is available without waiting. unsigned int GetLargestFreeSizeNoWaiting(); @@ -62,6 +64,22 @@ class GPU_EXPORT RingBuffer { return size_; } + // Gets a pointer to a memory block given the base memory and the offset. + void* GetPointer(RingBuffer::Offset offset) const { + return static_cast<int8*>(base_) + offset; + } + + // Gets the offset to a memory block given the base memory and the address. + RingBuffer::Offset GetOffset(void* pointer) const { + return static_cast<int8*>(pointer) - static_cast<int8*>(base_); + } + + // Rounds the given size to the alignment in use. + unsigned int RoundToAlignment(unsigned int size) { + return (size + alignment_ - 1) & ~(alignment_ - 1); + } + + private: enum State { IN_USE, @@ -105,92 +123,13 @@ class GPU_EXPORT RingBuffer { // Range between in_use_mark and free_mark is in use. Offset in_use_offset_; - DISALLOW_IMPLICIT_CONSTRUCTORS(RingBuffer); -}; - -// This class functions just like RingBuffer, but its API uses pointers -// instead of offsets. -class RingBufferWrapper { - public: - // Parameters: - // base_offset: The offset to the start of the buffer - // size: The size of the buffer in bytes. - // helper: A CommandBufferHelper for dealing with tokens. - // base: The physical address that corresponds to base_offset. - RingBufferWrapper(RingBuffer::Offset base_offset, - unsigned int size, - CommandBufferHelper* helper, - void* base) - : allocator_(base_offset, size, helper), - base_(static_cast<int8*>(base) - base_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. - // - // 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) { - RingBuffer::Offset offset = allocator_.Alloc(size); - return GetPointer(offset); - } + // Alignment for allocations. + unsigned int alignment_; - // 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, 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. - void* GetPointer(RingBuffer::Offset offset) const { - return static_cast<int8*>(base_) + offset; - } - - // Gets the offset to a memory block given the base memory and the address. - RingBuffer::Offset GetOffset(void* pointer) const { - return static_cast<int8*>(pointer) - static_cast<int8*>(base_); - } - - // Gets the size of the largest free block that is available without waiting. - unsigned int GetLargestFreeSizeNoWaiting() { - return allocator_.GetLargestFreeSizeNoWaiting(); - } - - // Gets the size of the largest free block that can be allocated if the - // caller can wait. - unsigned int GetLargestFreeOrPendingSize() { - return allocator_.GetLargestFreeOrPendingSize(); - } - - private: - RingBuffer allocator_; + // The physical address that corresponds to base_offset. void* base_; - DISALLOW_IMPLICIT_CONSTRUCTORS(RingBufferWrapper); + + DISALLOW_IMPLICIT_CONSTRUCTORS(RingBuffer); }; } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/ring_buffer_test.cc b/chromium/gpu/command_buffer/client/ring_buffer_test.cc index 05014289eab..0b58e3abcbd 100644 --- a/chromium/gpu/command_buffer/client/ring_buffer_test.cc +++ b/chromium/gpu/command_buffer/client/ring_buffer_test.cc @@ -35,6 +35,7 @@ class BaseRingBufferTest : public testing::Test { protected: static const unsigned int kBaseOffset = 128; static const unsigned int kBufferSize = 1024; + static const unsigned int kAlignment = 4; void RunPendingSetToken() { for (std::vector<const void*>::iterator it = set_token_arguments_.begin(); @@ -92,7 +93,7 @@ class BaseRingBufferTest : public testing::Test { } int32 GetToken() { - return command_buffer_->GetState().token; + return command_buffer_->GetLastState().token; } #if defined(OS_MACOSX) @@ -107,6 +108,8 @@ class BaseRingBufferTest : public testing::Test { std::vector<const void*> set_token_arguments_; bool delay_set_token_; + scoped_ptr<int8[]> buffer_; + int8* buffer_start_; }; #ifndef _MSC_VER @@ -122,7 +125,11 @@ class RingBufferTest : public BaseRingBufferTest { protected: virtual void SetUp() { BaseRingBufferTest::SetUp(); - allocator_.reset(new RingBuffer(kBaseOffset, kBufferSize, helper_.get())); + + buffer_.reset(new int8[kBufferSize + kBaseOffset]); + buffer_start_ = buffer_.get() + kBaseOffset; + allocator_.reset(new RingBuffer(kAlignment, kBaseOffset, kBufferSize, + helper_.get(), buffer_start_)); } virtual void TearDown() { @@ -140,12 +147,12 @@ TEST_F(RingBufferTest, TestBasic) { const unsigned int kSize = 16; EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeOrPendingSize()); EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeSizeNoWaiting()); - RingBuffer::Offset offset = allocator_->Alloc(kSize); - EXPECT_GE(kBufferSize, offset - kBaseOffset + kSize); + void* pointer = allocator_->Alloc(kSize); + EXPECT_GE(kBufferSize, allocator_->GetOffset(pointer) - kBaseOffset + kSize); EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeOrPendingSize()); EXPECT_EQ(kBufferSize - kSize, allocator_->GetLargestFreeSizeNoWaiting()); int32 token = helper_->InsertToken(); - allocator_->FreePendingToken(offset, token); + allocator_->FreePendingToken(pointer, token); } // Checks the free-pending-token mechanism. @@ -158,10 +165,11 @@ TEST_F(RingBufferTest, TestFreePendingToken) { // Allocate several buffers to fill in the memory. int32 tokens[kAllocCount]; for (unsigned int ii = 0; ii < kAllocCount; ++ii) { - RingBuffer::Offset offset = allocator_->Alloc(kSize); - EXPECT_GE(kBufferSize, offset - kBaseOffset + kSize); + void* pointer = allocator_->Alloc(kSize); + EXPECT_GE(kBufferSize, + allocator_->GetOffset(pointer) - kBaseOffset + kSize); tokens[ii] = helper_->InsertToken(); - allocator_->FreePendingToken(offset, tokens[ii]); + allocator_->FreePendingToken(pointer, tokens[ii]); } EXPECT_EQ(kBufferSize - (kSize * kAllocCount), @@ -171,131 +179,38 @@ TEST_F(RingBufferTest, TestFreePendingToken) { // This allocation will need to reclaim the space freed above, so that should // process the commands until a token is passed. - RingBuffer::Offset offset1 = allocator_->Alloc(kSize); - EXPECT_EQ(kBaseOffset, offset1); + void* pointer1 = allocator_->Alloc(kSize); + EXPECT_EQ(kBaseOffset, allocator_->GetOffset(pointer1)); // Check that the token has indeed passed. EXPECT_LE(tokens[0], GetToken()); - allocator_->FreePendingToken(offset1, helper_->InsertToken()); + allocator_->FreePendingToken(pointer1, helper_->InsertToken()); } // Tests GetLargestFreeSizeNoWaiting TEST_F(RingBufferTest, TestGetLargestFreeSizeNoWaiting) { EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeSizeNoWaiting()); - RingBuffer::Offset offset = allocator_->Alloc(kBufferSize); + void* pointer = allocator_->Alloc(kBufferSize); EXPECT_EQ(0u, allocator_->GetLargestFreeSizeNoWaiting()); - allocator_->FreePendingToken(offset, helper_->InsertToken()); + allocator_->FreePendingToken(pointer, helper_->InsertToken()); } TEST_F(RingBufferTest, TestFreeBug) { // The first and second allocations must not match. - const unsigned int kAlloc1 = 10; + const unsigned int kAlloc1 = 3*kAlignment; const unsigned int kAlloc2 = 20; - RingBuffer::Offset offset = allocator_->Alloc(kAlloc1); + void* pointer = allocator_->Alloc(kAlloc1); EXPECT_EQ(kBufferSize - kAlloc1, allocator_->GetLargestFreeSizeNoWaiting()); - allocator_->FreePendingToken(offset, helper_.get()->InsertToken()); - offset = allocator_->Alloc(kAlloc2); + allocator_->FreePendingToken(pointer, helper_.get()->InsertToken()); + pointer = allocator_->Alloc(kAlloc2); EXPECT_EQ(kBufferSize - kAlloc1 - kAlloc2, allocator_->GetLargestFreeSizeNoWaiting()); - allocator_->FreePendingToken(offset, helper_.get()->InsertToken()); - offset = allocator_->Alloc(kBufferSize); + allocator_->FreePendingToken(pointer, helper_.get()->InsertToken()); + pointer = allocator_->Alloc(kBufferSize); EXPECT_EQ(0u, allocator_->GetLargestFreeSizeNoWaiting()); - allocator_->FreePendingToken(offset, helper_.get()->InsertToken()); -} - -// Test fixture for RingBufferWrapper test - Creates a -// RingBufferWrapper, 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 RingBufferWrapperTest : public BaseRingBufferTest { - protected: - virtual void SetUp() { - BaseRingBufferTest::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 int8[kBufferSize + kBaseOffset]); - buffer_start_ = buffer_.get() + kBaseOffset; - allocator_.reset(new RingBufferWrapper( - kBaseOffset, kBufferSize, helper_.get(), buffer_start_)); - } - - virtual void TearDown() { - // If the GpuScheduler posts any tasks, this forces them to run. - base::MessageLoop::current()->RunUntilIdle(); - - BaseRingBufferTest::TearDown(); - } - - scoped_ptr<RingBufferWrapper> allocator_; - scoped_ptr<int8[]> buffer_; - int8* buffer_start_; -}; - -// Checks basic alloc and free. -TEST_F(RingBufferWrapperTest, TestBasic) { - const unsigned int kSize = 16; - void* pointer = allocator_->Alloc(kSize); - ASSERT_TRUE(pointer); - EXPECT_LE(buffer_start_, static_cast<int8*>(pointer)); - EXPECT_GE(kBufferSize, static_cast<int8*>(pointer) - buffer_start_ + kSize); - - allocator_->FreePendingToken(pointer, helper_->InsertToken()); - - int8* pointer_int8 = allocator_->AllocTyped<int8>(kSize); - ASSERT_TRUE(pointer_int8); - EXPECT_LE(buffer_start_, pointer_int8); - EXPECT_GE(buffer_start_ + kBufferSize, pointer_int8 + kSize); - allocator_->FreePendingToken(pointer_int8, helper_->InsertToken()); - - unsigned int* pointer_uint = allocator_->AllocTyped<unsigned int>(kSize); - ASSERT_TRUE(pointer_uint); - EXPECT_LE(buffer_start_, reinterpret_cast<int8*>(pointer_uint)); - EXPECT_GE(buffer_start_ + kBufferSize, - reinterpret_cast<int8* >(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 - kSize - kSize * sizeof(*pointer_uint), - allocator_->GetLargestFreeSizeNoWaiting()); - allocator_->FreePendingToken(pointer_uint, helper_->InsertToken()); -} - -// Checks the free-pending-token mechanism. -TEST_F(RingBufferWrapperTest, TestFreePendingToken) { - const unsigned int kSize = 16; - const unsigned int kAllocCount = kBufferSize / kSize; - CHECK(kAllocCount * kSize == kBufferSize); - - delay_set_token_ = true; - // Allocate several buffers to fill in the memory. - int32 tokens[kAllocCount]; - for (unsigned int ii = 0; ii < kAllocCount; ++ii) { - void* pointer = allocator_->Alloc(kSize); - EXPECT_TRUE(pointer != NULL); - tokens[ii] = helper_->InsertToken(); - allocator_->FreePendingToken(pointer, helper_->InsertToken()); - } - - EXPECT_EQ(kBufferSize - (kSize * kAllocCount), - allocator_->GetLargestFreeSizeNoWaiting()); - - RunPendingSetToken(); - - // This allocation will need to reclaim the space freed above, so that should - // process the commands until the token is passed. - void* pointer1 = allocator_->Alloc(kSize); - EXPECT_EQ(buffer_start_, static_cast<int8*>(pointer1)); - - // Check that the token has indeed passed. - EXPECT_LE(tokens[0], GetToken()); - - allocator_->FreePendingToken(pointer1, helper_->InsertToken()); - EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken()); + allocator_->FreePendingToken(pointer, helper_.get()->InsertToken()); } } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/share_group.cc b/chromium/gpu/command_buffer/client/share_group.cc index cb9f9bca5c6..96ab8d181be 100644 --- a/chromium/gpu/command_buffer/client/share_group.cc +++ b/chromium/gpu/command_buffer/client/share_group.cc @@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <stack> +#include <vector> + #include "gpu/command_buffer/client/share_group.h" #include "base/logging.h" @@ -13,6 +16,9 @@ namespace gpu { namespace gles2 { +ShareGroupContextData::IdHandlerData::IdHandlerData() : flush_generation_(0) {} +ShareGroupContextData::IdHandlerData::~IdHandlerData() {} + COMPILE_ASSERT(gpu::kInvalidResource == 0, INVALID_RESOURCE_NOT_0_AS_GL_EXPECTS); @@ -26,6 +32,7 @@ class IdHandler : public IdHandlerInterface { virtual void MakeIds( GLES2Implementation* /* gl_impl */, GLuint id_offset, GLsizei n, GLuint* ids) OVERRIDE { + base::AutoLock auto_lock(lock_); if (id_offset == 0) { for (GLsizei ii = 0; ii < n; ++ii) { ids[ii] = id_allocator_.AllocateID(); @@ -42,35 +49,144 @@ class IdHandler : public IdHandlerInterface { virtual bool FreeIds( GLES2Implementation* gl_impl, GLsizei n, const GLuint* ids, DeleteFn delete_fn) OVERRIDE { + base::AutoLock auto_lock(lock_); + for (GLsizei ii = 0; ii < n; ++ii) { id_allocator_.FreeID(ids[ii]); } + (gl_impl->*delete_fn)(n, ids); // We need to ensure that the delete call is evaluated on the service side // before any other contexts issue commands using these client ids. + // TODO(vmiura): Can remove this by virtualizing internal ids, however + // this code only affects PPAPI for now. gl_impl->helper()->CommandBufferHelper::Flush(); return true; } // Overridden from IdHandlerInterface. virtual bool MarkAsUsedForBind(GLuint id) OVERRIDE { - return id == 0 ? true : id_allocator_.MarkAsUsed(id); + if (id == 0) + return true; + base::AutoLock auto_lock(lock_); + return id_allocator_.MarkAsUsed(id); } - protected: + + virtual void FreeContext(GLES2Implementation* gl_impl) OVERRIDE {} + + private: + base::Lock lock_; IdAllocator id_allocator_; }; -// An id handler that require Gen before Bind. -class StrictIdHandler : public IdHandler { +// An id handler that requires Gen before Bind. +class StrictIdHandler : public IdHandlerInterface { public: - StrictIdHandler() {} + explicit StrictIdHandler(int id_namespace) : id_namespace_(id_namespace) {} virtual ~StrictIdHandler() {} // Overridden from IdHandler. + virtual void MakeIds(GLES2Implementation* gl_impl, + GLuint /* id_offset */, + GLsizei n, + GLuint* ids) OVERRIDE { + base::AutoLock auto_lock(lock_); + + // Collect pending FreeIds from other flush_generation. + CollectPendingFreeIds(gl_impl); + + for (GLsizei ii = 0; ii < n; ++ii) { + if (!free_ids_.empty()) { + // Allocate a previously freed Id. + ids[ii] = free_ids_.top(); + free_ids_.pop(); + + // Record kIdInUse state. + DCHECK(id_states_[ids[ii] - 1] == kIdFree); + id_states_[ids[ii] - 1] = kIdInUse; + } else { + // Allocate a new Id. + id_states_.push_back(kIdInUse); + ids[ii] = id_states_.size(); + } + } + } + + // Overridden from IdHandler. + virtual bool FreeIds(GLES2Implementation* gl_impl, + GLsizei n, + const GLuint* ids, + DeleteFn delete_fn) OVERRIDE { + + // Delete stub must run before CollectPendingFreeIds. + (gl_impl->*delete_fn)(n, ids); + + { + base::AutoLock auto_lock(lock_); + + // Collect pending FreeIds from other flush_generation. + CollectPendingFreeIds(gl_impl); + + // Save Ids to free in a later flush_generation. + ShareGroupContextData::IdHandlerData* ctxt_data = + gl_impl->share_group_context_data()->id_handler_data(id_namespace_); + + for (GLsizei ii = 0; ii < n; ++ii) { + GLuint id = ids[ii]; + if (id != 0) { + // Save freed Id for later. + DCHECK(id_states_[id - 1] == kIdInUse); + id_states_[id - 1] = kIdPendingFree; + ctxt_data->freed_ids_.push_back(id); + } + } + } + + return true; + } + + // Overridden from IdHandler. virtual bool MarkAsUsedForBind(GLuint id) OVERRIDE { - DCHECK(id == 0 || id_allocator_.InUse(id)); - return IdHandler::MarkAsUsedForBind(id); +#ifndef NDEBUG + if (id != 0) { + base::AutoLock auto_lock(lock_); + DCHECK(id_states_[id - 1] == kIdInUse); + } +#endif + return true; + } + + // Overridden from IdHandlerInterface. + virtual void FreeContext(GLES2Implementation* gl_impl) OVERRIDE { + base::AutoLock auto_lock(lock_); + CollectPendingFreeIds(gl_impl); + } + + private: + enum IdState { kIdFree, kIdPendingFree, kIdInUse }; + + void CollectPendingFreeIds(GLES2Implementation* gl_impl) { + uint32 flush_generation = gl_impl->helper()->flush_generation(); + ShareGroupContextData::IdHandlerData* ctxt_data = + gl_impl->share_group_context_data()->id_handler_data(id_namespace_); + + if (ctxt_data->flush_generation_ != flush_generation) { + ctxt_data->flush_generation_ = flush_generation; + for (uint32 ii = 0; ii < ctxt_data->freed_ids_.size(); ++ii) { + const GLuint id = ctxt_data->freed_ids_[ii]; + DCHECK(id_states_[id - 1] == kIdPendingFree); + id_states_[id - 1] = kIdFree; + free_ids_.push(id); + } + ctxt_data->freed_ids_.clear(); + } } + + int id_namespace_; + + base::Lock lock_; + std::vector<uint8> id_states_; + std::stack<uint32> free_ids_; }; // An id handler for ids that are never reused. @@ -83,6 +199,7 @@ class NonReusedIdHandler : public IdHandlerInterface { virtual void MakeIds( GLES2Implementation* /* gl_impl */, GLuint id_offset, GLsizei n, GLuint* ids) OVERRIDE { + base::AutoLock auto_lock(lock_); for (GLsizei ii = 0; ii < n; ++ii) { ids[ii] = ++last_id_ + id_offset; } @@ -103,82 +220,11 @@ class NonReusedIdHandler : public IdHandlerInterface { return false; } - private: - GLuint last_id_; -}; - -// An id handler for shared ids. -class SharedIdHandler : public IdHandlerInterface { - public: - SharedIdHandler( - id_namespaces::IdNamespaces id_namespace) - : id_namespace_(id_namespace) { - } - - virtual ~SharedIdHandler() {} - - virtual void MakeIds(GLES2Implementation* gl_impl, - GLuint id_offset, - GLsizei n, - GLuint* ids) OVERRIDE { - gl_impl->GenSharedIdsCHROMIUM(id_namespace_, id_offset, n, ids); - } - - virtual bool FreeIds(GLES2Implementation* gl_impl, - GLsizei n, - const GLuint* ids, - DeleteFn delete_fn) OVERRIDE { - gl_impl->DeleteSharedIdsCHROMIUM(id_namespace_, n, ids); - (gl_impl->*delete_fn)(n, ids); - // We need to ensure that the delete call is evaluated on the service side - // before any other contexts issue commands using these client ids. - gl_impl->helper()->CommandBufferHelper::Flush(); - return true; - } - - virtual bool MarkAsUsedForBind(GLuint id) OVERRIDE { - // This has no meaning for shared resources. - return true; - } - - private: - id_namespaces::IdNamespaces id_namespace_; -}; - -class ThreadSafeIdHandlerWrapper : public IdHandlerInterface { - public: - ThreadSafeIdHandlerWrapper(IdHandlerInterface* id_handler) - : id_handler_(id_handler) { - } - virtual ~ThreadSafeIdHandlerWrapper() { } - - // Overridden from IdHandlerInterface. - virtual void MakeIds(GLES2Implementation* gl_impl, - GLuint id_offset, - GLsizei n, - GLuint* ids) OVERRIDE { - base::AutoLock auto_lock(lock_); - id_handler_->MakeIds(gl_impl, id_offset, n, ids); - } - - // Overridden from IdHandlerInterface. - virtual bool FreeIds(GLES2Implementation* gl_impl, - GLsizei n, - const GLuint* ids, - DeleteFn delete_fn) OVERRIDE { - base::AutoLock auto_lock(lock_); - return id_handler_->FreeIds(gl_impl, n, ids, delete_fn); - } - - // Overridden from IdHandlerInterface. - virtual bool MarkAsUsedForBind(GLuint id) OVERRIDE { - base::AutoLock auto_lock(lock_); - return id_handler_->MarkAsUsedForBind(id); - } + virtual void FreeContext(GLES2Implementation* gl_impl) OVERRIDE {} private: - scoped_ptr<IdHandlerInterface> id_handler_; - base::Lock lock_; + base::Lock lock_; + GLuint last_id_; }; ShareGroup::ShareGroup(bool bind_generates_resource) @@ -186,21 +232,17 @@ ShareGroup::ShareGroup(bool bind_generates_resource) if (bind_generates_resource) { for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { if (i == id_namespaces::kProgramsAndShaders) { - id_handlers_[i].reset(new ThreadSafeIdHandlerWrapper( - new NonReusedIdHandler())); + id_handlers_[i].reset(new NonReusedIdHandler()); } else { - id_handlers_[i].reset(new ThreadSafeIdHandlerWrapper( - new IdHandler())); + id_handlers_[i].reset(new IdHandler()); } } } else { for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { if (i == id_namespaces::kProgramsAndShaders) { - id_handlers_[i].reset(new ThreadSafeIdHandlerWrapper( - new NonReusedIdHandler())); + id_handlers_[i].reset(new NonReusedIdHandler()); } else { - id_handlers_[i].reset(new ThreadSafeIdHandlerWrapper( - new StrictIdHandler())); + id_handlers_[i].reset(new StrictIdHandler(i)); } } } diff --git a/chromium/gpu/command_buffer/client/share_group.h b/chromium/gpu/command_buffer/client/share_group.h index 68ea6a9895a..341dd586839 100644 --- a/chromium/gpu/command_buffer/client/share_group.h +++ b/chromium/gpu/command_buffer/client/share_group.h @@ -20,6 +20,24 @@ class ProgramInfoManager; typedef void (GLES2Implementation::*DeleteFn)(GLsizei n, const GLuint* ids); +class ShareGroupContextData { + public: + struct IdHandlerData { + IdHandlerData(); + ~IdHandlerData(); + + std::vector<GLuint> freed_ids_; + uint32 flush_generation_; + }; + + IdHandlerData* id_handler_data(int namespace_id) { + return &id_handler_data_[namespace_id]; + } + + private: + IdHandlerData id_handler_data_[id_namespaces::kNumIdNamespaces]; +}; + // Base class for IdHandlers class IdHandlerInterface { public: @@ -38,6 +56,9 @@ class IdHandlerInterface { // Marks an id as used for glBind functions. id = 0 does nothing. virtual bool MarkAsUsedForBind(GLuint id) = 0; + + // Called when a context in the share group is destructed. + virtual void FreeContext(GLES2Implementation* gl_impl) = 0; }; // ShareGroup manages shared resources for contexts that are sharing resources. @@ -60,6 +81,12 @@ class GLES2_IMPL_EXPORT ShareGroup return program_info_manager_.get(); } + void FreeContext(GLES2Implementation* gl_impl) { + for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { + id_handlers_[i]->FreeContext(gl_impl); + } + } + private: friend class gpu::RefCountedThreadSafe<ShareGroup>; friend class gpu::gles2::GLES2ImplementationTest; diff --git a/chromium/gpu/command_buffer/client/transfer_buffer.cc b/chromium/gpu/command_buffer/client/transfer_buffer.cc index c4b84a14f32..c5ce3d549bd 100644 --- a/chromium/gpu/command_buffer/client/transfer_buffer.cc +++ b/chromium/gpu/command_buffer/client/transfer_buffer.cc @@ -6,14 +6,13 @@ #include "gpu/command_buffer/client/transfer_buffer.h" +#include "base/bits.h" +#include "base/debug/trace_event.h" #include "base/logging.h" #include "gpu/command_buffer/client/cmd_buffer_helper.h" namespace gpu { -AlignedRingBuffer::~AlignedRingBuffer() { -} - TransferBuffer::TransferBuffer( CommandBufferHelper* helper) : helper_(helper), @@ -53,11 +52,11 @@ bool TransferBuffer::Initialize( void TransferBuffer::Free() { if (HaveBuffer()) { + TRACE_EVENT0("gpu", "TransferBuffer::Free"); helper_->Finish(); helper_->command_buffer()->DestroyTransferBuffer(buffer_id_); buffer_id_ = -1; - buffer_.ptr = NULL; - buffer_.size = 0; + buffer_ = NULL; result_buffer_ = NULL; result_shm_offset_ = 0; ring_buffer_.reset(); @@ -66,6 +65,7 @@ void TransferBuffer::Free() { } bool TransferBuffer::HaveBuffer() const { + DCHECK(buffer_id_ == -1 || buffer_); return buffer_id_ != -1; } @@ -84,19 +84,19 @@ void TransferBuffer::FreePendingToken(void* p, unsigned int token) { void TransferBuffer::AllocateRingBuffer(unsigned int size) { for (;size >= min_buffer_size_; size /= 2) { int32 id = -1; - gpu::Buffer buffer = + scoped_refptr<gpu::Buffer> buffer = helper_->command_buffer()->CreateTransferBuffer(size, &id); if (id != -1) { + DCHECK(buffer); buffer_ = buffer; - ring_buffer_.reset(new AlignedRingBuffer( + ring_buffer_.reset(new RingBuffer( alignment_, - id, result_size_, - buffer_.size - result_size_, + buffer_->size() - result_size_, helper_, - static_cast<char*>(buffer_.ptr) + result_size_)); + static_cast<char*>(buffer_->memory()) + result_size_)); buffer_id_ = id; - result_buffer_ = buffer_.ptr; + result_buffer_ = buffer_->memory(); result_shm_offset_ = 0; return; } @@ -106,36 +106,8 @@ void TransferBuffer::AllocateRingBuffer(unsigned int size) { usable_ = false; } -// Returns the integer i such as 2^i <= n < 2^(i+1) -static int Log2Floor(uint32 n) { - if (n == 0) - return -1; - int log = 0; - uint32 value = n; - for (int i = 4; i >= 0; --i) { - int shift = (1 << i); - uint32 x = value >> shift; - if (x != 0) { - value = x; - log += shift; - } - } - DCHECK_EQ(value, 1u); - return log; -} - -// Returns the integer i such as 2^(i-1) < n <= 2^i -static int Log2Ceiling(uint32 n) { - if (n == 0) { - return -1; - } else { - // Log2Floor returns -1 for 0, so the following works correctly for n=1. - return 1 + Log2Floor(n - 1); - } -} - static unsigned int ComputePOTSize(unsigned int dimension) { - return (dimension == 0) ? 0 : 1 << Log2Ceiling(dimension); + return (dimension == 0) ? 0 : 1 << base::bits::Log2Ceiling(dimension); } void TransferBuffer::ReallocateRingBuffer(unsigned int size) { @@ -145,7 +117,7 @@ void TransferBuffer::ReallocateRingBuffer(unsigned int size) { needed_buffer_size = std::max(needed_buffer_size, default_buffer_size_); needed_buffer_size = std::min(needed_buffer_size, max_buffer_size_); - if (usable_ && (!HaveBuffer() || needed_buffer_size > buffer_.size)) { + if (usable_ && (!HaveBuffer() || needed_buffer_size > buffer_->size())) { if (HaveBuffer()) { Free(); } diff --git a/chromium/gpu/command_buffer/client/transfer_buffer.h b/chromium/gpu/command_buffer/client/transfer_buffer.h index 11173985819..348ad32b200 100644 --- a/chromium/gpu/command_buffer/client/transfer_buffer.h +++ b/chromium/gpu/command_buffer/client/transfer_buffer.h @@ -16,40 +16,6 @@ namespace gpu { class CommandBufferHelper; -// Wraps RingBufferWrapper to provide aligned allocations. -class AlignedRingBuffer : public RingBufferWrapper { - public: - AlignedRingBuffer( - unsigned int alignment, - int32 shm_id, - RingBuffer::Offset base_offset, - unsigned int size, - CommandBufferHelper* helper, - void* base) - : RingBufferWrapper(base_offset, size, helper, base), - alignment_(alignment), - shm_id_(shm_id) { - } - ~AlignedRingBuffer(); - - // Hiding Alloc from RingBufferWrapper - void* Alloc(unsigned int size) { - return RingBufferWrapper::Alloc(RoundToAlignment(size)); - } - - int32 GetShmId() const { - return shm_id_; - } - - private: - unsigned int RoundToAlignment(unsigned int size) { - return (size + alignment_ - 1) & ~(alignment_ - 1); - } - - unsigned int alignment_; - int32 shm_id_; -}; - // Interface for managing the transfer buffer. class GPU_EXPORT TransferBufferInterface { public: @@ -120,7 +86,7 @@ class GPU_EXPORT TransferBuffer : public TransferBufferInterface { void AllocateRingBuffer(unsigned int size); CommandBufferHelper* helper_; - scoped_ptr<AlignedRingBuffer> ring_buffer_; + scoped_ptr<RingBuffer> ring_buffer_; // size reserved for results unsigned int result_size_; @@ -144,7 +110,7 @@ class GPU_EXPORT TransferBuffer : public TransferBufferInterface { unsigned int bytes_since_last_flush_; // the current buffer. - gpu::Buffer buffer_; + scoped_refptr<gpu::Buffer> buffer_; // id of buffer. -1 = no buffer int32 buffer_id_; diff --git a/chromium/gpu/command_buffer/client/transfer_buffer_unittest.cc b/chromium/gpu/command_buffer/client/transfer_buffer_unittest.cc index 39ce923f78c..9f3b51e4750 100644 --- a/chromium/gpu/command_buffer/client/transfer_buffer_unittest.cc +++ b/chromium/gpu/command_buffer/client/transfer_buffer_unittest.cc @@ -181,6 +181,17 @@ TEST_F(TransferBufferTest, TooLargeAllocation) { transfer_buffer_->FreePendingToken(ptr, 1); } +TEST_F(TransferBufferTest, MemoryAlignmentAfterZeroAllocation) { + Initialize(32u); + void* ptr = transfer_buffer_->Alloc(0); + EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u); + transfer_buffer_->FreePendingToken(ptr, -1); + // Check that the pointer is aligned on the following allocation. + ptr = transfer_buffer_->Alloc(4); + EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u); + transfer_buffer_->FreePendingToken(ptr, 1); +} + TEST_F(TransferBufferTest, Flush) { Initialize(16u); unsigned int size_allocated = 0; @@ -214,9 +225,10 @@ class MockClientCommandBufferCanFail : public MockClientCommandBufferMockFlush { virtual ~MockClientCommandBufferCanFail() { } - MOCK_METHOD2(CreateTransferBuffer, Buffer(size_t size, int32* id)); + MOCK_METHOD2(CreateTransferBuffer, + scoped_refptr<Buffer>(size_t size, int32* id)); - Buffer RealCreateTransferBuffer(size_t size, int32* id) { + scoped_refptr<gpu::Buffer> RealCreateTransferBuffer(size_t size, int32* id) { return MockCommandBufferBase::CreateTransferBuffer(size, id); } }; @@ -375,7 +387,8 @@ TEST_F(TransferBufferExpandContractTest, Contract) { // Try to allocate again, fail first request EXPECT_CALL(*command_buffer(), CreateTransferBuffer(kStartTransferBufferSize, _)) - .WillOnce(DoAll(SetArgPointee<1>(-1), Return(Buffer()))) + .WillOnce( + DoAll(SetArgPointee<1>(-1), Return(scoped_refptr<gpu::Buffer>()))) .RetiresOnSaturation(); EXPECT_CALL(*command_buffer(), CreateTransferBuffer(kMinTransferBufferSize, _)) @@ -427,9 +440,12 @@ TEST_F(TransferBufferExpandContractTest, OutOfMemory) { // Try to allocate again, fail both requests. EXPECT_CALL(*command_buffer(), CreateTransferBuffer(_, _)) - .WillOnce(DoAll(SetArgPointee<1>(-1), Return(Buffer()))) - .WillOnce(DoAll(SetArgPointee<1>(-1), Return(Buffer()))) - .WillOnce(DoAll(SetArgPointee<1>(-1), Return(Buffer()))) + .WillOnce( + DoAll(SetArgPointee<1>(-1), Return(scoped_refptr<gpu::Buffer>()))) + .WillOnce( + DoAll(SetArgPointee<1>(-1), Return(scoped_refptr<gpu::Buffer>()))) + .WillOnce( + DoAll(SetArgPointee<1>(-1), Return(scoped_refptr<gpu::Buffer>()))) .RetiresOnSaturation(); const size_t kSize1 = 512 - kStartingOffset; diff --git a/chromium/gpu/command_buffer/client/vertex_array_object_manager.h b/chromium/gpu/command_buffer/client/vertex_array_object_manager.h index d5b07ec0e88..34f630d95ae 100644 --- a/chromium/gpu/command_buffer/client/vertex_array_object_manager.h +++ b/chromium/gpu/command_buffer/client/vertex_array_object_manager.h @@ -6,10 +6,11 @@ #define GPU_COMMAND_BUFFER_CLIENT_VERTEX_ARRAY_OBJECT_MANAGER_H_ #include <GLES2/gl2.h> + #include "base/containers/hash_tables.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "gles2_impl_export.h" -#include "gpu/command_buffer/common/types.h" namespace gpu { namespace gles2 { |