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/texcompress.h"
10 #include "main/texstore.h"
11 #include "main/texgetimage.h"
12 #include "main/texobj.h"
13 #include "main/texstore.h"
14 #include "main/teximage.h"
16 #include "intel_context.h"
17 #include "intel_mipmap_tree.h"
18 #include "intel_buffer_objects.h"
19 #include "intel_batchbuffer.h"
20 #include "intel_tex.h"
21 #include "intel_blit.h"
22 #include "intel_fbo.h"
24 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
26 /* Functions to store texture images. Where possible, mipmap_tree's
27 * will be created or further instantiated with image data, otherwise
28 * images will be stored in malloc'd memory. A validation step is
29 * required to pull those images into a mipmap tree, or otherwise
30 * decide a fallback is required.
49 /* Otherwise, store it in memory if (Border != 0) or (any dimension ==
52 * Otherwise, if max_level >= level >= min_level, create tree with
53 * space for textures from min_level down to max_level.
55 * Otherwise, create tree with space for textures from (level
56 * 0)..(1x1). Consider pruning this tree at a validation if the
60 guess_and_alloc_mipmap_tree(struct intel_context
*intel
,
61 struct intel_texture_object
*intelObj
,
62 struct intel_texture_image
*intelImage
,
63 GLboolean expect_accelerated_upload
)
67 GLuint width
= intelImage
->base
.Width
;
68 GLuint height
= intelImage
->base
.Height
;
69 GLuint depth
= intelImage
->base
.Depth
;
70 GLuint l2width
, l2height
, l2depth
;
71 GLuint i
, comp_byte
= 0;
74 DBG("%s\n", __FUNCTION__
);
76 if (intelImage
->base
.Border
||
77 ((intelImage
->base
._BaseFormat
== GL_DEPTH_COMPONENT
) &&
78 ((intelObj
->base
.WrapS
== GL_CLAMP_TO_BORDER
) ||
79 (intelObj
->base
.WrapT
== GL_CLAMP_TO_BORDER
))))
82 if (intelImage
->level
> intelObj
->base
.BaseLevel
&&
83 (intelImage
->base
.Width
== 1 ||
84 (intelObj
->base
.Target
!= GL_TEXTURE_1D
&&
85 intelImage
->base
.Height
== 1) ||
86 (intelObj
->base
.Target
== GL_TEXTURE_3D
&&
87 intelImage
->base
.Depth
== 1)))
90 /* If this image disrespects BaseLevel, allocate from level zero.
91 * Usually BaseLevel == 0, so it's unlikely to happen.
93 if (intelImage
->level
< intelObj
->base
.BaseLevel
)
96 firstLevel
= intelObj
->base
.BaseLevel
;
99 /* Figure out image dimensions at start level.
101 for (i
= intelImage
->level
; i
> firstLevel
; i
--) {
109 /* Guess a reasonable value for lastLevel. This is probably going
110 * to be wrong fairly often and might mean that we have to look at
111 * resizable buffers, or require that buffers implement lazy
112 * pagetable arrangements.
114 if ((intelObj
->base
.MinFilter
== GL_NEAREST
||
115 intelObj
->base
.MinFilter
== GL_LINEAR
) &&
116 intelImage
->level
== firstLevel
) {
117 lastLevel
= firstLevel
;
120 l2width
= logbase2(width
);
121 l2height
= logbase2(height
);
122 l2depth
= logbase2(depth
);
123 lastLevel
= firstLevel
+ MAX2(MAX2(l2width
, l2height
), l2depth
);
126 assert(!intelObj
->mt
);
127 if (_mesa_is_format_compressed(intelImage
->base
.TexFormat
))
128 comp_byte
= intel_compressed_num_bytes(intelImage
->base
.TexFormat
);
130 texelBytes
= _mesa_get_format_bytes(intelImage
->base
.TexFormat
);
132 intelObj
->mt
= intel_miptree_create(intel
,
133 intelObj
->base
.Target
,
134 intelImage
->base
._BaseFormat
,
135 intelImage
->base
.InternalFormat
,
143 expect_accelerated_upload
);
145 DBG("%s - success\n", __FUNCTION__
);
152 target_to_face(GLenum target
)
155 case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
:
156 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
:
157 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
:
158 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
:
159 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
:
160 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
:
161 return ((GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
);
167 /* There are actually quite a few combinations this will work for,
168 * more than what I've listed here.
171 check_pbo_format(GLint internalFormat
,
172 GLenum format
, GLenum type
,
173 gl_format mesa_format
)
175 switch (internalFormat
) {
178 return (format
== GL_BGRA
&&
179 (type
== GL_UNSIGNED_BYTE
||
180 type
== GL_UNSIGNED_INT_8_8_8_8_REV
) &&
181 mesa_format
== MESA_FORMAT_ARGB8888
);
184 return (format
== GL_RGB
&&
185 type
== GL_UNSIGNED_SHORT_5_6_5
&&
186 mesa_format
== MESA_FORMAT_RGB565
);
188 return (type
== GL_UNSIGNED_SHORT_8_8_MESA
|| type
== GL_UNSIGNED_BYTE
);
195 /* XXX: Do this for TexSubImage also:
198 try_pbo_upload(struct intel_context
*intel
,
199 struct intel_texture_image
*intelImage
,
200 const struct gl_pixelstore_attrib
*unpack
,
201 GLint internalFormat
,
202 GLint width
, GLint height
,
203 GLenum format
, GLenum type
, const void *pixels
)
205 struct intel_buffer_object
*pbo
= intel_buffer_object(unpack
->BufferObj
);
206 GLuint src_offset
, src_stride
;
207 GLuint dst_offset
, dst_stride
;
209 if (!_mesa_is_bufferobj(unpack
->BufferObj
) ||
210 intel
->ctx
._ImageTransferState
||
211 unpack
->SkipPixels
|| unpack
->SkipRows
) {
212 DBG("%s: failure 1\n", __FUNCTION__
);
216 /* note: potential 64-bit ptr to 32-bit int cast */
217 src_offset
= (GLuint
) (unsigned long) pixels
;
219 if (unpack
->RowLength
> 0)
220 src_stride
= unpack
->RowLength
;
224 dst_offset
= intel_miptree_image_offset(intelImage
->mt
,
228 dst_stride
= intelImage
->mt
->pitch
;
230 intelFlush(&intel
->ctx
);
231 LOCK_HARDWARE(intel
);
233 dri_bo
*src_buffer
= intel_bufferobj_buffer(intel
, pbo
, INTEL_READ
);
234 dri_bo
*dst_buffer
= intel_region_buffer(intel
,
235 intelImage
->mt
->region
,
239 if (!intelEmitCopyBlit(intel
,
241 src_stride
, src_buffer
, src_offset
, GL_FALSE
,
242 dst_stride
, dst_buffer
, dst_offset
, GL_FALSE
,
243 0, 0, 0, 0, width
, height
,
245 UNLOCK_HARDWARE(intel
);
249 UNLOCK_HARDWARE(intel
);
256 try_pbo_zcopy(struct intel_context
*intel
,
257 struct intel_texture_image
*intelImage
,
258 const struct gl_pixelstore_attrib
*unpack
,
259 GLint internalFormat
,
260 GLint width
, GLint height
,
261 GLenum format
, GLenum type
, const void *pixels
)
263 struct intel_buffer_object
*pbo
= intel_buffer_object(unpack
->BufferObj
);
264 GLuint src_offset
, src_stride
;
265 GLuint dst_offset
, dst_stride
;
267 if (!_mesa_is_bufferobj(unpack
->BufferObj
) ||
268 intel
->ctx
._ImageTransferState
||
269 unpack
->SkipPixels
|| unpack
->SkipRows
) {
270 DBG("%s: failure 1\n", __FUNCTION__
);
274 /* note: potential 64-bit ptr to 32-bit int cast */
275 src_offset
= (GLuint
) (unsigned long) pixels
;
277 if (unpack
->RowLength
> 0)
278 src_stride
= unpack
->RowLength
;
282 dst_offset
= intel_miptree_image_offset(intelImage
->mt
,
286 dst_stride
= intelImage
->mt
->pitch
;
288 if (src_stride
!= dst_stride
|| dst_offset
!= 0 || src_offset
!= 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
);
325 intelImage
->face
= target_to_face(target
);
326 intelImage
->level
= level
;
328 if (ctx
->_ImageTransferState
& IMAGE_CONVOLUTION_BIT
) {
329 _mesa_adjust_image_for_convolution(ctx
, dims
, &postConvWidth
,
333 /* choose the texture format */
334 texImage
->TexFormat
= intelChooseTextureFormat(ctx
, internalFormat
,
337 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
341 texelBytes
= _mesa_get_format_bytes(texImage
->TexFormat
);
343 /* Minimum pitch of 32 bytes */
344 if (postConvWidth
* texelBytes
< 32) {
345 postConvWidth
= 32 / texelBytes
;
346 texImage
->RowStride
= postConvWidth
;
349 if (!intelImage
->mt
) {
350 assert(texImage
->RowStride
== postConvWidth
);
354 /* Release the reference to a potentially orphaned buffer.
355 * Release any old malloced memory.
357 if (intelImage
->mt
) {
358 intel_miptree_release(intel
, &intelImage
->mt
);
359 assert(!texImage
->Data
);
361 else if (texImage
->Data
) {
362 _mesa_free_texmemory(texImage
->Data
);
363 texImage
->Data
= NULL
;
366 /* If this is the only texture image in the tree, could call
367 * bmBufferData with NULL data to free the old block and avoid
368 * waiting on any outstanding fences.
371 intelObj
->mt
->first_level
== level
&&
372 intelObj
->mt
->last_level
== level
&&
373 intelObj
->mt
->target
!= GL_TEXTURE_CUBE_MAP_ARB
&&
374 !intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
,
375 intelImage
->face
, intelImage
->level
)) {
378 intel_miptree_release(intel
, &intelObj
->mt
);
379 assert(!intelObj
->mt
);
383 guess_and_alloc_mipmap_tree(intel
, intelObj
, intelImage
, pixels
== NULL
);
385 DBG("guess_and_alloc_mipmap_tree: failed\n");
389 assert(!intelImage
->mt
);
392 intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
,
393 intelImage
->face
, intelImage
->level
)) {
395 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
396 assert(intelImage
->mt
);
397 } else if (intelImage
->base
.Border
== 0) {
399 GLuint texelBytes
= _mesa_get_format_bytes(intelImage
->base
.TexFormat
);
400 GLenum baseFormat
= _mesa_get_format_base_format(intelImage
->base
.TexFormat
);
401 if (_mesa_is_format_compressed(intelImage
->base
.TexFormat
)) {
403 intel_compressed_num_bytes(intelImage
->base
.TexFormat
);
406 /* Didn't fit in the object miptree, but it's suitable for inclusion in
407 * a miptree, so create one just for our level and store it in the image.
408 * It'll get moved into the object miptree at validate time.
410 intelImage
->mt
= intel_miptree_create(intel
, target
,
414 width
, height
, depth
,
416 comp_byte
, pixels
== NULL
);
424 _mesa_is_bufferobj(unpack
->BufferObj
) &&
425 check_pbo_format(internalFormat
, format
,
426 type
, intelImage
->base
.TexFormat
)) {
428 DBG("trying pbo upload\n");
430 /* Attempt to texture directly from PBO data (zero copy upload).
432 * Currently disable as it can lead to worse as well as better
433 * performance (in particular when intel_region_cow() is
436 if (intelObj
->mt
== intelImage
->mt
&&
437 intelObj
->mt
->first_level
== level
&&
438 intelObj
->mt
->last_level
== level
) {
440 if (try_pbo_zcopy(intel
, intelImage
, unpack
,
442 width
, height
, format
, type
, pixels
)) {
444 DBG("pbo zcopy upload succeeded\n");
450 /* Otherwise, attempt to use the blitter for PBO image uploads.
452 if (try_pbo_upload(intel
, intelImage
, unpack
,
454 width
, height
, format
, type
, pixels
)) {
455 DBG("pbo upload succeeded\n");
459 DBG("pbo upload failed\n");
462 /* intelCopyTexImage calls this function with pixels == NULL, with
463 * the expectation that the mipmap tree will be set up but nothing
464 * more will be done. This is where those calls return:
467 pixels
= _mesa_validate_pbo_compressed_teximage(ctx
, imageSize
, pixels
,
469 "glCompressedTexImage");
471 pixels
= _mesa_validate_pbo_teximage(ctx
, dims
, width
, height
, 1,
473 pixels
, unpack
, "glTexImage");
476 LOCK_HARDWARE(intel
);
478 if (intelImage
->mt
) {
480 texImage
->Data
= intel_miptree_image_map(intel
,
485 intelImage
->base
.ImageOffsets
);
486 texImage
->RowStride
= dstRowStride
/ intelImage
->mt
->cpp
;
489 /* Allocate regular memory and store the image there temporarily. */
490 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
491 sizeInBytes
= ctx
->Driver
.CompressedTextureSize(ctx
,
495 texImage
->TexFormat
);
497 _mesa_compressed_row_stride(texImage
->TexFormat
, width
);
501 dstRowStride
= postConvWidth
* texelBytes
;
502 sizeInBytes
= depth
* dstRowStride
* postConvHeight
;
505 texImage
->Data
= _mesa_alloc_texmemory(sizeInBytes
);
508 DBG("Upload image %dx%dx%d row_len %d "
509 "pitch %d pixels %d compressed %d\n",
510 width
, height
, depth
, width
* texelBytes
, dstRowStride
,
511 pixels
? 1 : 0, compressed
);
513 /* Copy data. Would like to know when it's ok for us to eg. use
514 * the blitter to copy. Or, use the hardware to do the format
515 * conversion and copy:
519 if (intelImage
->mt
) {
520 struct intel_region
*dst
= intelImage
->mt
->region
;
521 _mesa_copy_rect(texImage
->Data
, dst
->cpp
, dst
->pitch
,
523 intelImage
->mt
->level
[level
].width
,
524 (intelImage
->mt
->level
[level
].height
+3)/4,
530 memcpy(texImage
->Data
, pixels
, imageSize
);
533 else if (!_mesa_texstore(ctx
, dims
,
534 texImage
->_BaseFormat
,
536 texImage
->Data
, 0, 0, 0, /* dstX/Y/Zoffset */
538 texImage
->ImageOffsets
,
539 width
, height
, depth
,
540 format
, type
, pixels
, unpack
)) {
541 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
545 _mesa_unmap_teximage_pbo(ctx
, unpack
);
547 if (intelImage
->mt
) {
549 intel_miptree_image_unmap(intel
, intelImage
->mt
);
550 texImage
->Data
= NULL
;
553 UNLOCK_HARDWARE(intel
);
558 intelTexImage3D(GLcontext
* ctx
,
559 GLenum target
, GLint level
,
560 GLint internalFormat
,
561 GLint width
, GLint height
, GLint depth
,
563 GLenum format
, GLenum type
, const void *pixels
,
564 const struct gl_pixelstore_attrib
*unpack
,
565 struct gl_texture_object
*texObj
,
566 struct gl_texture_image
*texImage
)
568 intelTexImage(ctx
, 3, target
, level
,
569 internalFormat
, width
, height
, depth
, border
,
570 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
575 intelTexImage2D(GLcontext
* ctx
,
576 GLenum target
, GLint level
,
577 GLint internalFormat
,
578 GLint width
, GLint height
, GLint border
,
579 GLenum format
, GLenum type
, const void *pixels
,
580 const struct gl_pixelstore_attrib
*unpack
,
581 struct gl_texture_object
*texObj
,
582 struct gl_texture_image
*texImage
)
584 intelTexImage(ctx
, 2, target
, level
,
585 internalFormat
, width
, height
, 1, border
,
586 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
591 intelTexImage1D(GLcontext
* ctx
,
592 GLenum target
, GLint level
,
593 GLint internalFormat
,
594 GLint width
, GLint border
,
595 GLenum format
, GLenum type
, const void *pixels
,
596 const struct gl_pixelstore_attrib
*unpack
,
597 struct gl_texture_object
*texObj
,
598 struct gl_texture_image
*texImage
)
600 intelTexImage(ctx
, 1, target
, level
,
601 internalFormat
, width
, 1, 1, border
,
602 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
607 intelCompressedTexImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
608 GLint internalFormat
,
609 GLint width
, GLint height
, GLint border
,
610 GLsizei imageSize
, const GLvoid
*data
,
611 struct gl_texture_object
*texObj
,
612 struct gl_texture_image
*texImage
)
614 intelTexImage(ctx
, 2, target
, level
,
615 internalFormat
, width
, height
, 1, border
,
616 0, 0, data
, &ctx
->Unpack
, texObj
, texImage
, imageSize
, GL_TRUE
);
621 * Need to map texture image into memory before copying image data,
625 intel_get_tex_image(GLcontext
* ctx
, GLenum target
, GLint level
,
626 GLenum format
, GLenum type
, GLvoid
* pixels
,
627 struct gl_texture_object
*texObj
,
628 struct gl_texture_image
*texImage
, GLboolean compressed
)
630 struct intel_context
*intel
= intel_context(ctx
);
631 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
633 /* If we're reading from a texture that has been rendered to, need to
634 * make sure rendering is complete.
635 * We could probably predicate this on texObj->_RenderToTexture
640 if (intelImage
->mt
) {
641 /* Image is stored in hardware format in a buffer managed by the
642 * kernel. Need to explicitly map and unmap it.
644 intelImage
->base
.Data
=
645 intel_miptree_image_map(intel
,
649 &intelImage
->base
.RowStride
,
650 intelImage
->base
.ImageOffsets
);
651 intelImage
->base
.RowStride
/= intelImage
->mt
->cpp
;
654 /* Otherwise, the image should actually be stored in
655 * intelImage->base.Data. This is pretty confusing for
656 * everybody, I'd much prefer to separate the two functions of
657 * texImage->Data - storage for texture images in main memory
658 * and access (ie mappings) of images. In other words, we'd
659 * create a new texImage->Map field and leave Data simply for
662 assert(intelImage
->base
.Data
);
667 _mesa_get_compressed_teximage(ctx
, target
, level
, pixels
,
670 _mesa_get_teximage(ctx
, target
, level
, format
, type
, pixels
,
676 if (intelImage
->mt
) {
677 intel_miptree_image_unmap(intel
, intelImage
->mt
);
678 intelImage
->base
.Data
= NULL
;
684 intelGetTexImage(GLcontext
* ctx
, GLenum target
, GLint level
,
685 GLenum format
, GLenum type
, GLvoid
* pixels
,
686 struct gl_texture_object
*texObj
,
687 struct gl_texture_image
*texImage
)
689 intel_get_tex_image(ctx
, target
, level
, format
, type
, pixels
,
690 texObj
, texImage
, GL_FALSE
);
695 intelGetCompressedTexImage(GLcontext
*ctx
, GLenum target
, GLint level
,
697 struct gl_texture_object
*texObj
,
698 struct gl_texture_image
*texImage
)
700 intel_get_tex_image(ctx
, target
, level
, 0, 0, pixels
,
701 texObj
, texImage
, GL_TRUE
);
706 intelSetTexOffset(__DRIcontext
*pDRICtx
, GLint texname
,
707 unsigned long long offset
, GLint depth
, GLuint pitch
)
709 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
710 struct gl_texture_object
*tObj
= _mesa_lookup_texture(&intel
->ctx
, texname
);
711 struct intel_texture_object
*intelObj
= intel_texture_object(tObj
);
717 intel_miptree_release(intel
, &intelObj
->mt
);
719 intelObj
->imageOverride
= GL_TRUE
;
720 intelObj
->depthOverride
= depth
;
721 intelObj
->pitchOverride
= pitch
;
724 intelObj
->textureOffset
= offset
;
728 intelSetTexBuffer2(__DRIcontext
*pDRICtx
, GLint target
,
729 GLint glx_texture_format
,
730 __DRIdrawable
*dPriv
)
732 struct intel_framebuffer
*intel_fb
= dPriv
->driverPrivate
;
733 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
734 struct intel_texture_object
*intelObj
;
735 struct intel_texture_image
*intelImage
;
736 struct intel_mipmap_tree
*mt
;
737 struct intel_renderbuffer
*rb
;
738 struct gl_texture_unit
*texUnit
;
739 struct gl_texture_object
*texObj
;
740 struct gl_texture_image
*texImage
;
741 int level
= 0, type
, format
, internalFormat
;
743 texUnit
= &intel
->ctx
.Texture
.Unit
[intel
->ctx
.Texture
.CurrentUnit
];
744 texObj
= _mesa_select_tex_object(&intel
->ctx
, texUnit
, target
);
745 intelObj
= intel_texture_object(texObj
);
750 intel_update_renderbuffers(pDRICtx
, dPriv
);
752 rb
= intel_fb
->color_rb
[0];
753 /* If the region isn't set, then intel_update_renderbuffers was unable
754 * to get the buffers for the drawable.
756 if (rb
->region
== NULL
)
760 format
= GL_UNSIGNED_BYTE
;
761 if (glx_texture_format
== GLX_TEXTURE_FORMAT_RGB_EXT
)
762 internalFormat
= GL_RGB
;
764 internalFormat
= GL_RGBA
;
766 mt
= intel_miptree_create_for_region(intel
, target
,
768 0, 0, rb
->region
, 1, 0);
772 _mesa_lock_texture(&intel
->ctx
, texObj
);
774 texImage
= _mesa_get_tex_image(&intel
->ctx
, texObj
, target
, level
);
775 intelImage
= intel_texture_image(texImage
);
777 if (intelImage
->mt
) {
778 intel_miptree_release(intel
, &intelImage
->mt
);
779 assert(!texImage
->Data
);
782 intel_miptree_release(intel
, &intelObj
->mt
);
785 _mesa_init_teximage_fields(&intel
->ctx
, target
, texImage
,
786 rb
->region
->width
, rb
->region
->height
, 1,
789 intelImage
->face
= target_to_face(target
);
790 intelImage
->level
= level
;
791 texImage
->TexFormat
= intelChooseTextureFormat(&intel
->ctx
, internalFormat
,
793 texImage
->RowStride
= rb
->region
->pitch
;
794 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
796 if (!intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
,
797 intelImage
->face
, intelImage
->level
)) {
798 fprintf(stderr
, "miptree doesn't match image\n");
801 _mesa_unlock_texture(&intel
->ctx
, texObj
);
805 intelSetTexBuffer(__DRIcontext
*pDRICtx
, GLint target
, __DRIdrawable
*dPriv
)
807 /* The old interface didn't have the format argument, so copy our
808 * implementation's behavior at the time.
810 intelSetTexBuffer2(pDRICtx
, target
, GLX_TEXTURE_FORMAT_RGBA_EXT
, dPriv
);
815 intelInitTextureImageFuncs(struct dd_function_table
*functions
)
817 functions
->TexImage1D
= intelTexImage1D
;
818 functions
->TexImage2D
= intelTexImage2D
;
819 functions
->TexImage3D
= intelTexImage3D
;
820 functions
->GetTexImage
= intelGetTexImage
;
822 functions
->CompressedTexImage2D
= intelCompressedTexImage2D
;
823 functions
->GetCompressedTexImage
= intelGetCompressedTexImage
;