| 1 |
/* |
| 2 |
* Mesa 3-D graphics library |
| 3 |
* Version: 6.3 |
| 4 |
* |
| 5 |
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved. |
| 6 |
* |
| 7 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 8 |
* copy of this software and associated documentation files (the "Software"), |
| 9 |
* to deal in the Software without restriction, including without limitation |
| 10 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 12 |
* Software is furnished to do so, subject to the following conditions: |
| 13 |
* |
| 14 |
* The above copyright notice and this permission notice shall be included |
| 15 |
* in all copies or substantial portions of the Software. |
| 16 |
* |
| 17 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 18 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 |
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 21 |
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 22 |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 |
*/ |
| 24 |
|
| 25 |
|
| 26 |
#include "glheader.h" |
| 27 |
#include "imports.h" |
| 28 |
#include "buffers.h" |
| 29 |
#include "context.h" |
| 30 |
#include "framebuffer.h" |
| 31 |
#include "program.h" |
| 32 |
#include "renderbuffer.h" |
| 33 |
#include "texcompress.h" |
| 34 |
#include "texformat.h" |
| 35 |
#include "teximage.h" |
| 36 |
#include "texobj.h" |
| 37 |
#include "texstore.h" |
| 38 |
#if FEATURE_ARB_vertex_buffer_object |
| 39 |
#include "bufferobj.h" |
| 40 |
#endif |
| 41 |
#if FEATURE_EXT_framebuffer_object |
| 42 |
#include "fbobject.h" |
| 43 |
#include "texrender.h" |
| 44 |
#endif |
| 45 |
|
| 46 |
#include "driverfuncs.h" |
| 47 |
#include "swrast/swrast.h" |
| 48 |
#include "tnl/tnl.h" |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
/** |
| 53 |
* Plug in default functions for all pointers in the dd_function_table |
| 54 |
* structure. |
| 55 |
* Device drivers should call this function and then plug in any |
| 56 |
* functions which it wants to override. |
| 57 |
* Some functions (pointers) MUST be implemented by all drivers (REQUIRED). |
| 58 |
* |
| 59 |
* \param table the dd_function_table to initialize |
| 60 |
*/ |
| 61 |
void |
| 62 |
_mesa_init_driver_functions(struct dd_function_table *driver) |
| 63 |
{ |
| 64 |
_mesa_bzero(driver, sizeof(*driver)); |
| 65 |
|
| 66 |
driver->GetString = NULL; /* REQUIRED! */ |
| 67 |
driver->UpdateState = NULL; /* REQUIRED! */ |
| 68 |
driver->GetBufferSize = NULL; /* REQUIRED! */ |
| 69 |
driver->ResizeBuffers = _mesa_resize_framebuffer; |
| 70 |
driver->Error = NULL; |
| 71 |
|
| 72 |
driver->Finish = NULL; |
| 73 |
driver->Flush = NULL; |
| 74 |
|
| 75 |
/* framebuffer/image functions */ |
| 76 |
driver->Clear = _swrast_Clear; |
| 77 |
driver->Accum = _swrast_Accum; |
| 78 |
driver->DrawPixels = _swrast_DrawPixels; |
| 79 |
driver->ReadPixels = _swrast_ReadPixels; |
| 80 |
driver->CopyPixels = _swrast_CopyPixels; |
| 81 |
driver->Bitmap = _swrast_Bitmap; |
| 82 |
|
| 83 |
/* Texture functions */ |
| 84 |
driver->ChooseTextureFormat = _mesa_choose_tex_format; |
| 85 |
driver->TexImage1D = _mesa_store_teximage1d; |
| 86 |
driver->TexImage2D = _mesa_store_teximage2d; |
| 87 |
driver->TexImage3D = _mesa_store_teximage3d; |
| 88 |
driver->TexSubImage1D = _mesa_store_texsubimage1d; |
| 89 |
driver->TexSubImage2D = _mesa_store_texsubimage2d; |
| 90 |
driver->TexSubImage3D = _mesa_store_texsubimage3d; |
| 91 |
driver->GetTexImage = _mesa_get_teximage; |
| 92 |
driver->CopyTexImage1D = _swrast_copy_teximage1d; |
| 93 |
driver->CopyTexImage2D = _swrast_copy_teximage2d; |
| 94 |
driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d; |
| 95 |
driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d; |
| 96 |
driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d; |
| 97 |
driver->TestProxyTexImage = _mesa_test_proxy_teximage; |
| 98 |
driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; |
| 99 |
driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; |
| 100 |
driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d; |
| 101 |
driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; |
| 102 |
driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; |
| 103 |
driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; |
| 104 |
driver->GetCompressedTexImage = _mesa_get_compressed_teximage; |
| 105 |
driver->CompressedTextureSize = _mesa_compressed_texture_size; |
| 106 |
driver->BindTexture = NULL; |
| 107 |
driver->NewTextureObject = _mesa_new_texture_object; |
| 108 |
driver->DeleteTexture = _mesa_delete_texture_object; |
| 109 |
driver->NewTextureImage = _mesa_new_texture_image; |
| 110 |
driver->FreeTexImageData = _mesa_free_texture_image_data; |
| 111 |
driver->TextureMemCpy = _mesa_memcpy; |
| 112 |
driver->IsTextureResident = NULL; |
| 113 |
driver->PrioritizeTexture = NULL; |
| 114 |
driver->ActiveTexture = NULL; |
| 115 |
driver->UpdateTexturePalette = NULL; |
| 116 |
|
| 117 |
/* imaging */ |
| 118 |
driver->CopyColorTable = _swrast_CopyColorTable; |
| 119 |
driver->CopyColorSubTable = _swrast_CopyColorSubTable; |
| 120 |
driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; |
| 121 |
driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; |
| 122 |
|
| 123 |
/* Vertex/fragment programs */ |
| 124 |
driver->BindProgram = NULL; |
| 125 |
driver->NewProgram = _mesa_new_program; |
| 126 |
driver->DeleteProgram = _mesa_delete_program; |
| 127 |
|
| 128 |
/* simple state commands */ |
| 129 |
driver->AlphaFunc = NULL; |
| 130 |
driver->BlendColor = NULL; |
| 131 |
driver->BlendEquationSeparate = NULL; |
| 132 |
driver->BlendFuncSeparate = NULL; |
| 133 |
driver->ClearColor = NULL; |
| 134 |
driver->ClearDepth = NULL; |
| 135 |
driver->ClearIndex = NULL; |
| 136 |
driver->ClearStencil = NULL; |
| 137 |
driver->ClipPlane = NULL; |
| 138 |
driver->ColorMask = NULL; |
| 139 |
driver->ColorMaterial = NULL; |
| 140 |
driver->CullFace = NULL; |
| 141 |
driver->DrawBuffer = _swrast_DrawBuffer; |
| 142 |
driver->DrawBuffers = NULL; /***_swrast_DrawBuffers;***/ |
| 143 |
driver->FrontFace = NULL; |
| 144 |
driver->DepthFunc = NULL; |
| 145 |
driver->DepthMask = NULL; |
| 146 |
driver->DepthRange = NULL; |
| 147 |
driver->Enable = NULL; |
| 148 |
driver->Fogfv = NULL; |
| 149 |
driver->Hint = NULL; |
| 150 |
driver->IndexMask = NULL; |
| 151 |
driver->Lightfv = NULL; |
| 152 |
driver->LightModelfv = NULL; |
| 153 |
driver->LineStipple = NULL; |
| 154 |
driver->LineWidth = NULL; |
| 155 |
driver->LogicOpcode = NULL; |
| 156 |
driver->PointParameterfv = NULL; |
| 157 |
driver->PointSize = NULL; |
| 158 |
driver->PolygonMode = NULL; |
| 159 |
driver->PolygonOffset = NULL; |
| 160 |
driver->PolygonStipple = NULL; |
| 161 |
driver->ReadBuffer = NULL; |
| 162 |
driver->RenderMode = NULL; |
| 163 |
driver->Scissor = NULL; |
| 164 |
driver->ShadeModel = NULL; |
| 165 |
driver->StencilFunc = NULL; |
| 166 |
driver->StencilMask = NULL; |
| 167 |
driver->StencilOp = NULL; |
| 168 |
driver->ActiveStencilFace = NULL; |
| 169 |
driver->TexGen = NULL; |
| 170 |
driver->TexEnv = NULL; |
| 171 |
driver->TexParameter = NULL; |
| 172 |
driver->TextureMatrix = NULL; |
| 173 |
driver->Viewport = NULL; |
| 174 |
|
| 175 |
/* vertex arrays */ |
| 176 |
driver->VertexPointer = NULL; |
| 177 |
driver->NormalPointer = NULL; |
| 178 |
driver->ColorPointer = NULL; |
| 179 |
driver->FogCoordPointer = NULL; |
| 180 |
driver->IndexPointer = NULL; |
| 181 |
driver->SecondaryColorPointer = NULL; |
| 182 |
driver->TexCoordPointer = NULL; |
| 183 |
driver->EdgeFlagPointer = NULL; |
| 184 |
driver->VertexAttribPointer = NULL; |
| 185 |
driver->LockArraysEXT = NULL; |
| 186 |
driver->UnlockArraysEXT = NULL; |
| 187 |
|
| 188 |
/* state queries */ |
| 189 |
driver->GetBooleanv = NULL; |
| 190 |
driver->GetDoublev = NULL; |
| 191 |
driver->GetFloatv = NULL; |
| 192 |
driver->GetIntegerv = NULL; |
| 193 |
driver->GetPointerv = NULL; |
| 194 |
|
| 195 |
#if FEATURE_ARB_vertex_buffer_object |
| 196 |
driver->NewBufferObject = _mesa_new_buffer_object; |
| 197 |
driver->DeleteBuffer = _mesa_delete_buffer_object; |
| 198 |
driver->BindBuffer = NULL; |
| 199 |
driver->BufferData = _mesa_buffer_data; |
| 200 |
driver->BufferSubData = _mesa_buffer_subdata; |
| 201 |
driver->GetBufferSubData = _mesa_buffer_get_subdata; |
| 202 |
driver->MapBuffer = _mesa_buffer_map; |
| 203 |
driver->UnmapBuffer = _mesa_buffer_unmap; |
| 204 |
#endif |
| 205 |
|
| 206 |
#if FEATURE_EXT_framebuffer_object |
| 207 |
driver->NewFramebuffer = _mesa_new_framebuffer; |
| 208 |
driver->NewRenderbuffer = _mesa_new_soft_renderbuffer; |
| 209 |
driver->RenderbufferTexture = _mesa_renderbuffer_texture; |
| 210 |
driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer; |
| 211 |
#endif |
| 212 |
|
| 213 |
/* T&L stuff */ |
| 214 |
driver->NeedValidate = GL_FALSE; |
| 215 |
driver->ValidateTnlModule = NULL; |
| 216 |
driver->CurrentExecPrimitive = 0; |
| 217 |
driver->CurrentSavePrimitive = 0; |
| 218 |
driver->NeedFlush = 0; |
| 219 |
driver->SaveNeedFlush = 0; |
| 220 |
|
| 221 |
driver->FlushVertices = NULL; |
| 222 |
driver->SaveFlushVertices = NULL; |
| 223 |
driver->NotifySaveBegin = NULL; |
| 224 |
driver->LightingSpaceChange = NULL; |
| 225 |
driver->MakeCurrent = NULL; |
| 226 |
driver->ProgramStringNotify = _tnl_program_string; |
| 227 |
|
| 228 |
/* display list */ |
| 229 |
driver->NewList = NULL; |
| 230 |
driver->EndList = NULL; |
| 231 |
driver->BeginCallList = NULL; |
| 232 |
driver->EndCallList = NULL; |
| 233 |
} |