OSDN Git Service

c4e4b49aee4a9e376c79aebf89247bcbd2b445bb
[android-x86/external-mesa.git] / src / mesa / es / main / specials_es2.c
1 /**************************************************************************
2  *
3  * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  **************************************************************************/
24
25
26 #include "main/mtypes.h"
27 #include "main/context.h"
28 #include "main/imports.h"
29 #include "main/get.h"
30
31
32 const GLubyte * GLAPIENTRY _es_GetString(GLenum name);
33
34
35 static const char *
36 compute_es_version(void)
37 {
38    static const char es_2_0[] = "OpenGL ES 2.0";
39    return es_2_0;
40 }
41
42
43 /**
44  * Note: a more dynamic solution would be query the underlying GL
45  * and translate extension names...
46  */
47 static const char *
48 extension_string(void)
49 {
50    return
51       /* Core additions */
52       "GL_OES_single_precision "
53
54       /* Requred extensions */
55       "GL_OES_compressed_paletted_texture "
56
57       /* Normal extensions */
58       "GL_OES_depth24 "
59       "GL_OES_depth32 "
60       "GL_OES_depth_texture "
61       "GL_OES_element_index_uint "
62       "GL_OES_fbo_render_mipmap "
63       "GL_OES_mapbuffer "
64       "GL_OES_packed_depth_stencil "
65       "GL_OES_rgb8_rgba8 "
66       "GL_OES_standard_derivatives "
67       "GL_OES_stencil1 "
68       "GL_OES_stencil4 "
69       "GL_OES_stencil8 "
70       "GL_OES_texture_3D "
71       "GL_OES_texture_npot "
72       "GL_EXT_texture_filter_anisotropic "
73       "GL_EXT_texture_type_2_10_10_10_REV "
74       "GL_OES_depth_texture "
75       "GL_OES_standard_derivatives "
76       ;
77 }
78
79
80 const GLubyte * GLAPIENTRY
81 _es_GetString(GLenum name)
82 {
83    switch (name) {
84    case GL_VERSION:
85       return (const GLubyte *) compute_es_version();
86    case GL_SHADING_LANGUAGE_VERSION:
87       return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
88    case GL_EXTENSIONS:
89       return (const GLubyte *) extension_string();
90    default:
91       return _mesa_GetString(name);
92    }
93 }
94
95
96 void
97 _mesa_initialize_context_extra(GLcontext *ctx)
98 {
99    ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
100    ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
101
102    ctx->Point.PointSprite = GL_TRUE;  /* always on for ES 2.x */
103 }