1 /**************************************************************************
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
31 #include "simple_list.h"
35 #include "texformat.h"
39 #include "swrast/swrast.h"
43 #include "intel_screen.h"
44 #include "intel_batchbuffer.h"
45 #include "intel_context.h"
46 #include "intel_tex.h"
47 #include "intel_ioctl.h"
52 intelValidateClientStorage( intelContextPtr intel
, GLenum target
,
54 GLint srcWidth
, GLint srcHeight
,
55 GLenum format
, GLenum type
, const void *pixels
,
56 const struct gl_pixelstore_attrib
*packing
,
57 struct gl_texture_object
*texObj
,
58 struct gl_texture_image
*texImage
)
61 GLcontext
*ctx
= &intel
->ctx
;
65 fprintf(stderr
, "intformat %s format %s type %s\n",
66 _mesa_lookup_enum_by_nr( internalFormat
),
67 _mesa_lookup_enum_by_nr( format
),
68 _mesa_lookup_enum_by_nr( type
));
70 if (!ctx
->Unpack
.ClientStorage
)
73 if (ctx
->_ImageTransferState
||
74 texImage
->IsCompressed
||
75 texObj
->GenerateMipmap
)
79 /* This list is incomplete
81 switch ( internalFormat
) {
83 if ( format
== GL_BGRA
&& type
== GL_UNSIGNED_INT_8_8_8_8_REV
) {
84 texImage
->TexFormat
= &_mesa_texformat_argb8888
;
92 if ( format
== GL_RGB
&& type
== GL_UNSIGNED_SHORT_5_6_5
) {
93 texImage
->TexFormat
= &_mesa_texformat_rgb565
;
101 if ( format
== GL_YCBCR_MESA
&&
102 type
== GL_UNSIGNED_SHORT_8_8_REV_APPLE
) {
103 texImage
->TexFormat
= &_mesa_texformat_ycbcr_rev
;
106 else if ( format
== GL_YCBCR_MESA
&&
107 (type
== GL_UNSIGNED_SHORT_8_8_APPLE
||
108 type
== GL_UNSIGNED_BYTE
)) {
109 texImage
->TexFormat
= &_mesa_texformat_ycbcr
;
121 /* Could deal with these packing issues, but currently don't:
123 if (packing
->SkipPixels
||
125 packing
->SwapBytes
||
131 GLint srcRowStride
= _mesa_image_row_stride(packing
, srcWidth
,
136 fprintf(stderr
, "%s: srcRowStride %d/%x\n",
137 __FUNCTION__
, srcRowStride
, srcRowStride
);
139 /* Could check this later in upload, pitch restrictions could be
140 * relaxed, but would need to store the image pitch somewhere,
141 * as packing details might change before image is uploaded:
143 if (!intelIsAgpMemory( intel
, pixels
, srcHeight
* srcRowStride
) ||
148 /* Have validated that _mesa_transfer_teximage would be a straight
149 * memcpy at this point. NOTE: future calls to TexSubImage will
150 * overwrite the client data. This is explicitly mentioned in the
153 texImage
->Data
= (void *)pixels
;
154 texImage
->IsClientData
= GL_TRUE
;
155 texImage
->RowStride
= srcRowStride
/ texelBytes
;
162 static void intelTexImage1D( GLcontext
*ctx
, GLenum target
, GLint level
,
163 GLint internalFormat
,
164 GLint width
, GLint border
,
165 GLenum format
, GLenum type
, const GLvoid
*pixels
,
166 const struct gl_pixelstore_attrib
*packing
,
167 struct gl_texture_object
*texObj
,
168 struct gl_texture_image
*texImage
)
170 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
174 driSwapOutTextureObject( t
);
176 texImage
->IsClientData
= GL_FALSE
;
178 _mesa_store_teximage1d( ctx
, target
, level
, internalFormat
,
179 width
, border
, format
, type
,
180 pixels
, packing
, texObj
, texImage
);
182 t
->dirty_images
[0] |= (1 << level
);
185 static void intelTexSubImage1D( GLcontext
*ctx
,
190 GLenum format
, GLenum type
,
191 const GLvoid
*pixels
,
192 const struct gl_pixelstore_attrib
*packing
,
193 struct gl_texture_object
*texObj
,
194 struct gl_texture_image
*texImage
)
196 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
200 driSwapOutTextureObject( t
);
202 _mesa_store_texsubimage1d(ctx
, target
, level
, xoffset
, width
,
203 format
, type
, pixels
, packing
, texObj
,
208 /* Handles 2D, CUBE, RECT:
210 static void intelTexImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
211 GLint internalFormat
,
212 GLint width
, GLint height
, GLint border
,
213 GLenum format
, GLenum type
, const GLvoid
*pixels
,
214 const struct gl_pixelstore_attrib
*packing
,
215 struct gl_texture_object
*texObj
,
216 struct gl_texture_image
*texImage
)
218 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
221 /* which cube face or ordinary 2D image */
223 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
224 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
225 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
226 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
227 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
228 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
229 face
= (GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
238 driSwapOutTextureObject( t
);
239 texImage
->IsClientData
= GL_FALSE
;
241 if (intelValidateClientStorage( INTEL_CONTEXT(ctx
), target
,
244 format
, type
, pixels
,
245 packing
, texObj
, texImage
)) {
246 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
247 fprintf(stderr
, "%s: Using client storage\n", __FUNCTION__
);
250 _mesa_store_teximage2d( ctx
, target
, level
, internalFormat
,
251 width
, height
, border
, format
, type
,
252 pixels
, packing
, texObj
, texImage
);
254 t
->dirty_images
[face
] |= (1 << level
);
258 static void intelTexSubImage2D( GLcontext
*ctx
,
261 GLint xoffset
, GLint yoffset
,
262 GLsizei width
, GLsizei height
,
263 GLenum format
, GLenum type
,
264 const GLvoid
*pixels
,
265 const struct gl_pixelstore_attrib
*packing
,
266 struct gl_texture_object
*texObj
,
267 struct gl_texture_image
*texImage
)
269 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
272 /* which cube face or ordinary 2D image */
274 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
275 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
276 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
277 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
278 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
279 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
280 face
= (GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
287 if (texImage
->IsClientData
&&
288 (char *)pixels
== (char *)texImage
->Data
+
289 ((xoffset
+ yoffset
* texImage
->RowStride
) *
290 texImage
->TexFormat
->TexelBytes
)) {
292 /* Notification only - no upload required */
295 assert( t
); /* this _should_ be true */
297 driSwapOutTextureObject( t
);
299 _mesa_store_texsubimage2d(ctx
, target
, level
, xoffset
, yoffset
, width
,
300 height
, format
, type
, pixels
, packing
, texObj
,
303 t
->dirty_images
[face
] |= (1 << level
);
307 static void intelCompressedTexImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
308 GLint internalFormat
,
309 GLint width
, GLint height
, GLint border
,
310 GLsizei imageSize
, const GLvoid
*data
,
311 struct gl_texture_object
*texObj
,
312 struct gl_texture_image
*texImage
)
314 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
317 /* which cube face or ordinary 2D image */
319 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
320 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
321 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
322 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
323 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
324 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
325 face
= (GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
335 driSwapOutTextureObject( t
);
336 texImage
->IsClientData
= GL_FALSE
;
338 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
339 fprintf(stderr
, "%s: Using normal storage\n", __FUNCTION__
);
341 _mesa_store_compressed_teximage2d(ctx
, target
, level
, internalFormat
, width
,
342 height
, border
, imageSize
, data
, texObj
, texImage
);
344 t
->dirty_images
[face
] |= (1 << level
);
348 static void intelCompressedTexSubImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
349 GLint xoffset
, GLint yoffset
,
350 GLsizei width
, GLsizei height
,
352 GLsizei imageSize
, const GLvoid
*data
,
353 struct gl_texture_object
*texObj
,
354 struct gl_texture_image
*texImage
)
356 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
360 /* which cube face or ordinary 2D image */
362 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
363 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
364 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
365 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
366 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
367 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
368 face
= (GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
375 assert( t
); /* this _should_ be true */
377 driSwapOutTextureObject( t
);
379 _mesa_store_compressed_texsubimage2d(ctx
, target
, level
, xoffset
, yoffset
, width
,
380 height
, format
, imageSize
, data
, texObj
, texImage
);
382 t
->dirty_images
[face
] |= (1 << level
);
386 static void intelTexImage3D( GLcontext
*ctx
, GLenum target
, GLint level
,
387 GLint internalFormat
,
388 GLint width
, GLint height
, GLint depth
,
390 GLenum format
, GLenum type
, const GLvoid
*pixels
,
391 const struct gl_pixelstore_attrib
*packing
,
392 struct gl_texture_object
*texObj
,
393 struct gl_texture_image
*texImage
)
395 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
398 driSwapOutTextureObject( t
);
399 texImage
->IsClientData
= GL_FALSE
;
401 _mesa_store_teximage3d(ctx
, target
, level
, internalFormat
,
402 width
, height
, depth
, border
,
403 format
, type
, pixels
,
404 &ctx
->Unpack
, texObj
, texImage
);
406 t
->dirty_images
[0] |= (1 << level
);
411 intelTexSubImage3D( GLcontext
*ctx
, GLenum target
, GLint level
,
412 GLint xoffset
, GLint yoffset
, GLint zoffset
,
413 GLsizei width
, GLsizei height
, GLsizei depth
,
414 GLenum format
, GLenum type
,
415 const GLvoid
*pixels
,
416 const struct gl_pixelstore_attrib
*packing
,
417 struct gl_texture_object
*texObj
,
418 struct gl_texture_image
*texImage
)
420 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
422 assert( t
); /* this _should_ be true */
423 driSwapOutTextureObject( t
);
425 _mesa_store_texsubimage3d(ctx
, target
, level
, xoffset
, yoffset
, zoffset
,
426 width
, height
, depth
,
427 format
, type
, pixels
, packing
, texObj
, texImage
);
429 t
->dirty_images
[0] |= (1 << level
);
435 static void intelDeleteTexture( GLcontext
*ctx
, struct gl_texture_object
*tObj
)
437 driTextureObject
* t
= (driTextureObject
*) tObj
->DriverData
;
441 driDestroyTextureObject( t
);
444 /* Free mipmap images and the texture object itself */
445 _mesa_delete_texture_object(ctx
, tObj
);
449 static const struct gl_texture_format
*
450 intelChooseTextureFormat( GLcontext
*ctx
, GLint internalFormat
,
451 GLenum format
, GLenum type
)
453 intelContextPtr intel
= INTEL_CONTEXT( ctx
);
454 const GLboolean do32bpt
= ( intel
->intelScreen
->cpp
== 4 &&
455 intel
->intelScreen
->textureSize
> 4*1024*1024);
457 switch ( internalFormat
) {
460 case GL_COMPRESSED_RGBA
:
461 if ( format
== GL_BGRA
) {
462 if ( type
== GL_UNSIGNED_INT_8_8_8_8_REV
) {
463 return &_mesa_texformat_argb8888
;
465 else if ( type
== GL_UNSIGNED_SHORT_4_4_4_4_REV
) {
466 return &_mesa_texformat_argb4444
;
468 else if ( type
== GL_UNSIGNED_SHORT_1_5_5_5_REV
) {
469 return &_mesa_texformat_argb1555
;
472 return do32bpt
? &_mesa_texformat_argb8888
: &_mesa_texformat_argb4444
;
476 case GL_COMPRESSED_RGB
:
477 if ( format
== GL_RGB
&& type
== GL_UNSIGNED_SHORT_5_6_5
) {
478 return &_mesa_texformat_rgb565
;
480 return do32bpt
? &_mesa_texformat_argb8888
: &_mesa_texformat_rgb565
;
486 return do32bpt
? &_mesa_texformat_argb8888
: &_mesa_texformat_argb4444
;
490 return &_mesa_texformat_argb4444
;
493 return &_mesa_texformat_argb1555
;
499 return do32bpt
? &_mesa_texformat_argb8888
: &_mesa_texformat_rgb565
;
504 return &_mesa_texformat_rgb565
;
511 case GL_COMPRESSED_ALPHA
:
512 /* if (1 || intel->intelScreen->deviceID == PCI_CHIP_I915_G) */
513 return &_mesa_texformat_a8
;
515 /* return &_mesa_texformat_al88; */
523 case GL_COMPRESSED_LUMINANCE
:
524 return &_mesa_texformat_l8
;
527 case GL_LUMINANCE_ALPHA
:
528 case GL_LUMINANCE4_ALPHA4
:
529 case GL_LUMINANCE6_ALPHA2
:
530 case GL_LUMINANCE8_ALPHA8
:
531 case GL_LUMINANCE12_ALPHA4
:
532 case GL_LUMINANCE12_ALPHA12
:
533 case GL_LUMINANCE16_ALPHA16
:
534 case GL_COMPRESSED_LUMINANCE_ALPHA
:
535 return &_mesa_texformat_al88
;
542 case GL_COMPRESSED_INTENSITY
:
543 return &_mesa_texformat_i8
;
546 if (type
== GL_UNSIGNED_SHORT_8_8_MESA
||
547 type
== GL_UNSIGNED_BYTE
)
548 return &_mesa_texformat_ycbcr
;
550 return &_mesa_texformat_ycbcr_rev
;
552 case GL_COMPRESSED_RGB_FXT1_3DFX
:
553 return &_mesa_texformat_rgb_fxt1
;
554 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
555 return &_mesa_texformat_rgba_fxt1
;
559 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
560 return &_mesa_texformat_rgb_dxt1
;
562 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
563 return &_mesa_texformat_rgba_dxt1
;
567 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
568 return &_mesa_texformat_rgba_dxt3
;
570 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
571 return &_mesa_texformat_rgba_dxt5
;
574 fprintf(stderr
, "unexpected texture format in %s\n", __FUNCTION__
);
578 return NULL
; /* never get here */
583 void intelDestroyTexObj(intelContextPtr intel
, intelTextureObjectPtr t
)
590 if ( t
->age
> intel
->dirtyAge
)
591 intel
->dirtyAge
= t
->age
;
593 for ( i
= 0 ; i
< MAX_TEXTURE_UNITS
; i
++ ) {
594 if ( t
== intel
->CurrentTexObj
[ i
] )
595 intel
->CurrentTexObj
[ i
] = NULL
;
601 /* Upload an image from mesa's internal copy. Image may be 1D, 2D or
602 * 3D. Cubemaps are expanded elsewhere.
604 static void intelUploadTexImage( intelContextPtr intel
,
605 intelTextureObjectPtr t
,
606 const struct gl_texture_image
*image
,
607 const GLuint offset
)
610 if (!image
|| !image
->Data
)
613 if (image
->Depth
== 1 && image
->IsClientData
) {
614 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
615 fprintf(stderr
, "Blit uploading\n");
617 /* Do it with a blit.
619 intelEmitCopyBlitLocked( intel
,
620 image
->TexFormat
->TexelBytes
,
621 image
->RowStride
, /* ? */
622 intelGetMemoryOffsetMESA( NULL
, 0, image
->Data
),
623 t
->Pitch
/ image
->TexFormat
->TexelBytes
,
624 intelGetMemoryOffsetMESA( NULL
, 0, t
->BufAddr
+ offset
),
630 else if (image
->IsCompressed
) {
631 GLuint row_len
= image
->Width
* 2;
632 GLubyte
*dst
= (GLubyte
*)(t
->BufAddr
+ offset
);
633 GLubyte
*src
= (GLubyte
*)image
->Data
;
636 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
638 "Upload image %dx%dx%d offset %xm row_len %x "
639 "pitch %x depth_pitch %x\n",
640 image
->Width
, image
->Height
, image
->Depth
, offset
,
641 row_len
, t
->Pitch
, t
->depth_pitch
);
643 switch(image
->IntFormat
)
645 case GL_COMPRESSED_RGB_FXT1_3DFX
:
646 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
649 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
650 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
651 for (j
= 0 ; j
< image
->Height
/4 ; j
++, dst
+= (t
->Pitch
)) {
652 __memcpy(dst
, src
, row_len
);
658 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
659 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
660 for (j
= 0 ; j
< image
->Height
/4 ; j
++, dst
+= (t
->Pitch
)) {
661 __memcpy(dst
, src
, (image
->Width
*4) );
662 src
+= image
->Width
*4;
666 fprintf(stderr
,"Internal Compressed format not supported %d\n", image
->IntFormat
);
671 GLuint row_len
= image
->Width
* image
->TexFormat
->TexelBytes
;
672 GLubyte
*dst
= (GLubyte
*)(t
->BufAddr
+ offset
);
673 GLubyte
*src
= (GLubyte
*)image
->Data
;
676 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
678 "Upload image %dx%dx%d offset %xm row_len %x "
679 "pitch %x depth_pitch %x\n",
680 image
->Width
, image
->Height
, image
->Depth
, offset
,
681 row_len
, t
->Pitch
, t
->depth_pitch
);
683 if (row_len
== t
->Pitch
) {
684 for (d
= 0; d
< image
->Depth
; d
++) {
685 memcpy( dst
, src
, t
->Pitch
* image
->Height
);
686 dst
+= t
->depth_pitch
;
687 src
+= row_len
* image
->Height
;
691 for (d
= 0 ; d
< image
->Depth
; d
++) {
692 for (j
= 0 ; j
< image
->Height
; j
++) {
693 __memcpy(dst
, src
, row_len
);
698 dst
+= t
->depth_pitch
- (t
->Pitch
* image
->Height
);
706 int intelUploadTexImages( intelContextPtr intel
,
707 intelTextureObjectPtr t
,
710 const int numLevels
= t
->base
.lastLevel
- t
->base
.firstLevel
+ 1;
711 const struct gl_texture_image
*firstImage
= t
->image
[face
][t
->base
.firstLevel
].image
;
712 int pitch
= firstImage
->RowStride
* firstImage
->TexFormat
->TexelBytes
;
714 /* Can we texture out of the existing client data? */
715 if ( numLevels
== 1 &&
716 firstImage
->IsClientData
&&
719 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
720 fprintf(stderr
, "AGP texturing from client memory\n");
722 t
->TextureOffset
= intelAgpOffsetFromVirtual( intel
, firstImage
->Data
);
728 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
729 fprintf(stderr
, "Uploading client data to agp\n");
731 INTEL_FIREVERTICES( intel
);
732 LOCK_HARDWARE( intel
);
734 if ( t
->base
.memBlock
== NULL
) {
737 heap
= driAllocateTexture( intel
->texture_heaps
, intel
->nr_heaps
,
738 (driTextureObject
*) t
);
740 UNLOCK_HARDWARE( intel
);
744 /* Set the base offset of the texture image */
745 t
->BufAddr
= intel
->intelScreen
->tex
.map
+ t
->base
.memBlock
->ofs
;
746 t
->TextureOffset
= intel
->intelScreen
->textureOffset
+ t
->base
.memBlock
->ofs
;
751 /* Let the world know we've used this memory recently.
753 driUpdateTextureLRU( (driTextureObject
*) t
);
756 /* Upload any images that are new */
757 if (t
->base
.dirty_images
[face
]) {
760 intelWaitForIdle( intel
);
762 for (i
= 0 ; i
< numLevels
; i
++) {
763 int level
= i
+ t
->base
.firstLevel
;
765 if (t
->base
.dirty_images
[face
] & (1<<level
)) {
767 const struct gl_texture_image
*image
= t
->image
[face
][i
].image
;
768 GLuint offset
= t
->image
[face
][i
].offset
;
770 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
771 fprintf(stderr
, "upload level %d, offset %x\n",
774 intelUploadTexImage( intel
, t
, image
, offset
);
777 t
->base
.dirty_images
[face
] = 0;
778 intel
->perf_boxes
|= I830_BOX_TEXTURE_LOAD
;
781 UNLOCK_HARDWARE( intel
);
787 * Allocate a new texture object.
788 * Called via ctx->Driver.NewTextureObject.
789 * Note: this function will be called during context creation to
790 * allocate the default texture objects.
791 * Note: we could use containment here to 'derive' the driver-specific
792 * texture object from the core mesa gl_texture_object. Not done at this time.
794 static struct gl_texture_object
*
795 intelNewTextureObject( GLcontext
*ctx
, GLuint name
, GLenum target
)
797 struct gl_texture_object
*obj
= _mesa_new_texture_object(ctx
, name
, target
);
798 INTEL_CONTEXT(ctx
)->vtbl
.alloc_tex_obj( obj
);
803 void intelInitTextureFuncs( struct dd_function_table
*functions
)
805 functions
->NewTextureObject
= intelNewTextureObject
;
806 functions
->ChooseTextureFormat
= intelChooseTextureFormat
;
807 functions
->TexImage1D
= intelTexImage1D
;
808 functions
->TexImage2D
= intelTexImage2D
;
809 functions
->TexImage3D
= intelTexImage3D
;
810 functions
->TexSubImage1D
= intelTexSubImage1D
;
811 functions
->TexSubImage2D
= intelTexSubImage2D
;
812 functions
->TexSubImage3D
= intelTexSubImage3D
;
813 functions
->CopyTexImage1D
= _swrast_copy_teximage1d
;
814 functions
->CopyTexImage2D
= _swrast_copy_teximage2d
;
815 functions
->CopyTexSubImage1D
= _swrast_copy_texsubimage1d
;
816 functions
->CopyTexSubImage2D
= _swrast_copy_texsubimage2d
;
817 functions
->CopyTexSubImage3D
= _swrast_copy_texsubimage3d
;
818 functions
->DeleteTexture
= intelDeleteTexture
;
819 functions
->UpdateTexturePalette
= NULL
;
820 functions
->IsTextureResident
= driIsTextureResident
;
821 functions
->TestProxyTexImage
= _mesa_test_proxy_teximage
;
822 functions
->DeleteTexture
= intelDeleteTexture
;
823 functions
->CompressedTexImage2D
= intelCompressedTexImage2D
;
824 functions
->CompressedTexSubImage2D
= intelCompressedTexSubImage2D
;