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

Side by Side Diff: gpu/command_buffer/common/gles2_cmd_format.h

Issue 9693011: Land http://src.chromium.org/viewvc/chrome?view=rev&revision=125984 to trunk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 defines the GLES2 command buffer commands. 5 // This file defines the GLES2 command buffer commands.
6 6
7 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ 7 #ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_
8 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ 8 #define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_
9 9
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 // Returns the total size in bytes of the SizedResult for a given size of 86 // Returns the total size in bytes of the SizedResult for a given size of
87 // results. 87 // results.
88 static size_t ComputeSizeFromBytes(size_t size_of_result_in_bytes) { 88 static size_t ComputeSizeFromBytes(size_t size_of_result_in_bytes) {
89 return size_of_result_in_bytes + sizeof(uint32); // NOLINT 89 return size_of_result_in_bytes + sizeof(uint32); // NOLINT
90 } 90 }
91 91
92 // Returns the maximum number of results for a given buffer size. 92 // Returns the maximum number of results for a given buffer size.
93 static uint32 ComputeMaxResults(size_t size_of_buffer) { 93 static uint32 ComputeMaxResults(size_t size_of_buffer) {
94 return (size_of_buffer - sizeof(uint32)) / sizeof(T); // NOLINT 94 return (size_of_buffer >= sizeof(uint32)) ?
95 ((size_of_buffer - sizeof(uint32)) / sizeof(T)) : 0; // NOLINT
95 } 96 }
96 97
97 // Set the size for a given number of results. 98 // Set the size for a given number of results.
98 void SetNumResults(size_t num_results) { 99 void SetNumResults(size_t num_results) {
99 size = sizeof(T) * num_results; // NOLINT 100 size = sizeof(T) * num_results; // NOLINT
100 } 101 }
101 102
102 // Get the number of elements in the result 103 // Get the number of elements in the result
103 int32 GetNumResults() const { 104 int32 GetNumResults() const {
104 return size / sizeof(T); // NOLINT 105 return size / sizeof(T); // NOLINT
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 OffsetOf_GetUniformLocationBucket_location_shm_id_not_12); 533 OffsetOf_GetUniformLocationBucket_location_shm_id_not_12);
533 COMPILE_ASSERT(offsetof(GetUniformLocationBucket, location_shm_offset) == 16, 534 COMPILE_ASSERT(offsetof(GetUniformLocationBucket, location_shm_offset) == 16,
534 OffsetOf_GetUniformLocationBucket_location_shm_offset_not_16); 535 OffsetOf_GetUniformLocationBucket_location_shm_offset_not_16);
535 536
536 #pragma pack(pop) 537 #pragma pack(pop)
537 538
538 } // namespace gles2 539 } // namespace gles2
539 } // namespace gpu 540 } // namespace gpu
540 541
541 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ 542 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698