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

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

Issue 1331843005: Implemented new fence syncs which replaces the old sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted mojo readme, changed wait() to take a pointer Created 5 years, 2 months 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 5346 matching lines...) Expand 10 before | Expand all | Expand 10 after
5357 << sync_point << ")"); 5357 << sync_point << ")");
5358 DCHECK(capabilities_.future_sync_points); 5358 DCHECK(capabilities_.future_sync_points);
5359 helper_->CommandBufferHelper::Flush(); 5359 helper_->CommandBufferHelper::Flush();
5360 gpu_control_->RetireSyncPoint(sync_point); 5360 gpu_control_->RetireSyncPoint(sync_point);
5361 } 5361 }
5362 5362
5363 uint64_t GLES2Implementation::ShareGroupTracingGUID() const { 5363 uint64_t GLES2Implementation::ShareGroupTracingGUID() const {
5364 return share_group_->TracingGUID(); 5364 return share_group_->TracingGUID();
5365 } 5365 }
5366 5366
5367 GLuint64 GLES2Implementation::InsertFenceSyncCHROMIUM() {
5368 const uint64_t release = gpu_control_->GenerateFenceSyncRelease();
5369 helper_->InsertFenceSyncCHROMIUM(release);
5370 return release;
5371 }
5372
5373 void GLES2Implementation::GenSyncTokenCHROMIUM(GLuint64 fence_sync,
5374 GLbyte* sync_token) {
5375 if (!sync_token) {
5376 SetGLError(GL_INVALID_VALUE, "glGenSyncTokenCHROMIUM", "empty sync_token");
5377 return;
5378 } else if (!gpu_control_->IsFenceSyncRelease(fence_sync)) {
5379 SetGLError(GL_INVALID_VALUE, "glGenSyncTokenCHROMIUM",
5380 "invalid fence sync");
5381 return;
5382 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) {
5383 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM",
5384 "fence sync must be flushed before generating sync token");
5385 return;
5386 }
5387
5388 SyncToken* sync_token_data = reinterpret_cast<SyncToken*>(sync_token);
5389 memset(sync_token_data, 0, sizeof(SyncToken));
5390
5391 sync_token_data->namespace_id = gpu_control_->GetNamespaceID();
5392 sync_token_data->command_buffer_id = gpu_control_->GetCommandBufferID();
5393 sync_token_data->release_count = fence_sync;
5394 }
5395
5396 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {
5397 if (!sync_token) {
5398 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", "empty sync_token");
5399 return;
5400 };
5401
5402 const SyncToken* sync_token_data =
5403 reinterpret_cast<const SyncToken*>(sync_token);
5404 helper_->WaitSyncTokenCHROMIUM(sync_token_data->namespace_id,
5405 sync_token_data->command_buffer_id,
5406 sync_token_data->release_count);
5407 }
5408
5367 namespace { 5409 namespace {
5368 5410
5369 bool ValidImageFormat(GLenum internalformat, 5411 bool ValidImageFormat(GLenum internalformat,
5370 const Capabilities& capabilities) { 5412 const Capabilities& capabilities) {
5371 switch (internalformat) { 5413 switch (internalformat) {
5372 case GL_ATC_RGB_AMD: 5414 case GL_ATC_RGB_AMD:
5373 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: 5415 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
5374 return capabilities.texture_format_atc; 5416 return capabilities.texture_format_atc;
5375 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: 5417 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
5376 return capabilities.texture_format_dxt1; 5418 return capabilities.texture_format_dxt1;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
5882 CheckGLError(); 5924 CheckGLError();
5883 } 5925 }
5884 5926
5885 // Include the auto-generated part of this file. We split this because it means 5927 // Include the auto-generated part of this file. We split this because it means
5886 // we can easily edit the non-auto generated parts right here in this file 5928 // we can easily edit the non-auto generated parts right here in this file
5887 // instead of having to edit some template or the code generator. 5929 // instead of having to edit some template or the code generator.
5888 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 5930 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
5889 5931
5890 } // namespace gles2 5932 } // namespace gles2
5891 } // namespace gpu 5933 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_cmd_helper_autogen.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698