Print an error if idling the engine before the buffer copy fails.
[mesa.git] / src / mesa / drivers / common / driverfuncs.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.3
4 *
5 * Copyright (C) 1999-2004 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 "program.h"
31 #include "texcompress.h"
32 #include "texformat.h"
33 #include "teximage.h"
34 #include "texobj.h"
35 #include "texstore.h"
36 #include "bufferobj.h"
37
38 #include "driverfuncs.h"
39 #include "swrast/swrast.h"
40
41
42
43 /**
44 * Plug in default functions for all pointers in the dd_function_table
45 * structure.
46 * Device drivers should call this function and then plug in any
47 * functions which it wants to override.
48 * Some functions (pointers) MUST be implemented by all drivers (REQUIRED).
49 *
50 * \param table the dd_function_table to initialize
51 */
52 void
53 _mesa_init_driver_functions(struct dd_function_table *driver)
54 {
55 _mesa_bzero(driver, sizeof(*driver));
56
57 driver->GetString = NULL; /* REQUIRED! */
58 driver->UpdateState = NULL; /* REQUIRED! */
59 driver->GetBufferSize = NULL; /* REQUIRED! */
60 driver->ResizeBuffers = _swrast_alloc_buffers;
61 driver->Error = NULL;
62
63 driver->Finish = NULL;
64 driver->Flush = NULL;
65
66 /* framebuffer/image functions */
67 driver->Clear = _swrast_Clear;
68 driver->Accum = _swrast_Accum;
69 driver->DrawPixels = _swrast_DrawPixels;
70 driver->ReadPixels = _swrast_ReadPixels;
71 driver->CopyPixels = _swrast_CopyPixels;
72 driver->Bitmap = _swrast_Bitmap;
73
74 /* Texture functions */
75 driver->ChooseTextureFormat = _mesa_choose_tex_format;
76 driver->TexImage1D = _mesa_store_teximage1d;
77 driver->TexImage2D = _mesa_store_teximage2d;
78 driver->TexImage3D = _mesa_store_teximage3d;
79 driver->TexSubImage1D = _mesa_store_texsubimage1d;
80 driver->TexSubImage2D = _mesa_store_texsubimage2d;
81 driver->TexSubImage3D = _mesa_store_texsubimage3d;
82 driver->GetTexImage = _mesa_get_teximage;
83 driver->CopyTexImage1D = _swrast_copy_teximage1d;
84 driver->CopyTexImage2D = _swrast_copy_teximage2d;
85 driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
86 driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
87 driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
88 driver->TestProxyTexImage = _mesa_test_proxy_teximage;
89 driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
90 driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
91 driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d;
92 driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
93 driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
94 driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
95 driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
96 driver->CompressedTextureSize = _mesa_compressed_texture_size;
97 driver->BindTexture = NULL;
98 driver->NewTextureObject = _mesa_new_texture_object;
99 driver->DeleteTexture = _mesa_delete_texture_object;
100 driver->NewTextureImage = _mesa_new_texture_image;
101 driver->IsTextureResident = NULL;
102 driver->PrioritizeTexture = NULL;
103 driver->ActiveTexture = NULL;
104 driver->UpdateTexturePalette = NULL;
105
106 /* imaging */
107 driver->CopyColorTable = _swrast_CopyColorTable;
108 driver->CopyColorSubTable = _swrast_CopyColorSubTable;
109 driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
110 driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
111
112 /* Vertex/fragment programs */
113 driver->BindProgram = NULL;
114 driver->NewProgram = _mesa_new_program;
115 driver->DeleteProgram = _mesa_delete_program;
116
117 /* simple state commands */
118 driver->AlphaFunc = NULL;
119 driver->BlendColor = NULL;
120 driver->BlendEquationSeparate = NULL;
121 driver->BlendFuncSeparate = NULL;
122 driver->ClearColor = NULL;
123 driver->ClearDepth = NULL;
124 driver->ClearIndex = NULL;
125 driver->ClearStencil = NULL;
126 driver->ClipPlane = NULL;
127 driver->ColorMask = NULL;
128 driver->ColorMaterial = NULL;
129 driver->CullFace = NULL;
130 driver->DrawBuffer = _swrast_DrawBuffer;
131 driver->DrawBuffers = _swrast_DrawBuffers;
132 driver->FrontFace = NULL;
133 driver->DepthFunc = NULL;
134 driver->DepthMask = NULL;
135 driver->DepthRange = NULL;
136 driver->Enable = NULL;
137 driver->Fogfv = NULL;
138 driver->Hint = NULL;
139 driver->IndexMask = NULL;
140 driver->Lightfv = NULL;
141 driver->LightModelfv = NULL;
142 driver->LineStipple = NULL;
143 driver->LineWidth = NULL;
144 driver->LogicOpcode = NULL;
145 driver->PointParameterfv = NULL;
146 driver->PointSize = NULL;
147 driver->PolygonMode = NULL;
148 driver->PolygonOffset = NULL;
149 driver->PolygonStipple = NULL;
150 driver->ReadBuffer = NULL;
151 driver->RenderMode = NULL;
152 driver->Scissor = NULL;
153 driver->ShadeModel = NULL;
154 driver->StencilFunc = NULL;
155 driver->StencilMask = NULL;
156 driver->StencilOp = NULL;
157 driver->ActiveStencilFace = NULL;
158 driver->TexGen = NULL;
159 driver->TexEnv = NULL;
160 driver->TexParameter = NULL;
161 driver->TextureMatrix = NULL;
162 driver->Viewport = NULL;
163
164 /* vertex arrays */
165 driver->VertexPointer = NULL;
166 driver->NormalPointer = NULL;
167 driver->ColorPointer = NULL;
168 driver->FogCoordPointer = NULL;
169 driver->IndexPointer = NULL;
170 driver->SecondaryColorPointer = NULL;
171 driver->TexCoordPointer = NULL;
172 driver->EdgeFlagPointer = NULL;
173 driver->VertexAttribPointer = NULL;
174 driver->LockArraysEXT = NULL;
175 driver->UnlockArraysEXT = NULL;
176
177 /* state queries */
178 driver->GetBooleanv = NULL;
179 driver->GetDoublev = NULL;
180 driver->GetFloatv = NULL;
181 driver->GetIntegerv = NULL;
182 driver->GetPointerv = NULL;
183
184 #if FEATURE_ARB_vertex_buffer_object
185 driver->NewBufferObject = _mesa_new_buffer_object;
186 driver->DeleteBuffer = _mesa_delete_buffer_object;
187 driver->BindBuffer = NULL;
188 driver->BufferData = _mesa_buffer_data;
189 driver->BufferSubData = _mesa_buffer_subdata;
190 driver->GetBufferSubData = _mesa_buffer_get_subdata;
191 driver->MapBuffer = _mesa_buffer_map;
192 driver->UnmapBuffer = _mesa_buffer_unmap;
193 #endif
194
195 /* T&L stuff */
196 driver->NeedValidate = GL_FALSE;
197 driver->ValidateTnlModule = NULL;
198 driver->CurrentExecPrimitive = 0;
199 driver->CurrentSavePrimitive = 0;
200 driver->NeedFlush = 0;
201 driver->SaveNeedFlush = 0;
202
203 driver->FlushVertices = NULL;
204 driver->SaveFlushVertices = NULL;
205 driver->NotifySaveBegin = NULL;
206 driver->LightingSpaceChange = NULL;
207 driver->MakeCurrent = NULL;
208
209 /* display list */
210 driver->NewList = NULL;
211 driver->EndList = NULL;
212 driver->BeginCallList = NULL;
213 driver->EndCallList = NULL;
214 }