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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_autogen.h

Issue 1747013: Changes the code to use separate ids namspaces... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file is auto-generated. DO NOT EDIT! 5 // This file is auto-generated. DO NOT EDIT!
6 6
7 // It is included by gles2_cmd_decoder.cc 7 // It is included by gles2_cmd_decoder.cc
8 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ 8 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_
9 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ 9 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_
10 10
11 error::Error GLES2DecoderImpl::HandleActiveTexture( 11 error::Error GLES2DecoderImpl::HandleActiveTexture(
12 uint32 immediate_data_size, const gles2::ActiveTexture& c) { 12 uint32 immediate_data_size, const gles2::ActiveTexture& c) {
13 GLenum texture = static_cast<GLenum>(c.texture); 13 GLenum texture = static_cast<GLenum>(c.texture);
14 DoActiveTexture(texture); 14 DoActiveTexture(texture);
15 return error::kNoError; 15 return error::kNoError;
16 } 16 }
17 17
18 error::Error GLES2DecoderImpl::HandleAttachShader( 18 error::Error GLES2DecoderImpl::HandleAttachShader(
19 uint32 immediate_data_size, const gles2::AttachShader& c) { 19 uint32 immediate_data_size, const gles2::AttachShader& c) {
20 GLuint program; 20 GLuint program = c.program;
21 if (!id_manager()->GetServiceId(c.program, &program)) { 21 GLuint shader = c.shader;
22 SetGLError(GL_INVALID_VALUE); 22 DoAttachShader(program, shader);
23 return error::kNoError;
24 }
25 GLuint shader;
26 if (!id_manager()->GetServiceId(c.shader, &shader)) {
27 SetGLError(GL_INVALID_VALUE);
28 return error::kNoError;
29 }
30 glAttachShader(program, shader);
31 return error::kNoError; 23 return error::kNoError;
32 } 24 }
33 25
34 error::Error GLES2DecoderImpl::HandleBindBuffer( 26 error::Error GLES2DecoderImpl::HandleBindBuffer(
35 uint32 immediate_data_size, const gles2::BindBuffer& c) { 27 uint32 immediate_data_size, const gles2::BindBuffer& c) {
36 GLenum target = static_cast<GLenum>(c.target); 28 GLenum target = static_cast<GLenum>(c.target);
37 GLuint buffer = c.buffer; 29 GLuint buffer = c.buffer;
38 if (!ValidateGLenumBufferTarget(target)) { 30 if (!ValidateGLenumBufferTarget(target)) {
39 SetGLError(GL_INVALID_ENUM); 31 SetGLError(GL_INVALID_ENUM);
40 return error::kNoError; 32 return error::kNoError;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 GLboolean red = static_cast<GLboolean>(c.red); 249 GLboolean red = static_cast<GLboolean>(c.red);
258 GLboolean green = static_cast<GLboolean>(c.green); 250 GLboolean green = static_cast<GLboolean>(c.green);
259 GLboolean blue = static_cast<GLboolean>(c.blue); 251 GLboolean blue = static_cast<GLboolean>(c.blue);
260 GLboolean alpha = static_cast<GLboolean>(c.alpha); 252 GLboolean alpha = static_cast<GLboolean>(c.alpha);
261 glColorMask(red, green, blue, alpha); 253 glColorMask(red, green, blue, alpha);
262 return error::kNoError; 254 return error::kNoError;
263 } 255 }
264 256
265 error::Error GLES2DecoderImpl::HandleCompileShader( 257 error::Error GLES2DecoderImpl::HandleCompileShader(
266 uint32 immediate_data_size, const gles2::CompileShader& c) { 258 uint32 immediate_data_size, const gles2::CompileShader& c) {
267 GLuint shader; 259 GLuint shader = c.shader;
268 if (!id_manager()->GetServiceId(c.shader, &shader)) {
269 SetGLError(GL_INVALID_VALUE);
270 return error::kNoError;
271 }
272 DoCompileShader(shader); 260 DoCompileShader(shader);
273 return error::kNoError; 261 return error::kNoError;
274 } 262 }
275 263
276 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2D( 264 error::Error GLES2DecoderImpl::HandleCompressedTexSubImage2D(
277 uint32 immediate_data_size, const gles2::CompressedTexSubImage2D& c) { 265 uint32 immediate_data_size, const gles2::CompressedTexSubImage2D& c) {
278 GLenum target = static_cast<GLenum>(c.target); 266 GLenum target = static_cast<GLenum>(c.target);
279 GLint level = static_cast<GLint>(c.level); 267 GLint level = static_cast<GLint>(c.level);
280 GLint xoffset = static_cast<GLint>(c.xoffset); 268 GLint xoffset = static_cast<GLint>(c.xoffset);
281 GLint yoffset = static_cast<GLint>(c.yoffset); 269 GLint yoffset = static_cast<GLint>(c.yoffset);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 SetGLError(GL_INVALID_VALUE); 384 SetGLError(GL_INVALID_VALUE);
397 return error::kNoError; 385 return error::kNoError;
398 } 386 }
399 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); 387 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
400 return error::kNoError; 388 return error::kNoError;
401 } 389 }
402 390
403 error::Error GLES2DecoderImpl::HandleCreateProgram( 391 error::Error GLES2DecoderImpl::HandleCreateProgram(
404 uint32 immediate_data_size, const gles2::CreateProgram& c) { 392 uint32 immediate_data_size, const gles2::CreateProgram& c) {
405 uint32 client_id = c.client_id; 393 uint32 client_id = c.client_id;
406 CreateProgramHelper(client_id); 394 if (!CreateProgramHelper(client_id)) {
395 return error::kInvalidArguments;
396 }
407 return error::kNoError; 397 return error::kNoError;
408 } 398 }
409 399
410 error::Error GLES2DecoderImpl::HandleCreateShader( 400 error::Error GLES2DecoderImpl::HandleCreateShader(
411 uint32 immediate_data_size, const gles2::CreateShader& c) { 401 uint32 immediate_data_size, const gles2::CreateShader& c) {
412 GLenum type = static_cast<GLenum>(c.type); 402 GLenum type = static_cast<GLenum>(c.type);
413 if (!ValidateGLenumShaderType(type)) { 403 if (!ValidateGLenumShaderType(type)) {
414 SetGLError(GL_INVALID_ENUM); 404 SetGLError(GL_INVALID_ENUM);
415 return error::kNoError; 405 return error::kNoError;
416 } 406 }
417 uint32 client_id = c.client_id; 407 uint32 client_id = c.client_id;
418 CreateShaderHelper(type, client_id); 408 if (!CreateShaderHelper(type, client_id)) {
409 return error::kInvalidArguments;
410 }
419 return error::kNoError; 411 return error::kNoError;
420 } 412 }
421 413
422 error::Error GLES2DecoderImpl::HandleCullFace( 414 error::Error GLES2DecoderImpl::HandleCullFace(
423 uint32 immediate_data_size, const gles2::CullFace& c) { 415 uint32 immediate_data_size, const gles2::CullFace& c) {
424 GLenum mode = static_cast<GLenum>(c.mode); 416 GLenum mode = static_cast<GLenum>(c.mode);
425 if (!ValidateGLenumFaceType(mode)) { 417 if (!ValidateGLenumFaceType(mode)) {
426 SetGLError(GL_INVALID_ENUM); 418 SetGLError(GL_INVALID_ENUM);
427 return error::kNoError; 419 return error::kNoError;
428 } 420 }
(...skipping 10 matching lines...) Expand all
439 } 431 }
440 const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( 432 const GLuint* buffers = GetSharedMemoryAs<const GLuint*>(
441 c.buffers_shm_id, c.buffers_shm_offset, data_size); 433 c.buffers_shm_id, c.buffers_shm_offset, data_size);
442 if (n < 0) { 434 if (n < 0) {
443 SetGLError(GL_INVALID_VALUE); 435 SetGLError(GL_INVALID_VALUE);
444 return error::kNoError; 436 return error::kNoError;
445 } 437 }
446 if (buffers == NULL) { 438 if (buffers == NULL) {
447 return error::kOutOfBounds; 439 return error::kOutOfBounds;
448 } 440 }
449 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); 441 DeleteBuffersHelper(n, buffers);
450 return error::kNoError; 442 return error::kNoError;
451 } 443 }
452 444
453 error::Error GLES2DecoderImpl::HandleDeleteBuffersImmediate( 445 error::Error GLES2DecoderImpl::HandleDeleteBuffersImmediate(
454 uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) { 446 uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) {
455 GLsizei n = static_cast<GLsizei>(c.n); 447 GLsizei n = static_cast<GLsizei>(c.n);
456 uint32 data_size; 448 uint32 data_size;
457 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 449 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
458 return error::kOutOfBounds; 450 return error::kOutOfBounds;
459 } 451 }
460 const GLuint* buffers = GetImmediateDataAs<const GLuint*>( 452 const GLuint* buffers = GetImmediateDataAs<const GLuint*>(
461 c, data_size, immediate_data_size); 453 c, data_size, immediate_data_size);
462 if (n < 0) { 454 if (n < 0) {
463 SetGLError(GL_INVALID_VALUE); 455 SetGLError(GL_INVALID_VALUE);
464 return error::kNoError; 456 return error::kNoError;
465 } 457 }
466 if (buffers == NULL) { 458 if (buffers == NULL) {
467 return error::kOutOfBounds; 459 return error::kOutOfBounds;
468 } 460 }
469 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); 461 DeleteBuffersHelper(n, buffers);
470 return error::kNoError; 462 return error::kNoError;
471 } 463 }
472 464
473 error::Error GLES2DecoderImpl::HandleDeleteFramebuffers( 465 error::Error GLES2DecoderImpl::HandleDeleteFramebuffers(
474 uint32 immediate_data_size, const gles2::DeleteFramebuffers& c) { 466 uint32 immediate_data_size, const gles2::DeleteFramebuffers& c) {
475 GLsizei n = static_cast<GLsizei>(c.n); 467 GLsizei n = static_cast<GLsizei>(c.n);
476 uint32 data_size; 468 uint32 data_size;
477 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 469 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
478 return error::kOutOfBounds; 470 return error::kOutOfBounds;
479 } 471 }
480 const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( 472 const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>(
481 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size); 473 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size);
482 if (n < 0) { 474 if (n < 0) {
483 SetGLError(GL_INVALID_VALUE); 475 SetGLError(GL_INVALID_VALUE);
484 return error::kNoError; 476 return error::kNoError;
485 } 477 }
486 if (framebuffers == NULL) { 478 if (framebuffers == NULL) {
487 return error::kOutOfBounds; 479 return error::kOutOfBounds;
488 } 480 }
489 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); 481 DeleteFramebuffersHelper(n, framebuffers);
490 return error::kNoError; 482 return error::kNoError;
491 } 483 }
492 484
493 error::Error GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( 485 error::Error GLES2DecoderImpl::HandleDeleteFramebuffersImmediate(
494 uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) { 486 uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) {
495 GLsizei n = static_cast<GLsizei>(c.n); 487 GLsizei n = static_cast<GLsizei>(c.n);
496 uint32 data_size; 488 uint32 data_size;
497 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 489 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
498 return error::kOutOfBounds; 490 return error::kOutOfBounds;
499 } 491 }
500 const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>( 492 const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(
501 c, data_size, immediate_data_size); 493 c, data_size, immediate_data_size);
502 if (n < 0) { 494 if (n < 0) {
503 SetGLError(GL_INVALID_VALUE); 495 SetGLError(GL_INVALID_VALUE);
504 return error::kNoError; 496 return error::kNoError;
505 } 497 }
506 if (framebuffers == NULL) { 498 if (framebuffers == NULL) {
507 return error::kOutOfBounds; 499 return error::kOutOfBounds;
508 } 500 }
509 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); 501 DeleteFramebuffersHelper(n, framebuffers);
510 return error::kNoError; 502 return error::kNoError;
511 } 503 }
512 504
513 error::Error GLES2DecoderImpl::HandleDeleteRenderbuffers( 505 error::Error GLES2DecoderImpl::HandleDeleteRenderbuffers(
514 uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) { 506 uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) {
515 GLsizei n = static_cast<GLsizei>(c.n); 507 GLsizei n = static_cast<GLsizei>(c.n);
516 uint32 data_size; 508 uint32 data_size;
517 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 509 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
518 return error::kOutOfBounds; 510 return error::kOutOfBounds;
519 } 511 }
520 const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( 512 const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>(
521 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size); 513 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size);
522 if (n < 0) { 514 if (n < 0) {
523 SetGLError(GL_INVALID_VALUE); 515 SetGLError(GL_INVALID_VALUE);
524 return error::kNoError; 516 return error::kNoError;
525 } 517 }
526 if (renderbuffers == NULL) { 518 if (renderbuffers == NULL) {
527 return error::kOutOfBounds; 519 return error::kOutOfBounds;
528 } 520 }
529 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); 521 DeleteRenderbuffersHelper(n, renderbuffers);
530 return error::kNoError; 522 return error::kNoError;
531 } 523 }
532 524
533 error::Error GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( 525 error::Error GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate(
534 uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) { 526 uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) {
535 GLsizei n = static_cast<GLsizei>(c.n); 527 GLsizei n = static_cast<GLsizei>(c.n);
536 uint32 data_size; 528 uint32 data_size;
537 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 529 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
538 return error::kOutOfBounds; 530 return error::kOutOfBounds;
539 } 531 }
540 const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>( 532 const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(
541 c, data_size, immediate_data_size); 533 c, data_size, immediate_data_size);
542 if (n < 0) { 534 if (n < 0) {
543 SetGLError(GL_INVALID_VALUE); 535 SetGLError(GL_INVALID_VALUE);
544 return error::kNoError; 536 return error::kNoError;
545 } 537 }
546 if (renderbuffers == NULL) { 538 if (renderbuffers == NULL) {
547 return error::kOutOfBounds; 539 return error::kOutOfBounds;
548 } 540 }
549 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); 541 DeleteRenderbuffersHelper(n, renderbuffers);
550 return error::kNoError; 542 return error::kNoError;
551 } 543 }
552 544
553 error::Error GLES2DecoderImpl::HandleDeleteTextures( 545 error::Error GLES2DecoderImpl::HandleDeleteTextures(
554 uint32 immediate_data_size, const gles2::DeleteTextures& c) { 546 uint32 immediate_data_size, const gles2::DeleteTextures& c) {
555 GLsizei n = static_cast<GLsizei>(c.n); 547 GLsizei n = static_cast<GLsizei>(c.n);
556 uint32 data_size; 548 uint32 data_size;
557 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 549 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
558 return error::kOutOfBounds; 550 return error::kOutOfBounds;
559 } 551 }
560 const GLuint* textures = GetSharedMemoryAs<const GLuint*>( 552 const GLuint* textures = GetSharedMemoryAs<const GLuint*>(
561 c.textures_shm_id, c.textures_shm_offset, data_size); 553 c.textures_shm_id, c.textures_shm_offset, data_size);
562 if (n < 0) { 554 if (n < 0) {
563 SetGLError(GL_INVALID_VALUE); 555 SetGLError(GL_INVALID_VALUE);
564 return error::kNoError; 556 return error::kNoError;
565 } 557 }
566 if (textures == NULL) { 558 if (textures == NULL) {
567 return error::kOutOfBounds; 559 return error::kOutOfBounds;
568 } 560 }
569 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); 561 DeleteTexturesHelper(n, textures);
570 return error::kNoError; 562 return error::kNoError;
571 } 563 }
572 564
573 error::Error GLES2DecoderImpl::HandleDeleteTexturesImmediate( 565 error::Error GLES2DecoderImpl::HandleDeleteTexturesImmediate(
574 uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) { 566 uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) {
575 GLsizei n = static_cast<GLsizei>(c.n); 567 GLsizei n = static_cast<GLsizei>(c.n);
576 uint32 data_size; 568 uint32 data_size;
577 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 569 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
578 return error::kOutOfBounds; 570 return error::kOutOfBounds;
579 } 571 }
580 const GLuint* textures = GetImmediateDataAs<const GLuint*>( 572 const GLuint* textures = GetImmediateDataAs<const GLuint*>(
581 c, data_size, immediate_data_size); 573 c, data_size, immediate_data_size);
582 if (n < 0) { 574 if (n < 0) {
583 SetGLError(GL_INVALID_VALUE); 575 SetGLError(GL_INVALID_VALUE);
584 return error::kNoError; 576 return error::kNoError;
585 } 577 }
586 if (textures == NULL) { 578 if (textures == NULL) {
587 return error::kOutOfBounds; 579 return error::kOutOfBounds;
588 } 580 }
589 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); 581 DeleteTexturesHelper(n, textures);
590 return error::kNoError; 582 return error::kNoError;
591 } 583 }
592 584
593 error::Error GLES2DecoderImpl::HandleDepthFunc( 585 error::Error GLES2DecoderImpl::HandleDepthFunc(
594 uint32 immediate_data_size, const gles2::DepthFunc& c) { 586 uint32 immediate_data_size, const gles2::DepthFunc& c) {
595 GLenum func = static_cast<GLenum>(c.func); 587 GLenum func = static_cast<GLenum>(c.func);
596 if (!ValidateGLenumCmpFunction(func)) { 588 if (!ValidateGLenumCmpFunction(func)) {
597 SetGLError(GL_INVALID_ENUM); 589 SetGLError(GL_INVALID_ENUM);
598 return error::kNoError; 590 return error::kNoError;
599 } 591 }
(...skipping 11 matching lines...) Expand all
611 error::Error GLES2DecoderImpl::HandleDepthRangef( 603 error::Error GLES2DecoderImpl::HandleDepthRangef(
612 uint32 immediate_data_size, const gles2::DepthRangef& c) { 604 uint32 immediate_data_size, const gles2::DepthRangef& c) {
613 GLclampf zNear = static_cast<GLclampf>(c.zNear); 605 GLclampf zNear = static_cast<GLclampf>(c.zNear);
614 GLclampf zFar = static_cast<GLclampf>(c.zFar); 606 GLclampf zFar = static_cast<GLclampf>(c.zFar);
615 glDepthRange(zNear, zFar); 607 glDepthRange(zNear, zFar);
616 return error::kNoError; 608 return error::kNoError;
617 } 609 }
618 610
619 error::Error GLES2DecoderImpl::HandleDetachShader( 611 error::Error GLES2DecoderImpl::HandleDetachShader(
620 uint32 immediate_data_size, const gles2::DetachShader& c) { 612 uint32 immediate_data_size, const gles2::DetachShader& c) {
621 GLuint program; 613 GLuint program = c.program;
622 if (!id_manager()->GetServiceId(c.program, &program)) { 614 GLuint shader = c.shader;
623 SetGLError(GL_INVALID_VALUE); 615 DoDetachShader(program, shader);
624 return error::kNoError;
625 }
626 GLuint shader;
627 if (!id_manager()->GetServiceId(c.shader, &shader)) {
628 SetGLError(GL_INVALID_VALUE);
629 return error::kNoError;
630 }
631 glDetachShader(program, shader);
632 return error::kNoError; 616 return error::kNoError;
633 } 617 }
634 618
635 error::Error GLES2DecoderImpl::HandleDisable( 619 error::Error GLES2DecoderImpl::HandleDisable(
636 uint32 immediate_data_size, const gles2::Disable& c) { 620 uint32 immediate_data_size, const gles2::Disable& c) {
637 GLenum cap = static_cast<GLenum>(c.cap); 621 GLenum cap = static_cast<GLenum>(c.cap);
638 if (!ValidateGLenumCapability(cap)) { 622 if (!ValidateGLenumCapability(cap)) {
639 SetGLError(GL_INVALID_ENUM); 623 SetGLError(GL_INVALID_ENUM);
640 return error::kNoError; 624 return error::kNoError;
641 } 625 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 uint32 immediate_data_size, const gles2::Flush& c) { 679 uint32 immediate_data_size, const gles2::Flush& c) {
696 glFlush(); 680 glFlush();
697 return error::kNoError; 681 return error::kNoError;
698 } 682 }
699 683
700 error::Error GLES2DecoderImpl::HandleFramebufferRenderbuffer( 684 error::Error GLES2DecoderImpl::HandleFramebufferRenderbuffer(
701 uint32 immediate_data_size, const gles2::FramebufferRenderbuffer& c) { 685 uint32 immediate_data_size, const gles2::FramebufferRenderbuffer& c) {
702 GLenum target = static_cast<GLenum>(c.target); 686 GLenum target = static_cast<GLenum>(c.target);
703 GLenum attachment = static_cast<GLenum>(c.attachment); 687 GLenum attachment = static_cast<GLenum>(c.attachment);
704 GLenum renderbuffertarget = static_cast<GLenum>(c.renderbuffertarget); 688 GLenum renderbuffertarget = static_cast<GLenum>(c.renderbuffertarget);
705 GLuint renderbuffer; 689 GLuint renderbuffer = c.renderbuffer;
706 if (!id_manager()->GetServiceId(c.renderbuffer, &renderbuffer)) {
707 SetGLError(GL_INVALID_VALUE);
708 return error::kNoError;
709 }
710 if (!ValidateGLenumFrameBufferTarget(target)) { 690 if (!ValidateGLenumFrameBufferTarget(target)) {
711 SetGLError(GL_INVALID_ENUM); 691 SetGLError(GL_INVALID_ENUM);
712 return error::kNoError; 692 return error::kNoError;
713 } 693 }
714 if (!ValidateGLenumAttachment(attachment)) { 694 if (!ValidateGLenumAttachment(attachment)) {
715 SetGLError(GL_INVALID_ENUM); 695 SetGLError(GL_INVALID_ENUM);
716 return error::kNoError; 696 return error::kNoError;
717 } 697 }
718 if (!ValidateGLenumRenderBufferTarget(renderbuffertarget)) { 698 if (!ValidateGLenumRenderBufferTarget(renderbuffertarget)) {
719 SetGLError(GL_INVALID_ENUM); 699 SetGLError(GL_INVALID_ENUM);
720 return error::kNoError; 700 return error::kNoError;
721 } 701 }
722 DoFramebufferRenderbuffer( 702 DoFramebufferRenderbuffer(
723 target, attachment, renderbuffertarget, renderbuffer); 703 target, attachment, renderbuffertarget, renderbuffer);
724 return error::kNoError; 704 return error::kNoError;
725 } 705 }
726 706
727 error::Error GLES2DecoderImpl::HandleFramebufferTexture2D( 707 error::Error GLES2DecoderImpl::HandleFramebufferTexture2D(
728 uint32 immediate_data_size, const gles2::FramebufferTexture2D& c) { 708 uint32 immediate_data_size, const gles2::FramebufferTexture2D& c) {
729 GLenum target = static_cast<GLenum>(c.target); 709 GLenum target = static_cast<GLenum>(c.target);
730 GLenum attachment = static_cast<GLenum>(c.attachment); 710 GLenum attachment = static_cast<GLenum>(c.attachment);
731 GLenum textarget = static_cast<GLenum>(c.textarget); 711 GLenum textarget = static_cast<GLenum>(c.textarget);
732 GLuint texture; 712 GLuint texture = c.texture;
733 if (!id_manager()->GetServiceId(c.texture, &texture)) {
734 SetGLError(GL_INVALID_VALUE);
735 return error::kNoError;
736 }
737 GLint level = static_cast<GLint>(c.level); 713 GLint level = static_cast<GLint>(c.level);
738 if (!ValidateGLenumFrameBufferTarget(target)) { 714 if (!ValidateGLenumFrameBufferTarget(target)) {
739 SetGLError(GL_INVALID_ENUM); 715 SetGLError(GL_INVALID_ENUM);
740 return error::kNoError; 716 return error::kNoError;
741 } 717 }
742 if (!ValidateGLenumAttachment(attachment)) { 718 if (!ValidateGLenumAttachment(attachment)) {
743 SetGLError(GL_INVALID_ENUM); 719 SetGLError(GL_INVALID_ENUM);
744 return error::kNoError; 720 return error::kNoError;
745 } 721 }
746 if (!ValidateGLenumTextureTarget(textarget)) { 722 if (!ValidateGLenumTextureTarget(textarget)) {
(...skipping 24 matching lines...) Expand all
771 } 747 }
772 GLuint* buffers = GetSharedMemoryAs<GLuint*>( 748 GLuint* buffers = GetSharedMemoryAs<GLuint*>(
773 c.buffers_shm_id, c.buffers_shm_offset, data_size); 749 c.buffers_shm_id, c.buffers_shm_offset, data_size);
774 if (n < 0) { 750 if (n < 0) {
775 SetGLError(GL_INVALID_VALUE); 751 SetGLError(GL_INVALID_VALUE);
776 return error::kNoError; 752 return error::kNoError;
777 } 753 }
778 if (buffers == NULL) { 754 if (buffers == NULL) {
779 return error::kOutOfBounds; 755 return error::kOutOfBounds;
780 } 756 }
781 if (!GenGLObjects<GLGenBuffersHelper>(n, buffers)) { 757 if (!GenBuffersHelper(n, buffers)) {
782 return error::kInvalidArguments; 758 return error::kInvalidArguments;
783 } 759 }
784 return error::kNoError; 760 return error::kNoError;
785 } 761 }
786 762
787 error::Error GLES2DecoderImpl::HandleGenBuffersImmediate( 763 error::Error GLES2DecoderImpl::HandleGenBuffersImmediate(
788 uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) { 764 uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) {
789 GLsizei n = static_cast<GLsizei>(c.n); 765 GLsizei n = static_cast<GLsizei>(c.n);
790 uint32 data_size; 766 uint32 data_size;
791 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 767 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
792 return error::kOutOfBounds; 768 return error::kOutOfBounds;
793 } 769 }
794 GLuint* buffers = GetImmediateDataAs<GLuint*>( 770 GLuint* buffers = GetImmediateDataAs<GLuint*>(
795 c, data_size, immediate_data_size); 771 c, data_size, immediate_data_size);
796 if (n < 0) { 772 if (n < 0) {
797 SetGLError(GL_INVALID_VALUE); 773 SetGLError(GL_INVALID_VALUE);
798 return error::kNoError; 774 return error::kNoError;
799 } 775 }
800 if (buffers == NULL) { 776 if (buffers == NULL) {
801 return error::kOutOfBounds; 777 return error::kOutOfBounds;
802 } 778 }
803 if (!GenGLObjects<GLGenBuffersHelper>(n, buffers)) { 779 if (!GenBuffersHelper(n, buffers)) {
804 return error::kInvalidArguments; 780 return error::kInvalidArguments;
805 } 781 }
806 return error::kNoError; 782 return error::kNoError;
807 } 783 }
808 784
809 error::Error GLES2DecoderImpl::HandleGenerateMipmap( 785 error::Error GLES2DecoderImpl::HandleGenerateMipmap(
810 uint32 immediate_data_size, const gles2::GenerateMipmap& c) { 786 uint32 immediate_data_size, const gles2::GenerateMipmap& c) {
811 GLenum target = static_cast<GLenum>(c.target); 787 GLenum target = static_cast<GLenum>(c.target);
812 if (!ValidateGLenumTextureBindTarget(target)) { 788 if (!ValidateGLenumTextureBindTarget(target)) {
813 SetGLError(GL_INVALID_ENUM); 789 SetGLError(GL_INVALID_ENUM);
(...skipping 12 matching lines...) Expand all
826 } 802 }
827 GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( 803 GLuint* framebuffers = GetSharedMemoryAs<GLuint*>(
828 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size); 804 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size);
829 if (n < 0) { 805 if (n < 0) {
830 SetGLError(GL_INVALID_VALUE); 806 SetGLError(GL_INVALID_VALUE);
831 return error::kNoError; 807 return error::kNoError;
832 } 808 }
833 if (framebuffers == NULL) { 809 if (framebuffers == NULL) {
834 return error::kOutOfBounds; 810 return error::kOutOfBounds;
835 } 811 }
836 if (!GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers)) { 812 if (!GenFramebuffersHelper(n, framebuffers)) {
837 return error::kInvalidArguments; 813 return error::kInvalidArguments;
838 } 814 }
839 return error::kNoError; 815 return error::kNoError;
840 } 816 }
841 817
842 error::Error GLES2DecoderImpl::HandleGenFramebuffersImmediate( 818 error::Error GLES2DecoderImpl::HandleGenFramebuffersImmediate(
843 uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) { 819 uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) {
844 GLsizei n = static_cast<GLsizei>(c.n); 820 GLsizei n = static_cast<GLsizei>(c.n);
845 uint32 data_size; 821 uint32 data_size;
846 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 822 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
847 return error::kOutOfBounds; 823 return error::kOutOfBounds;
848 } 824 }
849 GLuint* framebuffers = GetImmediateDataAs<GLuint*>( 825 GLuint* framebuffers = GetImmediateDataAs<GLuint*>(
850 c, data_size, immediate_data_size); 826 c, data_size, immediate_data_size);
851 if (n < 0) { 827 if (n < 0) {
852 SetGLError(GL_INVALID_VALUE); 828 SetGLError(GL_INVALID_VALUE);
853 return error::kNoError; 829 return error::kNoError;
854 } 830 }
855 if (framebuffers == NULL) { 831 if (framebuffers == NULL) {
856 return error::kOutOfBounds; 832 return error::kOutOfBounds;
857 } 833 }
858 if (!GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers)) { 834 if (!GenFramebuffersHelper(n, framebuffers)) {
859 return error::kInvalidArguments; 835 return error::kInvalidArguments;
860 } 836 }
861 return error::kNoError; 837 return error::kNoError;
862 } 838 }
863 839
864 error::Error GLES2DecoderImpl::HandleGenRenderbuffers( 840 error::Error GLES2DecoderImpl::HandleGenRenderbuffers(
865 uint32 immediate_data_size, const gles2::GenRenderbuffers& c) { 841 uint32 immediate_data_size, const gles2::GenRenderbuffers& c) {
866 GLsizei n = static_cast<GLsizei>(c.n); 842 GLsizei n = static_cast<GLsizei>(c.n);
867 uint32 data_size; 843 uint32 data_size;
868 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 844 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
869 return error::kOutOfBounds; 845 return error::kOutOfBounds;
870 } 846 }
871 GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( 847 GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>(
872 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size); 848 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size);
873 if (n < 0) { 849 if (n < 0) {
874 SetGLError(GL_INVALID_VALUE); 850 SetGLError(GL_INVALID_VALUE);
875 return error::kNoError; 851 return error::kNoError;
876 } 852 }
877 if (renderbuffers == NULL) { 853 if (renderbuffers == NULL) {
878 return error::kOutOfBounds; 854 return error::kOutOfBounds;
879 } 855 }
880 if (!GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers)) { 856 if (!GenRenderbuffersHelper(n, renderbuffers)) {
881 return error::kInvalidArguments; 857 return error::kInvalidArguments;
882 } 858 }
883 return error::kNoError; 859 return error::kNoError;
884 } 860 }
885 861
886 error::Error GLES2DecoderImpl::HandleGenRenderbuffersImmediate( 862 error::Error GLES2DecoderImpl::HandleGenRenderbuffersImmediate(
887 uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) { 863 uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) {
888 GLsizei n = static_cast<GLsizei>(c.n); 864 GLsizei n = static_cast<GLsizei>(c.n);
889 uint32 data_size; 865 uint32 data_size;
890 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 866 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
891 return error::kOutOfBounds; 867 return error::kOutOfBounds;
892 } 868 }
893 GLuint* renderbuffers = GetImmediateDataAs<GLuint*>( 869 GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(
894 c, data_size, immediate_data_size); 870 c, data_size, immediate_data_size);
895 if (n < 0) { 871 if (n < 0) {
896 SetGLError(GL_INVALID_VALUE); 872 SetGLError(GL_INVALID_VALUE);
897 return error::kNoError; 873 return error::kNoError;
898 } 874 }
899 if (renderbuffers == NULL) { 875 if (renderbuffers == NULL) {
900 return error::kOutOfBounds; 876 return error::kOutOfBounds;
901 } 877 }
902 if (!GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers)) { 878 if (!GenRenderbuffersHelper(n, renderbuffers)) {
903 return error::kInvalidArguments; 879 return error::kInvalidArguments;
904 } 880 }
905 return error::kNoError; 881 return error::kNoError;
906 } 882 }
907 883
908 error::Error GLES2DecoderImpl::HandleGenTextures( 884 error::Error GLES2DecoderImpl::HandleGenTextures(
909 uint32 immediate_data_size, const gles2::GenTextures& c) { 885 uint32 immediate_data_size, const gles2::GenTextures& c) {
910 GLsizei n = static_cast<GLsizei>(c.n); 886 GLsizei n = static_cast<GLsizei>(c.n);
911 uint32 data_size; 887 uint32 data_size;
912 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 888 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
913 return error::kOutOfBounds; 889 return error::kOutOfBounds;
914 } 890 }
915 GLuint* textures = GetSharedMemoryAs<GLuint*>( 891 GLuint* textures = GetSharedMemoryAs<GLuint*>(
916 c.textures_shm_id, c.textures_shm_offset, data_size); 892 c.textures_shm_id, c.textures_shm_offset, data_size);
917 if (n < 0) { 893 if (n < 0) {
918 SetGLError(GL_INVALID_VALUE); 894 SetGLError(GL_INVALID_VALUE);
919 return error::kNoError; 895 return error::kNoError;
920 } 896 }
921 if (textures == NULL) { 897 if (textures == NULL) {
922 return error::kOutOfBounds; 898 return error::kOutOfBounds;
923 } 899 }
924 if (!GenGLObjects<GLGenTexturesHelper>(n, textures)) { 900 if (!GenTexturesHelper(n, textures)) {
925 return error::kInvalidArguments; 901 return error::kInvalidArguments;
926 } 902 }
927 return error::kNoError; 903 return error::kNoError;
928 } 904 }
929 905
930 error::Error GLES2DecoderImpl::HandleGenTexturesImmediate( 906 error::Error GLES2DecoderImpl::HandleGenTexturesImmediate(
931 uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) { 907 uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) {
932 GLsizei n = static_cast<GLsizei>(c.n); 908 GLsizei n = static_cast<GLsizei>(c.n);
933 uint32 data_size; 909 uint32 data_size;
934 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { 910 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) {
935 return error::kOutOfBounds; 911 return error::kOutOfBounds;
936 } 912 }
937 GLuint* textures = GetImmediateDataAs<GLuint*>( 913 GLuint* textures = GetImmediateDataAs<GLuint*>(
938 c, data_size, immediate_data_size); 914 c, data_size, immediate_data_size);
939 if (n < 0) { 915 if (n < 0) {
940 SetGLError(GL_INVALID_VALUE); 916 SetGLError(GL_INVALID_VALUE);
941 return error::kNoError; 917 return error::kNoError;
942 } 918 }
943 if (textures == NULL) { 919 if (textures == NULL) {
944 return error::kOutOfBounds; 920 return error::kOutOfBounds;
945 } 921 }
946 if (!GenGLObjects<GLGenTexturesHelper>(n, textures)) { 922 if (!GenTexturesHelper(n, textures)) {
947 return error::kInvalidArguments; 923 return error::kInvalidArguments;
948 } 924 }
949 return error::kNoError; 925 return error::kNoError;
950 } 926 }
951 927
952 error::Error GLES2DecoderImpl::HandleGetBooleanv( 928 error::Error GLES2DecoderImpl::HandleGetBooleanv(
953 uint32 immediate_data_size, const gles2::GetBooleanv& c) { 929 uint32 immediate_data_size, const gles2::GetBooleanv& c) {
954 GLenum pname = static_cast<GLenum>(c.pname); 930 GLenum pname = static_cast<GLenum>(c.pname);
955 typedef GetBooleanv::Result Result; 931 typedef GetBooleanv::Result Result;
956 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 932 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 if (error == GL_NO_ERROR) { 1118 if (error == GL_NO_ERROR) {
1143 result->SetNumResults(num_values); 1119 result->SetNumResults(num_values);
1144 } else { 1120 } else {
1145 SetGLError(error); 1121 SetGLError(error);
1146 } 1122 }
1147 return error::kNoError; 1123 return error::kNoError;
1148 } 1124 }
1149 1125
1150 error::Error GLES2DecoderImpl::HandleGetProgramiv( 1126 error::Error GLES2DecoderImpl::HandleGetProgramiv(
1151 uint32 immediate_data_size, const gles2::GetProgramiv& c) { 1127 uint32 immediate_data_size, const gles2::GetProgramiv& c) {
1152 GLuint program; 1128 GLuint program = c.program;
1153 if (!id_manager()->GetServiceId(c.program, &program)) {
1154 SetGLError(GL_INVALID_VALUE);
1155 return error::kNoError;
1156 }
1157 GLenum pname = static_cast<GLenum>(c.pname); 1129 GLenum pname = static_cast<GLenum>(c.pname);
1158 typedef GetProgramiv::Result Result; 1130 typedef GetProgramiv::Result Result;
1159 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1131 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1160 if (num_values == 0) { 1132 if (num_values == 0) {
1161 SetGLError(GL_INVALID_ENUM); 1133 SetGLError(GL_INVALID_ENUM);
1162 return error::kNoError; 1134 return error::kNoError;
1163 } 1135 }
1164 Result* result = GetSharedMemoryAs<Result*>( 1136 Result* result = GetSharedMemoryAs<Result*>(
1165 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); 1137 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values));
1166 GLint* params = result ? result->GetData() : NULL; 1138 GLint* params = result ? result->GetData() : NULL;
(...skipping 12 matching lines...) Expand all
1179 DoGetProgramiv(program, pname, params); 1151 DoGetProgramiv(program, pname, params);
1180 GLenum error = glGetError(); 1152 GLenum error = glGetError();
1181 if (error == GL_NO_ERROR) { 1153 if (error == GL_NO_ERROR) {
1182 result->SetNumResults(num_values); 1154 result->SetNumResults(num_values);
1183 } else { 1155 } else {
1184 SetGLError(error); 1156 SetGLError(error);
1185 } 1157 }
1186 return error::kNoError; 1158 return error::kNoError;
1187 } 1159 }
1188 1160
1189 error::Error GLES2DecoderImpl::HandleGetProgramInfoLog(
1190 uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) {
1191 GLuint program;
1192 if (!id_manager()->GetServiceId(c.program, &program)) {
1193 SetGLError(GL_INVALID_VALUE);
1194 return error::kNoError;
1195 }
1196 uint32 bucket_id = static_cast<uint32>(c.bucket_id);
1197 GLint len = 0;
1198 glGetProgramiv(program, GL_INFO_LOG_LENGTH, &len);
1199 Bucket* bucket = CreateBucket(bucket_id);
1200 bucket->SetSize(len + 1);
1201 glGetProgramInfoLog(
1202 program, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));
1203 return error::kNoError;
1204 }
1205
1206 error::Error GLES2DecoderImpl::HandleGetRenderbufferParameteriv( 1161 error::Error GLES2DecoderImpl::HandleGetRenderbufferParameteriv(
1207 uint32 immediate_data_size, const gles2::GetRenderbufferParameteriv& c) { 1162 uint32 immediate_data_size, const gles2::GetRenderbufferParameteriv& c) {
1208 GLenum target = static_cast<GLenum>(c.target); 1163 GLenum target = static_cast<GLenum>(c.target);
1209 GLenum pname = static_cast<GLenum>(c.pname); 1164 GLenum pname = static_cast<GLenum>(c.pname);
1210 typedef GetRenderbufferParameteriv::Result Result; 1165 typedef GetRenderbufferParameteriv::Result Result;
1211 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1166 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1212 if (num_values == 0) { 1167 if (num_values == 0) {
1213 SetGLError(GL_INVALID_ENUM); 1168 SetGLError(GL_INVALID_ENUM);
1214 return error::kNoError; 1169 return error::kNoError;
1215 } 1170 }
(...skipping 21 matching lines...) Expand all
1237 if (error == GL_NO_ERROR) { 1192 if (error == GL_NO_ERROR) {
1238 result->SetNumResults(num_values); 1193 result->SetNumResults(num_values);
1239 } else { 1194 } else {
1240 SetGLError(error); 1195 SetGLError(error);
1241 } 1196 }
1242 return error::kNoError; 1197 return error::kNoError;
1243 } 1198 }
1244 1199
1245 error::Error GLES2DecoderImpl::HandleGetShaderiv( 1200 error::Error GLES2DecoderImpl::HandleGetShaderiv(
1246 uint32 immediate_data_size, const gles2::GetShaderiv& c) { 1201 uint32 immediate_data_size, const gles2::GetShaderiv& c) {
1247 GLuint shader; 1202 GLuint shader = c.shader;
1248 if (!id_manager()->GetServiceId(c.shader, &shader)) {
1249 SetGLError(GL_INVALID_VALUE);
1250 return error::kNoError;
1251 }
1252 GLenum pname = static_cast<GLenum>(c.pname); 1203 GLenum pname = static_cast<GLenum>(c.pname);
1253 typedef GetShaderiv::Result Result; 1204 typedef GetShaderiv::Result Result;
1254 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1205 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1255 if (num_values == 0) { 1206 if (num_values == 0) {
1256 SetGLError(GL_INVALID_ENUM); 1207 SetGLError(GL_INVALID_ENUM);
1257 return error::kNoError; 1208 return error::kNoError;
1258 } 1209 }
1259 Result* result = GetSharedMemoryAs<Result*>( 1210 Result* result = GetSharedMemoryAs<Result*>(
1260 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); 1211 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values));
1261 GLint* params = result ? result->GetData() : NULL; 1212 GLint* params = result ? result->GetData() : NULL;
(...skipping 12 matching lines...) Expand all
1274 DoGetShaderiv(shader, pname, params); 1225 DoGetShaderiv(shader, pname, params);
1275 GLenum error = glGetError(); 1226 GLenum error = glGetError();
1276 if (error == GL_NO_ERROR) { 1227 if (error == GL_NO_ERROR) {
1277 result->SetNumResults(num_values); 1228 result->SetNumResults(num_values);
1278 } else { 1229 } else {
1279 SetGLError(error); 1230 SetGLError(error);
1280 } 1231 }
1281 return error::kNoError; 1232 return error::kNoError;
1282 } 1233 }
1283 1234
1284 error::Error GLES2DecoderImpl::HandleGetShaderInfoLog(
1285 uint32 immediate_data_size, const gles2::GetShaderInfoLog& c) {
1286 GLuint shader;
1287 if (!id_manager()->GetServiceId(c.shader, &shader)) {
1288 SetGLError(GL_INVALID_VALUE);
1289 return error::kNoError;
1290 }
1291 uint32 bucket_id = static_cast<uint32>(c.bucket_id);
1292 GLint len = 0;
1293 glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
1294 Bucket* bucket = CreateBucket(bucket_id);
1295 bucket->SetSize(len + 1);
1296 glGetShaderInfoLog(
1297 shader, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));
1298 return error::kNoError;
1299 }
1300
1301 error::Error GLES2DecoderImpl::HandleGetShaderSource(
1302 uint32 immediate_data_size, const gles2::GetShaderSource& c) {
1303 GLuint shader;
1304 if (!id_manager()->GetServiceId(c.shader, &shader)) {
1305 SetGLError(GL_INVALID_VALUE);
1306 return error::kNoError;
1307 }
1308 uint32 bucket_id = static_cast<uint32>(c.bucket_id);
1309 GLint len = 0;
1310 DoGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &len);
1311 Bucket* bucket = CreateBucket(bucket_id);
1312 bucket->SetSize(len + 1);
1313 DoGetShaderSource(
1314 shader, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));
1315 return error::kNoError;
1316 }
1317
1318 error::Error GLES2DecoderImpl::HandleGetTexParameterfv( 1235 error::Error GLES2DecoderImpl::HandleGetTexParameterfv(
1319 uint32 immediate_data_size, const gles2::GetTexParameterfv& c) { 1236 uint32 immediate_data_size, const gles2::GetTexParameterfv& c) {
1320 GLenum target = static_cast<GLenum>(c.target); 1237 GLenum target = static_cast<GLenum>(c.target);
1321 GLenum pname = static_cast<GLenum>(c.pname); 1238 GLenum pname = static_cast<GLenum>(c.pname);
1322 typedef GetTexParameterfv::Result Result; 1239 typedef GetTexParameterfv::Result Result;
1323 GLsizei num_values = util_.GLGetNumValuesReturned(pname); 1240 GLsizei num_values = util_.GLGetNumValuesReturned(pname);
1324 if (num_values == 0) { 1241 if (num_values == 0) {
1325 SetGLError(GL_INVALID_ENUM); 1242 SetGLError(GL_INVALID_ENUM);
1326 return error::kNoError; 1243 return error::kNoError;
1327 } 1244 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 if (!ValidateGLenumHintMode(mode)) { 1391 if (!ValidateGLenumHintMode(mode)) {
1475 SetGLError(GL_INVALID_ENUM); 1392 SetGLError(GL_INVALID_ENUM);
1476 return error::kNoError; 1393 return error::kNoError;
1477 } 1394 }
1478 glHint(target, mode); 1395 glHint(target, mode);
1479 return error::kNoError; 1396 return error::kNoError;
1480 } 1397 }
1481 1398
1482 error::Error GLES2DecoderImpl::HandleIsBuffer( 1399 error::Error GLES2DecoderImpl::HandleIsBuffer(
1483 uint32 immediate_data_size, const gles2::IsBuffer& c) { 1400 uint32 immediate_data_size, const gles2::IsBuffer& c) {
1484 GLuint buffer; 1401 GLuint buffer = c.buffer;
1485 if (!id_manager()->GetServiceId(c.buffer, &buffer)) {
1486 SetGLError(GL_INVALID_VALUE);
1487 return error::kNoError;
1488 }
1489 typedef IsBuffer::Result Result; 1402 typedef IsBuffer::Result Result;
1490 Result* result_dst = GetSharedMemoryAs<Result*>( 1403 Result* result_dst = GetSharedMemoryAs<Result*>(
1491 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1404 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1492 if (!result_dst) { 1405 if (!result_dst) {
1493 return error::kOutOfBounds; 1406 return error::kOutOfBounds;
1494 } 1407 }
1495 *result_dst = DoIsBuffer(buffer); 1408 *result_dst = DoIsBuffer(buffer);
1496 return error::kNoError; 1409 return error::kNoError;
1497 } 1410 }
1498 1411
1499 error::Error GLES2DecoderImpl::HandleIsEnabled( 1412 error::Error GLES2DecoderImpl::HandleIsEnabled(
1500 uint32 immediate_data_size, const gles2::IsEnabled& c) { 1413 uint32 immediate_data_size, const gles2::IsEnabled& c) {
1501 GLenum cap = static_cast<GLenum>(c.cap); 1414 GLenum cap = static_cast<GLenum>(c.cap);
1502 typedef IsEnabled::Result Result; 1415 typedef IsEnabled::Result Result;
1503 Result* result_dst = GetSharedMemoryAs<Result*>( 1416 Result* result_dst = GetSharedMemoryAs<Result*>(
1504 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1417 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1505 if (!result_dst) { 1418 if (!result_dst) {
1506 return error::kOutOfBounds; 1419 return error::kOutOfBounds;
1507 } 1420 }
1508 if (!ValidateGLenumCapability(cap)) { 1421 if (!ValidateGLenumCapability(cap)) {
1509 SetGLError(GL_INVALID_ENUM); 1422 SetGLError(GL_INVALID_ENUM);
1510 return error::kNoError; 1423 return error::kNoError;
1511 } 1424 }
1512 *result_dst = glIsEnabled(cap); 1425 *result_dst = glIsEnabled(cap);
1513 return error::kNoError; 1426 return error::kNoError;
1514 } 1427 }
1515 1428
1516 error::Error GLES2DecoderImpl::HandleIsFramebuffer( 1429 error::Error GLES2DecoderImpl::HandleIsFramebuffer(
1517 uint32 immediate_data_size, const gles2::IsFramebuffer& c) { 1430 uint32 immediate_data_size, const gles2::IsFramebuffer& c) {
1518 GLuint framebuffer = static_cast<GLuint>(c.framebuffer); 1431 GLuint framebuffer = c.framebuffer;
1519 typedef IsFramebuffer::Result Result; 1432 typedef IsFramebuffer::Result Result;
1520 Result* result_dst = GetSharedMemoryAs<Result*>( 1433 Result* result_dst = GetSharedMemoryAs<Result*>(
1521 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1434 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1522 if (!result_dst) { 1435 if (!result_dst) {
1523 return error::kOutOfBounds; 1436 return error::kOutOfBounds;
1524 } 1437 }
1525 *result_dst = DoIsFramebuffer(framebuffer); 1438 *result_dst = DoIsFramebuffer(framebuffer);
1526 return error::kNoError; 1439 return error::kNoError;
1527 } 1440 }
1528 1441
1529 error::Error GLES2DecoderImpl::HandleIsProgram( 1442 error::Error GLES2DecoderImpl::HandleIsProgram(
1530 uint32 immediate_data_size, const gles2::IsProgram& c) { 1443 uint32 immediate_data_size, const gles2::IsProgram& c) {
1531 GLuint program = static_cast<GLuint>(c.program); 1444 GLuint program = c.program;
1532 typedef IsProgram::Result Result; 1445 typedef IsProgram::Result Result;
1533 Result* result_dst = GetSharedMemoryAs<Result*>( 1446 Result* result_dst = GetSharedMemoryAs<Result*>(
1534 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1447 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1535 if (!result_dst) { 1448 if (!result_dst) {
1536 return error::kOutOfBounds; 1449 return error::kOutOfBounds;
1537 } 1450 }
1538 *result_dst = DoIsProgram(program); 1451 *result_dst = DoIsProgram(program);
1539 return error::kNoError; 1452 return error::kNoError;
1540 } 1453 }
1541 1454
1542 error::Error GLES2DecoderImpl::HandleIsRenderbuffer( 1455 error::Error GLES2DecoderImpl::HandleIsRenderbuffer(
1543 uint32 immediate_data_size, const gles2::IsRenderbuffer& c) { 1456 uint32 immediate_data_size, const gles2::IsRenderbuffer& c) {
1544 GLuint renderbuffer = static_cast<GLuint>(c.renderbuffer); 1457 GLuint renderbuffer = c.renderbuffer;
1545 typedef IsRenderbuffer::Result Result; 1458 typedef IsRenderbuffer::Result Result;
1546 Result* result_dst = GetSharedMemoryAs<Result*>( 1459 Result* result_dst = GetSharedMemoryAs<Result*>(
1547 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1460 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1548 if (!result_dst) { 1461 if (!result_dst) {
1549 return error::kOutOfBounds; 1462 return error::kOutOfBounds;
1550 } 1463 }
1551 *result_dst = DoIsRenderbuffer(renderbuffer); 1464 *result_dst = DoIsRenderbuffer(renderbuffer);
1552 return error::kNoError; 1465 return error::kNoError;
1553 } 1466 }
1554 1467
1555 error::Error GLES2DecoderImpl::HandleIsShader( 1468 error::Error GLES2DecoderImpl::HandleIsShader(
1556 uint32 immediate_data_size, const gles2::IsShader& c) { 1469 uint32 immediate_data_size, const gles2::IsShader& c) {
1557 GLuint shader = static_cast<GLuint>(c.shader); 1470 GLuint shader = c.shader;
1558 typedef IsShader::Result Result; 1471 typedef IsShader::Result Result;
1559 Result* result_dst = GetSharedMemoryAs<Result*>( 1472 Result* result_dst = GetSharedMemoryAs<Result*>(
1560 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1473 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1561 if (!result_dst) { 1474 if (!result_dst) {
1562 return error::kOutOfBounds; 1475 return error::kOutOfBounds;
1563 } 1476 }
1564 *result_dst = DoIsShader(shader); 1477 *result_dst = DoIsShader(shader);
1565 return error::kNoError; 1478 return error::kNoError;
1566 } 1479 }
1567 1480
1568 error::Error GLES2DecoderImpl::HandleIsTexture( 1481 error::Error GLES2DecoderImpl::HandleIsTexture(
1569 uint32 immediate_data_size, const gles2::IsTexture& c) { 1482 uint32 immediate_data_size, const gles2::IsTexture& c) {
1570 GLuint texture = static_cast<GLuint>(c.texture); 1483 GLuint texture = c.texture;
1571 typedef IsTexture::Result Result; 1484 typedef IsTexture::Result Result;
1572 Result* result_dst = GetSharedMemoryAs<Result*>( 1485 Result* result_dst = GetSharedMemoryAs<Result*>(
1573 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 1486 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
1574 if (!result_dst) { 1487 if (!result_dst) {
1575 return error::kOutOfBounds; 1488 return error::kOutOfBounds;
1576 } 1489 }
1577 *result_dst = DoIsTexture(texture); 1490 *result_dst = DoIsTexture(texture);
1578 return error::kNoError; 1491 return error::kNoError;
1579 } 1492 }
1580 1493
1581 error::Error GLES2DecoderImpl::HandleLineWidth( 1494 error::Error GLES2DecoderImpl::HandleLineWidth(
1582 uint32 immediate_data_size, const gles2::LineWidth& c) { 1495 uint32 immediate_data_size, const gles2::LineWidth& c) {
1583 GLfloat width = static_cast<GLfloat>(c.width); 1496 GLfloat width = static_cast<GLfloat>(c.width);
1584 glLineWidth(width); 1497 glLineWidth(width);
1585 return error::kNoError; 1498 return error::kNoError;
1586 } 1499 }
1587 1500
1588 error::Error GLES2DecoderImpl::HandleLinkProgram( 1501 error::Error GLES2DecoderImpl::HandleLinkProgram(
1589 uint32 immediate_data_size, const gles2::LinkProgram& c) { 1502 uint32 immediate_data_size, const gles2::LinkProgram& c) {
1590 GLuint program; 1503 GLuint program = c.program;
1591 if (!id_manager()->GetServiceId(c.program, &program)) {
1592 SetGLError(GL_INVALID_VALUE);
1593 return error::kNoError;
1594 }
1595 DoLinkProgram(program); 1504 DoLinkProgram(program);
1596 return error::kNoError; 1505 return error::kNoError;
1597 } 1506 }
1598 1507
1599 error::Error GLES2DecoderImpl::HandlePolygonOffset( 1508 error::Error GLES2DecoderImpl::HandlePolygonOffset(
1600 uint32 immediate_data_size, const gles2::PolygonOffset& c) { 1509 uint32 immediate_data_size, const gles2::PolygonOffset& c) {
1601 GLfloat factor = static_cast<GLfloat>(c.factor); 1510 GLfloat factor = static_cast<GLfloat>(c.factor);
1602 GLfloat units = static_cast<GLfloat>(c.units); 1511 GLfloat units = static_cast<GLfloat>(c.units);
1603 glPolygonOffset(factor, units); 1512 glPolygonOffset(factor, units);
1604 return error::kNoError; 1513 return error::kNoError;
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 if (value == NULL) { 2495 if (value == NULL) {
2587 return error::kOutOfBounds; 2496 return error::kOutOfBounds;
2588 } 2497 }
2589 glUniformMatrix4fv(location, count, transpose, value); 2498 glUniformMatrix4fv(location, count, transpose, value);
2590 return error::kNoError; 2499 return error::kNoError;
2591 } 2500 }
2592 2501
2593 error::Error GLES2DecoderImpl::HandleUseProgram( 2502 error::Error GLES2DecoderImpl::HandleUseProgram(
2594 uint32 immediate_data_size, const gles2::UseProgram& c) { 2503 uint32 immediate_data_size, const gles2::UseProgram& c) {
2595 GLuint program = c.program; 2504 GLuint program = c.program;
2596 if (program != 0 && !id_manager()->GetServiceId(program, &program)) {
2597 SetGLError(GL_INVALID_VALUE);
2598 return error::kNoError;
2599 }
2600 DoUseProgram(program); 2505 DoUseProgram(program);
2601 return error::kNoError; 2506 return error::kNoError;
2602 } 2507 }
2603 2508
2604 error::Error GLES2DecoderImpl::HandleValidateProgram( 2509 error::Error GLES2DecoderImpl::HandleValidateProgram(
2605 uint32 immediate_data_size, const gles2::ValidateProgram& c) { 2510 uint32 immediate_data_size, const gles2::ValidateProgram& c) {
2606 GLuint program; 2511 GLuint program = c.program;
2607 if (!id_manager()->GetServiceId(c.program, &program)) { 2512 DoValidateProgram(program);
2608 SetGLError(GL_INVALID_VALUE);
2609 return error::kNoError;
2610 }
2611 glValidateProgram(program);
2612 return error::kNoError; 2513 return error::kNoError;
2613 } 2514 }
2614 2515
2615 error::Error GLES2DecoderImpl::HandleVertexAttrib1f( 2516 error::Error GLES2DecoderImpl::HandleVertexAttrib1f(
2616 uint32 immediate_data_size, const gles2::VertexAttrib1f& c) { 2517 uint32 immediate_data_size, const gles2::VertexAttrib1f& c) {
2617 GLuint indx = static_cast<GLuint>(c.indx); 2518 GLuint indx = static_cast<GLuint>(c.indx);
2618 GLfloat x = static_cast<GLfloat>(c.x); 2519 GLfloat x = static_cast<GLfloat>(c.x);
2619 glVertexAttrib1f(indx, x); 2520 glVertexAttrib1f(indx, x);
2620 return error::kNoError; 2521 return error::kNoError;
2621 } 2522 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 if (height < 0) { 2704 if (height < 0) {
2804 SetGLError(GL_INVALID_VALUE); 2705 SetGLError(GL_INVALID_VALUE);
2805 return error::kNoError; 2706 return error::kNoError;
2806 } 2707 }
2807 glViewport(x, y, width, height); 2708 glViewport(x, y, width, height);
2808 return error::kNoError; 2709 return error::kNoError;
2809 } 2710 }
2810 2711
2811 error::Error GLES2DecoderImpl::HandleGetMaxValueInBuffer( 2712 error::Error GLES2DecoderImpl::HandleGetMaxValueInBuffer(
2812 uint32 immediate_data_size, const gles2::GetMaxValueInBuffer& c) { 2713 uint32 immediate_data_size, const gles2::GetMaxValueInBuffer& c) {
2813 GLuint buffer_id; 2714 GLuint buffer_id = c.buffer_id;
2814 if (!id_manager()->GetServiceId(c.buffer_id, &buffer_id)) {
2815 SetGLError(GL_INVALID_VALUE);
2816 return error::kNoError;
2817 }
2818 GLsizei count = static_cast<GLsizei>(c.count); 2715 GLsizei count = static_cast<GLsizei>(c.count);
2819 GLenum type = static_cast<GLenum>(c.type); 2716 GLenum type = static_cast<GLenum>(c.type);
2820 GLuint offset = static_cast<GLuint>(c.offset); 2717 GLuint offset = static_cast<GLuint>(c.offset);
2821 typedef GetMaxValueInBuffer::Result Result; 2718 typedef GetMaxValueInBuffer::Result Result;
2822 Result* result_dst = GetSharedMemoryAs<Result*>( 2719 Result* result_dst = GetSharedMemoryAs<Result*>(
2823 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst)); 2720 c.result_shm_id, c.result_shm_offset, sizeof(*result_dst));
2824 if (!result_dst) { 2721 if (!result_dst) {
2825 return error::kOutOfBounds; 2722 return error::kOutOfBounds;
2826 } 2723 }
2827 if (count < 0) { 2724 if (count < 0) {
2828 SetGLError(GL_INVALID_VALUE); 2725 SetGLError(GL_INVALID_VALUE);
2829 return error::kNoError; 2726 return error::kNoError;
2830 } 2727 }
2831 if (!ValidateGLenumIndexType(type)) { 2728 if (!ValidateGLenumIndexType(type)) {
2832 SetGLError(GL_INVALID_ENUM); 2729 SetGLError(GL_INVALID_ENUM);
2833 return error::kNoError; 2730 return error::kNoError;
2834 } 2731 }
2835 *result_dst = DoGetMaxValueInBuffer(buffer_id, count, type, offset); 2732 *result_dst = DoGetMaxValueInBuffer(buffer_id, count, type, offset);
2836 return error::kNoError; 2733 return error::kNoError;
2837 } 2734 }
2838 2735
2839 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ 2736 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_
2840 2737
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698