diff options
Diffstat (limited to 'chromium/gpu/command_buffer/client')
23 files changed, 616 insertions, 37 deletions
diff --git a/chromium/gpu/command_buffer/client/client_font_manager.cc b/chromium/gpu/command_buffer/client/client_font_manager.cc index 6dc6f269cdb..8a11104ee88 100644 --- a/chromium/gpu/command_buffer/client/client_font_manager.cc +++ b/chromium/gpu/command_buffer/client/client_font_manager.cc @@ -4,6 +4,8 @@ #include "gpu/command_buffer/client/client_font_manager.h" +#include "base/logging.h" + namespace gpu { namespace raster { diff --git a/chromium/gpu/command_buffer/client/cmd_buffer_helper.h b/chromium/gpu/command_buffer/client/cmd_buffer_helper.h index eca26c60e79..7111a460147 100644 --- a/chromium/gpu/command_buffer/client/cmd_buffer_helper.h +++ b/chromium/gpu/command_buffer/client/cmd_buffer_helper.h @@ -11,7 +11,7 @@ #include <stdint.h> #include <string.h> -#include "base/logging.h" +#include "base/check_op.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/time/time.h" diff --git a/chromium/gpu/command_buffer/client/fenced_allocator.h b/chromium/gpu/command_buffer/client/fenced_allocator.h index 7b238dd8249..d3299c11768 100644 --- a/chromium/gpu/command_buffer/client/fenced_allocator.h +++ b/chromium/gpu/command_buffer/client/fenced_allocator.h @@ -13,7 +13,7 @@ #include <vector> #include "base/bind.h" -#include "base/logging.h" +#include "base/check.h" #include "base/macros.h" #include "gpu/gpu_export.h" diff --git a/chromium/gpu/command_buffer/client/fenced_allocator_test.cc b/chromium/gpu/command_buffer/client/fenced_allocator_test.cc index ed09dd197f6..f68bf95f8b3 100644 --- a/chromium/gpu/command_buffer/client/fenced_allocator_test.cc +++ b/chromium/gpu/command_buffer/client/fenced_allocator_test.cc @@ -119,7 +119,7 @@ TEST_F(FencedAllocatorTest, TestOutOfMemory) { const unsigned int kSize = 16; const unsigned int kAllocCount = kBufferSize / kSize; - CHECK(kAllocCount * kSize == kBufferSize); + CHECK_EQ(kAllocCount * kSize, kBufferSize); // Allocate several buffers to fill in the memory. FencedAllocator::Offset offsets[kAllocCount]; @@ -161,7 +161,7 @@ TEST_F(FencedAllocatorTest, TestFreePendingToken) { const unsigned int kSize = 16; const unsigned int kAllocCount = kBufferSize / kSize; - CHECK(kAllocCount * kSize == kBufferSize); + CHECK_EQ(kAllocCount * kSize, kBufferSize); // Allocate several buffers to fill in the memory. FencedAllocator::Offset offsets[kAllocCount]; @@ -209,7 +209,7 @@ TEST_F(FencedAllocatorTest, FreeUnused) { const unsigned int kSize = 16; const unsigned int kAllocCount = kBufferSize / kSize; - CHECK(kAllocCount * kSize == kBufferSize); + CHECK_EQ(kAllocCount * kSize, kBufferSize); // Allocate several buffers to fill in the memory. FencedAllocator::Offset offsets[kAllocCount]; @@ -406,7 +406,7 @@ TEST_F(FencedAllocatorWrapperTest, TestBasic) { allocator_->CheckConsistency(); const unsigned int kSize = 16; - void *pointer = allocator_->Alloc(kSize); + void* pointer = allocator_->Alloc(kSize); ASSERT_TRUE(pointer); EXPECT_LE(buffer_.get(), static_cast<char *>(pointer)); EXPECT_GE(kBufferSize, static_cast<char *>(pointer) - buffer_.get() + kSize); @@ -415,14 +415,14 @@ TEST_F(FencedAllocatorWrapperTest, TestBasic) { allocator_->Free(pointer); EXPECT_TRUE(allocator_->CheckConsistency()); - char *pointer_char = allocator_->AllocTyped<char>(kSize); + char* pointer_char = allocator_->AllocTyped<char>(kSize); ASSERT_TRUE(pointer_char); EXPECT_LE(buffer_.get(), pointer_char); EXPECT_GE(buffer_.get() + kBufferSize, pointer_char + kSize); allocator_->Free(pointer_char); EXPECT_TRUE(allocator_->CheckConsistency()); - unsigned int *pointer_uint = allocator_->AllocTyped<unsigned int>(kSize); + unsigned int* pointer_uint = allocator_->AllocTyped<unsigned int>(kSize); ASSERT_TRUE(pointer_uint); EXPECT_LE(buffer_.get(), reinterpret_cast<char *>(pointer_uint)); EXPECT_GE(buffer_.get() + kBufferSize, @@ -439,7 +439,7 @@ TEST_F(FencedAllocatorWrapperTest, TestBasic) { TEST_F(FencedAllocatorWrapperTest, TestAllocZero) { allocator_->CheckConsistency(); - void *pointer = allocator_->Alloc(0); + void* pointer = allocator_->Alloc(0); ASSERT_FALSE(pointer); EXPECT_TRUE(allocator_->CheckConsistency()); } @@ -449,15 +449,15 @@ TEST_F(FencedAllocatorWrapperTest, TestAlignment) { allocator_->CheckConsistency(); const unsigned int kSize1 = 75; - void *pointer1 = allocator_->Alloc(kSize1); + void* pointer1 = allocator_->Alloc(kSize1); ASSERT_TRUE(pointer1); - EXPECT_EQ(reinterpret_cast<intptr_t>(pointer1) & (kAllocAlignment - 1), 0); + EXPECT_TRUE(base::IsAligned(pointer1, kAllocAlignment)); EXPECT_TRUE(allocator_->CheckConsistency()); const unsigned int kSize2 = 43; - void *pointer2 = allocator_->Alloc(kSize2); + void* pointer2 = allocator_->Alloc(kSize2); ASSERT_TRUE(pointer2); - EXPECT_EQ(reinterpret_cast<intptr_t>(pointer2) & (kAllocAlignment - 1), 0); + EXPECT_TRUE(base::IsAligned(pointer2, kAllocAlignment)); EXPECT_TRUE(allocator_->CheckConsistency()); allocator_->Free(pointer2); @@ -473,10 +473,10 @@ TEST_F(FencedAllocatorWrapperTest, TestOutOfMemory) { const unsigned int kSize = 16; const unsigned int kAllocCount = kBufferSize / kSize; - CHECK(kAllocCount * kSize == kBufferSize); + CHECK_EQ(kAllocCount * kSize, kBufferSize); // Allocate several buffers to fill in the memory. - void *pointers[kAllocCount]; + void* pointers[kAllocCount]; for (unsigned int i = 0; i < kAllocCount; ++i) { pointers[i] = allocator_->Alloc(kSize); EXPECT_TRUE(pointers[i]); @@ -484,7 +484,7 @@ TEST_F(FencedAllocatorWrapperTest, TestOutOfMemory) { } // This allocation should fail. - void *pointer_failed = allocator_->Alloc(kSize); + void* pointer_failed = allocator_->Alloc(kSize); EXPECT_FALSE(pointer_failed); EXPECT_TRUE(allocator_->CheckConsistency()); @@ -513,10 +513,10 @@ TEST_F(FencedAllocatorWrapperTest, TestFreePendingToken) { const unsigned int kSize = 16; const unsigned int kAllocCount = kBufferSize / kSize; - CHECK(kAllocCount * kSize == kBufferSize); + CHECK_EQ(kAllocCount * kSize, kBufferSize); // Allocate several buffers to fill in the memory. - void *pointers[kAllocCount]; + void* pointers[kAllocCount]; for (unsigned int i = 0; i < kAllocCount; ++i) { pointers[i] = allocator_->Alloc(kSize); EXPECT_TRUE(pointers[i]); @@ -524,7 +524,7 @@ TEST_F(FencedAllocatorWrapperTest, TestFreePendingToken) { } // This allocation should fail. - void *pointer_failed = allocator_->Alloc(kSize); + void* pointer_failed = allocator_->Alloc(kSize); EXPECT_FALSE(pointer_failed); EXPECT_TRUE(allocator_->CheckConsistency()); 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 76546b8dd53..dfe2d8512a2 100644 --- a/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_c_lib_autogen.h @@ -423,6 +423,11 @@ GLint GL_APIENTRY GLES2GetAttribLocation(GLuint program, const char* name) { void GL_APIENTRY GLES2GetBooleanv(GLenum pname, GLboolean* params) { gles2::GetGLContext()->GetBooleanv(pname, params); } +void GL_APIENTRY GLES2GetBooleani_v(GLenum pname, + GLuint index, + GLboolean* data) { + gles2::GetGLContext()->GetBooleani_v(pname, index, data); +} void GL_APIENTRY GLES2GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) { @@ -1832,6 +1837,41 @@ void GL_APIENTRY GLES2BeginBatchReadAccessSharedImageCHROMIUM() { void GL_APIENTRY GLES2EndBatchReadAccessSharedImageCHROMIUM() { gles2::GetGLContext()->EndBatchReadAccessSharedImageCHROMIUM(); } +void GL_APIENTRY GLES2EnableiOES(GLenum target, GLuint index) { + gles2::GetGLContext()->EnableiOES(target, index); +} +void GL_APIENTRY GLES2DisableiOES(GLenum target, GLuint index) { + gles2::GetGLContext()->DisableiOES(target, index); +} +void GL_APIENTRY GLES2BlendEquationiOES(GLuint buf, GLenum mode) { + gles2::GetGLContext()->BlendEquationiOES(buf, mode); +} +void GL_APIENTRY GLES2BlendEquationSeparateiOES(GLuint buf, + GLenum modeRGB, + GLenum modeAlpha) { + gles2::GetGLContext()->BlendEquationSeparateiOES(buf, modeRGB, modeAlpha); +} +void GL_APIENTRY GLES2BlendFunciOES(GLuint buf, GLenum src, GLenum dst) { + gles2::GetGLContext()->BlendFunciOES(buf, src, dst); +} +void GL_APIENTRY GLES2BlendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) { + gles2::GetGLContext()->BlendFuncSeparateiOES(buf, srcRGB, dstRGB, srcAlpha, + dstAlpha); +} +void GL_APIENTRY GLES2ColorMaskiOES(GLuint buf, + GLboolean r, + GLboolean g, + GLboolean b, + GLboolean a) { + gles2::GetGLContext()->ColorMaskiOES(buf, r, g, b, a); +} +GLboolean GL_APIENTRY GLES2IsEnablediOES(GLenum target, GLuint index) { + return gles2::GetGLContext()->IsEnablediOES(target, index); +} namespace gles2 { @@ -2169,6 +2209,10 @@ extern const NameToFunc g_gles2_function_table[] = { reinterpret_cast<GLES2FunctionPointer>(glGetBooleanv), }, { + "glGetBooleani_v", + reinterpret_cast<GLES2FunctionPointer>(glGetBooleani_v), + }, + { "glGetBufferParameteri64v", reinterpret_cast<GLES2FunctionPointer>(glGetBufferParameteri64v), }, @@ -3277,6 +3321,38 @@ extern const NameToFunc g_gles2_function_table[] = { glEndBatchReadAccessSharedImageCHROMIUM), }, { + "glEnableiOES", + reinterpret_cast<GLES2FunctionPointer>(glEnableiOES), + }, + { + "glDisableiOES", + reinterpret_cast<GLES2FunctionPointer>(glDisableiOES), + }, + { + "glBlendEquationiOES", + reinterpret_cast<GLES2FunctionPointer>(glBlendEquationiOES), + }, + { + "glBlendEquationSeparateiOES", + reinterpret_cast<GLES2FunctionPointer>(glBlendEquationSeparateiOES), + }, + { + "glBlendFunciOES", + reinterpret_cast<GLES2FunctionPointer>(glBlendFunciOES), + }, + { + "glBlendFuncSeparateiOES", + reinterpret_cast<GLES2FunctionPointer>(glBlendFuncSeparateiOES), + }, + { + "glColorMaskiOES", + reinterpret_cast<GLES2FunctionPointer>(glColorMaskiOES), + }, + { + "glIsEnablediOES", + reinterpret_cast<GLES2FunctionPointer>(glIsEnablediOES), + }, + { nullptr, nullptr, }, 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 7aa80690359..efe2fe42a7b 100644 --- a/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_cmd_helper_autogen.h @@ -851,6 +851,16 @@ void GetBooleanv(GLenum pname, } } +void GetBooleani_v(GLenum pname, + GLuint index, + uint32_t data_shm_id, + uint32_t data_shm_offset) { + gles2::cmds::GetBooleani_v* c = GetCmdSpace<gles2::cmds::GetBooleani_v>(); + if (c) { + c->Init(pname, index, data_shm_id, data_shm_offset); + } +} + void GetBufferParameteri64v(GLenum target, GLenum pname, uint32_t params_shm_id, @@ -3415,4 +3425,74 @@ void EndBatchReadAccessSharedImageCHROMIUM() { } } +void EnableiOES(GLenum target, GLuint index) { + gles2::cmds::EnableiOES* c = GetCmdSpace<gles2::cmds::EnableiOES>(); + if (c) { + c->Init(target, index); + } +} + +void DisableiOES(GLenum target, GLuint index) { + gles2::cmds::DisableiOES* c = GetCmdSpace<gles2::cmds::DisableiOES>(); + if (c) { + c->Init(target, index); + } +} + +void BlendEquationiOES(GLuint buf, GLenum mode) { + gles2::cmds::BlendEquationiOES* c = + GetCmdSpace<gles2::cmds::BlendEquationiOES>(); + if (c) { + c->Init(buf, mode); + } +} + +void BlendEquationSeparateiOES(GLuint buf, GLenum modeRGB, GLenum modeAlpha) { + gles2::cmds::BlendEquationSeparateiOES* c = + GetCmdSpace<gles2::cmds::BlendEquationSeparateiOES>(); + if (c) { + c->Init(buf, modeRGB, modeAlpha); + } +} + +void BlendFunciOES(GLuint buf, GLenum src, GLenum dst) { + gles2::cmds::BlendFunciOES* c = GetCmdSpace<gles2::cmds::BlendFunciOES>(); + if (c) { + c->Init(buf, src, dst); + } +} + +void BlendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) { + gles2::cmds::BlendFuncSeparateiOES* c = + GetCmdSpace<gles2::cmds::BlendFuncSeparateiOES>(); + if (c) { + c->Init(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); + } +} + +void ColorMaskiOES(GLuint buf, + GLboolean r, + GLboolean g, + GLboolean b, + GLboolean a) { + gles2::cmds::ColorMaskiOES* c = GetCmdSpace<gles2::cmds::ColorMaskiOES>(); + if (c) { + c->Init(buf, r, g, b, a); + } +} + +void IsEnablediOES(GLenum target, + GLuint index, + uint32_t result_shm_id, + uint32_t result_shm_offset) { + gles2::cmds::IsEnablediOES* c = GetCmdSpace<gles2::cmds::IsEnablediOES>(); + if (c) { + c->Init(target, index, result_shm_id, result_shm_offset); + } +} + #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 c5d65e65595..49d050e7e0d 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation.cc +++ b/chromium/gpu/command_buffer/client/gles2_implementation.cc @@ -647,6 +647,24 @@ void GLES2Implementation::Disable(GLenum cap) { CheckGLError(); } +void GLES2Implementation::DisableiOES(GLenum target, GLuint index) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDisableiOES(" + << GLES2Util::GetStringEnum(target) << ", " << index + << ")"); + if (index == 0u && target == GL_BLEND) { + bool changed = false; + DCHECK(target == GL_BLEND); + if (!state_.SetCapabilityState(target, false, &changed) || changed) { + helper_->DisableiOES(target, index); + } + } else { + helper_->DisableiOES(target, index); + } + + CheckGLError(); +} + void GLES2Implementation::Enable(GLenum cap) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnable(" @@ -658,6 +676,24 @@ void GLES2Implementation::Enable(GLenum cap) { CheckGLError(); } +void GLES2Implementation::EnableiOES(GLenum target, GLuint index) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableiOES(" + << GLES2Util::GetStringEnum(target) << ", " << index + << ")"); + if (index == 0u && target == GL_BLEND) { + bool changed = false; + DCHECK(target == GL_BLEND); + if (!state_.SetCapabilityState(target, true, &changed) || changed) { + helper_->EnableiOES(target, index); + } + } else { + helper_->EnableiOES(target, index); + } + + CheckGLError(); +} + GLboolean GLES2Implementation::IsEnabled(GLenum cap) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsEnabled(" @@ -680,6 +716,24 @@ GLboolean GLES2Implementation::IsEnabled(GLenum cap) { return state; } +GLboolean GLES2Implementation::IsEnablediOES(GLenum target, GLuint index) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glIsEnablediOES(" + << GLES2Util::GetStringCapability(target) << ", " << index + << ")"); + bool state = false; + typedef cmds::IsEnabled::Result Result; + auto result = GetResultAs<Result>(); + *result = 0; + helper_->IsEnablediOES(target, index, GetResultShmId(), result.offset()); + WaitForCmd(); + state = (*result) != 0; + + GPU_CLIENT_LOG("returned " << state); + CheckGLError(); + return state; +} + bool GLES2Implementation::GetHelper(GLenum pname, GLint* params) { // TODO(zmo): For all the BINDING points, there is a possibility where // resources are shared among multiple contexts, that the cached points @@ -1105,6 +1159,13 @@ bool GLES2Implementation::GetBooleanvHelper(GLenum pname, GLboolean* params) { return true; } +bool GLES2Implementation::GetBooleani_vHelper(GLenum pname, + GLuint index, + GLboolean* data) { + // TODO(zmo): Implement client side caching. + return false; +} + bool GLES2Implementation::GetFloatvHelper(GLenum pname, GLfloat* params) { // TODO(gman): Make this handle pnames that return more than 1 value. switch (pname) { diff --git a/chromium/gpu/command_buffer/client/gles2_implementation.h b/chromium/gpu/command_buffer/client/gles2_implementation.h index e0db2688e6b..5b828ea7208 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation.h +++ b/chromium/gpu/command_buffer/client/gles2_implementation.h @@ -599,6 +599,7 @@ class GLES2_IMPL_EXPORT GLES2Implementation : public GLES2Interface, bool GetHelper(GLenum pname, GLint* params); GLuint GetBoundBufferHelper(GLenum target); bool GetBooleanvHelper(GLenum pname, GLboolean* params); + bool GetBooleani_vHelper(GLenum pname, GLuint index, GLboolean* data); bool GetBufferParameteri64vHelper( GLenum target, GLenum pname, GLint64* params); bool GetBufferParameterivHelper(GLenum target, GLenum pname, GLint* params); diff --git a/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h b/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h index 6fb5046d5de..2ce5be504ca 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_implementation_autogen.h @@ -316,6 +316,8 @@ GLint GetAttribLocation(GLuint program, const char* name) override; void GetBooleanv(GLenum pname, GLboolean* params) override; +void GetBooleani_v(GLenum pname, GLuint index, GLboolean* data) override; + void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override; @@ -1291,4 +1293,30 @@ void BeginBatchReadAccessSharedImageCHROMIUM() override; void EndBatchReadAccessSharedImageCHROMIUM() override; +void EnableiOES(GLenum target, GLuint index) override; + +void DisableiOES(GLenum target, GLuint index) override; + +void BlendEquationiOES(GLuint buf, GLenum mode) override; + +void BlendEquationSeparateiOES(GLuint buf, + GLenum modeRGB, + GLenum modeAlpha) override; + +void BlendFunciOES(GLuint buf, GLenum src, GLenum dst) override; + +void BlendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) override; + +void ColorMaskiOES(GLuint buf, + GLboolean r, + GLboolean g, + GLboolean b, + GLboolean a) override; + +GLboolean IsEnablediOES(GLenum target, GLuint index) 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 69cd2bd09f6..6fa311c7a15 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_implementation_impl_autogen.h @@ -889,6 +889,34 @@ void GLES2Implementation::GetBooleanv(GLenum pname, GLboolean* params) { }); CheckGLError(); } +void GLES2Implementation::GetBooleani_v(GLenum pname, + GLuint index, + GLboolean* data) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_VALIDATE_DESTINATION_INITALIZATION(GLboolean, data); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetBooleani_v(" + << GLES2Util::GetStringIndexedGLState(pname) << ", " + << index << ", " << static_cast<const void*>(data) << ")"); + TRACE_EVENT0("gpu", "GLES2Implementation::GetBooleani_v"); + if (GetBooleani_vHelper(pname, index, data)) { + return; + } + typedef cmds::GetBooleani_v::Result Result; + ScopedResultPtr<Result> result = GetResultAs<Result>(); + if (!result) { + return; + } + result->SetNumResults(0); + helper_->GetBooleani_v(pname, index, GetResultShmId(), result.offset()); + WaitForCmd(); + result->CopyResult(data); + GPU_CLIENT_LOG_CODE_BLOCK({ + for (int32_t i = 0; i < result->GetNumResults(); ++i) { + GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); + } + }); + CheckGLError(); +} void GLES2Implementation::GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) { @@ -3731,4 +3759,62 @@ void GLES2Implementation::EndBatchReadAccessSharedImageCHROMIUM() { CheckGLError(); } +void GLES2Implementation::BlendEquationiOES(GLuint buf, GLenum mode) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationiOES(" << buf + << ", " << GLES2Util::GetStringEnum(mode) << ")"); + helper_->BlendEquationiOES(buf, mode); + CheckGLError(); +} + +void GLES2Implementation::BlendEquationSeparateiOES(GLuint buf, + GLenum modeRGB, + GLenum modeAlpha) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendEquationSeparateiOES(" + << buf << ", " << GLES2Util::GetStringEnum(modeRGB) << ", " + << GLES2Util::GetStringEnum(modeAlpha) << ")"); + helper_->BlendEquationSeparateiOES(buf, modeRGB, modeAlpha); + CheckGLError(); +} + +void GLES2Implementation::BlendFunciOES(GLuint buf, GLenum src, GLenum dst) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFunciOES(" << buf << ", " + << GLES2Util::GetStringEnum(src) << ", " + << GLES2Util::GetStringEnum(dst) << ")"); + helper_->BlendFunciOES(buf, src, dst); + CheckGLError(); +} + +void GLES2Implementation::BlendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glBlendFuncSeparateiOES(" << buf + << ", " << GLES2Util::GetStringEnum(srcRGB) << ", " + << GLES2Util::GetStringEnum(dstRGB) << ", " + << GLES2Util::GetStringEnum(srcAlpha) << ", " + << GLES2Util::GetStringEnum(dstAlpha) << ")"); + helper_->BlendFuncSeparateiOES(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); + CheckGLError(); +} + +void GLES2Implementation::ColorMaskiOES(GLuint buf, + GLboolean r, + GLboolean g, + GLboolean b, + GLboolean a) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glColorMaskiOES(" << buf << ", " + << GLES2Util::GetStringBool(r) << ", " + << GLES2Util::GetStringBool(g) << ", " + << GLES2Util::GetStringBool(b) << ", " + << GLES2Util::GetStringBool(a) << ")"); + helper_->ColorMaskiOES(buf, r, g, b, a); + CheckGLError(); +} + #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_IMPL_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 5205f3e98f7..c7c3b16a382 100644 --- a/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_implementation_unittest_autogen.h @@ -758,6 +758,24 @@ TEST_F(GLES2ImplementationTest, GetBooleanv) { EXPECT_EQ(static_cast<ResultType>(1), result); } +TEST_F(GLES2ImplementationTest, GetBooleani_v) { + struct Cmds { + cmds::GetBooleani_v cmd; + }; + typedef cmds::GetBooleani_v::Result::Type ResultType; + ResultType result = 0; + Cmds expected; + ExpectedMemoryInfo result1 = + GetExpectedResultMemory(sizeof(uint32_t) + sizeof(ResultType)); + expected.cmd.Init(123, 2, result1.id, result1.offset); + EXPECT_CALL(*command_buffer(), OnFlush()) + .WillOnce(SetMemory(result1.ptr, SizedResultHelper<ResultType>(1))) + .RetiresOnSaturation(); + gl_->GetBooleani_v(123, 2, &result); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); + EXPECT_EQ(static_cast<ResultType>(1), result); +} + TEST_F(GLES2ImplementationTest, GetBufferParameteri64v) { struct Cmds { cmds::GetBufferParameteri64v cmd; @@ -3124,4 +3142,81 @@ TEST_F(GLES2ImplementationTest, EndBatchReadAccessSharedImageCHROMIUM) { gl_->EndBatchReadAccessSharedImageCHROMIUM(); EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); } + +TEST_F(GLES2ImplementationTest, EnableiOES) { + struct Cmds { + cmds::EnableiOES cmd; + }; + Cmds expected; + expected.cmd.Init(1, 2); + + gl_->EnableiOES(1, 2); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, DisableiOES) { + struct Cmds { + cmds::DisableiOES cmd; + }; + Cmds expected; + expected.cmd.Init(1, 2); + + gl_->DisableiOES(1, 2); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, BlendEquationiOES) { + struct Cmds { + cmds::BlendEquationiOES cmd; + }; + Cmds expected; + expected.cmd.Init(1, GL_FUNC_SUBTRACT); + + gl_->BlendEquationiOES(1, GL_FUNC_SUBTRACT); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, BlendEquationSeparateiOES) { + struct Cmds { + cmds::BlendEquationSeparateiOES cmd; + }; + Cmds expected; + expected.cmd.Init(1, GL_FUNC_SUBTRACT, GL_FUNC_SUBTRACT); + + gl_->BlendEquationSeparateiOES(1, GL_FUNC_SUBTRACT, GL_FUNC_SUBTRACT); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, BlendFunciOES) { + struct Cmds { + cmds::BlendFunciOES cmd; + }; + Cmds expected; + expected.cmd.Init(1, 2, 3); + + gl_->BlendFunciOES(1, 2, 3); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, BlendFuncSeparateiOES) { + struct Cmds { + cmds::BlendFuncSeparateiOES cmd; + }; + Cmds expected; + expected.cmd.Init(1, 2, 3, 4, 5); + + gl_->BlendFuncSeparateiOES(1, 2, 3, 4, 5); + EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); +} + +TEST_F(GLES2ImplementationTest, ColorMaskiOES) { + struct Cmds { + cmds::ColorMaskiOES cmd; + }; + Cmds expected; + expected.cmd.Init(1, true, true, true, true); + + gl_->ColorMaskiOES(1, true, true, true, true); + 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 11954f6a4c4..a6cfcf3b536 100644 --- a/chromium/gpu/command_buffer/client/gles2_interface_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_interface_autogen.h @@ -235,6 +235,7 @@ virtual void GetAttachedShaders(GLuint program, GLuint* shaders) = 0; virtual GLint GetAttribLocation(GLuint program, const char* name) = 0; virtual void GetBooleanv(GLenum pname, GLboolean* params) = 0; +virtual void GetBooleani_v(GLenum pname, GLuint index, GLboolean* data) = 0; virtual void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) = 0; @@ -967,4 +968,22 @@ virtual void BeginSharedImageAccessDirectCHROMIUM(GLuint texture, virtual void EndSharedImageAccessDirectCHROMIUM(GLuint texture) = 0; virtual void BeginBatchReadAccessSharedImageCHROMIUM() = 0; virtual void EndBatchReadAccessSharedImageCHROMIUM() = 0; +virtual void EnableiOES(GLenum target, GLuint index) = 0; +virtual void DisableiOES(GLenum target, GLuint index) = 0; +virtual void BlendEquationiOES(GLuint buf, GLenum mode) = 0; +virtual void BlendEquationSeparateiOES(GLuint buf, + GLenum modeRGB, + GLenum modeAlpha) = 0; +virtual void BlendFunciOES(GLuint buf, GLenum src, GLenum dst) = 0; +virtual void BlendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) = 0; +virtual void ColorMaskiOES(GLuint buf, + GLboolean r, + GLboolean g, + GLboolean b, + GLboolean a) = 0; +virtual GLboolean IsEnablediOES(GLenum target, GLuint index) = 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 af3f5723eba..0af83a4f52b 100644 --- a/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_interface_stub_autogen.h @@ -232,6 +232,7 @@ void GetAttachedShaders(GLuint program, GLuint* shaders) override; GLint GetAttribLocation(GLuint program, const char* name) override; void GetBooleanv(GLenum pname, GLboolean* params) override; +void GetBooleani_v(GLenum pname, GLuint index, GLboolean* data) override; void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override; @@ -937,4 +938,22 @@ void BeginSharedImageAccessDirectCHROMIUM(GLuint texture, GLenum mode) override; void EndSharedImageAccessDirectCHROMIUM(GLuint texture) override; void BeginBatchReadAccessSharedImageCHROMIUM() override; void EndBatchReadAccessSharedImageCHROMIUM() override; +void EnableiOES(GLenum target, GLuint index) override; +void DisableiOES(GLenum target, GLuint index) override; +void BlendEquationiOES(GLuint buf, GLenum mode) override; +void BlendEquationSeparateiOES(GLuint buf, + GLenum modeRGB, + GLenum modeAlpha) override; +void BlendFunciOES(GLuint buf, GLenum src, GLenum dst) override; +void BlendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) override; +void ColorMaskiOES(GLuint buf, + GLboolean r, + GLboolean g, + GLboolean b, + GLboolean a) override; +GLboolean IsEnablediOES(GLenum target, GLuint index) 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 1ba3ccf0850..2c8542ba0f0 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 @@ -274,6 +274,9 @@ GLint GLES2InterfaceStub::GetAttribLocation(GLuint /* program */, } void GLES2InterfaceStub::GetBooleanv(GLenum /* pname */, GLboolean* /* params */) {} +void GLES2InterfaceStub::GetBooleani_v(GLenum /* pname */, + GLuint /* index */, + GLboolean* /* data */) {} void GLES2InterfaceStub::GetBufferParameteri64v(GLenum /* target */, GLenum /* pname */, GLint64* /* params */) {} @@ -1251,4 +1254,28 @@ void GLES2InterfaceStub::EndSharedImageAccessDirectCHROMIUM( GLuint /* texture */) {} void GLES2InterfaceStub::BeginBatchReadAccessSharedImageCHROMIUM() {} void GLES2InterfaceStub::EndBatchReadAccessSharedImageCHROMIUM() {} +void GLES2InterfaceStub::EnableiOES(GLenum /* target */, GLuint /* index */) {} +void GLES2InterfaceStub::DisableiOES(GLenum /* target */, GLuint /* index */) {} +void GLES2InterfaceStub::BlendEquationiOES(GLuint /* buf */, + GLenum /* mode */) {} +void GLES2InterfaceStub::BlendEquationSeparateiOES(GLuint /* buf */, + GLenum /* modeRGB */, + GLenum /* modeAlpha */) {} +void GLES2InterfaceStub::BlendFunciOES(GLuint /* buf */, + GLenum /* src */, + GLenum /* dst */) {} +void GLES2InterfaceStub::BlendFuncSeparateiOES(GLuint /* buf */, + GLenum /* srcRGB */, + GLenum /* dstRGB */, + GLenum /* srcAlpha */, + GLenum /* dstAlpha */) {} +void GLES2InterfaceStub::ColorMaskiOES(GLuint /* buf */, + GLboolean /* r */, + GLboolean /* g */, + GLboolean /* b */, + GLboolean /* a */) {} +GLboolean GLES2InterfaceStub::IsEnablediOES(GLenum /* target */, + GLuint /* index */) { + return 0; +} #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 5091689bd0e..d3d3e45c124 100644 --- a/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h +++ b/chromium/gpu/command_buffer/client/gles2_trace_implementation_autogen.h @@ -232,6 +232,7 @@ void GetAttachedShaders(GLuint program, GLuint* shaders) override; GLint GetAttribLocation(GLuint program, const char* name) override; void GetBooleanv(GLenum pname, GLboolean* params) override; +void GetBooleani_v(GLenum pname, GLuint index, GLboolean* data) override; void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) override; @@ -937,4 +938,22 @@ void BeginSharedImageAccessDirectCHROMIUM(GLuint texture, GLenum mode) override; void EndSharedImageAccessDirectCHROMIUM(GLuint texture) override; void BeginBatchReadAccessSharedImageCHROMIUM() override; void EndBatchReadAccessSharedImageCHROMIUM() override; +void EnableiOES(GLenum target, GLuint index) override; +void DisableiOES(GLenum target, GLuint index) override; +void BlendEquationiOES(GLuint buf, GLenum mode) override; +void BlendEquationSeparateiOES(GLuint buf, + GLenum modeRGB, + GLenum modeAlpha) override; +void BlendFunciOES(GLuint buf, GLenum src, GLenum dst) override; +void BlendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) override; +void ColorMaskiOES(GLuint buf, + GLboolean r, + GLboolean g, + GLboolean b, + GLboolean a) override; +GLboolean IsEnablediOES(GLenum target, GLuint index) 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 ce0e76e739b..bc4518d66f7 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 @@ -592,6 +592,13 @@ void GLES2TraceImplementation::GetBooleanv(GLenum pname, GLboolean* params) { gl_->GetBooleanv(pname, params); } +void GLES2TraceImplementation::GetBooleani_v(GLenum pname, + GLuint index, + GLboolean* data) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetBooleani_v"); + gl_->GetBooleani_v(pname, index, data); +} + void GLES2TraceImplementation::GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) { @@ -2651,4 +2658,56 @@ void GLES2TraceImplementation::EndBatchReadAccessSharedImageCHROMIUM() { gl_->EndBatchReadAccessSharedImageCHROMIUM(); } +void GLES2TraceImplementation::EnableiOES(GLenum target, GLuint index) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::EnableiOES"); + gl_->EnableiOES(target, index); +} + +void GLES2TraceImplementation::DisableiOES(GLenum target, GLuint index) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::DisableiOES"); + gl_->DisableiOES(target, index); +} + +void GLES2TraceImplementation::BlendEquationiOES(GLuint buf, GLenum mode) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlendEquationiOES"); + gl_->BlendEquationiOES(buf, mode); +} + +void GLES2TraceImplementation::BlendEquationSeparateiOES(GLuint buf, + GLenum modeRGB, + GLenum modeAlpha) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlendEquationSeparateiOES"); + gl_->BlendEquationSeparateiOES(buf, modeRGB, modeAlpha); +} + +void GLES2TraceImplementation::BlendFunciOES(GLuint buf, + GLenum src, + GLenum dst) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlendFunciOES"); + gl_->BlendFunciOES(buf, src, dst); +} + +void GLES2TraceImplementation::BlendFuncSeparateiOES(GLuint buf, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlendFuncSeparateiOES"); + gl_->BlendFuncSeparateiOES(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); +} + +void GLES2TraceImplementation::ColorMaskiOES(GLuint buf, + GLboolean r, + GLboolean g, + GLboolean b, + GLboolean a) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::ColorMaskiOES"); + gl_->ColorMaskiOES(buf, r, g, b, a); +} + +GLboolean GLES2TraceImplementation::IsEnablediOES(GLenum target, GLuint index) { + TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::IsEnablediOES"); + return gl_->IsEnablediOES(target, index); +} + #endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_IMPL_AUTOGEN_H_ diff --git a/chromium/gpu/command_buffer/client/implementation_base.cc b/chromium/gpu/command_buffer/client/implementation_base.cc index 15ae10c9ad1..a2404fd65a7 100644 --- a/chromium/gpu/command_buffer/client/implementation_base.cc +++ b/chromium/gpu/command_buffer/client/implementation_base.cc @@ -7,6 +7,7 @@ #include <algorithm> #include "base/bind.h" +#include "base/logging.h" #include "base/strings/stringprintf.h" #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/trace_event.h" diff --git a/chromium/gpu/command_buffer/client/raster_implementation.cc b/chromium/gpu/command_buffer/client/raster_implementation.cc index 92057b8752f..f1b93c14f5f 100644 --- a/chromium/gpu/command_buffer/client/raster_implementation.cc +++ b/chromium/gpu/command_buffer/client/raster_implementation.cc @@ -991,10 +991,6 @@ void RasterImplementation::GetQueryObjectui64vEXT(GLuint id, void* RasterImplementation::MapRasterCHROMIUM(uint32_t size, uint32_t* size_allocated) { *size_allocated = 0u; - if (size < 0) { - SetGLError(GL_INVALID_VALUE, "glMapRasterCHROMIUM", "negative size"); - return nullptr; - } if (raster_mapped_buffer_) { SetGLError(GL_INVALID_OPERATION, "glMapRasterCHROMIUM", "already mapped"); return nullptr; @@ -1010,10 +1006,6 @@ void* RasterImplementation::MapRasterCHROMIUM(uint32_t size, } void* RasterImplementation::MapFontBuffer(uint32_t size) { - if (size < 0) { - SetGLError(GL_INVALID_VALUE, "glMapFontBufferCHROMIUM", "negative size"); - return nullptr; - } if (font_mapped_buffer_) { SetGLError(GL_INVALID_OPERATION, "glMapFontBufferCHROMIUM", "already mapped"); @@ -1036,11 +1028,6 @@ void* RasterImplementation::MapFontBuffer(uint32_t size) { void RasterImplementation::UnmapRasterCHROMIUM(uint32_t raster_written_size, uint32_t total_written_size) { - if (total_written_size < 0) { - SetGLError(GL_INVALID_VALUE, "glUnmapRasterCHROMIUM", - "negative written_size"); - return; - } if (!raster_mapped_buffer_) { SetGLError(GL_INVALID_OPERATION, "glUnmapRasterCHROMIUM", "not mapped"); return; diff --git a/chromium/gpu/command_buffer/client/raster_implementation_gles.cc b/chromium/gpu/command_buffer/client/raster_implementation_gles.cc index 163e7c0a5e9..299dd4f9874 100644 --- a/chromium/gpu/command_buffer/client/raster_implementation_gles.cc +++ b/chromium/gpu/command_buffer/client/raster_implementation_gles.cc @@ -39,6 +39,8 @@ GLenum SkColorTypeToGLDataFormat(SkColorType color_type) { return GL_RGBA; case kBGRA_8888_SkColorType: return GL_BGRA_EXT; + case kGray_8_SkColorType: + return GL_LUMINANCE; default: DLOG(ERROR) << "Unknown SkColorType " << color_type; } @@ -50,6 +52,7 @@ GLenum SkColorTypeToGLDataType(SkColorType color_type) { switch (color_type) { case kRGBA_8888_SkColorType: case kBGRA_8888_SkColorType: + case kGray_8_SkColorType: return GL_UNSIGNED_BYTE; default: DLOG(ERROR) << "Unknown SkColorType " << color_type; @@ -170,17 +173,19 @@ void RasterImplementationGLES::WritePixels(const gpu::Mailbox& dest_mailbox, GLuint row_bytes, const SkImageInfo& src_info, const void* src_pixels) { - DCHECK_EQ(row_bytes, src_info.minRowBytes()); + DCHECK_GE(row_bytes, src_info.minRowBytes()); GLuint texture_id = CreateAndConsumeForGpuRaster(dest_mailbox); BeginSharedImageAccessDirectCHROMIUM( texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READWRITE_CHROMIUM); + gl_->PixelStorei(GL_UNPACK_ROW_LENGTH, row_bytes / src_info.bytesPerPixel()); gl_->BindTexture(texture_target, texture_id); gl_->TexSubImage2D(texture_target, 0, dst_x_offset, dst_y_offset, src_info.width(), src_info.height(), SkColorTypeToGLDataFormat(src_info.colorType()), SkColorTypeToGLDataType(src_info.colorType()), src_pixels); gl_->BindTexture(texture_target, 0); + gl_->PixelStorei(GL_UNPACK_ROW_LENGTH, 0); EndSharedImageAccessDirectCHROMIUM(texture_id); DeleteGpuRasterTexture(texture_id); diff --git a/chromium/gpu/command_buffer/client/ring_buffer.h b/chromium/gpu/command_buffer/client/ring_buffer.h index f0260979f33..faaef510a9e 100644 --- a/chromium/gpu/command_buffer/client/ring_buffer.h +++ b/chromium/gpu/command_buffer/client/ring_buffer.h @@ -10,7 +10,6 @@ #include <stdint.h> #include "base/containers/circular_deque.h" -#include "base/logging.h" #include "base/macros.h" #include "gpu/gpu_export.h" diff --git a/chromium/gpu/command_buffer/client/shared_image_interface.cc b/chromium/gpu/command_buffer/client/shared_image_interface.cc index 8b340c00ca3..1830ef08730 100644 --- a/chromium/gpu/command_buffer/client/shared_image_interface.cc +++ b/chromium/gpu/command_buffer/client/shared_image_interface.cc @@ -10,4 +10,7 @@ uint32_t SharedImageInterface::UsageForMailbox(const Mailbox& mailbox) { return 0u; } +void SharedImageInterface::NotifyMailboxAdded(const Mailbox& /*mailbox*/, + uint32_t /*usage*/) {} + } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/shared_image_interface.h b/chromium/gpu/command_buffer/client/shared_image_interface.h index 18369b51acd..ade24e373b9 100644 --- a/chromium/gpu/command_buffer/client/shared_image_interface.h +++ b/chromium/gpu/command_buffer/client/shared_image_interface.h @@ -149,7 +149,9 @@ class GPU_EXPORT SharedImageInterface { // wrapping it in GpuMemoryBufferHandle and then creating GpuMemoryBuffer from // that handle. virtual void RegisterSysmemBufferCollection(gfx::SysmemBufferCollectionId id, - zx::channel token) = 0; + zx::channel token, + gfx::BufferFormat format, + gfx::BufferUsage usage) = 0; virtual void ReleaseSysmemBufferCollection( gfx::SysmemBufferCollectionId id) = 0; @@ -163,6 +165,11 @@ class GPU_EXPORT SharedImageInterface { // commands on this interface have executed on the service side. virtual SyncToken GenVerifiedSyncToken() = 0; + // Wait on this SyncToken to be released before executing new commands on + // this interface on the service side. This is an async wait for all the + // previous commands which will be sent to server on the next flush(). + virtual void WaitSyncToken(const gpu::SyncToken& sync_token) = 0; + // Flush the SharedImageInterface, issuing any deferred IPCs. virtual void Flush() = 0; @@ -181,6 +188,10 @@ class GPU_EXPORT SharedImageInterface { // Provides the usage flags supported by the given |mailbox|. This must have // been created using a SharedImageInterface on the same channel. virtual uint32_t UsageForMailbox(const Mailbox& mailbox); + + // Informs that existing |mailbox| with |usage| can be passed to + // DestroySharedImage(). + virtual void NotifyMailboxAdded(const Mailbox& mailbox, uint32_t usage); }; } // namespace gpu diff --git a/chromium/gpu/command_buffer/client/transfer_buffer_unittest.cc b/chromium/gpu/command_buffer/client/transfer_buffer_unittest.cc index 8ca8609db9e..6bd739d0cc6 100644 --- a/chromium/gpu/command_buffer/client/transfer_buffer_unittest.cc +++ b/chromium/gpu/command_buffer/client/transfer_buffer_unittest.cc @@ -12,6 +12,7 @@ #include <memory> #include "base/compiler_specific.h" +#include "base/memory/aligned_memory.h" #include "gpu/command_buffer/client/client_test_helper.h" #include "gpu/command_buffer/client/cmd_buffer_helper.h" #include "gpu/command_buffer/common/command_buffer.h" @@ -218,11 +219,11 @@ TEST_F(TransferBufferTest, TooLargeAllocation) { TEST_F(TransferBufferTest, MemoryAlignmentAfterZeroAllocation) { Initialize(); void* ptr = transfer_buffer_->Alloc(0); - EXPECT_EQ((reinterpret_cast<uintptr_t>(ptr) & (kAlignment - 1)), 0u); + EXPECT_TRUE(base::IsAligned(ptr, kAlignment)); transfer_buffer_->FreePendingToken(ptr, helper_->InsertToken()); // 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); + EXPECT_TRUE(base::IsAligned(ptr, kAlignment)); transfer_buffer_->FreePendingToken(ptr, helper_->InsertToken()); } |