| 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 5534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5545 "invalid fence sync"); | 5545 "invalid fence sync"); |
| 5546 return; | 5546 return; |
| 5547 } else if (!gpu_control_->IsFenceSyncFlushReceived(fence_sync)) { | 5547 } else if (!gpu_control_->IsFenceSyncFlushReceived(fence_sync)) { |
| 5548 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", | 5548 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", |
| 5549 "fence sync must be flushed before generating sync token"); | 5549 "fence sync must be flushed before generating sync token"); |
| 5550 return; | 5550 return; |
| 5551 } | 5551 } |
| 5552 | 5552 |
| 5553 // Copy the data over after setting the data to ensure alignment. | 5553 // Copy the data over after setting the data to ensure alignment. |
| 5554 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), | 5554 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), |
| 5555 gpu_control_->GetExtraCommandBufferData(), | |
| 5556 gpu_control_->GetCommandBufferID(), fence_sync); | 5555 gpu_control_->GetCommandBufferID(), fence_sync); |
| 5557 sync_token_data.SetVerifyFlush(); | 5556 sync_token_data.SetVerifyFlush(); |
| 5558 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); | 5557 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
| 5559 } | 5558 } |
| 5560 | 5559 |
| 5561 void GLES2Implementation::GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync, | 5560 void GLES2Implementation::GenUnverifiedSyncTokenCHROMIUM(GLuint64 fence_sync, |
| 5562 GLbyte* sync_token) { | 5561 GLbyte* sync_token) { |
| 5563 if (!sync_token) { | 5562 if (!sync_token) { |
| 5564 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", | 5563 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", |
| 5565 "empty sync_token"); | 5564 "empty sync_token"); |
| 5566 return; | 5565 return; |
| 5567 } else if (!gpu_control_->IsFenceSyncRelease(fence_sync)) { | 5566 } else if (!gpu_control_->IsFenceSyncRelease(fence_sync)) { |
| 5568 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", | 5567 SetGLError(GL_INVALID_VALUE, "glGenNonFlushedSyncTokenCHROMIUM", |
| 5569 "invalid fence sync"); | 5568 "invalid fence sync"); |
| 5570 return; | 5569 return; |
| 5571 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) { | 5570 } else if (!gpu_control_->IsFenceSyncFlushed(fence_sync)) { |
| 5572 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", | 5571 SetGLError(GL_INVALID_OPERATION, "glGenSyncTokenCHROMIUM", |
| 5573 "fence sync must be flushed before generating sync token"); | 5572 "fence sync must be flushed before generating sync token"); |
| 5574 return; | 5573 return; |
| 5575 } | 5574 } |
| 5576 | 5575 |
| 5577 // Copy the data over after setting the data to ensure alignment. | 5576 // Copy the data over after setting the data to ensure alignment. |
| 5578 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), | 5577 SyncToken sync_token_data(gpu_control_->GetNamespaceID(), |
| 5579 gpu_control_->GetExtraCommandBufferData(), | |
| 5580 gpu_control_->GetCommandBufferID(), fence_sync); | 5578 gpu_control_->GetCommandBufferID(), fence_sync); |
| 5581 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); | 5579 memcpy(sync_token, &sync_token_data, sizeof(sync_token_data)); |
| 5582 } | 5580 } |
| 5583 | 5581 |
| 5584 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { | 5582 void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { |
| 5585 if (sync_token) { | 5583 if (sync_token) { |
| 5586 // Copy the data over before data access to ensure alignment. | 5584 // Copy the data over before data access to ensure alignment. |
| 5587 SyncToken sync_token_data; | 5585 SyncToken sync_token_data; |
| 5588 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); | 5586 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); |
| 5589 if (sync_token_data.HasData()) { | 5587 if (sync_token_data.HasData()) { |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6506 CheckGLError(); | 6504 CheckGLError(); |
| 6507 } | 6505 } |
| 6508 | 6506 |
| 6509 // Include the auto-generated part of this file. We split this because it means | 6507 // Include the auto-generated part of this file. We split this because it means |
| 6510 // we can easily edit the non-auto generated parts right here in this file | 6508 // we can easily edit the non-auto generated parts right here in this file |
| 6511 // instead of having to edit some template or the code generator. | 6509 // instead of having to edit some template or the code generator. |
| 6512 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6510 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6513 | 6511 |
| 6514 } // namespace gles2 | 6512 } // namespace gles2 |
| 6515 } // namespace gpu | 6513 } // namespace gpu |
| OLD | NEW |