2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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.
26 #include "main/glheader.h"
27 #include "main/imports.h"
28 #include "main/accum.h"
29 #include "main/arrayobj.h"
30 #include "main/context.h"
31 #include "main/framebuffer.h"
32 #include "main/mipmap.h"
33 #include "main/readpix.h"
34 #include "main/renderbuffer.h"
35 #include "main/shaderobj.h"
36 #include "main/texformat.h"
37 #include "main/texgetimage.h"
38 #include "main/teximage.h"
39 #include "main/texobj.h"
40 #include "main/texstore.h"
41 #include "main/bufferobj.h"
42 #include "main/fbobject.h"
43 #include "main/texturebarrier.h"
45 #include "program/program.h"
47 #include "swrast/swrast.h"
48 #include "swrast/s_renderbuffer.h"
50 #include "driverfuncs.h"
56 * Plug in default functions for all pointers in the dd_function_table
58 * Device drivers should call this function and then plug in any
59 * functions which it wants to override.
60 * Some functions (pointers) MUST be implemented by all drivers (REQUIRED).
62 * \param table the dd_function_table to initialize
65 _mesa_init_driver_functions(struct dd_function_table
*driver
)
67 memset(driver
, 0, sizeof(*driver
));
69 driver
->GetString
= NULL
; /* REQUIRED! */
70 driver
->UpdateState
= NULL
; /* REQUIRED! */
71 driver
->GetBufferSize
= NULL
; /* REQUIRED! */
72 driver
->ResizeBuffers
= _mesa_resize_framebuffer
;
75 driver
->Finish
= NULL
;
78 /* framebuffer/image functions */
79 driver
->Clear
= _swrast_Clear
;
80 driver
->Accum
= _mesa_accum
;
81 driver
->RasterPos
= _tnl_RasterPos
;
82 driver
->DrawPixels
= _swrast_DrawPixels
;
83 driver
->ReadPixels
= _mesa_readpixels
;
84 driver
->CopyPixels
= _swrast_CopyPixels
;
85 driver
->Bitmap
= _swrast_Bitmap
;
87 /* Texture functions */
88 driver
->ChooseTextureFormat
= _mesa_choose_tex_format
;
89 driver
->TexImage1D
= _mesa_store_teximage1d
;
90 driver
->TexImage2D
= _mesa_store_teximage2d
;
91 driver
->TexImage3D
= _mesa_store_teximage3d
;
92 driver
->TexSubImage1D
= _mesa_store_texsubimage1d
;
93 driver
->TexSubImage2D
= _mesa_store_texsubimage2d
;
94 driver
->TexSubImage3D
= _mesa_store_texsubimage3d
;
95 driver
->GetTexImage
= _mesa_get_teximage
;
96 driver
->CopyTexSubImage1D
= _mesa_meta_CopyTexSubImage1D
;
97 driver
->CopyTexSubImage2D
= _mesa_meta_CopyTexSubImage2D
;
98 driver
->CopyTexSubImage3D
= _mesa_meta_CopyTexSubImage3D
;
99 driver
->GenerateMipmap
= _mesa_meta_GenerateMipmap
;
100 driver
->TestProxyTexImage
= _mesa_test_proxy_teximage
;
101 driver
->BindTexture
= NULL
;
102 driver
->NewTextureObject
= _mesa_new_texture_object
;
103 driver
->DeleteTexture
= _mesa_delete_texture_object
;
104 driver
->NewTextureImage
= _swrast_new_texture_image
;
105 driver
->DeleteTextureImage
= _swrast_delete_texture_image
;
106 driver
->AllocTextureImageBuffer
= _swrast_alloc_texture_image_buffer
;
107 driver
->FreeTextureImageBuffer
= _swrast_free_texture_image_buffer
;
108 driver
->MapTextureImage
= _swrast_map_teximage
;
109 driver
->UnmapTextureImage
= _swrast_unmap_teximage
;
111 /* Vertex/fragment programs */
112 driver
->BindProgram
= NULL
;
113 driver
->NewProgram
= _mesa_new_program
;
114 driver
->DeleteProgram
= _mesa_delete_program
;
116 /* simple state commands */
117 driver
->AlphaFunc
= NULL
;
118 driver
->BlendColor
= NULL
;
119 driver
->BlendEquationSeparate
= NULL
;
120 driver
->BlendFuncSeparate
= NULL
;
121 driver
->ClearColor
= NULL
;
122 driver
->ClearDepth
= NULL
;
123 driver
->ClearStencil
= NULL
;
124 driver
->ClipPlane
= NULL
;
125 driver
->ColorMask
= NULL
;
126 driver
->ColorMaterial
= NULL
;
127 driver
->CullFace
= NULL
;
128 driver
->DrawBuffer
= NULL
;
129 driver
->FrontFace
= NULL
;
130 driver
->DepthFunc
= NULL
;
131 driver
->DepthMask
= NULL
;
132 driver
->DepthRange
= NULL
;
133 driver
->Enable
= NULL
;
134 driver
->Fogfv
= NULL
;
136 driver
->Lightfv
= NULL
;
137 driver
->LightModelfv
= NULL
;
138 driver
->LineStipple
= NULL
;
139 driver
->LineWidth
= NULL
;
140 driver
->LogicOpcode
= NULL
;
141 driver
->PointParameterfv
= NULL
;
142 driver
->PointSize
= NULL
;
143 driver
->PolygonMode
= NULL
;
144 driver
->PolygonOffset
= NULL
;
145 driver
->PolygonStipple
= NULL
;
146 driver
->ReadBuffer
= NULL
;
147 driver
->RenderMode
= NULL
;
148 driver
->Scissor
= NULL
;
149 driver
->ShadeModel
= NULL
;
150 driver
->StencilFuncSeparate
= NULL
;
151 driver
->StencilOpSeparate
= NULL
;
152 driver
->StencilMaskSeparate
= NULL
;
153 driver
->TexGen
= NULL
;
154 driver
->TexEnv
= NULL
;
155 driver
->TexParameter
= NULL
;
156 driver
->Viewport
= NULL
;
159 _mesa_init_buffer_object_functions(driver
);
161 driver
->NewFramebuffer
= _mesa_new_framebuffer
;
162 driver
->NewRenderbuffer
= _swrast_new_soft_renderbuffer
;
163 driver
->MapRenderbuffer
= _swrast_map_soft_renderbuffer
;
164 driver
->UnmapRenderbuffer
= _swrast_unmap_soft_renderbuffer
;
165 driver
->RenderTexture
= _swrast_render_texture
;
166 driver
->FinishRenderTexture
= _swrast_finish_render_texture
;
167 driver
->FramebufferRenderbuffer
= _mesa_framebuffer_renderbuffer
;
168 driver
->ValidateFramebuffer
= _mesa_validate_framebuffer
;
170 driver
->BlitFramebuffer
= _swrast_BlitFramebuffer
;
172 _mesa_init_texture_barrier_functions(driver
);
174 /* APPLE_vertex_array_object */
175 driver
->NewArrayObject
= _mesa_new_array_object
;
176 driver
->DeleteArrayObject
= _mesa_delete_array_object
;
177 driver
->BindArrayObject
= NULL
;
179 _mesa_init_shader_object_functions(driver
);
182 driver
->CurrentExecPrimitive
= 0;
183 driver
->CurrentSavePrimitive
= 0;
184 driver
->NeedFlush
= 0;
185 driver
->SaveNeedFlush
= 0;
187 driver
->FlushVertices
= NULL
;
188 driver
->SaveFlushVertices
= NULL
;
189 driver
->PrepareExecBegin
= NULL
;
190 driver
->NotifySaveBegin
= NULL
;
191 driver
->LightingSpaceChange
= NULL
;
194 driver
->NewList
= NULL
;
195 driver
->EndList
= NULL
;
196 driver
->BeginCallList
= NULL
;
197 driver
->EndCallList
= NULL
;
199 /* GL_ARB_texture_storage */
200 driver
->AllocTextureStorage
= _swrast_AllocTextureStorage
;