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
.bo
, dst_buffer
))
235 intel_flush(&intel
->ctx
);
239 drm_intel_bo
*src_buffer
= intel_bufferobj_source(intel
, pbo
, &offset
);
241 if (!intelEmitCopyBlit(intel
,
243 src_stride
, src_buffer
,
244 src_offset
+ offset
, GL_FALSE
,
245 dst_stride
, dst_buffer
, 0,
246 intelImage
->mt
->region
->tiling
,
247 0, 0, dst_x
, dst_y
, width
, height
,
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
->region
->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(struct gl_context
* 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 texelBytes
, sizeInBytes
;
319 GLuint dstRowStride
= 0, srcRowStride
= texImage
->RowStride
;
321 DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__
,
322 _mesa_lookup_enum_by_nr(target
), level
, width
, height
, depth
, border
);
324 intelImage
->face
= target_to_face(target
);
325 intelImage
->level
= level
;
327 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
331 texelBytes
= _mesa_get_format_bytes(texImage
->TexFormat
);
333 if (!intelImage
->mt
) {
334 assert(texImage
->RowStride
== width
);
338 /* Release the reference to a potentially orphaned buffer.
339 * Release any old malloced memory.
341 if (intelImage
->mt
) {
342 intel_miptree_release(intel
, &intelImage
->mt
);
343 assert(!texImage
->Data
);
345 else if (texImage
->Data
) {
346 _mesa_free_texmemory(texImage
->Data
);
347 texImage
->Data
= NULL
;
350 assert(!intelImage
->mt
);
353 intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
354 /* Use an existing miptree when possible */
355 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
356 assert(intelImage
->mt
);
357 } else if (intelImage
->base
.Border
== 0) {
358 /* Didn't fit in the object miptree, but it's suitable for inclusion in
359 * a miptree, so create one just for our level and store it in the image.
360 * It'll get moved into the object miptree at validate time.
362 intelImage
->mt
= intel_miptree_create_for_teximage(intel
, intelObj
,
366 /* Even if the object currently has a mipmap tree associated
367 * with it, this one is a more likely candidate to represent the
368 * whole object since our level didn't fit what was there
369 * before, and any lower levels would fit into our miptree.
372 intel_miptree_reference(&intelObj
->mt
, intelImage
->mt
);
379 _mesa_is_bufferobj(unpack
->BufferObj
) &&
380 check_pbo_format(internalFormat
, format
,
381 type
, intelImage
->base
.TexFormat
)) {
383 DBG("trying pbo upload\n");
385 /* Attempt to texture directly from PBO data (zero copy upload).
387 * Currently disable as it can lead to worse as well as better
388 * performance (in particular when intel_region_cow() is
391 if (intelObj
->mt
== intelImage
->mt
&&
392 intelObj
->mt
->first_level
== level
&&
393 intelObj
->mt
->last_level
== level
) {
395 if (try_pbo_zcopy(intel
, intelImage
, unpack
,
397 width
, height
, format
, type
, pixels
)) {
399 DBG("pbo zcopy upload succeeded\n");
405 /* Otherwise, attempt to use the blitter for PBO image uploads.
407 if (try_pbo_upload(intel
, intelImage
, unpack
,
409 width
, height
, format
, type
, pixels
)) {
410 DBG("pbo upload succeeded\n");
414 DBG("pbo upload failed\n");
417 /* intelCopyTexImage calls this function with pixels == NULL, with
418 * the expectation that the mipmap tree will be set up but nothing
419 * more will be done. This is where those calls return:
422 pixels
= _mesa_validate_pbo_compressed_teximage(ctx
, imageSize
, pixels
,
424 "glCompressedTexImage");
426 pixels
= _mesa_validate_pbo_teximage(ctx
, dims
, width
, height
, 1,
428 pixels
, unpack
, "glTexImage");
431 if (intelImage
->mt
) {
432 if (pixels
!= NULL
) {
433 /* Flush any queued rendering with the texture before mapping. */
434 if (drm_intel_bo_references(intel
->batch
.bo
,
435 intelImage
->mt
->region
->buffer
)) {
438 texImage
->Data
= intel_miptree_image_map(intel
,
443 intelImage
->base
.ImageOffsets
);
446 texImage
->RowStride
= dstRowStride
/ intelImage
->mt
->cpp
;
449 /* Allocate regular memory and store the image there temporarily. */
450 if (_mesa_is_format_compressed(texImage
->TexFormat
)) {
451 sizeInBytes
= _mesa_format_image_size(texImage
->TexFormat
,
456 _mesa_format_row_stride(texImage
->TexFormat
, width
);
460 dstRowStride
= width
* texelBytes
;
461 sizeInBytes
= depth
* dstRowStride
* height
;
464 texImage
->Data
= _mesa_alloc_texmemory(sizeInBytes
);
467 DBG("Upload image %dx%dx%d row_len %d "
468 "pitch %d pixels %d compressed %d\n",
469 width
, height
, depth
, width
* texelBytes
, dstRowStride
,
470 pixels
? 1 : 0, compressed
);
472 /* Copy data. Would like to know when it's ok for us to eg. use
473 * the blitter to copy. Or, use the hardware to do the format
474 * conversion and copy:
478 if (intelImage
->mt
) {
479 struct intel_region
*dst
= intelImage
->mt
->region
;
480 _mesa_copy_rect(texImage
->Data
, dst
->cpp
, dst
->pitch
,
482 intelImage
->mt
->level
[level
].width
,
483 (intelImage
->mt
->level
[level
].height
+3)/4,
489 memcpy(texImage
->Data
, pixels
, imageSize
);
492 else if (!_mesa_texstore(ctx
, dims
,
493 texImage
->_BaseFormat
,
495 texImage
->Data
, 0, 0, 0, /* dstX/Y/Zoffset */
497 texImage
->ImageOffsets
,
498 width
, height
, depth
,
499 format
, type
, pixels
, unpack
)) {
500 _mesa_error(ctx
, GL_OUT_OF_MEMORY
, "glTexImage");
504 _mesa_unmap_teximage_pbo(ctx
, unpack
);
506 if (intelImage
->mt
) {
508 intel_miptree_image_unmap(intel
, intelImage
->mt
);
509 texImage
->Data
= NULL
;
515 intelTexImage3D(struct gl_context
* ctx
,
516 GLenum target
, GLint level
,
517 GLint internalFormat
,
518 GLint width
, GLint height
, GLint depth
,
520 GLenum format
, GLenum type
, const void *pixels
,
521 const struct gl_pixelstore_attrib
*unpack
,
522 struct gl_texture_object
*texObj
,
523 struct gl_texture_image
*texImage
)
525 intelTexImage(ctx
, 3, target
, level
,
526 internalFormat
, width
, height
, depth
, border
,
527 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
532 intelTexImage2D(struct gl_context
* ctx
,
533 GLenum target
, GLint level
,
534 GLint internalFormat
,
535 GLint width
, GLint height
, GLint border
,
536 GLenum format
, GLenum type
, const void *pixels
,
537 const struct gl_pixelstore_attrib
*unpack
,
538 struct gl_texture_object
*texObj
,
539 struct gl_texture_image
*texImage
)
541 intelTexImage(ctx
, 2, target
, level
,
542 internalFormat
, width
, height
, 1, border
,
543 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
548 intelTexImage1D(struct gl_context
* ctx
,
549 GLenum target
, GLint level
,
550 GLint internalFormat
,
551 GLint width
, GLint border
,
552 GLenum format
, GLenum type
, const void *pixels
,
553 const struct gl_pixelstore_attrib
*unpack
,
554 struct gl_texture_object
*texObj
,
555 struct gl_texture_image
*texImage
)
557 intelTexImage(ctx
, 1, target
, level
,
558 internalFormat
, width
, 1, 1, border
,
559 format
, type
, pixels
, unpack
, texObj
, texImage
, 0, GL_FALSE
);
564 intelCompressedTexImage2D( struct gl_context
*ctx
, GLenum target
, GLint level
,
565 GLint internalFormat
,
566 GLint width
, GLint height
, GLint border
,
567 GLsizei imageSize
, const GLvoid
*data
,
568 struct gl_texture_object
*texObj
,
569 struct gl_texture_image
*texImage
)
571 intelTexImage(ctx
, 2, target
, level
,
572 internalFormat
, width
, height
, 1, border
,
573 0, 0, data
, &ctx
->Unpack
, texObj
, texImage
, imageSize
, GL_TRUE
);
578 * Need to map texture image into memory before copying image data,
582 intel_get_tex_image(struct gl_context
* ctx
, GLenum target
, GLint level
,
583 GLenum format
, GLenum type
, GLvoid
* pixels
,
584 struct gl_texture_object
*texObj
,
585 struct gl_texture_image
*texImage
, GLboolean compressed
)
587 struct intel_context
*intel
= intel_context(ctx
);
588 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
590 /* If we're reading from a texture that has been rendered to, need to
591 * make sure rendering is complete.
592 * We could probably predicate this on texObj->_RenderToTexture
597 if (intelImage
->mt
) {
598 /* Image is stored in hardware format in a buffer managed by the
599 * kernel. Need to explicitly map and unmap it.
601 intelImage
->base
.Data
=
602 intel_miptree_image_map(intel
,
606 &intelImage
->base
.RowStride
,
607 intelImage
->base
.ImageOffsets
);
608 intelImage
->base
.RowStride
/= intelImage
->mt
->cpp
;
611 /* Otherwise, the image should actually be stored in
612 * intelImage->base.Data. This is pretty confusing for
613 * everybody, I'd much prefer to separate the two functions of
614 * texImage->Data - storage for texture images in main memory
615 * and access (ie mappings) of images. In other words, we'd
616 * create a new texImage->Map field and leave Data simply for
619 assert(intelImage
->base
.Data
);
624 _mesa_get_compressed_teximage(ctx
, target
, level
, pixels
,
628 _mesa_get_teximage(ctx
, target
, level
, format
, type
, pixels
,
634 if (intelImage
->mt
) {
635 intel_miptree_image_unmap(intel
, intelImage
->mt
);
636 intelImage
->base
.Data
= NULL
;
642 intelGetTexImage(struct gl_context
* ctx
, GLenum target
, GLint level
,
643 GLenum format
, GLenum type
, GLvoid
* pixels
,
644 struct gl_texture_object
*texObj
,
645 struct gl_texture_image
*texImage
)
647 intel_get_tex_image(ctx
, target
, level
, format
, type
, pixels
,
648 texObj
, texImage
, GL_FALSE
);
653 intelGetCompressedTexImage(struct gl_context
*ctx
, GLenum target
, GLint level
,
655 struct gl_texture_object
*texObj
,
656 struct gl_texture_image
*texImage
)
658 intel_get_tex_image(ctx
, target
, level
, 0, 0, pixels
,
659 texObj
, texImage
, GL_TRUE
);
663 intelSetTexBuffer2(__DRIcontext
*pDRICtx
, GLint target
,
664 GLint texture_format
,
665 __DRIdrawable
*dPriv
)
667 struct gl_framebuffer
*fb
= dPriv
->driverPrivate
;
668 struct intel_context
*intel
= pDRICtx
->driverPrivate
;
669 struct gl_context
*ctx
= &intel
->ctx
;
670 struct intel_texture_object
*intelObj
;
671 struct intel_texture_image
*intelImage
;
672 struct intel_mipmap_tree
*mt
;
673 struct intel_renderbuffer
*rb
;
674 struct gl_texture_object
*texObj
;
675 struct gl_texture_image
*texImage
;
676 int level
= 0, internalFormat
;
679 texObj
= _mesa_get_current_tex_object(ctx
, target
);
680 intelObj
= intel_texture_object(texObj
);
685 if (dPriv
->lastStamp
!= dPriv
->dri2
.stamp
||
686 !pDRICtx
->driScreenPriv
->dri2
.useInvalidate
)
687 intel_update_renderbuffers(pDRICtx
, dPriv
);
689 rb
= intel_get_renderbuffer(fb
, BUFFER_FRONT_LEFT
);
690 /* If the region isn't set, then intel_update_renderbuffers was unable
691 * to get the buffers for the drawable.
693 if (rb
->region
== NULL
)
696 if (texture_format
== __DRI_TEXTURE_FORMAT_RGB
) {
697 internalFormat
= GL_RGB
;
698 texFormat
= MESA_FORMAT_XRGB8888
;
701 internalFormat
= GL_RGBA
;
702 texFormat
= MESA_FORMAT_ARGB8888
;
705 mt
= intel_miptree_create_for_region(intel
, target
,
706 internalFormat
, rb
->region
, 1, 0);
710 _mesa_lock_texture(&intel
->ctx
, texObj
);
712 texImage
= _mesa_get_tex_image(&intel
->ctx
, texObj
, target
, level
);
713 intelImage
= intel_texture_image(texImage
);
715 if (intelImage
->mt
) {
716 intel_miptree_release(intel
, &intelImage
->mt
);
717 assert(!texImage
->Data
);
720 intel_miptree_release(intel
, &intelObj
->mt
);
724 _mesa_init_teximage_fields(&intel
->ctx
, target
, texImage
,
725 rb
->region
->width
, rb
->region
->height
, 1,
726 0, internalFormat
, texFormat
);
728 intelImage
->face
= target_to_face(target
);
729 intelImage
->level
= level
;
730 texImage
->RowStride
= rb
->region
->pitch
;
731 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
733 if (!intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
)) {
734 fprintf(stderr
, "miptree doesn't match image\n");
737 _mesa_unlock_texture(&intel
->ctx
, texObj
);
741 intelSetTexBuffer(__DRIcontext
*pDRICtx
, GLint target
, __DRIdrawable
*dPriv
)
743 /* The old interface didn't have the format argument, so copy our
744 * implementation's behavior at the time.
746 intelSetTexBuffer2(pDRICtx
, target
, __DRI_TEXTURE_FORMAT_RGBA
, dPriv
);
749 #if FEATURE_OES_EGL_image
751 intel_image_target_texture_2d(struct gl_context
*ctx
, GLenum target
,
752 struct gl_texture_object
*texObj
,
753 struct gl_texture_image
*texImage
,
754 GLeglImageOES image_handle
)
756 struct intel_context
*intel
= intel_context(ctx
);
757 struct intel_texture_object
*intelObj
= intel_texture_object(texObj
);
758 struct intel_texture_image
*intelImage
= intel_texture_image(texImage
);
759 struct intel_mipmap_tree
*mt
;
763 screen
= intel
->intelScreen
->driScrnPriv
;
764 image
= screen
->dri2
.image
->lookupEGLImage(screen
, image_handle
,
765 screen
->loaderPrivate
);
769 mt
= intel_miptree_create_for_region(intel
, target
,
770 image
->internal_format
,
771 image
->region
, 1, 0);
775 if (intelImage
->mt
) {
776 intel_miptree_release(intel
, &intelImage
->mt
);
777 assert(!texImage
->Data
);
780 intel_miptree_release(intel
, &intelObj
->mt
);
783 _mesa_init_teximage_fields(&intel
->ctx
, target
, texImage
,
784 image
->region
->width
, image
->region
->height
, 1,
785 0, image
->internal_format
, image
->format
);
787 intelImage
->face
= target_to_face(target
);
788 intelImage
->level
= 0;
789 texImage
->RowStride
= image
->region
->pitch
;
790 intel_miptree_reference(&intelImage
->mt
, intelObj
->mt
);
792 if (!intel_miptree_match_image(intelObj
->mt
, &intelImage
->base
))
793 fprintf(stderr
, "miptree doesn't match image\n");
798 intelInitTextureImageFuncs(struct dd_function_table
*functions
)
800 functions
->TexImage1D
= intelTexImage1D
;
801 functions
->TexImage2D
= intelTexImage2D
;
802 functions
->TexImage3D
= intelTexImage3D
;
803 functions
->GetTexImage
= intelGetTexImage
;
805 functions
->CompressedTexImage2D
= intelCompressedTexImage2D
;
806 functions
->GetCompressedTexImage
= intelGetCompressedTexImage
;
808 #if FEATURE_OES_EGL_image
809 functions
->EGLImageTargetTexture2D
= intel_image_target_texture_2d
;