| Index: gpu/command_buffer/client/gles2_implementation.cc
|
| diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
|
| index 8b272ded6592b8d749c78945809964b34fe39c6a..ff61433fff59d2179fc27ec7cd072b60a1eccfe6 100644
|
| --- a/gpu/command_buffer/client/gles2_implementation.cc
|
| +++ b/gpu/command_buffer/client/gles2_implementation.cc
|
| @@ -378,19 +378,15 @@ void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token,
|
| const base::Closure& callback) {
|
| if (sync_token.HasData() &&
|
| (sync_token.verified_flush() ||
|
| - gpu_control_->CanWaitUnverifiedSyncToken(&sync_token))) {
|
| -
|
| - gpu::SyncToken intermediate_sync_token = sync_token;
|
| -
|
| - // Mark the intermediate sync token as verified if we can wait on
|
| - // unverified sync tokens.
|
| - intermediate_sync_token.SetVerifyFlush();
|
| + gpu_control_->CanWaitUnverifiedSyncToken(sync_token))) {
|
| + // We can only send verified sync tokens across IPC.
|
| + gpu::SyncToken verified_sync_token = sync_token;
|
| + verified_sync_token.SetVerifyFlush();
|
|
|
| gpu_control_->SignalSyncToken(
|
| - intermediate_sync_token,
|
| + verified_sync_token,
|
| base::Bind(&GLES2Implementation::RunIfContextNotLost,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - callback));
|
| + weak_ptr_factory_.GetWeakPtr(), callback));
|
| } else {
|
| // Invalid sync token, just call the callback immediately.
|
| callback.Run();
|
| @@ -399,7 +395,7 @@ void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token,
|
|
|
| // This may be called from any thread. It's safe to access gpu_control_ without
|
| // the lock because it is const.
|
| -bool GLES2Implementation::IsSyncTokenSignalled(
|
| +bool GLES2Implementation::IsSyncTokenSignaled(
|
| const gpu::SyncToken& sync_token) {
|
| // Check that the sync token belongs to this context.
|
| DCHECK_EQ(gpu_control_->GetNamespaceID(), sync_token.namespace_id());
|
| @@ -6115,7 +6111,7 @@ void GLES2Implementation::VerifySyncTokensCHROMIUM(GLbyte **sync_tokens,
|
| memcpy(&sync_token, sync_tokens[i], sizeof(sync_token));
|
|
|
| if (sync_token.HasData() && !sync_token.verified_flush()) {
|
| - if (!gpu_control_->CanWaitUnverifiedSyncToken(&sync_token)) {
|
| + if (!gpu_control_->CanWaitUnverifiedSyncToken(sync_token)) {
|
| SetGLError(GL_INVALID_VALUE, "glVerifySyncTokensCHROMIUM",
|
| "Cannot verify sync token using this context.");
|
| return;
|
| @@ -6149,25 +6145,32 @@ void GLES2Implementation::VerifySyncTokensCHROMIUM(GLbyte **sync_tokens,
|
| }
|
| }
|
|
|
| -void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {
|
| - if (sync_token) {
|
| - // Copy the data over before data access to ensure alignment.
|
| - SyncToken sync_token_data;
|
| - memcpy(&sync_token_data, sync_token, sizeof(SyncToken));
|
| - if (sync_token_data.HasData()) {
|
| - if (!sync_token_data.verified_flush() &&
|
| - !gpu_control_->CanWaitUnverifiedSyncToken(&sync_token_data)) {
|
| - SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM",
|
| - "Cannot wait on sync_token which has not been verified");
|
| - return;
|
| - }
|
| +void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token_data) {
|
| + if (!sync_token_data)
|
| + return;
|
|
|
| - helper_->WaitSyncTokenCHROMIUM(
|
| - static_cast<GLint>(sync_token_data.namespace_id()),
|
| - sync_token_data.command_buffer_id().GetUnsafeValue(),
|
| - sync_token_data.release_count());
|
| - }
|
| + // Copy the data over before data access to ensure alignment.
|
| + SyncToken sync_token;
|
| + memcpy(&sync_token, sync_token_data, sizeof(SyncToken));
|
| +
|
| + if (!sync_token.HasData())
|
| + return;
|
| +
|
| + if (!sync_token.verified_flush() &&
|
| + !gpu_control_->CanWaitUnverifiedSyncToken(sync_token)) {
|
| + SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM",
|
| + "Cannot wait on sync_token which has not been verified");
|
| + return;
|
| }
|
| +
|
| + helper_->WaitSyncTokenCHROMIUM(
|
| + static_cast<GLint>(sync_token.namespace_id()),
|
| + sync_token.command_buffer_id().GetUnsafeValue(),
|
| + sync_token.release_count());
|
| +
|
| + // Enqueue sync token in flush after inserting command so that it's not
|
| + // included in an automatic flush.
|
| + gpu_control_->WaitSyncToken(sync_token);
|
| }
|
|
|
| namespace {
|
|
|