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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file 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 <sstream> 8 #include <sstream>
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
11 #include <GLES2/gl2extchromium.h> 11 #include <GLES2/gl2extchromium.h>
12 12
13 #include "gpu/command_buffer/common/gles2_cmd_format.h" 13 #include "gpu/command_buffer/common/gles2_cmd_format.h"
14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
15 15
16 namespace gpu { 16 namespace gpu {
17 namespace gles2 { 17 namespace gles2 {
18 18
19 namespace gl_error_bit { 19 namespace gl_error_bit {
20 enum GLErrorBit { 20 enum GLErrorBit {
21 kNoError = 0, 21 kNoError = 0,
22 kInvalidEnum = (1 << 0), 22 kInvalidEnum = (1 << 0),
23 kInvalidValue = (1 << 1), 23 kInvalidValue = (1 << 1),
24 kInvalidOperation = (1 << 2), 24 kInvalidOperation = (1 << 2),
25 kOutOfMemory = (1 << 3), 25 kOutOfMemory = (1 << 3),
26 kInvalidFrameBufferOperation = (1 << 4) 26 kInvalidFrameBufferOperation = (1 << 4),
27 kContextLost = (1 << 5)
27 }; 28 };
28 } 29 }
29 30
30 int GLES2Util::GLGetNumValuesReturned(int id) const { 31 int GLES2Util::GLGetNumValuesReturned(int id) const {
31 switch (id) { 32 switch (id) {
32 // -- glGetBooleanv, glGetFloatv, glGetIntergerv 33 // -- glGetBooleanv, glGetFloatv, glGetIntergerv
33 case GL_ACTIVE_TEXTURE: 34 case GL_ACTIVE_TEXTURE:
34 return 1; 35 return 1;
35 case GL_ALIASED_LINE_WIDTH_RANGE: 36 case GL_ALIASED_LINE_WIDTH_RANGE:
36 return 2; 37 return 2;
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 case GL_INVALID_ENUM: 558 case GL_INVALID_ENUM:
558 return gl_error_bit::kInvalidEnum; 559 return gl_error_bit::kInvalidEnum;
559 case GL_INVALID_VALUE: 560 case GL_INVALID_VALUE:
560 return gl_error_bit::kInvalidValue; 561 return gl_error_bit::kInvalidValue;
561 case GL_INVALID_OPERATION: 562 case GL_INVALID_OPERATION:
562 return gl_error_bit::kInvalidOperation; 563 return gl_error_bit::kInvalidOperation;
563 case GL_OUT_OF_MEMORY: 564 case GL_OUT_OF_MEMORY:
564 return gl_error_bit::kOutOfMemory; 565 return gl_error_bit::kOutOfMemory;
565 case GL_INVALID_FRAMEBUFFER_OPERATION: 566 case GL_INVALID_FRAMEBUFFER_OPERATION:
566 return gl_error_bit::kInvalidFrameBufferOperation; 567 return gl_error_bit::kInvalidFrameBufferOperation;
568 case GL_CONTEXT_LOST_KHR:
569 return gl_error_bit::kContextLost;
567 default: 570 default:
568 NOTREACHED(); 571 NOTREACHED();
569 return gl_error_bit::kNoError; 572 return gl_error_bit::kNoError;
570 } 573 }
571 } 574 }
572 575
573 uint32 GLES2Util::GLErrorBitToGLError(uint32 error_bit) { 576 uint32 GLES2Util::GLErrorBitToGLError(uint32 error_bit) {
574 switch (error_bit) { 577 switch (error_bit) {
575 case gl_error_bit::kInvalidEnum: 578 case gl_error_bit::kInvalidEnum:
576 return GL_INVALID_ENUM; 579 return GL_INVALID_ENUM;
577 case gl_error_bit::kInvalidValue: 580 case gl_error_bit::kInvalidValue:
578 return GL_INVALID_VALUE; 581 return GL_INVALID_VALUE;
579 case gl_error_bit::kInvalidOperation: 582 case gl_error_bit::kInvalidOperation:
580 return GL_INVALID_OPERATION; 583 return GL_INVALID_OPERATION;
581 case gl_error_bit::kOutOfMemory: 584 case gl_error_bit::kOutOfMemory:
582 return GL_OUT_OF_MEMORY; 585 return GL_OUT_OF_MEMORY;
583 case gl_error_bit::kInvalidFrameBufferOperation: 586 case gl_error_bit::kInvalidFrameBufferOperation:
584 return GL_INVALID_FRAMEBUFFER_OPERATION; 587 return GL_INVALID_FRAMEBUFFER_OPERATION;
588 case gl_error_bit::kContextLost:
589 return GL_CONTEXT_LOST_KHR;
585 default: 590 default:
586 NOTREACHED(); 591 NOTREACHED();
587 return GL_NO_ERROR; 592 return GL_NO_ERROR;
588 } 593 }
589 } 594 }
590 595
591 uint32 GLES2Util::IndexToGLFaceTarget(int index) { 596 uint32 GLES2Util::IndexToGLFaceTarget(int index) {
592 static uint32 faces[] = { 597 static uint32 faces[] = {
593 GL_TEXTURE_CUBE_MAP_POSITIVE_X, 598 GL_TEXTURE_CUBE_MAP_POSITIVE_X,
594 GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 599 GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 942 }
938 943
939 return true; 944 return true;
940 } 945 }
941 946
942 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" 947 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h"
943 948
944 } // namespace gles2 949 } // namespace gles2
945 } // namespace gpu 950 } // namespace gpu
946 951
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gl_in_process_context.cc ('k') | gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698