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

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: Some fixes Created 5 years, 3 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 5351 matching lines...) Expand 10 before | Expand all | Expand 10 after
5362 5362
5363 void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) { 5363 void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) {
5364 GPU_CLIENT_SINGLE_THREAD_CHECK(); 5364 GPU_CLIENT_SINGLE_THREAD_CHECK();
5365 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM(" 5365 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM("
5366 << sync_point << ")"); 5366 << sync_point << ")");
5367 DCHECK(capabilities_.future_sync_points); 5367 DCHECK(capabilities_.future_sync_points);
5368 helper_->CommandBufferHelper::Flush(); 5368 helper_->CommandBufferHelper::Flush();
5369 gpu_control_->RetireSyncPoint(sync_point); 5369 gpu_control_->RetireSyncPoint(sync_point);
5370 } 5370 }
5371 5371
5372 GLuint GLES2Implementation::InsertFenceSyncCHROMIUM() {
5373 const uint32_t release = helper_->GenerateFenceSyncRelease();
5374 helper_->InsertFenceSyncCHROMIUM(release);
5375 return release;
5376 }
5377
5378 void GLES2Implementation::GenSyncTokenCHROMIUM(GLuint fence_sync,
5379 GLbyte* sync_token) {
5380 if (!sync_token) {
5381 SetGLError(GL_INVALID_VALUE, "glGenSyncTokenCHROMIUM", "empty sync_token");
5382 return;
5383 } else if (!helper_->IsFenceSyncRelease(fence_sync)) {
5384 SetGLError(GL_INVALID_VALUE, "glGenSyncTokenCHROMIUM",
5385 "invalid fence sync");
5386 return;
5387 } else if (!helper_->IsFenceSyncFlushed(fence_sync)) {
5388 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM",
5389 "fence sync must be flushed before generating sync token");
5390 return;
5391 }
5392
5393 int channel_id = 0;
5394 uint32_t route_id = 0;
5395 helper_->command_buffer()->GetRouteInformation(&channel_id, &route_id);
5396
5397 SyncToken* sync_token_data = reinterpret_cast<SyncToken*>(sync_token);
5398 memset(sync_token_data, 0, sizeof(SyncToken));
5399 sync_token_data->channel_client_id = channel_id;
5400 sync_token_data->route_id = route_id;
5401 sync_token_data->release_count = fence_sync;
5402 }
5403
5404 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {
5405 if (!sync_token) {
5406 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", "empty sync_token");
5407 return;
5408 };
5409
5410 const SyncToken* sync_token_data =
5411 reinterpret_cast<const SyncToken*>(sync_token);
5412 helper_->WaitSyncTokenCHROMIUM(sync_token_data->channel_client_id,
5413 sync_token_data->route_id,
5414 sync_token_data->release_count);
5415 }
5416
5372 namespace { 5417 namespace {
5373 5418
5374 bool ValidImageFormat(GLenum internalformat, 5419 bool ValidImageFormat(GLenum internalformat,
5375 const Capabilities& capabilities) { 5420 const Capabilities& capabilities) {
5376 switch (internalformat) { 5421 switch (internalformat) {
5377 case GL_ATC_RGB_AMD: 5422 case GL_ATC_RGB_AMD:
5378 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD: 5423 case GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD:
5379 return capabilities.texture_format_atc; 5424 return capabilities.texture_format_atc;
5380 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: 5425 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
5381 return capabilities.texture_format_dxt1; 5426 return capabilities.texture_format_dxt1;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
5887 CheckGLError(); 5932 CheckGLError();
5888 } 5933 }
5889 5934
5890 // Include the auto-generated part of this file. We split this because it means 5935 // Include the auto-generated part of this file. We split this because it means
5891 // we can easily edit the non-auto generated parts right here in this file 5936 // we can easily edit the non-auto generated parts right here in this file
5892 // instead of having to edit some template or the code generator. 5937 // instead of having to edit some template or the code generator.
5893 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 5938 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
5894 5939
5895 } // namespace gles2 5940 } // namespace gles2
5896 } // namespace gpu 5941 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698