OLD | NEW |
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 5423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5434 "invalid fence sync"); | 5434 "invalid fence sync"); |
5435 return; | 5435 return; |
5436 } else if (!gpu_control_->IsFenceSyncFlushReceived(fence_sync)) { | 5436 } else if (!gpu_control_->IsFenceSyncFlushReceived(fence_sync)) { |
5437 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", | 5437 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", |
5438 "fence sync must be flushed before generating sync token"); | 5438 "fence sync must be flushed before generating sync token"); |
5439 return; | 5439 return; |
5440 } | 5440 } |
5441 | 5441 |
5442 // Copy the data over after setting the data to ensure alignment. | 5442 // Copy the data over after setting the data to ensure alignment. |
5443 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), | 5443 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), |
| 5444 gpu_control_->GetExtraCommandBufferData(), |
5444 gpu_control_->GetCommandBufferID(), fence_sync); | 5445 gpu_control_->GetCommandBufferID(), fence_sync); |
5445 sync_token_data.SetVerifyFlush(); | 5446 sync_token_data.SetVerifyFlush(); |
5446 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); | 5447 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
5447 } | 5448 } |
5448 | 5449 |
5449 void GLES2Implementation::GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync, | 5450 void GLES2Implementation::GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync, |
5450 GLbyte* sync_token) { | 5451 GLbyte* sync_token) { |
5451 if (!sync_token) { | 5452 if (!sync_token) { |
5452 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", | 5453 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", |
5453 "empty sync_token"); | 5454 "empty sync_token"); |
5454 return; | 5455 return; |
5455 } else if (!gpu_control_->IsFenceSyncRelease(fence_sync)) { | 5456 } else if (!gpu_control_->IsFenceSyncRelease(fence_sync)) { |
5456 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", | 5457 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", |
5457 "invalid fence sync"); | 5458 "invalid fence sync"); |
5458 return; | 5459 return; |
5459 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) { | 5460 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) { |
5460 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", | 5461 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", |
5461 "fence sync must be flushed before generating sync token"); | 5462 "fence sync must be flushed before generating sync token"); |
5462 return; | 5463 return; |
5463 } | 5464 } |
5464 | 5465 |
5465 // Copy the data over after setting the data to ensure alignment. | 5466 // Copy the data over after setting the data to ensure alignment. |
5466 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), | 5467 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), |
| 5468 gpu_control_->GetExtraCommandBufferData(), |
5467 gpu_control_->GetCommandBufferID(), fence_sync); | 5469 gpu_control_->GetCommandBufferID(), fence_sync); |
5468 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); | 5470 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
5469 } | 5471 } |
5470 | 5472 |
5471 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { | 5473 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { |
5472 if (sync_token) { | 5474 if (sync_token) { |
5473 // Copy the data over before data access to ensure alignment. | 5475 // Copy the data over before data access to ensure alignment. |
5474 SyncToken sync_token_data; | 5476 SyncToken sync_token_data; |
5475 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); | 5477 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); |
5476 if (sync_token_data.HasData()) { | 5478 if (sync_token_data.HasData()) { |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6392 CheckGLError(); | 6394 CheckGLError(); |
6393 } | 6395 } |
6394 | 6396 |
6395 // Include the auto-generated part of this file. We split this because it means | 6397 // Include the auto-generated part of this file. We split this because it means |
6396 // we can easily edit the non-auto generated parts right here in this file | 6398 // we can easily edit the non-auto generated parts right here in this file |
6397 // instead of having to edit some template or the code generator. | 6399 // instead of having to edit some template or the code generator. |
6398 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6400 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6399 | 6401 |
6400 } // namespace gles2 | 6402 } // namespace gles2 |
6401 } // namespace gpu | 6403 } // namespace gpu |
OLD | NEW |