2 #include "main/glheader.h"
3 #include "main/macros.h"
4 #include "main/mtypes.h"
5 #include "main/enums.h"
6 #include "main/bufferobj.h"
7 #include "main/convolve.h"
8 #include "main/context.h"
9 #include "main/formats.h"
10 #include "main/texcompress.h"
11 #include "main/texstore.h"
12 #include "main/texgetimage.h"
13 #include "main/texobj.h"
14 #include "main/texstore.h"
15 #include "main/teximage.h"
17 #include "intel_context.h"
18 #include "intel_mipmap_tree.h"
19 #include "intel_buffer_objects.h"
20 #include "intel_batchbuffer.h"
21 #include "intel_tex.h"
22 #include "intel_blit.h"
23 #include "intel_fbo.h"
25 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
27 /* Functions to store texture images. Where possible, mipmap_tree's
28 * will be created or further instantiated with image data, otherwise
29 * images will be stored in malloc'd memory. A validation step is
30 * required to pull those images into a mipmap tree, or otherwise
31 * decide a fallback is required.
50 /* Otherwise, store it in memory if (Border != 0) or (any dimension ==
53 * Otherwise, if max_level >= level >= min_level, create tree with
54 * space for textures from min_level down to max_level.
56 * Otherwise, create tree with space for textures from (level
57 * 0)..(1x1). Consider pruning this tree at a validation if the
61 guess_and_alloc_mipmap_tree(struct intel_context
*intel
,
62 struct intel_texture_object
*intelObj
,
63 struct intel_texture_image
*intelImage
,
64 GLboolean expect_accelerated_upload
)
68 GLuint width
= intelImage
->base
.Width
;
69 GLuint height
= intelImage
->base
.Height
;
70 GLuint depth
= intelImage
->base
.Depth
;
71 GLuint l2width
, l2height
, l2depth
;
72 GLuint i
, comp_byte
= 0;
75 DBG("%s\n", __FUNCTION__
);
77 if (intelImage
->base
.Border
||
78 ((intelImage
->base
._BaseFormat
== GL_DEPTH_COMPONENT
) &&
79 ((intelObj
->base
.WrapS
== GL_CLAMP_TO_BORDER
) ||
80 (intelObj
->base
.WrapT
== GL_CLAMP_TO_BORDER
))))
83 if (intelImage
->level
> intelObj
->base
.BaseLevel
&&
84 (intelImage
->base
.Width
== 1 ||
85 (intelObj
->base
.Target
!= GL_TEXTURE_1D
&&
86 intelImage
->base
.Height
== 1) ||
87 (intelObj
->base
.Target
== GL_TEXTURE_3D
&&
88 intelImage
->base
.Depth
== 1)))
91 /* If this image disrespects BaseLevel, allocate from level zero.
92 * Usually BaseLevel == 0, so it's unlikely to happen.
94 if (intelImage
->level
< intelObj
->base
.BaseLevel
)
97 firstLevel
= intelObj
->base
.BaseLevel
;
100 /* Figure out image dimensions at start level.
102 for (i
= intelImage
->level
; i
> firstLevel
; i
--) {
110 /* Guess a reasonable value for lastLevel. This is probably going
111 * to be wrong fairly often and might mean that we have to look at
112 * resizable buffers, or require that buffers implement lazy
113 * pagetable arrangements.
115 if ((intelObj
->base
.MinFilter
== GL_NEAREST
||
116 intelObj
->base
.MinFilter
== GL_LINEAR
) &&
117 intelImage
->level
== firstLevel
&&
118 (intel
->gen
< 4 || firstLevel
== 0)) {
119 lastLevel
= firstLevel
;
122 l2width
= logbase2(width
);
123 l2height
= logbase2(height
);
124 l2depth
= logbase2(depth
);
125 lastLevel
= firstLevel
+ MAX2(MAX2(l2width
, l2height
), l2depth
);
128 assert(!intelObj
->mt
);
129 if (_mesa_is_format_compressed(intelImage
->base
.TexFormat
))
130 comp_byte
= intel_compressed_num_bytes(intelImage
->base
.TexFormat
);
132 texelBytes
= _mesa_get_format_bytes(intelImage
->base
.TexFormat
);
134 intelObj
->mt
= intel_miptree_create(intel
,
135 intelObj
->base
.Target
,
136 intelImage
->base
._BaseFormat
,
137 intelImage
->base
.InternalFormat
,
145 expect_accelerated_upload
);
147 DBG("%s - success\n", __FUNCTION__
);
154 target_to_face(GLenum target
)
157 case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
:
158 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
:
159 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
:
160 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
:
161 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
:
162 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
:
163 return ((GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
);
169 /* There are actually quite a few combinations this will work for,
170 * more than what I've listed here.
173 check_pbo_format(GLint internalFormat
,
174 GLenum format
, GLenum type
,
175 gl_format mesa_format
)
177 switch (internalFormat
) {
180 return (format
== GL_BGRA
&&
181 (type
== GL_UNSIGNED_BYTE
||
182 type
== GL_UNSIGNED_INT_8_8_8_8_REV
) &&
183 mesa_format
== MESA_FORMAT_ARGB8888
);
186 return (format
== GL_RGB
&&
187 type
== GL_UNSIGNED_SHORT_5_6_5
&&
188 mesa_format
== MESA_FORMAT_RGB565
);
190 return (type
== GL_UNSIGNED_SHORT_8_8_MESA
|| type
== GL_UNSIGNED_BYTE
);
197 /* XXX: Do this for TexSubImage also:
200 try_pbo_upload(struct intel_context
*intel
,
201 struct intel_texture_image
*intelImage
,
202 const struct gl_pixelstore_attrib
*unpack
,
203 GLint internalFormat
,
204 GLint width
, GLint height
,
205 GLenum format
, GLenum type
, const void *pixels
)
207 struct intel_buffer_object
*pbo
= intel_buffer_object(unpack
->BufferObj
);
208 GLuint src_offset
, src_stride
;
209 GLuint dst_x
, dst_y
, dst_stride
;
210 dri_bo
*dst_buffer
= intel_region_buffer(intel
,
211 intelImage
->mt
->region
,
214 if (!_mesa_is_bufferobj(unpack
->BufferObj
) ||
215 intel
->ctx
._ImageTransferState
||
216 unpack
->SkipPixels
|| unpack
->SkipRows
) {
217 DBG("%s: failure 1\n", __FUNCTION__
);
221 /* note: potential 64-bit ptr to 32-bit int cast */
222 src_offset
= (GLuint
) (unsigned long) pixels
;
224 if (unpack
->RowLength
> 0)
225 src_stride
= unpack
->RowLength
;
229 intel_miptree_get_image_offset(intelImage
->mt
, intelImage
->level
,
233 dst_stride
= intelImage
->mt
->pitch
;
235 if (drm_intel_bo_references(intel
->batch
->buf
, dst_buffer
))
236 intelFlush(&intel
->ctx
);
238 dri_bo
*src_buffer
= intel_bufferobj_buffer(intel
, pbo
, INTEL_READ
);
240 if (!intelEmitCopyBlit(intel
,
242 src_stride
, src_buffer
, src_offset
, GL_FALSE
,
243 dst_stride
, dst_buffer
, 0, GL_FALSE
,
244 0, 0, dst_x
, dst_y
, width
, height
,
255 try_pbo_zcopy(struct intel_context
*intel
,
256 struct intel_texture_image
*intelImage
,
257 const struct gl_pixelstore_attrib
*unpack
,
258 GLint internalFormat
,
259 GLint width
, GLint height
,
260 GLenum format
, GLenum type
, const void *pixels
)
262 struct intel_buffer_object
*pbo
= intel_buffer_object(unpack
->BufferObj
);
263 GLuint src_offset
, src_stride
;
264 GLuint dst_x
, dst_y
, dst_stride
;
266 if (!_mesa_is_bufferobj(unpack
->BufferObj
) ||
267 intel
->ctx
._ImageTransferState
||
268 unpack
->SkipPixels
|| unpack
->SkipRows
) {
269 DBG("%s: failure 1\n", __FUNCTION__
);
273 /* note: potential 64-bit ptr to 32-bit int cast */
274 src_offset
= (GLuint
) (unsigned long) pixels
;
276 if (unpack
->RowLength
> 0)
277 src_stride
= unpack
->RowLength
;
281 intel_miptree_get_image_offset(intelImage
->mt
, intelImage
->level
,
285 dst_stride
= intelImage
->mt
->pitch
;
287 if (src_stride
!= dst_stride
|| dst_x
!= 0 || dst_y
!= 0 ||
289 DBG("%s: failure 2\n", __FUNCTION__
);
293 intel_region_attach_pbo(intel
, intelImage
->mt
->region
, pbo
);
300 intelTexImage(GLcontext
* ctx
,
302 GLenum target
, GLint level
,
303 GLint internalFormat
,
304 GLint width
, GLint height
, GLint depth
,
306 GLenum format
, GLenum type
, const void *pixels
,
307 const struct gl_pixelstore_attrib
*unpack
,
308 struct gl_texture_object
*texObj
,
309 struct gl_texture_image
*texImage
, GLsizei imageSize
,
310 GLboolean compressed
)
312 struct intel_context
*intel
= intel_context(ctx
);
313 struct intel_texture_object
*intelObj
= intel_texture_object(texObj
);
314 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
315 GLint postConvWidth
= width
;
316 GLint postConvHeight
= height
;
317 GLint texelBytes
, sizeInBytes
;
318 GLuint dstRowStride
= 0, srcRowStride
= texImage
->RowStride
;
320 DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__
,
321 _mesa_lookup_enum_by_nr(target
), level
, width
, height
, depth
, border
);
323 intelImage
->face
= target_to_face(target
);
324 intelImage
->level
= level
;
326 if (ctx
->_ImageTransferState
& IMAGE_CONVOLUTION_BIT
) {
327 _mesa_adjust_image_for_convolution(ctx
, dims
, &postConvWidth
,
331 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
335 texelBytes
= _mesa_get_format_bytes(texImage
->TexFormat
);
337 /* Minimum pitch of 32 bytes */
338 if (postConvWidth
* texelBytes
< 32) {
339 postConvWidth
= 32 / texelBytes
;
340 texImage
->RowStride
= postConvWidth
;
343 if (!intelImage
->mt
) {
344 assert(texImage
->RowStride
== postConvWidth
);
348 /* Release the reference to a potentially orphaned buffer.
349 * Release any old malloced memory.
351 if (intelImage
->mt
) {
352 intel_miptree_release(intel
, &intelImage
->mt
);
353 assert(!texImage
->Data
);
355 else if (texImage
->Data
) {
356 _mesa_free_texmemory(texImage
->Data
);
357 texImage
->Data
= NULL
;
360 /* If this is the only texture image in the tree, could call
361 * bmBufferData with NULL data to free the old block and avoid
362 * waiting on any outstanding fences.
365 intelObj
->mt
->first_level
== level
&&
366 intelObj
->mt
->last_level
== level
&&
367 intelObj
->mt
->target
!= GL_TEXTURE_CUBE_MAP_ARB
&&
368 !intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
371 intel_miptree_release(intel
, &intelObj
->mt
);
372 assert(!intelObj
->mt
);
376 guess_and_alloc_mipmap_tree(intel
, intelObj
, intelImage
, pixels
== NULL
);
378 DBG("guess_and_alloc_mipmap_tree: failed\n");
382 assert(!intelImage
->mt
);
385 intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
387 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
388 assert(intelImage
->mt
);
389 } else if (intelImage
->base
.Border
== 0) {
391 GLuint texelBytes
= _mesa_get_format_bytes(intelImage
->base
.TexFormat
);
392 GLenum baseFormat
= _mesa_get_format_base_format(intelImage
->base
.TexFormat
);
393 if (_mesa_is_format_compressed(intelImage
->base
.TexFormat
)) {
395 intel_compressed_num_bytes(intelImage
->base
.TexFormat
);
398 /* Didn't fit in the object miptree, but it's suitable for inclusion in
399 * a miptree, so create one just for our level and store it in the image.
400 * It'll get moved into the object miptree at validate time.
402 intelImage
->mt
= intel_miptree_create(intel
, target
,
406 width
, height
, depth
,
408 comp_byte
, pixels
== NULL
);
416 _mesa_is_bufferobj(unpack
->BufferObj
) &&
417 check_pbo_format(internalFormat
, format
,
418 type
, intelImage
->base
.TexFormat
)) {
420 DBG("trying pbo upload\n");
422 /* Attempt to texture directly from PBO data (zero copy upload).
424 * Currently disable as it can lead to worse as well as better
425 * performance (in particular when intel_region_cow() is
428 if (intelObj
->mt
== intelImage
->mt
&&
429 intelObj
->mt
->first_level
== level
&&
430 intelObj
->mt
->last_level
== level
) {
432 if (try_pbo_zcopy(intel
, intelImage
, unpack
,
434 width
, height
, format
, type
, pixels
)) {
436 DBG("pbo zcopy upload succeeded\n");
442 /* Otherwise, attempt to use the blitter for PBO image uploads.
444 if (try_pbo_upload(intel
, intelImage
, unpack
,
446 width
, height
, format
, type
, pixels
)) {
447 DBG("pbo upload succeeded\n");
451 DBG("pbo upload failed\n");
454 /* intelCopyTexImage calls this function with pixels == NULL, with
455 * the expectation that the mipmap tree will be set up but nothing
456 * more will be done. This is where those calls return:
459 pixels
= _mesa_validate_pbo_compressed_teximage(ctx
, imageSize
, pixels
,
461 "glCompressedTexImage");
463 pixels
= _mesa_validate_pbo_teximage(ctx
, dims
, width
, height
, 1,
465 pixels
, unpack
, "glTexImage");
468 if (intelImage
->mt
) {
469 if (pixels
!= NULL
) {
470 /* Flush any queued rendering with the texture before mapping. */
471 if (drm_intel_bo_references(intel
->batch
->buf
,
472 intelImage
->mt
->region
->buffer
)) {
475 texImage
->Data
= intel_miptree_image_map(intel
,
480 intelImage
->base
.ImageOffsets
);
483 texImage
->RowStride
= dstRowStride
/ intelImage
->mt
->cpp
;
486 /* Allocate regular memory and store the image there temporarily. */
487 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
488 sizeInBytes
= _mesa_format_image_size(texImage
->TexFormat
,
493 _mesa_format_row_stride(texImage
->TexFormat
, width
);
497 dstRowStride
= postConvWidth
* texelBytes
;
498 sizeInBytes
= depth
* dstRowStride
* postConvHeight
;
501 texImage
->Data
= _mesa_alloc_texmemory(sizeInBytes
);
504 DBG("Upload image %dx%dx%d row_len %d "
505 "pitch %d pixels %d compressed %d\n",
506 width
, height
, depth
, width
* texelBytes
, dstRowStride
,
507 pixels
? 1 : 0, compressed
);
509 /* Copy data. Would like to know when it's ok for us to eg. use
510 * the blitter to copy. Or, use the hardware to do the format
511 * conversion and copy:
515 if (intelImage
->mt
) {
516 struct intel_region
*dst
= intelImage
->mt
->region
;
517 _mesa_copy_rect(texImage
->Data
, dst
->cpp
, dst
->pitch
,
519 intelImage
->mt
->level
[level
].width
,
520 (intelImage
->mt
->level
[level
].height
+3)/4,
526 memcpy(texImage
->Data
, pixels
, imageSize
);
529 else if (!_mesa_texstore(ctx
, dims
,
530 texImage
->_BaseFormat
,
532 texImage
->Data
, 0, 0, 0, /* dstX/Y/Zoffset */
534 texImage
->ImageOffsets
,
535 width
, height
, depth
,
536 format
, type
, pixels
, unpack
)) {
537 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
541 _mesa_unmap_teximage_pbo(ctx
, unpack
);
543 if (intelImage
->mt
) {
545 intel_miptree_image_unmap(intel
, intelImage
->mt
);
546 texImage
->Data
= NULL
;
552 intelTexImage3D(GLcontext
* ctx
,
553 GLenum target
, GLint level
,
554 GLint internalFormat
,
555 GLint width
, GLint height
, GLint depth
,
557 GLenum format
, GLenum type
, const void *pixels
,
558 const struct gl_pixelstore_attrib
*unpack
,
559 struct gl_texture_object
*texObj
,
560 struct gl_texture_image
*texImage
)
562 intelTexImage(ctx
, 3, target
, level
,
563 internalFormat
, width
, height
, depth
, border
,
564 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
569 intelTexImage2D(GLcontext
* ctx
,
570 GLenum target
, GLint level
,
571 GLint internalFormat
,
572 GLint width
, GLint height
, GLint border
,
573 GLenum format
, GLenum type
, const void *pixels
,
574 const struct gl_pixelstore_attrib
*unpack
,
575 struct gl_texture_object
*texObj
,
576 struct gl_texture_image
*texImage
)
578 intelTexImage(ctx
, 2, target
, level
,
579 internalFormat
, width
, height
, 1, border
,
580 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
585 intelTexImage1D(GLcontext
* ctx
,
586 GLenum target
, GLint level
,
587 GLint internalFormat
,
588 GLint width
, GLint border
,
589 GLenum format
, GLenum type
, const void *pixels
,
590 const struct gl_pixelstore_attrib
*unpack
,
591 struct gl_texture_object
*texObj
,
592 struct gl_texture_image
*texImage
)
594 intelTexImage(ctx
, 1, target
, level
,
595 internalFormat
, width
, 1, 1, border
,
596 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
601 intelCompressedTexImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
602 GLint internalFormat
,
603 GLint width
, GLint height
, GLint border
,
604 GLsizei imageSize
, const GLvoid
*data
,
605 struct gl_texture_object
*texObj
,
606 struct gl_texture_image
*texImage
)
608 intelTexImage(ctx
, 2, target
, level
,
609 internalFormat
, width
, height
, 1, border
,
610 0, 0, data
, &ctx
->Unpack
, texObj
, texImage
, imageSize
, GL_TRUE
);
615 * Need to map texture image into memory before copying image data,
619 intel_get_tex_image(GLcontext
* ctx
, GLenum target
, GLint level
,
620 GLenum format
, GLenum type
, GLvoid
* pixels
,
621 struct gl_texture_object
*texObj
,
622 struct gl_texture_image
*texImage
, GLboolean compressed
)
624 struct intel_context
*intel
= intel_context(ctx
);
625 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
627 /* If we're reading from a texture that has been rendered to, need to
628 * make sure rendering is complete.
629 * We could probably predicate this on texObj->_RenderToTexture
634 if (intelImage
->mt
) {
635 /* Image is stored in hardware format in a buffer managed by the
636 * kernel. Need to explicitly map and unmap it.
638 intelImage
->base
.Data
=
639 intel_miptree_image_map(intel
,
643 &intelImage
->base
.RowStride
,
644 intelImage
->base
.ImageOffsets
);
645 intelImage
->base
.RowStride
/= intelImage
->mt
->cpp
;
648 /* Otherwise, the image should actually be stored in
649 * intelImage->base.Data. This is pretty confusing for
650 * everybody, I'd much prefer to separate the two functions of
651 * texImage->Data - storage for texture images in main memory
652 * and access (ie mappings) of images. In other words, we'd
653 * create a new texImage->Map field and leave Data simply for
656 assert(intelImage
->base
.Data
);
661 _mesa_get_compressed_teximage(ctx
, target
, level
, pixels
,
665 _mesa_get_teximage(ctx
, target
, level
, format
, type
, pixels
,
671 if (intelImage
->mt
) {
672 intel_miptree_image_unmap(intel
, intelImage
->mt
);
673 intelImage
->base
.Data
= NULL
;
679 intelGetTexImage(GLcontext
* ctx
, GLenum target
, GLint level
,
680 GLenum format
, GLenum type
, GLvoid
* pixels
,
681 struct gl_texture_object
*texObj
,
682 struct gl_texture_image
*texImage
)
684 intel_get_tex_image(ctx
, target
, level
, format
, type
, pixels
,
685 texObj
, texImage
, GL_FALSE
);
690 intelGetCompressedTexImage(GLcontext
*ctx
, GLenum target
, GLint level
,
692 struct gl_texture_object
*texObj
,
693 struct gl_texture_image
*texImage
)
695 intel_get_tex_image(ctx
, target
, level
, 0, 0, pixels
,
696 texObj
, texImage
, GL_TRUE
);
701 intelSetTexOffset(__DRIcontext
*pDRICtx
, GLint texname
,
702 unsigned long long offset
, GLint depth
, GLuint pitch
)
704 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
705 struct gl_texture_object
*tObj
= _mesa_lookup_texture(&intel
->ctx
, texname
);
706 struct intel_texture_object
*intelObj
= intel_texture_object(tObj
);
712 intel_miptree_release(intel
, &intelObj
->mt
);
714 intelObj
->imageOverride
= GL_TRUE
;
715 intelObj
->depthOverride
= depth
;
716 intelObj
->pitchOverride
= pitch
;
719 intelObj
->textureOffset
= offset
;
723 intelSetTexBuffer2(__DRIcontext
*pDRICtx
, GLint target
,
724 GLint glx_texture_format
,
725 __DRIdrawable
*dPriv
)
727 struct gl_framebuffer
*fb
= dPriv
->driverPrivate
;
728 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
729 GLcontext
*ctx
= &intel
->ctx
;
730 struct intel_texture_object
*intelObj
;
731 struct intel_texture_image
*intelImage
;
732 struct intel_mipmap_tree
*mt
;
733 struct intel_renderbuffer
*rb
;
734 struct gl_texture_object
*texObj
;
735 struct gl_texture_image
*texImage
;
736 int level
= 0, internalFormat
;
738 texObj
= _mesa_get_current_tex_object(ctx
, target
);
739 intelObj
= intel_texture_object(texObj
);
744 if (!dPriv
->validBuffers
)
745 intel_update_renderbuffers(pDRICtx
, dPriv
);
747 rb
= intel_get_renderbuffer(fb
, BUFFER_FRONT_LEFT
);
748 /* If the region isn't set, then intel_update_renderbuffers was unable
749 * to get the buffers for the drawable.
751 if (rb
->region
== NULL
)
754 if (glx_texture_format
== GLX_TEXTURE_FORMAT_RGB_EXT
)
755 internalFormat
= GL_RGB
;
757 internalFormat
= GL_RGBA
;
759 mt
= intel_miptree_create_for_region(intel
, target
,
761 0, 0, rb
->region
, 1, 0);
765 _mesa_lock_texture(&intel
->ctx
, texObj
);
767 texImage
= _mesa_get_tex_image(&intel
->ctx
, texObj
, target
, level
);
768 intelImage
= intel_texture_image(texImage
);
770 if (intelImage
->mt
) {
771 intel_miptree_release(intel
, &intelImage
->mt
);
772 assert(!texImage
->Data
);
775 intel_miptree_release(intel
, &intelObj
->mt
);
778 _mesa_init_teximage_fields(&intel
->ctx
, target
, texImage
,
779 rb
->region
->width
, rb
->region
->height
, 1,
782 intelImage
->face
= target_to_face(target
);
783 intelImage
->level
= level
;
784 if (glx_texture_format
== GLX_TEXTURE_FORMAT_RGB_EXT
)
785 texImage
->TexFormat
= MESA_FORMAT_XRGB8888
;
787 texImage
->TexFormat
= MESA_FORMAT_ARGB8888
;
788 texImage
->RowStride
= rb
->region
->pitch
;
789 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
791 if (!intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
792 fprintf(stderr
, "miptree doesn't match image\n");
795 _mesa_unlock_texture(&intel
->ctx
, texObj
);
799 intelSetTexBuffer(__DRIcontext
*pDRICtx
, GLint target
, __DRIdrawable
*dPriv
)
801 /* The old interface didn't have the format argument, so copy our
802 * implementation's behavior at the time.
804 intelSetTexBuffer2(pDRICtx
, target
, GLX_TEXTURE_FORMAT_RGBA_EXT
, dPriv
);
809 intelInitTextureImageFuncs(struct dd_function_table
*functions
)
811 functions
->TexImage1D
= intelTexImage1D
;
812 functions
->TexImage2D
= intelTexImage2D
;
813 functions
->TexImage3D
= intelTexImage3D
;
814 functions
->GetTexImage
= intelGetTexImage
;
816 functions
->CompressedTexImage2D
= intelCompressedTexImage2D
;
817 functions
->GetCompressedTexImage
= intelGetCompressedTexImage
;