OSDN Git Service

8c1edab38ce4907a096de24b9ee8b5c53e1a68b0
[android-x86/external-mesa.git] / src / mesa / es / main / specials_es1.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 extern const GLubyte * GLAPIENTRY _es_GetString(GLenum name);
33
34
35 static const char *
36 compute_es_version(void)
37 {
38    static const char es_1_0[] = "OpenGL ES-CM 1.0";
39    static const char es_1_1[] = "OpenGL ES-CM 1.1";
40
41    (void) es_1_0;
42    return es_1_1;
43 }
44
45
46 /**
47  * Note: a more dynamic solution would be query the underlying GL
48  * and translate extension names...
49  */
50 static const char *
51 extension_string(void)
52 {
53    return
54       /* Core additions */
55       "GL_OES_byte_coordinates "
56       "GL_OES_fixed_point "
57       "GL_OES_single_precision "
58       "GL_OES_matrix_get "
59
60       /* 1.1 required extensions */
61       "GL_OES_read_format "
62       "GL_OES_compressed_paletted_texture "
63       "GL_OES_point_size_array "
64       "GL_OES_point_sprite "
65
66       /* 1.1 optional extensions */
67       "GL_OES_draw_texture "
68
69       /* 1.1 deprecated extensions */
70       "GL_OES_query_matrix "
71
72       /* Newer extensions */
73       "GL_OES_blend_equation_separate "
74       "GL_OES_blend_func_separate "
75       "GL_OES_blend_subtract "
76       "GL_OES_depth24 "
77       "GL_OES_depth32 "
78       "GL_OES_element_index_uint "
79       "GL_OES_fbo_render_mipmap "
80       "GL_OES_framebuffer_object "
81       "GL_OES_mapbuffer "
82       "GL_OES_rgb8_rgba8 "
83       "GL_OES_stencil1 "
84       "GL_OES_stencil4 "
85       "GL_OES_stencil8 "
86       "GL_OES_texture_cube_map "
87       "GL_OES_texture_env_crossbar "
88       "GL_OES_texture_mirrored_repeat "
89       "GL_EXT_texture_filter_anisotropic "
90       ;
91 }
92
93
94 const GLubyte * GLAPIENTRY
95 _es_GetString(GLenum name)
96 {
97    switch (name) {
98    case GL_VERSION:
99       return (const GLubyte *) compute_es_version();
100    case GL_EXTENSIONS:
101       return (const GLubyte *) extension_string();
102    default:
103       return _mesa_GetString(name);
104    }
105 }
106
107
108 void
109 _mesa_initialize_context_extra(GLcontext *ctx)
110 {
111    /* FEATURE_es2_glsl is on */
112    ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
113    ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
114 }