summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorzmo <zmo@chromium.org>2015-02-18 18:13:30 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-19 02:14:04 +0000
commit41e4058d8b421e4f15a1ea61af4797ed455ea1f0 (patch)
tree50b07610b5c3e9ea06bc307ea4f165afe5d9a5bc /gpu
parent192b9d9cfe388a6cfb76b9aea56070da1d878a81 (diff)
downloadchromium_src-41e4058d8b421e4f15a1ea61af4797ed455ea1f0.zip
chromium_src-41e4058d8b421e4f15a1ea61af4797ed455ea1f0.tar.gz
chromium_src-41e4058d8b421e4f15a1ea61af4797ed455ea1f0.tar.bz2
Add glWaitSync to GPU command buffer.
BUG=429053 TEST=gpu_unittests R=piman@chromium.org Review URL: https://codereview.chromium.org/936183002 Cr-Commit-Position: refs/heads/master@{#316969}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/GLES2/gl2chromium_autogen.h1
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py8
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h7
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h10
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc11
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest.cc15
-rw-r--r--gpu/command_buffer/client/gles2_interface_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h7
-rw-r--r--gpu/command_buffer/cmd_buffer_functions.txt1
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_autogen.h51
-rw-r--r--gpu/command_buffer/common/gles2_cmd_format_test_autogen.h14
-rw-r--r--gpu/command_buffer/common/gles2_cmd_ids_autogen.h135
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc18
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc18
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h2
19 files changed, 240 insertions, 67 deletions
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h
index 6107338..93f3c47 100644
--- a/gpu/GLES2/gl2chromium_autogen.h
+++ b/gpu/GLES2/gl2chromium_autogen.h
@@ -223,6 +223,7 @@
#define glVertexAttribIPointer GLES2_GET_FUN(VertexAttribIPointer)
#define glVertexAttribPointer GLES2_GET_FUN(VertexAttribPointer)
#define glViewport GLES2_GET_FUN(Viewport)
+#define glWaitSync GLES2_GET_FUN(WaitSync)
#define glBlitFramebufferCHROMIUM GLES2_GET_FUN(BlitFramebufferCHROMIUM)
#define glRenderbufferStorageMultisampleCHROMIUM \
GLES2_GET_FUN(RenderbufferStorageMultisampleCHROMIUM)
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index fcb73de..141d259 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -2928,6 +2928,14 @@ _FUNCTION_INFO = {
'GLsizei stride, GLuint offset',
'client_test': False,
},
+ 'WaitSync': {
+ 'type': 'Custom',
+ 'cmd_args': 'GLuint sync, GLbitfieldSyncFlushFlags flags, '
+ 'GLuint timeout_0, GLuint timeout_1',
+ 'impl_func': False,
+ 'client_test': False,
+ 'unsafe': True,
+ },
'Scissor': {
'type': 'StateSet',
'state': 'Scissor',
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index 40b8f10..803e66f 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -932,6 +932,9 @@ void GLES2VertexAttribPointer(GLuint indx,
void GLES2Viewport(GLint x, GLint y, GLsizei width, GLsizei height) {
gles2::GetGLContext()->Viewport(x, y, width, height);
}
+void GLES2WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
+ gles2::GetGLContext()->WaitSync(sync, flags, timeout);
+}
void GLES2BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
@@ -2153,6 +2156,10 @@ extern const NameToFunc g_gles2_function_table[] = {
reinterpret_cast<GLES2FunctionPointer>(glViewport),
},
{
+ "glWaitSync",
+ reinterpret_cast<GLES2FunctionPointer>(glWaitSync),
+ },
+ {
"glBlitFramebufferCHROMIUM",
reinterpret_cast<GLES2FunctionPointer>(glBlitFramebufferCHROMIUM),
},
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index 650c869..c58ce2c 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -1995,6 +1995,16 @@ void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) {
}
}
+void WaitSync(GLuint sync,
+ GLbitfield flags,
+ GLuint timeout_0,
+ GLuint timeout_1) {
+ gles2::cmds::WaitSync* c = GetCmdSpace<gles2::cmds::WaitSync>();
+ if (c) {
+ c->Init(sync, flags, timeout_0, timeout_1);
+ }
+}
+
void BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 338e09d..2dd95ec 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -4953,6 +4953,17 @@ GLenum GLES2Implementation::ClientWaitSync(
return *result;
}
+void GLES2Implementation::WaitSync(
+ GLsync sync, GLbitfield flags, GLuint64 timeout) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glWaitSync(" << sync << ", "
+ << flags << ", " << timeout << ")");
+ uint32_t v32_0 = 0, v32_1 = 0;
+ GLES2Util::MapUint64ToTwoUint32(timeout, &v32_0, &v32_1);
+ helper_->WaitSync(ToGLuint(sync), flags, v32_0, v32_1);
+ CheckGLError();
+}
+
// 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/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index ae57bbf..5c994e36 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -704,6 +704,8 @@ void VertexAttribPointer(GLuint indx,
void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override;
+void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override;
+
void BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index 6234a0d..2acbc63 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -3617,6 +3617,21 @@ TEST_F(GLES2ImplementationTest, ClientWaitSync) {
EXPECT_EQ(static_cast<GLenum>(GL_CONDITION_SATISFIED), result);
}
+TEST_F(GLES2ImplementationTest, WaitSync) {
+ const GLuint kClientSyncId = 36;
+ struct Cmds {
+ cmds::WaitSync cmd;
+ };
+ Cmds expected;
+ const GLuint64 kTimeout = GL_TIMEOUT_IGNORED;
+ uint32_t v32_0 = 0, v32_1 = 0;
+ GLES2Util::MapUint64ToTwoUint32(kTimeout, &v32_0, &v32_1);
+ expected.cmd.Init(kClientSyncId, 0, v32_0, v32_1);
+
+ gl_->WaitSync(reinterpret_cast<GLsync>(kClientSyncId), 0, kTimeout);
+ EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
+}
+
TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) {
ContextInitOptions init_options;
init_options.lose_context_when_out_of_memory = true;
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 0b5f21b6..623c413 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -517,6 +517,7 @@ virtual void VertexAttribPointer(GLuint indx,
GLsizei stride,
const void* ptr) = 0;
virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) = 0;
+virtual void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) = 0;
virtual void BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 4665b32..31d9636 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -502,6 +502,7 @@ void VertexAttribPointer(GLuint indx,
GLsizei stride,
const void* ptr) override;
void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override;
+void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override;
void BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index 35fe34c..d7aa072 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -869,6 +869,10 @@ void GLES2InterfaceStub::Viewport(GLint /* x */,
GLsizei /* width */,
GLsizei /* height */) {
}
+void GLES2InterfaceStub::WaitSync(GLsync /* sync */,
+ GLbitfield /* flags */,
+ GLuint64 /* timeout */) {
+}
void GLES2InterfaceStub::BlitFramebufferCHROMIUM(GLint /* srcX0 */,
GLint /* srcY0 */,
GLint /* srcX1 */,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index 2cee3ed..33626f7 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -502,6 +502,7 @@ void VertexAttribPointer(GLuint indx,
GLsizei stride,
const void* ptr) override;
void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override;
+void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) override;
void BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index 7e7b1c5..8e6faa7 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -1474,6 +1474,13 @@ void GLES2TraceImplementation::Viewport(GLint x,
gl_->Viewport(x, y, width, height);
}
+void GLES2TraceImplementation::WaitSync(GLsync sync,
+ GLbitfield flags,
+ GLuint64 timeout) {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::WaitSync");
+ gl_->WaitSync(sync, flags, timeout);
+}
+
void GLES2TraceImplementation::BlitFramebufferCHROMIUM(GLint srcX0,
GLint srcY0,
GLint srcX1,
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt
index 6f768f2..570eff1 100644
--- a/gpu/command_buffer/cmd_buffer_functions.txt
+++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -213,6 +213,7 @@ GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint indx, const GLui
GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint indx, GLintVertexAttribSize size, GLenumVertexAttribType type, GLsizei stride, const void* ptr);
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLintVertexAttribSize size, GLenumVertexAttribType type, GLboolean normalized, GLsizei stride, const void* ptr);
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfieldSyncFlushFlags flags, GLuint64 timeout);
GL_APICALL void GL_APIENTRY glBlitFramebufferCHROMIUM (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenumBlitFilter filter);
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleCHROMIUM (GLenumRenderBufferTarget target, GLsizei samples, GLenumRenderBufferFormat internalformat, GLsizei width, GLsizei height);
GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenumRenderBufferTarget target, GLsizei samples, GLenumRenderBufferFormat internalformat, GLsizei width, GLsizei height);
diff --git a/gpu/command_buffer/common/gles2_cmd_format_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
index 6759597..76ca3dd 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_autogen.h
@@ -9854,6 +9854,57 @@ static_assert(offsetof(Viewport, width) == 12,
static_assert(offsetof(Viewport, height) == 16,
"offset of Viewport height should be 16");
+struct WaitSync {
+ typedef WaitSync ValueType;
+ static const CommandId kCmdId = kWaitSync;
+ static const cmd::ArgFlags kArgFlags = cmd::kFixed;
+ static const uint8 cmd_flags = CMD_FLAG_SET_TRACE_LEVEL(3);
+
+ static uint32_t ComputeSize() {
+ return static_cast<uint32_t>(sizeof(ValueType)); // NOLINT
+ }
+
+ void SetHeader() { header.SetCmd<ValueType>(); }
+
+ void Init(GLuint _sync,
+ GLbitfield _flags,
+ GLuint _timeout_0,
+ GLuint _timeout_1) {
+ SetHeader();
+ sync = _sync;
+ flags = _flags;
+ timeout_0 = _timeout_0;
+ timeout_1 = _timeout_1;
+ }
+
+ void* Set(void* cmd,
+ GLuint _sync,
+ GLbitfield _flags,
+ GLuint _timeout_0,
+ GLuint _timeout_1) {
+ static_cast<ValueType*>(cmd)->Init(_sync, _flags, _timeout_0, _timeout_1);
+ return NextCmdAddress<ValueType>(cmd);
+ }
+
+ gpu::CommandHeader header;
+ uint32_t sync;
+ uint32_t flags;
+ uint32_t timeout_0;
+ uint32_t timeout_1;
+};
+
+static_assert(sizeof(WaitSync) == 20, "size of WaitSync should be 20");
+static_assert(offsetof(WaitSync, header) == 0,
+ "offset of WaitSync header should be 0");
+static_assert(offsetof(WaitSync, sync) == 4,
+ "offset of WaitSync sync should be 4");
+static_assert(offsetof(WaitSync, flags) == 8,
+ "offset of WaitSync flags should be 8");
+static_assert(offsetof(WaitSync, timeout_0) == 12,
+ "offset of WaitSync timeout_0 should be 12");
+static_assert(offsetof(WaitSync, timeout_1) == 16,
+ "offset of WaitSync timeout_1 should be 16");
+
struct BlitFramebufferCHROMIUM {
typedef BlitFramebufferCHROMIUM ValueType;
static const CommandId kCmdId = kBlitFramebufferCHROMIUM;
diff --git a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
index 83162b6..9422405 100644
--- a/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_format_test_autogen.h
@@ -3441,6 +3441,20 @@ TEST_F(GLES2FormatTest, Viewport) {
CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
}
+TEST_F(GLES2FormatTest, WaitSync) {
+ cmds::WaitSync& cmd = *GetBufferAs<cmds::WaitSync>();
+ void* next_cmd =
+ cmd.Set(&cmd, static_cast<GLuint>(11), static_cast<GLbitfield>(12),
+ static_cast<GLuint>(13), static_cast<GLuint>(14));
+ EXPECT_EQ(static_cast<uint32_t>(cmds::WaitSync::kCmdId), cmd.header.command);
+ EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);
+ EXPECT_EQ(static_cast<GLuint>(11), cmd.sync);
+ EXPECT_EQ(static_cast<GLbitfield>(12), cmd.flags);
+ EXPECT_EQ(static_cast<GLuint>(13), cmd.timeout_0);
+ EXPECT_EQ(static_cast<GLuint>(14), cmd.timeout_1);
+ CheckBytesWrittenMatchesExpectedSize(next_cmd, sizeof(cmd));
+}
+
TEST_F(GLES2FormatTest, BlitFramebufferCHROMIUM) {
cmds::BlitFramebufferCHROMIUM& cmd =
*GetBufferAs<cmds::BlitFramebufferCHROMIUM>();
diff --git a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
index b5e635b..d652511 100644
--- a/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_ids_autogen.h
@@ -220,73 +220,74 @@
OP(VertexAttribIPointer) /* 461 */ \
OP(VertexAttribPointer) /* 462 */ \
OP(Viewport) /* 463 */ \
- OP(BlitFramebufferCHROMIUM) /* 464 */ \
- OP(RenderbufferStorageMultisampleCHROMIUM) /* 465 */ \
- OP(RenderbufferStorageMultisampleEXT) /* 466 */ \
- OP(FramebufferTexture2DMultisampleEXT) /* 467 */ \
- OP(TexStorage2DEXT) /* 468 */ \
- OP(GenQueriesEXTImmediate) /* 469 */ \
- OP(DeleteQueriesEXTImmediate) /* 470 */ \
- OP(BeginQueryEXT) /* 471 */ \
- OP(BeginTransformFeedback) /* 472 */ \
- OP(EndQueryEXT) /* 473 */ \
- OP(EndTransformFeedback) /* 474 */ \
- OP(InsertEventMarkerEXT) /* 475 */ \
- OP(PushGroupMarkerEXT) /* 476 */ \
- OP(PopGroupMarkerEXT) /* 477 */ \
- OP(GenVertexArraysOESImmediate) /* 478 */ \
- OP(DeleteVertexArraysOESImmediate) /* 479 */ \
- OP(IsVertexArrayOES) /* 480 */ \
- OP(BindVertexArrayOES) /* 481 */ \
- OP(SwapBuffers) /* 482 */ \
- OP(GetMaxValueInBufferCHROMIUM) /* 483 */ \
- OP(EnableFeatureCHROMIUM) /* 484 */ \
- OP(ResizeCHROMIUM) /* 485 */ \
- OP(GetRequestableExtensionsCHROMIUM) /* 486 */ \
- OP(RequestExtensionCHROMIUM) /* 487 */ \
- OP(GetProgramInfoCHROMIUM) /* 488 */ \
- OP(GetUniformBlocksCHROMIUM) /* 489 */ \
- OP(GetTransformFeedbackVaryingsCHROMIUM) /* 490 */ \
- OP(GetUniformsES3CHROMIUM) /* 491 */ \
- OP(GetTranslatedShaderSourceANGLE) /* 492 */ \
- OP(PostSubBufferCHROMIUM) /* 493 */ \
- OP(TexImageIOSurface2DCHROMIUM) /* 494 */ \
- OP(CopyTextureCHROMIUM) /* 495 */ \
- OP(DrawArraysInstancedANGLE) /* 496 */ \
- OP(DrawElementsInstancedANGLE) /* 497 */ \
- OP(VertexAttribDivisorANGLE) /* 498 */ \
- OP(GenMailboxCHROMIUM) /* 499 */ \
- OP(ProduceTextureCHROMIUMImmediate) /* 500 */ \
- OP(ProduceTextureDirectCHROMIUMImmediate) /* 501 */ \
- OP(ConsumeTextureCHROMIUMImmediate) /* 502 */ \
- OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 503 */ \
- OP(BindUniformLocationCHROMIUMBucket) /* 504 */ \
- OP(GenValuebuffersCHROMIUMImmediate) /* 505 */ \
- OP(DeleteValuebuffersCHROMIUMImmediate) /* 506 */ \
- OP(IsValuebufferCHROMIUM) /* 507 */ \
- OP(BindValuebufferCHROMIUM) /* 508 */ \
- OP(SubscribeValueCHROMIUM) /* 509 */ \
- OP(PopulateSubscribedValuesCHROMIUM) /* 510 */ \
- OP(UniformValuebufferCHROMIUM) /* 511 */ \
- OP(BindTexImage2DCHROMIUM) /* 512 */ \
- OP(ReleaseTexImage2DCHROMIUM) /* 513 */ \
- OP(TraceBeginCHROMIUM) /* 514 */ \
- OP(TraceEndCHROMIUM) /* 515 */ \
- OP(AsyncTexSubImage2DCHROMIUM) /* 516 */ \
- OP(AsyncTexImage2DCHROMIUM) /* 517 */ \
- OP(WaitAsyncTexImage2DCHROMIUM) /* 518 */ \
- OP(WaitAllAsyncTexImage2DCHROMIUM) /* 519 */ \
- OP(DiscardFramebufferEXTImmediate) /* 520 */ \
- OP(LoseContextCHROMIUM) /* 521 */ \
- OP(InsertSyncPointCHROMIUM) /* 522 */ \
- OP(WaitSyncPointCHROMIUM) /* 523 */ \
- OP(DrawBuffersEXTImmediate) /* 524 */ \
- OP(DiscardBackbufferCHROMIUM) /* 525 */ \
- OP(ScheduleOverlayPlaneCHROMIUM) /* 526 */ \
- OP(SwapInterval) /* 527 */ \
- OP(MatrixLoadfCHROMIUMImmediate) /* 528 */ \
- OP(MatrixLoadIdentityCHROMIUM) /* 529 */ \
- OP(BlendBarrierKHR) /* 530 */
+ OP(WaitSync) /* 464 */ \
+ OP(BlitFramebufferCHROMIUM) /* 465 */ \
+ OP(RenderbufferStorageMultisampleCHROMIUM) /* 466 */ \
+ OP(RenderbufferStorageMultisampleEXT) /* 467 */ \
+ OP(FramebufferTexture2DMultisampleEXT) /* 468 */ \
+ OP(TexStorage2DEXT) /* 469 */ \
+ OP(GenQueriesEXTImmediate) /* 470 */ \
+ OP(DeleteQueriesEXTImmediate) /* 471 */ \
+ OP(BeginQueryEXT) /* 472 */ \
+ OP(BeginTransformFeedback) /* 473 */ \
+ OP(EndQueryEXT) /* 474 */ \
+ OP(EndTransformFeedback) /* 475 */ \
+ OP(InsertEventMarkerEXT) /* 476 */ \
+ OP(PushGroupMarkerEXT) /* 477 */ \
+ OP(PopGroupMarkerEXT) /* 478 */ \
+ OP(GenVertexArraysOESImmediate) /* 479 */ \
+ OP(DeleteVertexArraysOESImmediate) /* 480 */ \
+ OP(IsVertexArrayOES) /* 481 */ \
+ OP(BindVertexArrayOES) /* 482 */ \
+ OP(SwapBuffers) /* 483 */ \
+ OP(GetMaxValueInBufferCHROMIUM) /* 484 */ \
+ OP(EnableFeatureCHROMIUM) /* 485 */ \
+ OP(ResizeCHROMIUM) /* 486 */ \
+ OP(GetRequestableExtensionsCHROMIUM) /* 487 */ \
+ OP(RequestExtensionCHROMIUM) /* 488 */ \
+ OP(GetProgramInfoCHROMIUM) /* 489 */ \
+ OP(GetUniformBlocksCHROMIUM) /* 490 */ \
+ OP(GetTransformFeedbackVaryingsCHROMIUM) /* 491 */ \
+ OP(GetUniformsES3CHROMIUM) /* 492 */ \
+ OP(GetTranslatedShaderSourceANGLE) /* 493 */ \
+ OP(PostSubBufferCHROMIUM) /* 494 */ \
+ OP(TexImageIOSurface2DCHROMIUM) /* 495 */ \
+ OP(CopyTextureCHROMIUM) /* 496 */ \
+ OP(DrawArraysInstancedANGLE) /* 497 */ \
+ OP(DrawElementsInstancedANGLE) /* 498 */ \
+ OP(VertexAttribDivisorANGLE) /* 499 */ \
+ OP(GenMailboxCHROMIUM) /* 500 */ \
+ OP(ProduceTextureCHROMIUMImmediate) /* 501 */ \
+ OP(ProduceTextureDirectCHROMIUMImmediate) /* 502 */ \
+ OP(ConsumeTextureCHROMIUMImmediate) /* 503 */ \
+ OP(CreateAndConsumeTextureCHROMIUMImmediate) /* 504 */ \
+ OP(BindUniformLocationCHROMIUMBucket) /* 505 */ \
+ OP(GenValuebuffersCHROMIUMImmediate) /* 506 */ \
+ OP(DeleteValuebuffersCHROMIUMImmediate) /* 507 */ \
+ OP(IsValuebufferCHROMIUM) /* 508 */ \
+ OP(BindValuebufferCHROMIUM) /* 509 */ \
+ OP(SubscribeValueCHROMIUM) /* 510 */ \
+ OP(PopulateSubscribedValuesCHROMIUM) /* 511 */ \
+ OP(UniformValuebufferCHROMIUM) /* 512 */ \
+ OP(BindTexImage2DCHROMIUM) /* 513 */ \
+ OP(ReleaseTexImage2DCHROMIUM) /* 514 */ \
+ OP(TraceBeginCHROMIUM) /* 515 */ \
+ OP(TraceEndCHROMIUM) /* 516 */ \
+ OP(AsyncTexSubImage2DCHROMIUM) /* 517 */ \
+ OP(AsyncTexImage2DCHROMIUM) /* 518 */ \
+ OP(WaitAsyncTexImage2DCHROMIUM) /* 519 */ \
+ OP(WaitAllAsyncTexImage2DCHROMIUM) /* 520 */ \
+ OP(DiscardFramebufferEXTImmediate) /* 521 */ \
+ OP(LoseContextCHROMIUM) /* 522 */ \
+ OP(InsertSyncPointCHROMIUM) /* 523 */ \
+ OP(WaitSyncPointCHROMIUM) /* 524 */ \
+ OP(DrawBuffersEXTImmediate) /* 525 */ \
+ OP(DiscardBackbufferCHROMIUM) /* 526 */ \
+ OP(ScheduleOverlayPlaneCHROMIUM) /* 527 */ \
+ OP(SwapInterval) /* 528 */ \
+ OP(MatrixLoadfCHROMIUMImmediate) /* 529 */ \
+ OP(MatrixLoadIdentityCHROMIUM) /* 530 */ \
+ OP(BlendBarrierKHR) /* 531 */
enum CommandId {
kStartPoint = cmd::kLastCommonId, // All GLES2 commands start after this.
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index f530974..6b254e0 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -12087,6 +12087,24 @@ error::Error GLES2DecoderImpl::HandleClientWaitSync(
return error::kNoError;
}
+error::Error GLES2DecoderImpl::HandleWaitSync(
+ uint32_t immediate_data_size, const void* cmd_data) {
+ if (!unsafe_es3_apis_enabled())
+ return error::kUnknownCommand;
+ const gles2::cmds::WaitSync& c =
+ *static_cast<const gles2::cmds::WaitSync*>(cmd_data);
+ GLuint sync = static_cast<GLuint>(c.sync);
+ GLbitfield flags = static_cast<GLbitfield>(c.flags);
+ GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1);
+ GLsync service_sync = 0;
+ if (!group_->GetSyncServiceId(sync, &service_sync)) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "WaitSync", "invalid sync");
+ return error::kNoError;
+ }
+ glWaitSync(service_sync, flags, timeout);
+ return error::kNoError;
+}
+
void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer(
TextureRef* texture_ref) {
Texture* texture = texture_ref->texture();
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index cf4ea62..e07a8ee 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -356,6 +356,24 @@ TEST_P(GLES2DecoderTest, ClientWaitSyncBadSharedMemoryFails) {
EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
}
+TEST_P(GLES2DecoderTest, WaitSyncValidArgs) {
+ const GLuint64 kTimeout = GL_TIMEOUT_IGNORED;
+ EXPECT_CALL(*gl_, WaitSync(reinterpret_cast<GLsync>(kServiceSyncId),
+ 0, kTimeout))
+ .Times(1)
+ .RetiresOnSaturation();
+
+ uint32_t v32_0 = 0, v32_1 = 0;
+ GLES2Util::MapUint64ToTwoUint32(kTimeout, &v32_0, &v32_1);
+ cmds::WaitSync cmd;
+ cmd.Init(client_sync_id_, 0, v32_0, v32_1);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+}
+
TEST_P(GLES2DecoderManualInitTest, BindGeneratesResourceFalse) {
InitState init;
InitDecoder(init);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h
index e31738f2..1add369 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h
@@ -159,6 +159,8 @@ TEST_P(GLES2DecoderTest3, ViewportInvalidArgs3_0) {
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
}
+// TODO(gman): WaitSync
+
// TODO(gman): TexStorage2DEXT
// TODO(gman): GenQueriesEXTImmediate
// TODO(gman): DeleteQueriesEXTImmediate