1 /**************************************************************************
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
28 #include "main/mfeatures.h"
29 #include "main/bufferobj.h"
30 #include "main/enums.h"
31 #include "main/fbobject.h"
32 #include "main/formats.h"
33 #include "main/image.h"
34 #include "main/imports.h"
35 #include "main/macros.h"
36 #include "main/mipmap.h"
37 #include "main/pack.h"
39 #include "main/pixeltransfer.h"
40 #include "main/texcompress.h"
41 #include "main/texgetimage.h"
42 #include "main/teximage.h"
43 #include "main/texobj.h"
44 #include "main/texstore.h"
46 #include "state_tracker/st_debug.h"
47 #include "state_tracker/st_context.h"
48 #include "state_tracker/st_cb_fbo.h"
49 #include "state_tracker/st_cb_flush.h"
50 #include "state_tracker/st_cb_texture.h"
51 #include "state_tracker/st_format.h"
52 #include "state_tracker/st_texture.h"
53 #include "state_tracker/st_gen_mipmap.h"
54 #include "state_tracker/st_atom.h"
56 #include "pipe/p_context.h"
57 #include "pipe/p_defines.h"
58 #include "util/u_inlines.h"
59 #include "pipe/p_shader_tokens.h"
60 #include "util/u_tile.h"
61 #include "util/u_blit.h"
62 #include "util/u_format.h"
63 #include "util/u_surface.h"
64 #include "util/u_sampler.h"
65 #include "util/u_math.h"
66 #include "util/u_box.h"
68 #define DBG if (0) printf
71 static enum pipe_texture_target
72 gl_target_to_pipe(GLenum target
)
76 return PIPE_TEXTURE_1D
;
78 case GL_TEXTURE_EXTERNAL_OES
:
79 return PIPE_TEXTURE_2D
;
80 case GL_TEXTURE_RECTANGLE_NV
:
81 return PIPE_TEXTURE_RECT
;
83 return PIPE_TEXTURE_3D
;
84 case GL_TEXTURE_CUBE_MAP_ARB
:
85 return PIPE_TEXTURE_CUBE
;
86 case GL_TEXTURE_1D_ARRAY_EXT
:
87 return PIPE_TEXTURE_1D_ARRAY
;
88 case GL_TEXTURE_2D_ARRAY_EXT
:
89 return PIPE_TEXTURE_2D_ARRAY
;
90 case GL_TEXTURE_BUFFER
:
99 /** called via ctx->Driver.NewTextureImage() */
100 static struct gl_texture_image
*
101 st_NewTextureImage(struct gl_context
* ctx
)
103 DBG("%s\n", __FUNCTION__
);
105 return (struct gl_texture_image
*) ST_CALLOC_STRUCT(st_texture_image
);
109 /** called via ctx->Driver.DeleteTextureImage() */
111 st_DeleteTextureImage(struct gl_context
* ctx
, struct gl_texture_image
*img
)
113 /* nothing special (yet) for st_texture_image */
114 _mesa_delete_texture_image(ctx
, img
);
118 /** called via ctx->Driver.NewTextureObject() */
119 static struct gl_texture_object
*
120 st_NewTextureObject(struct gl_context
* ctx
, GLuint name
, GLenum target
)
122 struct st_texture_object
*obj
= ST_CALLOC_STRUCT(st_texture_object
);
124 DBG("%s\n", __FUNCTION__
);
125 _mesa_initialize_texture_object(&obj
->base
, name
, target
);
130 /** called via ctx->Driver.DeleteTextureObject() */
132 st_DeleteTextureObject(struct gl_context
*ctx
,
133 struct gl_texture_object
*texObj
)
135 struct st_context
*st
= st_context(ctx
);
136 struct st_texture_object
*stObj
= st_texture_object(texObj
);
138 pipe_resource_reference(&stObj
->pt
, NULL
);
139 if (stObj
->sampler_view
) {
140 if (stObj
->sampler_view
->context
!= st
->pipe
) {
141 /* Take "ownership" of this texture sampler view by setting
142 * its context pointer to this context. This avoids potential
143 * crashes when the texture object is shared among contexts
144 * and the original/owner context has already been destroyed.
146 stObj
->sampler_view
->context
= st
->pipe
;
148 pipe_sampler_view_reference(&stObj
->sampler_view
, NULL
);
150 _mesa_delete_texture_object(ctx
, texObj
);
154 /** called via ctx->Driver.FreeTextureImageBuffer() */
156 st_FreeTextureImageBuffer(struct gl_context
*ctx
,
157 struct gl_texture_image
*texImage
)
159 struct st_texture_image
*stImage
= st_texture_image(texImage
);
161 DBG("%s\n", __FUNCTION__
);
164 pipe_resource_reference(&stImage
->pt
, NULL
);
167 if (stImage
->TexData
) {
168 _mesa_align_free(stImage
->TexData
);
169 stImage
->TexData
= NULL
;
174 /** called via ctx->Driver.MapTextureImage() */
176 st_MapTextureImage(struct gl_context
*ctx
,
177 struct gl_texture_image
*texImage
,
178 GLuint slice
, GLuint x
, GLuint y
, GLuint w
, GLuint h
,
180 GLubyte
**mapOut
, GLint
*rowStrideOut
)
182 struct st_context
*st
= st_context(ctx
);
183 struct st_texture_image
*stImage
= st_texture_image(texImage
);
188 if (mode
& GL_MAP_READ_BIT
)
189 pipeMode
|= PIPE_TRANSFER_READ
;
190 if (mode
& GL_MAP_WRITE_BIT
)
191 pipeMode
|= PIPE_TRANSFER_WRITE
;
192 if (mode
& GL_MAP_INVALIDATE_RANGE_BIT
)
193 pipeMode
|= PIPE_TRANSFER_DISCARD_RANGE
;
195 map
= st_texture_image_map(st
, stImage
, slice
, pipeMode
, x
, y
, w
, h
);
198 *rowStrideOut
= stImage
->transfer
->stride
;
207 /** called via ctx->Driver.UnmapTextureImage() */
209 st_UnmapTextureImage(struct gl_context
*ctx
,
210 struct gl_texture_image
*texImage
,
213 struct st_context
*st
= st_context(ctx
);
214 struct st_texture_image
*stImage
= st_texture_image(texImage
);
215 st_texture_image_unmap(st
, stImage
);
220 * Return default texture resource binding bitmask for the given format.
223 default_bindings(struct st_context
*st
, enum pipe_format format
)
225 struct pipe_screen
*screen
= st
->pipe
->screen
;
226 const unsigned target
= PIPE_TEXTURE_2D
;
229 if (util_format_is_depth_or_stencil(format
))
230 bindings
= PIPE_BIND_SAMPLER_VIEW
| PIPE_BIND_DEPTH_STENCIL
;
232 bindings
= PIPE_BIND_SAMPLER_VIEW
| PIPE_BIND_RENDER_TARGET
;
234 if (screen
->is_format_supported(screen
, format
, target
, 0, bindings
))
238 format
= util_format_linear(format
);
240 if (screen
->is_format_supported(screen
, format
, target
, 0, bindings
))
243 return PIPE_BIND_SAMPLER_VIEW
;
248 /** Return number of image dimensions (1, 2 or 3) for a texture target. */
250 get_texture_dims(GLenum target
)
254 case GL_TEXTURE_1D_ARRAY_EXT
:
255 case GL_TEXTURE_BUFFER
:
258 case GL_TEXTURE_CUBE_MAP_ARB
:
259 case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
:
260 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
:
261 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
:
262 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
:
263 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
:
264 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
:
265 case GL_TEXTURE_RECTANGLE_NV
:
266 case GL_TEXTURE_2D_ARRAY_EXT
:
267 case GL_TEXTURE_EXTERNAL_OES
:
272 assert(0 && "invalid texture target in get_texture_dims()");
279 * Given the size of a mipmap image, try to compute the size of the level=0
282 * Note that this isn't always accurate for odd-sized, non-POW textures.
283 * For example, if level=1 and width=40 then the level=0 width may be 80 or 81.
285 * \return GL_TRUE for success, GL_FALSE for failure
288 guess_base_level_size(GLenum target
,
289 GLuint width
, GLuint height
, GLuint depth
, GLuint level
,
290 GLuint
*width0
, GLuint
*height0
, GLuint
*depth0
)
292 const GLuint dims
= get_texture_dims(target
);
299 /* Depending on the image's size, we can't always make a guess here */
300 if ((dims
>= 1 && width
== 1) ||
301 (dims
>= 2 && height
== 1) ||
302 (dims
>= 3 && depth
== 1)) {
303 /* we can't determine the image size at level=0 */
307 /* grow the image size until we hit level = 0 */
328 * Try to allocate a pipe_resource object for the given st_texture_object.
330 * We use the given st_texture_image as a clue to determine the size of the
331 * mipmap image at level=0.
333 * \return GL_TRUE for success, GL_FALSE if out of memory.
336 guess_and_alloc_texture(struct st_context
*st
,
337 struct st_texture_object
*stObj
,
338 const struct st_texture_image
*stImage
)
340 GLuint lastLevel
, width
, height
, depth
;
342 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
;
343 enum pipe_format fmt
;
345 DBG("%s\n", __FUNCTION__
);
349 if (!guess_base_level_size(stObj
->base
.Target
,
350 stImage
->base
.Width2
,
351 stImage
->base
.Height2
,
352 stImage
->base
.Depth2
,
354 &width
, &height
, &depth
)) {
355 /* we can't determine the image size at level=0 */
356 stObj
->width0
= stObj
->height0
= stObj
->depth0
= 0;
357 /* this is not an out of memory error */
361 /* At this point, (width x height x depth) is the expected size of
362 * the level=0 mipmap image.
365 /* Guess a reasonable value for lastLevel. With OpenGL we have no
366 * idea how many mipmap levels will be in a texture until we start
367 * to render with it. Make an educated guess here but be prepared
368 * to re-allocating a texture buffer with space for more (or fewer)
369 * mipmap levels later.
371 if ((stObj
->base
.Sampler
.MinFilter
== GL_NEAREST
||
372 stObj
->base
.Sampler
.MinFilter
== GL_LINEAR
||
373 stImage
->base
._BaseFormat
== GL_DEPTH_COMPONENT
||
374 stImage
->base
._BaseFormat
== GL_DEPTH_STENCIL_EXT
) &&
375 !stObj
->base
.GenerateMipmap
&&
376 stImage
->base
.Level
== 0) {
377 /* only alloc space for a single mipmap level */
381 /* alloc space for a full mipmap */
382 GLuint l2width
= util_logbase2(width
);
383 GLuint l2height
= util_logbase2(height
);
384 GLuint l2depth
= util_logbase2(depth
);
385 lastLevel
= MAX2(MAX2(l2width
, l2height
), l2depth
);
388 /* Save the level=0 dimensions */
389 stObj
->width0
= width
;
390 stObj
->height0
= height
;
391 stObj
->depth0
= depth
;
393 fmt
= st_mesa_format_to_pipe_format(stImage
->base
.TexFormat
);
395 bindings
= default_bindings(st
, fmt
);
397 st_gl_texture_dims_to_pipe_dims(stObj
->base
.Target
,
398 width
, height
, depth
,
399 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
401 stObj
->pt
= st_texture_create(st
,
402 gl_target_to_pipe(stObj
->base
.Target
),
411 DBG("%s returning %d\n", __FUNCTION__
, (stObj
->pt
!= NULL
));
413 return stObj
->pt
!= NULL
;
418 * Called via ctx->Driver.AllocTextureImageBuffer().
419 * If the texture object/buffer already has space for the indicated image,
420 * we're done. Otherwise, allocate memory for the new texture image.
423 st_AllocTextureImageBuffer(struct gl_context
*ctx
,
424 struct gl_texture_image
*texImage
,
425 gl_format format
, GLsizei width
,
426 GLsizei height
, GLsizei depth
)
428 struct st_context
*st
= st_context(ctx
);
429 struct st_texture_image
*stImage
= st_texture_image(texImage
);
430 struct st_texture_object
*stObj
= st_texture_object(texImage
->TexObject
);
431 const GLuint level
= texImage
->Level
;
433 DBG("%s\n", __FUNCTION__
);
438 assert(!stImage
->TexData
);
439 assert(!stImage
->pt
); /* xxx this might be wrong */
441 /* Look if the parent texture object has space for this image */
443 level
<= stObj
->pt
->last_level
&&
444 st_texture_match_image(stObj
->pt
, texImage
)) {
445 /* this image will fit in the existing texture object's memory */
446 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
450 /* The parent texture object does not have space for this image */
452 pipe_resource_reference(&stObj
->pt
, NULL
);
453 pipe_sampler_view_reference(&stObj
->sampler_view
, NULL
);
455 if (!guess_and_alloc_texture(st
, stObj
, stImage
)) {
456 /* Probably out of memory.
457 * Try flushing any pending rendering, then retry.
460 if (!guess_and_alloc_texture(st
, stObj
, stImage
)) {
461 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
467 st_texture_match_image(stObj
->pt
, texImage
)) {
468 /* The image will live in the object's mipmap memory */
469 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
474 /* Create a new, temporary texture/resource/buffer to hold this
475 * one texture image. Note that when we later access this image
476 * (either for mapping or copying) we'll want to always specify
477 * mipmap level=0, even if the image represents some other mipmap
480 enum pipe_format format
=
481 st_mesa_format_to_pipe_format(texImage
->TexFormat
);
482 GLuint bindings
= default_bindings(st
, format
);
483 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
;
485 st_gl_texture_dims_to_pipe_dims(stObj
->base
.Target
,
486 width
, height
, depth
,
487 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
489 stImage
->pt
= st_texture_create(st
,
490 gl_target_to_pipe(stObj
->base
.Target
),
498 return stImage
->pt
!= NULL
;
504 * Preparation prior to glTexImage. Basically check the 'surface_based'
505 * field and switch to a "normal" tex image if necessary.
508 prep_teximage(struct gl_context
*ctx
, struct gl_texture_image
*texImage
,
509 GLint internalFormat
,
510 GLint width
, GLint height
, GLint depth
, GLint border
,
511 GLenum format
, GLenum type
)
513 struct gl_texture_object
*texObj
= texImage
->TexObject
;
514 struct st_texture_object
*stObj
= st_texture_object(texObj
);
516 /* switch to "normal" */
517 if (stObj
->surface_based
) {
518 const GLenum target
= texObj
->Target
;
519 const GLuint level
= texImage
->Level
;
522 _mesa_clear_texture_object(ctx
, texObj
);
523 pipe_resource_reference(&stObj
->pt
, NULL
);
525 /* oops, need to init this image again */
526 texFormat
= _mesa_choose_texture_format(ctx
, texObj
, target
, level
,
527 internalFormat
, format
, type
);
529 _mesa_init_teximage_fields(ctx
, texImage
,
530 width
, height
, depth
, border
,
531 internalFormat
, texFormat
);
533 stObj
->surface_based
= GL_FALSE
;
539 st_TexImage3D(struct gl_context
* ctx
,
540 struct gl_texture_image
*texImage
,
541 GLint internalFormat
,
542 GLint width
, GLint height
, GLint depth
,
544 GLenum format
, GLenum type
, const void *pixels
,
545 const struct gl_pixelstore_attrib
*unpack
)
547 prep_teximage(ctx
, texImage
, internalFormat
, width
, height
, depth
, border
,
549 _mesa_store_teximage3d(ctx
, texImage
, internalFormat
, width
, height
, depth
,
550 border
, format
, type
, pixels
, unpack
);
555 st_TexImage2D(struct gl_context
* ctx
,
556 struct gl_texture_image
*texImage
,
557 GLint internalFormat
,
558 GLint width
, GLint height
, GLint border
,
559 GLenum format
, GLenum type
, const void *pixels
,
560 const struct gl_pixelstore_attrib
*unpack
)
562 prep_teximage(ctx
, texImage
, internalFormat
, width
, height
, 1, border
,
564 _mesa_store_teximage2d(ctx
, texImage
, internalFormat
, width
, height
,
565 border
, format
, type
, pixels
, unpack
);
570 st_TexImage1D(struct gl_context
* ctx
,
571 struct gl_texture_image
*texImage
,
572 GLint internalFormat
,
573 GLint width
, GLint border
,
574 GLenum format
, GLenum type
, const void *pixels
,
575 const struct gl_pixelstore_attrib
*unpack
)
577 prep_teximage(ctx
, texImage
, internalFormat
, width
, 1, 1, border
,
579 _mesa_store_teximage1d(ctx
, texImage
, internalFormat
, width
,
580 border
, format
, type
, pixels
, unpack
);
585 st_CompressedTexImage2D(struct gl_context
*ctx
,
586 struct gl_texture_image
*texImage
,
587 GLint internalFormat
,
588 GLint width
, GLint height
, GLint border
,
589 GLsizei imageSize
, const GLvoid
*data
)
591 prep_teximage(ctx
, texImage
, internalFormat
, width
, 1, 1, border
,
593 _mesa_store_compressed_teximage2d(ctx
, texImage
, internalFormat
, width
,
594 height
, border
, imageSize
, data
);
600 * glGetTexImage() helper: decompress a compressed texture by rendering
601 * a textured quad. Store the results in the user's buffer.
604 decompress_with_blit(struct gl_context
* ctx
,
605 GLenum format
, GLenum type
, GLvoid
*pixels
,
606 struct gl_texture_image
*texImage
)
608 struct st_context
*st
= st_context(ctx
);
609 struct pipe_context
*pipe
= st
->pipe
;
610 struct st_texture_image
*stImage
= st_texture_image(texImage
);
611 struct st_texture_object
*stObj
= st_texture_object(texImage
->TexObject
);
612 struct pipe_sampler_view
*src_view
;
613 const GLuint width
= texImage
->Width
;
614 const GLuint height
= texImage
->Height
;
615 struct pipe_surface
*dst_surface
;
616 struct pipe_resource
*dst_texture
;
617 struct pipe_transfer
*tex_xfer
;
618 unsigned bind
= (PIPE_BIND_RENDER_TARGET
| /* util_blit may choose to render */
619 PIPE_BIND_TRANSFER_READ
);
621 /* create temp / dest surface */
622 if (!util_create_rgba_surface(pipe
, width
, height
, bind
,
623 &dst_texture
, &dst_surface
)) {
624 _mesa_problem(ctx
, "util_create_rgba_surface() failed "
625 "in decompress_with_blit()");
629 /* Disable conditional rendering. */
630 if (st
->render_condition
) {
631 pipe
->render_condition(pipe
, NULL
, 0);
634 /* Create sampler view that limits fetches to the source mipmap level */
636 struct pipe_sampler_view sv_temp
;
638 u_sampler_view_default_template(&sv_temp
, stObj
->pt
, stObj
->pt
->format
);
640 sv_temp
.u
.tex
.first_level
=
641 sv_temp
.u
.tex
.last_level
= texImage
->Level
;
643 src_view
= pipe
->create_sampler_view(pipe
, stObj
->pt
, &sv_temp
);
645 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glGetTexImage");
650 /* blit/render/decompress */
651 util_blit_pixels_tex(st
->blit
,
652 src_view
, /* pipe_resource (src) */
653 0, 0, /* src x0, y0 */
654 width
, height
, /* src x1, y1 */
655 dst_surface
, /* pipe_surface (dst) */
656 0, 0, /* dst x0, y0 */
657 width
, height
, /* dst x1, y1 */
659 PIPE_TEX_MIPFILTER_NEAREST
);
661 /* Restore conditional rendering state. */
662 if (st
->render_condition
) {
663 pipe
->render_condition(pipe
, st
->render_condition
,
667 /* map the dst_surface so we can read from it */
668 tex_xfer
= pipe_get_transfer(pipe
,
671 0, 0, width
, height
);
673 pixels
= _mesa_map_pbo_dest(ctx
, &ctx
->Pack
, pixels
);
675 /* copy/pack data into user buffer */
676 if (st_equal_formats(stImage
->pt
->format
, format
, type
)) {
678 const uint bytesPerRow
= width
* util_format_get_blocksize(stImage
->pt
->format
);
679 ubyte
*map
= pipe_transfer_map(pipe
, tex_xfer
);
681 for (row
= 0; row
< height
; row
++) {
682 GLvoid
*dest
= _mesa_image_address2d(&ctx
->Pack
, pixels
, width
,
683 height
, format
, type
, row
, 0);
684 memcpy(dest
, map
, bytesPerRow
);
685 map
+= tex_xfer
->stride
;
687 pipe_transfer_unmap(pipe
, tex_xfer
);
690 /* format translation via floats */
692 enum pipe_format pformat
= util_format_linear(dst_texture
->format
);
693 for (row
= 0; row
< height
; row
++) {
694 const GLbitfield transferOps
= 0x0; /* bypassed for glGetTexImage() */
695 GLfloat rgba
[4 * MAX_WIDTH
];
696 GLvoid
*dest
= _mesa_image_address2d(&ctx
->Pack
, pixels
, width
,
697 height
, format
, type
, row
, 0);
699 if (ST_DEBUG
& DEBUG_FALLBACK
)
700 debug_printf("%s: fallback format translation\n", __FUNCTION__
);
702 /* get float[4] rgba row from surface */
703 pipe_get_tile_rgba_format(pipe
, tex_xfer
, 0, row
, width
, 1,
706 _mesa_pack_rgba_span_float(ctx
, width
, (GLfloat (*)[4]) rgba
, format
,
707 type
, dest
, &ctx
->Pack
, transferOps
);
711 _mesa_unmap_pbo_dest(ctx
, &ctx
->Pack
);
713 pipe
->transfer_destroy(pipe
, tex_xfer
);
715 /* destroy the temp / dest surface */
716 util_destroy_rgba_surface(dst_texture
, dst_surface
);
718 pipe_sampler_view_reference(&src_view
, NULL
);
724 * Called via ctx->Driver.GetTexImage()
727 st_GetTexImage(struct gl_context
* ctx
,
728 GLenum format
, GLenum type
, GLvoid
* pixels
,
729 struct gl_texture_image
*texImage
)
731 struct st_texture_image
*stImage
= st_texture_image(texImage
);
733 if (stImage
->pt
&& util_format_is_s3tc(stImage
->pt
->format
)) {
734 /* Need to decompress the texture.
735 * We'll do this by rendering a textured quad (which is hopefully
736 * faster than using the fallback code in texcompress.c).
737 * Note that we only expect RGBA formats (no Z/depth formats).
739 decompress_with_blit(ctx
, format
, type
, pixels
, texImage
);
742 _mesa_get_teximage(ctx
, format
, type
, pixels
, texImage
);
748 * Do a CopyTexSubImage operation using a read transfer from the source,
749 * a write transfer to the destination and get_tile()/put_tile() to access
752 * Note: srcY=0=TOP of renderbuffer
755 fallback_copy_texsubimage(struct gl_context
*ctx
,
756 struct st_renderbuffer
*strb
,
757 struct st_texture_image
*stImage
,
759 GLint destX
, GLint destY
, GLint destZ
,
760 GLint srcX
, GLint srcY
,
761 GLsizei width
, GLsizei height
)
763 struct st_context
*st
= st_context(ctx
);
764 struct pipe_context
*pipe
= st
->pipe
;
765 struct pipe_transfer
*src_trans
;
767 enum pipe_transfer_usage transfer_usage
;
769 if (ST_DEBUG
& DEBUG_FALLBACK
)
770 debug_printf("%s: fallback processing\n", __FUNCTION__
);
772 assert(width
<= MAX_WIDTH
);
774 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
775 srcY
= strb
->Base
.Height
- srcY
- height
;
778 src_trans
= pipe_get_transfer(pipe
,
781 strb
->rtt_face
+ strb
->rtt_slice
,
786 if ((baseFormat
== GL_DEPTH_COMPONENT
||
787 baseFormat
== GL_DEPTH_STENCIL
) &&
788 util_format_is_depth_and_stencil(stImage
->pt
->format
))
789 transfer_usage
= PIPE_TRANSFER_READ_WRITE
;
791 transfer_usage
= PIPE_TRANSFER_WRITE
;
793 /* XXX this used to ignore destZ param */
794 texDest
= st_texture_image_map(st
, stImage
, destZ
, transfer_usage
,
795 destX
, destY
, width
, height
);
797 if (baseFormat
== GL_DEPTH_COMPONENT
||
798 baseFormat
== GL_DEPTH_STENCIL
) {
799 const GLboolean scaleOrBias
= (ctx
->Pixel
.DepthScale
!= 1.0F
||
800 ctx
->Pixel
.DepthBias
!= 0.0F
);
803 /* determine bottom-to-top vs. top-to-bottom order for src buffer */
804 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
813 /* To avoid a large temp memory allocation, do copy row by row */
814 for (row
= 0; row
< height
; row
++, srcY
+= yStep
) {
815 uint data
[MAX_WIDTH
];
816 pipe_get_tile_z(pipe
, src_trans
, 0, srcY
, width
, 1, data
);
818 _mesa_scale_and_bias_depth_uint(ctx
, width
, data
);
820 pipe_put_tile_z(pipe
, stImage
->transfer
, 0, row
, width
, 1, data
);
826 (GLfloat
*) malloc(width
* height
* 4 * sizeof(GLfloat
));
828 if (tempSrc
&& texDest
) {
829 const GLint dims
= 2;
830 const GLint dstRowStride
= stImage
->transfer
->stride
;
831 struct gl_texture_image
*texImage
= &stImage
->base
;
832 struct gl_pixelstore_attrib unpack
= ctx
->DefaultPacking
;
834 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
835 unpack
.Invert
= GL_TRUE
;
838 /* get float/RGBA image from framebuffer */
839 /* XXX this usually involves a lot of int/float conversion.
840 * try to avoid that someday.
842 pipe_get_tile_rgba_format(pipe
, src_trans
, 0, 0, width
, height
,
843 util_format_linear(strb
->texture
->format
),
846 /* Store into texture memory.
847 * Note that this does some special things such as pixel transfer
848 * ops and format conversion. In particular, if the dest tex format
849 * is actually RGBA but the user created the texture as GL_RGB we
850 * need to fill-in/override the alpha channel with 1.0.
852 _mesa_texstore(ctx
, dims
,
853 texImage
->_BaseFormat
,
856 (GLubyte
**) &texDest
,
858 GL_RGBA
, GL_FLOAT
, tempSrc
, /* src */
862 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexSubImage");
869 st_texture_image_unmap(st
, stImage
);
870 pipe
->transfer_destroy(pipe
, src_trans
);
876 * If the format of the src renderbuffer and the format of the dest
877 * texture are compatible (in terms of blitting), return a TGSI writemask
878 * to be used during the blit.
879 * If the src/dest are incompatible, return 0.
882 compatible_src_dst_formats(struct gl_context
*ctx
,
883 const struct gl_renderbuffer
*src
,
884 const struct gl_texture_image
*dst
)
886 /* Get logical base formats for the src and dest.
887 * That is, use the user-requested formats and not the actual, device-
889 * For example, the user may have requested an A8 texture but the
890 * driver may actually be using an RGBA texture format. When we
891 * copy/blit to that texture, we only want to copy the Alpha channel
892 * and not the RGB channels.
894 * Similarly, when the src FBO was created an RGB format may have been
895 * requested but the driver actually chose an RGBA format. In that case,
896 * we don't want to copy the undefined Alpha channel to the dest texture
897 * (it should be 1.0).
899 const GLenum srcFormat
= _mesa_base_fbo_format(ctx
, src
->InternalFormat
);
900 const GLenum dstFormat
= _mesa_base_tex_format(ctx
, dst
->InternalFormat
);
903 * XXX when we have red-only and red/green renderbuffers we'll need
904 * to add more cases here (or implement a general-purpose routine that
905 * queries the existance of the R,G,B,A channels in the src and dest).
907 if (srcFormat
== dstFormat
) {
908 /* This is the same as matching_base_formats, which should
909 * always pass, as it did previously.
911 return TGSI_WRITEMASK_XYZW
;
913 else if (srcFormat
== GL_RGB
&& dstFormat
== GL_RGBA
) {
914 /* Make sure that A in the dest is 1. The actual src format
915 * may be RGBA and have undefined A values.
917 return TGSI_WRITEMASK_XYZ
;
919 else if (srcFormat
== GL_RGBA
&& dstFormat
== GL_RGB
) {
920 /* Make sure that A in the dest is 1. The actual dst format
921 * may be RGBA and will need A=1 to provide proper alpha values
922 * when sampled later.
924 return TGSI_WRITEMASK_XYZ
;
927 if (ST_DEBUG
& DEBUG_FALLBACK
)
928 debug_printf("%s failed for src %s, dst %s\n",
930 _mesa_lookup_enum_by_nr(srcFormat
),
931 _mesa_lookup_enum_by_nr(dstFormat
));
942 * Do a CopyTex[Sub]Image1/2/3D() using a hardware (blit) path if possible.
943 * Note that the region to copy has already been clipped so we know we
944 * won't read from outside the source renderbuffer's bounds.
946 * Note: srcY=0=Bottom of renderbuffer (GL convention)
949 st_copy_texsubimage(struct gl_context
*ctx
,
950 struct gl_texture_image
*texImage
,
951 GLint destX
, GLint destY
, GLint destZ
,
952 struct gl_renderbuffer
*rb
,
953 GLint srcX
, GLint srcY
,
954 GLsizei width
, GLsizei height
)
956 struct st_texture_image
*stImage
= st_texture_image(texImage
);
957 const GLenum texBaseFormat
= texImage
->_BaseFormat
;
958 struct gl_framebuffer
*fb
= ctx
->ReadBuffer
;
959 struct st_renderbuffer
*strb
;
960 struct st_context
*st
= st_context(ctx
);
961 struct pipe_context
*pipe
= st
->pipe
;
962 struct pipe_screen
*screen
= pipe
->screen
;
963 enum pipe_format dest_format
, src_format
;
964 GLboolean matching_base_formats
;
965 GLuint format_writemask
, sample_count
;
966 struct pipe_surface
*dest_surface
= NULL
;
967 GLboolean do_flip
= (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
);
968 struct pipe_surface surf_tmpl
;
969 unsigned int dst_usage
;
972 /* make sure finalize_textures has been called?
974 if (0) st_validate_state(st
);
976 /* determine if copying depth or color data */
977 if (texBaseFormat
== GL_DEPTH_COMPONENT
||
978 texBaseFormat
== GL_DEPTH_STENCIL
) {
979 strb
= st_renderbuffer(fb
->Attachment
[BUFFER_DEPTH
].Renderbuffer
);
982 /* texBaseFormat == GL_RGB, GL_RGBA, GL_ALPHA, etc */
983 strb
= st_renderbuffer(fb
->_ColorReadBuffer
);
986 if (!strb
|| !strb
->surface
|| !stImage
->pt
) {
987 debug_printf("%s: null strb or stImage\n", __FUNCTION__
);
991 sample_count
= strb
->surface
->texture
->nr_samples
;
992 /* I believe this would be legal, presumably would need to do a resolve
993 for color, and for depth/stencil spec says to just use one of the
994 depth/stencil samples per pixel? Need some transfer clarifications. */
995 assert(sample_count
< 2);
998 assert(strb
->surface
);
1001 src_format
= strb
->surface
->format
;
1002 dest_format
= stImage
->pt
->format
;
1005 * Determine if the src framebuffer and dest texture have the same
1006 * base format. We need this to detect a case such as the framebuffer
1007 * being GL_RGBA but the texture being GL_RGB. If the actual hardware
1008 * texture format stores RGBA we need to set A=1 (overriding the
1009 * framebuffer's alpha values). We can't do that with the blit or
1010 * textured-quad paths.
1012 matching_base_formats
=
1013 (_mesa_get_format_base_format(strb
->Base
.Format
) ==
1014 _mesa_get_format_base_format(texImage
->TexFormat
));
1016 if (ctx
->_ImageTransferState
) {
1020 if (matching_base_formats
&&
1021 src_format
== dest_format
&&
1023 /* use surface_copy() / blit */
1024 struct pipe_box src_box
;
1025 u_box_2d_zslice(srcX
, srcY
, strb
->surface
->u
.tex
.first_layer
,
1026 width
, height
, &src_box
);
1028 /* for resource_copy_region(), y=0=top, always */
1029 pipe
->resource_copy_region(pipe
,
1032 stImage
->base
.Level
,
1033 destX
, destY
, destZ
+ stImage
->base
.Face
,
1036 strb
->surface
->u
.tex
.level
,
1041 if (texBaseFormat
== GL_DEPTH_STENCIL
) {
1045 if (texBaseFormat
== GL_DEPTH_COMPONENT
) {
1046 format_writemask
= TGSI_WRITEMASK_XYZW
;
1047 dst_usage
= PIPE_BIND_DEPTH_STENCIL
;
1050 format_writemask
= compatible_src_dst_formats(ctx
, &strb
->Base
, texImage
);
1051 dst_usage
= PIPE_BIND_RENDER_TARGET
;
1054 if (!format_writemask
||
1055 !screen
->is_format_supported(screen
, src_format
,
1056 PIPE_TEXTURE_2D
, sample_count
,
1057 PIPE_BIND_SAMPLER_VIEW
) ||
1058 !screen
->is_format_supported(screen
, dest_format
,
1065 srcY1
= strb
->Base
.Height
- srcY
- height
;
1066 srcY0
= srcY1
+ height
;
1070 srcY1
= srcY0
+ height
;
1073 /* Disable conditional rendering. */
1074 if (st
->render_condition
) {
1075 pipe
->render_condition(pipe
, NULL
, 0);
1078 memset(&surf_tmpl
, 0, sizeof(surf_tmpl
));
1079 surf_tmpl
.format
= util_format_linear(stImage
->pt
->format
);
1080 surf_tmpl
.usage
= dst_usage
;
1081 surf_tmpl
.u
.tex
.level
= stImage
->base
.Level
;
1082 surf_tmpl
.u
.tex
.first_layer
= stImage
->base
.Face
+ destZ
;
1083 surf_tmpl
.u
.tex
.last_layer
= stImage
->base
.Face
+ destZ
;
1085 dest_surface
= pipe
->create_surface(pipe
, stImage
->pt
,
1087 util_blit_pixels_writemask(st
->blit
,
1089 strb
->surface
->u
.tex
.level
,
1091 srcX
+ width
, srcY1
,
1092 strb
->surface
->u
.tex
.first_layer
,
1095 destX
+ width
, destY
+ height
,
1096 0.0, PIPE_TEX_MIPFILTER_NEAREST
,
1098 pipe_surface_reference(&dest_surface
, NULL
);
1100 /* Restore conditional rendering state. */
1101 if (st
->render_condition
) {
1102 pipe
->render_condition(pipe
, st
->render_condition
,
1103 st
->condition_mode
);
1109 /* software fallback */
1110 fallback_copy_texsubimage(ctx
,
1111 strb
, stImage
, texBaseFormat
,
1112 destX
, destY
, destZ
,
1113 srcX
, srcY
, width
, height
);
1119 st_CopyTexSubImage1D(struct gl_context
*ctx
,
1120 struct gl_texture_image
*texImage
,
1122 struct gl_renderbuffer
*rb
,
1123 GLint x
, GLint y
, GLsizei width
)
1125 const GLint yoffset
= 0, zoffset
= 0;
1126 const GLsizei height
= 1;
1127 st_copy_texsubimage(ctx
, texImage
,
1128 xoffset
, yoffset
, zoffset
, /* destX,Y,Z */
1129 rb
, x
, y
, width
, height
); /* src X, Y, size */
1134 st_CopyTexSubImage2D(struct gl_context
*ctx
,
1135 struct gl_texture_image
*texImage
,
1136 GLint xoffset
, GLint yoffset
,
1137 struct gl_renderbuffer
*rb
,
1138 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
1140 const GLint zoffset
= 0;
1141 st_copy_texsubimage(ctx
, texImage
,
1142 xoffset
, yoffset
, zoffset
, /* destX,Y,Z */
1143 rb
, x
, y
, width
, height
); /* src X, Y, size */
1148 st_CopyTexSubImage3D(struct gl_context
*ctx
,
1149 struct gl_texture_image
*texImage
,
1150 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1151 struct gl_renderbuffer
*rb
,
1152 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
1154 st_copy_texsubimage(ctx
, texImage
,
1155 xoffset
, yoffset
, zoffset
, /* destX,Y,Z */
1156 rb
, x
, y
, width
, height
); /* src X, Y, size */
1161 * Copy image data from stImage into the texture object 'stObj' at level
1165 copy_image_data_to_texture(struct st_context
*st
,
1166 struct st_texture_object
*stObj
,
1168 struct st_texture_image
*stImage
)
1172 const struct gl_texture_image
*dstImage
=
1173 stObj
->base
.Image
[stImage
->base
.Face
][dstLevel
];
1175 assert(dstImage
->Width
== stImage
->base
.Width
);
1176 assert(dstImage
->Height
== stImage
->base
.Height
);
1177 assert(dstImage
->Depth
== stImage
->base
.Depth
);
1181 /* Copy potentially with the blitter:
1184 if (stImage
->pt
!= stObj
->pt
)
1187 src_level
= stImage
->base
.Level
;
1189 st_texture_image_copy(st
->pipe
,
1190 stObj
->pt
, dstLevel
, /* dest texture, level */
1191 stImage
->pt
, src_level
, /* src texture, level */
1192 stImage
->base
.Face
);
1194 pipe_resource_reference(&stImage
->pt
, NULL
);
1196 else if (stImage
->TexData
) {
1197 /* Copy from malloc'd memory */
1198 /* XXX this should be re-examined/tested with a compressed format */
1199 GLuint blockSize
= util_format_get_blocksize(stObj
->pt
->format
);
1200 GLuint srcRowStride
= stImage
->base
.Width
* blockSize
;
1201 GLuint srcSliceStride
= stImage
->base
.Height
* srcRowStride
;
1202 st_texture_image_data(st
,
1209 _mesa_align_free(stImage
->TexData
);
1210 stImage
->TexData
= NULL
;
1213 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
1218 * Called during state validation. When this function is finished,
1219 * the texture object should be ready for rendering.
1220 * \return GL_TRUE for success, GL_FALSE for failure (out of mem)
1223 st_finalize_texture(struct gl_context
*ctx
,
1224 struct pipe_context
*pipe
,
1225 struct gl_texture_object
*tObj
)
1227 struct st_context
*st
= st_context(ctx
);
1228 struct st_texture_object
*stObj
= st_texture_object(tObj
);
1229 const GLuint nr_faces
= (stObj
->base
.Target
== GL_TEXTURE_CUBE_MAP
) ? 6 : 1;
1231 struct st_texture_image
*firstImage
;
1232 enum pipe_format firstImageFormat
;
1233 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
;
1235 if (stObj
->base
._Complete
) {
1236 /* The texture is complete and we know exactly how many mipmap levels
1237 * are present/needed. This is conditional because we may be called
1238 * from the st_generate_mipmap() function when the texture object is
1239 * incomplete. In that case, we'll have set stObj->lastLevel before
1242 if (stObj
->base
.Sampler
.MinFilter
== GL_LINEAR
||
1243 stObj
->base
.Sampler
.MinFilter
== GL_NEAREST
)
1244 stObj
->lastLevel
= stObj
->base
.BaseLevel
;
1246 stObj
->lastLevel
= stObj
->base
._MaxLevel
;
1249 firstImage
= st_texture_image(stObj
->base
.Image
[0][stObj
->base
.BaseLevel
]);
1252 /* If both firstImage and stObj point to a texture which can contain
1253 * all active images, favour firstImage. Note that because of the
1254 * completeness requirement, we know that the image dimensions
1257 if (firstImage
->pt
&&
1258 firstImage
->pt
!= stObj
->pt
&&
1259 (!stObj
->pt
|| firstImage
->pt
->last_level
>= stObj
->pt
->last_level
)) {
1260 pipe_resource_reference(&stObj
->pt
, firstImage
->pt
);
1261 pipe_sampler_view_reference(&stObj
->sampler_view
, NULL
);
1264 /* Find gallium format for the Mesa texture */
1265 firstImageFormat
= st_mesa_format_to_pipe_format(firstImage
->base
.TexFormat
);
1267 /* Find size of level=0 Gallium mipmap image, plus number of texture layers */
1269 GLuint width
, height
, depth
;
1270 if (!guess_base_level_size(stObj
->base
.Target
,
1271 firstImage
->base
.Width2
,
1272 firstImage
->base
.Height2
,
1273 firstImage
->base
.Depth2
,
1274 firstImage
->base
.Level
,
1275 &width
, &height
, &depth
)) {
1276 width
= stObj
->width0
;
1277 height
= stObj
->height0
;
1278 depth
= stObj
->depth0
;
1280 /* convert GL dims to Gallium dims */
1281 st_gl_texture_dims_to_pipe_dims(stObj
->base
.Target
, width
, height
, depth
,
1282 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
1285 /* If we already have a gallium texture, check that it matches the texture
1286 * object's format, target, size, num_levels, etc.
1289 if (stObj
->pt
->target
!= gl_target_to_pipe(stObj
->base
.Target
) ||
1290 !st_sampler_compat_formats(stObj
->pt
->format
, firstImageFormat
) ||
1291 stObj
->pt
->last_level
< stObj
->lastLevel
||
1292 stObj
->pt
->width0
!= ptWidth
||
1293 stObj
->pt
->height0
!= ptHeight
||
1294 stObj
->pt
->depth0
!= ptDepth
||
1295 stObj
->pt
->array_size
!= ptLayers
)
1297 /* The gallium texture does not match the Mesa texture so delete the
1298 * gallium texture now. We'll make a new one below.
1300 pipe_resource_reference(&stObj
->pt
, NULL
);
1301 pipe_sampler_view_reference(&stObj
->sampler_view
, NULL
);
1302 st
->dirty
.st
|= ST_NEW_FRAMEBUFFER
;
1306 /* May need to create a new gallium texture:
1309 GLuint bindings
= default_bindings(st
, firstImageFormat
);
1311 stObj
->pt
= st_texture_create(st
,
1312 gl_target_to_pipe(stObj
->base
.Target
),
1322 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
1327 /* Pull in any images not in the object's texture:
1329 for (face
= 0; face
< nr_faces
; face
++) {
1331 for (level
= stObj
->base
.BaseLevel
; level
<= stObj
->lastLevel
; level
++) {
1332 struct st_texture_image
*stImage
=
1333 st_texture_image(stObj
->base
.Image
[face
][level
]);
1335 /* Need to import images in main memory or held in other textures.
1337 if (stImage
&& stObj
->pt
!= stImage
->pt
) {
1339 (stImage
->base
.Width
== u_minify(stObj
->width0
, level
) &&
1340 stImage
->base
.Height
== u_minify(stObj
->height0
, level
) &&
1341 stImage
->base
.Depth
== u_minify(stObj
->depth0
, level
))) {
1342 /* src image fits expected dest mipmap level size */
1343 copy_image_data_to_texture(st
, stObj
, level
, stImage
);
1354 * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory
1355 * for a whole mipmap stack.
1358 st_AllocTextureStorage(struct gl_context
*ctx
,
1359 struct gl_texture_object
*texObj
,
1360 GLsizei levels
, GLsizei width
,
1361 GLsizei height
, GLsizei depth
)
1363 const GLuint numFaces
= (texObj
->Target
== GL_TEXTURE_CUBE_MAP
) ? 6 : 1;
1364 struct st_context
*st
= st_context(ctx
);
1365 struct st_texture_object
*stObj
= st_texture_object(texObj
);
1366 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
, bindings
;
1367 enum pipe_format fmt
;
1372 /* Save the level=0 dimensions */
1373 stObj
->width0
= width
;
1374 stObj
->height0
= height
;
1375 stObj
->depth0
= depth
;
1376 stObj
->lastLevel
= levels
- 1;
1378 fmt
= st_mesa_format_to_pipe_format(texObj
->Image
[0][0]->TexFormat
);
1380 bindings
= default_bindings(st
, fmt
);
1382 st_gl_texture_dims_to_pipe_dims(texObj
->Target
,
1383 width
, height
, depth
,
1384 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
1386 stObj
->pt
= st_texture_create(st
,
1387 gl_target_to_pipe(texObj
->Target
),
1398 /* Set image resource pointers */
1399 for (level
= 0; level
< levels
; level
++) {
1401 for (face
= 0; face
< numFaces
; face
++) {
1402 struct st_texture_image
*stImage
=
1403 st_texture_image(texObj
->Image
[face
][level
]);
1404 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
1414 st_init_texture_functions(struct dd_function_table
*functions
)
1416 functions
->ChooseTextureFormat
= st_ChooseTextureFormat
;
1417 functions
->TexImage1D
= st_TexImage1D
;
1418 functions
->TexImage2D
= st_TexImage2D
;
1419 functions
->TexImage3D
= st_TexImage3D
;
1420 functions
->TexSubImage1D
= _mesa_store_texsubimage1d
;
1421 functions
->TexSubImage2D
= _mesa_store_texsubimage2d
;
1422 functions
->TexSubImage3D
= _mesa_store_texsubimage3d
;
1423 functions
->CompressedTexSubImage1D
= _mesa_store_compressed_texsubimage1d
;
1424 functions
->CompressedTexSubImage2D
= _mesa_store_compressed_texsubimage2d
;
1425 functions
->CompressedTexSubImage3D
= _mesa_store_compressed_texsubimage3d
;
1426 functions
->CopyTexSubImage1D
= st_CopyTexSubImage1D
;
1427 functions
->CopyTexSubImage2D
= st_CopyTexSubImage2D
;
1428 functions
->CopyTexSubImage3D
= st_CopyTexSubImage3D
;
1429 functions
->GenerateMipmap
= st_generate_mipmap
;
1431 functions
->GetTexImage
= st_GetTexImage
;
1433 /* compressed texture functions */
1434 functions
->CompressedTexImage2D
= st_CompressedTexImage2D
;
1435 functions
->GetCompressedTexImage
= _mesa_get_compressed_teximage
;
1437 functions
->NewTextureObject
= st_NewTextureObject
;
1438 functions
->NewTextureImage
= st_NewTextureImage
;
1439 functions
->DeleteTextureImage
= st_DeleteTextureImage
;
1440 functions
->DeleteTexture
= st_DeleteTextureObject
;
1441 functions
->AllocTextureImageBuffer
= st_AllocTextureImageBuffer
;
1442 functions
->FreeTextureImageBuffer
= st_FreeTextureImageBuffer
;
1443 functions
->MapTextureImage
= st_MapTextureImage
;
1444 functions
->UnmapTextureImage
= st_UnmapTextureImage
;
1446 /* XXX Temporary until we can query pipe's texture sizes */
1447 functions
->TestProxyTexImage
= _mesa_test_proxy_teximage
;
1449 functions
->AllocTextureStorage
= st_AllocTextureStorage
;