| 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 45b52d9461df319a4f161f862b6aca6217b95e0c..4fcb0b3217102debe568bd972bbadbecf86a0d34 100644
|
| --- a/gpu/command_buffer/client/gles2_implementation.cc
|
| +++ b/gpu/command_buffer/client/gles2_implementation.cc
|
| @@ -5366,6 +5366,11 @@ GLuint GLES2Implementation::InsertSyncPointCHROMIUM() {
|
| return gpu_control_->InsertSyncPoint();
|
| }
|
|
|
| +void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
|
| + // This should no longer be called.
|
| + NOTREACHED();
|
| +}
|
| +
|
| GLuint GLES2Implementation::InsertFutureSyncPointCHROMIUM() {
|
| GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertFutureSyncPointCHROMIUM");
|
| @@ -5437,25 +5442,34 @@ void GLES2Implementation::GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync,
|
| }
|
|
|
| void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {
|
| - if (!sync_token) {
|
| - SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", "empty sync_token");
|
| - return;
|
| - };
|
| + 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;
|
| + }
|
|
|
| - // Copy the data over before data access to ensure alignment.
|
| - SyncToken sync_token_data;
|
| - memcpy(&sync_token_data, sync_token, sizeof(SyncToken));
|
| + // TODO(dyen): Temporarily support old sync points, remove once all old
|
| + // sync points have been removed.
|
| + const gpu::CommandBufferNamespace namespace_id =
|
| + sync_token_data.namespace_id();
|
| + if (namespace_id == gpu::CommandBufferNamespace::OLD_SYNC_POINTS) {
|
| + const uint32_t sync_point =
|
| + static_cast<uint32_t>(sync_token_data.release_count());
|
| + helper_->WaitSyncPointCHROMIUM(sync_point);
|
| + return;
|
| + }
|
|
|
| - 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;
|
| + helper_->WaitSyncTokenCHROMIUM(
|
| + static_cast<GLuint>(sync_token_data.namespace_id()),
|
| + sync_token_data.command_buffer_id(), sync_token_data.release_count());
|
| + }
|
| }
|
| -
|
| - helper_->WaitSyncTokenCHROMIUM(sync_token_data.namespace_id(),
|
| - sync_token_data.command_buffer_id(),
|
| - sync_token_data.release_count());
|
| }
|
|
|
| namespace {
|
|
|