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

Side by Side Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 9732010: Check that attachments are the correct type for the attachment type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file is here so other GLES2 related files can have a common set of 5 // This file is here so other GLES2 related files can have a common set of
6 // includes where appropriate. 6 // includes where appropriate.
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 536 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
537 GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 537 GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
538 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 538 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
539 }; 539 };
540 return faces[index]; 540 return faces[index];
541 } 541 }
542 542
543 uint32 GLES2Util::GetChannelsForFormat(int format) { 543 uint32 GLES2Util::GetChannelsForFormat(int format) {
544 switch (format) { 544 switch (format) {
545 case GL_ALPHA: 545 case GL_ALPHA:
546 return 0x0008; 546 case GL_ALPHA16F_EXT:
547 case GL_ALPHA32F_EXT:
548 return kAlpha;
547 case GL_LUMINANCE: 549 case GL_LUMINANCE:
548 return 0x0007; 550 return kRGB;
549 case GL_LUMINANCE_ALPHA: 551 case GL_LUMINANCE_ALPHA:
550 return 0x000F; 552 return kRGBA;
551 case GL_RGB: 553 case GL_RGB:
552 case GL_RGB8_OES: 554 case GL_RGB8_OES:
553 case GL_RGB565: 555 case GL_RGB565:
554 return 0x0007; 556 case GL_RGB16F_EXT:
557 case GL_RGB32F_EXT:
558 return kRGB;
555 case GL_BGRA_EXT: 559 case GL_BGRA_EXT:
560 case GL_BGRA8_EXT:
561 case GL_RGBA16F_EXT:
562 case GL_RGBA32F_EXT:
556 case GL_RGBA: 563 case GL_RGBA:
557 case GL_RGBA8_OES: 564 case GL_RGBA8_OES:
558 case GL_RGBA4: 565 case GL_RGBA4:
559 case GL_RGB5_A1: 566 case GL_RGB5_A1:
560 return 0x000F; 567 return kRGBA;
568 case GL_DEPTH_COMPONENT16:
569 case GL_DEPTH_COMPONENT:
570 return kDepth;
571 case GL_STENCIL_INDEX8:
572 return kStencil;
573 case GL_DEPTH_STENCIL_OES:
574 case GL_DEPTH24_STENCIL8_OES:
575 return kDepth | kStencil;
561 default: 576 default:
562 return 0x0000; 577 return 0x0000;
563 } 578 }
579 }
580
581 uint32 GLES2Util::GetChannelsNeededForAttachmentType(int type) {
582 switch (type) {
583 case GL_COLOR_ATTACHMENT0:
584 return kRGBA;
585 case GL_DEPTH_ATTACHMENT:
586 return kDepth;
587 case GL_STENCIL_ATTACHMENT:
588 return kStencil;
589 default:
590 return 0x0000;
591 }
564 } 592 }
565 593
566 std::string GLES2Util::GetStringEnum(uint32 value) { 594 std::string GLES2Util::GetStringEnum(uint32 value) {
567 const EnumToString* entry = enum_to_string_table_; 595 const EnumToString* entry = enum_to_string_table_;
568 const EnumToString* end = entry + enum_to_string_table_len_; 596 const EnumToString* end = entry + enum_to_string_table_len_;
569 for (;entry < end; ++entry) { 597 for (;entry < end; ++entry) {
570 if (value == entry->value) { 598 if (value == entry->value) {
571 return entry->name; 599 return entry->name;
572 } 600 }
573 } 601 }
(...skipping 22 matching lines...) Expand all
596 } 624 }
597 } 625 }
598 return GetStringEnum(value); 626 return GetStringEnum(value);
599 } 627 }
600 628
601 #include "../common/gles2_cmd_utils_implementation_autogen.h" 629 #include "../common/gles2_cmd_utils_implementation_autogen.h"
602 630
603 } // namespace gles2 631 } // namespace gles2
604 } // namespace gpu 632 } // namespace gpu
605 633
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils.h ('k') | gpu/command_buffer/service/framebuffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698