ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

getstring.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  7.1
00004  *
00005  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 
00026 
00027 #include "glheader.h"
00028 #include "context.h"
00029 #include "get.h"
00030 #include "version.h"
00031 #include "enums.h"
00032 #include "extensions.h"
00033 
00034 
00039 static const char *
00040 compute_version(const GLcontext *ctx)
00041 {
00042    static const char *version_1_2 = "1.2 Mesa " MESA_VERSION_STRING;
00043    static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING;
00044    static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING;
00045    static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING;
00046    static const char *version_2_0 = "2.0 Mesa " MESA_VERSION_STRING;
00047    static const char *version_2_1 = "2.1 Mesa " MESA_VERSION_STRING;
00048 
00049    const GLboolean ver_1_3 = (ctx->Extensions.ARB_multisample &&
00050                               ctx->Extensions.ARB_multitexture &&
00051                               ctx->Extensions.ARB_texture_border_clamp &&
00052                               ctx->Extensions.ARB_texture_compression &&
00053                               ctx->Extensions.ARB_texture_cube_map &&
00054                               ctx->Extensions.EXT_texture_env_add &&
00055                               ctx->Extensions.ARB_texture_env_combine &&
00056                               ctx->Extensions.ARB_texture_env_dot3);
00057    const GLboolean ver_1_4 = (ver_1_3 &&
00058                               ctx->Extensions.ARB_depth_texture &&
00059                               ctx->Extensions.ARB_shadow &&
00060                               ctx->Extensions.ARB_texture_env_crossbar &&
00061                               ctx->Extensions.ARB_texture_mirrored_repeat &&
00062                               ctx->Extensions.ARB_window_pos &&
00063                               ctx->Extensions.EXT_blend_color &&
00064                               ctx->Extensions.EXT_blend_func_separate &&
00065                               ctx->Extensions.EXT_blend_minmax &&
00066                               ctx->Extensions.EXT_blend_subtract &&
00067                               ctx->Extensions.EXT_fog_coord &&
00068                               ctx->Extensions.EXT_multi_draw_arrays &&
00069                               ctx->Extensions.EXT_point_parameters &&
00070                               ctx->Extensions.EXT_secondary_color &&
00071                               ctx->Extensions.EXT_stencil_wrap &&
00072                               ctx->Extensions.EXT_texture_lod_bias &&
00073                               ctx->Extensions.SGIS_generate_mipmap);
00074    const GLboolean ver_1_5 = (ver_1_4 &&
00075                               ctx->Extensions.ARB_occlusion_query &&
00076                               ctx->Extensions.ARB_vertex_buffer_object &&
00077                               ctx->Extensions.EXT_shadow_funcs);
00078    const GLboolean ver_2_0 = (ver_1_5 &&
00079                               ctx->Extensions.ARB_draw_buffers &&
00080                               ctx->Extensions.ARB_point_sprite &&
00081                               ctx->Extensions.ARB_shader_objects &&
00082                               ctx->Extensions.ARB_vertex_shader &&
00083                               ctx->Extensions.ARB_fragment_shader &&
00084                               ctx->Extensions.ARB_texture_non_power_of_two &&
00085                               ctx->Extensions.EXT_blend_equation_separate &&
00086 
00087                   /* Technically, 2.0 requires the functionality
00088                    * of the EXT version.  Enable 2.0 if either
00089                    * extension is available, and assume that a
00090                    * driver that only exposes the ATI extension
00091                    * will fallback to software when necessary.
00092                    */
00093                   (ctx->Extensions.EXT_stencil_two_side
00094                    || ctx->Extensions.ATI_separate_stencil));
00095    const GLboolean ver_2_1 = (ver_2_0 &&
00096                               ctx->Extensions.ARB_shading_language_120 &&
00097                               ctx->Extensions.EXT_pixel_buffer_object &&
00098                               ctx->Extensions.EXT_texture_sRGB);
00099    if (ver_2_1)
00100       return version_2_1;
00101    if (ver_2_0)
00102       return version_2_0;
00103    if (ver_1_5)
00104       return version_1_5;
00105    if (ver_1_4)
00106       return version_1_4;
00107    if (ver_1_3)
00108       return version_1_3;
00109    return version_1_2;
00110 }
00111 
00112 
00113 
00125 const GLubyte * GLAPIENTRY
00126 _mesa_GetString( GLenum name )
00127 {
00128    GET_CURRENT_CONTEXT(ctx);
00129    static const char *vendor = "Brian Paul";
00130    static const char *renderer = "Mesa";
00131 
00132    if (!ctx)
00133       return NULL;
00134 
00135    ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
00136 
00137    /* this is a required driver function */
00138    assert(ctx->Driver.GetString);
00139    {
00140       /* Give the driver the chance to handle this query */
00141       const GLubyte *str = (*ctx->Driver.GetString)(ctx, name);
00142       if (str)
00143          return str;
00144    }
00145 
00146    switch (name) {
00147       case GL_VENDOR:
00148          return (const GLubyte *) vendor;
00149       case GL_RENDERER:
00150          return (const GLubyte *) renderer;
00151       case GL_VERSION:
00152          return (const GLubyte *) compute_version(ctx);
00153       case GL_EXTENSIONS:
00154          if (!ctx->Extensions.String)
00155             ctx->Extensions.String = _mesa_make_extension_string(ctx);
00156          return (const GLubyte *) ctx->Extensions.String;
00157 #if FEATURE_ARB_shading_language_100
00158       case GL_SHADING_LANGUAGE_VERSION_ARB:
00159          if (ctx->Extensions.ARB_shading_language_120)
00160             return (const GLubyte *) "1.20";
00161          else if (ctx->Extensions.ARB_shading_language_100)
00162             return (const GLubyte *) "1.10";
00163          goto error;
00164 #endif
00165 #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \
00166     FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
00167       case GL_PROGRAM_ERROR_STRING_NV:
00168          if (ctx->Extensions.NV_fragment_program ||
00169              ctx->Extensions.ARB_fragment_program ||
00170              ctx->Extensions.NV_vertex_program ||
00171              ctx->Extensions.ARB_vertex_program) {
00172             return (const GLubyte *) ctx->Program.ErrorString;
00173          }
00174          /* FALL-THROUGH */
00175 #endif
00176 #if FEATURE_ARB_shading_language_100
00177       error:
00178 #endif
00179       default:
00180          _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
00181          return (const GLubyte *) 0;
00182    }
00183 }
00184 
00185 
00197 void GLAPIENTRY
00198 _mesa_GetPointerv( GLenum pname, GLvoid **params )
00199 {
00200    GET_CURRENT_CONTEXT(ctx);
00201    const GLuint clientUnit = ctx->Array.ActiveTexture;
00202    ASSERT_OUTSIDE_BEGIN_END(ctx);
00203 
00204    if (!params)
00205       return;
00206 
00207    if (MESA_VERBOSE & VERBOSE_API)
00208       _mesa_debug(ctx, "glGetPointerv %s\n", _mesa_lookup_enum_by_nr(pname));
00209 
00210    if (ctx->Driver.GetPointerv
00211        && (*ctx->Driver.GetPointerv)(ctx, pname, params))
00212       return;
00213 
00214    switch (pname) {
00215       case GL_VERTEX_ARRAY_POINTER:
00216          *params = (GLvoid *) ctx->Array.ArrayObj->Vertex.Ptr;
00217          break;
00218       case GL_NORMAL_ARRAY_POINTER:
00219          *params = (GLvoid *) ctx->Array.ArrayObj->Normal.Ptr;
00220          break;
00221       case GL_COLOR_ARRAY_POINTER:
00222          *params = (GLvoid *) ctx->Array.ArrayObj->Color.Ptr;
00223          break;
00224       case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
00225          *params = (GLvoid *) ctx->Array.ArrayObj->SecondaryColor.Ptr;
00226          break;
00227       case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
00228          *params = (GLvoid *) ctx->Array.ArrayObj->FogCoord.Ptr;
00229          break;
00230       case GL_INDEX_ARRAY_POINTER:
00231          *params = (GLvoid *) ctx->Array.ArrayObj->Index.Ptr;
00232          break;
00233       case GL_TEXTURE_COORD_ARRAY_POINTER:
00234          *params = (GLvoid *) ctx->Array.ArrayObj->TexCoord[clientUnit].Ptr;
00235          break;
00236       case GL_EDGE_FLAG_ARRAY_POINTER:
00237          *params = (GLvoid *) ctx->Array.ArrayObj->EdgeFlag.Ptr;
00238          break;
00239       case GL_FEEDBACK_BUFFER_POINTER:
00240          *params = ctx->Feedback.Buffer;
00241          break;
00242       case GL_SELECTION_BUFFER_POINTER:
00243          *params = ctx->Select.Buffer;
00244          break;
00245 #if FEATURE_MESA_program_debug
00246       case GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA:
00247          if (!ctx->Extensions.MESA_program_debug) {
00248             _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
00249             return;
00250          }
00251          *params = *(GLvoid **) &ctx->FragmentProgram.Callback;
00252          break;
00253       case GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA:
00254          if (!ctx->Extensions.MESA_program_debug) {
00255             _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
00256             return;
00257          }
00258          *params = ctx->FragmentProgram.CallbackData;
00259          break;
00260       case GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA:
00261          if (!ctx->Extensions.MESA_program_debug) {
00262             _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
00263             return;
00264          }
00265          *params = *(GLvoid **) &ctx->VertexProgram.Callback;
00266          break;
00267       case GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA:
00268          if (!ctx->Extensions.MESA_program_debug) {
00269             _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
00270             return;
00271          }
00272          *params = ctx->VertexProgram.CallbackData;
00273          break;
00274 #endif
00275       default:
00276          _mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
00277          return;
00278    }
00279 }
00280 
00281 
00288 GLenum GLAPIENTRY
00289 _mesa_GetError( void )
00290 {
00291    GET_CURRENT_CONTEXT(ctx);
00292    GLenum e = ctx->ErrorValue;
00293    ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
00294 
00295    if (MESA_VERBOSE & VERBOSE_API)
00296       _mesa_debug(ctx, "glGetError <-- %s\n", _mesa_lookup_enum_by_nr(e));
00297 
00298    ctx->ErrorValue = (GLenum) GL_NO_ERROR;
00299    return e;
00300 }

Generated on Sat May 26 2012 04:19:04 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.