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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 1399173002: Reland: Added SyncToken command buffer trait to help with IPC messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Read/Write SyncToken variables separately. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.cc ('k') | gpu/command_buffer/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 27bdd8a0f99ce0b3943872020c292213cea53393..b1a2aa835febf5ce60d9f9f64b3700c058c656f8 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -30,6 +30,7 @@
#include "gpu/command_buffer/client/vertex_array_object_manager.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/common/id_allocator.h"
+#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/command_buffer/common/trace_event.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
@@ -5385,12 +5386,10 @@ void GLES2Implementation::GenSyncTokenCHROMIUM(GLuint64 fence_sync,
return;
}
- SyncToken* sync_token_data = reinterpret_cast<SyncToken*>(sync_token);
- memset(sync_token_data, 0, sizeof(SyncToken));
-
- sync_token_data->namespace_id = gpu_control_->GetNamespaceID();
- sync_token_data->command_buffer_id = gpu_control_->GetCommandBufferID();
- sync_token_data->release_count = fence_sync;
+ // Copy the data over after setting the data to ensure alignment.
+ SyncToken sync_token_data(gpu_control_->GetNamespaceID(),
+ gpu_control_->GetCommandBufferID(), fence_sync);
+ memcpy(sync_token, &sync_token_data, sizeof(sync_token_data));
}
void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {
@@ -5399,11 +5398,12 @@ void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) {
return;
};
- const SyncToken* sync_token_data =
- reinterpret_cast<const SyncToken*>(sync_token);
- helper_->WaitSyncTokenCHROMIUM(sync_token_data->namespace_id,
- sync_token_data->command_buffer_id,
- sync_token_data->release_count);
+ // Copy the data over before data access to ensure alignment.
+ SyncToken sync_token_data;
+ memcpy(&sync_token_data, sync_token, sizeof(SyncToken));
+ helper_->WaitSyncTokenCHROMIUM(sync_token_data.namespace_id(),
+ sync_token_data.command_buffer_id(),
+ sync_token_data.release_count());
}
namespace {
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.cc ('k') | gpu/command_buffer/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698