ac85009c581daece4efb408cec30f4dd88b4001c
[reactos.git] / reactos / dll / opengl / mesa / drivers / common / driverfuncs.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.1
4 *
5 * Copyright (C) 1999-2007 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 "main/glheader.h"
27 #include "main/imports.h"
28 #include "main/accum.h"
29 #include "main/context.h"
30 #include "main/framebuffer.h"
31 #include "main/readpix.h"
32 #include "main/renderbuffer.h"
33 #include "main/texformat.h"
34 #include "main/texgetimage.h"
35 #include "main/teximage.h"
36 #include "main/texobj.h"
37 #include "main/texstore.h"
38 #include "main/bufferobj.h"
39 #include "main/texturebarrier.h"
40
41 #include "tnl/tnl.h"
42 #include "swrast/swrast.h"
43 #include "swrast/s_renderbuffer.h"
44
45 #include "driverfuncs.h"
46 #include "meta.h"
47
48
49
50 /**
51 * Plug in default functions for all pointers in the dd_function_table
52 * structure.
53 * Device drivers should call this function and then plug in any
54 * functions which it wants to override.
55 * Some functions (pointers) MUST be implemented by all drivers (REQUIRED).
56 *
57 * \param table the dd_function_table to initialize
58 */
59 void
60 _mesa_init_driver_functions(struct dd_function_table *driver)
61 {
62 memset(driver, 0, sizeof(*driver));
63
64 driver->GetString = NULL; /* REQUIRED! */
65 driver->UpdateState = NULL; /* REQUIRED! */
66 driver->GetBufferSize = NULL; /* REQUIRED! */
67 driver->ResizeBuffers = _mesa_resize_framebuffer;
68 driver->Error = NULL;
69
70 driver->Finish = NULL;
71 driver->Flush = NULL;
72
73 /* framebuffer/image functions */
74 driver->Clear = _swrast_Clear;
75 driver->Accum = _mesa_accum;
76 driver->RasterPos = _tnl_RasterPos;
77 driver->DrawPixels = _swrast_DrawPixels;
78 driver->ReadPixels = _mesa_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->TexSubImage1D = _mesa_store_texsubimage1d;
87 driver->TexSubImage2D = _mesa_store_texsubimage2d;
88 driver->GetTexImage = _mesa_get_teximage;
89 driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
90 driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
91 driver->TestProxyTexImage = _mesa_test_proxy_teximage;
92 driver->BindTexture = NULL;
93 driver->NewTextureObject = _mesa_new_texture_object;
94 driver->DeleteTexture = _mesa_delete_texture_object;
95 driver->NewTextureImage = _swrast_new_texture_image;
96 driver->DeleteTextureImage = _swrast_delete_texture_image;
97 driver->AllocTextureImageBuffer = _swrast_alloc_texture_image_buffer;
98 driver->FreeTextureImageBuffer = _swrast_free_texture_image_buffer;
99 driver->MapTextureImage = _swrast_map_teximage;
100 driver->UnmapTextureImage = _swrast_unmap_teximage;
101
102 /* simple state commands */
103 driver->AlphaFunc = NULL;
104 driver->BlendColor = NULL;
105 driver->BlendEquationSeparate = NULL;
106 driver->BlendFuncSeparate = NULL;
107 driver->ClearColor = NULL;
108 driver->ClearDepth = NULL;
109 driver->ClearStencil = NULL;
110 driver->ClipPlane = NULL;
111 driver->ColorMask = NULL;
112 driver->ColorMaterial = NULL;
113 driver->CullFace = NULL;
114 driver->DrawBuffer = NULL;
115 driver->FrontFace = NULL;
116 driver->DepthFunc = NULL;
117 driver->DepthMask = NULL;
118 driver->DepthRange = NULL;
119 driver->Enable = NULL;
120 driver->Fogfv = NULL;
121 driver->Hint = NULL;
122 driver->Lightfv = NULL;
123 driver->LightModelfv = NULL;
124 driver->LineStipple = NULL;
125 driver->LineWidth = NULL;
126 driver->LogicOpcode = NULL;
127 driver->PointParameterfv = NULL;
128 driver->PointSize = NULL;
129 driver->PolygonMode = NULL;
130 driver->PolygonOffset = NULL;
131 driver->PolygonStipple = NULL;
132 driver->ReadBuffer = NULL;
133 driver->RenderMode = NULL;
134 driver->Scissor = NULL;
135 driver->ShadeModel = NULL;
136 driver->TexGen = NULL;
137 driver->TexEnv = NULL;
138 driver->TexParameter = NULL;
139 driver->Viewport = NULL;
140
141 /* buffer objects */
142 _mesa_init_buffer_object_functions(driver);
143
144 driver->MapRenderbuffer = _swrast_map_soft_renderbuffer;
145 driver->UnmapRenderbuffer = _swrast_unmap_soft_renderbuffer;
146
147 _mesa_init_texture_barrier_functions(driver);
148
149 /* T&L stuff */
150 driver->CurrentExecPrimitive = 0;
151 driver->CurrentSavePrimitive = 0;
152 driver->NeedFlush = 0;
153 driver->SaveNeedFlush = 0;
154
155 driver->FlushVertices = NULL;
156 driver->SaveFlushVertices = NULL;
157 driver->PrepareExecBegin = NULL;
158 driver->NotifySaveBegin = NULL;
159 driver->LightingSpaceChange = NULL;
160
161 /* display list */
162 driver->NewList = NULL;
163 driver->EndList = NULL;
164 driver->BeginCallList = NULL;
165 driver->EndCallList = NULL;
166
167 /* GL_ARB_texture_storage */
168 driver->AllocTextureStorage = _swrast_AllocTextureStorage;
169 }