Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A class to emulate GLES2 over command buffers. 5 // A class to emulate GLES2 over command buffers.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 5348 matching lines...) Expand 10 before | Expand all | Expand 10 after
5359 return true; 5359 return true;
5360 } 5360 }
5361 5361
5362 GLuint GLES2Implementation::InsertSyncPointCHROMIUM() { 5362 GLuint GLES2Implementation::InsertSyncPointCHROMIUM() {
5363 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5363 GPU_CLIENT_SINGLE_THREAD_CHECK();
5364 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertSyncPointCHROMIUM"); 5364 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertSyncPointCHROMIUM");
5365 helper_->CommandBufferHelper::Flush(); 5365 helper_->CommandBufferHelper::Flush();
5366 return gpu_control_->InsertSyncPoint(); 5366 return gpu_control_->InsertSyncPoint();
5367 } 5367 }
5368 5368
5369 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) {
5370 // This should no longer be called.
5371 NOTREACHED();
5372 }
5373
5369 GLuint GLES2Implementation::InsertFutureSyncPointCHROMIUM() { 5374 GLuint GLES2Implementation::InsertFutureSyncPointCHROMIUM() {
5370 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5375 GPU_CLIENT_SINGLE_THREAD_CHECK();
5371 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertFutureSyncPointCHROMIUM"); 5376 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertFutureSyncPointCHROMIUM");
5372 DCHECK(capabilities_.future_sync_points); 5377 DCHECK(capabilities_.future_sync_points);
5373 return gpu_control_->InsertFutureSyncPoint(); 5378 return gpu_control_->InsertFutureSyncPoint();
5374 } 5379 }
5375 5380
5376 void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) { 5381 void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) {
5377 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5382 GPU_CLIENT_SINGLE_THREAD_CHECK();
5378 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM(" 5383 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM("
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
5430 return; 5435 return;
5431 } 5436 }
5432 5437
5433 // Copy the data over after setting the data to ensure alignment. 5438 // Copy the data over after setting the data to ensure alignment.
5434 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), 5439 SyncToken sync_token_data(gpu_control_->GetNamespaceID(),
5435 gpu_control_->GetCommandBufferID(), fence_sync); 5440 gpu_control_->GetCommandBufferID(), fence_sync);
5436 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); 5441 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data));
5437 } 5442 }
5438 5443
5439 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { 5444 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {
5440 if (!sync_token) { 5445 if (sync_token) {
5441 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", "empty sync_token"); 5446 // Copy the data over before data access to ensure alignment.
5442 return; 5447 SyncToken sync_token_data;
5443 }; 5448 memcpy(&sync_token_data, sync_token, sizeof(SyncToken));
5449 if (sync_token_data.HasData()) {
5450 if (!sync_token_data.verified_flush() &&
5451 !gpu_control_->CanWaitUnverifiedSyncToken(&sync_token_data)) {
5452 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM",
5453 "Cannot wait on sync_token which has not been verified");
5454 return;
5455 }
5444 5456
5445 // Copy the data over before data access to ensure alignment. 5457 // TODO(dyen): Temporarily support old sync points, remove once all old
5446 SyncToken sync_token_data; 5458 // sync points have been removed.
5447 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); 5459 const gpu::CommandBufferNamespace namespace_id =
5460 sync_token_data.namespace_id();
5461 if (namespace_id == gpu::CommandBufferNamespace::OLD_SYNC_POINTS) {
5462 const uint32_t sync_point =
5463 static_cast<uint32_t>(sync_token_data.release_count());
5464 helper_->WaitSyncPointCHROMIUM(sync_point);
5465 return;
5466 }
5448 5467
5449 if (!sync_token_data.verified_flush() && 5468 helper_->WaitSyncTokenCHROMIUM(
5450 !gpu_control_->CanWaitUnverifiedSyncToken(&sync_token_data)) { 5469 static_cast<GLuint>(sync_token_data.namespace_id()),
5451 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", 5470 sync_token_data.command_buffer_id(), sync_token_data.release_count());
5452 "Cannot wait on sync_token which has not been verified"); 5471 }
5453 return;
5454 } 5472 }
5455
5456 helper_->WaitSyncTokenCHROMIUM(sync_token_data.namespace_id(),
5457 sync_token_data.command_buffer_id(),
5458 sync_token_data.release_count());
5459 } 5473 }
5460 5474
5461 namespace { 5475 namespace {
5462 5476
5463 bool ValidImageFormat(GLenum internalformat, 5477 bool ValidImageFormat(GLenum internalformat,
5464 const Capabilities& capabilities) { 5478 const Capabilities& capabilities) {
5465 switch (internalformat) { 5479 switch (internalformat) {
5466 case GL_ATC_RGB_AMD: 5480 case GL_ATC_RGB_AMD:
5467 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: 5481 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
5468 return capabilities.texture_format_atc; 5482 return capabilities.texture_format_atc;
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
6347 CheckGLError(); 6361 CheckGLError();
6348 } 6362 }
6349 6363
6350 // Include the auto-generated part of this file. We split this because it means 6364 // Include the auto-generated part of this file. We split this because it means
6351 // we can easily edit the non-auto generated parts right here in this file 6365 // we can easily edit the non-auto generated parts right here in this file
6352 // instead of having to edit some template or the code generator. 6366 // instead of having to edit some template or the code generator.
6353 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 6367 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
6354 6368
6355 } // namespace gles2 6369 } // namespace gles2
6356 } // namespace gpu 6370 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | gpu/command_buffer/client/gles2_implementation_impl_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698