• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include "GLEScmUtils.h"
17 
18 
glParamSize(GLenum param)19 size_t glParamSize(GLenum param)
20 {
21     size_t s = 0;
22 
23     switch(param)
24     {
25     case GL_MAX_TEXTURE_SIZE:
26     //case GL_TEXTURE_GEN_MODE_OES:
27     case GL_TEXTURE_ENV_MODE:
28     case GL_FOG_MODE:
29     case GL_FOG_DENSITY:
30     case GL_FOG_START:
31     case GL_FOG_END:
32     case GL_SPOT_EXPONENT:
33     case GL_CONSTANT_ATTENUATION:
34     case GL_LINEAR_ATTENUATION:
35     case GL_QUADRATIC_ATTENUATION:
36     case GL_SHININESS:
37     case GL_LIGHT_MODEL_TWO_SIDE:
38     case GL_POINT_SIZE:
39     case GL_POINT_SIZE_MIN:
40     case GL_POINT_SIZE_MAX:
41     case GL_POINT_FADE_THRESHOLD_SIZE:
42     case GL_CULL_FACE_MODE:
43     case GL_FRONT_FACE:
44     case GL_SHADE_MODEL:
45     case GL_DEPTH_WRITEMASK:
46     case GL_DEPTH_CLEAR_VALUE:
47     case GL_STENCIL_FAIL:
48     case GL_STENCIL_PASS_DEPTH_FAIL:
49     case GL_STENCIL_PASS_DEPTH_PASS:
50     case GL_STENCIL_REF:
51     case GL_STENCIL_WRITEMASK:
52     case GL_MATRIX_MODE:
53     case GL_MODELVIEW_STACK_DEPTH:
54     case GL_PROJECTION_STACK_DEPTH:
55     case GL_TEXTURE_STACK_DEPTH:
56     case GL_ALPHA_TEST_FUNC:
57     case GL_ALPHA_TEST_REF:
58     case GL_BLEND_DST:
59     case GL_BLEND_SRC:
60     case GL_LOGIC_OP_MODE:
61     case GL_SCISSOR_TEST:
62     case GL_MAX_TEXTURE_UNITS:
63         s = 1;
64         break;
65     case GL_ALIASED_LINE_WIDTH_RANGE:
66     case GL_ALIASED_POINT_SIZE_RANGE:
67     case GL_DEPTH_RANGE:
68     case GL_MAX_VIEWPORT_DIMS:
69     case GL_SMOOTH_POINT_SIZE_RANGE:
70     case GL_SMOOTH_LINE_WIDTH_RANGE:
71         s= 2;
72         break;
73     case GL_SPOT_DIRECTION:
74     case GL_POINT_DISTANCE_ATTENUATION:
75     case GL_CURRENT_NORMAL:
76         s =  3;
77         break;
78     case GL_CURRENT_TEXTURE_COORDS:
79     case GL_CURRENT_COLOR:
80     case GL_FOG_COLOR:
81     case GL_AMBIENT:
82     case GL_DIFFUSE:
83     case GL_SPECULAR:
84     case GL_EMISSION:
85     case GL_POSITION:
86     case GL_LIGHT_MODEL_AMBIENT:
87     case GL_TEXTURE_ENV_COLOR:
88     case GL_SCISSOR_BOX:
89     case GL_VIEWPORT:
90     //case GL_TEXTURE_CROP_RECT_OES:
91         s =  4;
92         break;
93     case GL_MODELVIEW_MATRIX:
94     case GL_PROJECTION_MATRIX:
95     case GL_TEXTURE_MATRIX:
96         s = 16;
97     default:
98         s = 1; // assume 1
99     }
100     return s;
101 }
102