2 #include "main/glheader.h"
3 #include "main/macros.h"
4 #include "main/mfeatures.h"
5 #include "main/mtypes.h"
6 #include "main/enums.h"
7 #include "main/bufferobj.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/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
59 static struct intel_mipmap_tree
*
60 intel_miptree_create_for_teximage(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 i
, comp_byte
= 0;
73 DBG("%s\n", __FUNCTION__
);
75 if (intelImage
->base
.Border
)
78 if (intelImage
->level
> intelObj
->base
.BaseLevel
&&
79 (intelImage
->base
.Width
== 1 ||
80 (intelObj
->base
.Target
!= GL_TEXTURE_1D
&&
81 intelImage
->base
.Height
== 1) ||
82 (intelObj
->base
.Target
== GL_TEXTURE_3D
&&
83 intelImage
->base
.Depth
== 1))) {
84 /* For this combination, we're at some lower mipmap level and
85 * some important dimension is 1. We can't extrapolate up to a
86 * likely base level width/height/depth for a full mipmap stack
87 * from this info, so just allocate this one level.
89 firstLevel
= intelImage
->level
;
90 lastLevel
= intelImage
->level
;
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
;
100 /* 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 (intel
->gen
< 4 || firstLevel
== 0)) {
118 lastLevel
= firstLevel
;
120 lastLevel
= firstLevel
+ logbase2(MAX2(MAX2(width
, height
), depth
));
124 if (_mesa_is_format_compressed(intelImage
->base
.TexFormat
))
125 comp_byte
= intel_compressed_num_bytes(intelImage
->base
.TexFormat
);
127 texelBytes
= _mesa_get_format_bytes(intelImage
->base
.TexFormat
);
129 return intel_miptree_create(intel
,
130 intelObj
->base
.Target
,
131 intelImage
->base
._BaseFormat
,
132 intelImage
->base
.InternalFormat
,
140 expect_accelerated_upload
);
147 target_to_face(GLenum target
)
150 case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
:
151 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
:
152 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
:
153 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
:
154 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
:
155 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
:
156 return ((GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
);
162 /* There are actually quite a few combinations this will work for,
163 * more than what I've listed here.
166 check_pbo_format(GLint internalFormat
,
167 GLenum format
, GLenum type
,
168 gl_format mesa_format
)
170 switch (internalFormat
) {
174 return (format
== GL_BGRA
&&
175 (type
== GL_UNSIGNED_BYTE
||
176 type
== GL_UNSIGNED_INT_8_8_8_8_REV
) &&
177 mesa_format
== MESA_FORMAT_ARGB8888
);
180 return (format
== GL_RGB
&&
181 type
== GL_UNSIGNED_SHORT_5_6_5
&&
182 mesa_format
== MESA_FORMAT_RGB565
);
185 return (format
== GL_LUMINANCE
&&
186 type
== GL_UNSIGNED_BYTE
&&
187 mesa_format
== MESA_FORMAT_L8
);
189 return (type
== GL_UNSIGNED_SHORT_8_8_MESA
|| type
== GL_UNSIGNED_BYTE
);
196 /* XXX: Do this for TexSubImage also:
199 try_pbo_upload(struct intel_context
*intel
,
200 struct intel_texture_image
*intelImage
,
201 const struct gl_pixelstore_attrib
*unpack
,
202 GLint internalFormat
,
203 GLint width
, GLint height
,
204 GLenum format
, GLenum type
, const void *pixels
)
206 struct intel_buffer_object
*pbo
= intel_buffer_object(unpack
->BufferObj
);
207 GLuint src_offset
, src_stride
;
208 GLuint dst_x
, dst_y
, dst_stride
;
209 drm_intel_bo
*dst_buffer
= intel_region_buffer(intel
,
210 intelImage
->mt
->region
,
213 if (!_mesa_is_bufferobj(unpack
->BufferObj
) ||
214 intel
->ctx
._ImageTransferState
||
215 unpack
->SkipPixels
|| unpack
->SkipRows
) {
216 DBG("%s: failure 1\n", __FUNCTION__
);
220 /* note: potential 64-bit ptr to 32-bit int cast */
221 src_offset
= (GLuint
) (unsigned long) pixels
;
223 if (unpack
->RowLength
> 0)
224 src_stride
= unpack
->RowLength
;
228 intel_miptree_get_image_offset(intelImage
->mt
, intelImage
->level
,
232 dst_stride
= intelImage
->mt
->region
->pitch
;
234 if (drm_intel_bo_references(intel
->batch
->buf
, dst_buffer
))
235 intel_flush(&intel
->ctx
);
238 drm_intel_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,
244 intelImage
->mt
->region
->tiling
,
245 0, 0, dst_x
, dst_y
, width
, height
,
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_x
, dst_y
, 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 intel_miptree_get_image_offset(intelImage
->mt
, intelImage
->level
,
286 dst_stride
= intelImage
->mt
->region
->pitch
;
288 if (src_stride
!= dst_stride
|| dst_x
!= 0 || dst_y
!= 0 ||
290 DBG("%s: failure 2\n", __FUNCTION__
);
294 intel_region_attach_pbo(intel
, intelImage
->mt
->region
, pbo
);
301 intelTexImage(struct gl_context
* ctx
,
303 GLenum target
, GLint level
,
304 GLint internalFormat
,
305 GLint width
, GLint height
, GLint depth
,
307 GLenum format
, GLenum type
, const void *pixels
,
308 const struct gl_pixelstore_attrib
*unpack
,
309 struct gl_texture_object
*texObj
,
310 struct gl_texture_image
*texImage
, GLsizei imageSize
,
311 GLboolean compressed
)
313 struct intel_context
*intel
= intel_context(ctx
);
314 struct intel_texture_object
*intelObj
= intel_texture_object(texObj
);
315 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
316 GLint texelBytes
, sizeInBytes
;
317 GLuint dstRowStride
= 0, srcRowStride
= texImage
->RowStride
;
319 DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__
,
320 _mesa_lookup_enum_by_nr(target
), level
, width
, height
, depth
, border
);
322 intelImage
->face
= target_to_face(target
);
323 intelImage
->level
= level
;
325 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
329 texelBytes
= _mesa_get_format_bytes(texImage
->TexFormat
);
331 if (!intelImage
->mt
) {
332 assert(texImage
->RowStride
== width
);
336 /* Release the reference to a potentially orphaned buffer.
337 * Release any old malloced memory.
339 if (intelImage
->mt
) {
340 intel_miptree_release(intel
, &intelImage
->mt
);
341 assert(!texImage
->Data
);
343 else if (texImage
->Data
) {
344 _mesa_free_texmemory(texImage
->Data
);
345 texImage
->Data
= NULL
;
348 assert(!intelImage
->mt
);
351 intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
352 /* Use an existing miptree when possible */
353 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
354 assert(intelImage
->mt
);
355 } else if (intelImage
->base
.Border
== 0) {
356 /* Didn't fit in the object miptree, but it's suitable for inclusion in
357 * a miptree, so create one just for our level and store it in the image.
358 * It'll get moved into the object miptree at validate time.
360 intelImage
->mt
= intel_miptree_create_for_teximage(intel
, intelObj
,
364 /* Even if the object currently has a mipmap tree associated
365 * with it, this one is a more likely candidate to represent the
366 * whole object since our level didn't fit what was there
367 * before, and any lower levels would fit into our miptree.
370 intel_miptree_reference(&intelObj
->mt
, intelImage
->mt
);
377 _mesa_is_bufferobj(unpack
->BufferObj
) &&
378 check_pbo_format(internalFormat
, format
,
379 type
, intelImage
->base
.TexFormat
)) {
381 DBG("trying pbo upload\n");
383 /* Attempt to texture directly from PBO data (zero copy upload).
385 * Currently disable as it can lead to worse as well as better
386 * performance (in particular when intel_region_cow() is
389 if (intelObj
->mt
== intelImage
->mt
&&
390 intelObj
->mt
->first_level
== level
&&
391 intelObj
->mt
->last_level
== level
) {
393 if (try_pbo_zcopy(intel
, intelImage
, unpack
,
395 width
, height
, format
, type
, pixels
)) {
397 DBG("pbo zcopy upload succeeded\n");
403 /* Otherwise, attempt to use the blitter for PBO image uploads.
405 if (try_pbo_upload(intel
, intelImage
, unpack
,
407 width
, height
, format
, type
, pixels
)) {
408 DBG("pbo upload succeeded\n");
412 DBG("pbo upload failed\n");
415 /* intelCopyTexImage calls this function with pixels == NULL, with
416 * the expectation that the mipmap tree will be set up but nothing
417 * more will be done. This is where those calls return:
420 pixels
= _mesa_validate_pbo_compressed_teximage(ctx
, imageSize
, pixels
,
422 "glCompressedTexImage");
424 pixels
= _mesa_validate_pbo_teximage(ctx
, dims
, width
, height
, 1,
426 pixels
, unpack
, "glTexImage");
429 if (intelImage
->mt
) {
430 if (pixels
!= NULL
) {
431 /* Flush any queued rendering with the texture before mapping. */
432 if (drm_intel_bo_references(intel
->batch
->buf
,
433 intelImage
->mt
->region
->buffer
)) {
436 texImage
->Data
= intel_miptree_image_map(intel
,
441 intelImage
->base
.ImageOffsets
);
444 texImage
->RowStride
= dstRowStride
/ intelImage
->mt
->cpp
;
447 /* Allocate regular memory and store the image there temporarily. */
448 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
449 sizeInBytes
= _mesa_format_image_size(texImage
->TexFormat
,
454 _mesa_format_row_stride(texImage
->TexFormat
, width
);
458 dstRowStride
= width
* texelBytes
;
459 sizeInBytes
= depth
* dstRowStride
* height
;
462 texImage
->Data
= _mesa_alloc_texmemory(sizeInBytes
);
465 DBG("Upload image %dx%dx%d row_len %d "
466 "pitch %d pixels %d compressed %d\n",
467 width
, height
, depth
, width
* texelBytes
, dstRowStride
,
468 pixels
? 1 : 0, compressed
);
470 /* Copy data. Would like to know when it's ok for us to eg. use
471 * the blitter to copy. Or, use the hardware to do the format
472 * conversion and copy:
476 if (intelImage
->mt
) {
477 struct intel_region
*dst
= intelImage
->mt
->region
;
478 _mesa_copy_rect(texImage
->Data
, dst
->cpp
, dst
->pitch
,
480 intelImage
->mt
->level
[level
].width
,
481 (intelImage
->mt
->level
[level
].height
+3)/4,
487 memcpy(texImage
->Data
, pixels
, imageSize
);
490 else if (!_mesa_texstore(ctx
, dims
,
491 texImage
->_BaseFormat
,
493 texImage
->Data
, 0, 0, 0, /* dstX/Y/Zoffset */
495 texImage
->ImageOffsets
,
496 width
, height
, depth
,
497 format
, type
, pixels
, unpack
)) {
498 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
502 _mesa_unmap_teximage_pbo(ctx
, unpack
);
504 if (intelImage
->mt
) {
506 intel_miptree_image_unmap(intel
, intelImage
->mt
);
507 texImage
->Data
= NULL
;
513 intelTexImage3D(struct gl_context
* ctx
,
514 GLenum target
, GLint level
,
515 GLint internalFormat
,
516 GLint width
, GLint height
, GLint depth
,
518 GLenum format
, GLenum type
, const void *pixels
,
519 const struct gl_pixelstore_attrib
*unpack
,
520 struct gl_texture_object
*texObj
,
521 struct gl_texture_image
*texImage
)
523 intelTexImage(ctx
, 3, target
, level
,
524 internalFormat
, width
, height
, depth
, border
,
525 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
530 intelTexImage2D(struct gl_context
* ctx
,
531 GLenum target
, GLint level
,
532 GLint internalFormat
,
533 GLint width
, GLint height
, GLint border
,
534 GLenum format
, GLenum type
, const void *pixels
,
535 const struct gl_pixelstore_attrib
*unpack
,
536 struct gl_texture_object
*texObj
,
537 struct gl_texture_image
*texImage
)
539 intelTexImage(ctx
, 2, target
, level
,
540 internalFormat
, width
, height
, 1, border
,
541 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
546 intelTexImage1D(struct gl_context
* ctx
,
547 GLenum target
, GLint level
,
548 GLint internalFormat
,
549 GLint width
, GLint border
,
550 GLenum format
, GLenum type
, const void *pixels
,
551 const struct gl_pixelstore_attrib
*unpack
,
552 struct gl_texture_object
*texObj
,
553 struct gl_texture_image
*texImage
)
555 intelTexImage(ctx
, 1, target
, level
,
556 internalFormat
, width
, 1, 1, border
,
557 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
562 intelCompressedTexImage2D( struct gl_context
*ctx
, GLenum target
, GLint level
,
563 GLint internalFormat
,
564 GLint width
, GLint height
, GLint border
,
565 GLsizei imageSize
, const GLvoid
*data
,
566 struct gl_texture_object
*texObj
,
567 struct gl_texture_image
*texImage
)
569 intelTexImage(ctx
, 2, target
, level
,
570 internalFormat
, width
, height
, 1, border
,
571 0, 0, data
, &ctx
->Unpack
, texObj
, texImage
, imageSize
, GL_TRUE
);
576 * Need to map texture image into memory before copying image data,
580 intel_get_tex_image(struct gl_context
* ctx
, GLenum target
, GLint level
,
581 GLenum format
, GLenum type
, GLvoid
* pixels
,
582 struct gl_texture_object
*texObj
,
583 struct gl_texture_image
*texImage
, GLboolean compressed
)
585 struct intel_context
*intel
= intel_context(ctx
);
586 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
588 /* If we're reading from a texture that has been rendered to, need to
589 * make sure rendering is complete.
590 * We could probably predicate this on texObj->_RenderToTexture
595 if (intelImage
->mt
) {
596 /* Image is stored in hardware format in a buffer managed by the
597 * kernel. Need to explicitly map and unmap it.
599 intelImage
->base
.Data
=
600 intel_miptree_image_map(intel
,
604 &intelImage
->base
.RowStride
,
605 intelImage
->base
.ImageOffsets
);
606 intelImage
->base
.RowStride
/= intelImage
->mt
->cpp
;
609 /* Otherwise, the image should actually be stored in
610 * intelImage->base.Data. This is pretty confusing for
611 * everybody, I'd much prefer to separate the two functions of
612 * texImage->Data - storage for texture images in main memory
613 * and access (ie mappings) of images. In other words, we'd
614 * create a new texImage->Map field and leave Data simply for
617 assert(intelImage
->base
.Data
);
622 _mesa_get_compressed_teximage(ctx
, target
, level
, pixels
,
626 _mesa_get_teximage(ctx
, target
, level
, format
, type
, pixels
,
632 if (intelImage
->mt
) {
633 intel_miptree_image_unmap(intel
, intelImage
->mt
);
634 intelImage
->base
.Data
= NULL
;
640 intelGetTexImage(struct gl_context
* ctx
, GLenum target
, GLint level
,
641 GLenum format
, GLenum type
, GLvoid
* pixels
,
642 struct gl_texture_object
*texObj
,
643 struct gl_texture_image
*texImage
)
645 intel_get_tex_image(ctx
, target
, level
, format
, type
, pixels
,
646 texObj
, texImage
, GL_FALSE
);
651 intelGetCompressedTexImage(struct gl_context
*ctx
, GLenum target
, GLint level
,
653 struct gl_texture_object
*texObj
,
654 struct gl_texture_image
*texImage
)
656 intel_get_tex_image(ctx
, target
, level
, 0, 0, pixels
,
657 texObj
, texImage
, GL_TRUE
);
661 intelSetTexBuffer2(__DRIcontext
*pDRICtx
, GLint target
,
662 GLint texture_format
,
663 __DRIdrawable
*dPriv
)
665 struct gl_framebuffer
*fb
= dPriv
->driverPrivate
;
666 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
667 struct gl_context
*ctx
= &intel
->ctx
;
668 struct intel_texture_object
*intelObj
;
669 struct intel_texture_image
*intelImage
;
670 struct intel_mipmap_tree
*mt
;
671 struct intel_renderbuffer
*rb
;
672 struct gl_texture_object
*texObj
;
673 struct gl_texture_image
*texImage
;
674 int level
= 0, internalFormat
;
677 texObj
= _mesa_get_current_tex_object(ctx
, target
);
678 intelObj
= intel_texture_object(texObj
);
683 if (dPriv
->lastStamp
!= dPriv
->dri2
.stamp
||
684 !pDRICtx
->driScreenPriv
->dri2
.useInvalidate
)
685 intel_update_renderbuffers(pDRICtx
, dPriv
);
687 rb
= intel_get_renderbuffer(fb
, BUFFER_FRONT_LEFT
);
688 /* If the region isn't set, then intel_update_renderbuffers was unable
689 * to get the buffers for the drawable.
691 if (rb
->region
== NULL
)
694 if (texture_format
== __DRI_TEXTURE_FORMAT_RGB
) {
695 internalFormat
= GL_RGB
;
696 texFormat
= MESA_FORMAT_XRGB8888
;
699 internalFormat
= GL_RGBA
;
700 texFormat
= MESA_FORMAT_ARGB8888
;
703 mt
= intel_miptree_create_for_region(intel
, target
,
704 internalFormat
, rb
->region
, 1, 0);
708 _mesa_lock_texture(&intel
->ctx
, texObj
);
710 texImage
= _mesa_get_tex_image(&intel
->ctx
, texObj
, target
, level
);
711 intelImage
= intel_texture_image(texImage
);
713 if (intelImage
->mt
) {
714 intel_miptree_release(intel
, &intelImage
->mt
);
715 assert(!texImage
->Data
);
718 intel_miptree_release(intel
, &intelObj
->mt
);
722 _mesa_init_teximage_fields(&intel
->ctx
, target
, texImage
,
723 rb
->region
->width
, rb
->region
->height
, 1,
724 0, internalFormat
, texFormat
);
726 intelImage
->face
= target_to_face(target
);
727 intelImage
->level
= level
;
728 texImage
->RowStride
= rb
->region
->pitch
;
729 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
731 if (!intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
732 fprintf(stderr
, "miptree doesn't match image\n");
735 _mesa_unlock_texture(&intel
->ctx
, texObj
);
739 intelSetTexBuffer(__DRIcontext
*pDRICtx
, GLint target
, __DRIdrawable
*dPriv
)
741 /* The old interface didn't have the format argument, so copy our
742 * implementation's behavior at the time.
744 intelSetTexBuffer2(pDRICtx
, target
, __DRI_TEXTURE_FORMAT_RGBA
, dPriv
);
747 #if FEATURE_OES_EGL_image
749 intel_image_target_texture_2d(struct gl_context
*ctx
, GLenum target
,
750 struct gl_texture_object
*texObj
,
751 struct gl_texture_image
*texImage
,
752 GLeglImageOES image_handle
)
754 struct intel_context
*intel
= intel_context(ctx
);
755 struct intel_texture_object
*intelObj
= intel_texture_object(texObj
);
756 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
757 struct intel_mipmap_tree
*mt
;
761 screen
= intel
->intelScreen
->driScrnPriv
;
762 image
= screen
->dri2
.image
->lookupEGLImage(screen
, image_handle
,
763 screen
->loaderPrivate
);
767 mt
= intel_miptree_create_for_region(intel
, target
,
768 image
->internal_format
,
769 image
->region
, 1, 0);
773 if (intelImage
->mt
) {
774 intel_miptree_release(intel
, &intelImage
->mt
);
775 assert(!texImage
->Data
);
778 intel_miptree_release(intel
, &intelObj
->mt
);
781 _mesa_init_teximage_fields(&intel
->ctx
, target
, texImage
,
782 image
->region
->width
, image
->region
->height
, 1,
783 0, image
->internal_format
, image
->format
);
785 intelImage
->face
= target_to_face(target
);
786 intelImage
->level
= 0;
787 texImage
->RowStride
= image
->region
->pitch
;
788 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
790 if (!intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
))
791 fprintf(stderr
, "miptree doesn't match image\n");
796 intelInitTextureImageFuncs(struct dd_function_table
*functions
)
798 functions
->TexImage1D
= intelTexImage1D
;
799 functions
->TexImage2D
= intelTexImage2D
;
800 functions
->TexImage3D
= intelTexImage3D
;
801 functions
->GetTexImage
= intelGetTexImage
;
803 functions
->CompressedTexImage2D
= intelCompressedTexImage2D
;
804 functions
->GetCompressedTexImage
= intelGetCompressedTexImage
;
806 #if FEATURE_OES_EGL_image
807 functions
->EGLImageTargetTexture2D
= intel_image_target_texture_2d
;