OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | |
6 | |
7 namespace gpu { | |
8 namespace gles2 { | |
9 | |
10 // Custom Handlers | |
11 error::Error GLES2DecoderPassthroughImpl::HandleBindAttribLocationBucket( | |
12 uint32_t immediate_data_size, | |
13 const void* cmd_data) { | |
14 const gles2::cmds::BindAttribLocationBucket& c = | |
15 *static_cast<const gles2::cmds::BindAttribLocationBucket*>(cmd_data); | |
16 GLuint program = static_cast<GLuint>(c.program); | |
17 GLuint index = static_cast<GLuint>(c.index); | |
18 Bucket* bucket = GetBucket(c.name_bucket_id); | |
19 if (!bucket || bucket->size() == 0) { | |
20 return error::kInvalidArguments; | |
21 } | |
22 std::string name_str; | |
23 if (!bucket->GetAsString(&name_str)) { | |
24 return error::kInvalidArguments; | |
25 } | |
26 error::Error error = DoBindAttribLocation(program, index, name_str.c_str()); | |
27 if (error != error::kNoError) { | |
28 return error; | |
29 } | |
30 return error::kNoError; | |
31 } | |
32 | |
33 error::Error GLES2DecoderPassthroughImpl::HandleBufferData( | |
34 uint32_t immediate_data_size, | |
35 const void* cmd_data) { | |
36 const gles2::cmds::BufferData& c = | |
37 *static_cast<const gles2::cmds::BufferData*>(cmd_data); | |
38 GLenum target = static_cast<GLenum>(c.target); | |
39 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | |
40 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); | |
41 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset); | |
42 GLenum usage = static_cast<GLenum>(c.usage); | |
43 const void* data = NULL; | |
44 if (data_shm_id != 0 || data_shm_offset != 0) { | |
45 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, size); | |
46 if (!data) { | |
47 return error::kOutOfBounds; | |
48 } | |
49 } | |
50 error::Error error = DoBufferData(target, size, data, usage); | |
51 if (error != error::kNoError) { | |
52 return error; | |
53 } | |
54 return error::kNoError; | |
55 } | |
56 | |
57 error::Error GLES2DecoderPassthroughImpl::HandleClientWaitSync( | |
58 uint32_t immediate_data_size, | |
59 const void* cmd_data) { | |
60 const gles2::cmds::ClientWaitSync& c = | |
61 *static_cast<const gles2::cmds::ClientWaitSync*>(cmd_data); | |
62 const GLuint sync = static_cast<GLuint>(c.sync); | |
63 const GLbitfield flags = static_cast<GLbitfield>(c.flags); | |
64 const GLuint64 timeout = c.timeout(); | |
65 typedef cmds::ClientWaitSync::Result Result; | |
66 Result* result_dst = GetSharedMemoryAs<Result*>( | |
67 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); | |
68 if (!result_dst) { | |
69 return error::kOutOfBounds; | |
70 } | |
71 error::Error error = DoClientWaitSync(sync, flags, timeout, result_dst); | |
72 if (error != error::kNoError) { | |
73 return error; | |
74 } | |
75 return error::kNoError; | |
76 } | |
77 | |
78 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage2DBucket( | |
79 uint32_t immediate_data_size, | |
80 const void* cmd_data) { | |
81 const gles2::cmds::CompressedTexImage2DBucket& c = | |
82 *static_cast<const gles2::cmds::CompressedTexImage2DBucket*>(cmd_data); | |
83 GLenum target = static_cast<GLenum>(c.target); | |
84 GLint level = static_cast<GLint>(c.level); | |
85 GLenum internalformat = static_cast<GLenum>(c.internalformat); | |
86 GLsizei width = static_cast<GLsizei>(c.width); | |
87 GLsizei height = static_cast<GLsizei>(c.height); | |
88 GLint border = static_cast<GLint>(c.border); | |
89 Bucket* bucket = GetBucket(c.bucket_id); | |
90 if (!bucket) { | |
91 return error::kInvalidArguments; | |
92 } | |
93 uint32_t data_size = bucket->size(); | |
94 GLsizei imageSize = data_size; | |
95 const void* data = bucket->GetData(0, data_size); | |
96 if (!data) { | |
97 return error::kInvalidArguments; | |
98 } | |
99 error::Error error = DoCompressedTexImage2D( | |
100 target, level, internalformat, width, height, border, imageSize, data); | |
101 if (error != error::kNoError) { | |
102 return error; | |
103 } | |
104 return error::kNoError; | |
105 } | |
106 | |
107 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage2D( | |
108 uint32_t immediate_data_size, | |
109 const void* cmd_data) { | |
110 const gles2::cmds::CompressedTexImage2D& c = | |
111 *static_cast<const gles2::cmds::CompressedTexImage2D*>(cmd_data); | |
112 GLenum target = static_cast<GLenum>(c.target); | |
113 GLint level = static_cast<GLint>(c.level); | |
114 GLenum internalformat = static_cast<GLenum>(c.internalformat); | |
115 GLsizei width = static_cast<GLsizei>(c.width); | |
116 GLsizei height = static_cast<GLsizei>(c.height); | |
117 GLint border = static_cast<GLint>(c.border); | |
118 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); | |
119 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); | |
120 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset); | |
121 const void* data = NULL; | |
122 if (data_shm_id != 0 || data_shm_offset != 0) { | |
123 data = | |
124 GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, imageSize); | |
125 if (!data) { | |
126 return error::kOutOfBounds; | |
127 } | |
128 } | |
129 error::Error error = DoCompressedTexImage2D( | |
130 target, level, internalformat, width, height, border, imageSize, data); | |
131 if (error != error::kNoError) { | |
132 return error; | |
133 } | |
134 return error::kNoError; | |
135 } | |
136 | |
137 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage2DBucket( | |
138 uint32_t immediate_data_size, | |
139 const void* cmd_data) { | |
140 const gles2::cmds::CompressedTexSubImage2DBucket& c = | |
141 *static_cast<const gles2::cmds::CompressedTexSubImage2DBucket*>(cmd_data); | |
142 GLenum target = static_cast<GLenum>(c.target); | |
143 GLint level = static_cast<GLint>(c.level); | |
144 GLint xoffset = static_cast<GLint>(c.xoffset); | |
145 GLint yoffset = static_cast<GLint>(c.yoffset); | |
146 GLsizei width = static_cast<GLsizei>(c.width); | |
147 GLsizei height = static_cast<GLsizei>(c.height); | |
148 GLenum format = static_cast<GLenum>(c.format); | |
149 Bucket* bucket = GetBucket(c.bucket_id); | |
150 if (!bucket) { | |
151 return error::kInvalidArguments; | |
152 } | |
153 uint32_t data_size = bucket->size(); | |
154 GLsizei imageSize = data_size; | |
155 const void* data = bucket->GetData(0, data_size); | |
156 if (!data) { | |
157 return error::kInvalidArguments; | |
158 } | |
159 error::Error error = DoCompressedTexSubImage2D( | |
160 target, level, xoffset, yoffset, width, height, format, imageSize, data); | |
161 if (error != error::kNoError) { | |
162 return error; | |
163 } | |
164 return error::kNoError; | |
165 } | |
166 | |
167 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage3DBucket( | |
168 uint32_t immediate_data_size, | |
169 const void* cmd_data) { | |
170 const gles2::cmds::CompressedTexImage3DBucket& c = | |
171 *static_cast<const gles2::cmds::CompressedTexImage3DBucket*>(cmd_data); | |
172 GLenum target = static_cast<GLenum>(c.target); | |
173 GLint level = static_cast<GLint>(c.level); | |
174 GLenum internal_format = static_cast<GLenum>(c.internalformat); | |
175 GLsizei width = static_cast<GLsizei>(c.width); | |
176 GLsizei height = static_cast<GLsizei>(c.height); | |
177 GLsizei depth = static_cast<GLsizei>(c.depth); | |
178 GLint border = static_cast<GLint>(c.border); | |
179 Bucket* bucket = GetBucket(c.bucket_id); | |
180 if (!bucket) { | |
181 return error::kInvalidArguments; | |
182 } | |
183 uint32_t data_size = bucket->size(); | |
184 GLsizei imageSize = data_size; | |
185 const void* data = bucket->GetData(0, data_size); | |
186 if (!data) { | |
187 return error::kInvalidArguments; | |
188 } | |
189 error::Error error = | |
190 DoCompressedTexImage3D(target, level, internal_format, width, height, | |
191 depth, border, imageSize, data); | |
192 if (error != error::kNoError) { | |
193 return error; | |
194 } | |
195 return error::kNoError; | |
196 } | |
197 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage3D( | |
198 uint32_t immediate_data_size, | |
199 const void* cmd_data) { | |
200 const gles2::cmds::CompressedTexImage3D& c = | |
201 *static_cast<const gles2::cmds::CompressedTexImage3D*>(cmd_data); | |
202 GLenum target = static_cast<GLenum>(c.target); | |
203 GLint level = static_cast<GLint>(c.level); | |
204 GLenum internal_format = static_cast<GLenum>(c.internalformat); | |
205 GLsizei width = static_cast<GLsizei>(c.width); | |
206 GLsizei height = static_cast<GLsizei>(c.height); | |
207 GLsizei depth = static_cast<GLsizei>(c.depth); | |
208 GLint border = static_cast<GLint>(c.border); | |
209 GLsizei image_size = static_cast<GLsizei>(c.imageSize); | |
210 uint32_t data_shm_id = static_cast<uint32_t>(c.data_shm_id); | |
211 uint32_t data_shm_offset = static_cast<uint32_t>(c.data_shm_offset); | |
212 const void* data = NULL; | |
213 if (data_shm_id != 0 || data_shm_offset != 0) { | |
214 data = GetSharedMemoryAs<const void*>(data_shm_id, data_shm_offset, | |
215 image_size); | |
216 if (!data) { | |
217 return error::kOutOfBounds; | |
218 } | |
219 } | |
220 error::Error error = | |
221 DoCompressedTexImage3D(target, level, internal_format, width, height, | |
222 depth, border, image_size, data); | |
223 if (error != error::kNoError) { | |
224 return error; | |
225 } | |
226 return error::kNoError; | |
227 } | |
228 | |
229 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage3DBucket( | |
230 uint32_t immediate_data_size, | |
231 const void* cmd_data) { | |
232 const gles2::cmds::CompressedTexSubImage3DBucket& c = | |
233 *static_cast<const gles2::cmds::CompressedTexSubImage3DBucket*>(cmd_data); | |
234 GLenum target = static_cast<GLenum>(c.target); | |
235 GLint level = static_cast<GLint>(c.level); | |
236 GLint xoffset = static_cast<GLint>(c.xoffset); | |
237 GLint yoffset = static_cast<GLint>(c.yoffset); | |
238 GLint zoffset = static_cast<GLint>(c.zoffset); | |
239 GLsizei width = static_cast<GLsizei>(c.width); | |
240 GLsizei height = static_cast<GLsizei>(c.height); | |
241 GLsizei depth = static_cast<GLsizei>(c.depth); | |
242 GLenum format = static_cast<GLenum>(c.format); | |
243 Bucket* bucket = GetBucket(c.bucket_id); | |
244 if (!bucket) { | |
245 return error::kInvalidArguments; | |
246 } | |
247 uint32_t data_size = bucket->size(); | |
248 GLsizei image_size = data_size; | |
249 const void* data = bucket->GetData(0, data_size); | |
250 if (!data) { | |
251 return error::kInvalidArguments; | |
252 } | |
253 error::Error error = | |
254 DoCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, | |
255 height, depth, format, image_size, data); | |
256 if (error != error::kNoError) { | |
257 return error; | |
258 } | |
259 return error::kNoError; | |
260 } | |
261 | |
262 error::Error GLES2DecoderPassthroughImpl::HandleCreateProgram( | |
263 uint32_t immediate_data_size, | |
264 const void* cmd_data) { | |
265 const gles2::cmds::CreateProgram& c = | |
266 *static_cast<const gles2::cmds::CreateProgram*>(cmd_data); | |
267 GLuint client_id = static_cast<GLuint>(c.client_id); | |
268 error::Error error = DoCreateProgram(client_id); | |
269 if (error != error::kNoError) { | |
270 return error; | |
271 } | |
272 return error::kNoError; | |
273 } | |
274 | |
275 error::Error GLES2DecoderPassthroughImpl::HandleCreateShader( | |
276 uint32_t immediate_data_size, | |
277 const void* cmd_data) { | |
278 const gles2::cmds::CreateShader& c = | |
279 *static_cast<const gles2::cmds::CreateShader*>(cmd_data); | |
280 GLenum type = static_cast<GLenum>(c.type); | |
281 GLuint client_id = static_cast<GLuint>(c.client_id); | |
282 error::Error error = DoCreateShader(type, client_id); | |
283 if (error != error::kNoError) { | |
284 return error; | |
285 } | |
286 return error::kNoError; | |
287 } | |
288 | |
289 error::Error GLES2DecoderPassthroughImpl::HandleFenceSync( | |
290 uint32_t immediate_data_size, | |
291 const void* cmd_data) { | |
292 const gles2::cmds::FenceSync& c = | |
293 *static_cast<const gles2::cmds::FenceSync*>(cmd_data); | |
294 GLenum condition = static_cast<GLenum>(c.condition); | |
295 GLbitfield flags = static_cast<GLbitfield>(c.flags); | |
296 GLuint client_id = static_cast<GLuint>(c.client_id); | |
297 error::Error error = DoFenceSync(condition, flags, client_id); | |
298 if (error != error::kNoError) { | |
299 return error; | |
300 } | |
301 return error::kNoError; | |
302 } | |
303 | |
304 error::Error GLES2DecoderPassthroughImpl::HandleDrawArrays( | |
305 uint32_t immediate_data_size, | |
306 const void* cmd_data) { | |
307 const gles2::cmds::DrawArrays& c = | |
308 *static_cast<const gles2::cmds::DrawArrays*>(cmd_data); | |
309 GLenum mode = static_cast<GLenum>(c.mode); | |
310 GLint first = static_cast<GLint>(c.first); | |
311 GLsizei count = static_cast<GLsizei>(c.count); | |
312 error::Error error = DoDrawArrays(mode, first, count); | |
313 if (error != error::kNoError) { | |
314 return error; | |
315 } | |
316 return error::kNoError; | |
317 } | |
318 | |
319 error::Error GLES2DecoderPassthroughImpl::HandleDrawElements( | |
320 uint32_t immediate_data_size, | |
321 const void* cmd_data) { | |
322 const gles2::cmds::DrawElements& c = | |
323 *static_cast<const gles2::cmds::DrawElements*>(cmd_data); | |
324 GLenum mode = static_cast<GLenum>(c.mode); | |
325 GLsizei count = static_cast<GLsizei>(c.count); | |
326 GLenum type = static_cast<GLenum>(c.type); | |
327 const GLvoid* indices = | |
328 reinterpret_cast<const GLvoid*>(static_cast<uintptr_t>(c.index_offset)); | |
329 error::Error error = DoDrawElements(mode, count, type, indices); | |
330 if (error != error::kNoError) { | |
331 return error; | |
332 } | |
333 return error::kNoError; | |
334 } | |
335 | |
336 error::Error GLES2DecoderPassthroughImpl::HandleGetActiveAttrib( | |
337 uint32_t immediate_data_size, | |
338 const void* cmd_data) { | |
339 const gles2::cmds::GetActiveAttrib& c = | |
340 *static_cast<const gles2::cmds::GetActiveAttrib*>(cmd_data); | |
341 GLuint program = static_cast<GLuint>(c.program); | |
342 GLuint index = static_cast<GLuint>(c.index); | |
343 uint32_t name_bucket_id = c.name_bucket_id; | |
344 typedef cmds::GetActiveAttrib::Result Result; | |
345 Result* result = GetSharedMemoryAs<Result*>( | |
346 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | |
347 if (!result) { | |
348 return error::kOutOfBounds; | |
349 } | |
350 // Check that the client initialized the result. | |
351 if (result->success != 0) { | |
352 return error::kInvalidArguments; | |
353 } | |
354 | |
355 std::string name; | |
356 error::Error error = | |
357 DoGetActiveAttrib(program, index, &result->size, &result->type, &name); | |
358 if (error != error::kNoError) { | |
359 return error; | |
360 } | |
361 | |
362 result->success = 1; // true. | |
363 Bucket* bucket = CreateBucket(name_bucket_id); | |
364 bucket->SetFromString(name.c_str()); | |
365 return error::kNoError; | |
366 } | |
367 | |
368 error::Error GLES2DecoderPassthroughImpl::HandleGetActiveUniform( | |
369 uint32_t immediate_data_size, | |
370 const void* cmd_data) { | |
371 const gles2::cmds::GetActiveUniform& c = | |
372 *static_cast<const gles2::cmds::GetActiveUniform*>(cmd_data); | |
373 GLuint program = static_cast<GLuint>(c.program); | |
374 GLuint index = static_cast<GLuint>(c.index); | |
375 uint32_t name_bucket_id = c.name_bucket_id; | |
376 typedef cmds::GetActiveUniform::Result Result; | |
377 Result* result = GetSharedMemoryAs<Result*>( | |
378 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | |
379 if (!result) { | |
380 return error::kOutOfBounds; | |
381 } | |
382 // Check that the client initialized the result. | |
383 if (result->success != 0) { | |
384 return error::kInvalidArguments; | |
385 } | |
386 | |
387 std::string name; | |
388 error::Error error = | |
389 DoGetActiveUniform(program, index, &result->size, &result->type, &name); | |
390 if (error != error::kNoError) { | |
391 return error; | |
392 } | |
393 | |
394 result->success = 1; // true. | |
395 Bucket* bucket = CreateBucket(name_bucket_id); | |
396 bucket->SetFromString(name.c_str()); | |
397 return error::kNoError; | |
398 } | |
399 | |
400 error::Error GLES2DecoderPassthroughImpl::HandleGetActiveUniformBlockiv( | |
401 uint32_t immediate_data_size, | |
402 const void* cmd_data) { | |
403 const gles2::cmds::GetActiveUniformBlockiv& c = | |
404 *static_cast<const gles2::cmds::GetActiveUniformBlockiv*>(cmd_data); | |
405 GLuint program = static_cast<GLuint>(c.program); | |
406 GLuint uniformBlockIndex = static_cast<GLuint>(c.index); | |
407 GLenum pname = static_cast<GLenum>(c.pname); | |
408 unsigned int buffer_size = 0; | |
409 typedef cmds::GetActiveUniformBlockiv::Result Result; | |
410 Result* result = GetSharedMemoryAndSizeAs<Result*>( | |
411 c.params_shm_id, c.params_shm_offset, &buffer_size); | |
412 GLint* params = result ? result->GetData() : NULL; | |
413 GLsizei bufsize = Result::ComputeMaxResults(buffer_size); | |
414 GLsizei length = 0; | |
415 error::Error error = DoGetActiveUniformBlockiv( | |
416 program, uniformBlockIndex, pname, bufsize, &length, params); | |
417 if (error != error::kNoError) { | |
418 return error; | |
419 } | |
420 if (length > bufsize) { | |
421 return error::kOutOfBounds; | |
422 } | |
423 result->SetNumResults(length); | |
424 return error::kNoError; | |
425 } | |
426 | |
427 error::Error GLES2DecoderPassthroughImpl::HandleGetActiveUniformBlockName( | |
428 uint32_t immediate_data_size, | |
429 const void* cmd_data) { | |
430 const gles2::cmds::GetActiveUniformBlockName& c = | |
431 *static_cast<const gles2::cmds::GetActiveUniformBlockName*>(cmd_data); | |
432 GLuint program = static_cast<GLuint>(c.program); | |
433 GLuint uniformBlockIndex = static_cast<GLuint>(c.index); | |
434 uint32_t name_bucket_id = c.name_bucket_id; | |
435 typedef cmds::GetActiveUniformBlockName::Result Result; | |
436 Result* result = GetSharedMemoryAs<Result*>( | |
437 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | |
438 if (!result) { | |
439 return error::kOutOfBounds; | |
440 } | |
441 // Check that the client initialized the result. | |
442 if (*result != 0) { | |
443 return error::kInvalidArguments; | |
444 } | |
445 | |
446 std::string name; | |
447 error::Error error = | |
448 DoGetActiveUniformBlockName(program, uniformBlockIndex, &name); | |
449 if (error != error::kNoError) { | |
450 return error; | |
451 } | |
452 | |
453 *result = 1; | |
454 Bucket* bucket = CreateBucket(name_bucket_id); | |
455 bucket->SetFromString(name.c_str()); | |
456 return error::kNoError; | |
457 } | |
458 | |
459 error::Error GLES2DecoderPassthroughImpl::HandleGetActiveUniformsiv( | |
460 uint32_t immediate_data_size, | |
461 const void* cmd_data) { | |
462 const gles2::cmds::GetActiveUniformsiv& c = | |
463 *static_cast<const gles2::cmds::GetActiveUniformsiv*>(cmd_data); | |
464 GLuint program = static_cast<GLuint>(c.program); | |
465 GLenum pname = static_cast<GLenum>(c.pname); | |
466 Bucket* bucket = GetBucket(c.indices_bucket_id); | |
467 if (!bucket) { | |
468 return error::kInvalidArguments; | |
469 } | |
470 GLsizei uniformCount = static_cast<GLsizei>(bucket->size() / sizeof(GLuint)); | |
471 const GLuint* indices = bucket->GetDataAs<const GLuint*>(0, bucket->size()); | |
472 typedef cmds::GetActiveUniformsiv::Result Result; | |
473 Result* result = GetSharedMemoryAs<Result*>( | |
474 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(uniformCount)); | |
475 GLint* params = result ? result->GetData() : NULL; | |
476 if (params == NULL) { | |
477 return error::kOutOfBounds; | |
478 } | |
479 // Check that the client initialized the result. | |
480 if (result->size != 0) { | |
481 return error::kInvalidArguments; | |
482 } | |
483 | |
484 GLsizei bufsize = uniformCount; | |
485 GLsizei length = 0; | |
486 error::Error error = DoGetActiveUniformsiv(program, uniformCount, indices, | |
487 pname, bufsize, &length, params); | |
488 if (error != error::kNoError) { | |
489 return error; | |
490 } | |
491 | |
492 result->SetNumResults(length); | |
493 return error::kNoError; | |
494 } | |
495 | |
496 error::Error GLES2DecoderPassthroughImpl::HandleGetAttachedShaders( | |
497 uint32_t immediate_data_size, | |
498 const void* cmd_data) { | |
499 const gles2::cmds::GetAttachedShaders& c = | |
500 *static_cast<const gles2::cmds::GetAttachedShaders*>(cmd_data); | |
501 GLuint program = static_cast<GLuint>(c.program); | |
502 typedef cmds::GetAttachedShaders::Result Result; | |
503 uint32_t maxCount = Result::ComputeMaxResults(c.result_size); | |
504 Result* result = GetSharedMemoryAs<Result*>( | |
505 c.result_shm_id, c.result_shm_offset, Result::ComputeSize(maxCount)); | |
506 if (!result) { | |
507 return error::kOutOfBounds; | |
508 } | |
509 // Check that the client initialized the result. | |
510 if (result->size != 0) { | |
511 return error::kInvalidArguments; | |
512 } | |
513 GLsizei count = 0; | |
514 error::Error error = | |
515 DoGetAttachedShaders(program, maxCount, &count, result->GetData()); | |
516 if (error != error::kNoError) { | |
517 return error; | |
518 } | |
519 | |
520 result->SetNumResults(count); | |
521 return error::kNoError; | |
522 } | |
523 | |
524 error::Error GLES2DecoderPassthroughImpl::HandleGetAttribLocation( | |
525 uint32_t immediate_data_size, | |
526 const void* cmd_data) { | |
527 const gles2::cmds::GetAttribLocation& c = | |
528 *static_cast<const gles2::cmds::GetAttribLocation*>(cmd_data); | |
529 GLuint program = static_cast<GLuint>(c.program); | |
530 Bucket* bucket = GetBucket(c.name_bucket_id); | |
531 if (!bucket) { | |
532 return error::kInvalidArguments; | |
533 } | |
534 std::string name_str; | |
535 if (!bucket->GetAsString(&name_str)) { | |
536 return error::kInvalidArguments; | |
537 } | |
538 GLint* location = GetSharedMemoryAs<GLint*>( | |
539 c.location_shm_id, c.location_shm_offset, sizeof(GLint)); | |
540 if (!location) { | |
541 return error::kOutOfBounds; | |
542 } | |
543 if (*location != -1) { | |
544 return error::kInvalidArguments; | |
545 } | |
546 error::Error error = DoGetAttribLocation(program, name_str.c_str(), location); | |
547 if (error != error::kNoError) { | |
548 return error; | |
549 } | |
550 return error::kNoError; | |
551 } | |
552 | |
553 error::Error GLES2DecoderPassthroughImpl::HandleGetFragDataLocation( | |
554 uint32_t immediate_data_size, | |
555 const void* cmd_data) { | |
556 const gles2::cmds::GetFragDataLocation& c = | |
557 *static_cast<const gles2::cmds::GetFragDataLocation*>(cmd_data); | |
558 GLuint program = static_cast<GLuint>(c.program); | |
559 Bucket* bucket = GetBucket(c.name_bucket_id); | |
560 if (!bucket) { | |
561 return error::kInvalidArguments; | |
562 } | |
563 std::string name_str; | |
564 if (!bucket->GetAsString(&name_str)) { | |
565 return error::kInvalidArguments; | |
566 } | |
567 GLint* location = GetSharedMemoryAs<GLint*>( | |
568 c.location_shm_id, c.location_shm_offset, sizeof(GLint)); | |
569 if (!location) { | |
570 return error::kOutOfBounds; | |
571 } | |
572 if (*location != -1) { | |
573 return error::kInvalidArguments; | |
574 } | |
575 error::Error error = | |
576 DoGetFragDataLocation(program, name_str.c_str(), location); | |
577 if (error != error::kNoError) { | |
578 return error; | |
579 } | |
580 return error::kNoError; | |
581 } | |
582 | |
583 error::Error GLES2DecoderPassthroughImpl::HandleGetInternalformativ( | |
584 uint32_t immediate_data_size, | |
585 const void* cmd_data) { | |
586 const gles2::cmds::GetInternalformativ& c = | |
587 *static_cast<const gles2::cmds::GetInternalformativ*>(cmd_data); | |
588 GLenum target = static_cast<GLenum>(c.target); | |
589 GLenum internalformat = static_cast<GLenum>(c.format); | |
590 GLenum pname = static_cast<GLenum>(c.pname); | |
591 unsigned int buffer_size = 0; | |
592 typedef cmds::GetInternalformativ::Result Result; | |
593 Result* result = GetSharedMemoryAndSizeAs<Result*>( | |
594 c.params_shm_id, c.params_shm_offset, &buffer_size); | |
595 GLint* params = result ? result->GetData() : NULL; | |
596 GLsizei bufsize = Result::ComputeMaxResults(buffer_size); | |
597 GLsizei length = 0; | |
598 error::Error error = DoGetInternalformativ(target, internalformat, pname, | |
599 bufsize, &length, params); | |
600 if (error != error::kNoError) { | |
601 return error; | |
602 } | |
603 if (length > bufsize) { | |
604 return error::kOutOfBounds; | |
605 } | |
606 result->SetNumResults(length); | |
607 return error::kNoError; | |
608 } | |
609 | |
610 error::Error GLES2DecoderPassthroughImpl::HandleGetProgramInfoLog( | |
611 uint32_t immediate_data_size, | |
612 const void* cmd_data) { | |
613 const gles2::cmds::GetProgramInfoLog& c = | |
614 *static_cast<const gles2::cmds::GetProgramInfoLog*>(cmd_data); | |
615 GLuint program = static_cast<GLuint>(c.program); | |
616 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); | |
617 | |
618 std::string infolog; | |
619 error::Error error = DoGetProgramInfoLog(program, &infolog); | |
620 if (error != error::kNoError) { | |
621 return error; | |
622 } | |
623 | |
624 Bucket* bucket = CreateBucket(bucket_id); | |
625 bucket->SetFromString(infolog.c_str()); | |
626 return error::kNoError; | |
627 } | |
628 | |
629 error::Error GLES2DecoderPassthroughImpl::HandleGetShaderInfoLog( | |
630 uint32_t immediate_data_size, | |
631 const void* cmd_data) { | |
632 const gles2::cmds::GetShaderInfoLog& c = | |
633 *static_cast<const gles2::cmds::GetShaderInfoLog*>(cmd_data); | |
634 GLuint shader = static_cast<GLuint>(c.shader); | |
635 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); | |
636 | |
637 std::string infolog; | |
638 error::Error error = DoGetShaderInfoLog(shader, &infolog); | |
639 if (error != error::kNoError) { | |
640 return error; | |
641 } | |
642 | |
643 Bucket* bucket = CreateBucket(bucket_id); | |
644 bucket->SetFromString(infolog.c_str()); | |
645 return error::kNoError; | |
646 } | |
647 | |
648 error::Error GLES2DecoderPassthroughImpl::HandleGetShaderPrecisionFormat( | |
649 uint32_t immediate_data_size, | |
650 const void* cmd_data) { | |
651 const gles2::cmds::GetShaderPrecisionFormat& c = | |
652 *static_cast<const gles2::cmds::GetShaderPrecisionFormat*>(cmd_data); | |
653 GLenum shader_type = static_cast<GLenum>(c.shadertype); | |
654 GLenum precision_type = static_cast<GLenum>(c.precisiontype); | |
655 typedef cmds::GetShaderPrecisionFormat::Result Result; | |
656 Result* result = GetSharedMemoryAs<Result*>( | |
657 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | |
658 if (!result) { | |
659 return error::kOutOfBounds; | |
660 } | |
661 // Check that the client initialized the result. | |
662 if (result->success != 0) { | |
663 return error::kInvalidArguments; | |
664 } | |
665 | |
666 GLint range[2] = {0, 0}; | |
667 GLint precision = 0; | |
668 error::Error error = DoGetShaderPrecisionFormat(shader_type, precision_type, | |
669 range, &precision); | |
670 if (error != error::kNoError) { | |
671 return error; | |
672 } | |
673 | |
674 result->success = 1; // true | |
675 result->min_range = range[0]; | |
676 result->max_range = range[1]; | |
677 result->precision = precision; | |
678 | |
679 return error::kNoError; | |
680 } | |
681 | |
682 error::Error GLES2DecoderPassthroughImpl::HandleGetShaderSource( | |
683 uint32_t immediate_data_size, | |
684 const void* cmd_data) { | |
685 const gles2::cmds::GetShaderSource& c = | |
686 *static_cast<const gles2::cmds::GetShaderSource*>(cmd_data); | |
687 GLuint shader = static_cast<GLuint>(c.shader); | |
688 uint32_t bucket_id = static_cast<uint32_t>(c.bucket_id); | |
689 | |
690 std::string source; | |
691 error::Error error = DoGetShaderSource(shader, &source); | |
692 if (error != error::kNoError) { | |
693 return error; | |
694 } | |
695 | |
696 Bucket* bucket = CreateBucket(bucket_id); | |
697 bucket->SetFromString(source.c_str()); | |
698 | |
699 return error::kNoError; | |
700 } | |
701 error::Error GLES2DecoderPassthroughImpl::HandleGetString( | |
702 uint32_t immediate_data_size, | |
703 const void* cmd_data) { | |
704 const gles2::cmds::GetString& c = | |
705 *static_cast<const gles2::cmds::GetString*>(cmd_data); | |
706 GLenum name = static_cast<GLenum>(c.name); | |
707 | |
708 const char* str = nullptr; | |
709 error::Error error = DoGetString(name, &str); | |
710 if (error != error::kNoError) { | |
711 return error; | |
712 } | |
713 if (!str) { | |
714 return error::kOutOfBounds; | |
715 } | |
716 Bucket* bucket = CreateBucket(c.bucket_id); | |
717 bucket->SetFromString(str); | |
718 | |
719 return error::kNoError; | |
720 } | |
721 error::Error GLES2DecoderPassthroughImpl::HandleGetTransformFeedbackVarying( | |
722 uint32_t immediate_data_size, | |
723 const void* cmd_data) { | |
724 const gles2::cmds::GetTransformFeedbackVarying& c = | |
725 *static_cast<const gles2::cmds::GetTransformFeedbackVarying*>(cmd_data); | |
726 GLuint program = static_cast<GLuint>(c.program); | |
727 GLuint index = static_cast<GLuint>(c.index); | |
728 uint32_t name_bucket_id = c.name_bucket_id; | |
729 typedef cmds::GetTransformFeedbackVarying::Result Result; | |
730 Result* result = GetSharedMemoryAs<Result*>( | |
731 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | |
732 if (!result) { | |
733 return error::kOutOfBounds; | |
734 } | |
735 // Check that the client initialized the result. | |
736 if (result->success != 0) { | |
737 return error::kInvalidArguments; | |
738 } | |
739 | |
740 GLsizei size = 0; | |
741 GLenum type = 0; | |
742 std::string name; | |
743 error::Error error = | |
744 DoGetTransformFeedbackVarying(program, index, &size, &type, &name); | |
745 if (error != error::kNoError) { | |
746 return error; | |
747 } | |
748 | |
749 result->success = 1; // true. | |
750 result->size = static_cast<int32_t>(size); | |
751 result->type = static_cast<uint32_t>(type); | |
752 Bucket* bucket = CreateBucket(name_bucket_id); | |
753 bucket->SetFromString(name.c_str()); | |
754 return error::kNoError; | |
755 } | |
756 | |
757 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformBlockIndex( | |
758 uint32_t immediate_data_size, | |
759 const void* cmd_data) { | |
760 const gles2::cmds::GetUniformBlockIndex& c = | |
761 *static_cast<const gles2::cmds::GetUniformBlockIndex*>(cmd_data); | |
762 GLuint program = static_cast<GLuint>(c.program); | |
763 Bucket* bucket = GetBucket(c.name_bucket_id); | |
764 if (!bucket) { | |
765 return error::kInvalidArguments; | |
766 } | |
767 std::string name_str; | |
768 if (!bucket->GetAsString(&name_str)) { | |
769 return error::kInvalidArguments; | |
770 } | |
771 GLint* index = GetSharedMemoryAs<GLint*>(c.index_shm_id, c.index_shm_offset, | |
772 sizeof(GLint)); | |
773 if (!index) { | |
774 return error::kOutOfBounds; | |
775 } | |
776 if (*index != -1) { | |
777 return error::kInvalidArguments; | |
778 } | |
779 error::Error error = DoGetUniformBlockIndex(program, name_str.c_str(), index); | |
780 if (error != error::kNoError) { | |
781 return error; | |
782 } | |
783 return error::kNoError; | |
784 } | |
785 | |
786 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformfv( | |
787 uint32_t immediate_data_size, | |
788 const void* cmd_data) { | |
789 const gles2::cmds::GetUniformfv& c = | |
790 *static_cast<const gles2::cmds::GetUniformfv*>(cmd_data); | |
791 GLuint program = static_cast<GLuint>(c.program); | |
792 GLint location = static_cast<GLint>(c.location); | |
793 unsigned int buffer_size = 0; | |
794 typedef cmds::GetUniformfv::Result Result; | |
795 Result* result = GetSharedMemoryAndSizeAs<Result*>( | |
796 c.params_shm_id, c.params_shm_offset, &buffer_size); | |
797 GLfloat* params = result ? result->GetData() : NULL; | |
798 GLsizei bufsize = Result::ComputeMaxResults(buffer_size); | |
799 GLsizei length = 0; | |
800 error::Error error = | |
801 DoGetUniformfv(program, location, bufsize, &length, params); | |
802 if (error != error::kNoError) { | |
803 return error; | |
804 } | |
805 if (length > bufsize) { | |
806 return error::kOutOfBounds; | |
807 } | |
808 result->SetNumResults(length); | |
809 return error::kNoError; | |
810 } | |
811 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformiv( | |
812 uint32_t immediate_data_size, | |
813 const void* cmd_data) { | |
814 const gles2::cmds::GetUniformiv& c = | |
815 *static_cast<const gles2::cmds::GetUniformiv*>(cmd_data); | |
816 GLuint program = static_cast<GLuint>(c.program); | |
817 GLint location = static_cast<GLint>(c.location); | |
818 unsigned int buffer_size = 0; | |
819 typedef cmds::GetUniformiv::Result Result; | |
820 Result* result = GetSharedMemoryAndSizeAs<Result*>( | |
821 c.params_shm_id, c.params_shm_offset, &buffer_size); | |
822 GLint* params = result ? result->GetData() : NULL; | |
823 GLsizei bufsize = Result::ComputeMaxResults(buffer_size); | |
824 GLsizei length = 0; | |
825 error::Error error = | |
826 DoGetUniformiv(program, location, bufsize, &length, params); | |
827 if (error != error::kNoError) { | |
828 return error; | |
829 } | |
830 if (length > bufsize) { | |
831 return error::kOutOfBounds; | |
832 } | |
833 result->SetNumResults(length); | |
834 return error::kNoError; | |
835 } | |
836 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformuiv( | |
837 uint32_t immediate_data_size, | |
838 const void* cmd_data) { | |
839 const gles2::cmds::GetUniformuiv& c = | |
840 *static_cast<const gles2::cmds::GetUniformuiv*>(cmd_data); | |
841 GLuint program = static_cast<GLuint>(c.program); | |
842 GLint location = static_cast<GLint>(c.location); | |
843 unsigned int buffer_size = 0; | |
844 typedef cmds::GetUniformuiv::Result Result; | |
845 Result* result = GetSharedMemoryAndSizeAs<Result*>( | |
846 c.params_shm_id, c.params_shm_offset, &buffer_size); | |
847 GLuint* params = result ? result->GetData() : NULL; | |
848 GLsizei bufsize = Result::ComputeMaxResults(buffer_size); | |
849 GLsizei length = 0; | |
850 error::Error error = | |
851 DoGetUniformuiv(program, location, bufsize, &length, params); | |
852 if (error != error::kNoError) { | |
853 return error; | |
854 } | |
855 if (length > bufsize) { | |
856 return error::kOutOfBounds; | |
857 } | |
858 result->SetNumResults(length); | |
859 return error::kNoError; | |
860 } | |
861 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformIndices( | |
862 uint32_t immediate_data_size, | |
863 const void* cmd_data) { | |
864 const gles2::cmds::GetUniformIndices& c = | |
865 *static_cast<const gles2::cmds::GetUniformIndices*>(cmd_data); | |
866 GLuint program = static_cast<GLuint>(c.program); | |
867 Bucket* bucket = GetBucket(c.names_bucket_id); | |
868 if (!bucket) { | |
869 return error::kInvalidArguments; | |
870 } | |
871 GLsizei count = 0; | |
872 std::vector<char*> names; | |
873 std::vector<GLint> len; | |
874 if (!bucket->GetAsStrings(&count, &names, &len) || count <= 0) { | |
875 return error::kInvalidArguments; | |
876 } | |
877 typedef cmds::GetUniformIndices::Result Result; | |
878 Result* result = GetSharedMemoryAs<Result*>( | |
879 c.indices_shm_id, c.indices_shm_offset, | |
880 Result::ComputeSize(static_cast<size_t>(count))); | |
881 GLuint* indices = result ? result->GetData() : NULL; | |
882 if (indices == NULL) { | |
883 return error::kOutOfBounds; | |
884 } | |
885 // Check that the client initialized the result. | |
886 if (result->size != 0) { | |
887 return error::kInvalidArguments; | |
888 } | |
889 GLsizei length = 0; | |
890 error::Error error = | |
891 DoGetUniformIndices(program, count, &names[0], count, &length, indices); | |
892 if (error != error::kNoError) { | |
893 return error; | |
894 } | |
895 if (length != count) { | |
896 return error::kOutOfBounds; | |
897 } | |
898 result->SetNumResults(length); | |
899 return error::kNoError; | |
900 } | |
901 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformLocation( | |
902 uint32_t immediate_data_size, | |
903 const void* cmd_data) { | |
904 const gles2::cmds::GetUniformLocation& c = | |
905 *static_cast<const gles2::cmds::GetUniformLocation*>(cmd_data); | |
906 GLuint program = static_cast<GLuint>(c.program); | |
907 Bucket* bucket = GetBucket(c.name_bucket_id); | |
908 if (!bucket) { | |
909 return error::kInvalidArguments; | |
910 } | |
911 std::string name_str; | |
912 if (!bucket->GetAsString(&name_str)) { | |
913 return error::kInvalidArguments; | |
914 } | |
915 GLint* location = GetSharedMemoryAs<GLint*>( | |
916 c.location_shm_id, c.location_shm_offset, sizeof(GLint)); | |
917 if (!location) { | |
918 return error::kOutOfBounds; | |
919 } | |
920 if (*location != -1) { | |
921 return error::kInvalidArguments; | |
922 } | |
923 error::Error error = | |
924 DoGetUniformLocation(program, name_str.c_str(), location); | |
925 if (error != error::kNoError) { | |
926 return error; | |
927 } | |
928 return error::kNoError; | |
929 } | |
930 error::Error GLES2DecoderPassthroughImpl::HandleGetVertexAttribPointerv( | |
931 uint32_t immediate_data_size, | |
932 const void* cmd_data) { | |
933 const gles2::cmds::GetVertexAttribPointerv& c = | |
934 *static_cast<const gles2::cmds::GetVertexAttribPointerv*>(cmd_data); | |
935 GLuint index = static_cast<GLuint>(c.index); | |
936 GLenum pname = static_cast<GLenum>(c.pname); | |
937 unsigned int buffer_size = 0; | |
938 typedef cmds::GetVertexAttribPointerv::Result Result; | |
939 Result* result = GetSharedMemoryAndSizeAs<Result*>( | |
940 c.pointer_shm_id, c.pointer_shm_offset, &buffer_size); | |
941 GLuint* params = result ? result->GetData() : NULL; | |
942 GLsizei bufsize = Result::ComputeMaxResults(buffer_size); | |
943 GLsizei length = 0; | |
944 error::Error error = | |
945 DoGetVertexAttribPointerv(index, pname, bufsize, &length, params); | |
946 if (error != error::kNoError) { | |
947 return error; | |
948 } | |
949 if (length > bufsize) { | |
950 return error::kOutOfBounds; | |
951 } | |
952 result->SetNumResults(length); | |
953 return error::kNoError; | |
954 } | |
955 error::Error GLES2DecoderPassthroughImpl::HandlePixelStorei( | |
956 uint32_t immediate_data_size, | |
957 const void* cmd_data) { | |
958 const gles2::cmds::PixelStorei& c = | |
959 *static_cast<const gles2::cmds::PixelStorei*>(cmd_data); | |
960 GLenum pname = static_cast<GLuint>(c.pname); | |
961 GLint param = static_cast<GLint>(c.param); | |
962 error::Error error = DoPixelStorei(pname, param); | |
963 if (error != error::kNoError) { | |
964 return error; | |
965 } | |
966 return error::kNoError; | |
967 } | |
968 error::Error GLES2DecoderPassthroughImpl::HandleReadPixels( | |
969 uint32_t immediate_data_size, | |
970 const void* cmd_data) { | |
971 const gles2::cmds::ReadPixels& c = | |
972 *static_cast<const gles2::cmds::ReadPixels*>(cmd_data); | |
973 GLint x = static_cast<GLint>(c.x); | |
974 GLint y = static_cast<GLint>(c.y); | |
975 GLsizei width = static_cast<GLsizei>(c.width); | |
976 GLsizei height = static_cast<GLsizei>(c.height); | |
977 GLenum format = static_cast<GLenum>(c.format); | |
978 GLenum type = static_cast<GLenum>(c.type); | |
979 | |
980 uint8_t* pixels = nullptr; | |
981 unsigned int buffer_size = 0; | |
982 if (c.pixels_shm_id != 0) { | |
983 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | |
984 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); | |
985 if (!pixels) { | |
986 return error::kOutOfBounds; | |
987 } | |
988 } | |
989 | |
990 GLsizei bufsize = buffer_size; | |
991 GLsizei length = 0; | |
992 error::Error error = | |
993 DoReadPixels(x, y, width, height, format, type, bufsize, &length, pixels); | |
994 if (error != error::kNoError) { | |
995 return error; | |
996 } | |
997 if (length > bufsize) { | |
998 return error::kOutOfBounds; | |
999 } | |
1000 | |
1001 typedef cmds::ReadPixels::Result Result; | |
1002 Result* result = nullptr; | |
1003 if (c.result_shm_id != 0) { | |
1004 result = GetSharedMemoryAs<Result*>(c.result_shm_id, c.result_shm_offset, | |
1005 sizeof(*result)); | |
1006 if (!result) { | |
1007 return error::kOutOfBounds; | |
1008 } | |
1009 if (result->success != 0) { | |
1010 return error::kInvalidArguments; | |
1011 } | |
1012 } | |
1013 | |
1014 if (result) { | |
1015 result->success = 1; | |
1016 result->row_length = static_cast<uint32_t>(width); | |
1017 result->num_rows = static_cast<uint32_t>(height); | |
1018 } | |
1019 | |
1020 return error::kNoError; | |
1021 } | |
1022 error::Error GLES2DecoderPassthroughImpl::HandleShaderBinary( | |
1023 uint32_t immediate_data_size, | |
1024 const void* cmd_data) { | |
1025 const gles2::cmds::ShaderBinary& c = | |
1026 *static_cast<const gles2::cmds::ShaderBinary*>(cmd_data); | |
1027 GLsizei n = static_cast<GLsizei>(c.n); | |
1028 GLsizei length = static_cast<GLsizei>(c.length); | |
1029 uint32_t data_size; | |
1030 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | |
1031 return error::kOutOfBounds; | |
1032 } | |
1033 const GLuint* shaders = GetSharedMemoryAs<const GLuint*>( | |
1034 c.shaders_shm_id, c.shaders_shm_offset, data_size); | |
1035 GLenum binaryformat = static_cast<GLenum>(c.binaryformat); | |
1036 const void* binary = GetSharedMemoryAs<const void*>( | |
1037 c.binary_shm_id, c.binary_shm_offset, length); | |
1038 if (shaders == NULL || binary == NULL) { | |
1039 return error::kOutOfBounds; | |
1040 } | |
1041 | |
1042 error::Error error = DoShaderBinary(n, shaders, binaryformat, binary, length); | |
1043 if (error != error::kNoError) { | |
1044 return error; | |
1045 } | |
1046 | |
1047 return error::kNoError; | |
1048 } | |
1049 error::Error GLES2DecoderPassthroughImpl::HandleTexImage2D( | |
1050 uint32_t immediate_data_size, | |
1051 const void* cmd_data) { | |
1052 const gles2::cmds::TexImage2D& c = | |
1053 *static_cast<const gles2::cmds::TexImage2D*>(cmd_data); | |
1054 GLenum target = static_cast<GLenum>(c.target); | |
1055 GLint level = static_cast<GLint>(c.level); | |
1056 GLint internal_format = static_cast<GLint>(c.internalformat); | |
1057 GLsizei width = static_cast<GLsizei>(c.width); | |
1058 GLsizei height = static_cast<GLsizei>(c.height); | |
1059 GLint border = static_cast<GLint>(c.border); | |
1060 GLenum format = static_cast<GLenum>(c.format); | |
1061 GLenum type = static_cast<GLenum>(c.type); | |
1062 | |
1063 GLsizei imagesize = 0; | |
1064 const void* pixels = NULL; | |
1065 if (c.pixels_shm_id != 0 || c.pixels_shm_offset != 0) { | |
1066 unsigned int buffer_size = 0; | |
1067 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | |
1068 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); | |
1069 if (!pixels) { | |
1070 return error::kOutOfBounds; | |
1071 } | |
1072 imagesize = buffer_size; | |
1073 } | |
1074 | |
1075 error::Error error = | |
1076 DoTexImage2D(target, level, internal_format, width, height, border, | |
1077 format, type, imagesize, pixels); | |
1078 if (error != error::kNoError) { | |
1079 return error; | |
1080 } | |
1081 | |
1082 return error::kNoError; | |
1083 } | |
1084 | |
1085 error::Error GLES2DecoderPassthroughImpl::HandleTexImage3D( | |
1086 uint32_t immediate_data_size, | |
1087 const void* cmd_data) { | |
1088 const gles2::cmds::TexImage3D& c = | |
1089 *static_cast<const gles2::cmds::TexImage3D*>(cmd_data); | |
1090 GLenum target = static_cast<GLenum>(c.target); | |
1091 GLint level = static_cast<GLint>(c.level); | |
1092 GLint internal_format = static_cast<GLint>(c.internalformat); | |
1093 GLsizei width = static_cast<GLsizei>(c.width); | |
1094 GLsizei height = static_cast<GLsizei>(c.height); | |
1095 GLsizei depth = static_cast<GLsizei>(c.depth); | |
1096 GLint border = static_cast<GLint>(c.border); | |
1097 GLenum format = static_cast<GLenum>(c.format); | |
1098 GLenum type = static_cast<GLenum>(c.type); | |
1099 | |
1100 GLsizei imagesize = 0; | |
1101 const void* pixels = NULL; | |
1102 if (c.pixels_shm_id != 0 || c.pixels_shm_offset != 0) { | |
1103 unsigned int buffer_size = 0; | |
1104 pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | |
1105 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); | |
1106 if (!pixels) { | |
1107 return error::kOutOfBounds; | |
1108 } | |
1109 imagesize = buffer_size; | |
1110 } | |
1111 | |
1112 error::Error error = | |
1113 DoTexImage3D(target, level, internal_format, width, height, depth, border, | |
1114 format, type, imagesize, pixels); | |
1115 if (error != error::kNoError) { | |
1116 return error; | |
1117 } | |
1118 | |
1119 return error::kNoError; | |
1120 } | |
1121 | |
1122 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage2D( | |
1123 uint32_t immediate_data_size, | |
1124 const void* cmd_data) { | |
1125 const gles2::cmds::TexSubImage2D& c = | |
1126 *static_cast<const gles2::cmds::TexSubImage2D*>(cmd_data); | |
1127 GLenum target = static_cast<GLenum>(c.target); | |
1128 GLint level = static_cast<GLint>(c.level); | |
1129 GLint xoffset = static_cast<GLint>(c.xoffset); | |
1130 GLint yoffset = static_cast<GLint>(c.yoffset); | |
1131 GLsizei width = static_cast<GLsizei>(c.width); | |
1132 GLsizei height = static_cast<GLsizei>(c.height); | |
1133 GLenum format = static_cast<GLenum>(c.format); | |
1134 GLenum type = static_cast<GLenum>(c.type); | |
1135 | |
1136 unsigned int buffer_size = 0; | |
1137 const void* pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | |
1138 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); | |
1139 if (!pixels) { | |
1140 return error::kOutOfBounds; | |
1141 } | |
1142 GLsizei imagesize = buffer_size; | |
1143 | |
1144 error::Error error = DoTexSubImage2D(target, level, xoffset, yoffset, width, | |
1145 height, format, type, imagesize, pixels); | |
1146 if (error != error::kNoError) { | |
1147 return error; | |
1148 } | |
1149 | |
1150 return error::kNoError; | |
1151 } | |
1152 | |
1153 error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage3D( | |
1154 uint32_t immediate_data_size, | |
1155 const void* cmd_data) { | |
1156 const gles2::cmds::TexSubImage3D& c = | |
1157 *static_cast<const gles2::cmds::TexSubImage3D*>(cmd_data); | |
1158 GLenum target = static_cast<GLenum>(c.target); | |
1159 GLint level = static_cast<GLint>(c.level); | |
1160 GLint xoffset = static_cast<GLint>(c.xoffset); | |
1161 GLint yoffset = static_cast<GLint>(c.yoffset); | |
1162 GLint zoffset = static_cast<GLint>(c.zoffset); | |
1163 GLsizei width = static_cast<GLsizei>(c.width); | |
1164 GLsizei height = static_cast<GLsizei>(c.height); | |
1165 GLsizei depth = static_cast<GLsizei>(c.depth); | |
1166 GLenum format = static_cast<GLenum>(c.format); | |
1167 GLenum type = static_cast<GLenum>(c.type); | |
1168 | |
1169 unsigned int buffer_size = 0; | |
1170 const void* pixels = GetSharedMemoryAndSizeAs<uint8_t*>( | |
1171 c.pixels_shm_id, c.pixels_shm_offset, &buffer_size); | |
1172 if (!pixels) { | |
1173 return error::kOutOfBounds; | |
1174 } | |
1175 GLsizei imagesize = buffer_size; | |
1176 | |
1177 error::Error error = | |
1178 DoTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, | |
1179 depth, format, type, imagesize, pixels); | |
1180 if (error != error::kNoError) { | |
1181 return error; | |
1182 } | |
1183 | |
1184 return error::kNoError; | |
1185 } | |
1186 | |
1187 error::Error GLES2DecoderPassthroughImpl::HandleUniformBlockBinding( | |
1188 uint32_t immediate_data_size, | |
1189 const void* cmd_data) { | |
1190 const gles2::cmds::UniformBlockBinding& c = | |
1191 *static_cast<const gles2::cmds::UniformBlockBinding*>(cmd_data); | |
1192 GLuint program = static_cast<GLuint>(c.program); | |
1193 GLuint index = static_cast<GLuint>(c.index); | |
1194 GLuint binding = static_cast<GLuint>(c.binding); | |
1195 | |
1196 error::Error error = DoUniformBlockBinding(program, index, binding); | |
1197 if (error != error::kNoError) { | |
1198 return error; | |
1199 } | |
1200 | |
1201 return error::kNoError; | |
1202 } | |
1203 | |
1204 error::Error GLES2DecoderPassthroughImpl::HandleVertexAttribIPointer( | |
1205 uint32_t immediate_data_size, | |
1206 const void* cmd_data) { | |
1207 const gles2::cmds::VertexAttribIPointer& c = | |
1208 *static_cast<const gles2::cmds::VertexAttribIPointer*>(cmd_data); | |
1209 GLuint index = static_cast<GLuint>(c.indx); | |
1210 GLint size = static_cast<GLint>(c.size); | |
1211 GLenum type = static_cast<GLenum>(c.type); | |
1212 GLsizei stride = static_cast<GLsizei>(c.stride); | |
1213 GLsizei offset = static_cast<GLsizei>(c.offset); | |
1214 const void* ptr = reinterpret_cast<const void*>(offset); | |
1215 | |
1216 error::Error error = DoVertexAttribIPointer(index, size, type, stride, ptr); | |
1217 if (error != error::kNoError) { | |
1218 return error; | |
1219 } | |
1220 | |
1221 return error::kNoError; | |
1222 } | |
1223 | |
1224 error::Error GLES2DecoderPassthroughImpl::HandleVertexAttribPointer( | |
1225 uint32_t immediate_data_size, | |
1226 const void* cmd_data) { | |
1227 const gles2::cmds::VertexAttribPointer& c = | |
1228 *static_cast<const gles2::cmds::VertexAttribPointer*>(cmd_data); | |
1229 GLuint index = static_cast<GLuint>(c.indx); | |
1230 GLint size = static_cast<GLint>(c.size); | |
1231 GLenum type = static_cast<GLenum>(c.type); | |
1232 GLboolean normalized = static_cast<GLenum>(c.normalized); | |
1233 GLsizei stride = static_cast<GLsizei>(c.stride); | |
1234 GLsizei offset = static_cast<GLsizei>(c.offset); | |
1235 const void* ptr = reinterpret_cast<const void*>(offset); | |
1236 | |
1237 error::Error error = | |
1238 DoVertexAttribPointer(index, size, type, normalized, stride, ptr); | |
1239 if (error != error::kNoError) { | |
1240 return error; | |
1241 } | |
1242 | |
1243 return error::kNoError; | |
1244 } | |
1245 | |
1246 error::Error GLES2DecoderPassthroughImpl::HandleWaitSync( | |
1247 uint32_t immediate_data_size, | |
1248 const void* cmd_data) { | |
1249 const gles2::cmds::WaitSync& c = | |
1250 *static_cast<const gles2::cmds::WaitSync*>(cmd_data); | |
1251 const GLuint sync = static_cast<GLuint>(c.sync); | |
1252 const GLbitfield flags = static_cast<GLbitfield>(c.flags); | |
1253 const GLuint64 timeout = c.timeout(); | |
1254 | |
1255 error::Error error = DoWaitSync(sync, flags, timeout); | |
1256 if (error != error::kNoError) { | |
1257 return error; | |
1258 } | |
1259 | |
1260 return error::kNoError; | |
1261 } | |
1262 | |
1263 error::Error GLES2DecoderPassthroughImpl::HandleQueryCounterEXT( | |
1264 uint32_t immediate_data_size, | |
1265 const void* cmd_data) { | |
1266 const gles2::cmds::QueryCounterEXT& c = | |
1267 *static_cast<const gles2::cmds::QueryCounterEXT*>(cmd_data); | |
1268 GLuint id = static_cast<GLuint>(c.id); | |
1269 GLenum target = static_cast<GLenum>(c.target); | |
1270 | |
1271 error::Error error = DoQueryCounterEXT(id, target); | |
1272 if (error != error::kNoError) { | |
1273 return error; | |
1274 } | |
1275 | |
1276 return error::kNoError; | |
1277 } | |
1278 | |
1279 error::Error GLES2DecoderPassthroughImpl::HandleBeginQueryEXT( | |
1280 uint32_t immediate_data_size, | |
1281 const void* cmd_data) { | |
1282 const gles2::cmds::BeginQueryEXT& c = | |
1283 *static_cast<const gles2::cmds::BeginQueryEXT*>(cmd_data); | |
1284 GLenum target = static_cast<GLenum>(c.target); | |
1285 GLuint id = static_cast<GLuint>(c.id); | |
1286 | |
1287 error::Error error = DoBeginQueryEXT(target, id); | |
1288 if (error != error::kNoError) { | |
1289 return error; | |
1290 } | |
1291 | |
1292 return error::kNoError; | |
1293 } | |
1294 | |
1295 error::Error GLES2DecoderPassthroughImpl::HandleEndQueryEXT( | |
1296 uint32_t immediate_data_size, | |
1297 const void* cmd_data) { | |
1298 const gles2::cmds::EndQueryEXT& c = | |
1299 *static_cast<const gles2::cmds::EndQueryEXT*>(cmd_data); | |
1300 GLenum target = static_cast<GLenum>(c.target); | |
1301 | |
1302 error::Error error = DoEndQueryEXT(target); | |
1303 if (error != error::kNoError) { | |
1304 return error; | |
1305 } | |
1306 | |
1307 return error::kNoError; | |
1308 } | |
1309 | |
1310 error::Error GLES2DecoderPassthroughImpl::HandleSetDisjointValueSyncCHROMIUM( | |
1311 uint32_t immediate_data_size, | |
1312 const void* cmd_data) { | |
1313 const gles2::cmds::SetDisjointValueSyncCHROMIUM& c = | |
1314 *static_cast<const gles2::cmds::SetDisjointValueSyncCHROMIUM*>(cmd_data); | |
1315 DisjointValueSync* sync = GetSharedMemoryAs<DisjointValueSync*>( | |
1316 c.sync_data_shm_id, c.sync_data_shm_offset, sizeof(*sync)); | |
1317 if (!sync) { | |
1318 return error::kOutOfBounds; | |
1319 } | |
1320 error::Error error = DoSetDisjointValueSyncCHROMIUM(sync); | |
1321 if (error != error::kNoError) { | |
1322 return error; | |
1323 } | |
1324 return error::kNoError; | |
1325 } | |
1326 | |
1327 error::Error GLES2DecoderPassthroughImpl::HandleInsertEventMarkerEXT( | |
1328 uint32_t immediate_data_size, | |
1329 const void* cmd_data) { | |
1330 const gles2::cmds::InsertEventMarkerEXT& c = | |
1331 *static_cast<const gles2::cmds::InsertEventMarkerEXT*>(cmd_data); | |
1332 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | |
1333 Bucket* bucket = GetBucket(bucket_id); | |
1334 if (!bucket || bucket->size() == 0) { | |
1335 return error::kInvalidArguments; | |
1336 } | |
1337 std::string str; | |
1338 if (!bucket->GetAsString(&str)) { | |
1339 return error::kInvalidArguments; | |
1340 } | |
1341 error::Error error = DoInsertEventMarkerEXT(0, str.c_str()); | |
1342 if (error != error::kNoError) { | |
1343 return error; | |
1344 } | |
1345 return error::kNoError; | |
1346 } | |
1347 | |
1348 error::Error GLES2DecoderPassthroughImpl::HandlePushGroupMarkerEXT( | |
1349 uint32_t immediate_data_size, | |
1350 const void* cmd_data) { | |
1351 const gles2::cmds::PushGroupMarkerEXT& c = | |
1352 *static_cast<const gles2::cmds::PushGroupMarkerEXT*>(cmd_data); | |
1353 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | |
1354 Bucket* bucket = GetBucket(bucket_id); | |
1355 if (!bucket || bucket->size() == 0) { | |
1356 return error::kInvalidArguments; | |
1357 } | |
1358 std::string str; | |
1359 if (!bucket->GetAsString(&str)) { | |
1360 return error::kInvalidArguments; | |
1361 } | |
1362 error::Error error = DoPushGroupMarkerEXT(0, str.c_str()); | |
1363 if (error != error::kNoError) { | |
1364 return error; | |
1365 } | |
1366 return error::kNoError; | |
1367 } | |
1368 error::Error GLES2DecoderPassthroughImpl::HandleEnableFeatureCHROMIUM( | |
1369 uint32_t immediate_data_size, | |
1370 const void* cmd_data) { | |
1371 const gles2::cmds::EnableFeatureCHROMIUM& c = | |
1372 *static_cast<const gles2::cmds::EnableFeatureCHROMIUM*>(cmd_data); | |
1373 Bucket* bucket = GetBucket(c.bucket_id); | |
1374 if (!bucket || bucket->size() == 0) { | |
1375 return error::kInvalidArguments; | |
1376 } | |
1377 typedef cmds::EnableFeatureCHROMIUM::Result Result; | |
1378 Result* result = GetSharedMemoryAs<Result*>( | |
1379 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | |
1380 if (!result) { | |
1381 return error::kOutOfBounds; | |
1382 } | |
1383 // Check that the client initialized the result. | |
1384 if (*result != 0) { | |
1385 return error::kInvalidArguments; | |
1386 } | |
1387 std::string feature_str; | |
1388 if (!bucket->GetAsString(&feature_str)) { | |
1389 return error::kInvalidArguments; | |
1390 } | |
1391 error::Error error = DoEnableFeatureCHROMIUM(feature_str.c_str()); | |
1392 if (error != error::kNoError) { | |
1393 return error; | |
1394 } | |
1395 | |
1396 *result = 1; // true. | |
1397 return error::kNoError; | |
1398 } | |
1399 error::Error GLES2DecoderPassthroughImpl::HandleMapBufferRange( | |
1400 uint32_t immediate_data_size, | |
1401 const void* cmd_data) { | |
1402 const gles2::cmds::MapBufferRange& c = | |
1403 *static_cast<const gles2::cmds::MapBufferRange*>(cmd_data); | |
1404 GLenum target = static_cast<GLenum>(c.target); | |
1405 GLbitfield access = static_cast<GLbitfield>(c.access); | |
1406 GLintptr offset = static_cast<GLintptr>(c.offset); | |
1407 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | |
1408 | |
1409 typedef cmds::MapBufferRange::Result Result; | |
1410 Result* result = GetSharedMemoryAs<Result*>( | |
1411 c.result_shm_id, c.result_shm_offset, sizeof(*result)); | |
1412 if (!result) { | |
1413 return error::kOutOfBounds; | |
1414 } | |
1415 if (*result != 0) { | |
1416 *result = 0; | |
1417 return error::kInvalidArguments; | |
1418 } | |
1419 uint8_t* mem = | |
1420 GetSharedMemoryAs<uint8_t*>(c.data_shm_id, c.data_shm_offset, size); | |
1421 if (!mem) { | |
1422 return error::kOutOfBounds; | |
1423 } | |
1424 | |
1425 void* ptr = nullptr; | |
1426 error::Error error = DoMapBufferRange(target, offset, size, access, &ptr); | |
1427 if (error != error::kNoError) { | |
1428 return error; | |
1429 } | |
1430 | |
1431 *result = 1; | |
1432 return error::kNoError; | |
1433 } | |
1434 | |
1435 error::Error GLES2DecoderPassthroughImpl::HandleUnmapBuffer( | |
1436 uint32_t immediate_data_size, | |
1437 const void* cmd_data) { | |
1438 const gles2::cmds::UnmapBuffer& c = | |
1439 *static_cast<const gles2::cmds::UnmapBuffer*>(cmd_data); | |
1440 GLenum target = static_cast<GLenum>(c.target); | |
1441 error::Error error = DoUnmapBuffer(target); | |
1442 if (error != error::kNoError) { | |
1443 return error; | |
1444 } | |
1445 return error::kNoError; | |
1446 } | |
1447 | |
1448 error::Error GLES2DecoderPassthroughImpl::HandleResizeCHROMIUM( | |
1449 uint32_t immediate_data_size, | |
1450 const void* cmd_data) { | |
1451 const gles2::cmds::ResizeCHROMIUM& c = | |
1452 *static_cast<const gles2::cmds::ResizeCHROMIUM*>(cmd_data); | |
1453 GLuint width = static_cast<GLuint>(c.width); | |
1454 GLuint height = static_cast<GLuint>(c.height); | |
1455 GLfloat scale_factor = static_cast<GLfloat>(c.scale_factor); | |
1456 GLboolean has_alpha = static_cast<GLboolean>(c.alpha); | |
1457 error::Error error = DoResizeCHROMIUM(width, height, scale_factor, has_alpha); | |
1458 if (error != error::kNoError) { | |
1459 return error; | |
1460 } | |
1461 return error::kNoError; | |
1462 } | |
1463 | |
1464 error::Error | |
1465 GLES2DecoderPassthroughImpl::HandleGetRequestableExtensionsCHROMIUM( | |
1466 uint32_t immediate_data_size, | |
1467 const void* cmd_data) { | |
1468 const gles2::cmds::GetRequestableExtensionsCHROMIUM& c = | |
1469 *static_cast<const gles2::cmds::GetRequestableExtensionsCHROMIUM*>( | |
1470 cmd_data); | |
1471 const char* str = nullptr; | |
1472 error::Error error = DoGetRequestableExtensionsCHROMIUM(&str); | |
1473 if (error != error::kNoError) { | |
1474 return error; | |
1475 } | |
1476 if (!str) { | |
1477 return error::kOutOfBounds; | |
1478 } | |
1479 Bucket* bucket = CreateBucket(c.bucket_id); | |
1480 bucket->SetFromString(str); | |
1481 | |
1482 return error::kNoError; | |
1483 } | |
1484 | |
1485 error::Error GLES2DecoderPassthroughImpl::HandleRequestExtensionCHROMIUM( | |
1486 uint32_t immediate_data_size, | |
1487 const void* cmd_data) { | |
1488 const gles2::cmds::RequestExtensionCHROMIUM& c = | |
1489 *static_cast<const gles2::cmds::RequestExtensionCHROMIUM*>(cmd_data); | |
1490 Bucket* bucket = GetBucket(c.bucket_id); | |
1491 if (!bucket || bucket->size() == 0) { | |
1492 return error::kInvalidArguments; | |
1493 } | |
1494 std::string feature_str; | |
1495 if (!bucket->GetAsString(&feature_str)) { | |
1496 return error::kInvalidArguments; | |
1497 } | |
1498 error::Error error = DoRequestExtensionCHROMIUM(feature_str.c_str()); | |
1499 if (error != error::kNoError) { | |
1500 return error; | |
1501 } | |
1502 return error::kNoError; | |
1503 } | |
1504 | |
1505 error::Error GLES2DecoderPassthroughImpl::HandleGetProgramInfoCHROMIUM( | |
1506 uint32_t immediate_data_size, | |
1507 const void* cmd_data) { | |
1508 const gles2::cmds::GetProgramInfoCHROMIUM& c = | |
1509 *static_cast<const gles2::cmds::GetProgramInfoCHROMIUM*>(cmd_data); | |
1510 GLuint program = static_cast<GLuint>(c.program); | |
1511 | |
1512 uint32_t bucket_id = c.bucket_id; | |
1513 Bucket* bucket = CreateBucket(bucket_id); | |
1514 bucket->SetSize(sizeof(ProgramInfoHeader)); // in case we fail. | |
1515 | |
1516 std::vector<uint8_t> data; | |
1517 error::Error error = DoGetProgramInfoCHROMIUM(program, &data); | |
1518 if (error != error::kNoError) { | |
1519 return error; | |
1520 } | |
1521 | |
1522 bucket->SetSize(data.size()); | |
1523 bucket->SetData(data.data(), 0, data.size()); | |
1524 | |
1525 return error::kNoError; | |
1526 } | |
1527 | |
1528 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformBlocksCHROMIUM( | |
1529 uint32_t immediate_data_size, | |
1530 const void* cmd_data) { | |
1531 const gles2::cmds::GetUniformBlocksCHROMIUM& c = | |
1532 *static_cast<const gles2::cmds::GetUniformBlocksCHROMIUM*>(cmd_data); | |
1533 GLuint program = static_cast<GLuint>(c.program); | |
1534 | |
1535 uint32_t bucket_id = c.bucket_id; | |
1536 Bucket* bucket = CreateBucket(bucket_id); | |
1537 bucket->SetSize(sizeof(UniformBlocksHeader)); // in case we fail. | |
1538 | |
1539 std::vector<uint8_t> data; | |
1540 error::Error error = DoGetUniformBlocksCHROMIUM(program, &data); | |
1541 if (error != error::kNoError) { | |
1542 return error; | |
1543 } | |
1544 | |
1545 bucket->SetSize(data.size()); | |
1546 bucket->SetData(data.data(), 0, data.size()); | |
1547 | |
1548 return error::kNoError; | |
1549 } | |
1550 | |
1551 error::Error | |
1552 GLES2DecoderPassthroughImpl::HandleGetTransformFeedbackVaryingsCHROMIUM( | |
1553 uint32_t immediate_data_size, | |
1554 const void* cmd_data) { | |
1555 const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM& c = | |
1556 *static_cast<const gles2::cmds::GetTransformFeedbackVaryingsCHROMIUM*>( | |
1557 cmd_data); | |
1558 GLuint program = static_cast<GLuint>(c.program); | |
1559 | |
1560 uint32_t bucket_id = c.bucket_id; | |
1561 Bucket* bucket = CreateBucket(bucket_id); | |
1562 bucket->SetSize(sizeof(TransformFeedbackVaryingsHeader)); // in case we fail. | |
1563 | |
1564 std::vector<uint8_t> data; | |
1565 error::Error error = DoGetTransformFeedbackVaryingsCHROMIUM(program, &data); | |
1566 if (error != error::kNoError) { | |
1567 return error; | |
1568 } | |
1569 | |
1570 bucket->SetSize(data.size()); | |
1571 bucket->SetData(data.data(), 0, data.size()); | |
1572 | |
1573 return error::kNoError; | |
1574 } | |
1575 | |
1576 error::Error GLES2DecoderPassthroughImpl::HandleGetUniformsES3CHROMIUM( | |
1577 uint32_t immediate_data_size, | |
1578 const void* cmd_data) { | |
1579 const gles2::cmds::GetUniformsES3CHROMIUM& c = | |
1580 *static_cast<const gles2::cmds::GetUniformsES3CHROMIUM*>(cmd_data); | |
1581 GLuint program = static_cast<GLuint>(c.program); | |
1582 | |
1583 uint32_t bucket_id = c.bucket_id; | |
1584 Bucket* bucket = CreateBucket(bucket_id); | |
1585 bucket->SetSize(sizeof(UniformsES3Header)); // in case we fail. | |
1586 | |
1587 std::vector<uint8_t> data; | |
1588 error::Error error = DoGetUniformsES3CHROMIUM(program, &data); | |
1589 if (error != error::kNoError) { | |
1590 return error; | |
1591 } | |
1592 | |
1593 bucket->SetSize(data.size()); | |
1594 bucket->SetData(data.data(), 0, data.size()); | |
1595 | |
1596 return error::kNoError; | |
1597 } | |
1598 | |
1599 error::Error GLES2DecoderPassthroughImpl::HandleGetTranslatedShaderSourceANGLE( | |
1600 uint32_t immediate_data_size, | |
1601 const void* cmd_data) { | |
1602 const gles2::cmds::GetTranslatedShaderSourceANGLE& c = | |
1603 *static_cast<const gles2::cmds::GetTranslatedShaderSourceANGLE*>( | |
1604 cmd_data); | |
1605 GLuint shader = static_cast<GLuint>(c.shader); | |
1606 | |
1607 std::string source; | |
1608 error::Error error = DoGetTranslatedShaderSourceANGLE(shader, &source); | |
1609 if (error != error::kNoError) { | |
1610 return error; | |
1611 } | |
1612 | |
1613 Bucket* bucket = CreateBucket(c.bucket_id); | |
1614 bucket->SetFromString(source.c_str()); | |
1615 | |
1616 return error::kNoError; | |
1617 } | |
1618 error::Error GLES2DecoderPassthroughImpl::HandlePostSubBufferCHROMIUM( | |
1619 uint32_t immediate_data_size, | |
1620 const void* cmd_data) { | |
1621 const gles2::cmds::PostSubBufferCHROMIUM& c = | |
1622 *static_cast<const gles2::cmds::PostSubBufferCHROMIUM*>(cmd_data); | |
1623 GLint x = static_cast<GLint>(c.x); | |
1624 GLint y = static_cast<GLint>(c.y); | |
1625 GLint width = static_cast<GLint>(c.width); | |
1626 GLint height = static_cast<GLint>(c.height); | |
1627 error::Error error = DoPostSubBufferCHROMIUM(x, y, width, height); | |
1628 if (error != error::kNoError) { | |
1629 return error; | |
1630 } | |
1631 return error::kNoError; | |
1632 } | |
1633 error::Error GLES2DecoderPassthroughImpl::HandleDrawArraysInstancedANGLE( | |
1634 uint32_t immediate_data_size, | |
1635 const void* cmd_data) { | |
1636 const gles2::cmds::DrawArraysInstancedANGLE& c = | |
1637 *static_cast<const gles2::cmds::DrawArraysInstancedANGLE*>(cmd_data); | |
1638 GLenum mode = static_cast<GLenum>(c.mode); | |
1639 GLint first = static_cast<GLint>(c.first); | |
1640 GLsizei count = static_cast<GLsizei>(c.count); | |
1641 GLsizei primcount = static_cast<GLsizei>(c.primcount); | |
1642 error::Error error = | |
1643 DoDrawArraysInstancedANGLE(mode, first, count, primcount); | |
1644 if (error != error::kNoError) { | |
1645 return error; | |
1646 } | |
1647 return error::kNoError; | |
1648 } | |
1649 | |
1650 error::Error GLES2DecoderPassthroughImpl::HandleDrawElementsInstancedANGLE( | |
1651 uint32_t immediate_data_size, | |
1652 const void* cmd_data) { | |
1653 const gles2::cmds::DrawElementsInstancedANGLE& c = | |
1654 *static_cast<const gles2::cmds::DrawElementsInstancedANGLE*>(cmd_data); | |
1655 GLenum mode = static_cast<GLenum>(c.mode); | |
1656 GLsizei count = static_cast<GLsizei>(c.count); | |
1657 GLenum type = static_cast<GLenum>(c.type); | |
1658 const GLvoid* indices = | |
1659 reinterpret_cast<const GLvoid*>(static_cast<uintptr_t>(c.index_offset)); | |
1660 GLsizei primcount = static_cast<GLsizei>(c.primcount); | |
1661 error::Error error = | |
1662 DoDrawElementsInstancedANGLE(mode, count, type, indices, primcount); | |
1663 if (error != error::kNoError) { | |
1664 return error; | |
1665 } | |
1666 return error::kNoError; | |
1667 } | |
1668 | |
1669 error::Error GLES2DecoderPassthroughImpl::HandleVertexAttribDivisorANGLE( | |
1670 uint32_t immediate_data_size, | |
1671 const void* cmd_data) { | |
1672 const gles2::cmds::VertexAttribDivisorANGLE& c = | |
1673 *static_cast<const gles2::cmds::VertexAttribDivisorANGLE*>(cmd_data); | |
1674 GLuint index = static_cast<GLuint>(c.index); | |
1675 GLuint divisor = static_cast<GLuint>(c.divisor); | |
1676 error::Error error = DoVertexAttribDivisorANGLE(index, divisor); | |
1677 if (error != error::kNoError) { | |
1678 return error; | |
1679 } | |
1680 return error::kNoError; | |
1681 } | |
1682 | |
1683 error::Error GLES2DecoderPassthroughImpl::HandleGenMailboxCHROMIUM( | |
1684 uint32_t immediate_data_size, | |
1685 const void* cmd_data) { | |
1686 const gles2::cmds::GenMailboxCHROMIUM& c = | |
1687 *static_cast<const gles2::cmds::GenMailboxCHROMIUM*>(cmd_data); | |
1688 (void)c; | |
1689 return error::kUnknownCommand; | |
1690 } | |
1691 | |
1692 error::Error | |
1693 GLES2DecoderPassthroughImpl::HandleCreateAndConsumeTextureCHROMIUMImmediate( | |
1694 uint32_t immediate_data_size, | |
1695 const void* cmd_data) { | |
1696 const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate& c = *static_cast< | |
1697 const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate*>(cmd_data); | |
1698 GLenum target = static_cast<GLenum>(c.target); | |
1699 uint32_t data_size; | |
1700 if (!GLES2Util::ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) { | |
1701 return error::kOutOfBounds; | |
1702 } | |
1703 if (data_size > immediate_data_size) { | |
1704 return error::kOutOfBounds; | |
1705 } | |
1706 const GLbyte* mailbox = | |
1707 GetImmediateDataAs<const GLbyte*>(c, data_size, immediate_data_size); | |
1708 if (mailbox == NULL) { | |
1709 return error::kOutOfBounds; | |
1710 } | |
1711 uint32_t client_id = c.client_id; | |
1712 error::Error error = | |
1713 DoCreateAndConsumeTextureCHROMIUM(target, mailbox, client_id); | |
1714 if (error != error::kNoError) { | |
1715 return error; | |
1716 } | |
1717 | |
1718 return error::kNoError; | |
1719 } | |
1720 | |
1721 error::Error | |
1722 GLES2DecoderPassthroughImpl::HandleBindUniformLocationCHROMIUMBucket( | |
1723 uint32_t immediate_data_size, | |
1724 const void* cmd_data) { | |
1725 const gles2::cmds::BindUniformLocationCHROMIUMBucket& c = | |
1726 *static_cast<const gles2::cmds::BindUniformLocationCHROMIUMBucket*>( | |
1727 cmd_data); | |
1728 GLuint program = static_cast<GLuint>(c.program); | |
1729 GLint location = static_cast<GLint>(c.location); | |
1730 Bucket* bucket = GetBucket(c.name_bucket_id); | |
1731 if (!bucket || bucket->size() == 0) { | |
1732 return error::kInvalidArguments; | |
1733 } | |
1734 std::string name_str; | |
1735 if (!bucket->GetAsString(&name_str)) { | |
1736 return error::kInvalidArguments; | |
1737 } | |
1738 error::Error error = | |
1739 DoBindUniformLocationCHROMIUM(program, location, name_str.c_str()); | |
1740 if (error != error::kNoError) { | |
1741 return error; | |
1742 } | |
1743 return error::kNoError; | |
1744 } | |
1745 | |
1746 error::Error GLES2DecoderPassthroughImpl::HandleTraceBeginCHROMIUM( | |
1747 uint32_t immediate_data_size, | |
1748 const void* cmd_data) { | |
1749 const gles2::cmds::TraceBeginCHROMIUM& c = | |
1750 *static_cast<const gles2::cmds::TraceBeginCHROMIUM*>(cmd_data); | |
1751 Bucket* category_bucket = GetBucket(c.category_bucket_id); | |
1752 Bucket* name_bucket = GetBucket(c.name_bucket_id); | |
1753 if (!category_bucket || category_bucket->size() == 0 || !name_bucket || | |
1754 name_bucket->size() == 0) { | |
1755 return error::kInvalidArguments; | |
1756 } | |
1757 | |
1758 std::string category_name; | |
1759 std::string trace_name; | |
1760 if (!category_bucket->GetAsString(&category_name) || | |
1761 !name_bucket->GetAsString(&trace_name)) { | |
1762 return error::kInvalidArguments; | |
1763 } | |
1764 | |
1765 error::Error error = | |
1766 DoTraceBeginCHROMIUM(category_name.c_str(), trace_name.c_str()); | |
1767 if (error != error::kNoError) { | |
1768 return error; | |
1769 } | |
1770 return error::kNoError; | |
1771 } | |
1772 | |
1773 error::Error GLES2DecoderPassthroughImpl::HandleDescheduleUntilFinishedCHROMIUM( | |
1774 uint32_t immediate_data_size, | |
1775 const void* cmd_data) { | |
1776 const gles2::cmds::DescheduleUntilFinishedCHROMIUM& c = | |
1777 *static_cast<const gles2::cmds::DescheduleUntilFinishedCHROMIUM*>( | |
1778 cmd_data); | |
1779 (void)c; | |
1780 | |
1781 error::Error error = DoDescheduleUntilFinishedCHROMIUM(); | |
1782 if (error != error::kNoError) { | |
1783 return error; | |
1784 } | |
1785 return error::kNoError; | |
1786 } | |
1787 | |
1788 error::Error GLES2DecoderPassthroughImpl::HandleInsertFenceSyncCHROMIUM( | |
1789 uint32_t immediate_data_size, | |
1790 const void* cmd_data) { | |
1791 const gles2::cmds::InsertFenceSyncCHROMIUM& c = | |
1792 *static_cast<const gles2::cmds::InsertFenceSyncCHROMIUM*>(cmd_data); | |
1793 GLuint64 release_count = c.release_count(); | |
1794 error::Error error = DoInsertFenceSyncCHROMIUM(release_count); | |
1795 if (error != error::kNoError) { | |
1796 return error; | |
1797 } | |
1798 return error::kNoError; | |
1799 } | |
1800 error::Error GLES2DecoderPassthroughImpl::HandleGenSyncTokenCHROMIUMImmediate( | |
1801 uint32_t immediate_data_size, | |
1802 const void* cmd_data) { | |
1803 const gles2::cmds::GenSyncTokenCHROMIUMImmediate& c = | |
1804 *static_cast<const gles2::cmds::GenSyncTokenCHROMIUMImmediate*>(cmd_data); | |
1805 (void)c; | |
1806 return error::kUnknownCommand; | |
1807 } | |
1808 | |
1809 error::Error | |
1810 GLES2DecoderPassthroughImpl::HandleGenUnverifiedSyncTokenCHROMIUMImmediate( | |
1811 uint32_t immediate_data_size, | |
1812 const void* cmd_data) { | |
1813 const gles2::cmds::GenUnverifiedSyncTokenCHROMIUMImmediate& c = | |
1814 *static_cast<const gles2::cmds::GenUnverifiedSyncTokenCHROMIUMImmediate*>( | |
1815 cmd_data); | |
1816 (void)c; | |
1817 return error::kUnknownCommand; | |
1818 } | |
1819 | |
1820 error::Error | |
1821 GLES2DecoderPassthroughImpl::HandleVerifySyncTokensCHROMIUMImmediate( | |
1822 uint32_t immediate_data_size, | |
1823 const void* cmd_data) { | |
1824 const gles2::cmds::VerifySyncTokensCHROMIUMImmediate& c = | |
1825 *static_cast<const gles2::cmds::VerifySyncTokensCHROMIUMImmediate*>( | |
1826 cmd_data); | |
1827 (void)c; | |
1828 return error::kUnknownCommand; | |
1829 } | |
1830 | |
1831 error::Error GLES2DecoderPassthroughImpl::HandleWaitSyncTokenCHROMIUM( | |
1832 uint32_t immediate_data_size, | |
1833 const void* cmd_data) { | |
1834 const gles2::cmds::WaitSyncTokenCHROMIUM& c = | |
1835 *static_cast<const gles2::cmds::WaitSyncTokenCHROMIUM*>(cmd_data); | |
1836 CommandBufferNamespace namespace_id = | |
1837 static_cast<gpu::CommandBufferNamespace>(c.namespace_id); | |
1838 CommandBufferId command_buffer_id = | |
1839 CommandBufferId::FromUnsafeValue(c.command_buffer_id()); | |
1840 const uint64_t release_count = c.release_count(); | |
1841 | |
1842 const CommandBufferNamespace kMinNamespaceId = | |
1843 CommandBufferNamespace::INVALID; | |
1844 const CommandBufferNamespace kMaxNamespaceId = | |
1845 CommandBufferNamespace::NUM_COMMAND_BUFFER_NAMESPACES; | |
1846 if ((namespace_id < static_cast<int32_t>(kMinNamespaceId)) || | |
1847 (namespace_id >= static_cast<int32_t>(kMaxNamespaceId))) { | |
1848 namespace_id = gpu::CommandBufferNamespace::INVALID; | |
1849 } | |
1850 | |
1851 error::Error error = | |
1852 DoWaitSyncTokenCHROMIUM(namespace_id, command_buffer_id, release_count); | |
1853 if (error != error::kNoError) { | |
1854 return error; | |
1855 } | |
1856 return error::kNoError; | |
1857 } | |
1858 | |
1859 error::Error GLES2DecoderPassthroughImpl::HandleDiscardBackbufferCHROMIUM( | |
1860 uint32_t immediate_data_size, | |
1861 const void* cmd_data) { | |
1862 const gles2::cmds::DiscardBackbufferCHROMIUM& c = | |
1863 *static_cast<const gles2::cmds::DiscardBackbufferCHROMIUM*>(cmd_data); | |
1864 (void)c; | |
1865 error::Error error = DoDiscardBackbufferCHROMIUM(); | |
1866 if (error != error::kNoError) { | |
1867 return error; | |
1868 } | |
1869 return error::kNoError; | |
1870 } | |
1871 | |
1872 error::Error GLES2DecoderPassthroughImpl::HandleScheduleOverlayPlaneCHROMIUM( | |
1873 uint32_t immediate_data_size, | |
1874 const void* cmd_data) { | |
1875 const gles2::cmds::ScheduleOverlayPlaneCHROMIUM& c = | |
1876 *static_cast<const gles2::cmds::ScheduleOverlayPlaneCHROMIUM*>(cmd_data); | |
1877 GLint plane_z_order = static_cast<GLint>(c.plane_z_order); | |
1878 GLenum plane_transform = static_cast<GLenum>(c.plane_transform); | |
1879 GLuint overlay_texture_id = static_cast<GLuint>(c.overlay_texture_id); | |
1880 GLint bounds_x = static_cast<GLint>(c.bounds_x); | |
1881 GLint bounds_y = static_cast<GLint>(c.bounds_y); | |
1882 GLint bounds_width = static_cast<GLint>(c.bounds_width); | |
1883 GLint bounds_height = static_cast<GLint>(c.bounds_height); | |
1884 GLfloat uv_x = static_cast<GLfloat>(c.uv_x); | |
1885 GLfloat uv_y = static_cast<GLfloat>(c.uv_x); | |
1886 GLfloat uv_width = static_cast<GLfloat>(c.uv_x); | |
1887 GLfloat uv_height = static_cast<GLfloat>(c.uv_x); | |
1888 error::Error error = DoScheduleOverlayPlaneCHROMIUM( | |
1889 plane_z_order, plane_transform, overlay_texture_id, bounds_x, bounds_y, | |
1890 bounds_width, bounds_height, uv_x, uv_y, uv_width, uv_height); | |
1891 if (error != error::kNoError) { | |
1892 return error; | |
1893 } | |
1894 return error::kNoError; | |
1895 } | |
1896 | |
1897 error::Error GLES2DecoderPassthroughImpl::HandleScheduleCALayerCHROMIUM( | |
1898 uint32_t immediate_data_size, | |
1899 const void* cmd_data) { | |
1900 const gles2::cmds::ScheduleCALayerCHROMIUM& c = | |
1901 *static_cast<const gles2::cmds::ScheduleCALayerCHROMIUM*>(cmd_data); | |
1902 const GLfloat* mem = GetSharedMemoryAs<const GLfloat*>(c.shm_id, c.shm_offset, | |
1903 28 * sizeof(GLfloat)); | |
1904 if (!mem) { | |
1905 return error::kOutOfBounds; | |
1906 } | |
1907 GLuint contents_texture_id = static_cast<GLint>(c.contents_texture_id); | |
1908 const GLfloat* contents_rect = mem; | |
1909 GLfloat opacity = static_cast<GLfloat>(c.opacity); | |
1910 GLuint background_color = static_cast<GLuint>(c.background_color); | |
1911 GLuint edge_aa_mask = static_cast<GLuint>(c.edge_aa_mask); | |
1912 const GLfloat* bounds_rect = mem + 4; | |
1913 GLboolean is_clipped = static_cast<GLboolean>(c.is_clipped); | |
1914 const GLfloat* clip_rect = mem + 8; | |
1915 GLint sorting_context_id = static_cast<GLint>(c.sorting_context_id); | |
1916 const GLfloat* transform = mem + 12; | |
1917 error::Error error = DoScheduleCALayerCHROMIUM( | |
1918 contents_texture_id, contents_rect, opacity, background_color, | |
1919 edge_aa_mask, bounds_rect, is_clipped, clip_rect, sorting_context_id, | |
1920 transform); | |
1921 if (error != error::kNoError) { | |
1922 return error; | |
1923 } | |
1924 return error::kNoError; | |
1925 } | |
1926 | |
1927 error::Error GLES2DecoderPassthroughImpl::HandleGenPathsCHROMIUM( | |
1928 uint32_t immediate_data_size, | |
1929 const void* cmd_data) { | |
1930 const gles2::cmds::GenPathsCHROMIUM& c = | |
1931 *static_cast<const gles2::cmds::GenPathsCHROMIUM*>(cmd_data); | |
1932 GLuint path = static_cast<GLuint>(c.first_client_id); | |
1933 GLsizei range = static_cast<GLsizei>(c.range); | |
1934 error::Error error = DoGenPathsCHROMIUM(path, range); | |
1935 if (error != error::kNoError) { | |
1936 return error; | |
1937 } | |
1938 return error::kNoError; | |
1939 } | |
1940 | |
1941 error::Error GLES2DecoderPassthroughImpl::HandleDeletePathsCHROMIUM( | |
1942 uint32_t immediate_data_size, | |
1943 const void* cmd_data) { | |
1944 const gles2::cmds::DeletePathsCHROMIUM& c = | |
1945 *static_cast<const gles2::cmds::DeletePathsCHROMIUM*>(cmd_data); | |
1946 GLuint path = static_cast<GLuint>(c.first_client_id); | |
1947 GLsizei range = static_cast<GLsizei>(c.range); | |
1948 error::Error error = DoDeletePathsCHROMIUM(path, range); | |
1949 if (error != error::kNoError) { | |
1950 return error; | |
1951 } | |
1952 return error::kNoError; | |
1953 } | |
1954 | |
1955 error::Error GLES2DecoderPassthroughImpl::HandlePathCommandsCHROMIUM( | |
1956 uint32_t immediate_data_size, | |
1957 const void* cmd_data) { | |
1958 const gles2::cmds::PathCommandsCHROMIUM& c = | |
1959 *static_cast<const gles2::cmds::PathCommandsCHROMIUM*>(cmd_data); | |
1960 GLuint path = static_cast<GLuint>(c.path); | |
1961 GLsizei num_commands = static_cast<GLsizei>(c.numCommands); | |
1962 const GLubyte* commands = nullptr; | |
1963 if (num_commands > 0) { | |
1964 uint32_t commands_shm_id = static_cast<uint32_t>(c.commands_shm_id); | |
1965 uint32_t commands_shm_offset = static_cast<uint32_t>(c.commands_shm_offset); | |
1966 if (commands_shm_id != 0 || commands_shm_offset != 0) { | |
1967 commands = GetSharedMemoryAs<const GLubyte*>( | |
1968 commands_shm_id, commands_shm_offset, num_commands); | |
1969 } | |
1970 if (!commands) { | |
1971 return error::kOutOfBounds; | |
1972 } | |
1973 } | |
1974 GLsizei num_coords = static_cast<GLsizei>(c.numCoords); | |
1975 GLenum coord_type = static_cast<GLenum>(c.coordType); | |
1976 const GLvoid* coords = nullptr; | |
1977 GLsizei coords_bufsize = 0; | |
1978 if (num_coords > 0) { | |
1979 uint32_t coords_shm_id = static_cast<uint32_t>(c.coords_shm_id); | |
1980 uint32_t coords_shm_offset = static_cast<uint32_t>(c.coords_shm_offset); | |
1981 if (coords_shm_id != 0 || coords_shm_offset != 0) { | |
1982 unsigned int memory_size = 0; | |
1983 coords = GetSharedMemoryAndSizeAs<const GLvoid*>( | |
1984 coords_shm_id, coords_shm_offset, &memory_size); | |
1985 coords_bufsize = static_cast<GLsizei>(memory_size); | |
1986 } | |
1987 | |
1988 if (!coords) { | |
1989 return error::kOutOfBounds; | |
1990 } | |
1991 } | |
1992 | |
1993 error::Error error = | |
1994 DoPathCommandsCHROMIUM(path, num_commands, commands, num_coords, | |
1995 coord_type, coords, coords_bufsize); | |
1996 if (error != error::kNoError) { | |
1997 return error; | |
1998 } | |
1999 | |
2000 return error::kNoError; | |
2001 } | |
2002 | |
2003 error::Error GLES2DecoderPassthroughImpl::HandlePathParameterfCHROMIUM( | |
2004 uint32_t immediate_data_size, | |
2005 const void* cmd_data) { | |
2006 const gles2::cmds::PathParameterfCHROMIUM& c = | |
2007 *static_cast<const gles2::cmds::PathParameterfCHROMIUM*>(cmd_data); | |
2008 GLuint path = static_cast<GLuint>(c.path); | |
2009 GLenum pname = static_cast<GLenum>(c.pname); | |
2010 GLfloat value = static_cast<GLfloat>(c.value); | |
2011 error::Error error = DoPathParameterfCHROMIUM(path, pname, value); | |
2012 if (error != error::kNoError) { | |
2013 return error; | |
2014 } | |
2015 return error::kNoError; | |
2016 } | |
2017 | |
2018 error::Error GLES2DecoderPassthroughImpl::HandlePathParameteriCHROMIUM( | |
2019 uint32_t immediate_data_size, | |
2020 const void* cmd_data) { | |
2021 const gles2::cmds::PathParameteriCHROMIUM& c = | |
2022 *static_cast<const gles2::cmds::PathParameteriCHROMIUM*>(cmd_data); | |
2023 GLuint path = static_cast<GLuint>(c.path); | |
2024 GLenum pname = static_cast<GLenum>(c.pname); | |
2025 GLint value = static_cast<GLint>(c.value); | |
2026 error::Error error = DoPathParameteriCHROMIUM(path, pname, value); | |
2027 if (error != error::kNoError) { | |
2028 return error; | |
2029 } | |
2030 return error::kNoError; | |
2031 } | |
2032 | |
2033 error::Error GLES2DecoderPassthroughImpl::HandleStencilFillPathCHROMIUM( | |
2034 uint32_t immediate_data_size, | |
2035 const void* cmd_data) { | |
2036 const gles2::cmds::StencilFillPathCHROMIUM& c = | |
2037 *static_cast<const gles2::cmds::StencilFillPathCHROMIUM*>(cmd_data); | |
2038 GLuint path = static_cast<GLuint>(c.path); | |
2039 GLenum fill_mode = static_cast<GLenum>(c.fillMode); | |
2040 GLuint mask = static_cast<GLuint>(c.mask); | |
2041 error::Error error = DoStencilFillPathCHROMIUM(path, fill_mode, mask); | |
2042 if (error != error::kNoError) { | |
2043 return error; | |
2044 } | |
2045 return error::kNoError; | |
2046 } | |
2047 | |
2048 error::Error GLES2DecoderPassthroughImpl::HandleStencilStrokePathCHROMIUM( | |
2049 uint32_t immediate_data_size, | |
2050 const void* cmd_data) { | |
2051 const gles2::cmds::StencilStrokePathCHROMIUM& c = | |
2052 *static_cast<const gles2::cmds::StencilStrokePathCHROMIUM*>(cmd_data); | |
2053 GLuint path = static_cast<GLuint>(c.path); | |
2054 GLint reference = static_cast<GLint>(c.reference); | |
2055 GLuint mask = static_cast<GLuint>(c.mask); | |
2056 error::Error error = DoStencilStrokePathCHROMIUM(path, reference, mask); | |
2057 if (error != error::kNoError) { | |
2058 return error; | |
2059 } | |
2060 return error::kNoError; | |
2061 } | |
2062 | |
2063 error::Error GLES2DecoderPassthroughImpl::HandleCoverFillPathCHROMIUM( | |
2064 uint32_t immediate_data_size, | |
2065 const void* cmd_data) { | |
2066 const gles2::cmds::CoverFillPathCHROMIUM& c = | |
2067 *static_cast<const gles2::cmds::CoverFillPathCHROMIUM*>(cmd_data); | |
2068 GLuint path = static_cast<GLuint>(c.path); | |
2069 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
2070 error::Error error = DoCoverFillPathCHROMIUM(path, cover_mode); | |
2071 if (error != error::kNoError) { | |
2072 return error; | |
2073 } | |
2074 return error::kNoError; | |
2075 } | |
2076 | |
2077 error::Error GLES2DecoderPassthroughImpl::HandleCoverStrokePathCHROMIUM( | |
2078 uint32_t immediate_data_size, | |
2079 const void* cmd_data) { | |
2080 const gles2::cmds::CoverStrokePathCHROMIUM& c = | |
2081 *static_cast<const gles2::cmds::CoverStrokePathCHROMIUM*>(cmd_data); | |
2082 GLuint path = static_cast<GLuint>(c.path); | |
2083 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
2084 error::Error error = DoCoverStrokePathCHROMIUM(path, cover_mode); | |
2085 if (error != error::kNoError) { | |
2086 return error; | |
2087 } | |
2088 return error::kNoError; | |
2089 } | |
2090 | |
2091 error::Error | |
2092 GLES2DecoderPassthroughImpl::HandleStencilThenCoverFillPathCHROMIUM( | |
2093 uint32_t immediate_data_size, | |
2094 const void* cmd_data) { | |
2095 const gles2::cmds::StencilThenCoverFillPathCHROMIUM& c = | |
2096 *static_cast<const gles2::cmds::StencilThenCoverFillPathCHROMIUM*>( | |
2097 cmd_data); | |
2098 GLuint path = static_cast<GLuint>(c.path); | |
2099 GLenum fill_mode = static_cast<GLenum>(c.fillMode); | |
2100 GLuint mask = static_cast<GLuint>(c.mask); | |
2101 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
2102 error::Error error = | |
2103 DoStencilThenCoverFillPathCHROMIUM(path, fill_mode, mask, cover_mode); | |
2104 if (error != error::kNoError) { | |
2105 return error; | |
2106 } | |
2107 return error::kNoError; | |
2108 } | |
2109 | |
2110 error::Error | |
2111 GLES2DecoderPassthroughImpl::HandleStencilThenCoverStrokePathCHROMIUM( | |
2112 uint32_t immediate_data_size, | |
2113 const void* cmd_data) { | |
2114 const gles2::cmds::StencilThenCoverStrokePathCHROMIUM& c = | |
2115 *static_cast<const gles2::cmds::StencilThenCoverStrokePathCHROMIUM*>( | |
2116 cmd_data); | |
2117 GLuint path = static_cast<GLuint>(c.path); | |
2118 GLint reference = static_cast<GLint>(c.reference); | |
2119 GLuint mask = static_cast<GLuint>(c.mask); | |
2120 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
2121 error::Error error = | |
2122 DoStencilThenCoverStrokePathCHROMIUM(path, reference, mask, cover_mode); | |
2123 if (error != error::kNoError) { | |
2124 return error; | |
2125 } | |
2126 return error::kNoError; | |
2127 } | |
2128 | |
2129 error::Error | |
2130 GLES2DecoderPassthroughImpl::HandleStencilFillPathInstancedCHROMIUM( | |
2131 uint32_t immediate_data_size, | |
2132 const void* cmd_data) { | |
2133 const gles2::cmds::StencilFillPathInstancedCHROMIUM& c = | |
2134 *static_cast<const gles2::cmds::StencilFillPathInstancedCHROMIUM*>( | |
2135 cmd_data); | |
2136 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
2137 GLenum path_name_type = static_cast<GLuint>(c.pathNameType); | |
2138 const GLvoid* paths = nullptr; | |
2139 GLsizei paths_bufsize = 0; | |
2140 if (num_paths > 0) { | |
2141 uint32_t paths_shm_id = static_cast<uint32_t>(c.paths_shm_id); | |
2142 uint32_t paths_shm_offset = static_cast<uint32_t>(c.paths_shm_offset); | |
2143 if (paths_shm_id != 0 || paths_shm_offset != 0) { | |
2144 unsigned int memory_size = 0; | |
2145 paths = GetSharedMemoryAndSizeAs<const GLvoid*>( | |
2146 paths_shm_id, paths_shm_offset, &memory_size); | |
2147 paths_bufsize = static_cast<GLsizei>(memory_size); | |
2148 } | |
2149 | |
2150 if (!paths) { | |
2151 return error::kOutOfBounds; | |
2152 } | |
2153 } | |
2154 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
2155 GLenum fill_mode = static_cast<GLenum>(c.fillMode); | |
2156 GLuint mask = static_cast<GLuint>(c.mask); | |
2157 GLenum transform_type = static_cast<GLuint>(c.transformType); | |
2158 const GLfloat* transform_values = nullptr; | |
2159 GLsizei transform_values_bufsize = 0; | |
2160 if (c.transformValues_shm_id != 0 || c.transformValues_shm_offset != 0) { | |
2161 unsigned int memory_size = 0; | |
2162 transform_values = GetSharedMemoryAndSizeAs<const GLfloat*>( | |
2163 c.transformValues_shm_id, c.transformValues_shm_offset, &memory_size); | |
2164 transform_values_bufsize = static_cast<GLsizei>(memory_size); | |
2165 } | |
2166 if (!transform_values) { | |
2167 return error::kOutOfBounds; | |
2168 } | |
2169 | |
2170 error::Error error = DoStencilFillPathInstancedCHROMIUM( | |
2171 num_paths, path_name_type, paths, paths_bufsize, path_base, fill_mode, | |
2172 mask, transform_type, transform_values, transform_values_bufsize); | |
2173 if (error != error::kNoError) { | |
2174 return error; | |
2175 } | |
2176 | |
2177 return error::kNoError; | |
2178 } | |
2179 | |
2180 error::Error | |
2181 GLES2DecoderPassthroughImpl::HandleStencilStrokePathInstancedCHROMIUM( | |
2182 uint32_t immediate_data_size, | |
2183 const void* cmd_data) { | |
2184 const gles2::cmds::StencilStrokePathInstancedCHROMIUM& c = | |
2185 *static_cast<const gles2::cmds::StencilStrokePathInstancedCHROMIUM*>( | |
2186 cmd_data); | |
2187 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
2188 GLenum path_name_type = static_cast<GLuint>(c.pathNameType); | |
2189 const GLvoid* paths = nullptr; | |
2190 GLsizei paths_bufsize = 0; | |
2191 if (num_paths > 0) { | |
2192 uint32_t paths_shm_id = static_cast<uint32_t>(c.paths_shm_id); | |
2193 uint32_t paths_shm_offset = static_cast<uint32_t>(c.paths_shm_offset); | |
2194 if (paths_shm_id != 0 || paths_shm_offset != 0) { | |
2195 unsigned int memory_size = 0; | |
2196 paths = GetSharedMemoryAndSizeAs<const GLvoid*>( | |
2197 paths_shm_id, paths_shm_offset, &memory_size); | |
2198 paths_bufsize = static_cast<GLsizei>(memory_size); | |
2199 } | |
2200 | |
2201 if (!paths) { | |
2202 return error::kOutOfBounds; | |
2203 } | |
2204 } | |
2205 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
2206 GLint reference = static_cast<GLint>(c.reference); | |
2207 GLuint mask = static_cast<GLuint>(c.mask); | |
2208 GLenum transform_type = static_cast<GLuint>(c.transformType); | |
2209 const GLfloat* transform_values = nullptr; | |
2210 GLsizei transform_values_bufsize = 0; | |
2211 if (c.transformValues_shm_id != 0 || c.transformValues_shm_offset != 0) { | |
2212 unsigned int memory_size = 0; | |
2213 transform_values = GetSharedMemoryAndSizeAs<const GLfloat*>( | |
2214 c.transformValues_shm_id, c.transformValues_shm_offset, &memory_size); | |
2215 transform_values_bufsize = static_cast<GLsizei>(memory_size); | |
2216 } | |
2217 if (!transform_values) { | |
2218 return error::kOutOfBounds; | |
2219 } | |
2220 | |
2221 error::Error error = DoStencilStrokePathInstancedCHROMIUM( | |
2222 num_paths, path_name_type, paths, paths_bufsize, path_base, reference, | |
2223 mask, transform_type, transform_values, transform_values_bufsize); | |
2224 if (error != error::kNoError) { | |
2225 return error; | |
2226 } | |
2227 | |
2228 return error::kNoError; | |
2229 } | |
2230 | |
2231 error::Error GLES2DecoderPassthroughImpl::HandleCoverFillPathInstancedCHROMIUM( | |
2232 uint32_t immediate_data_size, | |
2233 const void* cmd_data) { | |
2234 const gles2::cmds::CoverFillPathInstancedCHROMIUM& c = | |
2235 *static_cast<const gles2::cmds::CoverFillPathInstancedCHROMIUM*>( | |
2236 cmd_data); | |
2237 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
2238 GLenum path_name_type = static_cast<GLuint>(c.pathNameType); | |
2239 const GLvoid* paths = nullptr; | |
2240 GLsizei paths_bufsize = 0; | |
2241 if (num_paths > 0) { | |
2242 uint32_t paths_shm_id = static_cast<uint32_t>(c.paths_shm_id); | |
2243 uint32_t paths_shm_offset = static_cast<uint32_t>(c.paths_shm_offset); | |
2244 if (paths_shm_id != 0 || paths_shm_offset != 0) { | |
2245 unsigned int memory_size = 0; | |
2246 paths = GetSharedMemoryAndSizeAs<const GLvoid*>( | |
2247 paths_shm_id, paths_shm_offset, &memory_size); | |
2248 paths_bufsize = static_cast<GLsizei>(memory_size); | |
2249 } | |
2250 | |
2251 if (!paths) { | |
2252 return error::kOutOfBounds; | |
2253 } | |
2254 } | |
2255 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
2256 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
2257 GLenum transform_type = static_cast<GLuint>(c.transformType); | |
2258 const GLfloat* transform_values = nullptr; | |
2259 GLsizei transform_values_bufsize = 0; | |
2260 if (c.transformValues_shm_id != 0 || c.transformValues_shm_offset != 0) { | |
2261 unsigned int memory_size = 0; | |
2262 transform_values = GetSharedMemoryAndSizeAs<const GLfloat*>( | |
2263 c.transformValues_shm_id, c.transformValues_shm_offset, &memory_size); | |
2264 transform_values_bufsize = static_cast<GLsizei>(memory_size); | |
2265 } | |
2266 if (!transform_values) { | |
2267 return error::kOutOfBounds; | |
2268 } | |
2269 | |
2270 error::Error error = DoCoverFillPathInstancedCHROMIUM( | |
2271 num_paths, path_name_type, paths, paths_bufsize, path_base, cover_mode, | |
2272 transform_type, transform_values, transform_values_bufsize); | |
2273 if (error != error::kNoError) { | |
2274 return error; | |
2275 } | |
2276 | |
2277 return error::kNoError; | |
2278 } | |
2279 | |
2280 error::Error | |
2281 GLES2DecoderPassthroughImpl::HandleCoverStrokePathInstancedCHROMIUM( | |
2282 uint32_t immediate_data_size, | |
2283 const void* cmd_data) { | |
2284 const gles2::cmds::CoverStrokePathInstancedCHROMIUM& c = | |
2285 *static_cast<const gles2::cmds::CoverStrokePathInstancedCHROMIUM*>( | |
2286 cmd_data); | |
2287 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
2288 GLenum path_name_type = static_cast<GLuint>(c.pathNameType); | |
2289 const GLvoid* paths = nullptr; | |
2290 GLsizei paths_bufsize = 0; | |
2291 if (num_paths > 0) { | |
2292 uint32_t paths_shm_id = static_cast<uint32_t>(c.paths_shm_id); | |
2293 uint32_t paths_shm_offset = static_cast<uint32_t>(c.paths_shm_offset); | |
2294 if (paths_shm_id != 0 || paths_shm_offset != 0) { | |
2295 unsigned int memory_size = 0; | |
2296 paths = GetSharedMemoryAndSizeAs<const GLvoid*>( | |
2297 paths_shm_id, paths_shm_offset, &memory_size); | |
2298 paths_bufsize = static_cast<GLsizei>(memory_size); | |
2299 } | |
2300 | |
2301 if (!paths) { | |
2302 return error::kOutOfBounds; | |
2303 } | |
2304 } | |
2305 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
2306 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
2307 GLenum transform_type = static_cast<GLuint>(c.transformType); | |
2308 const GLfloat* transform_values = nullptr; | |
2309 GLsizei transform_values_bufsize = 0; | |
2310 if (c.transformValues_shm_id != 0 || c.transformValues_shm_offset != 0) { | |
2311 unsigned int memory_size = 0; | |
2312 transform_values = GetSharedMemoryAndSizeAs<const GLfloat*>( | |
2313 c.transformValues_shm_id, c.transformValues_shm_offset, &memory_size); | |
2314 transform_values_bufsize = static_cast<GLsizei>(memory_size); | |
2315 } | |
2316 if (!transform_values) { | |
2317 return error::kOutOfBounds; | |
2318 } | |
2319 | |
2320 error::Error error = DoCoverStrokePathInstancedCHROMIUM( | |
2321 num_paths, path_name_type, paths, paths_bufsize, path_base, cover_mode, | |
2322 transform_type, transform_values, transform_values_bufsize); | |
2323 if (error != error::kNoError) { | |
2324 return error; | |
2325 } | |
2326 | |
2327 return error::kNoError; | |
2328 } | |
2329 | |
2330 error::Error | |
2331 GLES2DecoderPassthroughImpl::HandleStencilThenCoverFillPathInstancedCHROMIUM( | |
2332 uint32_t immediate_data_size, | |
2333 const void* cmd_data) { | |
2334 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM& c = | |
2335 *static_cast< | |
2336 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM*>( | |
2337 cmd_data); | |
2338 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
2339 GLenum path_name_type = static_cast<GLuint>(c.pathNameType); | |
2340 const GLvoid* paths = nullptr; | |
2341 GLsizei paths_bufsize = 0; | |
2342 if (num_paths > 0) { | |
2343 uint32_t paths_shm_id = static_cast<uint32_t>(c.paths_shm_id); | |
2344 uint32_t paths_shm_offset = static_cast<uint32_t>(c.paths_shm_offset); | |
2345 if (paths_shm_id != 0 || paths_shm_offset != 0) { | |
2346 unsigned int memory_size = 0; | |
2347 paths = GetSharedMemoryAndSizeAs<const GLvoid*>( | |
2348 paths_shm_id, paths_shm_offset, &memory_size); | |
2349 paths_bufsize = static_cast<GLsizei>(memory_size); | |
2350 } | |
2351 | |
2352 if (!paths) { | |
2353 return error::kOutOfBounds; | |
2354 } | |
2355 } | |
2356 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
2357 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
2358 GLenum fill_mode = static_cast<GLenum>(c.fillMode); | |
2359 GLuint mask = static_cast<GLuint>(c.mask); | |
2360 GLenum transform_type = static_cast<GLuint>(c.transformType); | |
2361 const GLfloat* transform_values = nullptr; | |
2362 GLsizei transform_values_bufsize = 0; | |
2363 if (c.transformValues_shm_id != 0 || c.transformValues_shm_offset != 0) { | |
2364 unsigned int memory_size = 0; | |
2365 transform_values = GetSharedMemoryAndSizeAs<const GLfloat*>( | |
2366 c.transformValues_shm_id, c.transformValues_shm_offset, &memory_size); | |
2367 transform_values_bufsize = static_cast<GLsizei>(memory_size); | |
2368 } | |
2369 if (!transform_values) { | |
2370 return error::kOutOfBounds; | |
2371 } | |
2372 | |
2373 error::Error error = DoStencilThenCoverFillPathInstancedCHROMIUM( | |
2374 num_paths, path_name_type, paths, paths_bufsize, path_base, cover_mode, | |
2375 fill_mode, mask, transform_type, transform_values, | |
2376 transform_values_bufsize); | |
2377 if (error != error::kNoError) { | |
2378 return error; | |
2379 } | |
2380 | |
2381 return error::kNoError; | |
2382 } | |
2383 | |
2384 error::Error | |
2385 GLES2DecoderPassthroughImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM( | |
2386 uint32_t immediate_data_size, | |
2387 const void* cmd_data) { | |
2388 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c = | |
2389 *static_cast< | |
2390 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM*>( | |
2391 cmd_data); | |
2392 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
2393 GLenum path_name_type = static_cast<GLuint>(c.pathNameType); | |
2394 const GLvoid* paths = nullptr; | |
2395 GLsizei paths_bufsize = 0; | |
2396 if (num_paths > 0) { | |
2397 uint32_t paths_shm_id = static_cast<uint32_t>(c.paths_shm_id); | |
2398 uint32_t paths_shm_offset = static_cast<uint32_t>(c.paths_shm_offset); | |
2399 if (paths_shm_id != 0 || paths_shm_offset != 0) { | |
2400 unsigned int memory_size = 0; | |
2401 paths = GetSharedMemoryAndSizeAs<const GLvoid*>( | |
2402 paths_shm_id, paths_shm_offset, &memory_size); | |
2403 paths_bufsize = static_cast<GLsizei>(memory_size); | |
2404 } | |
2405 | |
2406 if (!paths) { | |
2407 return error::kOutOfBounds; | |
2408 } | |
2409 } | |
2410 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
2411 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
2412 GLint reference = static_cast<GLint>(c.reference); | |
2413 GLuint mask = static_cast<GLuint>(c.mask); | |
2414 GLenum transform_type = static_cast<GLuint>(c.transformType); | |
2415 const GLfloat* transform_values = nullptr; | |
2416 GLsizei transform_values_bufsize = 0; | |
2417 if (c.transformValues_shm_id != 0 || c.transformValues_shm_offset != 0) { | |
2418 unsigned int memory_size = 0; | |
2419 transform_values = GetSharedMemoryAndSizeAs<const GLfloat*>( | |
2420 c.transformValues_shm_id, c.transformValues_shm_offset, &memory_size); | |
2421 transform_values_bufsize = static_cast<GLsizei>(memory_size); | |
2422 } | |
2423 if (!transform_values) { | |
2424 return error::kOutOfBounds; | |
2425 } | |
2426 | |
2427 error::Error error = DoStencilThenCoverStrokePathInstancedCHROMIUM( | |
2428 num_paths, path_name_type, paths, paths_bufsize, path_base, cover_mode, | |
2429 reference, mask, transform_type, transform_values, | |
2430 transform_values_bufsize); | |
2431 if (error != error::kNoError) { | |
2432 return error; | |
2433 } | |
2434 | |
2435 return error::kNoError; | |
2436 } | |
2437 | |
2438 error::Error | |
2439 GLES2DecoderPassthroughImpl::HandleBindFragmentInputLocationCHROMIUMBucket( | |
2440 uint32_t immediate_data_size, | |
2441 const void* cmd_data) { | |
2442 const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket& c = | |
2443 *static_cast<const gles2::cmds::BindFragmentInputLocationCHROMIUMBucket*>( | |
2444 cmd_data); | |
2445 GLuint program = static_cast<GLuint>(c.program); | |
2446 GLint location = static_cast<GLint>(c.location); | |
2447 Bucket* bucket = GetBucket(c.name_bucket_id); | |
2448 if (!bucket || bucket->size() == 0) { | |
2449 return error::kInvalidArguments; | |
2450 } | |
2451 std::string name_str; | |
2452 if (!bucket->GetAsString(&name_str)) { | |
2453 return error::kInvalidArguments; | |
2454 } | |
2455 error::Error error = | |
2456 DoBindFragmentInputLocationCHROMIUM(program, location, name_str.c_str()); | |
2457 if (error != error::kNoError) { | |
2458 return error; | |
2459 } | |
2460 return error::kNoError; | |
2461 } | |
2462 | |
2463 error::Error | |
2464 GLES2DecoderPassthroughImpl::HandleProgramPathFragmentInputGenCHROMIUM( | |
2465 uint32_t immediate_data_size, | |
2466 const void* cmd_data) { | |
2467 const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM& c = | |
2468 *static_cast<const gles2::cmds::ProgramPathFragmentInputGenCHROMIUM*>( | |
2469 cmd_data); | |
2470 GLint program = static_cast<GLint>(c.program); | |
2471 GLint location = static_cast<GLint>(c.location); | |
2472 GLenum gen_mode = static_cast<GLint>(c.genMode); | |
2473 GLint components = static_cast<GLint>(c.components); | |
2474 const GLfloat* coeffs = nullptr; | |
2475 GLsizei coeffs_bufsize = 0; | |
2476 if (c.coeffs_shm_id != 0 || c.coeffs_shm_offset != 0) { | |
2477 unsigned int memory_size = 0; | |
2478 coeffs = GetSharedMemoryAndSizeAs<const GLfloat*>( | |
2479 c.coeffs_shm_id, c.coeffs_shm_offset, &memory_size); | |
2480 coeffs_bufsize = static_cast<GLsizei>(memory_size); | |
2481 } | |
2482 if (!coeffs) { | |
2483 return error::kOutOfBounds; | |
2484 } | |
2485 error::Error error = DoProgramPathFragmentInputGenCHROMIUM( | |
2486 program, location, gen_mode, components, coeffs, coeffs_bufsize); | |
2487 if (error != error::kNoError) { | |
2488 return error; | |
2489 } | |
2490 return error::kNoError; | |
2491 } | |
piman
2016/06/03 04:23:37
nit: blank line between functions
Geoff Lang
2016/06/03 13:33:13
Done, and the rest in this file.
| |
2492 error::Error | |
2493 GLES2DecoderPassthroughImpl::HandleBindFragDataLocationIndexedEXTBucket( | |
2494 uint32_t immediate_data_size, | |
2495 const void* cmd_data) { | |
2496 const gles2::cmds::BindFragDataLocationIndexedEXTBucket& c = | |
2497 *static_cast<const gles2::cmds::BindFragDataLocationIndexedEXTBucket*>( | |
2498 cmd_data); | |
2499 GLuint program = static_cast<GLuint>(c.program); | |
2500 GLuint colorNumber = static_cast<GLuint>(c.colorNumber); | |
2501 GLuint index = static_cast<GLuint>(c.index); | |
2502 Bucket* bucket = GetBucket(c.name_bucket_id); | |
2503 if (!bucket || bucket->size() == 0) { | |
2504 return error::kInvalidArguments; | |
2505 } | |
2506 std::string name_str; | |
2507 if (!bucket->GetAsString(&name_str)) { | |
2508 return error::kInvalidArguments; | |
2509 } | |
2510 error::Error error = DoBindFragDataLocationIndexedEXT( | |
2511 program, colorNumber, index, name_str.c_str()); | |
2512 if (error != error::kNoError) { | |
2513 return error; | |
2514 } | |
2515 return error::kNoError; | |
2516 } | |
piman
2016/06/03 04:23:37
nit: blank line between functions
| |
2517 error::Error GLES2DecoderPassthroughImpl::HandleBindFragDataLocationEXTBucket( | |
2518 uint32_t immediate_data_size, | |
2519 const void* cmd_data) { | |
2520 const gles2::cmds::BindFragDataLocationEXTBucket& c = | |
2521 *static_cast<const gles2::cmds::BindFragDataLocationEXTBucket*>(cmd_data); | |
2522 GLuint program = static_cast<GLuint>(c.program); | |
2523 GLuint colorNumber = static_cast<GLuint>(c.colorNumber); | |
2524 Bucket* bucket = GetBucket(c.name_bucket_id); | |
2525 if (!bucket || bucket->size() == 0) { | |
2526 return error::kInvalidArguments; | |
2527 } | |
2528 std::string name_str; | |
2529 if (!bucket->GetAsString(&name_str)) { | |
2530 return error::kInvalidArguments; | |
2531 } | |
2532 error::Error error = | |
2533 DoBindFragDataLocationEXT(program, colorNumber, name_str.c_str()); | |
2534 if (error != error::kNoError) { | |
2535 return error; | |
2536 } | |
2537 return error::kNoError; | |
2538 } | |
piman
2016/06/03 04:23:37
nit: blank line between functions
| |
2539 error::Error GLES2DecoderPassthroughImpl::HandleGetFragDataIndexEXT( | |
2540 uint32_t immediate_data_size, | |
2541 const void* cmd_data) { | |
2542 const gles2::cmds::GetFragDataIndexEXT& c = | |
2543 *static_cast<const gles2::cmds::GetFragDataIndexEXT*>(cmd_data); | |
2544 GLuint program = static_cast<GLuint>(c.program); | |
2545 Bucket* bucket = GetBucket(c.name_bucket_id); | |
2546 if (!bucket) { | |
2547 return error::kInvalidArguments; | |
2548 } | |
2549 std::string name_str; | |
2550 if (!bucket->GetAsString(&name_str)) { | |
2551 return error::kInvalidArguments; | |
2552 } | |
2553 GLint* index = GetSharedMemoryAs<GLint*>(c.index_shm_id, c.index_shm_offset, | |
2554 sizeof(GLint)); | |
2555 if (!index) { | |
2556 return error::kOutOfBounds; | |
2557 } | |
2558 // Check that the client initialized the result. | |
2559 if (*index != -1) { | |
2560 return error::kInvalidArguments; | |
2561 } | |
2562 error::Error error = DoGetFragDataIndexEXT(program, name_str.c_str(), index); | |
2563 if (error != error::kNoError) { | |
2564 return error; | |
2565 } | |
2566 return error::kNoError; | |
2567 } | |
2568 | |
2569 } // namespace gles2 | |
2570 } // namespace gpu | |
OLD | NEW |