2 * Copyright (C) 2009 Francisco Jerez.
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:
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.
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.
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"
34 #include "main/texobj.h"
35 #include "main/texstore.h"
36 #include "main/texformat.h"
37 #include "main/texcompress.h"
38 #include "main/texgetimage.h"
39 #include "main/mipmap.h"
40 #include "main/teximage.h"
41 #include "drivers/common/meta.h"
42 #include "swrast/s_texfetch.h"
44 static struct gl_texture_object
*
45 nouveau_texture_new(struct gl_context
*ctx
, GLuint name
, GLenum target
)
47 struct nouveau_texture
*nt
= CALLOC_STRUCT(nouveau_texture
);
49 _mesa_initialize_texture_object(&nt
->base
, name
, target
);
55 nouveau_texture_free(struct gl_context
*ctx
, struct gl_texture_object
*t
)
57 struct nouveau_texture
*nt
= to_nouveau_texture(t
);
60 for (i
= 0; i
< MAX_TEXTURE_LEVELS
; i
++)
61 nouveau_surface_ref(NULL
, &nt
->surfaces
[i
]);
63 _mesa_delete_texture_object(ctx
, t
);
66 static struct gl_texture_image
*
67 nouveau_teximage_new(struct gl_context
*ctx
)
69 struct nouveau_teximage
*nti
= CALLOC_STRUCT(nouveau_teximage
);
75 nouveau_teximage_free(struct gl_context
*ctx
, struct gl_texture_image
*ti
)
77 struct nouveau_teximage
*nti
= to_nouveau_teximage(ti
);
79 nouveau_surface_ref(NULL
, &nti
->surface
);
83 nouveau_teximage_map(struct gl_context
*ctx
, struct gl_texture_image
*ti
,
84 int access
, int x
, int y
, int w
, int h
)
86 struct nouveau_teximage
*nti
= to_nouveau_teximage(ti
);
87 struct nouveau_surface
*s
= &nti
->surface
;
88 struct nouveau_surface
*st
= &nti
->transfer
.surface
;
91 if (!(access
& GL_MAP_READ_BIT
) &&
92 nouveau_bo_pending(s
->bo
)) {
94 * Heuristic: use a bounce buffer to pipeline
98 st
->format
= s
->format
;
102 st
->pitch
= s
->pitch
;
106 ti
->Data
= nouveau_get_scratch(ctx
, st
->pitch
* h
,
107 &st
->bo
, &st
->offset
);
112 if (access
& GL_MAP_READ_BIT
)
113 flags
|= NOUVEAU_BO_RD
;
114 if (access
& GL_MAP_WRITE_BIT
)
115 flags
|= NOUVEAU_BO_WR
;
118 ret
= nouveau_bo_map(s
->bo
, flags
);
122 ti
->Data
= s
->bo
->map
+ y
* s
->pitch
+ x
* s
->cpp
;
128 nouveau_teximage_unmap(struct gl_context
*ctx
, struct gl_texture_image
*ti
)
130 struct nouveau_teximage
*nti
= to_nouveau_teximage(ti
);
131 struct nouveau_surface
*s
= &nti
->surface
;
132 struct nouveau_surface
*st
= &nti
->transfer
.surface
;
135 context_drv(ctx
)->surface_copy(ctx
, s
, st
, nti
->transfer
.x
,
136 nti
->transfer
.y
, 0, 0,
137 st
->width
, st
->height
);
138 nouveau_surface_ref(NULL
, st
);
141 nouveau_bo_unmap(s
->bo
);
149 nouveau_map_texture_image(struct gl_context
*ctx
,
150 struct gl_texture_image
*ti
,
152 GLuint x
, GLuint y
, GLuint w
, GLuint h
,
157 struct nouveau_teximage
*nti
= to_nouveau_teximage(ti
);
158 struct nouveau_surface
*s
= &nti
->surface
;
159 struct nouveau_surface
*st
= &nti
->transfer
.surface
;
161 /* Nouveau has no support for 3D or cubemap textures. */
165 if (!(mode
& GL_MAP_READ_BIT
) &&
166 nouveau_bo_pending(s
->bo
)) {
168 * Heuristic: use a bounce buffer to pipeline
169 * teximage transfers.
172 st
->format
= s
->format
;
176 st
->pitch
= s
->pitch
;
180 *map
= nouveau_get_scratch(ctx
, st
->pitch
* h
,
181 &st
->bo
, &st
->offset
);
186 if (mode
& GL_MAP_READ_BIT
)
187 flags
|= NOUVEAU_BO_RD
;
188 if (mode
& GL_MAP_WRITE_BIT
)
189 flags
|= NOUVEAU_BO_WR
;
192 ret
= nouveau_bo_map(s
->bo
, flags
);
196 *map
= s
->bo
->map
+ y
* s
->pitch
+ x
* s
->cpp
;
200 *map
= ti
->Data
+ y
* s
->pitch
+ x
* s
->cpp
;
206 nouveau_unmap_texture_image(struct gl_context
*ctx
, struct gl_texture_image
*ti
,
209 struct nouveau_teximage
*nti
= to_nouveau_teximage(ti
);
210 struct nouveau_surface
*s
= &nti
->surface
;
211 struct nouveau_surface
*st
= &nti
->transfer
.surface
;
214 context_drv(ctx
)->surface_copy(ctx
, s
, st
, nti
->transfer
.x
,
215 nti
->transfer
.y
, 0, 0,
216 st
->width
, st
->height
);
217 nouveau_surface_ref(NULL
, st
);
220 nouveau_bo_unmap(s
->bo
);
227 nouveau_choose_tex_format(struct gl_context
*ctx
, GLint internalFormat
,
228 GLenum srcFormat
, GLenum srcType
)
230 switch (internalFormat
) {
239 case GL_COMPRESSED_RGBA
:
240 return MESA_FORMAT_ARGB8888
;
242 return MESA_FORMAT_ARGB1555
;
249 case GL_COMPRESSED_RGB
:
250 return MESA_FORMAT_XRGB8888
;
255 return MESA_FORMAT_RGB565
;
258 case GL_LUMINANCE_ALPHA
:
259 case GL_LUMINANCE4_ALPHA4
:
260 case GL_LUMINANCE6_ALPHA2
:
261 case GL_LUMINANCE12_ALPHA4
:
262 case GL_LUMINANCE12_ALPHA12
:
263 case GL_LUMINANCE16_ALPHA16
:
264 case GL_LUMINANCE8_ALPHA8
:
265 case GL_COMPRESSED_LUMINANCE_ALPHA
:
266 return MESA_FORMAT_ARGB8888
;
274 case GL_COMPRESSED_LUMINANCE
:
275 return MESA_FORMAT_L8
;
282 case GL_COMPRESSED_ALPHA
:
283 return MESA_FORMAT_A8
;
290 return MESA_FORMAT_I8
;
298 teximage_fits(struct gl_texture_object
*t
, int level
)
300 struct nouveau_surface
*s
= &to_nouveau_texture(t
)->surfaces
[level
];
301 struct gl_texture_image
*ti
= t
->Image
[0][level
];
303 if (!ti
|| !to_nouveau_teximage(ti
)->surface
.bo
)
306 if (level
== t
->BaseLevel
&& (s
->offset
& 0x7f))
309 return t
->Target
== GL_TEXTURE_RECTANGLE
||
310 (s
->bo
&& s
->format
== ti
->TexFormat
&&
311 s
->width
== ti
->Width
&& s
->height
== ti
->Height
);
315 validate_teximage(struct gl_context
*ctx
, struct gl_texture_object
*t
,
316 int level
, int x
, int y
, int z
,
317 int width
, int height
, int depth
)
319 struct gl_texture_image
*ti
= t
->Image
[0][level
];
321 if (teximage_fits(t
, level
)) {
322 struct nouveau_surface
*ss
= to_nouveau_texture(t
)->surfaces
;
323 struct nouveau_surface
*s
= &to_nouveau_teximage(ti
)->surface
;
325 if (t
->Target
== GL_TEXTURE_RECTANGLE
)
326 nouveau_surface_ref(s
, &ss
[level
]);
328 context_drv(ctx
)->surface_copy(ctx
, &ss
[level
], s
,
339 get_last_level(struct gl_texture_object
*t
)
341 struct gl_texture_image
*base
= t
->Image
[0][t
->BaseLevel
];
343 if (t
->Sampler
.MinFilter
== GL_NEAREST
||
344 t
->Sampler
.MinFilter
== GL_LINEAR
|| !base
)
347 return MIN2(t
->BaseLevel
+ base
->MaxLog2
, t
->MaxLevel
);
351 relayout_texture(struct gl_context
*ctx
, struct gl_texture_object
*t
)
353 struct gl_texture_image
*base
= t
->Image
[0][t
->BaseLevel
];
355 if (base
&& t
->Target
!= GL_TEXTURE_RECTANGLE
) {
356 struct nouveau_surface
*ss
= to_nouveau_texture(t
)->surfaces
;
357 struct nouveau_surface
*s
= &to_nouveau_teximage(base
)->surface
;
358 int i
, ret
, last
= get_last_level(t
);
359 unsigned size
, offset
= 0,
363 /* Deallocate the old storage. */
364 for (i
= 0; i
< MAX_TEXTURE_LEVELS
; i
++)
365 nouveau_bo_ref(NULL
, &ss
[i
].bo
);
367 /* Relayout the mipmap tree. */
368 for (i
= t
->BaseLevel
; i
<= last
; i
++) {
369 size
= width
* height
* s
->cpp
;
371 /* Images larger than 16B have to be aligned. */
373 offset
= align(offset
, 64);
375 ss
[i
] = (struct nouveau_surface
) {
382 .pitch
= width
* s
->cpp
,
386 width
= MAX2(1, width
/ 2);
387 height
= MAX2(1, height
/ 2);
390 /* Get new storage. */
391 size
= align(offset
, 64);
393 ret
= nouveau_bo_new(context_dev(ctx
), NOUVEAU_BO_MAP
|
394 NOUVEAU_BO_GART
| NOUVEAU_BO_VRAM
,
395 0, size
, &ss
[last
].bo
);
398 for (i
= t
->BaseLevel
; i
< last
; i
++)
399 nouveau_bo_ref(ss
[last
].bo
, &ss
[i
].bo
);
404 nouveau_texture_validate(struct gl_context
*ctx
, struct gl_texture_object
*t
)
406 struct nouveau_texture
*nt
= to_nouveau_texture(t
);
407 int i
, last
= get_last_level(t
);
409 if (!teximage_fits(t
, t
->BaseLevel
) ||
410 !teximage_fits(t
, last
))
414 nt
->dirty
= GL_FALSE
;
416 /* Copy the teximages to the actual miptree. */
417 for (i
= t
->BaseLevel
; i
<= last
; i
++) {
418 struct nouveau_surface
*s
= &nt
->surfaces
[i
];
420 validate_teximage(ctx
, t
, i
, 0, 0, 0,
421 s
->width
, s
->height
, 1);
424 FIRE_RING(context_chan(ctx
));
431 nouveau_texture_reallocate(struct gl_context
*ctx
, struct gl_texture_object
*t
)
433 if (!teximage_fits(t
, t
->BaseLevel
) ||
434 !teximage_fits(t
, get_last_level(t
))) {
436 relayout_texture(ctx
, t
);
437 nouveau_texture_validate(ctx
, t
);
442 get_teximage_placement(struct gl_texture_image
*ti
)
444 if (ti
->TexFormat
== MESA_FORMAT_A8
||
445 ti
->TexFormat
== MESA_FORMAT_L8
||
446 ti
->TexFormat
== MESA_FORMAT_I8
)
447 /* 1 cpp formats will have to be swizzled by the CPU,
448 * so leave them in system RAM for now. */
449 return NOUVEAU_BO_MAP
;
451 return NOUVEAU_BO_GART
| NOUVEAU_BO_MAP
;
455 nouveau_teximage(struct gl_context
*ctx
, GLint dims
, GLenum target
, GLint level
,
456 GLint internalFormat
,
457 GLint width
, GLint height
, GLint depth
, GLint border
,
458 GLenum format
, GLenum type
, const GLvoid
*pixels
,
459 const struct gl_pixelstore_attrib
*packing
,
460 struct gl_texture_object
*t
,
461 struct gl_texture_image
*ti
)
463 struct nouveau_surface
*s
= &to_nouveau_teximage(ti
)->surface
;
466 /* Allocate a new bo for the image. */
467 nouveau_surface_alloc(ctx
, s
, LINEAR
, get_teximage_placement(ti
),
468 ti
->TexFormat
, width
, height
);
469 ti
->RowStride
= s
->pitch
/ s
->cpp
;
471 pixels
= _mesa_validate_pbo_teximage(ctx
, dims
, width
, height
, depth
,
472 format
, type
, pixels
, packing
,
475 /* Store the pixel data. */
476 nouveau_teximage_map(ctx
, ti
, GL_MAP_WRITE_BIT
,
477 0, 0, width
, height
);
479 ret
= _mesa_texstore(ctx
, dims
, ti
->_BaseFormat
,
480 ti
->TexFormat
, ti
->Data
,
483 width
, height
, depth
,
484 format
, type
, pixels
, packing
);
487 nouveau_teximage_unmap(ctx
, ti
);
488 _mesa_unmap_teximage_pbo(ctx
, packing
);
490 if (!validate_teximage(ctx
, t
, level
, 0, 0, 0,
491 width
, height
, depth
))
492 /* It doesn't fit, mark it as dirty. */
496 if (level
== t
->BaseLevel
) {
497 if (!teximage_fits(t
, level
))
498 relayout_texture(ctx
, t
);
499 nouveau_texture_validate(ctx
, t
);
502 context_dirty_i(ctx
, TEX_OBJ
, ctx
->Texture
.CurrentUnit
);
503 context_dirty_i(ctx
, TEX_ENV
, ctx
->Texture
.CurrentUnit
);
507 nouveau_teximage_1d(struct gl_context
*ctx
, GLenum target
, GLint level
,
508 GLint internalFormat
,
509 GLint width
, GLint border
,
510 GLenum format
, GLenum type
, const GLvoid
*pixels
,
511 const struct gl_pixelstore_attrib
*packing
,
512 struct gl_texture_object
*t
,
513 struct gl_texture_image
*ti
)
515 nouveau_teximage(ctx
, 1, target
, level
, internalFormat
,
516 width
, 1, 1, border
, format
, type
, pixels
,
521 nouveau_teximage_2d(struct gl_context
*ctx
, GLenum target
, GLint level
,
522 GLint internalFormat
,
523 GLint width
, GLint height
, GLint border
,
524 GLenum format
, GLenum type
, const GLvoid
*pixels
,
525 const struct gl_pixelstore_attrib
*packing
,
526 struct gl_texture_object
*t
,
527 struct gl_texture_image
*ti
)
529 nouveau_teximage(ctx
, 2, target
, level
, internalFormat
,
530 width
, height
, 1, border
, format
, type
, pixels
,
535 nouveau_teximage_3d(struct gl_context
*ctx
, GLenum target
, GLint level
,
536 GLint internalFormat
,
537 GLint width
, GLint height
, GLint depth
, GLint border
,
538 GLenum format
, GLenum type
, const GLvoid
*pixels
,
539 const struct gl_pixelstore_attrib
*packing
,
540 struct gl_texture_object
*t
,
541 struct gl_texture_image
*ti
)
543 nouveau_teximage(ctx
, 3, target
, level
, internalFormat
,
544 width
, height
, depth
, border
, format
, type
, pixels
,
549 nouveau_texsubimage(struct gl_context
*ctx
, GLint dims
, GLenum target
, GLint level
,
550 GLint xoffset
, GLint yoffset
, GLint zoffset
,
551 GLint width
, GLint height
, GLint depth
,
552 GLenum format
, GLenum type
, const void *pixels
,
553 const struct gl_pixelstore_attrib
*packing
,
554 struct gl_texture_object
*t
,
555 struct gl_texture_image
*ti
)
557 struct nouveau_surface
*s
= &to_nouveau_teximage(ti
)->surface
;
560 pixels
= _mesa_validate_pbo_teximage(ctx
, dims
, width
, height
, depth
,
561 format
, type
, pixels
, packing
,
564 nouveau_teximage_map(ctx
, ti
, GL_MAP_WRITE_BIT
,
565 xoffset
, yoffset
, width
, height
);
567 ret
= _mesa_texstore(ctx
, 3, ti
->_BaseFormat
, ti
->TexFormat
,
568 ti
->Data
, 0, 0, 0, s
->pitch
,
569 ti
->ImageOffsets
, width
, height
, depth
,
570 format
, type
, pixels
, packing
);
573 nouveau_teximage_unmap(ctx
, ti
);
574 _mesa_unmap_teximage_pbo(ctx
, packing
);
577 if (!to_nouveau_texture(t
)->dirty
)
578 validate_teximage(ctx
, t
, level
, xoffset
, yoffset
, zoffset
,
579 width
, height
, depth
);
583 nouveau_texsubimage_3d(struct gl_context
*ctx
, GLenum target
, GLint level
,
584 GLint xoffset
, GLint yoffset
, GLint zoffset
,
585 GLint width
, GLint height
, GLint depth
,
586 GLenum format
, GLenum type
, const void *pixels
,
587 const struct gl_pixelstore_attrib
*packing
,
588 struct gl_texture_object
*t
,
589 struct gl_texture_image
*ti
)
591 nouveau_texsubimage(ctx
, 3, target
, level
, xoffset
, yoffset
, zoffset
,
592 width
, height
, depth
, format
, type
, pixels
,
597 nouveau_texsubimage_2d(struct gl_context
*ctx
, GLenum target
, GLint level
,
598 GLint xoffset
, GLint yoffset
,
599 GLint width
, GLint height
,
600 GLenum format
, GLenum type
, const void *pixels
,
601 const struct gl_pixelstore_attrib
*packing
,
602 struct gl_texture_object
*t
,
603 struct gl_texture_image
*ti
)
605 nouveau_texsubimage(ctx
, 2, target
, level
, xoffset
, yoffset
, 0,
606 width
, height
, 1, format
, type
, pixels
,
611 nouveau_texsubimage_1d(struct gl_context
*ctx
, GLenum target
, GLint level
,
612 GLint xoffset
, GLint width
,
613 GLenum format
, GLenum type
, const void *pixels
,
614 const struct gl_pixelstore_attrib
*packing
,
615 struct gl_texture_object
*t
,
616 struct gl_texture_image
*ti
)
618 nouveau_texsubimage(ctx
, 1, target
, level
, xoffset
, 0, 0,
619 width
, 1, 1, format
, type
, pixels
,
624 nouveau_bind_texture(struct gl_context
*ctx
, GLenum target
,
625 struct gl_texture_object
*t
)
627 context_dirty_i(ctx
, TEX_OBJ
, ctx
->Texture
.CurrentUnit
);
628 context_dirty_i(ctx
, TEX_ENV
, ctx
->Texture
.CurrentUnit
);
632 get_texbuffer_format(struct gl_renderbuffer
*rb
, GLint format
)
634 struct nouveau_surface
*s
= &to_nouveau_renderbuffer(rb
)->surface
;
638 else if (format
== __DRI_TEXTURE_FORMAT_RGBA
)
639 return MESA_FORMAT_ARGB8888
;
641 return MESA_FORMAT_XRGB8888
;
645 nouveau_set_texbuffer(__DRIcontext
*dri_ctx
,
646 GLint target
, GLint format
,
649 struct nouveau_context
*nctx
= dri_ctx
->driverPrivate
;
650 struct gl_context
*ctx
= &nctx
->base
;
651 struct gl_framebuffer
*fb
= draw
->driverPrivate
;
652 struct gl_renderbuffer
*rb
=
653 fb
->Attachment
[BUFFER_FRONT_LEFT
].Renderbuffer
;
654 struct gl_texture_object
*t
= _mesa_get_current_tex_object(ctx
, target
);
655 struct gl_texture_image
*ti
;
656 struct nouveau_surface
*s
;
658 _mesa_lock_texture(ctx
, t
);
659 ti
= _mesa_get_tex_image(ctx
, t
, target
, 0);
660 s
= &to_nouveau_teximage(ti
)->surface
;
662 /* Update the texture surface with the given drawable. */
663 nouveau_update_renderbuffers(dri_ctx
, draw
);
664 nouveau_surface_ref(&to_nouveau_renderbuffer(rb
)->surface
, s
);
666 s
->format
= get_texbuffer_format(rb
, format
);
668 /* Update the image fields. */
669 _mesa_init_teximage_fields(ctx
, target
, ti
, s
->width
, s
->height
,
670 1, 0, s
->cpp
, s
->format
);
671 ti
->RowStride
= s
->pitch
/ s
->cpp
;
673 /* Try to validate it. */
674 if (!validate_teximage(ctx
, t
, 0, 0, 0, 0, s
->width
, s
->height
, 1))
675 nouveau_texture_reallocate(ctx
, t
);
677 context_dirty_i(ctx
, TEX_OBJ
, ctx
->Texture
.CurrentUnit
);
678 context_dirty_i(ctx
, TEX_ENV
, ctx
->Texture
.CurrentUnit
);
680 _mesa_unlock_texture(ctx
, t
);
684 nouveau_texture_map(struct gl_context
*ctx
, struct gl_texture_object
*t
)
688 for (i
= t
->BaseLevel
; i
< t
->_MaxLevel
; i
++) {
689 struct gl_texture_image
*ti
= t
->Image
[0][i
];
692 nouveau_teximage_map(ctx
, ti
, GL_MAP_READ_BIT
,
693 0, 0, ti
->Width
, ti
->Height
);
698 nouveau_texture_unmap(struct gl_context
*ctx
, struct gl_texture_object
*t
)
702 for (i
= t
->BaseLevel
; i
< t
->_MaxLevel
; i
++) {
704 nouveau_teximage_unmap(ctx
, t
->Image
[0][i
]);
709 store_mipmap(struct gl_context
*ctx
, GLenum target
, int first
, int last
,
710 struct gl_texture_object
*t
)
712 struct gl_pixelstore_attrib packing
= {
713 .BufferObj
= ctx
->Shared
->NullBufferObj
,
716 GLenum format
= t
->Image
[0][t
->BaseLevel
]->TexFormat
;
717 unsigned base_format
, type
, comps
;
720 base_format
= _mesa_get_format_base_format(format
);
721 _mesa_format_to_type_and_comps(format
, &type
, &comps
);
723 for (i
= first
; i
<= last
; i
++) {
724 struct gl_texture_image
*ti
= t
->Image
[0][i
];
725 void *data
= ti
->Data
;
727 nouveau_teximage(ctx
, 3, target
, i
, ti
->InternalFormat
,
728 ti
->Width
, ti
->Height
, ti
->Depth
,
729 ti
->Border
, base_format
, type
, data
,
732 _mesa_free_texmemory(data
);
737 nouveau_generate_mipmap(struct gl_context
*ctx
, GLenum target
,
738 struct gl_texture_object
*t
)
740 if (_mesa_meta_check_generate_mipmap_fallback(ctx
, target
, t
)) {
741 struct gl_texture_image
*base
= t
->Image
[0][t
->BaseLevel
];
743 nouveau_teximage_map(ctx
, base
, GL_MAP_READ_BIT
,
744 0, 0, base
->Width
, base
->Height
);
745 _mesa_generate_mipmap(ctx
, target
, t
);
746 nouveau_teximage_unmap(ctx
, base
);
748 if (!_mesa_is_format_compressed(base
->TexFormat
)) {
749 store_mipmap(ctx
, target
, t
->BaseLevel
+ 1,
750 get_last_level(t
), t
);
754 _mesa_meta_GenerateMipmap(ctx
, target
, t
);
759 nouveau_texture_functions_init(struct dd_function_table
*functions
)
761 functions
->NewTextureObject
= nouveau_texture_new
;
762 functions
->DeleteTexture
= nouveau_texture_free
;
763 functions
->NewTextureImage
= nouveau_teximage_new
;
764 functions
->FreeTextureImageBuffer
= nouveau_teximage_free
;
765 functions
->ChooseTextureFormat
= nouveau_choose_tex_format
;
766 functions
->TexImage1D
= nouveau_teximage_1d
;
767 functions
->TexImage2D
= nouveau_teximage_2d
;
768 functions
->TexImage3D
= nouveau_teximage_3d
;
769 functions
->TexSubImage1D
= nouveau_texsubimage_1d
;
770 functions
->TexSubImage2D
= nouveau_texsubimage_2d
;
771 functions
->TexSubImage3D
= nouveau_texsubimage_3d
;
772 functions
->BindTexture
= nouveau_bind_texture
;
773 functions
->MapTexture
= nouveau_texture_map
;
774 functions
->UnmapTexture
= nouveau_texture_unmap
;
775 functions
->MapTextureImage
= nouveau_map_texture_image
;
776 functions
->UnmapTextureImage
= nouveau_unmap_texture_image
;
777 functions
->GenerateMipmap
= nouveau_generate_mipmap
;