intel/radeon: add common metaops code.
[mesa.git] / src / mesa / drivers / dri / common / dri_metaops.c
1 /**************************************************************************
2 *
3 * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * Copyright 2009 Intel Corporation.
5 * 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
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
17 * of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 *
27 **************************************************************************/
28
29 #include "main/arrayobj.h"
30 #include "main/attrib.h"
31 #include "main/blend.h"
32 #include "main/bufferobj.h"
33 #include "main/buffers.h"
34 #include "main/depth.h"
35 #include "main/enable.h"
36 #include "main/matrix.h"
37 #include "main/macros.h"
38 #include "main/polygon.h"
39 #include "main/shaders.h"
40 #include "main/stencil.h"
41 #include "main/texstate.h"
42 #include "main/varray.h"
43 #include "main/viewport.h"
44 #include "shader/arbprogram.h"
45 #include "shader/program.h"
46 #include "dri_metaops.h"
47
48 void
49 meta_set_passthrough_transform(struct dri_metaops *meta)
50 {
51 GLcontext *ctx = meta->ctx;
52
53 meta->saved_vp_x = ctx->Viewport.X;
54 meta->saved_vp_y = ctx->Viewport.Y;
55 meta->saved_vp_width = ctx->Viewport.Width;
56 meta->saved_vp_height = ctx->Viewport.Height;
57 meta->saved_matrix_mode = ctx->Transform.MatrixMode;
58
59 meta->internal_viewport_call = GL_TRUE;
60 _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
61 meta->internal_viewport_call = GL_FALSE;
62
63 _mesa_MatrixMode(GL_PROJECTION);
64 _mesa_PushMatrix();
65 _mesa_LoadIdentity();
66 _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1);
67
68 _mesa_MatrixMode(GL_MODELVIEW);
69 _mesa_PushMatrix();
70 _mesa_LoadIdentity();
71 }
72
73 void
74 meta_restore_transform(struct dri_metaops *meta)
75 {
76 _mesa_MatrixMode(GL_PROJECTION);
77 _mesa_PopMatrix();
78 _mesa_MatrixMode(GL_MODELVIEW);
79 _mesa_PopMatrix();
80
81 _mesa_MatrixMode(meta->saved_matrix_mode);
82
83 meta->internal_viewport_call = GL_TRUE;
84 _mesa_Viewport(meta->saved_vp_x, meta->saved_vp_y,
85 meta->saved_vp_width, meta->saved_vp_height);
86 meta->internal_viewport_call = GL_FALSE;
87 }
88
89
90 /**
91 * Set up a vertex program to pass through the position and first texcoord
92 * for pixel path.
93 */
94 void
95 meta_set_passthrough_vertex_program(struct dri_metaops *meta)
96 {
97 GLcontext *ctx = meta->ctx;
98 static const char *vp =
99 "!!ARBvp1.0\n"
100 "TEMP vertexClip;\n"
101 "DP4 vertexClip.x, state.matrix.mvp.row[0], vertex.position;\n"
102 "DP4 vertexClip.y, state.matrix.mvp.row[1], vertex.position;\n"
103 "DP4 vertexClip.z, state.matrix.mvp.row[2], vertex.position;\n"
104 "DP4 vertexClip.w, state.matrix.mvp.row[3], vertex.position;\n"
105 "MOV result.position, vertexClip;\n"
106 "MOV result.texcoord[0], vertex.texcoord[0];\n"
107 "MOV result.color, vertex.color;\n"
108 "END\n";
109
110 assert(meta->saved_vp == NULL);
111
112 _mesa_reference_vertprog(ctx, &meta->saved_vp,
113 ctx->VertexProgram.Current);
114 if (meta->passthrough_vp == NULL) {
115 GLuint prog_name;
116 _mesa_GenPrograms(1, &prog_name);
117 _mesa_BindProgram(GL_VERTEX_PROGRAM_ARB, prog_name);
118 _mesa_ProgramStringARB(GL_VERTEX_PROGRAM_ARB,
119 GL_PROGRAM_FORMAT_ASCII_ARB,
120 strlen(vp), (const GLubyte *)vp);
121 _mesa_reference_vertprog(ctx, &meta->passthrough_vp,
122 ctx->VertexProgram.Current);
123 _mesa_DeletePrograms(1, &prog_name);
124 }
125
126 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
127 _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
128 meta->passthrough_vp);
129 ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
130 &meta->passthrough_vp->Base);
131
132 meta->saved_vp_enable = ctx->VertexProgram.Enabled;
133 _mesa_Enable(GL_VERTEX_PROGRAM_ARB);
134 }
135
136 /**
137 * Restores the previous vertex program after
138 * meta_set_passthrough_vertex_program()
139 */
140 void
141 meta_restore_vertex_program(struct dri_metaops *meta)
142 {
143 GLcontext *ctx = meta->ctx;
144
145 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
146 _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
147 meta->saved_vp);
148 _mesa_reference_vertprog(ctx, &meta->saved_vp, NULL);
149 ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
150 &ctx->VertexProgram.Current->Base);
151
152 if (!meta->saved_vp_enable)
153 _mesa_Disable(GL_VERTEX_PROGRAM_ARB);
154 }
155
156 /**
157 * Binds the given program string to GL_FRAGMENT_PROGRAM_ARB, caching the
158 * program object.
159 */
160 void
161 meta_set_fragment_program(struct dri_metaops *meta,
162 struct gl_fragment_program **prog,
163 const char *prog_string)
164 {
165 GLcontext *ctx = meta->ctx;
166 assert(meta->saved_fp == NULL);
167
168 _mesa_reference_fragprog(ctx, &meta->saved_fp,
169 ctx->FragmentProgram.Current);
170 if (*prog == NULL) {
171 GLuint prog_name;
172 _mesa_GenPrograms(1, &prog_name);
173 _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, prog_name);
174 _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB,
175 GL_PROGRAM_FORMAT_ASCII_ARB,
176 strlen(prog_string), (const GLubyte *)prog_string);
177 _mesa_reference_fragprog(ctx, prog, ctx->FragmentProgram.Current);
178 /* Note that DeletePrograms unbinds the program on us */
179 _mesa_DeletePrograms(1, &prog_name);
180 }
181
182 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
183 _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, *prog);
184 ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, &((*prog)->Base));
185
186 meta->saved_fp_enable = ctx->FragmentProgram.Enabled;
187 _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB);
188 }
189
190 /**
191 * Restores the previous fragment program after
192 * meta_set_fragment_program()
193 */
194 void
195 meta_restore_fragment_program(struct dri_metaops *meta)
196 {
197 GLcontext *ctx = meta->ctx;
198
199 FLUSH_VERTICES(ctx, _NEW_PROGRAM);
200 _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
201 meta->saved_fp);
202 _mesa_reference_fragprog(ctx, &meta->saved_fp, NULL);
203 ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
204 &ctx->FragmentProgram.Current->Base);
205
206 if (!meta->saved_fp_enable)
207 _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB);
208 }
209
210 static const float default_texcoords[4][2] = { { 0.0, 0.0 },
211 { 1.0, 0.0 },
212 { 1.0, 1.0 },
213 { 0.0, 1.0 } };
214
215 void
216 meta_set_default_texrect(struct dri_metaops *meta)
217 {
218 GLcontext *ctx = meta->ctx;
219 struct gl_client_array *old_texcoord_array;
220
221 meta->saved_active_texture = ctx->Texture.CurrentUnit;
222 if (meta->saved_array_vbo == NULL) {
223 _mesa_reference_buffer_object(ctx, &meta->saved_array_vbo,
224 ctx->Array.ArrayBufferObj);
225 }
226
227 old_texcoord_array = &ctx->Array.ArrayObj->TexCoord[0];
228 meta->saved_texcoord_type = old_texcoord_array->Type;
229 meta->saved_texcoord_size = old_texcoord_array->Size;
230 meta->saved_texcoord_stride = old_texcoord_array->Stride;
231 meta->saved_texcoord_enable = old_texcoord_array->Enabled;
232 meta->saved_texcoord_ptr = old_texcoord_array->Ptr;
233 _mesa_reference_buffer_object(ctx, &meta->saved_texcoord_vbo,
234 old_texcoord_array->BufferObj);
235
236 _mesa_ClientActiveTextureARB(GL_TEXTURE0);
237
238 if (meta->texcoord_vbo == NULL) {
239 GLuint vbo_name;
240
241 _mesa_GenBuffersARB(1, &vbo_name);
242 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_name);
243 _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(default_texcoords),
244 default_texcoords, GL_STATIC_DRAW_ARB);
245 _mesa_reference_buffer_object(ctx, &meta->texcoord_vbo,
246 ctx->Array.ArrayBufferObj);
247 } else {
248 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB,
249 meta->texcoord_vbo->Name);
250 }
251 _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), NULL);
252
253 _mesa_Enable(GL_TEXTURE_COORD_ARRAY);
254 }
255
256 void
257 meta_restore_texcoords(struct dri_metaops *meta)
258 {
259 GLcontext *ctx = meta->ctx;
260
261 /* Restore the old TexCoordPointer */
262 if (meta->saved_texcoord_vbo) {
263 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB,
264 meta->saved_texcoord_vbo->Name);
265 _mesa_reference_buffer_object(ctx, &meta->saved_texcoord_vbo, NULL);
266 } else {
267 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
268 }
269
270 _mesa_TexCoordPointer(meta->saved_texcoord_size,
271 meta->saved_texcoord_type,
272 meta->saved_texcoord_stride,
273 meta->saved_texcoord_ptr);
274 if (!meta->saved_texcoord_enable)
275 _mesa_Disable(GL_TEXTURE_COORD_ARRAY);
276
277 _mesa_ClientActiveTextureARB(GL_TEXTURE0 +
278 meta->saved_active_texture);
279
280 if (meta->saved_array_vbo) {
281 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB,
282 meta->saved_array_vbo->Name);
283 _mesa_reference_buffer_object(ctx, &meta->saved_array_vbo, NULL);
284 } else {
285 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
286 }
287 }
288
289
290 /**
291 * Perform glClear where mask contains only color, depth, and/or stencil.
292 *
293 * The implementation is based on calling into Mesa to set GL state and
294 * performing normal triangle rendering. The intent of this path is to
295 * have as generic a path as possible, so that any driver could make use of
296 * it.
297 */
298
299 /**
300 * Per-context one-time init of things for intl_clear_tris().
301 * Basically set up a private array object for vertex/color arrays.
302 */
303 static void
304 meta_init_clear(struct dri_metaops *meta)
305 {
306 GLcontext *ctx = meta->ctx;
307 struct gl_array_object *arraySave = NULL;
308 const GLuint arrayBuffer = ctx->Array.ArrayBufferObj->Name;
309 const GLuint elementBuffer = ctx->Array.ElementArrayBufferObj->Name;
310
311 /* create new array object */
312 meta->clear.arrayObj = _mesa_new_array_object(ctx, ~0);
313
314 /* save current array object, bind new one */
315 _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj);
316 ctx->NewState |= _NEW_ARRAY;
317 ctx->Array.NewState |= _NEW_ARRAY_ALL;
318 _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, meta->clear.arrayObj);
319
320 /* one-time setup of vertex arrays (pos, color) */
321 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
322 _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
323 _mesa_ColorPointer(4, GL_FLOAT, 4 * sizeof(GLfloat), meta->clear.color);
324 _mesa_VertexPointer(3, GL_FLOAT, 3 * sizeof(GLfloat), meta->clear.vertices);
325 _mesa_Enable(GL_COLOR_ARRAY);
326 _mesa_Enable(GL_VERTEX_ARRAY);
327
328 /* restore original array object */
329 ctx->NewState |= _NEW_ARRAY;
330 ctx->Array.NewState |= _NEW_ARRAY_ALL;
331 _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave);
332 _mesa_reference_array_object(ctx, &arraySave, NULL);
333
334 /* restore original buffer objects */
335 _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, arrayBuffer);
336 _mesa_BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementBuffer);
337 }
338
339
340
341 /**
342 * Perform glClear where mask contains only color, depth, and/or stencil.
343 *
344 * The implementation is based on calling into Mesa to set GL state and
345 * performing normal triangle rendering. The intent of this path is to
346 * have as generic a path as possible, so that any driver could make use of
347 * it.
348 */
349 void
350 meta_clear_tris(struct dri_metaops *meta, GLbitfield mask)
351 {
352 GLcontext *ctx = meta->ctx;
353 GLfloat dst_z;
354 struct gl_framebuffer *fb = ctx->DrawBuffer;
355 int i;
356 GLboolean saved_fp_enable = GL_FALSE, saved_vp_enable = GL_FALSE;
357 GLuint saved_shader_program = 0;
358 unsigned int saved_active_texture;
359 struct gl_array_object *arraySave = NULL;
360
361 if (!meta->clear.arrayObj)
362 meta_init_clear(meta);
363
364 assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH |
365 BUFFER_BIT_STENCIL)) == 0);
366
367 _mesa_PushAttrib(GL_COLOR_BUFFER_BIT |
368 GL_DEPTH_BUFFER_BIT |
369 GL_ENABLE_BIT |
370 GL_POLYGON_BIT |
371 GL_STENCIL_BUFFER_BIT |
372 GL_TRANSFORM_BIT |
373 GL_CURRENT_BIT |
374 GL_VIEWPORT_BIT);
375 saved_active_texture = ctx->Texture.CurrentUnit;
376
377 /* Disable existing GL state we don't want to apply to a clear. */
378 _mesa_Disable(GL_ALPHA_TEST);
379 _mesa_Disable(GL_BLEND);
380 _mesa_Disable(GL_CULL_FACE);
381 _mesa_Disable(GL_FOG);
382 _mesa_Disable(GL_POLYGON_SMOOTH);
383 _mesa_Disable(GL_POLYGON_STIPPLE);
384 _mesa_Disable(GL_POLYGON_OFFSET_FILL);
385 _mesa_Disable(GL_LIGHTING);
386 _mesa_Disable(GL_CLIP_PLANE0);
387 _mesa_Disable(GL_CLIP_PLANE1);
388 _mesa_Disable(GL_CLIP_PLANE2);
389 _mesa_Disable(GL_CLIP_PLANE3);
390 _mesa_Disable(GL_CLIP_PLANE4);
391 _mesa_Disable(GL_CLIP_PLANE5);
392 _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL);
393 if (ctx->Extensions.ARB_fragment_program && ctx->FragmentProgram.Enabled) {
394 saved_fp_enable = GL_TRUE;
395 _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB);
396 }
397 if (ctx->Extensions.ARB_vertex_program && ctx->VertexProgram.Enabled) {
398 saved_vp_enable = GL_TRUE;
399 _mesa_Disable(GL_VERTEX_PROGRAM_ARB);
400 }
401 if (ctx->Extensions.ARB_shader_objects && ctx->Shader.CurrentProgram) {
402 saved_shader_program = ctx->Shader.CurrentProgram->Name;
403 _mesa_UseProgramObjectARB(0);
404 }
405
406 if (ctx->Texture._EnabledUnits != 0) {
407 int i;
408
409 for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
410 _mesa_ActiveTextureARB(GL_TEXTURE0 + i);
411 _mesa_Disable(GL_TEXTURE_1D);
412 _mesa_Disable(GL_TEXTURE_2D);
413 _mesa_Disable(GL_TEXTURE_3D);
414 if (ctx->Extensions.ARB_texture_cube_map)
415 _mesa_Disable(GL_TEXTURE_CUBE_MAP_ARB);
416 if (ctx->Extensions.NV_texture_rectangle)
417 _mesa_Disable(GL_TEXTURE_RECTANGLE_NV);
418 if (ctx->Extensions.MESA_texture_array) {
419 _mesa_Disable(GL_TEXTURE_1D_ARRAY_EXT);
420 _mesa_Disable(GL_TEXTURE_2D_ARRAY_EXT);
421 }
422 }
423 }
424
425 /* save current array object, bind our private one */
426 _mesa_reference_array_object(ctx, &arraySave, ctx->Array.ArrayObj);
427 ctx->NewState |= _NEW_ARRAY;
428 ctx->Array.NewState |= _NEW_ARRAY_ALL;
429 _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, meta->clear.arrayObj);
430
431 meta_set_passthrough_transform(meta);
432
433 for (i = 0; i < 4; i++) {
434 COPY_4FV(meta->clear.color[i], ctx->Color.ClearColor);
435 }
436
437 /* convert clear Z from [0,1] to NDC coord in [-1,1] */
438 dst_z = -1.0 + 2.0 * ctx->Depth.Clear;
439
440 /* The ClearDepth value is unaffected by DepthRange, so do a default
441 * mapping.
442 */
443 _mesa_DepthRange(0.0, 1.0);
444
445 /* Prepare the vertices, which are the same regardless of which buffer we're
446 * drawing to.
447 */
448 meta->clear.vertices[0][0] = fb->_Xmin;
449 meta->clear.vertices[0][1] = fb->_Ymin;
450 meta->clear.vertices[0][2] = dst_z;
451 meta->clear.vertices[1][0] = fb->_Xmax;
452 meta->clear.vertices[1][1] = fb->_Ymin;
453 meta->clear.vertices[1][2] = dst_z;
454 meta->clear.vertices[2][0] = fb->_Xmax;
455 meta->clear.vertices[2][1] = fb->_Ymax;
456 meta->clear.vertices[2][2] = dst_z;
457 meta->clear.vertices[3][0] = fb->_Xmin;
458 meta->clear.vertices[3][1] = fb->_Ymax;
459 meta->clear.vertices[3][2] = dst_z;
460
461 while (mask != 0) {
462 GLuint this_mask = 0;
463 GLuint color_bit;
464
465 color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS);
466 if (color_bit != 0)
467 this_mask |= (1 << (color_bit - 1));
468
469 /* Clear depth/stencil in the same pass as color. */
470 this_mask |= (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL));
471
472 /* Select the current color buffer and use the color write mask if
473 * we have one, otherwise don't write any color channels.
474 */
475 if (this_mask & BUFFER_BIT_FRONT_LEFT)
476 _mesa_DrawBuffer(GL_FRONT_LEFT);
477 else if (this_mask & BUFFER_BIT_BACK_LEFT)
478 _mesa_DrawBuffer(GL_BACK_LEFT);
479 else if (color_bit != 0)
480 _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0 +
481 (color_bit - BUFFER_COLOR0 - 1));
482 else
483 _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
484
485 /* Control writing of the depth clear value to depth. */
486 if (this_mask & BUFFER_BIT_DEPTH) {
487 _mesa_DepthFunc(GL_ALWAYS);
488 _mesa_Enable(GL_DEPTH_TEST);
489 } else {
490 _mesa_Disable(GL_DEPTH_TEST);
491 _mesa_DepthMask(GL_FALSE);
492 }
493
494 /* Control writing of the stencil clear value to stencil. */
495 if (this_mask & BUFFER_BIT_STENCIL) {
496 _mesa_Enable(GL_STENCIL_TEST);
497 _mesa_StencilOpSeparate(GL_FRONT_AND_BACK,
498 GL_REPLACE, GL_REPLACE, GL_REPLACE);
499 _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS,
500 ctx->Stencil.Clear & 0x7fffffff,
501 ctx->Stencil.WriteMask[0]);
502 } else {
503 _mesa_Disable(GL_STENCIL_TEST);
504 }
505
506 _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
507
508 mask &= ~this_mask;
509 }
510
511 meta_restore_transform(meta);
512
513 _mesa_ActiveTextureARB(GL_TEXTURE0 + saved_active_texture);
514 if (saved_fp_enable)
515 _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB);
516 if (saved_vp_enable)
517 _mesa_Enable(GL_VERTEX_PROGRAM_ARB);
518
519 if (saved_shader_program)
520 _mesa_UseProgramObjectARB(saved_shader_program);
521
522 _mesa_PopAttrib();
523
524 /* restore current array object */
525 ctx->NewState |= _NEW_ARRAY;
526 ctx->Array.NewState |= _NEW_ARRAY_ALL;
527 _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, arraySave);
528 _mesa_reference_array_object(ctx, &arraySave, NULL);
529 }
530
531 void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta)
532 {
533 meta->ctx = ctx;
534 }
535
536 void meta_destroy_metaops(struct dri_metaops *meta)
537 {
538 if (meta->clear.arrayObj)
539 _mesa_delete_array_object(meta->ctx, meta->clear.arrayObj);
540
541 }