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 **************************************************************************/
32 #include "simple_list.h"
36 #include "texformat.h"
40 #include "swrast/swrast.h"
44 #include "intel_screen.h"
45 #include "intel_batchbuffer.h"
46 #include "intel_context.h"
47 #include "intel_tex.h"
48 #include "intel_ioctl.h"
53 intelValidateClientStorage( intelContextPtr intel
, GLenum target
,
55 GLint srcWidth
, GLint srcHeight
,
56 GLenum format
, GLenum type
, const void *pixels
,
57 const struct gl_pixelstore_attrib
*packing
,
58 struct gl_texture_object
*texObj
,
59 struct gl_texture_image
*texImage
)
62 GLcontext
*ctx
= &intel
->ctx
;
66 fprintf(stderr
, "intformat %s format %s type %s\n",
67 _mesa_lookup_enum_by_nr( internalFormat
),
68 _mesa_lookup_enum_by_nr( format
),
69 _mesa_lookup_enum_by_nr( type
));
71 if (!ctx
->Unpack
.ClientStorage
)
74 if (ctx
->_ImageTransferState
||
75 texImage
->IsCompressed
||
76 texObj
->GenerateMipmap
)
80 /* This list is incomplete
82 switch ( internalFormat
) {
84 if ( format
== GL_BGRA
&& type
== GL_UNSIGNED_INT_8_8_8_8_REV
) {
85 texImage
->TexFormat
= &_mesa_texformat_argb8888
;
93 if ( format
== GL_RGB
&& type
== GL_UNSIGNED_SHORT_5_6_5
) {
94 texImage
->TexFormat
= &_mesa_texformat_rgb565
;
102 if ( format
== GL_YCBCR_MESA
&&
103 type
== GL_UNSIGNED_SHORT_8_8_REV_APPLE
) {
104 texImage
->TexFormat
= &_mesa_texformat_ycbcr_rev
;
107 else if ( format
== GL_YCBCR_MESA
&&
108 (type
== GL_UNSIGNED_SHORT_8_8_APPLE
||
109 type
== GL_UNSIGNED_BYTE
)) {
110 texImage
->TexFormat
= &_mesa_texformat_ycbcr
;
122 /* Could deal with these packing issues, but currently don't:
124 if (packing
->SkipPixels
||
126 packing
->SwapBytes
||
132 GLint srcRowStride
= _mesa_image_row_stride(packing
, srcWidth
,
137 fprintf(stderr
, "%s: srcRowStride %d/%x\n",
138 __FUNCTION__
, srcRowStride
, srcRowStride
);
140 /* Could check this later in upload, pitch restrictions could be
141 * relaxed, but would need to store the image pitch somewhere,
142 * as packing details might change before image is uploaded:
144 if (!intelIsAgpMemory( intel
, pixels
, srcHeight
* srcRowStride
) ||
149 /* Have validated that _mesa_transfer_teximage would be a straight
150 * memcpy at this point. NOTE: future calls to TexSubImage will
151 * overwrite the client data. This is explicitly mentioned in the
154 texImage
->Data
= (void *)pixels
;
155 texImage
->IsClientData
= GL_TRUE
;
156 texImage
->RowStride
= srcRowStride
/ texelBytes
;
163 static void intelTexImage1D( GLcontext
*ctx
, GLenum target
, GLint level
,
164 GLint internalFormat
,
165 GLint width
, GLint border
,
166 GLenum format
, GLenum type
, const GLvoid
*pixels
,
167 const struct gl_pixelstore_attrib
*packing
,
168 struct gl_texture_object
*texObj
,
169 struct gl_texture_image
*texImage
)
171 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
175 driSwapOutTextureObject( t
);
177 texImage
->IsClientData
= GL_FALSE
;
179 _mesa_store_teximage1d( ctx
, target
, level
, internalFormat
,
180 width
, border
, format
, type
,
181 pixels
, packing
, texObj
, texImage
);
183 t
->dirty_images
[0] |= (1 << level
);
186 static void intelTexSubImage1D( GLcontext
*ctx
,
191 GLenum format
, GLenum type
,
192 const GLvoid
*pixels
,
193 const struct gl_pixelstore_attrib
*packing
,
194 struct gl_texture_object
*texObj
,
195 struct gl_texture_image
*texImage
)
197 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
201 driSwapOutTextureObject( t
);
203 _mesa_store_texsubimage1d(ctx
, target
, level
, xoffset
, width
,
204 format
, type
, pixels
, packing
, texObj
,
209 /* Handles 2D, CUBE, RECT:
211 static void intelTexImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
212 GLint internalFormat
,
213 GLint width
, GLint height
, GLint border
,
214 GLenum format
, GLenum type
, const GLvoid
*pixels
,
215 const struct gl_pixelstore_attrib
*packing
,
216 struct gl_texture_object
*texObj
,
217 struct gl_texture_image
*texImage
)
219 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
222 /* which cube face or ordinary 2D image */
224 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
225 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
226 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
227 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
228 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
229 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
230 face
= (GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
239 driSwapOutTextureObject( t
);
240 texImage
->IsClientData
= GL_FALSE
;
242 if (intelValidateClientStorage( INTEL_CONTEXT(ctx
), target
,
245 format
, type
, pixels
,
246 packing
, texObj
, texImage
)) {
247 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
248 fprintf(stderr
, "%s: Using client storage\n", __FUNCTION__
);
251 _mesa_store_teximage2d( ctx
, target
, level
, internalFormat
,
252 width
, height
, border
, format
, type
,
253 pixels
, packing
, texObj
, texImage
);
255 t
->dirty_images
[face
] |= (1 << level
);
259 static void intelTexSubImage2D( GLcontext
*ctx
,
262 GLint xoffset
, GLint yoffset
,
263 GLsizei width
, GLsizei height
,
264 GLenum format
, GLenum type
,
265 const GLvoid
*pixels
,
266 const struct gl_pixelstore_attrib
*packing
,
267 struct gl_texture_object
*texObj
,
268 struct gl_texture_image
*texImage
)
270 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
273 /* which cube face or ordinary 2D image */
275 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
276 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
277 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
278 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
279 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
280 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
281 face
= (GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
288 if (texImage
->IsClientData
&&
289 (char *)pixels
== (char *)texImage
->Data
+
290 ((xoffset
+ yoffset
* texImage
->RowStride
) *
291 texImage
->TexFormat
->TexelBytes
)) {
293 /* Notification only - no upload required */
296 assert( t
); /* this _should_ be true */
298 driSwapOutTextureObject( t
);
300 _mesa_store_texsubimage2d(ctx
, target
, level
, xoffset
, yoffset
, width
,
301 height
, format
, type
, pixels
, packing
, texObj
,
304 t
->dirty_images
[face
] |= (1 << level
);
308 static void intelCompressedTexImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
309 GLint internalFormat
,
310 GLint width
, GLint height
, GLint border
,
311 GLsizei imageSize
, const GLvoid
*data
,
312 struct gl_texture_object
*texObj
,
313 struct gl_texture_image
*texImage
)
315 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
318 /* which cube face or ordinary 2D image */
320 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
321 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
322 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
323 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
324 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
325 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
326 face
= (GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
336 driSwapOutTextureObject( t
);
337 texImage
->IsClientData
= GL_FALSE
;
339 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
340 fprintf(stderr
, "%s: Using normal storage\n", __FUNCTION__
);
342 _mesa_store_compressed_teximage2d(ctx
, target
, level
, internalFormat
, width
,
343 height
, border
, imageSize
, data
, texObj
, texImage
);
345 t
->dirty_images
[face
] |= (1 << level
);
349 static void intelCompressedTexSubImage2D( GLcontext
*ctx
, GLenum target
, GLint level
,
350 GLint xoffset
, GLint yoffset
,
351 GLsizei width
, GLsizei height
,
353 GLsizei imageSize
, const GLvoid
*data
,
354 struct gl_texture_object
*texObj
,
355 struct gl_texture_image
*texImage
)
357 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
361 /* which cube face or ordinary 2D image */
363 case GL_TEXTURE_CUBE_MAP_POSITIVE_X
:
364 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X
:
365 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y
:
366 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
:
367 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z
:
368 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
:
369 face
= (GLuint
) target
- (GLuint
) GL_TEXTURE_CUBE_MAP_POSITIVE_X
;
376 assert( t
); /* this _should_ be true */
378 driSwapOutTextureObject( t
);
380 _mesa_store_compressed_texsubimage2d(ctx
, target
, level
, xoffset
, yoffset
, width
,
381 height
, format
, imageSize
, data
, texObj
, texImage
);
383 t
->dirty_images
[face
] |= (1 << level
);
387 static void intelTexImage3D( GLcontext
*ctx
, GLenum target
, GLint level
,
388 GLint internalFormat
,
389 GLint width
, GLint height
, GLint depth
,
391 GLenum format
, GLenum type
, const GLvoid
*pixels
,
392 const struct gl_pixelstore_attrib
*packing
,
393 struct gl_texture_object
*texObj
,
394 struct gl_texture_image
*texImage
)
396 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
399 driSwapOutTextureObject( t
);
400 texImage
->IsClientData
= GL_FALSE
;
402 _mesa_store_teximage3d(ctx
, target
, level
, internalFormat
,
403 width
, height
, depth
, border
,
404 format
, type
, pixels
,
405 &ctx
->Unpack
, texObj
, texImage
);
407 t
->dirty_images
[0] |= (1 << level
);
412 intelTexSubImage3D( GLcontext
*ctx
, GLenum target
, GLint level
,
413 GLint xoffset
, GLint yoffset
, GLint zoffset
,
414 GLsizei width
, GLsizei height
, GLsizei depth
,
415 GLenum format
, GLenum type
,
416 const GLvoid
*pixels
,
417 const struct gl_pixelstore_attrib
*packing
,
418 struct gl_texture_object
*texObj
,
419 struct gl_texture_image
*texImage
)
421 driTextureObject
* t
= (driTextureObject
*) texObj
->DriverData
;
423 assert( t
); /* this _should_ be true */
424 driSwapOutTextureObject( t
);
426 _mesa_store_texsubimage3d(ctx
, target
, level
, xoffset
, yoffset
, zoffset
,
427 width
, height
, depth
,
428 format
, type
, pixels
, packing
, texObj
, texImage
);
430 t
->dirty_images
[0] |= (1 << level
);
436 static void intelDeleteTexture( GLcontext
*ctx
, struct gl_texture_object
*tObj
)
438 driTextureObject
* t
= (driTextureObject
*) tObj
->DriverData
;
442 driDestroyTextureObject( t
);
445 /* Free mipmap images and the texture object itself */
446 _mesa_delete_texture_object(ctx
, tObj
);
450 static const struct gl_texture_format
*
451 intelChooseTextureFormat( GLcontext
*ctx
, GLint internalFormat
,
452 GLenum format
, GLenum type
)
454 intelContextPtr intel
= INTEL_CONTEXT( ctx
);
455 const GLboolean do32bpt
= ( intel
->intelScreen
->cpp
== 4 &&
456 intel
->intelScreen
->tex
.size
> 4*1024*1024);
458 switch ( internalFormat
) {
461 case GL_COMPRESSED_RGBA
:
462 if ( format
== GL_BGRA
) {
463 if ( type
== GL_UNSIGNED_INT_8_8_8_8_REV
) {
464 return &_mesa_texformat_argb8888
;
466 else if ( type
== GL_UNSIGNED_SHORT_4_4_4_4_REV
) {
467 return &_mesa_texformat_argb4444
;
469 else if ( type
== GL_UNSIGNED_SHORT_1_5_5_5_REV
) {
470 return &_mesa_texformat_argb1555
;
473 return do32bpt
? &_mesa_texformat_argb8888
: &_mesa_texformat_argb4444
;
477 case GL_COMPRESSED_RGB
:
478 if ( format
== GL_RGB
&& type
== GL_UNSIGNED_SHORT_5_6_5
) {
479 return &_mesa_texformat_rgb565
;
481 return do32bpt
? &_mesa_texformat_argb8888
: &_mesa_texformat_rgb565
;
487 return do32bpt
? &_mesa_texformat_argb8888
: &_mesa_texformat_argb4444
;
491 return &_mesa_texformat_argb4444
;
494 return &_mesa_texformat_argb1555
;
500 return do32bpt
? &_mesa_texformat_argb8888
: &_mesa_texformat_rgb565
;
505 return &_mesa_texformat_rgb565
;
512 case GL_COMPRESSED_ALPHA
:
513 return &_mesa_texformat_a8
;
521 case GL_COMPRESSED_LUMINANCE
:
522 return &_mesa_texformat_l8
;
525 case GL_LUMINANCE_ALPHA
:
526 case GL_LUMINANCE4_ALPHA4
:
527 case GL_LUMINANCE6_ALPHA2
:
528 case GL_LUMINANCE8_ALPHA8
:
529 case GL_LUMINANCE12_ALPHA4
:
530 case GL_LUMINANCE12_ALPHA12
:
531 case GL_LUMINANCE16_ALPHA16
:
532 case GL_COMPRESSED_LUMINANCE_ALPHA
:
533 return &_mesa_texformat_al88
;
540 case GL_COMPRESSED_INTENSITY
:
541 return &_mesa_texformat_i8
;
544 if (type
== GL_UNSIGNED_SHORT_8_8_MESA
||
545 type
== GL_UNSIGNED_BYTE
)
546 return &_mesa_texformat_ycbcr
;
548 return &_mesa_texformat_ycbcr_rev
;
550 case GL_COMPRESSED_RGB_FXT1_3DFX
:
551 return &_mesa_texformat_rgb_fxt1
;
552 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
553 return &_mesa_texformat_rgba_fxt1
;
557 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
558 return &_mesa_texformat_rgb_dxt1
;
560 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
561 return &_mesa_texformat_rgba_dxt1
;
565 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
566 return &_mesa_texformat_rgba_dxt3
;
568 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
569 return &_mesa_texformat_rgba_dxt5
;
571 case GL_DEPTH_COMPONENT
:
572 case GL_DEPTH_COMPONENT16
:
573 case GL_DEPTH_COMPONENT24
:
574 case GL_DEPTH_COMPONENT32
:
575 return &_mesa_texformat_depth_component16
;
578 fprintf(stderr
, "unexpected texture format %s in %s\n",
579 _mesa_lookup_enum_by_nr(internalFormat
),
584 return NULL
; /* never get here */
589 void intelDestroyTexObj(intelContextPtr intel
, intelTextureObjectPtr t
)
596 if ( t
->age
> intel
->dirtyAge
)
597 intel
->dirtyAge
= t
->age
;
599 for ( i
= 0 ; i
< MAX_TEXTURE_UNITS
; i
++ ) {
600 if ( t
== intel
->CurrentTexObj
[ i
] )
601 intel
->CurrentTexObj
[ i
] = NULL
;
607 /* Upload an image from mesa's internal copy. Image may be 1D, 2D or
608 * 3D. Cubemaps are expanded elsewhere.
610 static void intelUploadTexImage( intelContextPtr intel
,
611 intelTextureObjectPtr t
,
612 const struct gl_texture_image
*image
,
613 const GLuint offset
)
616 if (!image
|| !image
->Data
)
619 if (image
->Depth
== 1 && image
->IsClientData
) {
620 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
621 fprintf(stderr
, "Blit uploading\n");
623 /* Do it with a blit.
625 intelEmitCopyBlitLocked( intel
,
626 image
->TexFormat
->TexelBytes
,
627 image
->RowStride
, /* ? */
628 intelGetMemoryOffsetMESA( NULL
, 0, image
->Data
),
629 t
->Pitch
/ image
->TexFormat
->TexelBytes
,
630 intelGetMemoryOffsetMESA( NULL
, 0, t
->BufAddr
+ offset
),
636 else if (image
->IsCompressed
) {
637 GLuint row_len
= image
->Width
* 2;
638 GLubyte
*dst
= (GLubyte
*)(t
->BufAddr
+ offset
);
639 GLubyte
*src
= (GLubyte
*)image
->Data
;
642 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
644 "Upload image %dx%dx%d offset %xm row_len %x "
645 "pitch %x depth_pitch %x\n",
646 image
->Width
, image
->Height
, image
->Depth
, offset
,
647 row_len
, t
->Pitch
, t
->depth_pitch
);
649 switch (image
->InternalFormat
) {
650 case GL_COMPRESSED_RGB_FXT1_3DFX
:
651 case GL_COMPRESSED_RGBA_FXT1_3DFX
:
654 case GL_COMPRESSED_RGB_S3TC_DXT1_EXT
:
655 case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
:
656 for (j
= 0 ; j
< image
->Height
/4 ; j
++, dst
+= (t
->Pitch
)) {
657 __memcpy(dst
, src
, row_len
);
663 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
:
664 case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:
665 for (j
= 0 ; j
< image
->Height
/4 ; j
++, dst
+= (t
->Pitch
)) {
666 __memcpy(dst
, src
, (image
->Width
*4) );
667 src
+= image
->Width
*4;
671 fprintf(stderr
,"Internal Compressed format not supported %d\n", image
->InternalFormat
);
676 GLuint row_len
= image
->Width
* image
->TexFormat
->TexelBytes
;
677 GLubyte
*dst
= (GLubyte
*)(t
->BufAddr
+ offset
);
678 GLubyte
*src
= (GLubyte
*)image
->Data
;
681 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
683 "Upload image %dx%dx%d offset %xm row_len %x "
684 "pitch %x depth_pitch %x\n",
685 image
->Width
, image
->Height
, image
->Depth
, offset
,
686 row_len
, t
->Pitch
, t
->depth_pitch
);
688 if (row_len
== t
->Pitch
) {
689 for (d
= 0; d
< image
->Depth
; d
++) {
690 memcpy( dst
, src
, t
->Pitch
* image
->Height
);
691 dst
+= t
->depth_pitch
;
692 src
+= row_len
* image
->Height
;
696 for (d
= 0 ; d
< image
->Depth
; d
++) {
697 for (j
= 0 ; j
< image
->Height
; j
++) {
698 __memcpy(dst
, src
, row_len
);
703 dst
+= t
->depth_pitch
- (t
->Pitch
* image
->Height
);
711 int intelUploadTexImages( intelContextPtr intel
,
712 intelTextureObjectPtr t
,
715 const int numLevels
= t
->base
.lastLevel
- t
->base
.firstLevel
+ 1;
716 const struct gl_texture_image
*firstImage
= t
->image
[face
][t
->base
.firstLevel
].image
;
717 int pitch
= firstImage
->RowStride
* firstImage
->TexFormat
->TexelBytes
;
719 /* Can we texture out of the existing client data? */
720 if ( numLevels
== 1 &&
721 firstImage
->IsClientData
&&
724 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
725 fprintf(stderr
, "AGP texturing from client memory\n");
727 t
->TextureOffset
= intelAgpOffsetFromVirtual( intel
, firstImage
->Data
);
733 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
734 fprintf(stderr
, "Uploading client data to agp\n");
736 INTEL_FIREVERTICES( intel
);
737 LOCK_HARDWARE( intel
);
739 if ( t
->base
.memBlock
== NULL
) {
742 heap
= driAllocateTexture( intel
->texture_heaps
, intel
->nr_heaps
,
743 (driTextureObject
*) t
);
745 UNLOCK_HARDWARE( intel
);
749 /* Set the base offset of the texture image */
750 t
->BufAddr
= intel
->intelScreen
->tex
.map
+ t
->base
.memBlock
->ofs
;
751 t
->TextureOffset
= intel
->intelScreen
->tex
.offset
+ t
->base
.memBlock
->ofs
;
756 /* Let the world know we've used this memory recently.
758 driUpdateTextureLRU( (driTextureObject
*) t
);
761 /* Upload any images that are new */
762 if (t
->base
.dirty_images
[face
]) {
765 intelWaitForIdle( intel
);
767 for (i
= 0 ; i
< numLevels
; i
++) {
768 int level
= i
+ t
->base
.firstLevel
;
770 if (t
->base
.dirty_images
[face
] & (1<<level
)) {
772 const struct gl_texture_image
*image
= t
->image
[face
][i
].image
;
773 GLuint offset
= t
->image
[face
][i
].offset
;
775 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
776 fprintf(stderr
, "upload level %d, offset %x\n",
779 intelUploadTexImage( intel
, t
, image
, offset
);
782 t
->base
.dirty_images
[face
] = 0;
783 intel
->perf_boxes
|= I830_BOX_TEXTURE_LOAD
;
786 UNLOCK_HARDWARE( intel
);
792 * Allocate a new texture object.
793 * Called via ctx->Driver.NewTextureObject.
794 * Note: this function will be called during context creation to
795 * allocate the default texture objects.
796 * Note: we could use containment here to 'derive' the driver-specific
797 * texture object from the core mesa gl_texture_object. Not done at this time.
799 static struct gl_texture_object
*
800 intelNewTextureObject( GLcontext
*ctx
, GLuint name
, GLenum target
)
802 struct gl_texture_object
*obj
= _mesa_new_texture_object(ctx
, name
, target
);
803 INTEL_CONTEXT(ctx
)->vtbl
.alloc_tex_obj( obj
);
808 void intelInitTextureFuncs( struct dd_function_table
*functions
)
810 functions
->NewTextureObject
= intelNewTextureObject
;
811 functions
->ChooseTextureFormat
= intelChooseTextureFormat
;
812 functions
->TexImage1D
= intelTexImage1D
;
813 functions
->TexImage2D
= intelTexImage2D
;
814 functions
->TexImage3D
= intelTexImage3D
;
815 functions
->TexSubImage1D
= intelTexSubImage1D
;
816 functions
->TexSubImage2D
= intelTexSubImage2D
;
817 functions
->TexSubImage3D
= intelTexSubImage3D
;
818 functions
->CopyTexImage1D
= _swrast_copy_teximage1d
;
819 functions
->CopyTexImage2D
= _swrast_copy_teximage2d
;
820 functions
->CopyTexSubImage1D
= _swrast_copy_texsubimage1d
;
821 functions
->CopyTexSubImage2D
= _swrast_copy_texsubimage2d
;
822 functions
->CopyTexSubImage3D
= _swrast_copy_texsubimage3d
;
823 functions
->DeleteTexture
= intelDeleteTexture
;
824 functions
->UpdateTexturePalette
= NULL
;
825 functions
->IsTextureResident
= driIsTextureResident
;
826 functions
->TestProxyTexImage
= _mesa_test_proxy_teximage
;
827 functions
->DeleteTexture
= intelDeleteTexture
;
828 functions
->CompressedTexImage2D
= intelCompressedTexImage2D
;
829 functions
->CompressedTexSubImage2D
= intelCompressedTexSubImage2D
;