blob: 4a8ea31a48f885b555485eea1286d880cadbeac1 [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 Paule4b23562005-05-04 20:11:35 +000030#include "framebuffer.h"
Brian Paul4d859f72004-01-23 18:57:05 +000031#include "program.h"
Brian Paule4b23562005-05-04 20:11:35 +000032#include "renderbuffer.h"
Brian Paul8f04c122004-04-27 13:39:20 +000033#include "texcompress.h"
Brian Paul988a8862004-01-20 02:36:44 +000034#include "texformat.h"
35#include "teximage.h"
36#include "texobj.h"
37#include "texstore.h"
Brian Paul2c6f9112005-02-24 05:47:06 +000038#if FEATURE_ARB_vertex_buffer_object
Brian Paul988a8862004-01-20 02:36:44 +000039#include "bufferobj.h"
Brian Paul2c6f9112005-02-24 05:47:06 +000040#endif
41#if FEATURE_EXT_framebuffer_object
42#include "fbobject.h"
Brian Paule4b23562005-05-04 20:11:35 +000043#include "texrender.h"
Brian Paul2c6f9112005-02-24 05:47:06 +000044#endif
Brian Paul988a8862004-01-20 02:36:44 +000045
46#include "driverfuncs.h"
47#include "swrast/swrast.h"
48
49
50
51/**
52 * Plug in default functions for all pointers in the dd_function_table
53 * structure.
54 * Device drivers should call this function and then plug in any
55 * functions which it wants to override.
56 * Some functions (pointers) MUST be implemented by all drivers (REQUIRED).
57 *
58 * \param table the dd_function_table to initialize
59 */
60void
61_mesa_init_driver_functions(struct dd_function_table *driver)
62{
63 _mesa_bzero(driver, sizeof(*driver));
64
65 driver->GetString = NULL; /* REQUIRED! */
66 driver->UpdateState = NULL; /* REQUIRED! */
67 driver->GetBufferSize = NULL; /* REQUIRED! */
Brian Paule4b23562005-05-04 20:11:35 +000068 driver->ResizeBuffers = _mesa_resize_framebuffer;
Brian Paul988a8862004-01-20 02:36:44 +000069 driver->Error = NULL;
70
71 driver->Finish = NULL;
72 driver->Flush = NULL;
73
74 /* framebuffer/image functions */
75 driver->Clear = _swrast_Clear;
76 driver->Accum = _swrast_Accum;
77 driver->DrawPixels = _swrast_DrawPixels;
78 driver->ReadPixels = _swrast_ReadPixels;
79 driver->CopyPixels = _swrast_CopyPixels;
80 driver->Bitmap = _swrast_Bitmap;
81
82 /* Texture functions */
83 driver->ChooseTextureFormat = _mesa_choose_tex_format;
84 driver->TexImage1D = _mesa_store_teximage1d;
85 driver->TexImage2D = _mesa_store_teximage2d;
86 driver->TexImage3D = _mesa_store_teximage3d;
87 driver->TexSubImage1D = _mesa_store_texsubimage1d;
88 driver->TexSubImage2D = _mesa_store_texsubimage2d;
89 driver->TexSubImage3D = _mesa_store_texsubimage3d;
Brian Paul68d293b2004-12-12 19:03:16 +000090 driver->GetTexImage = _mesa_get_teximage;
Brian Paul988a8862004-01-20 02:36:44 +000091 driver->CopyTexImage1D = _swrast_copy_teximage1d;
92 driver->CopyTexImage2D = _swrast_copy_teximage2d;
93 driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
94 driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
95 driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
96 driver->TestProxyTexImage = _mesa_test_proxy_teximage;
97 driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
98 driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
99 driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d;
100 driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
101 driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
102 driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
Brian Paul68d293b2004-12-12 19:03:16 +0000103 driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
Brian Paul8f04c122004-04-27 13:39:20 +0000104 driver->CompressedTextureSize = _mesa_compressed_texture_size;
Brian Paul988a8862004-01-20 02:36:44 +0000105 driver->BindTexture = NULL;
106 driver->NewTextureObject = _mesa_new_texture_object;
107 driver->DeleteTexture = _mesa_delete_texture_object;
108 driver->NewTextureImage = _mesa_new_texture_image;
Keith Whitwell3e62d3a2005-03-22 14:27:10 +0000109 driver->FreeTexImageData = _mesa_free_texture_image_data;
Keith Whitwell17bcf9f2005-05-23 12:17:27 +0000110 driver->TextureMemCpy = _mesa_memcpy;
Brian Paul988a8862004-01-20 02:36:44 +0000111 driver->IsTextureResident = NULL;
112 driver->PrioritizeTexture = NULL;
113 driver->ActiveTexture = NULL;
114 driver->UpdateTexturePalette = NULL;
115
116 /* imaging */
117 driver->CopyColorTable = _swrast_CopyColorTable;
118 driver->CopyColorSubTable = _swrast_CopyColorSubTable;
119 driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
120 driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
121
Brian Paul4d859f72004-01-23 18:57:05 +0000122 /* Vertex/fragment programs */
123 driver->BindProgram = NULL;
124 driver->NewProgram = _mesa_new_program;
125 driver->DeleteProgram = _mesa_delete_program;
126
Brian Paul988a8862004-01-20 02:36:44 +0000127 /* simple state commands */
128 driver->AlphaFunc = NULL;
129 driver->BlendColor = NULL;
Ian Romanickc93105e2004-01-27 18:52:40 +0000130 driver->BlendEquationSeparate = NULL;
Brian Paul988a8862004-01-20 02:36:44 +0000131 driver->BlendFuncSeparate = NULL;
132 driver->ClearColor = NULL;
133 driver->ClearDepth = NULL;
134 driver->ClearIndex = NULL;
135 driver->ClearStencil = NULL;
136 driver->ClipPlane = NULL;
137 driver->ColorMask = NULL;
138 driver->ColorMaterial = NULL;
139 driver->CullFace = NULL;
140 driver->DrawBuffer = _swrast_DrawBuffer;
Brian Paule4b23562005-05-04 20:11:35 +0000141 driver->DrawBuffers = NULL; /***_swrast_DrawBuffers;***/
Brian Paul988a8862004-01-20 02:36:44 +0000142 driver->FrontFace = NULL;
143 driver->DepthFunc = NULL;
144 driver->DepthMask = NULL;
145 driver->DepthRange = NULL;
146 driver->Enable = NULL;
147 driver->Fogfv = NULL;
148 driver->Hint = NULL;
149 driver->IndexMask = NULL;
150 driver->Lightfv = NULL;
151 driver->LightModelfv = NULL;
152 driver->LineStipple = NULL;
153 driver->LineWidth = NULL;
154 driver->LogicOpcode = NULL;
155 driver->PointParameterfv = NULL;
156 driver->PointSize = NULL;
157 driver->PolygonMode = NULL;
158 driver->PolygonOffset = NULL;
159 driver->PolygonStipple = NULL;
160 driver->ReadBuffer = NULL;
161 driver->RenderMode = NULL;
162 driver->Scissor = NULL;
163 driver->ShadeModel = NULL;
164 driver->StencilFunc = NULL;
165 driver->StencilMask = NULL;
166 driver->StencilOp = NULL;
167 driver->ActiveStencilFace = 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;
Brian Paul7eab3372004-10-31 15:23:42 +0000202 driver->UnmapBuffer = _mesa_buffer_unmap;
Brian Paul988a8862004-01-20 02:36:44 +0000203#endif
204
Brian Paul2c6f9112005-02-24 05:47:06 +0000205#if FEATURE_EXT_framebuffer_object
206 driver->NewFramebuffer = _mesa_new_framebuffer;
Brian Paule4b23562005-05-04 20:11:35 +0000207 driver->NewRenderbuffer = _mesa_new_soft_renderbuffer;
208 driver->RenderbufferTexture = _mesa_renderbuffer_texture;
209 driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer;
Brian Paul2c6f9112005-02-24 05:47:06 +0000210#endif
211
Brian Paul988a8862004-01-20 02:36:44 +0000212 /* T&L stuff */
213 driver->NeedValidate = GL_FALSE;
214 driver->ValidateTnlModule = NULL;
215 driver->CurrentExecPrimitive = 0;
216 driver->CurrentSavePrimitive = 0;
217 driver->NeedFlush = 0;
218 driver->SaveNeedFlush = 0;
219
220 driver->FlushVertices = NULL;
221 driver->SaveFlushVertices = NULL;
222 driver->NotifySaveBegin = NULL;
223 driver->LightingSpaceChange = NULL;
224 driver->MakeCurrent = NULL;
225
226 /* display list */
227 driver->NewList = NULL;
228 driver->EndList = NULL;
229 driver->BeginCallList = NULL;
230 driver->EndCallList = NULL;
231}