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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file is here so other GLES2 related files can have a common set of 5 // This file is here so other GLES2 related files can have a common set of
6 // includes where appropriate. 6 // includes where appropriate.
7 7
8 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ 8 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_
9 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ 9 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Does an add checking for overflow. If there was no overflow returns true. 47 // Does an add checking for overflow. If there was no overflow returns true.
48 inline bool SafeAddInt32(int32_t a, int32_t b, int32_t* dst) { 48 inline bool SafeAddInt32(int32_t a, int32_t b, int32_t* dst) {
49 DCHECK(dst); 49 DCHECK(dst);
50 base::CheckedNumeric<int32_t> checked = a; 50 base::CheckedNumeric<int32_t> checked = a;
51 checked += b; 51 checked += b;
52 *dst = checked.ValueOrDefault(0); 52 *dst = checked.ValueOrDefault(0);
53 return checked.IsValid(); 53 return checked.IsValid();
54 } 54 }
55 55
56 // Returns the address of the first byte after a struct.
57 template <typename T>
58 const void* AddressAfterStruct(const T& pod) {
59 return reinterpret_cast<const uint8_t*>(&pod) + sizeof(pod);
60 }
61
62 // Returns the address of the frst byte after the struct or NULL if size >
63 // immediate_data_size.
64 template <typename RETURN_TYPE, typename COMMAND_TYPE>
65 RETURN_TYPE GetImmediateDataAs(const COMMAND_TYPE& pod,
66 uint32_t size,
67 uint32_t immediate_data_size) {
68 return (size <= immediate_data_size)
69 ? static_cast<RETURN_TYPE>(
70 const_cast<void*>(AddressAfterStruct(pod)))
71 : NULL;
72 }
73
56 struct GLES2_UTILS_EXPORT PixelStoreParams { 74 struct GLES2_UTILS_EXPORT PixelStoreParams {
57 PixelStoreParams() 75 PixelStoreParams()
58 : alignment(4), 76 : alignment(4),
59 row_length(0), 77 row_length(0),
60 image_height(0), 78 image_height(0),
61 skip_pixels(0), 79 skip_pixels(0),
62 skip_rows(0), 80 skip_rows(0),
63 skip_images(0) { 81 skip_images(0) {
64 } 82 }
65 83
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 bool fail_if_major_perf_caveat; 316 bool fail_if_major_perf_caveat;
299 bool lose_context_when_out_of_memory; 317 bool lose_context_when_out_of_memory;
300 ContextType context_type; 318 ContextType context_type;
301 }; 319 };
302 320
303 } // namespace gles2 321 } // namespace gles2
304 } // namespace gpu 322 } // namespace gpu
305 323
306 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_ 324 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_
307 325
OLDNEW
« 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