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 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
);
237 LOCK_HARDWARE(intel
);
239 dri_bo
*src_buffer
= intel_bufferobj_buffer(intel
, pbo
, INTEL_READ
);
241 if (!intelEmitCopyBlit(intel
,
243 src_stride
, src_buffer
, src_offset
, GL_FALSE
,
244 dst_stride
, dst_buffer
, 0, GL_FALSE
,
245 0, 0, dst_x
, dst_y
, width
, height
,
247 UNLOCK_HARDWARE(intel
);
251 UNLOCK_HARDWARE(intel
);
258 try_pbo_zcopy(struct intel_context
*intel
,
259 struct intel_texture_image
*intelImage
,
260 const struct gl_pixelstore_attrib
*unpack
,
261 GLint internalFormat
,
262 GLint width
, GLint height
,
263 GLenum format
, GLenum type
, const void *pixels
)
265 struct intel_buffer_object
*pbo
= intel_buffer_object(unpack
->BufferObj
);
266 GLuint src_offset
, src_stride
;
267 GLuint dst_x
, dst_y
, dst_stride
;
269 if (!_mesa_is_bufferobj(unpack
->BufferObj
) ||
270 intel
->ctx
._ImageTransferState
||
271 unpack
->SkipPixels
|| unpack
->SkipRows
) {
272 DBG("%s: failure 1\n", __FUNCTION__
);
276 /* note: potential 64-bit ptr to 32-bit int cast */
277 src_offset
= (GLuint
) (unsigned long) pixels
;
279 if (unpack
->RowLength
> 0)
280 src_stride
= unpack
->RowLength
;
284 intel_miptree_get_image_offset(intelImage
->mt
, intelImage
->level
,
288 dst_stride
= intelImage
->mt
->pitch
;
290 if (src_stride
!= dst_stride
|| dst_x
!= 0 || dst_y
!= 0 ||
292 DBG("%s: failure 2\n", __FUNCTION__
);
296 intel_region_attach_pbo(intel
, intelImage
->mt
->region
, pbo
);
303 intelTexImage(GLcontext
* ctx
,
305 GLenum target
, GLint level
,
306 GLint internalFormat
,
307 GLint width
, GLint height
, GLint depth
,
309 GLenum format
, GLenum type
, const void *pixels
,
310 const struct gl_pixelstore_attrib
*unpack
,
311 struct gl_texture_object
*texObj
,
312 struct gl_texture_image
*texImage
, GLsizei imageSize
,
313 GLboolean compressed
)
315 struct intel_context
*intel
= intel_context(ctx
);
316 struct intel_texture_object
*intelObj
= intel_texture_object(texObj
);
317 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
318 GLint postConvWidth
= width
;
319 GLint postConvHeight
= height
;
320 GLint texelBytes
, sizeInBytes
;
321 GLuint dstRowStride
= 0, srcRowStride
= texImage
->RowStride
;
323 DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__
,
324 _mesa_lookup_enum_by_nr(target
), level
, width
, height
, depth
, border
);
326 intelImage
->face
= target_to_face(target
);
327 intelImage
->level
= level
;
329 if (ctx
->_ImageTransferState
& IMAGE_CONVOLUTION_BIT
) {
330 _mesa_adjust_image_for_convolution(ctx
, dims
, &postConvWidth
,
334 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
338 texelBytes
= _mesa_get_format_bytes(texImage
->TexFormat
);
340 /* Minimum pitch of 32 bytes */
341 if (postConvWidth
* texelBytes
< 32) {
342 postConvWidth
= 32 / texelBytes
;
343 texImage
->RowStride
= postConvWidth
;
346 if (!intelImage
->mt
) {
347 assert(texImage
->RowStride
== postConvWidth
);
351 /* Release the reference to a potentially orphaned buffer.
352 * Release any old malloced memory.
354 if (intelImage
->mt
) {
355 intel_miptree_release(intel
, &intelImage
->mt
);
356 assert(!texImage
->Data
);
358 else if (texImage
->Data
) {
359 _mesa_free_texmemory(texImage
->Data
);
360 texImage
->Data
= NULL
;
363 /* If this is the only texture image in the tree, could call
364 * bmBufferData with NULL data to free the old block and avoid
365 * waiting on any outstanding fences.
368 intelObj
->mt
->first_level
== level
&&
369 intelObj
->mt
->last_level
== level
&&
370 intelObj
->mt
->target
!= GL_TEXTURE_CUBE_MAP_ARB
&&
371 !intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
374 intel_miptree_release(intel
, &intelObj
->mt
);
375 assert(!intelObj
->mt
);
379 guess_and_alloc_mipmap_tree(intel
, intelObj
, intelImage
, pixels
== NULL
);
381 DBG("guess_and_alloc_mipmap_tree: failed\n");
385 assert(!intelImage
->mt
);
388 intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
390 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
391 assert(intelImage
->mt
);
392 } else if (intelImage
->base
.Border
== 0) {
394 GLuint texelBytes
= _mesa_get_format_bytes(intelImage
->base
.TexFormat
);
395 GLenum baseFormat
= _mesa_get_format_base_format(intelImage
->base
.TexFormat
);
396 if (_mesa_is_format_compressed(intelImage
->base
.TexFormat
)) {
398 intel_compressed_num_bytes(intelImage
->base
.TexFormat
);
401 /* Didn't fit in the object miptree, but it's suitable for inclusion in
402 * a miptree, so create one just for our level and store it in the image.
403 * It'll get moved into the object miptree at validate time.
405 intelImage
->mt
= intel_miptree_create(intel
, target
,
409 width
, height
, depth
,
411 comp_byte
, pixels
== NULL
);
419 _mesa_is_bufferobj(unpack
->BufferObj
) &&
420 check_pbo_format(internalFormat
, format
,
421 type
, intelImage
->base
.TexFormat
)) {
423 DBG("trying pbo upload\n");
425 /* Attempt to texture directly from PBO data (zero copy upload).
427 * Currently disable as it can lead to worse as well as better
428 * performance (in particular when intel_region_cow() is
431 if (intelObj
->mt
== intelImage
->mt
&&
432 intelObj
->mt
->first_level
== level
&&
433 intelObj
->mt
->last_level
== level
) {
435 if (try_pbo_zcopy(intel
, intelImage
, unpack
,
437 width
, height
, format
, type
, pixels
)) {
439 DBG("pbo zcopy upload succeeded\n");
445 /* Otherwise, attempt to use the blitter for PBO image uploads.
447 if (try_pbo_upload(intel
, intelImage
, unpack
,
449 width
, height
, format
, type
, pixels
)) {
450 DBG("pbo upload succeeded\n");
454 DBG("pbo upload failed\n");
457 /* intelCopyTexImage calls this function with pixels == NULL, with
458 * the expectation that the mipmap tree will be set up but nothing
459 * more will be done. This is where those calls return:
462 pixels
= _mesa_validate_pbo_compressed_teximage(ctx
, imageSize
, pixels
,
464 "glCompressedTexImage");
466 pixels
= _mesa_validate_pbo_teximage(ctx
, dims
, width
, height
, 1,
468 pixels
, unpack
, "glTexImage");
471 LOCK_HARDWARE(intel
);
473 if (intelImage
->mt
) {
474 if (pixels
!= NULL
) {
475 /* Flush any queued rendering with the texture before mapping. */
476 if (drm_intel_bo_references(intel
->batch
->buf
,
477 intelImage
->mt
->region
->buffer
)) {
480 texImage
->Data
= intel_miptree_image_map(intel
,
485 intelImage
->base
.ImageOffsets
);
488 texImage
->RowStride
= dstRowStride
/ intelImage
->mt
->cpp
;
491 /* Allocate regular memory and store the image there temporarily. */
492 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
493 sizeInBytes
= _mesa_format_image_size(texImage
->TexFormat
,
498 _mesa_format_row_stride(texImage
->TexFormat
, width
);
502 dstRowStride
= postConvWidth
* texelBytes
;
503 sizeInBytes
= depth
* dstRowStride
* postConvHeight
;
506 texImage
->Data
= _mesa_alloc_texmemory(sizeInBytes
);
509 DBG("Upload image %dx%dx%d row_len %d "
510 "pitch %d pixels %d compressed %d\n",
511 width
, height
, depth
, width
* texelBytes
, dstRowStride
,
512 pixels
? 1 : 0, compressed
);
514 /* Copy data. Would like to know when it's ok for us to eg. use
515 * the blitter to copy. Or, use the hardware to do the format
516 * conversion and copy:
520 if (intelImage
->mt
) {
521 struct intel_region
*dst
= intelImage
->mt
->region
;
522 _mesa_copy_rect(texImage
->Data
, dst
->cpp
, dst
->pitch
,
524 intelImage
->mt
->level
[level
].width
,
525 (intelImage
->mt
->level
[level
].height
+3)/4,
531 memcpy(texImage
->Data
, pixels
, imageSize
);
534 else if (!_mesa_texstore(ctx
, dims
,
535 texImage
->_BaseFormat
,
537 texImage
->Data
, 0, 0, 0, /* dstX/Y/Zoffset */
539 texImage
->ImageOffsets
,
540 width
, height
, depth
,
541 format
, type
, pixels
, unpack
)) {
542 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
546 _mesa_unmap_teximage_pbo(ctx
, unpack
);
548 if (intelImage
->mt
) {
550 intel_miptree_image_unmap(intel
, intelImage
->mt
);
551 texImage
->Data
= NULL
;
554 UNLOCK_HARDWARE(intel
);
559 intelTexImage3D(GLcontext
* ctx
,
560 GLenum target
, GLint level
,
561 GLint internalFormat
,
562 GLint width
, GLint height
, GLint depth
,
564 GLenum format
, GLenum type
, const void *pixels
,
565 const struct gl_pixelstore_attrib
*unpack
,
566 struct gl_texture_object
*texObj
,
567 struct gl_texture_image
*texImage
)
569 intelTexImage(ctx
, 3, target
, level
,
570 internalFormat
, width
, height
, depth
, border
,
571 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
576 intelTexImage2D(GLcontext
* ctx
,
577 GLenum target
, GLint level
,
578 GLint internalFormat
,
579 GLint width
, GLint height
, GLint border
,
580 GLenum format
, GLenum type
, const void *pixels
,
581 const struct gl_pixelstore_attrib
*unpack
,
582 struct gl_texture_object
*texObj
,
583 struct gl_texture_image
*texImage
)
585 intelTexImage(ctx
, 2, target
, level
,
586 internalFormat
, width
, height
, 1, border
,
587 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
592 intelTexImage1D(GLcontext
* ctx
,
593 GLenum target
, GLint level
,
594 GLint internalFormat
,
595 GLint width
, GLint border
,
596 GLenum format
, GLenum type
, const void *pixels
,
597 const struct gl_pixelstore_attrib
*unpack
,
598 struct gl_texture_object
*texObj
,
599 struct gl_texture_image
*texImage
)
601 intelTexImage(ctx
, 1, target
, level
,
602 internalFormat
, width
, 1, 1, border
,
603 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
608 intelCompressedTexImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
609 GLint internalFormat
,
610 GLint width
, GLint height
, GLint border
,
611 GLsizei imageSize
, const GLvoid
*data
,
612 struct gl_texture_object
*texObj
,
613 struct gl_texture_image
*texImage
)
615 intelTexImage(ctx
, 2, target
, level
,
616 internalFormat
, width
, height
, 1, border
,
617 0, 0, data
, &ctx
->Unpack
, texObj
, texImage
, imageSize
, GL_TRUE
);
622 * Need to map texture image into memory before copying image data,
626 intel_get_tex_image(GLcontext
* ctx
, GLenum target
, GLint level
,
627 GLenum format
, GLenum type
, GLvoid
* pixels
,
628 struct gl_texture_object
*texObj
,
629 struct gl_texture_image
*texImage
, GLboolean compressed
)
631 struct intel_context
*intel
= intel_context(ctx
);
632 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
634 /* If we're reading from a texture that has been rendered to, need to
635 * make sure rendering is complete.
636 * We could probably predicate this on texObj->_RenderToTexture
641 if (intelImage
->mt
) {
642 /* Image is stored in hardware format in a buffer managed by the
643 * kernel. Need to explicitly map and unmap it.
645 intelImage
->base
.Data
=
646 intel_miptree_image_map(intel
,
650 &intelImage
->base
.RowStride
,
651 intelImage
->base
.ImageOffsets
);
652 intelImage
->base
.RowStride
/= intelImage
->mt
->cpp
;
655 /* Otherwise, the image should actually be stored in
656 * intelImage->base.Data. This is pretty confusing for
657 * everybody, I'd much prefer to separate the two functions of
658 * texImage->Data - storage for texture images in main memory
659 * and access (ie mappings) of images. In other words, we'd
660 * create a new texImage->Map field and leave Data simply for
663 assert(intelImage
->base
.Data
);
668 _mesa_get_compressed_teximage(ctx
, target
, level
, pixels
,
672 _mesa_get_teximage(ctx
, target
, level
, format
, type
, pixels
,
678 if (intelImage
->mt
) {
679 intel_miptree_image_unmap(intel
, intelImage
->mt
);
680 intelImage
->base
.Data
= NULL
;
686 intelGetTexImage(GLcontext
* ctx
, GLenum target
, GLint level
,
687 GLenum format
, GLenum type
, GLvoid
* pixels
,
688 struct gl_texture_object
*texObj
,
689 struct gl_texture_image
*texImage
)
691 intel_get_tex_image(ctx
, target
, level
, format
, type
, pixels
,
692 texObj
, texImage
, GL_FALSE
);
697 intelGetCompressedTexImage(GLcontext
*ctx
, GLenum target
, GLint level
,
699 struct gl_texture_object
*texObj
,
700 struct gl_texture_image
*texImage
)
702 intel_get_tex_image(ctx
, target
, level
, 0, 0, pixels
,
703 texObj
, texImage
, GL_TRUE
);
708 intelSetTexOffset(__DRIcontext
*pDRICtx
, GLint texname
,
709 unsigned long long offset
, GLint depth
, GLuint pitch
)
711 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
712 struct gl_texture_object
*tObj
= _mesa_lookup_texture(&intel
->ctx
, texname
);
713 struct intel_texture_object
*intelObj
= intel_texture_object(tObj
);
719 intel_miptree_release(intel
, &intelObj
->mt
);
721 intelObj
->imageOverride
= GL_TRUE
;
722 intelObj
->depthOverride
= depth
;
723 intelObj
->pitchOverride
= pitch
;
726 intelObj
->textureOffset
= offset
;
730 intelSetTexBuffer2(__DRIcontext
*pDRICtx
, GLint target
,
731 GLint glx_texture_format
,
732 __DRIdrawable
*dPriv
)
734 struct intel_framebuffer
*intel_fb
= dPriv
->driverPrivate
;
735 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
736 struct intel_texture_object
*intelObj
;
737 struct intel_texture_image
*intelImage
;
738 struct intel_mipmap_tree
*mt
;
739 struct intel_renderbuffer
*rb
;
740 struct gl_texture_unit
*texUnit
;
741 struct gl_texture_object
*texObj
;
742 struct gl_texture_image
*texImage
;
743 int level
= 0, internalFormat
;
745 texUnit
= &intel
->ctx
.Texture
.Unit
[intel
->ctx
.Texture
.CurrentUnit
];
746 texObj
= _mesa_select_tex_object(&intel
->ctx
, texUnit
, 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
;