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 5478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5489 "invalid fence sync"); | 5489 "invalid fence sync"); |
5490 return; | 5490 return; |
5491 } else if (!gpu_control_->IsFenceSyncFlushReceived(fence_sync)) { | 5491 } else if (!gpu_control_->IsFenceSyncFlushReceived(fence_sync)) { |
5492 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", | 5492 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", |
5493 "fence sync must be flushed before generating sync token"); | 5493 "fence sync must be flushed before generating sync token"); |
5494 return; | 5494 return; |
5495 } | 5495 } |
5496 | 5496 |
5497 // Copy the data over after setting the data to ensure alignment. | 5497 // Copy the data over after setting the data to ensure alignment. |
5498 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), | 5498 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), |
| 5499 gpu_control_->GetExtraCommandBufferData(), |
5499 gpu_control_->GetCommandBufferID(), fence_sync); | 5500 gpu_control_->GetCommandBufferID(), fence_sync); |
5500 sync_token_data.SetVerifyFlush(); | 5501 sync_token_data.SetVerifyFlush(); |
5501 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); | 5502 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
5502 } | 5503 } |
5503 | 5504 |
5504 void GLES2Implementation::GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync, | 5505 void GLES2Implementation::GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync, |
5505 GLbyte* sync_token) { | 5506 GLbyte* sync_token) { |
5506 if (!sync_token) { | 5507 if (!sync_token) { |
5507 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", | 5508 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", |
5508 "empty sync_token"); | 5509 "empty sync_token"); |
5509 return; | 5510 return; |
5510 } else if (!gpu_control_->IsFenceSyncRelease(fence_sync)) { | 5511 } else if (!gpu_control_->IsFenceSyncRelease(fence_sync)) { |
5511 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", | 5512 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", |
5512 "invalid fence sync"); | 5513 "invalid fence sync"); |
5513 return; | 5514 return; |
5514 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) { | 5515 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) { |
5515 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", | 5516 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", |
5516 "fence sync must be flushed before generating sync token"); | 5517 "fence sync must be flushed before generating sync token"); |
5517 return; | 5518 return; |
5518 } | 5519 } |
5519 | 5520 |
5520 // Copy the data over after setting the data to ensure alignment. | 5521 // Copy the data over after setting the data to ensure alignment. |
5521 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), | 5522 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), |
| 5523 gpu_control_->GetExtraCommandBufferData(), |
5522 gpu_control_->GetCommandBufferID(), fence_sync); | 5524 gpu_control_->GetCommandBufferID(), fence_sync); |
5523 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); | 5525 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
5524 } | 5526 } |
5525 | 5527 |
5526 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { | 5528 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { |
5527 if (sync_token) { | 5529 if (sync_token) { |
5528 // Copy the data over before data access to ensure alignment. | 5530 // Copy the data over before data access to ensure alignment. |
5529 SyncToken sync_token_data; | 5531 SyncToken sync_token_data; |
5530 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); | 5532 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); |
5531 if (sync_token_data.HasData()) { | 5533 if (sync_token_data.HasData()) { |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6447 CheckGLError(); | 6449 CheckGLError(); |
6448 } | 6450 } |
6449 | 6451 |
6450 // Include the auto-generated part of this file. We split this because it means | 6452 // Include the auto-generated part of this file. We split this because it means |
6451 // we can easily edit the non-auto generated parts right here in this file | 6453 // we can easily edit the non-auto generated parts right here in this file |
6452 // instead of having to edit some template or the code generator. | 6454 // instead of having to edit some template or the code generator. |
6453 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6455 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6454 | 6456 |
6455 } // namespace gles2 | 6457 } // namespace gles2 |
6456 } // namespace gpu | 6458 } // namespace gpu |
OLD | NEW |