blob: 69cc9195689b0ef1bb7d2944a4353e66761e8a90 [file] [log] [blame]
Brian Paul988a8862004-01-20 02:36:44 +00001/*
2 * Mesa 3-D graphics library
Brian Paul7eab3372004-10-31 15:23:42 +00003 * Version: 6.3
Brian Paul988a8862004-01-20 02:36:44 +00004 *
Brian Paul2c6f9112005-02-24 05:47:06 +00005 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
Brian Paul988a8862004-01-20 02:36:44 +00006 *
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"
Brian Paul4d859f72004-01-23 18:57:05 +000030#include "program.h"
Brian Paul8f04c122004-04-27 13:39:20 +000031#include "texcompress.h"
Brian Paul988a8862004-01-20 02:36:44 +000032#include "texformat.h"
33#include "teximage.h"
34#include "texobj.h"
35#include "texstore.h"
Brian Paul2c6f9112005-02-24 05:47:06 +000036#if FEATURE_ARB_vertex_buffer_object
Brian Paul988a8862004-01-20 02:36:44 +000037#include "bufferobj.h"
Brian Paul2c6f9112005-02-24 05:47:06 +000038#endif
39#if FEATURE_EXT_framebuffer_object
40#include "fbobject.h"
41#endif
Brian Paul988a8862004-01-20 02:36:44 +000042
43#include "driverfuncs.h"
44#include "swrast/swrast.h"
45
46
47
48/**
49 * Plug in default functions for all pointers in the dd_function_table
50 * structure.
51 * Device drivers should call this function and then plug in any
52 * functions which it wants to override.
53 * Some functions (pointers) MUST be implemented by all drivers (REQUIRED).
54 *
55 * \param table the dd_function_table to initialize
56 */
57void
58_mesa_init_driver_functions(struct dd_function_table *driver)
59{
60 _mesa_bzero(driver, sizeof(*driver));
61
62 driver->GetString = NULL; /* REQUIRED! */
63 driver->UpdateState = NULL; /* REQUIRED! */
64 driver->GetBufferSize = NULL; /* REQUIRED! */
65 driver->ResizeBuffers = _swrast_alloc_buffers;
66 driver->Error = NULL;
67
68 driver->Finish = NULL;
69 driver->Flush = NULL;
70
71 /* framebuffer/image functions */
72 driver->Clear = _swrast_Clear;
73 driver->Accum = _swrast_Accum;
74 driver->DrawPixels = _swrast_DrawPixels;
75 driver->ReadPixels = _swrast_ReadPixels;
76 driver->CopyPixels = _swrast_CopyPixels;
77 driver->Bitmap = _swrast_Bitmap;
78
79 /* Texture functions */
80 driver->ChooseTextureFormat = _mesa_choose_tex_format;
81 driver->TexImage1D = _mesa_store_teximage1d;
82 driver->TexImage2D = _mesa_store_teximage2d;
83 driver->TexImage3D = _mesa_store_teximage3d;
84 driver->TexSubImage1D = _mesa_store_texsubimage1d;
85 driver->TexSubImage2D = _mesa_store_texsubimage2d;
86 driver->TexSubImage3D = _mesa_store_texsubimage3d;
Brian Paul68d293b2004-12-12 19:03:16 +000087 driver->GetTexImage = _mesa_get_teximage;
Brian Paul988a8862004-01-20 02:36:44 +000088 driver->CopyTexImage1D = _swrast_copy_teximage1d;
89 driver->CopyTexImage2D = _swrast_copy_teximage2d;
90 driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
91 driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
92 driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
93 driver->TestProxyTexImage = _mesa_test_proxy_teximage;
94 driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
95 driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
96 driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d;
97 driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
98 driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
99 driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
Brian Paul68d293b2004-12-12 19:03:16 +0000100 driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
Brian Paul8f04c122004-04-27 13:39:20 +0000101 driver->CompressedTextureSize = _mesa_compressed_texture_size;
Brian Paul988a8862004-01-20 02:36:44 +0000102 driver->BindTexture = NULL;
103 driver->NewTextureObject = _mesa_new_texture_object;
104 driver->DeleteTexture = _mesa_delete_texture_object;
105 driver->NewTextureImage = _mesa_new_texture_image;
Keith Whitwell3e62d3a2005-03-22 14:27:10 +0000106 driver->FreeTexImageData = _mesa_free_texture_image_data;
Brian Paul988a8862004-01-20 02:36:44 +0000107 driver->IsTextureResident = NULL;
108 driver->PrioritizeTexture = NULL;
109 driver->ActiveTexture = NULL;
110 driver->UpdateTexturePalette = NULL;
111
112 /* imaging */
113 driver->CopyColorTable = _swrast_CopyColorTable;
114 driver->CopyColorSubTable = _swrast_CopyColorSubTable;
115 driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
116 driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
117
Brian Paul4d859f72004-01-23 18:57:05 +0000118 /* Vertex/fragment programs */
119 driver->BindProgram = NULL;
120 driver->NewProgram = _mesa_new_program;
121 driver->DeleteProgram = _mesa_delete_program;
122
Brian Paul988a8862004-01-20 02:36:44 +0000123 /* simple state commands */
124 driver->AlphaFunc = NULL;
125 driver->BlendColor = NULL;
Ian Romanickc93105e2004-01-27 18:52:40 +0000126 driver->BlendEquationSeparate = NULL;
Brian Paul988a8862004-01-20 02:36:44 +0000127 driver->BlendFuncSeparate = NULL;
128 driver->ClearColor = NULL;
129 driver->ClearDepth = NULL;
130 driver->ClearIndex = NULL;
131 driver->ClearStencil = NULL;
132 driver->ClipPlane = NULL;
133 driver->ColorMask = NULL;
134 driver->ColorMaterial = NULL;
135 driver->CullFace = NULL;
136 driver->DrawBuffer = _swrast_DrawBuffer;
Brian Paul53f82c52004-10-02 16:39:09 +0000137 driver->DrawBuffers = _swrast_DrawBuffers;
Brian Paul988a8862004-01-20 02:36:44 +0000138 driver->FrontFace = NULL;
139 driver->DepthFunc = NULL;
140 driver->DepthMask = NULL;
141 driver->DepthRange = NULL;
142 driver->Enable = NULL;
143 driver->Fogfv = NULL;
144 driver->Hint = NULL;
145 driver->IndexMask = NULL;
146 driver->Lightfv = NULL;
147 driver->LightModelfv = NULL;
148 driver->LineStipple = NULL;
149 driver->LineWidth = NULL;
150 driver->LogicOpcode = NULL;
151 driver->PointParameterfv = NULL;
152 driver->PointSize = NULL;
153 driver->PolygonMode = NULL;
154 driver->PolygonOffset = NULL;
155 driver->PolygonStipple = NULL;
156 driver->ReadBuffer = NULL;
157 driver->RenderMode = NULL;
158 driver->Scissor = NULL;
159 driver->ShadeModel = NULL;
160 driver->StencilFunc = NULL;
161 driver->StencilMask = NULL;
162 driver->StencilOp = NULL;
163 driver->ActiveStencilFace = NULL;
164 driver->TexGen = NULL;
165 driver->TexEnv = NULL;
166 driver->TexParameter = NULL;
167 driver->TextureMatrix = NULL;
168 driver->Viewport = NULL;
169
170 /* vertex arrays */
171 driver->VertexPointer = NULL;
172 driver->NormalPointer = NULL;
173 driver->ColorPointer = NULL;
174 driver->FogCoordPointer = NULL;
175 driver->IndexPointer = NULL;
176 driver->SecondaryColorPointer = NULL;
177 driver->TexCoordPointer = NULL;
178 driver->EdgeFlagPointer = NULL;
179 driver->VertexAttribPointer = NULL;
180 driver->LockArraysEXT = NULL;
181 driver->UnlockArraysEXT = NULL;
182
183 /* state queries */
184 driver->GetBooleanv = NULL;
185 driver->GetDoublev = NULL;
186 driver->GetFloatv = NULL;
187 driver->GetIntegerv = NULL;
188 driver->GetPointerv = NULL;
189
190#if FEATURE_ARB_vertex_buffer_object
191 driver->NewBufferObject = _mesa_new_buffer_object;
192 driver->DeleteBuffer = _mesa_delete_buffer_object;
193 driver->BindBuffer = NULL;
194 driver->BufferData = _mesa_buffer_data;
195 driver->BufferSubData = _mesa_buffer_subdata;
196 driver->GetBufferSubData = _mesa_buffer_get_subdata;
197 driver->MapBuffer = _mesa_buffer_map;
Brian Paul7eab3372004-10-31 15:23:42 +0000198 driver->UnmapBuffer = _mesa_buffer_unmap;
Brian Paul988a8862004-01-20 02:36:44 +0000199#endif
200
Brian Paul2c6f9112005-02-24 05:47:06 +0000201#if FEATURE_EXT_framebuffer_object
202 driver->NewFramebuffer = _mesa_new_framebuffer;
203 driver->NewRenderbuffer = _mesa_new_renderbuffer;
204#endif
205
Brian Paul988a8862004-01-20 02:36:44 +0000206 /* T&L stuff */
207 driver->NeedValidate = GL_FALSE;
208 driver->ValidateTnlModule = NULL;
209 driver->CurrentExecPrimitive = 0;
210 driver->CurrentSavePrimitive = 0;
211 driver->NeedFlush = 0;
212 driver->SaveNeedFlush = 0;
213
214 driver->FlushVertices = NULL;
215 driver->SaveFlushVertices = NULL;
216 driver->NotifySaveBegin = NULL;
217 driver->LightingSpaceChange = NULL;
218 driver->MakeCurrent = NULL;
219
220 /* display list */
221 driver->NewList = NULL;
222 driver->EndList = NULL;
223 driver->BeginCallList = NULL;
224 driver->EndCallList = NULL;
225}