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

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

Issue 2012533004: Add generated and hand-written passthrough command handlers with stub Doers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 | « gpu/command_buffer/common/buffer.cc ('k') | gpu/command_buffer/service/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/gles2_cmd_utils.h
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h
index 267c0413af312bba055ab9657b062c71cbb2dd49..a6e8bcb4770f5804b341c5670d16ac53643aa948 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils.h
@@ -53,6 +53,24 @@ inline bool SafeAddInt32(int32_t a, int32_t b, int32_t* dst) {
return checked.IsValid();
}
+// Returns the address of the first byte after a struct.
+template <typename T>
+const void* AddressAfterStruct(const T& pod) {
+ return reinterpret_cast<const uint8_t*>(&pod) + sizeof(pod);
+}
+
+// Returns the address of the frst byte after the struct or NULL if size >
+// immediate_data_size.
+template <typename RETURN_TYPE, typename COMMAND_TYPE>
+RETURN_TYPE GetImmediateDataAs(const COMMAND_TYPE& pod,
+ uint32_t size,
+ uint32_t immediate_data_size) {
+ return (size <= immediate_data_size)
+ ? static_cast<RETURN_TYPE>(
+ const_cast<void*>(AddressAfterStruct(pod)))
+ : NULL;
+}
+
struct GLES2_UTILS_EXPORT PixelStoreParams {
PixelStoreParams()
: alignment(4),
« no previous file with comments | « gpu/command_buffer/common/buffer.cc ('k') | gpu/command_buffer/service/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698