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

Unified Diff: gpu/command_buffer/common/cmd_buffer_common.h

Issue 2275203002: Make command buffer commands and immediate data volatile (Closed)
Patch Set: rebase Created 4 years, 3 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
Index: gpu/command_buffer/common/cmd_buffer_common.h
diff --git a/gpu/command_buffer/common/cmd_buffer_common.h b/gpu/command_buffer/common/cmd_buffer_common.h
index e8989be2894cd07a60fa4a04dce85e53d5d398c0..38acf4a6e9cde51386ed95daa102638c080c65b0 100644
--- a/gpu/command_buffer/common/cmd_buffer_common.h
+++ b/gpu/command_buffer/common/cmd_buffer_common.h
@@ -79,6 +79,11 @@ struct CommandHeader {
DCHECK_GE(size_in_bytes, sizeof(T)); // NOLINT
Init(T::kCmdId, ComputeNumEntries(size_in_bytes));
}
+
+ static CommandHeader FromVolatile(const volatile CommandHeader& other) {
+ // const_cast is safe because the copy constructor is trivial.
+ return const_cast<const CommandHeader&>(other);
+ }
};
static_assert(sizeof(CommandHeader) == 4,

Powered by Google App Engine
This is Rietveld 408576698