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 st_get_texture_sampler_view(stObj
, pipe
);
614 const GLuint width
= texImage
->Width
;
615 const GLuint height
= texImage
->Height
;
616 struct pipe_surface
*dst_surface
;
617 struct pipe_resource
*dst_texture
;
618 struct pipe_transfer
*tex_xfer
;
619 unsigned bind
= (PIPE_BIND_RENDER_TARGET
| /* util_blit may choose to render */
620 PIPE_BIND_TRANSFER_READ
);
622 /* create temp / dest surface */
623 if (!util_create_rgba_surface(pipe
, width
, height
, bind
,
624 &dst_texture
, &dst_surface
)) {
625 _mesa_problem(ctx
, "util_create_rgba_surface() failed "
626 "in decompress_with_blit()");
630 /* Disable conditional rendering. */
631 if (st
->render_condition
) {
632 pipe
->render_condition(pipe
, NULL
, 0);
635 /* Choose the source mipmap level */
636 src_view
->u
.tex
.first_level
= src_view
->u
.tex
.last_level
= texImage
->Level
;
638 /* blit/render/decompress */
639 util_blit_pixels_tex(st
->blit
,
640 src_view
, /* pipe_resource (src) */
641 0, 0, /* src x0, y0 */
642 width
, height
, /* src x1, y1 */
643 dst_surface
, /* pipe_surface (dst) */
644 0, 0, /* dst x0, y0 */
645 width
, height
, /* dst x1, y1 */
647 PIPE_TEX_MIPFILTER_NEAREST
);
649 /* Restore conditional rendering state. */
650 if (st
->render_condition
) {
651 pipe
->render_condition(pipe
, st
->render_condition
,
655 /* map the dst_surface so we can read from it */
656 tex_xfer
= pipe_get_transfer(pipe
,
659 0, 0, width
, height
);
661 pixels
= _mesa_map_pbo_dest(ctx
, &ctx
->Pack
, pixels
);
663 /* copy/pack data into user buffer */
664 if (st_equal_formats(stImage
->pt
->format
, format
, type
)) {
666 const uint bytesPerRow
= width
* util_format_get_blocksize(stImage
->pt
->format
);
667 ubyte
*map
= pipe_transfer_map(pipe
, tex_xfer
);
669 for (row
= 0; row
< height
; row
++) {
670 GLvoid
*dest
= _mesa_image_address2d(&ctx
->Pack
, pixels
, width
,
671 height
, format
, type
, row
, 0);
672 memcpy(dest
, map
, bytesPerRow
);
673 map
+= tex_xfer
->stride
;
675 pipe_transfer_unmap(pipe
, tex_xfer
);
678 /* format translation via floats */
680 enum pipe_format pformat
= util_format_linear(dst_texture
->format
);
681 for (row
= 0; row
< height
; row
++) {
682 const GLbitfield transferOps
= 0x0; /* bypassed for glGetTexImage() */
683 GLfloat rgba
[4 * MAX_WIDTH
];
684 GLvoid
*dest
= _mesa_image_address2d(&ctx
->Pack
, pixels
, width
,
685 height
, format
, type
, row
, 0);
687 if (ST_DEBUG
& DEBUG_FALLBACK
)
688 debug_printf("%s: fallback format translation\n", __FUNCTION__
);
690 /* get float[4] rgba row from surface */
691 pipe_get_tile_rgba_format(pipe
, tex_xfer
, 0, row
, width
, 1,
694 _mesa_pack_rgba_span_float(ctx
, width
, (GLfloat (*)[4]) rgba
, format
,
695 type
, dest
, &ctx
->Pack
, transferOps
);
699 _mesa_unmap_pbo_dest(ctx
, &ctx
->Pack
);
701 pipe
->transfer_destroy(pipe
, tex_xfer
);
703 /* destroy the temp / dest surface */
704 util_destroy_rgba_surface(dst_texture
, dst_surface
);
710 * Called via ctx->Driver.GetTexImage()
713 st_GetTexImage(struct gl_context
* ctx
,
714 GLenum format
, GLenum type
, GLvoid
* pixels
,
715 struct gl_texture_image
*texImage
)
717 struct st_texture_image
*stImage
= st_texture_image(texImage
);
719 if (stImage
->pt
&& util_format_is_s3tc(stImage
->pt
->format
)) {
720 /* Need to decompress the texture.
721 * We'll do this by rendering a textured quad (which is hopefully
722 * faster than using the fallback code in texcompress.c).
723 * Note that we only expect RGBA formats (no Z/depth formats).
725 decompress_with_blit(ctx
, format
, type
, pixels
, texImage
);
728 _mesa_get_teximage(ctx
, format
, type
, pixels
, texImage
);
734 * Do a CopyTexSubImage operation using a read transfer from the source,
735 * a write transfer to the destination and get_tile()/put_tile() to access
738 * Note: srcY=0=TOP of renderbuffer
741 fallback_copy_texsubimage(struct gl_context
*ctx
,
742 struct st_renderbuffer
*strb
,
743 struct st_texture_image
*stImage
,
745 GLint destX
, GLint destY
, GLint destZ
,
746 GLint srcX
, GLint srcY
,
747 GLsizei width
, GLsizei height
)
749 struct st_context
*st
= st_context(ctx
);
750 struct pipe_context
*pipe
= st
->pipe
;
751 struct pipe_transfer
*src_trans
;
753 enum pipe_transfer_usage transfer_usage
;
755 if (ST_DEBUG
& DEBUG_FALLBACK
)
756 debug_printf("%s: fallback processing\n", __FUNCTION__
);
758 assert(width
<= MAX_WIDTH
);
760 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
761 srcY
= strb
->Base
.Height
- srcY
- height
;
764 src_trans
= pipe_get_transfer(pipe
,
767 strb
->rtt_face
+ strb
->rtt_slice
,
772 if ((baseFormat
== GL_DEPTH_COMPONENT
||
773 baseFormat
== GL_DEPTH_STENCIL
) &&
774 util_format_is_depth_and_stencil(stImage
->pt
->format
))
775 transfer_usage
= PIPE_TRANSFER_READ_WRITE
;
777 transfer_usage
= PIPE_TRANSFER_WRITE
;
779 /* XXX this used to ignore destZ param */
780 texDest
= st_texture_image_map(st
, stImage
, destZ
, transfer_usage
,
781 destX
, destY
, width
, height
);
783 if (baseFormat
== GL_DEPTH_COMPONENT
||
784 baseFormat
== GL_DEPTH_STENCIL
) {
785 const GLboolean scaleOrBias
= (ctx
->Pixel
.DepthScale
!= 1.0F
||
786 ctx
->Pixel
.DepthBias
!= 0.0F
);
789 /* determine bottom-to-top vs. top-to-bottom order for src buffer */
790 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
799 /* To avoid a large temp memory allocation, do copy row by row */
800 for (row
= 0; row
< height
; row
++, srcY
+= yStep
) {
801 uint data
[MAX_WIDTH
];
802 pipe_get_tile_z(pipe
, src_trans
, 0, srcY
, width
, 1, data
);
804 _mesa_scale_and_bias_depth_uint(ctx
, width
, data
);
806 pipe_put_tile_z(pipe
, stImage
->transfer
, 0, row
, width
, 1, data
);
812 (GLfloat
*) malloc(width
* height
* 4 * sizeof(GLfloat
));
814 if (tempSrc
&& texDest
) {
815 const GLint dims
= 2;
816 const GLint dstRowStride
= stImage
->transfer
->stride
;
817 struct gl_texture_image
*texImage
= &stImage
->base
;
818 struct gl_pixelstore_attrib unpack
= ctx
->DefaultPacking
;
820 if (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
) {
821 unpack
.Invert
= GL_TRUE
;
824 /* get float/RGBA image from framebuffer */
825 /* XXX this usually involves a lot of int/float conversion.
826 * try to avoid that someday.
828 pipe_get_tile_rgba_format(pipe
, src_trans
, 0, 0, width
, height
,
829 util_format_linear(strb
->texture
->format
),
832 /* Store into texture memory.
833 * Note that this does some special things such as pixel transfer
834 * ops and format conversion. In particular, if the dest tex format
835 * is actually RGBA but the user created the texture as GL_RGB we
836 * need to fill-in/override the alpha channel with 1.0.
838 _mesa_texstore(ctx
, dims
,
839 texImage
->_BaseFormat
,
842 (GLubyte
**) &texDest
,
844 GL_RGBA
, GL_FLOAT
, tempSrc
, /* src */
848 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexSubImage");
855 st_texture_image_unmap(st
, stImage
);
856 pipe
->transfer_destroy(pipe
, src_trans
);
862 * If the format of the src renderbuffer and the format of the dest
863 * texture are compatible (in terms of blitting), return a TGSI writemask
864 * to be used during the blit.
865 * If the src/dest are incompatible, return 0.
868 compatible_src_dst_formats(struct gl_context
*ctx
,
869 const struct gl_renderbuffer
*src
,
870 const struct gl_texture_image
*dst
)
872 /* Get logical base formats for the src and dest.
873 * That is, use the user-requested formats and not the actual, device-
875 * For example, the user may have requested an A8 texture but the
876 * driver may actually be using an RGBA texture format. When we
877 * copy/blit to that texture, we only want to copy the Alpha channel
878 * and not the RGB channels.
880 * Similarly, when the src FBO was created an RGB format may have been
881 * requested but the driver actually chose an RGBA format. In that case,
882 * we don't want to copy the undefined Alpha channel to the dest texture
883 * (it should be 1.0).
885 const GLenum srcFormat
= _mesa_base_fbo_format(ctx
, src
->InternalFormat
);
886 const GLenum dstFormat
= _mesa_base_tex_format(ctx
, dst
->InternalFormat
);
889 * XXX when we have red-only and red/green renderbuffers we'll need
890 * to add more cases here (or implement a general-purpose routine that
891 * queries the existance of the R,G,B,A channels in the src and dest).
893 if (srcFormat
== dstFormat
) {
894 /* This is the same as matching_base_formats, which should
895 * always pass, as it did previously.
897 return TGSI_WRITEMASK_XYZW
;
899 else if (srcFormat
== GL_RGB
&& dstFormat
== GL_RGBA
) {
900 /* Make sure that A in the dest is 1. The actual src format
901 * may be RGBA and have undefined A values.
903 return TGSI_WRITEMASK_XYZ
;
905 else if (srcFormat
== GL_RGBA
&& dstFormat
== GL_RGB
) {
906 /* Make sure that A in the dest is 1. The actual dst format
907 * may be RGBA and will need A=1 to provide proper alpha values
908 * when sampled later.
910 return TGSI_WRITEMASK_XYZ
;
913 if (ST_DEBUG
& DEBUG_FALLBACK
)
914 debug_printf("%s failed for src %s, dst %s\n",
916 _mesa_lookup_enum_by_nr(srcFormat
),
917 _mesa_lookup_enum_by_nr(dstFormat
));
928 * Do a CopyTex[Sub]Image1/2/3D() using a hardware (blit) path if possible.
929 * Note that the region to copy has already been clipped so we know we
930 * won't read from outside the source renderbuffer's bounds.
932 * Note: srcY=0=Bottom of renderbuffer (GL convention)
935 st_copy_texsubimage(struct gl_context
*ctx
,
936 struct gl_texture_image
*texImage
,
937 GLint destX
, GLint destY
, GLint destZ
,
938 struct gl_renderbuffer
*rb
,
939 GLint srcX
, GLint srcY
,
940 GLsizei width
, GLsizei height
)
942 struct st_texture_image
*stImage
= st_texture_image(texImage
);
943 const GLenum texBaseFormat
= texImage
->_BaseFormat
;
944 struct gl_framebuffer
*fb
= ctx
->ReadBuffer
;
945 struct st_renderbuffer
*strb
;
946 struct st_context
*st
= st_context(ctx
);
947 struct pipe_context
*pipe
= st
->pipe
;
948 struct pipe_screen
*screen
= pipe
->screen
;
949 enum pipe_format dest_format
, src_format
;
950 GLboolean matching_base_formats
;
951 GLuint format_writemask
, sample_count
;
952 struct pipe_surface
*dest_surface
= NULL
;
953 GLboolean do_flip
= (st_fb_orientation(ctx
->ReadBuffer
) == Y_0_TOP
);
954 struct pipe_surface surf_tmpl
;
955 unsigned int dst_usage
;
958 /* make sure finalize_textures has been called?
960 if (0) st_validate_state(st
);
962 /* determine if copying depth or color data */
963 if (texBaseFormat
== GL_DEPTH_COMPONENT
||
964 texBaseFormat
== GL_DEPTH_STENCIL
) {
965 strb
= st_renderbuffer(fb
->Attachment
[BUFFER_DEPTH
].Renderbuffer
);
968 /* texBaseFormat == GL_RGB, GL_RGBA, GL_ALPHA, etc */
969 strb
= st_renderbuffer(fb
->_ColorReadBuffer
);
972 if (!strb
|| !strb
->surface
|| !stImage
->pt
) {
973 debug_printf("%s: null strb or stImage\n", __FUNCTION__
);
977 sample_count
= strb
->surface
->texture
->nr_samples
;
978 /* I believe this would be legal, presumably would need to do a resolve
979 for color, and for depth/stencil spec says to just use one of the
980 depth/stencil samples per pixel? Need some transfer clarifications. */
981 assert(sample_count
< 2);
984 assert(strb
->surface
);
987 src_format
= strb
->surface
->format
;
988 dest_format
= stImage
->pt
->format
;
991 * Determine if the src framebuffer and dest texture have the same
992 * base format. We need this to detect a case such as the framebuffer
993 * being GL_RGBA but the texture being GL_RGB. If the actual hardware
994 * texture format stores RGBA we need to set A=1 (overriding the
995 * framebuffer's alpha values). We can't do that with the blit or
996 * textured-quad paths.
998 matching_base_formats
=
999 (_mesa_get_format_base_format(strb
->Base
.Format
) ==
1000 _mesa_get_format_base_format(texImage
->TexFormat
));
1002 if (ctx
->_ImageTransferState
) {
1006 if (matching_base_formats
&&
1007 src_format
== dest_format
&&
1009 /* use surface_copy() / blit */
1010 struct pipe_box src_box
;
1011 u_box_2d_zslice(srcX
, srcY
, strb
->surface
->u
.tex
.first_layer
,
1012 width
, height
, &src_box
);
1014 /* for resource_copy_region(), y=0=top, always */
1015 pipe
->resource_copy_region(pipe
,
1018 stImage
->base
.Level
,
1019 destX
, destY
, destZ
+ stImage
->base
.Face
,
1022 strb
->surface
->u
.tex
.level
,
1027 if (texBaseFormat
== GL_DEPTH_STENCIL
) {
1031 if (texBaseFormat
== GL_DEPTH_COMPONENT
) {
1032 format_writemask
= TGSI_WRITEMASK_XYZW
;
1033 dst_usage
= PIPE_BIND_DEPTH_STENCIL
;
1036 format_writemask
= compatible_src_dst_formats(ctx
, &strb
->Base
, texImage
);
1037 dst_usage
= PIPE_BIND_RENDER_TARGET
;
1040 if (!format_writemask
||
1041 !screen
->is_format_supported(screen
, src_format
,
1042 PIPE_TEXTURE_2D
, sample_count
,
1043 PIPE_BIND_SAMPLER_VIEW
) ||
1044 !screen
->is_format_supported(screen
, dest_format
,
1051 srcY1
= strb
->Base
.Height
- srcY
- height
;
1052 srcY0
= srcY1
+ height
;
1056 srcY1
= srcY0
+ height
;
1059 /* Disable conditional rendering. */
1060 if (st
->render_condition
) {
1061 pipe
->render_condition(pipe
, NULL
, 0);
1064 memset(&surf_tmpl
, 0, sizeof(surf_tmpl
));
1065 surf_tmpl
.format
= util_format_linear(stImage
->pt
->format
);
1066 surf_tmpl
.usage
= dst_usage
;
1067 surf_tmpl
.u
.tex
.level
= stImage
->base
.Level
;
1068 surf_tmpl
.u
.tex
.first_layer
= stImage
->base
.Face
+ destZ
;
1069 surf_tmpl
.u
.tex
.last_layer
= stImage
->base
.Face
+ destZ
;
1071 dest_surface
= pipe
->create_surface(pipe
, stImage
->pt
,
1073 util_blit_pixels_writemask(st
->blit
,
1075 strb
->surface
->u
.tex
.level
,
1077 srcX
+ width
, srcY1
,
1078 strb
->surface
->u
.tex
.first_layer
,
1081 destX
+ width
, destY
+ height
,
1082 0.0, PIPE_TEX_MIPFILTER_NEAREST
,
1084 pipe_surface_reference(&dest_surface
, NULL
);
1086 /* Restore conditional rendering state. */
1087 if (st
->render_condition
) {
1088 pipe
->render_condition(pipe
, st
->render_condition
,
1089 st
->condition_mode
);
1095 /* software fallback */
1096 fallback_copy_texsubimage(ctx
,
1097 strb
, stImage
, texBaseFormat
,
1098 destX
, destY
, destZ
,
1099 srcX
, srcY
, width
, height
);
1105 st_CopyTexSubImage1D(struct gl_context
*ctx
,
1106 struct gl_texture_image
*texImage
,
1108 struct gl_renderbuffer
*rb
,
1109 GLint x
, GLint y
, GLsizei width
)
1111 const GLint yoffset
= 0, zoffset
= 0;
1112 const GLsizei height
= 1;
1113 st_copy_texsubimage(ctx
, texImage
,
1114 xoffset
, yoffset
, zoffset
, /* destX,Y,Z */
1115 rb
, x
, y
, width
, height
); /* src X, Y, size */
1120 st_CopyTexSubImage2D(struct gl_context
*ctx
,
1121 struct gl_texture_image
*texImage
,
1122 GLint xoffset
, GLint yoffset
,
1123 struct gl_renderbuffer
*rb
,
1124 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
1126 const GLint zoffset
= 0;
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_CopyTexSubImage3D(struct gl_context
*ctx
,
1135 struct gl_texture_image
*texImage
,
1136 GLint xoffset
, GLint yoffset
, GLint zoffset
,
1137 struct gl_renderbuffer
*rb
,
1138 GLint x
, GLint y
, GLsizei width
, GLsizei height
)
1140 st_copy_texsubimage(ctx
, texImage
,
1141 xoffset
, yoffset
, zoffset
, /* destX,Y,Z */
1142 rb
, x
, y
, width
, height
); /* src X, Y, size */
1147 * Copy image data from stImage into the texture object 'stObj' at level
1151 copy_image_data_to_texture(struct st_context
*st
,
1152 struct st_texture_object
*stObj
,
1154 struct st_texture_image
*stImage
)
1158 const struct gl_texture_image
*dstImage
=
1159 stObj
->base
.Image
[stImage
->base
.Face
][dstLevel
];
1161 assert(dstImage
->Width
== stImage
->base
.Width
);
1162 assert(dstImage
->Height
== stImage
->base
.Height
);
1163 assert(dstImage
->Depth
== stImage
->base
.Depth
);
1167 /* Copy potentially with the blitter:
1170 if (stImage
->pt
!= stObj
->pt
)
1173 src_level
= stImage
->base
.Level
;
1175 st_texture_image_copy(st
->pipe
,
1176 stObj
->pt
, dstLevel
, /* dest texture, level */
1177 stImage
->pt
, src_level
, /* src texture, level */
1178 stImage
->base
.Face
);
1180 pipe_resource_reference(&stImage
->pt
, NULL
);
1182 else if (stImage
->TexData
) {
1183 /* Copy from malloc'd memory */
1184 /* XXX this should be re-examined/tested with a compressed format */
1185 GLuint blockSize
= util_format_get_blocksize(stObj
->pt
->format
);
1186 GLuint srcRowStride
= stImage
->base
.Width
* blockSize
;
1187 GLuint srcSliceStride
= stImage
->base
.Height
* srcRowStride
;
1188 st_texture_image_data(st
,
1195 _mesa_align_free(stImage
->TexData
);
1196 stImage
->TexData
= NULL
;
1199 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
1204 * Called during state validation. When this function is finished,
1205 * the texture object should be ready for rendering.
1206 * \return GL_TRUE for success, GL_FALSE for failure (out of mem)
1209 st_finalize_texture(struct gl_context
*ctx
,
1210 struct pipe_context
*pipe
,
1211 struct gl_texture_object
*tObj
)
1213 struct st_context
*st
= st_context(ctx
);
1214 struct st_texture_object
*stObj
= st_texture_object(tObj
);
1215 const GLuint nr_faces
= (stObj
->base
.Target
== GL_TEXTURE_CUBE_MAP
) ? 6 : 1;
1217 struct st_texture_image
*firstImage
;
1218 enum pipe_format firstImageFormat
;
1219 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
;
1221 if (stObj
->base
._Complete
) {
1222 /* The texture is complete and we know exactly how many mipmap levels
1223 * are present/needed. This is conditional because we may be called
1224 * from the st_generate_mipmap() function when the texture object is
1225 * incomplete. In that case, we'll have set stObj->lastLevel before
1228 if (stObj
->base
.Sampler
.MinFilter
== GL_LINEAR
||
1229 stObj
->base
.Sampler
.MinFilter
== GL_NEAREST
)
1230 stObj
->lastLevel
= stObj
->base
.BaseLevel
;
1232 stObj
->lastLevel
= stObj
->base
._MaxLevel
;
1235 firstImage
= st_texture_image(stObj
->base
.Image
[0][stObj
->base
.BaseLevel
]);
1238 /* If both firstImage and stObj point to a texture which can contain
1239 * all active images, favour firstImage. Note that because of the
1240 * completeness requirement, we know that the image dimensions
1243 if (firstImage
->pt
&&
1244 firstImage
->pt
!= stObj
->pt
&&
1245 (!stObj
->pt
|| firstImage
->pt
->last_level
>= stObj
->pt
->last_level
)) {
1246 pipe_resource_reference(&stObj
->pt
, firstImage
->pt
);
1247 pipe_sampler_view_reference(&stObj
->sampler_view
, NULL
);
1250 /* Find gallium format for the Mesa texture */
1251 firstImageFormat
= st_mesa_format_to_pipe_format(firstImage
->base
.TexFormat
);
1253 /* Find size of level=0 Gallium mipmap image, plus number of texture layers */
1255 GLuint width
, height
, depth
;
1256 if (!guess_base_level_size(stObj
->base
.Target
,
1257 firstImage
->base
.Width2
,
1258 firstImage
->base
.Height2
,
1259 firstImage
->base
.Depth2
,
1260 firstImage
->base
.Level
,
1261 &width
, &height
, &depth
)) {
1262 width
= stObj
->width0
;
1263 height
= stObj
->height0
;
1264 depth
= stObj
->depth0
;
1266 /* convert GL dims to Gallium dims */
1267 st_gl_texture_dims_to_pipe_dims(stObj
->base
.Target
, width
, height
, depth
,
1268 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
1271 /* If we already have a gallium texture, check that it matches the texture
1272 * object's format, target, size, num_levels, etc.
1275 if (stObj
->pt
->target
!= gl_target_to_pipe(stObj
->base
.Target
) ||
1276 !st_sampler_compat_formats(stObj
->pt
->format
, firstImageFormat
) ||
1277 stObj
->pt
->last_level
< stObj
->lastLevel
||
1278 stObj
->pt
->width0
!= ptWidth
||
1279 stObj
->pt
->height0
!= ptHeight
||
1280 stObj
->pt
->depth0
!= ptDepth
||
1281 stObj
->pt
->array_size
!= ptLayers
)
1283 /* The gallium texture does not match the Mesa texture so delete the
1284 * gallium texture now. We'll make a new one below.
1286 pipe_resource_reference(&stObj
->pt
, NULL
);
1287 pipe_sampler_view_reference(&stObj
->sampler_view
, NULL
);
1288 st
->dirty
.st
|= ST_NEW_FRAMEBUFFER
;
1292 /* May need to create a new gallium texture:
1295 GLuint bindings
= default_bindings(st
, firstImageFormat
);
1297 stObj
->pt
= st_texture_create(st
,
1298 gl_target_to_pipe(stObj
->base
.Target
),
1308 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
1313 /* Pull in any images not in the object's texture:
1315 for (face
= 0; face
< nr_faces
; face
++) {
1317 for (level
= stObj
->base
.BaseLevel
; level
<= stObj
->lastLevel
; level
++) {
1318 struct st_texture_image
*stImage
=
1319 st_texture_image(stObj
->base
.Image
[face
][level
]);
1321 /* Need to import images in main memory or held in other textures.
1323 if (stImage
&& stObj
->pt
!= stImage
->pt
) {
1325 (stImage
->base
.Width
== u_minify(stObj
->width0
, level
) &&
1326 stImage
->base
.Height
== u_minify(stObj
->height0
, level
) &&
1327 stImage
->base
.Depth
== u_minify(stObj
->depth0
, level
))) {
1328 /* src image fits expected dest mipmap level size */
1329 copy_image_data_to_texture(st
, stObj
, level
, stImage
);
1340 * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory
1341 * for a whole mipmap stack.
1344 st_AllocTextureStorage(struct gl_context
*ctx
,
1345 struct gl_texture_object
*texObj
,
1346 GLsizei levels
, GLsizei width
,
1347 GLsizei height
, GLsizei depth
)
1349 const GLuint numFaces
= (texObj
->Target
== GL_TEXTURE_CUBE_MAP
) ? 6 : 1;
1350 struct st_context
*st
= st_context(ctx
);
1351 struct st_texture_object
*stObj
= st_texture_object(texObj
);
1352 GLuint ptWidth
, ptHeight
, ptDepth
, ptLayers
, bindings
;
1353 enum pipe_format fmt
;
1358 /* Save the level=0 dimensions */
1359 stObj
->width0
= width
;
1360 stObj
->height0
= height
;
1361 stObj
->depth0
= depth
;
1362 stObj
->lastLevel
= levels
- 1;
1364 fmt
= st_mesa_format_to_pipe_format(texObj
->Image
[0][0]->TexFormat
);
1366 bindings
= default_bindings(st
, fmt
);
1368 st_gl_texture_dims_to_pipe_dims(texObj
->Target
,
1369 width
, height
, depth
,
1370 &ptWidth
, &ptHeight
, &ptDepth
, &ptLayers
);
1372 stObj
->pt
= st_texture_create(st
,
1373 gl_target_to_pipe(texObj
->Target
),
1384 /* Set image resource pointers */
1385 for (level
= 0; level
< levels
; level
++) {
1387 for (face
= 0; face
< numFaces
; face
++) {
1388 struct st_texture_image
*stImage
=
1389 st_texture_image(texObj
->Image
[face
][level
]);
1390 pipe_resource_reference(&stImage
->pt
, stObj
->pt
);
1400 st_init_texture_functions(struct dd_function_table
*functions
)
1402 functions
->ChooseTextureFormat
= st_ChooseTextureFormat
;
1403 functions
->TexImage1D
= st_TexImage1D
;
1404 functions
->TexImage2D
= st_TexImage2D
;
1405 functions
->TexImage3D
= st_TexImage3D
;
1406 functions
->TexSubImage1D
= _mesa_store_texsubimage1d
;
1407 functions
->TexSubImage2D
= _mesa_store_texsubimage2d
;
1408 functions
->TexSubImage3D
= _mesa_store_texsubimage3d
;
1409 functions
->CompressedTexSubImage1D
= _mesa_store_compressed_texsubimage1d
;
1410 functions
->CompressedTexSubImage2D
= _mesa_store_compressed_texsubimage2d
;
1411 functions
->CompressedTexSubImage3D
= _mesa_store_compressed_texsubimage3d
;
1412 functions
->CopyTexSubImage1D
= st_CopyTexSubImage1D
;
1413 functions
->CopyTexSubImage2D
= st_CopyTexSubImage2D
;
1414 functions
->CopyTexSubImage3D
= st_CopyTexSubImage3D
;
1415 functions
->GenerateMipmap
= st_generate_mipmap
;
1417 functions
->GetTexImage
= st_GetTexImage
;
1419 /* compressed texture functions */
1420 functions
->CompressedTexImage2D
= st_CompressedTexImage2D
;
1421 functions
->GetCompressedTexImage
= _mesa_get_compressed_teximage
;
1423 functions
->NewTextureObject
= st_NewTextureObject
;
1424 functions
->NewTextureImage
= st_NewTextureImage
;
1425 functions
->DeleteTextureImage
= st_DeleteTextureImage
;
1426 functions
->DeleteTexture
= st_DeleteTextureObject
;
1427 functions
->AllocTextureImageBuffer
= st_AllocTextureImageBuffer
;
1428 functions
->FreeTextureImageBuffer
= st_FreeTextureImageBuffer
;
1429 functions
->MapTextureImage
= st_MapTextureImage
;
1430 functions
->UnmapTextureImage
= st_UnmapTextureImage
;
1432 /* XXX Temporary until we can query pipe's texture sizes */
1433 functions
->TestProxyTexImage
= _mesa_test_proxy_teximage
;
1435 functions
->AllocTextureStorage
= st_AllocTextureStorage
;