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 case GL_PROXY_TEXTURE_1D
:
77 return PIPE_TEXTURE_1D
;
79 case GL_PROXY_TEXTURE_2D
:
80 case GL_TEXTURE_EXTERNAL_OES
:
81 return PIPE_TEXTURE_2D
;
82 case GL_TEXTURE_RECTANGLE_NV
:
83 case GL_PROXY_TEXTURE_RECTANGLE_NV
:
84 return PIPE_TEXTURE_RECT
;
86 case GL_PROXY_TEXTURE_3D
:
87 return PIPE_TEXTURE_3D
;
88 case GL_TEXTURE_CUBE_MAP_ARB
:
89 case GL_PROXY_TEXTURE_CUBE_MAP_ARB
:
90 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
91 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
92 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
93 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
94 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
95 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
96 return PIPE_TEXTURE_CUBE
;
97 case GL_TEXTURE_1D_ARRAY_EXT
:
98 case GL_PROXY_TEXTURE_1D_ARRAY_EXT
:
99 return PIPE_TEXTURE_1D_ARRAY
;
100 case GL_TEXTURE_2D_ARRAY_EXT
:
101 case GL_PROXY_TEXTURE_2D_ARRAY_EXT
:
102 return PIPE_TEXTURE_2D_ARRAY
;
103 case GL_TEXTURE_BUFFER
:
105 case GL_TEXTURE_CUBE_MAP_ARRAY
:
106 case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY
:
107 return PIPE_TEXTURE_CUBE_ARRAY
;
115 /** called via ctx->Driver.NewTextureImage() */
116 static struct gl_texture_image
*
117 st_NewTextureImage(struct gl_context
* ctx
)
119 DBG("%s\n", __FUNCTION__
);
121 return (struct gl_texture_image
*) ST_CALLOC_STRUCT(st_texture_image
);
125 /** called via ctx->Driver.DeleteTextureImage() */
127 st_DeleteTextureImage(struct gl_context
* ctx
, struct gl_texture_image
*img
)
129 /* nothing special (yet) for st_texture_image */
130 _mesa_delete_texture_image(ctx
, img
);
134 /** called via ctx->Driver.NewTextureObject() */
135 static struct gl_texture_object
*
136 st_NewTextureObject(struct gl_context
* ctx
, GLuint name
, GLenum target
)
138 struct st_texture_object
*obj
= ST_CALLOC_STRUCT(st_texture_object
);
140 DBG("%s\n", __FUNCTION__
);
141 _mesa_initialize_texture_object(&obj
->base
, name
, target
);
146 /** called via ctx->Driver.DeleteTextureObject() */
148 st_DeleteTextureObject(struct gl_context
*ctx
,
149 struct gl_texture_object
*texObj
)
151 struct st_context
*st
= st_context(ctx
);
152 struct st_texture_object
*stObj
= st_texture_object(texObj
);
154 pipe_resource_reference(&stObj
->pt
, NULL
);
155 if (stObj
->sampler_view
) {
156 pipe_sampler_view_release(st
->pipe
, &stObj
->sampler_view
);
158 _mesa_delete_texture_object(ctx
, texObj
);
162 /** called via ctx->Driver.FreeTextureImageBuffer() */
164 st_FreeTextureImageBuffer(struct gl_context
*ctx
,
165 struct gl_texture_image
*texImage
)
167 struct st_texture_image
*stImage
= st_texture_image(texImage
);
169 DBG("%s\n", __FUNCTION__
);
172 pipe_resource_reference(&stImage
->pt
, NULL
);
175 if (stImage
->TexData
) {
176 _mesa_align_free(stImage
->TexData
);
177 stImage
->TexData
= NULL
;
182 /** called via ctx->Driver.MapTextureImage() */
184 st_MapTextureImage(struct gl_context
*ctx
,
185 struct gl_texture_image
*texImage
,
186 GLuint slice
, GLuint x
, GLuint y
, GLuint w
, GLuint h
,
188 GLubyte
**mapOut
, GLint
*rowStrideOut
)
190 struct st_context
*st
= st_context(ctx
);
191 struct st_texture_image
*stImage
= st_texture_image(texImage
);
196 if (mode
& GL_MAP_READ_BIT
)
197 pipeMode
|= PIPE_TRANSFER_READ
;
198 if (mode
& GL_MAP_WRITE_BIT
)
199 pipeMode
|= PIPE_TRANSFER_WRITE
;
200 if (mode
& GL_MAP_INVALIDATE_RANGE_BIT
)
201 pipeMode
|= PIPE_TRANSFER_DISCARD_RANGE
;
203 map
= st_texture_image_map(st
, stImage
, slice
, pipeMode
, x
, y
, w
, h
);
206 *rowStrideOut
= stImage
->transfer
->stride
;
215 /** called via ctx->Driver.UnmapTextureImage() */
217 st_UnmapTextureImage(struct gl_context
*ctx
,
218 struct gl_texture_image
*texImage
,
221 struct st_context
*st
= st_context(ctx
);
222 struct st_texture_image
*stImage
= st_texture_image(texImage
);
223 st_texture_image_unmap(st
, stImage
);
228 * Return default texture resource binding bitmask for the given format.
231 default_bindings(struct st_context
*st
, enum pipe_format format
)
233 struct pipe_screen
*screen
= st
->pipe
->screen
;
234 const unsigned target
= PIPE_TEXTURE_2D
;
237 if (util_format_is_depth_or_stencil(format
))
238 bindings
= PIPE_BIND_SAMPLER_VIEW
| PIPE_BIND_DEPTH_STENCIL
;
240 bindings
= PIPE_BIND_SAMPLER_VIEW
| PIPE_BIND_RENDER_TARGET
;
242 if (screen
->is_format_supported(screen
, format
, target
, 0, bindings
))
246 format
= util_format_linear(format
);
248 if (screen
->is_format_supported(screen
, format
, target
, 0, bindings
))
251 return PIPE_BIND_SAMPLER_VIEW
;
256 /** Return number of image dimensions (1, 2 or 3) for a texture target. */
258 get_texture_dims(GLenum target
)
262 case GL_TEXTURE_1D_ARRAY_EXT
:
263 case GL_TEXTURE_BUFFER
:
266 case GL_TEXTURE_CUBE_MAP_ARB
:
267 case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
:
268 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
:
269 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
:
270 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
:
271 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
:
272 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
:
273 case GL_TEXTURE_RECTANGLE_NV
:
274 case GL_TEXTURE_2D_ARRAY_EXT
:
275 case GL_TEXTURE_EXTERNAL_OES
:
278 case GL_TEXTURE_CUBE_MAP_ARRAY
:
281 assert(0 && "invalid texture target in get_texture_dims()");
288 * Given the size of a mipmap image, try to compute the size of the level=0
291 * Note that this isn't always accurate for odd-sized, non-POW textures.
292 * For example, if level=1 and width=40 then the level=0 width may be 80 or 81.
294 * \return GL_TRUE for success, GL_FALSE for failure
297 guess_base_level_size(GLenum target
,
298 GLuint width
, GLuint height
, GLuint depth
, GLuint level
,
299 GLuint
*width0
, GLuint
*height0
, GLuint
*depth0
)
301 const GLuint dims
= get_texture_dims(target
);
308 /* Depending on the image's size, we can't always make a guess here */
309 if ((dims
>= 1 && width
== 1) ||
310 (dims
>= 2 && height
== 1) ||
311 (dims
>= 3 && depth
== 1)) {
312 /* we can't determine the image size at level=0 */
316 /* grow the image size until we hit level = 0 */
337 * Try to allocate a pipe_resource object for the given st_texture_object.
339 * We use the given st_texture_image as a clue to determine the size of the
340 * mipmap image at level=0.
342 * \return GL_TRUE for success, GL_FALSE if out of memory.
345 guess_and_alloc_texture(struct st_context
*st
,
346 struct st_texture_object
*stObj
,
347 const struct st_texture_image
*stImage
)
349 GLuint lastLevel
, width
, height
, depth
;
351 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
;
352 enum pipe_format fmt
;
354 DBG("%s\n", __FUNCTION__
);
358 if (!guess_base_level_size(stObj
->base
.Target
,
359 stImage
->base
.Width2
,
360 stImage
->base
.Height2
,
361 stImage
->base
.Depth2
,
363 &width
, &height
, &depth
)) {
364 /* we can't determine the image size at level=0 */
365 stObj
->width0
= stObj
->height0
= stObj
->depth0
= 0;
366 /* this is not an out of memory error */
370 /* At this point, (width x height x depth) is the expected size of
371 * the level=0 mipmap image.
374 /* Guess a reasonable value for lastLevel. With OpenGL we have no
375 * idea how many mipmap levels will be in a texture until we start
376 * to render with it. Make an educated guess here but be prepared
377 * to re-allocating a texture buffer with space for more (or fewer)
378 * mipmap levels later.
380 if ((stObj
->base
.Sampler
.MinFilter
== GL_NEAREST
||
381 stObj
->base
.Sampler
.MinFilter
== GL_LINEAR
||
382 (stObj
->base
.BaseLevel
== 0 &&
383 stObj
->base
.MaxLevel
== 0) ||
384 stImage
->base
._BaseFormat
== GL_DEPTH_COMPONENT
||
385 stImage
->base
._BaseFormat
== GL_DEPTH_STENCIL_EXT
) &&
386 !stObj
->base
.GenerateMipmap
&&
387 stImage
->base
.Level
== 0) {
388 /* only alloc space for a single mipmap level */
392 /* alloc space for a full mipmap */
393 GLuint l2width
= util_logbase2(width
);
394 GLuint l2height
= util_logbase2(height
);
395 GLuint l2depth
= util_logbase2(depth
);
396 lastLevel
= MAX2(MAX2(l2width
, l2height
), l2depth
);
399 /* Save the level=0 dimensions */
400 stObj
->width0
= width
;
401 stObj
->height0
= height
;
402 stObj
->depth0
= depth
;
404 fmt
= st_mesa_format_to_pipe_format(stImage
->base
.TexFormat
);
406 bindings
= default_bindings(st
, fmt
);
408 st_gl_texture_dims_to_pipe_dims(stObj
->base
.Target
,
409 width
, height
, depth
,
410 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
412 stObj
->pt
= st_texture_create(st
,
413 gl_target_to_pipe(stObj
->base
.Target
),
422 stObj
->lastLevel
= lastLevel
;
424 DBG("%s returning %d\n", __FUNCTION__
, (stObj
->pt
!= NULL
));
426 return stObj
->pt
!= NULL
;
431 * Called via ctx->Driver.AllocTextureImageBuffer().
432 * If the texture object/buffer already has space for the indicated image,
433 * we're done. Otherwise, allocate memory for the new texture image.
436 st_AllocTextureImageBuffer(struct gl_context
*ctx
,
437 struct gl_texture_image
*texImage
)
439 struct st_context
*st
= st_context(ctx
);
440 struct st_texture_image
*stImage
= st_texture_image(texImage
);
441 struct st_texture_object
*stObj
= st_texture_object(texImage
->TexObject
);
442 const GLuint level
= texImage
->Level
;
443 GLuint width
= texImage
->Width
;
444 GLuint height
= texImage
->Height
;
445 GLuint depth
= texImage
->Depth
;
447 DBG("%s\n", __FUNCTION__
);
449 assert(!stImage
->TexData
);
450 assert(!stImage
->pt
); /* xxx this might be wrong */
452 /* Look if the parent texture object has space for this image */
454 level
<= stObj
->pt
->last_level
&&
455 st_texture_match_image(stObj
->pt
, texImage
)) {
456 /* this image will fit in the existing texture object's memory */
457 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
461 /* The parent texture object does not have space for this image */
463 pipe_resource_reference(&stObj
->pt
, NULL
);
464 pipe_sampler_view_release(st
->pipe
, &stObj
->sampler_view
);
466 if (!guess_and_alloc_texture(st
, stObj
, stImage
)) {
467 /* Probably out of memory.
468 * Try flushing any pending rendering, then retry.
471 if (!guess_and_alloc_texture(st
, stObj
, stImage
)) {
472 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
478 st_texture_match_image(stObj
->pt
, texImage
)) {
479 /* The image will live in the object's mipmap memory */
480 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
485 /* Create a new, temporary texture/resource/buffer to hold this
486 * one texture image. Note that when we later access this image
487 * (either for mapping or copying) we'll want to always specify
488 * mipmap level=0, even if the image represents some other mipmap
491 enum pipe_format format
=
492 st_mesa_format_to_pipe_format(texImage
->TexFormat
);
493 GLuint bindings
= default_bindings(st
, format
);
494 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
;
496 st_gl_texture_dims_to_pipe_dims(stObj
->base
.Target
,
497 width
, height
, depth
,
498 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
500 stImage
->pt
= st_texture_create(st
,
501 gl_target_to_pipe(stObj
->base
.Target
),
509 return stImage
->pt
!= NULL
;
515 * Preparation prior to glTexImage. Basically check the 'surface_based'
516 * field and switch to a "normal" tex image if necessary.
519 prep_teximage(struct gl_context
*ctx
, struct gl_texture_image
*texImage
,
520 GLenum format
, GLenum type
)
522 struct gl_texture_object
*texObj
= texImage
->TexObject
;
523 struct st_texture_object
*stObj
= st_texture_object(texObj
);
525 /* switch to "normal" */
526 if (stObj
->surface_based
) {
527 const GLenum target
= texObj
->Target
;
528 const GLuint level
= texImage
->Level
;
531 _mesa_clear_texture_object(ctx
, texObj
);
532 pipe_resource_reference(&stObj
->pt
, NULL
);
534 /* oops, need to init this image again */
535 texFormat
= _mesa_choose_texture_format(ctx
, texObj
, target
, level
,
536 texImage
->InternalFormat
, format
,
539 _mesa_init_teximage_fields(ctx
, texImage
,
540 texImage
->Width
, texImage
->Height
,
541 texImage
->Depth
, texImage
->Border
,
542 texImage
->InternalFormat
, texFormat
);
544 stObj
->surface_based
= GL_FALSE
;
550 st_TexImage(struct gl_context
* ctx
, GLuint dims
,
551 struct gl_texture_image
*texImage
,
552 GLenum format
, GLenum type
, const void *pixels
,
553 const struct gl_pixelstore_attrib
*unpack
)
555 prep_teximage(ctx
, texImage
, format
, type
);
556 _mesa_store_teximage(ctx
, dims
, texImage
, format
, type
, pixels
, unpack
);
561 st_CompressedTexImage(struct gl_context
*ctx
, GLuint dims
,
562 struct gl_texture_image
*texImage
,
563 GLsizei imageSize
, const GLvoid
*data
)
565 prep_teximage(ctx
, texImage
, GL_NONE
, GL_NONE
);
566 _mesa_store_compressed_teximage(ctx
, dims
, texImage
, imageSize
, data
);
572 * glGetTexImage() helper: decompress a compressed texture by rendering
573 * a textured quad. Store the results in the user's buffer.
576 decompress_with_blit(struct gl_context
* ctx
,
577 GLenum format
, GLenum type
, GLvoid
*pixels
,
578 struct gl_texture_image
*texImage
)
580 struct st_context
*st
= st_context(ctx
);
581 struct pipe_context
*pipe
= st
->pipe
;
582 struct st_texture_image
*stImage
= st_texture_image(texImage
);
583 struct st_texture_object
*stObj
= st_texture_object(texImage
->TexObject
);
584 const GLuint width
= texImage
->Width
;
585 const GLuint height
= texImage
->Height
;
586 struct pipe_resource
*dst_texture
;
587 struct pipe_blit_info blit
;
588 unsigned bind
= (PIPE_BIND_RENDER_TARGET
| PIPE_BIND_TRANSFER_READ
);
589 struct pipe_transfer
*tex_xfer
;
592 /* create temp / dest surface */
593 if (!util_create_rgba_texture(pipe
, width
, height
, bind
,
595 _mesa_problem(ctx
, "util_create_rgba_texture() failed "
596 "in decompress_with_blit()");
600 blit
.src
.resource
= stObj
->pt
;
601 blit
.src
.level
= texImage
->Level
;
602 blit
.src
.format
= util_format_linear(stObj
->pt
->format
);
603 blit
.dst
.resource
= dst_texture
;
605 blit
.dst
.format
= dst_texture
->format
;
606 blit
.src
.box
.x
= blit
.dst
.box
.x
= 0;
607 blit
.src
.box
.y
= blit
.dst
.box
.y
= 0;
608 blit
.src
.box
.z
= 0; /* XXX compressed array textures? */
610 blit
.src
.box
.width
= blit
.dst
.box
.width
= width
;
611 blit
.src
.box
.height
= blit
.dst
.box
.height
= height
;
612 blit
.src
.box
.depth
= blit
.dst
.box
.depth
= 1;
613 blit
.mask
= PIPE_MASK_RGBA
;
614 blit
.filter
= PIPE_TEX_FILTER_NEAREST
;
615 blit
.scissor_enable
= FALSE
;
617 /* blit/render/decompress */
618 st
->pipe
->blit(st
->pipe
, &blit
);
620 pixels
= _mesa_map_pbo_dest(ctx
, &ctx
->Pack
, pixels
);
622 map
= pipe_transfer_map(pipe
, dst_texture
, 0, 0,
624 0, 0, width
, height
, &tex_xfer
);
629 /* copy/pack data into user buffer */
630 if (_mesa_format_matches_format_and_type(stImage
->base
.TexFormat
,
632 ctx
->Pack
.SwapBytes
)) {
634 const uint bytesPerRow
= width
* util_format_get_blocksize(stImage
->pt
->format
);
635 /* map the dst_surface so we can read from it */
637 for (row
= 0; row
< height
; row
++) {
638 GLvoid
*dest
= _mesa_image_address2d(&ctx
->Pack
, pixels
, width
,
639 height
, format
, type
, row
, 0);
640 memcpy(dest
, map
, bytesPerRow
);
641 map
+= tex_xfer
->stride
;
643 pipe_transfer_unmap(pipe
, tex_xfer
);
646 /* format translation via floats */
648 enum pipe_format pformat
= util_format_linear(dst_texture
->format
);
651 rgba
= malloc(width
* 4 * sizeof(GLfloat
));
653 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glGetTexImage()");
657 for (row
= 0; row
< height
; row
++) {
658 const GLbitfield transferOps
= 0x0; /* bypassed for glGetTexImage() */
659 GLvoid
*dest
= _mesa_image_address2d(&ctx
->Pack
, pixels
, width
,
660 height
, format
, type
, row
, 0);
662 if (ST_DEBUG
& DEBUG_FALLBACK
)
663 debug_printf("%s: fallback format translation\n", __FUNCTION__
);
665 /* get float[4] rgba row from surface */
666 pipe_get_tile_rgba_format(tex_xfer
, map
, 0, row
, width
, 1,
669 _mesa_pack_rgba_span_float(ctx
, width
, (GLfloat (*)[4]) rgba
, format
,
670 type
, dest
, &ctx
->Pack
, transferOps
);
678 pipe_transfer_unmap(pipe
, tex_xfer
);
680 _mesa_unmap_pbo_dest(ctx
, &ctx
->Pack
);
681 pipe_resource_reference(&dst_texture
, NULL
);
687 * Called via ctx->Driver.GetTexImage()
690 st_GetTexImage(struct gl_context
* ctx
,
691 GLenum format
, GLenum type
, GLvoid
* pixels
,
692 struct gl_texture_image
*texImage
)
694 struct st_texture_image
*stImage
= st_texture_image(texImage
);
696 if (stImage
->pt
&& util_format_is_s3tc(stImage
->pt
->format
)) {
697 /* Need to decompress the texture.
698 * We'll do this by rendering a textured quad (which is hopefully
699 * faster than using the fallback code in texcompress.c).
700 * Note that we only expect RGBA formats (no Z/depth formats).
702 decompress_with_blit(ctx
, format
, type
, pixels
, texImage
);
705 _mesa_get_teximage(ctx
, format
, type
, pixels
, texImage
);
711 * Do a CopyTexSubImage operation using a read transfer from the source,
712 * a write transfer to the destination and get_tile()/put_tile() to access
715 * Note: srcY=0=TOP of renderbuffer
718 fallback_copy_texsubimage(struct gl_context
*ctx
,
719 struct st_renderbuffer
*strb
,
720 struct st_texture_image
*stImage
,
722 GLint destX
, GLint destY
, GLint destZ
,
723 GLint srcX
, GLint srcY
,
724 GLsizei width
, GLsizei height
)
726 struct st_context
*st
= st_context(ctx
);
727 struct pipe_context
*pipe
= st
->pipe
;
728 struct pipe_transfer
*src_trans
;
730 enum pipe_transfer_usage transfer_usage
;
733 if (ST_DEBUG
& DEBUG_FALLBACK
)
734 debug_printf("%s: fallback processing\n", __FUNCTION__
);
736 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
737 srcY
= strb
->Base
.Height
- srcY
- height
;
740 map
= pipe_transfer_map(pipe
,
743 strb
->rtt_face
+ strb
->rtt_slice
,
746 width
, height
, &src_trans
);
748 if ((baseFormat
== GL_DEPTH_COMPONENT
||
749 baseFormat
== GL_DEPTH_STENCIL
) &&
750 util_format_is_depth_and_stencil(stImage
->pt
->format
))
751 transfer_usage
= PIPE_TRANSFER_READ_WRITE
;
753 transfer_usage
= PIPE_TRANSFER_WRITE
;
755 /* XXX this used to ignore destZ param */
756 texDest
= st_texture_image_map(st
, stImage
, destZ
, transfer_usage
,
757 destX
, destY
, width
, height
);
759 if (baseFormat
== GL_DEPTH_COMPONENT
||
760 baseFormat
== GL_DEPTH_STENCIL
) {
761 const GLboolean scaleOrBias
= (ctx
->Pixel
.DepthScale
!= 1.0F
||
762 ctx
->Pixel
.DepthBias
!= 0.0F
);
766 /* determine bottom-to-top vs. top-to-bottom order for src buffer */
767 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
776 data
= malloc(width
* sizeof(uint
));
779 /* To avoid a large temp memory allocation, do copy row by row */
780 for (row
= 0; row
< height
; row
++, srcY
+= yStep
) {
781 pipe_get_tile_z(src_trans
, map
, 0, srcY
, width
, 1, data
);
783 _mesa_scale_and_bias_depth_uint(ctx
, width
, data
);
785 pipe_put_tile_z(stImage
->transfer
, texDest
, 0, row
, width
, 1,
790 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glCopyTexSubImage()");
798 malloc(width
* height
* 4 * sizeof(GLfloat
));
800 if (tempSrc
&& texDest
) {
801 const GLint dims
= 2;
802 const GLint dstRowStride
= stImage
->transfer
->stride
;
803 struct gl_texture_image
*texImage
= &stImage
->base
;
804 struct gl_pixelstore_attrib unpack
= ctx
->DefaultPacking
;
806 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
807 unpack
.Invert
= GL_TRUE
;
810 /* get float/RGBA image from framebuffer */
811 /* XXX this usually involves a lot of int/float conversion.
812 * try to avoid that someday.
814 pipe_get_tile_rgba_format(src_trans
, map
, 0, 0, width
, height
,
815 util_format_linear(strb
->texture
->format
),
818 /* Store into texture memory.
819 * Note that this does some special things such as pixel transfer
820 * ops and format conversion. In particular, if the dest tex format
821 * is actually RGBA but the user created the texture as GL_RGB we
822 * need to fill-in/override the alpha channel with 1.0.
824 _mesa_texstore(ctx
, dims
,
825 texImage
->_BaseFormat
,
828 (GLubyte
**) &texDest
,
830 GL_RGBA
, GL_FLOAT
, tempSrc
, /* src */
834 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexSubImage");
840 st_texture_image_unmap(st
, stImage
);
841 pipe
->transfer_unmap(pipe
, src_trans
);
847 * If the format of the src renderbuffer and the format of the dest
848 * texture are compatible (in terms of blitting), return a TGSI writemask
849 * to be used during the blit.
850 * If the src/dest are incompatible, return 0.
853 compatible_src_dst_formats(struct gl_context
*ctx
,
854 const struct gl_renderbuffer
*src
,
855 const struct gl_texture_image
*dst
)
857 /* Get logical base formats for the src and dest.
858 * That is, use the user-requested formats and not the actual, device-
860 * For example, the user may have requested an A8 texture but the
861 * driver may actually be using an RGBA texture format. When we
862 * copy/blit to that texture, we only want to copy the Alpha channel
863 * and not the RGB channels.
865 * Similarly, when the src FBO was created an RGB format may have been
866 * requested but the driver actually chose an RGBA format. In that case,
867 * we don't want to copy the undefined Alpha channel to the dest texture
868 * (it should be 1.0).
870 const GLenum srcFormat
= _mesa_base_fbo_format(ctx
, src
->InternalFormat
);
871 const GLenum dstFormat
= _mesa_base_tex_format(ctx
, dst
->InternalFormat
);
874 * XXX when we have red-only and red/green renderbuffers we'll need
875 * to add more cases here (or implement a general-purpose routine that
876 * queries the existance of the R,G,B,A channels in the src and dest).
878 if (srcFormat
== dstFormat
) {
879 /* This is the same as matching_base_formats, which should
880 * always pass, as it did previously.
882 return TGSI_WRITEMASK_XYZW
;
884 else if (srcFormat
== GL_RGB
&& dstFormat
== GL_RGBA
) {
885 /* Make sure that A in the dest is 1. The actual src format
886 * may be RGBA and have undefined A values.
888 return TGSI_WRITEMASK_XYZ
;
890 else if (srcFormat
== GL_RGBA
&& dstFormat
== GL_RGB
) {
891 /* Make sure that A in the dest is 1. The actual dst format
892 * may be RGBA and will need A=1 to provide proper alpha values
893 * when sampled later.
895 return TGSI_WRITEMASK_XYZ
;
898 if (ST_DEBUG
& DEBUG_FALLBACK
)
899 debug_printf("%s failed for src %s, dst %s\n",
901 _mesa_lookup_enum_by_nr(srcFormat
),
902 _mesa_lookup_enum_by_nr(dstFormat
));
913 * Do a CopyTex[Sub]Image1/2/3D() using a hardware (blit) path if possible.
914 * Note that the region to copy has already been clipped so we know we
915 * won't read from outside the source renderbuffer's bounds.
917 * Note: srcY=0=Bottom of renderbuffer (GL convention)
920 st_CopyTexSubImage(struct gl_context
*ctx
, GLuint dims
,
921 struct gl_texture_image
*texImage
,
922 GLint destX
, GLint destY
, GLint destZ
,
923 struct gl_renderbuffer
*rb
,
924 GLint srcX
, GLint srcY
, GLsizei width
, GLsizei height
)
926 struct st_texture_image
*stImage
= st_texture_image(texImage
);
927 const GLenum texBaseFormat
= texImage
->_BaseFormat
;
928 struct st_renderbuffer
*strb
= st_renderbuffer(rb
);
929 struct st_context
*st
= st_context(ctx
);
930 struct pipe_context
*pipe
= st
->pipe
;
931 struct pipe_screen
*screen
= pipe
->screen
;
932 enum pipe_format dest_format
, src_format
;
933 GLboolean matching_base_formats
;
934 GLuint color_writemask
, zs_writemask
, sample_count
;
935 struct pipe_surface
*dest_surface
= NULL
;
936 GLboolean do_flip
= (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
);
937 struct pipe_surface surf_tmpl
;
938 unsigned int dst_usage
;
941 /* make sure finalize_textures has been called?
943 if (0) st_validate_state(st
);
945 if (!strb
|| !strb
->surface
|| !stImage
->pt
) {
946 debug_printf("%s: null strb or stImage\n", __FUNCTION__
);
950 sample_count
= strb
->surface
->texture
->nr_samples
;
951 /* I believe this would be legal, presumably would need to do a resolve
952 for color, and for depth/stencil spec says to just use one of the
953 depth/stencil samples per pixel? Need some transfer clarifications. */
954 assert(sample_count
< 2);
957 assert(strb
->surface
);
960 src_format
= strb
->surface
->format
;
961 dest_format
= stImage
->pt
->format
;
964 * Determine if the src framebuffer and dest texture have the same
965 * base format. We need this to detect a case such as the framebuffer
966 * being GL_RGBA but the texture being GL_RGB. If the actual hardware
967 * texture format stores RGBA we need to set A=1 (overriding the
968 * framebuffer's alpha values). We can't do that with the blit or
969 * textured-quad paths.
971 matching_base_formats
=
972 (_mesa_get_format_base_format(strb
->Base
.Format
) ==
973 _mesa_get_format_base_format(texImage
->TexFormat
));
975 if (ctx
->_ImageTransferState
) {
979 if (texImage
->TexObject
->Target
== GL_TEXTURE_1D_ARRAY
) {
980 /* 1D arrays might be thought of as 2D images but the actual layout
981 * might not be that way. At some points, we convert OpenGL's 1D
982 * array 'height' into gallium 'layers' and that prevents the blit
983 * utility code from doing the right thing. Simpy use the memcpy-based
989 if (matching_base_formats
&&
990 src_format
== dest_format
&&
992 /* use surface_copy() / blit */
993 struct pipe_box src_box
;
996 u_box_2d_zslice(srcX
, srcY
, strb
->surface
->u
.tex
.first_layer
,
997 width
, height
, &src_box
);
999 /* If stImage->pt is an independent image (not a pointer into a full
1000 * mipmap) stImage->pt.last_level will be zero and we need to use that
1001 * as the dest level.
1003 dstLevel
= MIN2(stImage
->base
.Level
, stImage
->pt
->last_level
);
1005 /* for resource_copy_region(), y=0=top, always */
1006 pipe
->resource_copy_region(pipe
,
1010 destX
, destY
, destZ
+ stImage
->base
.Face
,
1013 strb
->surface
->u
.tex
.level
,
1018 if (texBaseFormat
== GL_DEPTH_STENCIL
) {
1022 if (texBaseFormat
== GL_DEPTH_COMPONENT
) {
1023 color_writemask
= 0;
1024 zs_writemask
= BLIT_WRITEMASK_Z
;
1025 dst_usage
= PIPE_BIND_DEPTH_STENCIL
;
1028 color_writemask
= compatible_src_dst_formats(ctx
, &strb
->Base
, texImage
);
1030 dst_usage
= PIPE_BIND_RENDER_TARGET
;
1033 if ((!color_writemask
&& !zs_writemask
) ||
1034 !screen
->is_format_supported(screen
, src_format
,
1035 PIPE_TEXTURE_2D
, sample_count
,
1036 PIPE_BIND_SAMPLER_VIEW
) ||
1037 !screen
->is_format_supported(screen
, dest_format
,
1044 srcY1
= strb
->Base
.Height
- srcY
- height
;
1045 srcY0
= srcY1
+ height
;
1049 srcY1
= srcY0
+ height
;
1052 /* Disable conditional rendering. */
1053 if (st
->render_condition
) {
1054 pipe
->render_condition(pipe
, NULL
, 0);
1057 memset(&surf_tmpl
, 0, sizeof(surf_tmpl
));
1058 surf_tmpl
.format
= util_format_linear(stImage
->pt
->format
);
1059 surf_tmpl
.usage
= dst_usage
;
1060 surf_tmpl
.u
.tex
.level
= stImage
->base
.Level
;
1061 surf_tmpl
.u
.tex
.first_layer
= stImage
->base
.Face
+ destZ
;
1062 surf_tmpl
.u
.tex
.last_layer
= stImage
->base
.Face
+ destZ
;
1064 dest_surface
= pipe
->create_surface(pipe
, stImage
->pt
,
1066 util_blit_pixels(st
->blit
,
1068 strb
->surface
->u
.tex
.level
,
1070 srcX
+ width
, srcY1
,
1071 strb
->surface
->u
.tex
.first_layer
,
1074 destX
+ width
, destY
+ height
,
1075 0.0, PIPE_TEX_MIPFILTER_NEAREST
,
1076 color_writemask
, zs_writemask
);
1077 pipe_surface_reference(&dest_surface
, NULL
);
1079 /* Restore conditional rendering state. */
1080 if (st
->render_condition
) {
1081 pipe
->render_condition(pipe
, st
->render_condition
,
1082 st
->condition_mode
);
1088 /* software fallback */
1089 fallback_copy_texsubimage(ctx
,
1090 strb
, stImage
, texBaseFormat
,
1091 destX
, destY
, destZ
,
1092 srcX
, srcY
, width
, height
);
1097 * Copy image data from stImage into the texture object 'stObj' at level
1101 copy_image_data_to_texture(struct st_context
*st
,
1102 struct st_texture_object
*stObj
,
1104 struct st_texture_image
*stImage
)
1108 const struct gl_texture_image
*dstImage
=
1109 stObj
->base
.Image
[stImage
->base
.Face
][dstLevel
];
1111 assert(dstImage
->Width
== stImage
->base
.Width
);
1112 assert(dstImage
->Height
== stImage
->base
.Height
);
1113 assert(dstImage
->Depth
== stImage
->base
.Depth
);
1117 /* Copy potentially with the blitter:
1120 if (stImage
->pt
->last_level
== 0)
1123 src_level
= stImage
->base
.Level
;
1125 assert(src_level
<= stImage
->pt
->last_level
);
1126 assert(u_minify(stImage
->pt
->width0
, src_level
) == stImage
->base
.Width
);
1127 assert(stImage
->pt
->target
== PIPE_TEXTURE_1D_ARRAY
||
1128 u_minify(stImage
->pt
->height0
, src_level
) == stImage
->base
.Height
);
1129 assert(stImage
->pt
->target
== PIPE_TEXTURE_2D_ARRAY
||
1130 stImage
->pt
->target
== PIPE_TEXTURE_CUBE_ARRAY
||
1131 u_minify(stImage
->pt
->depth0
, src_level
) == stImage
->base
.Depth
);
1133 st_texture_image_copy(st
->pipe
,
1134 stObj
->pt
, dstLevel
, /* dest texture, level */
1135 stImage
->pt
, src_level
, /* src texture, level */
1136 stImage
->base
.Face
);
1138 pipe_resource_reference(&stImage
->pt
, NULL
);
1140 else if (stImage
->TexData
) {
1141 /* Copy from malloc'd memory */
1142 /* XXX this should be re-examined/tested with a compressed format */
1143 GLuint blockSize
= util_format_get_blocksize(stObj
->pt
->format
);
1144 GLuint srcRowStride
= stImage
->base
.Width
* blockSize
;
1145 GLuint srcSliceStride
= stImage
->base
.Height
* srcRowStride
;
1146 st_texture_image_data(st
,
1153 _mesa_align_free(stImage
->TexData
);
1154 stImage
->TexData
= NULL
;
1157 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
1162 * Called during state validation. When this function is finished,
1163 * the texture object should be ready for rendering.
1164 * \return GL_TRUE for success, GL_FALSE for failure (out of mem)
1167 st_finalize_texture(struct gl_context
*ctx
,
1168 struct pipe_context
*pipe
,
1169 struct gl_texture_object
*tObj
)
1171 struct st_context
*st
= st_context(ctx
);
1172 struct st_texture_object
*stObj
= st_texture_object(tObj
);
1173 const GLuint nr_faces
= (stObj
->base
.Target
== GL_TEXTURE_CUBE_MAP
) ? 6 : 1;
1175 struct st_texture_image
*firstImage
;
1176 enum pipe_format firstImageFormat
;
1177 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
;
1179 if (_mesa_is_texture_complete(tObj
, &tObj
->Sampler
)) {
1180 /* The texture is complete and we know exactly how many mipmap levels
1181 * are present/needed. This is conditional because we may be called
1182 * from the st_generate_mipmap() function when the texture object is
1183 * incomplete. In that case, we'll have set stObj->lastLevel before
1186 if (stObj
->base
.Sampler
.MinFilter
== GL_LINEAR
||
1187 stObj
->base
.Sampler
.MinFilter
== GL_NEAREST
)
1188 stObj
->lastLevel
= stObj
->base
.BaseLevel
;
1190 stObj
->lastLevel
= stObj
->base
._MaxLevel
;
1193 firstImage
= st_texture_image(stObj
->base
.Image
[0][stObj
->base
.BaseLevel
]);
1196 /* If both firstImage and stObj point to a texture which can contain
1197 * all active images, favour firstImage. Note that because of the
1198 * completeness requirement, we know that the image dimensions
1201 if (firstImage
->pt
&&
1202 firstImage
->pt
!= stObj
->pt
&&
1203 (!stObj
->pt
|| firstImage
->pt
->last_level
>= stObj
->pt
->last_level
)) {
1204 pipe_resource_reference(&stObj
->pt
, firstImage
->pt
);
1205 pipe_sampler_view_release(st
->pipe
, &stObj
->sampler_view
);
1208 /* Find gallium format for the Mesa texture */
1209 firstImageFormat
= st_mesa_format_to_pipe_format(firstImage
->base
.TexFormat
);
1211 /* Find size of level=0 Gallium mipmap image, plus number of texture layers */
1213 GLuint width
, height
, depth
;
1214 if (!guess_base_level_size(stObj
->base
.Target
,
1215 firstImage
->base
.Width2
,
1216 firstImage
->base
.Height2
,
1217 firstImage
->base
.Depth2
,
1218 firstImage
->base
.Level
,
1219 &width
, &height
, &depth
)) {
1220 width
= stObj
->width0
;
1221 height
= stObj
->height0
;
1222 depth
= stObj
->depth0
;
1224 /* convert GL dims to Gallium dims */
1225 st_gl_texture_dims_to_pipe_dims(stObj
->base
.Target
, width
, height
, depth
,
1226 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
1229 /* If we already have a gallium texture, check that it matches the texture
1230 * object's format, target, size, num_levels, etc.
1233 if (stObj
->pt
->target
!= gl_target_to_pipe(stObj
->base
.Target
) ||
1234 !st_sampler_compat_formats(stObj
->pt
->format
, firstImageFormat
) ||
1235 stObj
->pt
->last_level
< stObj
->lastLevel
||
1236 stObj
->pt
->width0
!= ptWidth
||
1237 stObj
->pt
->height0
!= ptHeight
||
1238 stObj
->pt
->depth0
!= ptDepth
||
1239 stObj
->pt
->array_size
!= ptLayers
)
1241 /* The gallium texture does not match the Mesa texture so delete the
1242 * gallium texture now. We'll make a new one below.
1244 pipe_resource_reference(&stObj
->pt
, NULL
);
1245 pipe_sampler_view_release(st
->pipe
, &stObj
->sampler_view
);
1246 st
->dirty
.st
|= ST_NEW_FRAMEBUFFER
;
1250 /* May need to create a new gallium texture:
1253 GLuint bindings
= default_bindings(st
, firstImageFormat
);
1255 stObj
->pt
= st_texture_create(st
,
1256 gl_target_to_pipe(stObj
->base
.Target
),
1266 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
1271 /* Pull in any images not in the object's texture:
1273 for (face
= 0; face
< nr_faces
; face
++) {
1275 for (level
= stObj
->base
.BaseLevel
; level
<= stObj
->lastLevel
; level
++) {
1276 struct st_texture_image
*stImage
=
1277 st_texture_image(stObj
->base
.Image
[face
][level
]);
1279 /* Need to import images in main memory or held in other textures.
1281 if (stImage
&& stObj
->pt
!= stImage
->pt
) {
1283 (stImage
->base
.Width
== u_minify(stObj
->width0
, level
) &&
1284 stImage
->base
.Height
== u_minify(stObj
->height0
, level
) &&
1285 stImage
->base
.Depth
== u_minify(stObj
->depth0
, level
))) {
1286 /* src image fits expected dest mipmap level size */
1287 copy_image_data_to_texture(st
, stObj
, level
, stImage
);
1298 * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory
1299 * for a whole mipmap stack.
1302 st_AllocTextureStorage(struct gl_context
*ctx
,
1303 struct gl_texture_object
*texObj
,
1304 GLsizei levels
, GLsizei width
,
1305 GLsizei height
, GLsizei depth
)
1307 const GLuint numFaces
= _mesa_num_tex_faces(texObj
->Target
);
1308 struct st_context
*st
= st_context(ctx
);
1309 struct st_texture_object
*stObj
= st_texture_object(texObj
);
1310 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
, bindings
;
1311 enum pipe_format fmt
;
1316 /* Save the level=0 dimensions */
1317 stObj
->width0
= width
;
1318 stObj
->height0
= height
;
1319 stObj
->depth0
= depth
;
1320 stObj
->lastLevel
= levels
- 1;
1322 fmt
= st_mesa_format_to_pipe_format(texObj
->Image
[0][0]->TexFormat
);
1324 bindings
= default_bindings(st
, fmt
);
1326 st_gl_texture_dims_to_pipe_dims(texObj
->Target
,
1327 width
, height
, depth
,
1328 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
1330 stObj
->pt
= st_texture_create(st
,
1331 gl_target_to_pipe(texObj
->Target
),
1342 /* Set image resource pointers */
1343 for (level
= 0; level
< levels
; level
++) {
1345 for (face
= 0; face
< numFaces
; face
++) {
1346 struct st_texture_image
*stImage
=
1347 st_texture_image(texObj
->Image
[face
][level
]);
1348 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
1357 st_TestProxyTexImage(struct gl_context
*ctx
, GLenum target
,
1358 GLint level
, gl_format format
,
1359 GLint width
, GLint height
,
1360 GLint depth
, GLint border
)
1362 struct st_context
*st
= st_context(ctx
);
1363 struct pipe_context
*pipe
= st
->pipe
;
1365 if (width
== 0 || height
== 0 || depth
== 0) {
1366 /* zero-sized images are legal, and always fit! */
1370 if (pipe
->screen
->can_create_resource
) {
1371 /* Ask the gallium driver if the texture is too large */
1372 struct gl_texture_object
*texObj
=
1373 _mesa_get_current_tex_object(ctx
, target
);
1374 struct pipe_resource pt
;
1376 /* Setup the pipe_resource object
1378 memset(&pt
, 0, sizeof(pt
));
1380 pt
.target
= gl_target_to_pipe(target
);
1381 pt
.format
= st_mesa_format_to_pipe_format(format
);
1383 st_gl_texture_dims_to_pipe_dims(target
,
1384 width
, height
, depth
,
1385 &pt
.width0
, &pt
.height0
,
1386 &pt
.depth0
, &pt
.array_size
);
1388 if (level
== 0 && (texObj
->Sampler
.MinFilter
== GL_LINEAR
||
1389 texObj
->Sampler
.MinFilter
== GL_NEAREST
)) {
1390 /* assume just one mipmap level */
1394 /* assume a full set of mipmaps */
1395 pt
.last_level
= _mesa_logbase2(MAX3(width
, height
, depth
));
1398 return pipe
->screen
->can_create_resource(pipe
->screen
, &pt
);
1401 /* Use core Mesa fallback */
1402 return _mesa_test_proxy_teximage(ctx
, target
, level
, format
,
1403 width
, height
, depth
, border
);
1409 st_init_texture_functions(struct dd_function_table
*functions
)
1411 functions
->ChooseTextureFormat
= st_ChooseTextureFormat
;
1412 functions
->TexImage
= st_TexImage
;
1413 functions
->TexSubImage
= _mesa_store_texsubimage
;
1414 functions
->CompressedTexSubImage
= _mesa_store_compressed_texsubimage
;
1415 functions
->CopyTexSubImage
= st_CopyTexSubImage
;
1416 functions
->GenerateMipmap
= st_generate_mipmap
;
1418 functions
->GetTexImage
= st_GetTexImage
;
1420 /* compressed texture functions */
1421 functions
->CompressedTexImage
= st_CompressedTexImage
;
1422 functions
->GetCompressedTexImage
= _mesa_get_compressed_teximage
;
1424 functions
->NewTextureObject
= st_NewTextureObject
;
1425 functions
->NewTextureImage
= st_NewTextureImage
;
1426 functions
->DeleteTextureImage
= st_DeleteTextureImage
;
1427 functions
->DeleteTexture
= st_DeleteTextureObject
;
1428 functions
->AllocTextureImageBuffer
= st_AllocTextureImageBuffer
;
1429 functions
->FreeTextureImageBuffer
= st_FreeTextureImageBuffer
;
1430 functions
->MapTextureImage
= st_MapTextureImage
;
1431 functions
->UnmapTextureImage
= st_UnmapTextureImage
;
1433 /* XXX Temporary until we can query pipe's texture sizes */
1434 functions
->TestProxyTexImage
= st_TestProxyTexImage
;
1436 functions
->AllocTextureStorage
= st_AllocTextureStorage
;