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/image.h"
11 #include "main/texcompress.h"
12 #include "main/texstore.h"
13 #include "main/texgetimage.h"
14 #include "main/texobj.h"
15 #include "main/texstore.h"
16 #include "main/teximage.h"
18 #include "intel_context.h"
19 #include "intel_mipmap_tree.h"
20 #include "intel_buffer_objects.h"
21 #include "intel_batchbuffer.h"
22 #include "intel_tex.h"
23 #include "intel_blit.h"
24 #include "intel_fbo.h"
26 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
28 /* Functions to store texture images. Where possible, mipmap_tree's
29 * will be created or further instantiated with image data, otherwise
30 * images will be stored in malloc'd memory. A validation step is
31 * required to pull those images into a mipmap tree, or otherwise
32 * decide a fallback is required.
51 /* Otherwise, store it in memory if (Border != 0) or (any dimension ==
54 * Otherwise, if max_level >= level >= min_level, create tree with
55 * space for textures from min_level down to max_level.
57 * Otherwise, create tree with space for textures from (level
58 * 0)..(1x1). Consider pruning this tree at a validation if the
62 guess_and_alloc_mipmap_tree(struct intel_context
*intel
,
63 struct intel_texture_object
*intelObj
,
64 struct intel_texture_image
*intelImage
,
65 GLboolean expect_accelerated_upload
)
69 GLuint width
= intelImage
->base
.Width
;
70 GLuint height
= intelImage
->base
.Height
;
71 GLuint depth
= intelImage
->base
.Depth
;
72 GLuint l2width
, l2height
, l2depth
;
73 GLuint i
, comp_byte
= 0;
76 DBG("%s\n", __FUNCTION__
);
78 if (intelImage
->base
.Border
||
79 ((intelImage
->base
._BaseFormat
== GL_DEPTH_COMPONENT
) &&
80 ((intelObj
->base
.WrapS
== GL_CLAMP_TO_BORDER
) ||
81 (intelObj
->base
.WrapT
== GL_CLAMP_TO_BORDER
))))
84 if (intelImage
->level
> intelObj
->base
.BaseLevel
&&
85 (intelImage
->base
.Width
== 1 ||
86 (intelObj
->base
.Target
!= GL_TEXTURE_1D
&&
87 intelImage
->base
.Height
== 1) ||
88 (intelObj
->base
.Target
== GL_TEXTURE_3D
&&
89 intelImage
->base
.Depth
== 1)))
92 /* If this image disrespects BaseLevel, allocate from level zero.
93 * Usually BaseLevel == 0, so it's unlikely to happen.
95 if (intelImage
->level
< intelObj
->base
.BaseLevel
)
98 firstLevel
= intelObj
->base
.BaseLevel
;
101 /* Figure out image dimensions at start level.
103 for (i
= intelImage
->level
; i
> firstLevel
; i
--) {
111 /* Guess a reasonable value for lastLevel. This is probably going
112 * to be wrong fairly often and might mean that we have to look at
113 * resizable buffers, or require that buffers implement lazy
114 * pagetable arrangements.
116 if ((intelObj
->base
.MinFilter
== GL_NEAREST
||
117 intelObj
->base
.MinFilter
== GL_LINEAR
) &&
118 intelImage
->level
== firstLevel
&&
119 (intel
->gen
< 4 || firstLevel
== 0)) {
120 lastLevel
= firstLevel
;
123 l2width
= logbase2(width
);
124 l2height
= logbase2(height
);
125 l2depth
= logbase2(depth
);
126 lastLevel
= firstLevel
+ MAX2(MAX2(l2width
, l2height
), l2depth
);
129 assert(!intelObj
->mt
);
130 if (_mesa_is_format_compressed(intelImage
->base
.TexFormat
))
131 comp_byte
= intel_compressed_num_bytes(intelImage
->base
.TexFormat
);
133 texelBytes
= _mesa_get_format_bytes(intelImage
->base
.TexFormat
);
135 intelObj
->mt
= intel_miptree_create(intel
,
136 intelObj
->base
.Target
,
137 intelImage
->base
._BaseFormat
,
138 intelImage
->base
.InternalFormat
,
146 expect_accelerated_upload
);
148 DBG("%s - success\n", __FUNCTION__
);
155 target_to_face(GLenum target
)
158 case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
:
159 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
:
160 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
:
161 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
:
162 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
:
163 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
:
164 return ((GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
);
170 /* There are actually quite a few combinations this will work for,
171 * more than what I've listed here.
174 check_pbo_format(GLint internalFormat
,
175 GLenum format
, GLenum type
,
176 gl_format mesa_format
)
178 switch (internalFormat
) {
181 return (format
== GL_BGRA
&&
182 (type
== GL_UNSIGNED_BYTE
||
183 type
== GL_UNSIGNED_INT_8_8_8_8_REV
) &&
184 mesa_format
== MESA_FORMAT_ARGB8888
);
187 return (format
== GL_RGB
&&
188 type
== GL_UNSIGNED_SHORT_5_6_5
&&
189 mesa_format
== MESA_FORMAT_RGB565
);
191 return (type
== GL_UNSIGNED_SHORT_8_8_MESA
|| type
== GL_UNSIGNED_BYTE
);
198 /* XXX: Do this for TexSubImage also:
201 try_pbo_upload(struct intel_context
*intel
,
202 struct intel_texture_image
*intelImage
,
203 const struct gl_pixelstore_attrib
*unpack
,
204 GLint internalFormat
,
205 GLint width
, GLint height
,
206 GLenum format
, GLenum type
, const void *pixels
)
208 struct intel_buffer_object
*pbo
= intel_buffer_object(unpack
->BufferObj
);
209 GLuint src_offset
, src_stride
;
210 GLuint dst_x
, dst_y
, dst_stride
;
211 dri_bo
*dst_buffer
= intel_region_buffer(intel
,
212 intelImage
->mt
->region
,
215 if (!_mesa_is_bufferobj(unpack
->BufferObj
) ||
216 intel
->ctx
._ImageTransferState
||
217 unpack
->SkipPixels
|| unpack
->SkipRows
) {
218 DBG("%s: failure 1\n", __FUNCTION__
);
222 /* note: potential 64-bit ptr to 32-bit int cast */
223 src_offset
= (GLuint
) (unsigned long) pixels
;
225 if (unpack
->RowLength
> 0)
226 src_stride
= unpack
->RowLength
;
230 intel_miptree_get_image_offset(intelImage
->mt
, intelImage
->level
,
234 dst_stride
= intelImage
->mt
->pitch
;
236 if (drm_intel_bo_references(intel
->batch
->buf
, dst_buffer
))
237 intelFlush(&intel
->ctx
);
238 LOCK_HARDWARE(intel
);
240 dri_bo
*src_buffer
= intel_bufferobj_buffer(intel
, pbo
, INTEL_READ
);
242 if (!intelEmitCopyBlit(intel
,
244 src_stride
, src_buffer
, src_offset
, GL_FALSE
,
245 dst_stride
, dst_buffer
, 0, GL_FALSE
,
246 0, 0, dst_x
, dst_y
, width
, height
,
248 UNLOCK_HARDWARE(intel
);
252 UNLOCK_HARDWARE(intel
);
259 try_pbo_zcopy(struct intel_context
*intel
,
260 struct intel_texture_image
*intelImage
,
261 const struct gl_pixelstore_attrib
*unpack
,
262 GLint internalFormat
,
263 GLint width
, GLint height
,
264 GLenum format
, GLenum type
, const void *pixels
)
266 struct intel_buffer_object
*pbo
= intel_buffer_object(unpack
->BufferObj
);
267 GLuint src_offset
, src_stride
;
268 GLuint dst_x
, dst_y
, dst_stride
;
270 if (!_mesa_is_bufferobj(unpack
->BufferObj
) ||
271 intel
->ctx
._ImageTransferState
||
272 unpack
->SkipPixels
|| unpack
->SkipRows
) {
273 DBG("%s: failure 1\n", __FUNCTION__
);
277 /* note: potential 64-bit ptr to 32-bit int cast */
278 src_offset
= (GLuint
) (unsigned long) pixels
;
280 if (unpack
->RowLength
> 0)
281 src_stride
= unpack
->RowLength
;
285 intel_miptree_get_image_offset(intelImage
->mt
, intelImage
->level
,
289 dst_stride
= intelImage
->mt
->pitch
;
291 if (src_stride
!= dst_stride
|| dst_x
!= 0 || dst_y
!= 0 ||
293 DBG("%s: failure 2\n", __FUNCTION__
);
297 intel_region_attach_pbo(intel
, intelImage
->mt
->region
, pbo
);
304 intelTexImage(GLcontext
* ctx
,
306 GLenum target
, GLint level
,
307 GLint internalFormat
,
308 GLint width
, GLint height
, GLint depth
,
310 GLenum format
, GLenum type
, const void *pixels
,
311 const struct gl_pixelstore_attrib
*unpack
,
312 struct gl_texture_object
*texObj
,
313 struct gl_texture_image
*texImage
, GLsizei imageSize
,
314 GLboolean compressed
)
316 struct intel_context
*intel
= intel_context(ctx
);
317 struct intel_texture_object
*intelObj
= intel_texture_object(texObj
);
318 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
319 GLint postConvWidth
= width
;
320 GLint postConvHeight
= height
;
321 GLint texelBytes
, sizeInBytes
;
322 GLuint dstRowStride
= 0, srcRowStride
= texImage
->RowStride
;
324 DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__
,
325 _mesa_lookup_enum_by_nr(target
), level
, width
, height
, depth
, border
);
327 intelImage
->face
= target_to_face(target
);
328 intelImage
->level
= level
;
330 if (ctx
->_ImageTransferState
& IMAGE_CONVOLUTION_BIT
) {
331 _mesa_adjust_image_for_convolution(ctx
, dims
, &postConvWidth
,
335 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
339 texelBytes
= _mesa_get_format_bytes(texImage
->TexFormat
);
341 /* Minimum pitch of 32 bytes */
342 if (postConvWidth
* texelBytes
< 32) {
343 postConvWidth
= 32 / texelBytes
;
344 texImage
->RowStride
= postConvWidth
;
347 if (!intelImage
->mt
) {
348 assert(texImage
->RowStride
== postConvWidth
);
352 /* Release the reference to a potentially orphaned buffer.
353 * Release any old malloced memory.
355 if (intelImage
->mt
) {
356 intel_miptree_release(intel
, &intelImage
->mt
);
357 assert(!texImage
->Data
);
359 else if (texImage
->Data
) {
360 _mesa_free_texmemory(texImage
->Data
);
361 texImage
->Data
= NULL
;
364 /* If this is the only texture image in the tree, could call
365 * bmBufferData with NULL data to free the old block and avoid
366 * waiting on any outstanding fences.
369 intelObj
->mt
->first_level
== level
&&
370 intelObj
->mt
->last_level
== level
&&
371 intelObj
->mt
->target
!= GL_TEXTURE_CUBE_MAP_ARB
&&
372 !intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
375 intel_miptree_release(intel
, &intelObj
->mt
);
376 assert(!intelObj
->mt
);
380 guess_and_alloc_mipmap_tree(intel
, intelObj
, intelImage
, pixels
== NULL
);
382 DBG("guess_and_alloc_mipmap_tree: failed\n");
386 assert(!intelImage
->mt
);
389 intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
391 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
392 assert(intelImage
->mt
);
393 } else if (intelImage
->base
.Border
== 0) {
395 GLuint texelBytes
= _mesa_get_format_bytes(intelImage
->base
.TexFormat
);
396 GLenum baseFormat
= _mesa_get_format_base_format(intelImage
->base
.TexFormat
);
397 if (_mesa_is_format_compressed(intelImage
->base
.TexFormat
)) {
399 intel_compressed_num_bytes(intelImage
->base
.TexFormat
);
402 /* Didn't fit in the object miptree, but it's suitable for inclusion in
403 * a miptree, so create one just for our level and store it in the image.
404 * It'll get moved into the object miptree at validate time.
406 intelImage
->mt
= intel_miptree_create(intel
, target
,
410 width
, height
, depth
,
412 comp_byte
, pixels
== NULL
);
420 _mesa_is_bufferobj(unpack
->BufferObj
) &&
421 check_pbo_format(internalFormat
, format
,
422 type
, intelImage
->base
.TexFormat
)) {
424 DBG("trying pbo upload\n");
426 /* Attempt to texture directly from PBO data (zero copy upload).
428 * Currently disable as it can lead to worse as well as better
429 * performance (in particular when intel_region_cow() is
432 if (intelObj
->mt
== intelImage
->mt
&&
433 intelObj
->mt
->first_level
== level
&&
434 intelObj
->mt
->last_level
== level
) {
436 if (try_pbo_zcopy(intel
, intelImage
, unpack
,
438 width
, height
, format
, type
, pixels
)) {
440 DBG("pbo zcopy upload succeeded\n");
446 /* Otherwise, attempt to use the blitter for PBO image uploads.
448 if (try_pbo_upload(intel
, intelImage
, unpack
,
450 width
, height
, format
, type
, pixels
)) {
451 DBG("pbo upload succeeded\n");
455 DBG("pbo upload failed\n");
458 /* intelCopyTexImage calls this function with pixels == NULL, with
459 * the expectation that the mipmap tree will be set up but nothing
460 * more will be done. This is where those calls return:
463 pixels
= _mesa_validate_pbo_compressed_teximage(ctx
, imageSize
, pixels
,
465 "glCompressedTexImage");
467 pixels
= _mesa_validate_pbo_teximage(ctx
, dims
, width
, height
, 1,
469 pixels
, unpack
, "glTexImage");
472 LOCK_HARDWARE(intel
);
474 if (intelImage
->mt
) {
475 if (pixels
!= NULL
) {
476 /* Flush any queued rendering with the texture before mapping. */
477 if (drm_intel_bo_references(intel
->batch
->buf
,
478 intelImage
->mt
->region
->buffer
)) {
481 texImage
->Data
= intel_miptree_image_map(intel
,
486 intelImage
->base
.ImageOffsets
);
489 texImage
->RowStride
= dstRowStride
/ intelImage
->mt
->cpp
;
492 /* Allocate regular memory and store the image there temporarily. */
493 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
494 sizeInBytes
= _mesa_format_image_size(texImage
->TexFormat
,
499 _mesa_format_row_stride(texImage
->TexFormat
, width
);
503 dstRowStride
= postConvWidth
* texelBytes
;
504 sizeInBytes
= depth
* dstRowStride
* postConvHeight
;
507 texImage
->Data
= _mesa_alloc_texmemory(sizeInBytes
);
510 DBG("Upload image %dx%dx%d row_len %d "
511 "pitch %d pixels %d compressed %d\n",
512 width
, height
, depth
, width
* texelBytes
, dstRowStride
,
513 pixels
? 1 : 0, compressed
);
515 /* Copy data. Would like to know when it's ok for us to eg. use
516 * the blitter to copy. Or, use the hardware to do the format
517 * conversion and copy:
521 if (intelImage
->mt
) {
522 struct intel_region
*dst
= intelImage
->mt
->region
;
523 _mesa_copy_rect(texImage
->Data
, dst
->cpp
, dst
->pitch
,
525 intelImage
->mt
->level
[level
].width
,
526 (intelImage
->mt
->level
[level
].height
+3)/4,
532 memcpy(texImage
->Data
, pixels
, imageSize
);
535 else if (!_mesa_texstore(ctx
, dims
,
536 texImage
->_BaseFormat
,
538 texImage
->Data
, 0, 0, 0, /* dstX/Y/Zoffset */
540 texImage
->ImageOffsets
,
541 width
, height
, depth
,
542 format
, type
, pixels
, unpack
)) {
543 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
547 _mesa_unmap_teximage_pbo(ctx
, unpack
);
549 if (intelImage
->mt
) {
551 intel_miptree_image_unmap(intel
, intelImage
->mt
);
552 texImage
->Data
= NULL
;
555 UNLOCK_HARDWARE(intel
);
560 intelTexImage3D(GLcontext
* ctx
,
561 GLenum target
, GLint level
,
562 GLint internalFormat
,
563 GLint width
, GLint height
, GLint depth
,
565 GLenum format
, GLenum type
, const void *pixels
,
566 const struct gl_pixelstore_attrib
*unpack
,
567 struct gl_texture_object
*texObj
,
568 struct gl_texture_image
*texImage
)
570 intelTexImage(ctx
, 3, target
, level
,
571 internalFormat
, width
, height
, depth
, border
,
572 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
577 intelTexImage2D(GLcontext
* ctx
,
578 GLenum target
, GLint level
,
579 GLint internalFormat
,
580 GLint width
, GLint height
, GLint border
,
581 GLenum format
, GLenum type
, const void *pixels
,
582 const struct gl_pixelstore_attrib
*unpack
,
583 struct gl_texture_object
*texObj
,
584 struct gl_texture_image
*texImage
)
586 intelTexImage(ctx
, 2, target
, level
,
587 internalFormat
, width
, height
, 1, border
,
588 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
593 intelTexImage1D(GLcontext
* ctx
,
594 GLenum target
, GLint level
,
595 GLint internalFormat
,
596 GLint width
, GLint border
,
597 GLenum format
, GLenum type
, const void *pixels
,
598 const struct gl_pixelstore_attrib
*unpack
,
599 struct gl_texture_object
*texObj
,
600 struct gl_texture_image
*texImage
)
602 intelTexImage(ctx
, 1, target
, level
,
603 internalFormat
, width
, 1, 1, border
,
604 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
609 intelCompressedTexImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
610 GLint internalFormat
,
611 GLint width
, GLint height
, GLint border
,
612 GLsizei imageSize
, const GLvoid
*data
,
613 struct gl_texture_object
*texObj
,
614 struct gl_texture_image
*texImage
)
616 intelTexImage(ctx
, 2, target
, level
,
617 internalFormat
, width
, height
, 1, border
,
618 0, 0, data
, &ctx
->Unpack
, texObj
, texImage
, imageSize
, GL_TRUE
);
623 * Need to map texture image into memory before copying image data,
627 intel_get_tex_image(GLcontext
* ctx
, GLenum target
, GLint level
,
628 GLenum format
, GLenum type
, GLvoid
* pixels
,
629 struct gl_texture_object
*texObj
,
630 struct gl_texture_image
*texImage
, GLboolean compressed
)
632 struct intel_context
*intel
= intel_context(ctx
);
633 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
635 /* If we're reading from a texture that has been rendered to, need to
636 * make sure rendering is complete.
637 * We could probably predicate this on texObj->_RenderToTexture
642 if (intelImage
->mt
) {
643 /* Image is stored in hardware format in a buffer managed by the
644 * kernel. Need to explicitly map and unmap it.
646 intelImage
->base
.Data
=
647 intel_miptree_image_map(intel
,
651 &intelImage
->base
.RowStride
,
652 intelImage
->base
.ImageOffsets
);
653 intelImage
->base
.RowStride
/= intelImage
->mt
->cpp
;
656 /* Otherwise, the image should actually be stored in
657 * intelImage->base.Data. This is pretty confusing for
658 * everybody, I'd much prefer to separate the two functions of
659 * texImage->Data - storage for texture images in main memory
660 * and access (ie mappings) of images. In other words, we'd
661 * create a new texImage->Map field and leave Data simply for
664 assert(intelImage
->base
.Data
);
669 _mesa_get_compressed_teximage(ctx
, target
, level
, pixels
,
673 _mesa_get_teximage(ctx
, target
, level
, format
, type
, pixels
,
679 if (intelImage
->mt
) {
680 intel_miptree_image_unmap(intel
, intelImage
->mt
);
681 intelImage
->base
.Data
= NULL
;
687 intelGetTexImage(GLcontext
* ctx
, GLenum target
, GLint level
,
688 GLenum format
, GLenum type
, GLvoid
* pixels
,
689 struct gl_texture_object
*texObj
,
690 struct gl_texture_image
*texImage
)
692 intel_get_tex_image(ctx
, target
, level
, format
, type
, pixels
,
693 texObj
, texImage
, GL_FALSE
);
698 intelGetCompressedTexImage(GLcontext
*ctx
, GLenum target
, GLint level
,
700 struct gl_texture_object
*texObj
,
701 struct gl_texture_image
*texImage
)
703 intel_get_tex_image(ctx
, target
, level
, 0, 0, pixels
,
704 texObj
, texImage
, GL_TRUE
);
709 intelSetTexOffset(__DRIcontext
*pDRICtx
, GLint texname
,
710 unsigned long long offset
, GLint depth
, GLuint pitch
)
712 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
713 struct gl_texture_object
*tObj
= _mesa_lookup_texture(&intel
->ctx
, texname
);
714 struct intel_texture_object
*intelObj
= intel_texture_object(tObj
);
720 intel_miptree_release(intel
, &intelObj
->mt
);
722 intelObj
->imageOverride
= GL_TRUE
;
723 intelObj
->depthOverride
= depth
;
724 intelObj
->pitchOverride
= pitch
;
727 intelObj
->textureOffset
= offset
;
731 intelSetTexBuffer2(__DRIcontext
*pDRICtx
, GLint target
,
732 GLint glx_texture_format
,
733 __DRIdrawable
*dPriv
)
735 struct intel_framebuffer
*intel_fb
= dPriv
->driverPrivate
;
736 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
737 GLcontext
*ctx
= &intel
->ctx
;
738 struct intel_texture_object
*intelObj
;
739 struct intel_texture_image
*intelImage
;
740 struct intel_mipmap_tree
*mt
;
741 struct intel_renderbuffer
*rb
;
742 struct gl_texture_object
*texObj
;
743 struct gl_texture_image
*texImage
;
744 int level
= 0, internalFormat
;
746 texObj
= _mesa_get_current_tex_object(ctx
, target
);
747 intelObj
= intel_texture_object(texObj
);
752 intel_update_renderbuffers(pDRICtx
, dPriv
);
754 rb
= intel_fb
->color_rb
[0];
755 /* If the region isn't set, then intel_update_renderbuffers was unable
756 * to get the buffers for the drawable.
758 if (rb
->region
== NULL
)
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 if (glx_texture_format
== GLX_TEXTURE_FORMAT_RGB_EXT
)
792 texImage
->TexFormat
= MESA_FORMAT_XRGB8888
;
794 texImage
->TexFormat
= MESA_FORMAT_ARGB8888
;
795 texImage
->RowStride
= rb
->region
->pitch
;
796 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
798 if (!intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
799 fprintf(stderr
, "miptree doesn't match image\n");
802 _mesa_unlock_texture(&intel
->ctx
, texObj
);
806 intelSetTexBuffer(__DRIcontext
*pDRICtx
, GLint target
, __DRIdrawable
*dPriv
)
808 /* The old interface didn't have the format argument, so copy our
809 * implementation's behavior at the time.
811 intelSetTexBuffer2(pDRICtx
, target
, GLX_TEXTURE_FORMAT_RGBA_EXT
, dPriv
);
816 intelInitTextureImageFuncs(struct dd_function_table
*functions
)
818 functions
->TexImage1D
= intelTexImage1D
;
819 functions
->TexImage2D
= intelTexImage2D
;
820 functions
->TexImage3D
= intelTexImage3D
;
821 functions
->GetTexImage
= intelGetTexImage
;
823 functions
->CompressedTexImage2D
= intelCompressedTexImage2D
;
824 functions
->GetCompressedTexImage
= intelGetCompressedTexImage
;