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