Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index 52a9c4351b47185261d76eba400f20aec9bb0b41..5ba2fd0a6904c6c5c18d3736a6f8203d61268ba4 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -12055,6 +12055,41 @@ error::Error GLES2DecoderImpl::HandleUniformBlockBinding( |
return error::kNoError; |
} |
+error::Error GLES2DecoderImpl::HandleClientWaitSync( |
+ uint32_t immediate_data_size, const void* cmd_data) { |
+ if (!unsafe_es3_apis_enabled()) |
+ return error::kUnknownCommand; |
+ const gles2::cmds::ClientWaitSync& c = |
+ *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); |
+ GLuint sync = static_cast<GLuint>(c.sync); |
+ GLbitfield flags = static_cast<GLbitfield>(c.flags); |
+ GLuint64Union mapping; |
+ mapping.param32[0] = c.timeout_0; |
+ mapping.param32[1] = c.timeout_1; |
+ GLuint64 timeout = mapping.param64; |
+ if (timeout != 0) { |
+ // In Chromium we only allow |timeout| to be 0. |
piman
2015/02/18 16:22:07
We should allow it here, and check this in the web
|
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "ClientWaitSync", "timeout not 0"); |
+ return error::kNoError; |
+ } |
+ typedef cmds::ClientWaitSync::Result Result; |
+ Result* result_dst = GetSharedMemoryAs<Result*>( |
+ c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); |
+ if (!result_dst) { |
+ return error::kOutOfBounds; |
+ } |
+ if (*result_dst != GL_WAIT_FAILED) { |
+ return error::kInvalidArguments; |
+ } |
+ GLsync service_sync = 0; |
+ if (!group_->GetSyncServiceId(sync, &service_sync)) { |
+ LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "ClientWaitSync", "invalid sync"); |
+ return error::kNoError; |
+ } |
+ *result_dst = glClientWaitSync(service_sync, flags, timeout); |
+ return error::kNoError; |
+} |
+ |
void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( |
TextureRef* texture_ref) { |
Texture* texture = texture_ref->texture(); |