driverfuncs.c revision b43671c8bf0ff640243c670ff98225d2a3c10632
1/* 2 * Mesa 3-D graphics library 3 * Version: 6.5 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 "occlude.h" 32#include "program.h" 33#include "renderbuffer.h" 34#include "texcompress.h" 35#include "texformat.h" 36#include "teximage.h" 37#include "texobj.h" 38#include "texstore.h" 39#if FEATURE_ARB_vertex_buffer_object 40#include "bufferobj.h" 41#endif 42#if FEATURE_EXT_framebuffer_object 43#include "fbobject.h" 44#include "texrender.h" 45#endif 46 47#include "driverfuncs.h" 48#include "swrast/swrast.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 */ 61void 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 = NULL; 142 driver->DrawBuffers = NULL; 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->StencilFuncSeparate = NULL; 166 driver->StencilOpSeparate = NULL; 167 driver->StencilMaskSeparate = NULL; 168 driver->TexGen = NULL; 169 driver->TexEnv = NULL; 170 driver->TexParameter = NULL; 171 driver->TextureMatrix = NULL; 172 driver->Viewport = NULL; 173 174 /* vertex arrays */ 175 driver->VertexPointer = NULL; 176 driver->NormalPointer = NULL; 177 driver->ColorPointer = NULL; 178 driver->FogCoordPointer = NULL; 179 driver->IndexPointer = NULL; 180 driver->SecondaryColorPointer = NULL; 181 driver->TexCoordPointer = NULL; 182 driver->EdgeFlagPointer = NULL; 183 driver->VertexAttribPointer = NULL; 184 driver->LockArraysEXT = NULL; 185 driver->UnlockArraysEXT = NULL; 186 187 /* state queries */ 188 driver->GetBooleanv = NULL; 189 driver->GetDoublev = NULL; 190 driver->GetFloatv = NULL; 191 driver->GetIntegerv = NULL; 192 driver->GetPointerv = NULL; 193 194#if FEATURE_ARB_vertex_buffer_object 195 driver->NewBufferObject = _mesa_new_buffer_object; 196 driver->DeleteBuffer = _mesa_delete_buffer_object; 197 driver->BindBuffer = NULL; 198 driver->BufferData = _mesa_buffer_data; 199 driver->BufferSubData = _mesa_buffer_subdata; 200 driver->GetBufferSubData = _mesa_buffer_get_subdata; 201 driver->MapBuffer = _mesa_buffer_map; 202 driver->UnmapBuffer = _mesa_buffer_unmap; 203#endif 204 205#if FEATURE_EXT_framebuffer_object 206 driver->NewFramebuffer = _mesa_new_framebuffer; 207 driver->NewRenderbuffer = _mesa_new_soft_renderbuffer; 208 driver->RenderbufferTexture = _mesa_renderbuffer_texture; 209 driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer; 210#endif 211 212 /* query objects */ 213 driver->NewQueryObject = _mesa_new_query_object; 214 driver->BeginQuery = NULL; 215 driver->EndQuery = NULL; 216 217 /* T&L stuff */ 218 driver->NeedValidate = GL_FALSE; 219 driver->ValidateTnlModule = NULL; 220 driver->CurrentExecPrimitive = 0; 221 driver->CurrentSavePrimitive = 0; 222 driver->NeedFlush = 0; 223 driver->SaveNeedFlush = 0; 224 225 driver->FlushVertices = NULL; 226 driver->SaveFlushVertices = NULL; 227 driver->NotifySaveBegin = NULL; 228 driver->LightingSpaceChange = NULL; 229 230 /* display list */ 231 driver->NewList = NULL; 232 driver->EndList = NULL; 233 driver->BeginCallList = NULL; 234 driver->EndCallList = NULL; 235} 236