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

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

Issue 822713002: Update from https://crrev.com/309415 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 12 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
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 kTextures, 59 kTextures,
60 kQueries, 60 kQueries,
61 kVertexArrays, 61 kVertexArrays,
62 kValuebuffers, 62 kValuebuffers,
63 kSamplers, 63 kSamplers,
64 kTransformFeedbacks, 64 kTransformFeedbacks,
65 kNumIdNamespaces 65 kNumIdNamespaces
66 }; 66 };
67 67
68 // These numbers must not change 68 // These numbers must not change
69 COMPILE_ASSERT(kBuffers == 0, kBuffers_is_not_0); 69 static_assert(kBuffers == 0, "kBuffers should equal 0");
70 COMPILE_ASSERT(kFramebuffers == 1, kFramebuffers_is_not_1); 70 static_assert(kFramebuffers == 1, "kFramebuffers should equal 1");
71 COMPILE_ASSERT(kProgramsAndShaders == 2, kProgramsAndShaders_is_not_2); 71 static_assert(kProgramsAndShaders == 2, "kProgramsAndShaders should equal 2");
72 COMPILE_ASSERT(kRenderbuffers == 3, kRenderbuffers_is_not_3); 72 static_assert(kRenderbuffers == 3, "kRenderbuffers should equal 3");
73 COMPILE_ASSERT(kTextures == 4, kTextures_is_not_4); 73 static_assert(kTextures == 4, "kTextures should equal 4");
74 74
75 } // namespace id_namespaces 75 } // namespace id_namespaces
76 76
77 // Used for some glGetXXX commands that return a result through a pointer. We 77 // Used for some glGetXXX commands that return a result through a pointer. We
78 // need to know if the command succeeded or not and the size of the result. If 78 // need to know if the command succeeded or not and the size of the result. If
79 // the command failed its result size will 0. 79 // the command failed its result size will 0.
80 template <typename T> 80 template <typename T>
81 struct SizedResult { 81 struct SizedResult {
82 typedef T Type; 82 typedef T Type;
83 83
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 // Copy the result. 116 // Copy the result.
117 void CopyResult(void* dst) const { 117 void CopyResult(void* dst) const {
118 memcpy(dst, &data, size); 118 memcpy(dst, &data, size);
119 } 119 }
120 120
121 uint32_t size; // in bytes. 121 uint32_t size; // in bytes.
122 int32_t data; // this is just here to get an offset. 122 int32_t data; // this is just here to get an offset.
123 }; 123 };
124 124
125 COMPILE_ASSERT(sizeof(SizedResult<int8_t>) == 8, SizedResult_size_not_8); 125 static_assert(sizeof(SizedResult<int8_t>) == 8,
126 COMPILE_ASSERT(offsetof(SizedResult<int8_t>, size) == 0, 126 "size of SizedResult<int8_t> should be 8");
127 OffsetOf_SizedResult_size_not_0); 127 static_assert(offsetof(SizedResult<int8_t>, size) == 0,
128 COMPILE_ASSERT(offsetof(SizedResult<int8_t>, data) == 4, 128 "offset of SizedResult<int8_t>.size should be 0");
129 OffsetOf_SizedResult_data_not_4); 129 static_assert(offsetof(SizedResult<int8_t>, data) == 4,
130 "offset of SizedResult<int8_t>.data should be 4");
130 131
131 // The data for one attrib or uniform from GetProgramInfoCHROMIUM. 132 // The data for one attrib or uniform from GetProgramInfoCHROMIUM.
132 struct ProgramInput { 133 struct ProgramInput {
133 uint32_t type; // The type (GL_VEC3, GL_MAT3, GL_SAMPLER_2D, etc. 134 uint32_t type; // The type (GL_VEC3, GL_MAT3, GL_SAMPLER_2D, etc.
134 int32_t size; // The size (how big the array is for uniforms) 135 int32_t size; // The size (how big the array is for uniforms)
135 uint32_t location_offset; // offset from ProgramInfoHeader to 'size' 136 uint32_t location_offset; // offset from ProgramInfoHeader to 'size'
136 // locations for uniforms, 1 for attribs. 137 // locations for uniforms, 1 for attribs.
137 uint32_t name_offset; // offset from ProgrmaInfoHeader to start of name. 138 uint32_t name_offset; // offset from ProgrmaInfoHeader to start of name.
138 uint32_t name_length; // length of the name. 139 uint32_t name_length; // length of the name.
139 }; 140 };
(...skipping 29 matching lines...) Expand all
169 170
170 bool HasAsyncUploadTokenPassed(uint32_t token) { 171 bool HasAsyncUploadTokenPassed(uint32_t token) {
171 DCHECK_NE(token, 0u); 172 DCHECK_NE(token, 0u);
172 uint32_t current_token = base::subtle::Acquire_Load(&async_upload_token); 173 uint32_t current_token = base::subtle::Acquire_Load(&async_upload_token);
173 return (current_token - token < 0x80000000); 174 return (current_token - token < 0x80000000);
174 } 175 }
175 176
176 base::subtle::Atomic32 async_upload_token; 177 base::subtle::Atomic32 async_upload_token;
177 }; 178 };
178 179
179 COMPILE_ASSERT(sizeof(ProgramInput) == 20, ProgramInput_size_not_20); 180 static_assert(sizeof(ProgramInput) == 20, "size of ProgramInput should be 20");
180 COMPILE_ASSERT(offsetof(ProgramInput, type) == 0, 181 static_assert(offsetof(ProgramInput, type) == 0,
181 OffsetOf_ProgramInput_type_not_0); 182 "offset of ProgramInput.type should be 0");
182 COMPILE_ASSERT(offsetof(ProgramInput, size) == 4, 183 static_assert(offsetof(ProgramInput, size) == 4,
183 OffsetOf_ProgramInput_size_not_4); 184 "offset of ProgramInput.size should be 4");
184 COMPILE_ASSERT(offsetof(ProgramInput, location_offset) == 8, 185 static_assert(offsetof(ProgramInput, location_offset) == 8,
185 OffsetOf_ProgramInput_location_offset_not_8); 186 "offset of ProgramInput.location_offset should be 8");
186 COMPILE_ASSERT(offsetof(ProgramInput, name_offset) == 12, 187 static_assert(offsetof(ProgramInput, name_offset) == 12,
187 OffsetOf_ProgramInput_name_offset_not_12); 188 "offset of ProgramInput.name_offset should be 12");
188 COMPILE_ASSERT(offsetof(ProgramInput, name_length) == 16, 189 static_assert(offsetof(ProgramInput, name_length) == 16,
189 OffsetOf_ProgramInput_name_length_not_16); 190 "offset of ProgramInput.name_length should be 16");
190 191
191 COMPILE_ASSERT(sizeof(ProgramInfoHeader) == 12, ProgramInfoHeader_size_not_12); 192 static_assert(sizeof(ProgramInfoHeader) == 12,
192 COMPILE_ASSERT(offsetof(ProgramInfoHeader, link_status) == 0, 193 "size of ProgramInfoHeader should be 12");
193 OffsetOf_ProgramInfoHeader_link_status_not_0); 194 static_assert(offsetof(ProgramInfoHeader, link_status) == 0,
194 COMPILE_ASSERT(offsetof(ProgramInfoHeader, num_attribs) == 4, 195 "offset of ProgramInfoHeader.link_status should be 0");
195 OffsetOf_ProgramInfoHeader_num_attribs_not_4); 196 static_assert(offsetof(ProgramInfoHeader, num_attribs) == 4,
196 COMPILE_ASSERT(offsetof(ProgramInfoHeader, num_uniforms) == 8, 197 "offset of ProgramInfoHeader.num_attribs should be 4");
197 OffsetOf_ProgramInfoHeader_num_uniforms_not_8); 198 static_assert(offsetof(ProgramInfoHeader, num_uniforms) == 8,
199 "offset of ProgramInfoHeader.num_uniforms should be 8");
198 200
199 namespace cmds { 201 namespace cmds {
200 202
201 #include "../common/gles2_cmd_format_autogen.h" 203 #include "../common/gles2_cmd_format_autogen.h"
202 204
203 // These are hand written commands. 205 // These are hand written commands.
204 // TODO(gman): Attempt to make these auto-generated. 206 // TODO(gman): Attempt to make these auto-generated.
205 207
206 struct GenMailboxCHROMIUM { 208 struct GenMailboxCHROMIUM {
207 typedef GenMailboxCHROMIUM ValueType; 209 typedef GenMailboxCHROMIUM ValueType;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 static_cast<ValueType*>(cmd)->Init(_target, _client_id, _mailbox); 254 static_cast<ValueType*>(cmd)->Init(_target, _client_id, _mailbox);
253 const uint32_t size = ComputeSize(); 255 const uint32_t size = ComputeSize();
254 return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size); 256 return NextImmediateCmdAddressTotalSize<ValueType>(cmd, size);
255 } 257 }
256 258
257 gpu::CommandHeader header; 259 gpu::CommandHeader header;
258 uint32_t target; 260 uint32_t target;
259 uint32_t client_id; 261 uint32_t client_id;
260 }; 262 };
261 263
262 COMPILE_ASSERT(sizeof(CreateAndConsumeTextureCHROMIUMImmediate) == 12, 264 static_assert(sizeof(CreateAndConsumeTextureCHROMIUMImmediate) == 12,
263 Sizeof_CreateAndConsumeTextureCHROMIUMImmediate_is_not_12); 265 "size of CreateAndConsumeTextureCHROMIUMImmediate should be 12");
264 COMPILE_ASSERT(offsetof(CreateAndConsumeTextureCHROMIUMImmediate, header) == 0, 266 static_assert(offsetof(CreateAndConsumeTextureCHROMIUMImmediate, header) == 0,
265 OffsetOf_CreateAndConsumeTextureCHROMIUMImmediate_header_not_0); 267 "offset of CreateAndConsumeTextureCHROMIUMImmediate.header "
266 COMPILE_ASSERT(offsetof(CreateAndConsumeTextureCHROMIUMImmediate, target) == 4, 268 "should be 0");
267 OffsetOf_CreateAndConsumeTextureCHROMIUMImmediate_target_not_4); 269 static_assert(offsetof(CreateAndConsumeTextureCHROMIUMImmediate, target) == 4,
268 COMPILE_ASSERT( 270 "offset of CreateAndConsumeTextureCHROMIUMImmediate.target "
271 "should be 4");
272 static_assert(
269 offsetof(CreateAndConsumeTextureCHROMIUMImmediate, client_id) == 8, 273 offsetof(CreateAndConsumeTextureCHROMIUMImmediate, client_id) == 8,
270 OffsetOf_CreateAndConsumeTextureCHROMIUMImmediate_client_id_not_8); 274 "offset of CreateAndConsumeTextureCHROMIUMImmediate.client_id should be 8");
271 275
272 276
273 #pragma pack(pop) 277 #pragma pack(pop)
274 278
275 } // namespace cmd 279 } // namespace cmd
276 } // namespace gles2 280 } // namespace gles2
277 } // namespace gpu 281 } // namespace gpu
278 282
279 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_ 283 #endif // GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_FORMAT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698