dri/nouveau: Fix up software mipmap generation.
[mesa.git] / src / mesa / drivers / dri / nouveau / nouveau_texture.c
1 /*
2 * Copyright (C) 2009 Francisco Jerez.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27 #include "nouveau_driver.h"
28 #include "nouveau_context.h"
29 #include "nouveau_texture.h"
30 #include "nouveau_fbo.h"
31 #include "nouveau_util.h"
32
33 #include "main/texobj.h"
34 #include "main/texstore.h"
35 #include "main/texformat.h"
36 #include "main/texcompress.h"
37 #include "main/texgetimage.h"
38 #include "main/mipmap.h"
39 #include "main/texfetch.h"
40 #include "main/teximage.h"
41 #include "drivers/common/meta.h"
42
43 static struct gl_texture_object *
44 nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target)
45 {
46 struct nouveau_texture *nt = CALLOC_STRUCT(nouveau_texture);
47
48 _mesa_initialize_texture_object(&nt->base, name, target);
49
50 return &nt->base;
51 }
52
53 static void
54 nouveau_texture_free(GLcontext *ctx, struct gl_texture_object *t)
55 {
56 struct nouveau_texture *nt = to_nouveau_texture(t);
57 int i;
58
59 for (i = 0; i < MAX_TEXTURE_LEVELS; i++)
60 nouveau_surface_ref(NULL, &nt->surfaces[i]);
61
62 _mesa_delete_texture_object(ctx, t);
63 }
64
65 static struct gl_texture_image *
66 nouveau_teximage_new(GLcontext *ctx)
67 {
68 struct nouveau_teximage *nti = CALLOC_STRUCT(nouveau_teximage);
69
70 return &nti->base;
71 }
72
73 static void
74 nouveau_teximage_free(GLcontext *ctx, struct gl_texture_image *ti)
75 {
76 struct nouveau_teximage *nti = to_nouveau_teximage(ti);
77
78 nouveau_surface_ref(NULL, &nti->surface);
79 }
80
81 static void
82 nouveau_teximage_map(GLcontext *ctx, struct gl_texture_image *ti)
83 {
84 struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
85 int ret;
86
87 if (s->bo) {
88 ret = nouveau_bo_map(s->bo, NOUVEAU_BO_RDWR);
89 assert(!ret);
90
91 ti->Data = s->bo->map;
92 }
93 }
94
95 static void
96 nouveau_teximage_unmap(GLcontext *ctx, struct gl_texture_image *ti)
97 {
98 struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
99
100 if (s->bo)
101 nouveau_bo_unmap(s->bo);
102 ti->Data = NULL;
103 }
104
105 static gl_format
106 nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
107 GLenum srcFormat, GLenum srcType)
108 {
109 switch (internalFormat) {
110 case 4:
111 case GL_RGBA:
112 case GL_RGBA2:
113 case GL_RGBA4:
114 case GL_RGBA8:
115 case GL_RGBA12:
116 case GL_RGBA16:
117 case GL_RGB10_A2:
118 return MESA_FORMAT_ARGB8888;
119 case GL_RGB5_A1:
120 return MESA_FORMAT_ARGB1555;
121
122 case GL_RGB:
123 case GL_RGB8:
124 case GL_RGB10:
125 case GL_RGB12:
126 case GL_RGB16:
127 return MESA_FORMAT_XRGB8888;
128 case 3:
129 case GL_R3_G3_B2:
130 case GL_RGB4:
131 case GL_RGB5:
132 return MESA_FORMAT_RGB565;
133
134 case 2:
135 case GL_LUMINANCE_ALPHA:
136 case GL_LUMINANCE4_ALPHA4:
137 case GL_LUMINANCE6_ALPHA2:
138 case GL_LUMINANCE12_ALPHA4:
139 case GL_LUMINANCE12_ALPHA12:
140 case GL_LUMINANCE16_ALPHA16:
141 case GL_LUMINANCE8_ALPHA8:
142 return MESA_FORMAT_ARGB8888;
143
144 case 1:
145 case GL_LUMINANCE:
146 case GL_LUMINANCE4:
147 case GL_LUMINANCE12:
148 case GL_LUMINANCE16:
149 case GL_LUMINANCE8:
150 return MESA_FORMAT_L8;
151
152 case GL_ALPHA:
153 case GL_ALPHA4:
154 case GL_ALPHA12:
155 case GL_ALPHA16:
156 case GL_ALPHA8:
157 return MESA_FORMAT_A8;
158
159 case GL_INTENSITY:
160 case GL_INTENSITY4:
161 case GL_INTENSITY12:
162 case GL_INTENSITY16:
163 case GL_INTENSITY8:
164 return MESA_FORMAT_I8;
165
166 case GL_COLOR_INDEX:
167 case GL_COLOR_INDEX1_EXT:
168 case GL_COLOR_INDEX2_EXT:
169 case GL_COLOR_INDEX4_EXT:
170 case GL_COLOR_INDEX12_EXT:
171 case GL_COLOR_INDEX16_EXT:
172 case GL_COLOR_INDEX8_EXT:
173 return MESA_FORMAT_CI8;
174
175 default:
176 assert(0);
177 }
178 }
179
180 static GLboolean
181 teximage_fits(struct gl_texture_object *t, int level)
182 {
183 struct nouveau_surface *s = &to_nouveau_texture(t)->surfaces[level];
184 struct gl_texture_image *ti = t->Image[0][level];
185
186 return ti && (t->Target == GL_TEXTURE_RECTANGLE ||
187 (s->bo && s->width == ti->Width &&
188 s->height == ti->Height &&
189 s->format == ti->TexFormat));
190 }
191
192 static GLboolean
193 validate_teximage(GLcontext *ctx, struct gl_texture_object *t,
194 int level, int x, int y, int z,
195 int width, int height, int depth)
196 {
197 struct gl_texture_image *ti = t->Image[0][level];
198
199 if (teximage_fits(t, level)) {
200 struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces;
201 struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
202
203 if (t->Target == GL_TEXTURE_RECTANGLE)
204 nouveau_surface_ref(s, &ss[level]);
205 else
206 context_drv(ctx)->surface_copy(ctx, &ss[level], s,
207 x, y, x, y,
208 width, height);
209
210 return GL_TRUE;
211 }
212
213 return GL_FALSE;
214 }
215
216 static int
217 get_last_level(struct gl_texture_object *t)
218 {
219 struct gl_texture_image *base = t->Image[0][t->BaseLevel];
220
221 if (t->MinFilter == GL_NEAREST ||
222 t->MinFilter == GL_LINEAR || !base)
223 return t->BaseLevel;
224 else
225 return MIN2(t->BaseLevel + base->MaxLog2, t->MaxLevel);
226 }
227
228 static void
229 relayout_texture(GLcontext *ctx, struct gl_texture_object *t)
230 {
231 struct gl_texture_image *base = t->Image[0][t->BaseLevel];
232
233 if (base && t->Target != GL_TEXTURE_RECTANGLE) {
234 struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces;
235 struct nouveau_surface *s = &to_nouveau_teximage(base)->surface;
236 int i, ret, last = get_last_level(t);
237 unsigned size, offset = 0,
238 width = s->width,
239 height = s->height;
240
241 /* Deallocate the old storage. */
242 for (i = 0; i < MAX_TEXTURE_LEVELS; i++)
243 nouveau_bo_ref(NULL, &ss[i].bo);
244
245 /* Relayout the mipmap tree. */
246 for (i = t->BaseLevel; i <= last; i++) {
247 size = width * height * s->cpp;
248
249 /* Images larger than 16B have to be aligned. */
250 if (size > 16)
251 offset = align(offset, 64);
252
253 ss[i] = (struct nouveau_surface) {
254 .offset = offset,
255 .layout = SWIZZLED,
256 .format = s->format,
257 .width = width,
258 .height = height,
259 .cpp = s->cpp,
260 .pitch = width * s->cpp,
261 };
262
263 offset += size;
264 width = MAX2(1, width / 2);
265 height = MAX2(1, height / 2);
266 }
267
268 /* Get new storage. */
269 size = align(offset, 64);
270
271 ret = nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_MAP |
272 NOUVEAU_BO_GART | NOUVEAU_BO_VRAM,
273 0, size, &ss[last].bo);
274 assert(!ret);
275
276 for (i = t->BaseLevel; i < last; i++)
277 nouveau_bo_ref(ss[last].bo, &ss[i].bo);
278 }
279 }
280
281 GLboolean
282 nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t)
283 {
284 struct nouveau_texture *nt = to_nouveau_texture(t);
285 int i, last = get_last_level(t);
286
287 if (!teximage_fits(t, t->BaseLevel) ||
288 !teximage_fits(t, last))
289 return GL_FALSE;
290
291 if (nt->dirty) {
292 nt->dirty = GL_FALSE;
293
294 /* Copy the teximages to the actual miptree. */
295 for (i = t->BaseLevel; i <= last; i++) {
296 struct nouveau_surface *s = &nt->surfaces[i];
297
298 validate_teximage(ctx, t, i, 0, 0, 0,
299 s->width, s->height, 1);
300 }
301
302 FIRE_RING(context_chan(ctx));
303 }
304
305 return GL_TRUE;
306 }
307
308 void
309 nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
310 {
311 if (!teximage_fits(t, t->BaseLevel) ||
312 !teximage_fits(t, get_last_level(t))) {
313 texture_dirty(t);
314 relayout_texture(ctx, t);
315 nouveau_texture_validate(ctx, t);
316 }
317 }
318
319 static unsigned
320 get_teximage_placement(struct gl_texture_image *ti)
321 {
322 if (ti->TexFormat == MESA_FORMAT_A8 ||
323 ti->TexFormat == MESA_FORMAT_L8 ||
324 ti->TexFormat == MESA_FORMAT_I8)
325 /* 1 cpp formats will have to be swizzled by the CPU,
326 * so leave them in system RAM for now. */
327 return NOUVEAU_BO_MAP;
328 else
329 return NOUVEAU_BO_GART | NOUVEAU_BO_MAP;
330 }
331
332 static void
333 nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
334 GLint internalFormat,
335 GLint width, GLint height, GLint depth, GLint border,
336 GLenum format, GLenum type, const GLvoid *pixels,
337 const struct gl_pixelstore_attrib *packing,
338 struct gl_texture_object *t,
339 struct gl_texture_image *ti)
340 {
341 struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
342 int ret;
343
344 /* Allocate a new bo for the image. */
345 nouveau_surface_alloc(ctx, s, LINEAR, get_teximage_placement(ti),
346 ti->TexFormat, width, height);
347 ti->RowStride = s->pitch / s->cpp;
348
349 pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, depth,
350 format, type, pixels, packing,
351 "glTexImage");
352 if (pixels) {
353 /* Store the pixel data. */
354 nouveau_teximage_map(ctx, ti);
355
356 ret = _mesa_texstore(ctx, dims, ti->_BaseFormat,
357 ti->TexFormat, ti->Data,
358 0, 0, 0, s->pitch,
359 ti->ImageOffsets,
360 width, height, depth,
361 format, type, pixels, packing);
362 assert(ret);
363
364 nouveau_teximage_unmap(ctx, ti);
365 _mesa_unmap_teximage_pbo(ctx, packing);
366
367 if (!validate_teximage(ctx, t, level, 0, 0, 0,
368 width, height, depth))
369 /* It doesn't fit, mark it as dirty. */
370 texture_dirty(t);
371 }
372
373 if (level == t->BaseLevel) {
374 if (!teximage_fits(t, level))
375 relayout_texture(ctx, t);
376 nouveau_texture_validate(ctx, t);
377 }
378
379 context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
380 context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
381 }
382
383 static void
384 nouveau_teximage_1d(GLcontext *ctx, GLenum target, GLint level,
385 GLint internalFormat,
386 GLint width, GLint border,
387 GLenum format, GLenum type, const GLvoid *pixels,
388 const struct gl_pixelstore_attrib *packing,
389 struct gl_texture_object *t,
390 struct gl_texture_image *ti)
391 {
392 nouveau_teximage(ctx, 1, target, level, internalFormat,
393 width, 1, 1, border, format, type, pixels,
394 packing, t, ti);
395 }
396
397 static void
398 nouveau_teximage_2d(GLcontext *ctx, GLenum target, GLint level,
399 GLint internalFormat,
400 GLint width, GLint height, GLint border,
401 GLenum format, GLenum type, const GLvoid *pixels,
402 const struct gl_pixelstore_attrib *packing,
403 struct gl_texture_object *t,
404 struct gl_texture_image *ti)
405 {
406 nouveau_teximage(ctx, 2, target, level, internalFormat,
407 width, height, 1, border, format, type, pixels,
408 packing, t, ti);
409 }
410
411 static void
412 nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint level,
413 GLint internalFormat,
414 GLint width, GLint height, GLint depth, GLint border,
415 GLenum format, GLenum type, const GLvoid *pixels,
416 const struct gl_pixelstore_attrib *packing,
417 struct gl_texture_object *t,
418 struct gl_texture_image *ti)
419 {
420 nouveau_teximage(ctx, 3, target, level, internalFormat,
421 width, height, depth, border, format, type, pixels,
422 packing, t, ti);
423 }
424
425 static void
426 nouveau_texsubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
427 GLint xoffset, GLint yoffset, GLint zoffset,
428 GLint width, GLint height, GLint depth,
429 GLenum format, GLenum type, const void *pixels,
430 const struct gl_pixelstore_attrib *packing,
431 struct gl_texture_object *t,
432 struct gl_texture_image *ti)
433 {
434 struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
435 int ret;
436
437 pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, depth,
438 format, type, pixels, packing,
439 "glTexSubImage");
440 if (pixels) {
441 nouveau_teximage_map(ctx, ti);
442
443 ret = _mesa_texstore(ctx, 3, ti->_BaseFormat, ti->TexFormat,
444 ti->Data, xoffset, yoffset, zoffset,
445 s->pitch, ti->ImageOffsets,
446 width, height, depth, format, type,
447 pixels, packing);
448 assert(ret);
449
450 nouveau_teximage_unmap(ctx, ti);
451 _mesa_unmap_teximage_pbo(ctx, packing);
452 }
453
454 if (!to_nouveau_texture(t)->dirty)
455 validate_teximage(ctx, t, level, xoffset, yoffset, zoffset,
456 width, height, depth);
457 }
458
459 static void
460 nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level,
461 GLint xoffset, GLint yoffset, GLint zoffset,
462 GLint width, GLint height, GLint depth,
463 GLenum format, GLenum type, const void *pixels,
464 const struct gl_pixelstore_attrib *packing,
465 struct gl_texture_object *t,
466 struct gl_texture_image *ti)
467 {
468 nouveau_texsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
469 width, height, depth, format, type, pixels,
470 packing, t, ti);
471 }
472
473 static void
474 nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level,
475 GLint xoffset, GLint yoffset,
476 GLint width, GLint height,
477 GLenum format, GLenum type, const void *pixels,
478 const struct gl_pixelstore_attrib *packing,
479 struct gl_texture_object *t,
480 struct gl_texture_image *ti)
481 {
482 nouveau_texsubimage(ctx, 2, target, level, xoffset, yoffset, 0,
483 width, height, 1, format, type, pixels,
484 packing, t, ti);
485 }
486
487 static void
488 nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level,
489 GLint xoffset, GLint width,
490 GLenum format, GLenum type, const void *pixels,
491 const struct gl_pixelstore_attrib *packing,
492 struct gl_texture_object *t,
493 struct gl_texture_image *ti)
494 {
495 nouveau_texsubimage(ctx, 1, target, level, xoffset, 0, 0,
496 width, 1, 1, format, type, pixels,
497 packing, t, ti);
498 }
499
500 static void
501 nouveau_get_teximage(GLcontext *ctx, GLenum target, GLint level,
502 GLenum format, GLenum type, GLvoid *pixels,
503 struct gl_texture_object *t,
504 struct gl_texture_image *ti)
505 {
506 nouveau_teximage_map(ctx, ti);
507 _mesa_get_teximage(ctx, target, level, format, type, pixels,
508 t, ti);
509 nouveau_teximage_unmap(ctx, ti);
510 }
511
512 static void
513 nouveau_bind_texture(GLcontext *ctx, GLenum target,
514 struct gl_texture_object *t)
515 {
516 context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
517 context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
518 }
519
520 static gl_format
521 get_texbuffer_format(struct gl_renderbuffer *rb, GLint format)
522 {
523 struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface;
524
525 if (s->cpp < 4)
526 return s->format;
527 else if (format == __DRI_TEXTURE_FORMAT_RGBA)
528 return MESA_FORMAT_ARGB8888;
529 else
530 return MESA_FORMAT_XRGB8888;
531 }
532
533 void
534 nouveau_set_texbuffer(__DRIcontext *dri_ctx,
535 GLint target, GLint format,
536 __DRIdrawable *draw)
537 {
538 struct nouveau_context *nctx = dri_ctx->driverPrivate;
539 GLcontext *ctx = &nctx->base;
540 struct gl_framebuffer *fb = draw->driverPrivate;
541 struct gl_renderbuffer *rb =
542 fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
543 struct gl_texture_object *t = _mesa_get_current_tex_object(ctx, target);
544 struct gl_texture_image *ti;
545 struct nouveau_surface *s;
546
547 _mesa_lock_texture(ctx, t);
548 ti = _mesa_get_tex_image(ctx, t, target, 0);
549 s = &to_nouveau_teximage(ti)->surface;
550
551 /* Update the texture surface with the given drawable. */
552 nouveau_update_renderbuffers(dri_ctx, draw);
553 nouveau_surface_ref(&to_nouveau_renderbuffer(rb)->surface, s);
554
555 /* Update the image fields. */
556 _mesa_init_teximage_fields(ctx, target, ti, s->width, s->height,
557 1, 0, s->cpp);
558 ti->RowStride = s->pitch / s->cpp;
559 ti->TexFormat = s->format = get_texbuffer_format(rb, format);
560
561 /* Try to validate it. */
562 if (!validate_teximage(ctx, t, 0, 0, 0, 0, s->width, s->height, 1))
563 nouveau_texture_reallocate(ctx, t);
564
565 context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
566 context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
567
568 _mesa_unlock_texture(ctx, t);
569 }
570
571 static void
572 nouveau_texture_map(GLcontext *ctx, struct gl_texture_object *t)
573 {
574 int i;
575
576 for (i = t->BaseLevel; i < t->_MaxLevel; i++) {
577 if (t->Image[0][i])
578 nouveau_teximage_map(ctx, t->Image[0][i]);
579 }
580 }
581
582 static void
583 nouveau_texture_unmap(GLcontext *ctx, struct gl_texture_object *t)
584 {
585 int i;
586
587 for (i = t->BaseLevel; i < t->_MaxLevel; i++) {
588 if (t->Image[0][i])
589 nouveau_teximage_unmap(ctx, t->Image[0][i]);
590 }
591 }
592
593 static void
594 store_mipmap(GLcontext *ctx, GLenum target, int first, int last,
595 struct gl_texture_object *t)
596 {
597 struct gl_pixelstore_attrib packing = {
598 .BufferObj = ctx->Shared->NullBufferObj,
599 .Alignment = 1
600 };
601 GLenum format = t->Image[0][first]->TexFormat;
602 unsigned base_format, type, comps;
603 int i;
604
605 base_format = _mesa_get_format_base_format(format);
606 _mesa_format_to_type_and_comps(format, &type, &comps);
607
608 for (i = first; i <= last; i++) {
609 struct gl_texture_image *ti = t->Image[0][i];
610 void *data = ti->Data;
611
612 nouveau_teximage(ctx, 3, target, i, ti->InternalFormat,
613 ti->Width, ti->Height, ti->Depth,
614 ti->Border, base_format, type, data,
615 &packing, t, ti);
616
617 _mesa_free_texmemory(data);
618 }
619 }
620
621 static void
622 nouveau_generate_mipmap(GLcontext *ctx, GLenum target,
623 struct gl_texture_object *t)
624 {
625 if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, t)) {
626 struct gl_texture_image *base = t->Image[0][t->BaseLevel];
627
628 nouveau_teximage_map(ctx, base);
629 _mesa_generate_mipmap(ctx, target, t);
630 nouveau_teximage_unmap(ctx, base);
631
632 store_mipmap(ctx, target, t->BaseLevel + 1,
633 get_last_level(t), t);
634
635 } else {
636 _mesa_meta_GenerateMipmap(ctx, target, t);
637 }
638 }
639
640 void
641 nouveau_texture_functions_init(struct dd_function_table *functions)
642 {
643 functions->NewTextureObject = nouveau_texture_new;
644 functions->DeleteTexture = nouveau_texture_free;
645 functions->NewTextureImage = nouveau_teximage_new;
646 functions->FreeTexImageData = nouveau_teximage_free;
647 functions->ChooseTextureFormat = nouveau_choose_tex_format;
648 functions->TexImage1D = nouveau_teximage_1d;
649 functions->TexImage2D = nouveau_teximage_2d;
650 functions->TexImage3D = nouveau_teximage_3d;
651 functions->TexSubImage1D = nouveau_texsubimage_1d;
652 functions->TexSubImage2D = nouveau_texsubimage_2d;
653 functions->TexSubImage3D = nouveau_texsubimage_3d;
654 functions->GetTexImage = nouveau_get_teximage;
655 functions->BindTexture = nouveau_bind_texture;
656 functions->MapTexture = nouveau_texture_map;
657 functions->UnmapTexture = nouveau_texture_unmap;
658 functions->GenerateMipmap = nouveau_generate_mipmap;
659 }