Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendriverfuncs.c
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 7.1 00004 * 00005 * Copyright (C) 1999-2007 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 #include "main/glheader.h" 00027 #include "main/imports.h" 00028 #include "main/arrayobj.h" 00029 #include "main/buffers.h" 00030 #include "main/context.h" 00031 #include "main/framebuffer.h" 00032 #include "main/mipmap.h" 00033 #include "main/queryobj.h" 00034 #include "main/renderbuffer.h" 00035 #include "main/texcompress.h" 00036 #include "main/texformat.h" 00037 #include "main/teximage.h" 00038 #include "main/texobj.h" 00039 #include "main/texstore.h" 00040 #if FEATURE_ARB_vertex_buffer_object 00041 #include "main/bufferobj.h" 00042 #endif 00043 #if FEATURE_EXT_framebuffer_object 00044 #include "main/fbobject.h" 00045 #include "main/texrender.h" 00046 #endif 00047 00048 #include "shader/program.h" 00049 #include "shader/prog_execute.h" 00050 #include "shader/shader_api.h" 00051 #include "tnl/tnl.h" 00052 #include "swrast/swrast.h" 00053 00054 #include "driverfuncs.h" 00055 00056 00057 00067 void 00068 _mesa_init_driver_functions(struct dd_function_table *driver) 00069 { 00070 _mesa_bzero(driver, sizeof(*driver)); 00071 00072 driver->GetString = NULL; /* REQUIRED! */ 00073 driver->UpdateState = NULL; /* REQUIRED! */ 00074 driver->GetBufferSize = NULL; /* REQUIRED! */ 00075 driver->ResizeBuffers = _mesa_resize_framebuffer; 00076 driver->Error = NULL; 00077 00078 driver->Finish = NULL; 00079 driver->Flush = NULL; 00080 00081 /* framebuffer/image functions */ 00082 driver->Clear = _swrast_Clear; 00083 driver->Accum = _swrast_Accum; 00084 driver->RasterPos = _tnl_RasterPos; 00085 driver->DrawPixels = _swrast_DrawPixels; 00086 driver->ReadPixels = _swrast_ReadPixels; 00087 driver->CopyPixels = _swrast_CopyPixels; 00088 driver->Bitmap = _swrast_Bitmap; 00089 00090 /* Texture functions */ 00091 driver->ChooseTextureFormat = _mesa_choose_tex_format; 00092 driver->TexImage1D = _mesa_store_teximage1d; 00093 driver->TexImage2D = _mesa_store_teximage2d; 00094 driver->TexImage3D = _mesa_store_teximage3d; 00095 driver->TexSubImage1D = _mesa_store_texsubimage1d; 00096 driver->TexSubImage2D = _mesa_store_texsubimage2d; 00097 driver->TexSubImage3D = _mesa_store_texsubimage3d; 00098 driver->GetTexImage = _mesa_get_teximage; 00099 driver->CopyTexImage1D = _swrast_copy_teximage1d; 00100 driver->CopyTexImage2D = _swrast_copy_teximage2d; 00101 driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d; 00102 driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d; 00103 driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d; 00104 driver->GenerateMipmap = _mesa_generate_mipmap; 00105 driver->TestProxyTexImage = _mesa_test_proxy_teximage; 00106 driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; 00107 driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; 00108 driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d; 00109 driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; 00110 driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; 00111 driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; 00112 driver->GetCompressedTexImage = _mesa_get_compressed_teximage; 00113 driver->CompressedTextureSize = _mesa_compressed_texture_size; 00114 driver->BindTexture = NULL; 00115 driver->NewTextureObject = _mesa_new_texture_object; 00116 driver->DeleteTexture = _mesa_delete_texture_object; 00117 driver->NewTextureImage = _mesa_new_texture_image; 00118 driver->FreeTexImageData = _mesa_free_texture_image_data; 00119 driver->MapTexture = NULL; 00120 driver->UnmapTexture = NULL; 00121 driver->TextureMemCpy = _mesa_memcpy; 00122 driver->IsTextureResident = NULL; 00123 driver->PrioritizeTexture = NULL; 00124 driver->ActiveTexture = NULL; 00125 driver->UpdateTexturePalette = NULL; 00126 00127 /* imaging */ 00128 driver->CopyColorTable = _swrast_CopyColorTable; 00129 driver->CopyColorSubTable = _swrast_CopyColorSubTable; 00130 driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; 00131 driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; 00132 00133 /* Vertex/fragment programs */ 00134 driver->BindProgram = NULL; 00135 driver->NewProgram = _mesa_new_program; 00136 driver->DeleteProgram = _mesa_delete_program; 00137 #if FEATURE_MESA_program_debug 00138 driver->GetProgramRegister = _mesa_get_program_register; 00139 #endif /* FEATURE_MESA_program_debug */ 00140 00141 /* simple state commands */ 00142 driver->AlphaFunc = NULL; 00143 driver->BlendColor = NULL; 00144 driver->BlendEquationSeparate = NULL; 00145 driver->BlendFuncSeparate = NULL; 00146 driver->ClearColor = NULL; 00147 driver->ClearDepth = NULL; 00148 driver->ClearIndex = NULL; 00149 driver->ClearStencil = NULL; 00150 driver->ClipPlane = NULL; 00151 driver->ColorMask = NULL; 00152 driver->ColorMaterial = NULL; 00153 driver->CullFace = NULL; 00154 driver->DrawBuffer = NULL; 00155 driver->DrawBuffers = NULL; 00156 driver->FrontFace = NULL; 00157 driver->DepthFunc = NULL; 00158 driver->DepthMask = NULL; 00159 driver->DepthRange = NULL; 00160 driver->Enable = NULL; 00161 driver->Fogfv = NULL; 00162 driver->Hint = NULL; 00163 driver->IndexMask = NULL; 00164 driver->Lightfv = NULL; 00165 driver->LightModelfv = NULL; 00166 driver->LineStipple = NULL; 00167 driver->LineWidth = NULL; 00168 driver->LogicOpcode = NULL; 00169 driver->PointParameterfv = NULL; 00170 driver->PointSize = NULL; 00171 driver->PolygonMode = NULL; 00172 driver->PolygonOffset = NULL; 00173 driver->PolygonStipple = NULL; 00174 driver->ReadBuffer = NULL; 00175 driver->RenderMode = NULL; 00176 driver->Scissor = NULL; 00177 driver->ShadeModel = NULL; 00178 driver->StencilFuncSeparate = NULL; 00179 driver->StencilOpSeparate = NULL; 00180 driver->StencilMaskSeparate = NULL; 00181 driver->TexGen = NULL; 00182 driver->TexEnv = NULL; 00183 driver->TexParameter = NULL; 00184 driver->TextureMatrix = NULL; 00185 driver->Viewport = NULL; 00186 00187 /* vertex arrays */ 00188 driver->VertexPointer = NULL; 00189 driver->NormalPointer = NULL; 00190 driver->ColorPointer = NULL; 00191 driver->FogCoordPointer = NULL; 00192 driver->IndexPointer = NULL; 00193 driver->SecondaryColorPointer = NULL; 00194 driver->TexCoordPointer = NULL; 00195 driver->EdgeFlagPointer = NULL; 00196 driver->VertexAttribPointer = NULL; 00197 driver->LockArraysEXT = NULL; 00198 driver->UnlockArraysEXT = NULL; 00199 00200 /* state queries */ 00201 driver->GetBooleanv = NULL; 00202 driver->GetDoublev = NULL; 00203 driver->GetFloatv = NULL; 00204 driver->GetIntegerv = NULL; 00205 driver->GetPointerv = NULL; 00206 00207 #if FEATURE_ARB_vertex_buffer_object 00208 driver->NewBufferObject = _mesa_new_buffer_object; 00209 driver->DeleteBuffer = _mesa_delete_buffer_object; 00210 driver->BindBuffer = NULL; 00211 driver->BufferData = _mesa_buffer_data; 00212 driver->BufferSubData = _mesa_buffer_subdata; 00213 driver->GetBufferSubData = _mesa_buffer_get_subdata; 00214 driver->MapBuffer = _mesa_buffer_map; 00215 driver->UnmapBuffer = _mesa_buffer_unmap; 00216 #endif 00217 00218 #if FEATURE_EXT_framebuffer_object 00219 driver->NewFramebuffer = _mesa_new_framebuffer; 00220 driver->NewRenderbuffer = _mesa_new_soft_renderbuffer; 00221 driver->RenderTexture = _mesa_render_texture; 00222 driver->FinishRenderTexture = _mesa_finish_render_texture; 00223 driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer; 00224 #endif 00225 00226 #if FEATURE_EXT_framebuffer_blit 00227 driver->BlitFramebuffer = _swrast_BlitFramebuffer; 00228 #endif 00229 00230 /* query objects */ 00231 driver->NewQueryObject = _mesa_new_query_object; 00232 driver->DeleteQuery = _mesa_delete_query; 00233 driver->BeginQuery = _mesa_begin_query; 00234 driver->EndQuery = _mesa_end_query; 00235 driver->WaitQuery = _mesa_wait_query; 00236 00237 /* APPLE_vertex_array_object */ 00238 driver->NewArrayObject = _mesa_new_array_object; 00239 driver->DeleteArrayObject = _mesa_delete_array_object; 00240 driver->BindArrayObject = NULL; 00241 00242 /* T&L stuff */ 00243 driver->NeedValidate = GL_FALSE; 00244 driver->ValidateTnlModule = NULL; 00245 driver->CurrentExecPrimitive = 0; 00246 driver->CurrentSavePrimitive = 0; 00247 driver->NeedFlush = 0; 00248 driver->SaveNeedFlush = 0; 00249 00250 driver->ProgramStringNotify = _tnl_program_string; 00251 driver->FlushVertices = NULL; 00252 driver->SaveFlushVertices = NULL; 00253 driver->NotifySaveBegin = NULL; 00254 driver->LightingSpaceChange = NULL; 00255 00256 /* display list */ 00257 driver->NewList = NULL; 00258 driver->EndList = NULL; 00259 driver->BeginCallList = NULL; 00260 driver->EndCallList = NULL; 00261 00262 00263 /* XXX temporary here */ 00264 _mesa_init_glsl_driver_functions(driver); 00265 } 00266 00267 00273 void 00274 _mesa_init_driver_state(GLcontext *ctx) 00275 { 00276 ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); 00277 00278 ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor); 00279 00280 ctx->Driver.BlendEquationSeparate(ctx, 00281 ctx->Color.BlendEquationRGB, 00282 ctx->Color.BlendEquationA); 00283 00284 ctx->Driver.BlendFuncSeparate(ctx, 00285 ctx->Color.BlendSrcRGB, 00286 ctx->Color.BlendDstRGB, 00287 ctx->Color.BlendSrcA, ctx->Color.BlendDstA); 00288 00289 ctx->Driver.ColorMask(ctx, 00290 ctx->Color.ColorMask[RCOMP], 00291 ctx->Color.ColorMask[GCOMP], 00292 ctx->Color.ColorMask[BCOMP], 00293 ctx->Color.ColorMask[ACOMP]); 00294 00295 ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode); 00296 ctx->Driver.DepthFunc(ctx, ctx->Depth.Func); 00297 ctx->Driver.DepthMask(ctx, ctx->Depth.Mask); 00298 00299 ctx->Driver.Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled); 00300 ctx->Driver.Enable(ctx, GL_BLEND, ctx->Color.BlendEnabled); 00301 ctx->Driver.Enable(ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled); 00302 ctx->Driver.Enable(ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled); 00303 ctx->Driver.Enable(ctx, GL_CULL_FACE, ctx->Polygon.CullFlag); 00304 ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test); 00305 ctx->Driver.Enable(ctx, GL_DITHER, ctx->Color.DitherFlag); 00306 ctx->Driver.Enable(ctx, GL_FOG, ctx->Fog.Enabled); 00307 ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled); 00308 ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag); 00309 ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag); 00310 ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled); 00311 ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled); 00312 ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE); 00313 ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE); 00314 ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE); 00315 ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE); 00316 ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE); 00317 00318 ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color); 00319 ctx->Driver.Fogfv(ctx, GL_FOG_MODE, 0); 00320 ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density); 00321 ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start); 00322 ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End); 00323 00324 ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace); 00325 00326 { 00327 GLfloat f = (GLfloat) ctx->Light.Model.ColorControl; 00328 ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f); 00329 } 00330 00331 ctx->Driver.LineWidth(ctx, ctx->Line.Width); 00332 ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp); 00333 ctx->Driver.PointSize(ctx, ctx->Point.Size); 00334 ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple); 00335 ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, 00336 ctx->Scissor.Width, ctx->Scissor.Height); 00337 ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel); 00338 ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT, 00339 ctx->Stencil.Function[0], 00340 ctx->Stencil.Ref[0], 00341 ctx->Stencil.ValueMask[0]); 00342 ctx->Driver.StencilFuncSeparate(ctx, GL_BACK, 00343 ctx->Stencil.Function[1], 00344 ctx->Stencil.Ref[1], 00345 ctx->Stencil.ValueMask[1]); 00346 ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT, ctx->Stencil.WriteMask[0]); 00347 ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, ctx->Stencil.WriteMask[1]); 00348 ctx->Driver.StencilOpSeparate(ctx, GL_FRONT, 00349 ctx->Stencil.FailFunc[0], 00350 ctx->Stencil.ZFailFunc[0], 00351 ctx->Stencil.ZPassFunc[0]); 00352 ctx->Driver.StencilOpSeparate(ctx, GL_BACK, 00353 ctx->Stencil.FailFunc[1], 00354 ctx->Stencil.ZFailFunc[1], 00355 ctx->Stencil.ZPassFunc[1]); 00356 00357 00358 ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]); 00359 } Generated on Sun May 27 2012 04:19:56 for ReactOS by
1.7.6.1
|