[MESA]
[reactos.git] / reactos / dll / opengl / mesa / src / mesa / swrast / s_texfetch.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.7
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (c) 2009 VMware, Inc.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 /**
28 * \file s_texfetch.c
29 *
30 * Texel fetch/store functions
31 *
32 * \author Gareth Hughes
33 */
34
35
36 #include "main/colormac.h"
37 #include "main/macros.h"
38 #include "main/teximage.h"
39 #include "s_context.h"
40 #include "s_texfetch.h"
41
42
43 /**
44 * Convert an 8-bit sRGB value from non-linear space to a
45 * linear RGB value in [0, 1].
46 * Implemented with a 256-entry lookup table.
47 */
48 static inline GLfloat
49 nonlinear_to_linear(GLubyte cs8)
50 {
51 static GLfloat table[256];
52 static GLboolean tableReady = GL_FALSE;
53 if (!tableReady) {
54 /* compute lookup table now */
55 GLuint i;
56 for (i = 0; i < 256; i++) {
57 const GLfloat cs = UBYTE_TO_FLOAT(i);
58 if (cs <= 0.04045) {
59 table[i] = cs / 12.92f;
60 }
61 else {
62 table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4);
63 }
64 }
65 tableReady = GL_TRUE;
66 }
67 return table[cs8];
68 }
69
70
71
72 /* Texel fetch routines for all supported formats
73 */
74 #define DIM 1
75 #include "s_texfetch_tmp.h"
76
77 #define DIM 2
78 #include "s_texfetch_tmp.h"
79
80 #define DIM 3
81 #include "s_texfetch_tmp.h"
82
83 /**
84 * Null texel fetch function.
85 *
86 * Have to have this so the FetchTexel function pointer is never NULL.
87 */
88 static void fetch_null_texelf( const struct swrast_texture_image *texImage,
89 GLint i, GLint j, GLint k, GLfloat *texel )
90 {
91 (void) texImage; (void) i; (void) j; (void) k;
92 texel[RCOMP] = 0.0;
93 texel[GCOMP] = 0.0;
94 texel[BCOMP] = 0.0;
95 texel[ACOMP] = 0.0;
96 _mesa_warning(NULL, "fetch_null_texelf() called!");
97 }
98
99
100 /**
101 * Table to map MESA_FORMAT_ to texel fetch/store funcs.
102 * XXX this is somewhat temporary.
103 */
104 static struct {
105 gl_format Name;
106 FetchTexelFunc Fetch1D;
107 FetchTexelFunc Fetch2D;
108 FetchTexelFunc Fetch3D;
109 }
110 texfetch_funcs[MESA_FORMAT_COUNT] =
111 {
112 {
113 MESA_FORMAT_NONE,
114 fetch_null_texelf,
115 fetch_null_texelf,
116 fetch_null_texelf
117 },
118
119 {
120 MESA_FORMAT_RGBA8888,
121 fetch_texel_1d_f_rgba8888,
122 fetch_texel_2d_f_rgba8888,
123 fetch_texel_3d_f_rgba8888
124 },
125 {
126 MESA_FORMAT_RGBA8888_REV,
127 fetch_texel_1d_f_rgba8888_rev,
128 fetch_texel_2d_f_rgba8888_rev,
129 fetch_texel_3d_f_rgba8888_rev
130 },
131 {
132 MESA_FORMAT_ARGB8888,
133 fetch_texel_1d_f_argb8888,
134 fetch_texel_2d_f_argb8888,
135 fetch_texel_3d_f_argb8888
136 },
137 {
138 MESA_FORMAT_ARGB8888_REV,
139 fetch_texel_1d_f_argb8888_rev,
140 fetch_texel_2d_f_argb8888_rev,
141 fetch_texel_3d_f_argb8888_rev
142 },
143 {
144 MESA_FORMAT_RGBX8888,
145 fetch_texel_1d_f_rgbx8888,
146 fetch_texel_2d_f_rgbx8888,
147 fetch_texel_3d_f_rgbx8888
148 },
149 {
150 MESA_FORMAT_RGBX8888_REV,
151 fetch_texel_1d_f_rgbx8888_rev,
152 fetch_texel_2d_f_rgbx8888_rev,
153 fetch_texel_3d_f_rgbx8888_rev
154 },
155 {
156 MESA_FORMAT_XRGB8888,
157 fetch_texel_1d_f_xrgb8888,
158 fetch_texel_2d_f_xrgb8888,
159 fetch_texel_3d_f_xrgb8888
160 },
161 {
162 MESA_FORMAT_XRGB8888_REV,
163 fetch_texel_1d_f_xrgb8888_rev,
164 fetch_texel_2d_f_xrgb8888_rev,
165 fetch_texel_3d_f_xrgb8888_rev
166 },
167 {
168 MESA_FORMAT_RGB888,
169 fetch_texel_1d_f_rgb888,
170 fetch_texel_2d_f_rgb888,
171 fetch_texel_3d_f_rgb888
172 },
173 {
174 MESA_FORMAT_BGR888,
175 fetch_texel_1d_f_bgr888,
176 fetch_texel_2d_f_bgr888,
177 fetch_texel_3d_f_bgr888
178 },
179 {
180 MESA_FORMAT_RGB565,
181 fetch_texel_1d_f_rgb565,
182 fetch_texel_2d_f_rgb565,
183 fetch_texel_3d_f_rgb565
184 },
185 {
186 MESA_FORMAT_RGB565_REV,
187 fetch_texel_1d_f_rgb565_rev,
188 fetch_texel_2d_f_rgb565_rev,
189 fetch_texel_3d_f_rgb565_rev
190 },
191 {
192 MESA_FORMAT_ARGB4444,
193 fetch_texel_1d_f_argb4444,
194 fetch_texel_2d_f_argb4444,
195 fetch_texel_3d_f_argb4444
196 },
197 {
198 MESA_FORMAT_ARGB4444_REV,
199 fetch_texel_1d_f_argb4444_rev,
200 fetch_texel_2d_f_argb4444_rev,
201 fetch_texel_3d_f_argb4444_rev
202 },
203 {
204 MESA_FORMAT_RGBA5551,
205 fetch_texel_1d_f_rgba5551,
206 fetch_texel_2d_f_rgba5551,
207 fetch_texel_3d_f_rgba5551
208 },
209 {
210 MESA_FORMAT_ARGB1555,
211 fetch_texel_1d_f_argb1555,
212 fetch_texel_2d_f_argb1555,
213 fetch_texel_3d_f_argb1555
214 },
215 {
216 MESA_FORMAT_ARGB1555_REV,
217 fetch_texel_1d_f_argb1555_rev,
218 fetch_texel_2d_f_argb1555_rev,
219 fetch_texel_3d_f_argb1555_rev
220 },
221 {
222 MESA_FORMAT_AL44,
223 fetch_texel_1d_f_al44,
224 fetch_texel_2d_f_al44,
225 fetch_texel_3d_f_al44
226 },
227 {
228 MESA_FORMAT_AL88,
229 fetch_texel_1d_f_al88,
230 fetch_texel_2d_f_al88,
231 fetch_texel_3d_f_al88
232 },
233 {
234 MESA_FORMAT_AL88_REV,
235 fetch_texel_1d_f_al88_rev,
236 fetch_texel_2d_f_al88_rev,
237 fetch_texel_3d_f_al88_rev
238 },
239 {
240 MESA_FORMAT_AL1616,
241 fetch_texel_1d_f_al1616,
242 fetch_texel_2d_f_al1616,
243 fetch_texel_3d_f_al1616
244 },
245 {
246 MESA_FORMAT_AL1616_REV,
247 fetch_texel_1d_f_al1616_rev,
248 fetch_texel_2d_f_al1616_rev,
249 fetch_texel_3d_f_al1616_rev
250 },
251 {
252 MESA_FORMAT_RGB332,
253 fetch_texel_1d_f_rgb332,
254 fetch_texel_2d_f_rgb332,
255 fetch_texel_3d_f_rgb332
256 },
257 {
258 MESA_FORMAT_A8,
259 fetch_texel_1d_f_a8,
260 fetch_texel_2d_f_a8,
261 fetch_texel_3d_f_a8
262 },
263 {
264 MESA_FORMAT_A16,
265 fetch_texel_1d_f_a16,
266 fetch_texel_2d_f_a16,
267 fetch_texel_3d_f_a16
268 },
269 {
270 MESA_FORMAT_L8,
271 fetch_texel_1d_f_l8,
272 fetch_texel_2d_f_l8,
273 fetch_texel_3d_f_l8
274 },
275 {
276 MESA_FORMAT_L16,
277 fetch_texel_1d_f_l16,
278 fetch_texel_2d_f_l16,
279 fetch_texel_3d_f_l16
280 },
281 {
282 MESA_FORMAT_I8,
283 fetch_texel_1d_f_i8,
284 fetch_texel_2d_f_i8,
285 fetch_texel_3d_f_i8
286 },
287 {
288 MESA_FORMAT_I16,
289 fetch_texel_1d_f_i16,
290 fetch_texel_2d_f_i16,
291 fetch_texel_3d_f_i16
292 },
293 {
294 MESA_FORMAT_YCBCR,
295 fetch_texel_1d_f_ycbcr,
296 fetch_texel_2d_f_ycbcr,
297 fetch_texel_3d_f_ycbcr
298 },
299 {
300 MESA_FORMAT_YCBCR_REV,
301 fetch_texel_1d_f_ycbcr_rev,
302 fetch_texel_2d_f_ycbcr_rev,
303 fetch_texel_3d_f_ycbcr_rev
304 },
305 {
306 MESA_FORMAT_Z24_S8,
307 fetch_texel_1d_f_z24_s8,
308 fetch_texel_2d_f_z24_s8,
309 fetch_texel_3d_f_z24_s8
310 },
311 {
312 MESA_FORMAT_S8_Z24,
313 fetch_texel_1d_f_s8_z24,
314 fetch_texel_2d_f_s8_z24,
315 fetch_texel_3d_f_s8_z24
316 },
317 {
318 MESA_FORMAT_Z16,
319 fetch_texel_1d_f_z16,
320 fetch_texel_2d_f_z16,
321 fetch_texel_3d_f_z16
322 },
323 {
324 MESA_FORMAT_X8_Z24,
325 fetch_texel_1d_f_s8_z24,
326 fetch_texel_2d_f_s8_z24,
327 fetch_texel_3d_f_s8_z24
328 },
329 {
330 MESA_FORMAT_Z24_X8,
331 fetch_texel_1d_f_z24_s8,
332 fetch_texel_2d_f_z24_s8,
333 fetch_texel_3d_f_z24_s8
334 },
335 {
336 MESA_FORMAT_Z32,
337 fetch_texel_1d_f_z32,
338 fetch_texel_2d_f_z32,
339 fetch_texel_3d_f_z32
340 },
341 {
342 MESA_FORMAT_S8,
343 NULL,
344 NULL,
345 NULL
346 },
347 {
348 MESA_FORMAT_SRGB8,
349 fetch_texel_1d_srgb8,
350 fetch_texel_2d_srgb8,
351 fetch_texel_3d_srgb8
352 },
353 {
354 MESA_FORMAT_SRGBA8,
355 fetch_texel_1d_srgba8,
356 fetch_texel_2d_srgba8,
357 fetch_texel_3d_srgba8
358 },
359 {
360 MESA_FORMAT_SARGB8,
361 fetch_texel_1d_sargb8,
362 fetch_texel_2d_sargb8,
363 fetch_texel_3d_sargb8
364 },
365 {
366 MESA_FORMAT_SL8,
367 fetch_texel_1d_sl8,
368 fetch_texel_2d_sl8,
369 fetch_texel_3d_sl8
370 },
371 {
372 MESA_FORMAT_SLA8,
373 fetch_texel_1d_sla8,
374 fetch_texel_2d_sla8,
375 fetch_texel_3d_sla8
376 },
377 {
378 MESA_FORMAT_RGBA_FLOAT32,
379 fetch_texel_1d_f_rgba_f32,
380 fetch_texel_2d_f_rgba_f32,
381 fetch_texel_3d_f_rgba_f32
382 },
383 {
384 MESA_FORMAT_RGBA_FLOAT16,
385 fetch_texel_1d_f_rgba_f16,
386 fetch_texel_2d_f_rgba_f16,
387 fetch_texel_3d_f_rgba_f16
388 },
389 {
390 MESA_FORMAT_RGB_FLOAT32,
391 fetch_texel_1d_f_rgb_f32,
392 fetch_texel_2d_f_rgb_f32,
393 fetch_texel_3d_f_rgb_f32
394 },
395 {
396 MESA_FORMAT_RGB_FLOAT16,
397 fetch_texel_1d_f_rgb_f16,
398 fetch_texel_2d_f_rgb_f16,
399 fetch_texel_3d_f_rgb_f16
400 },
401 {
402 MESA_FORMAT_ALPHA_FLOAT32,
403 fetch_texel_1d_f_alpha_f32,
404 fetch_texel_2d_f_alpha_f32,
405 fetch_texel_3d_f_alpha_f32
406 },
407 {
408 MESA_FORMAT_ALPHA_FLOAT16,
409 fetch_texel_1d_f_alpha_f16,
410 fetch_texel_2d_f_alpha_f16,
411 fetch_texel_3d_f_alpha_f16
412 },
413 {
414 MESA_FORMAT_LUMINANCE_FLOAT32,
415 fetch_texel_1d_f_luminance_f32,
416 fetch_texel_2d_f_luminance_f32,
417 fetch_texel_3d_f_luminance_f32
418 },
419 {
420 MESA_FORMAT_LUMINANCE_FLOAT16,
421 fetch_texel_1d_f_luminance_f16,
422 fetch_texel_2d_f_luminance_f16,
423 fetch_texel_3d_f_luminance_f16
424 },
425 {
426 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32,
427 fetch_texel_1d_f_luminance_alpha_f32,
428 fetch_texel_2d_f_luminance_alpha_f32,
429 fetch_texel_3d_f_luminance_alpha_f32
430 },
431 {
432 MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
433 fetch_texel_1d_f_luminance_alpha_f16,
434 fetch_texel_2d_f_luminance_alpha_f16,
435 fetch_texel_3d_f_luminance_alpha_f16
436 },
437 {
438 MESA_FORMAT_INTENSITY_FLOAT32,
439 fetch_texel_1d_f_intensity_f32,
440 fetch_texel_2d_f_intensity_f32,
441 fetch_texel_3d_f_intensity_f32
442 },
443 {
444 MESA_FORMAT_INTENSITY_FLOAT16,
445 fetch_texel_1d_f_intensity_f16,
446 fetch_texel_2d_f_intensity_f16,
447 fetch_texel_3d_f_intensity_f16
448 },
449
450 {
451 MESA_FORMAT_ALPHA_UINT8,
452 NULL,
453 NULL,
454 NULL
455 },
456
457 {
458 MESA_FORMAT_ALPHA_UINT16,
459 NULL,
460 NULL,
461 NULL
462 },
463
464 {
465 MESA_FORMAT_ALPHA_UINT32,
466 NULL,
467 NULL,
468 NULL
469 },
470
471 {
472 MESA_FORMAT_ALPHA_INT8,
473 NULL,
474 NULL,
475 NULL
476 },
477
478 {
479 MESA_FORMAT_ALPHA_INT16,
480 NULL,
481 NULL,
482 NULL
483 },
484
485 {
486 MESA_FORMAT_ALPHA_INT32,
487 NULL,
488 NULL,
489 NULL
490 },
491
492
493 {
494 MESA_FORMAT_INTENSITY_UINT8,
495 NULL,
496 NULL,
497 NULL
498 },
499
500 {
501 MESA_FORMAT_INTENSITY_UINT16,
502 NULL,
503 NULL,
504 NULL
505 },
506
507 {
508 MESA_FORMAT_INTENSITY_UINT32,
509 NULL,
510 NULL,
511 NULL
512 },
513
514 {
515 MESA_FORMAT_INTENSITY_INT8,
516 NULL,
517 NULL,
518 NULL
519 },
520
521 {
522 MESA_FORMAT_INTENSITY_INT16,
523 NULL,
524 NULL,
525 NULL
526 },
527
528 {
529 MESA_FORMAT_INTENSITY_INT32,
530 NULL,
531 NULL,
532 NULL
533 },
534
535
536 {
537 MESA_FORMAT_LUMINANCE_UINT8,
538 NULL,
539 NULL,
540 NULL
541 },
542
543 {
544 MESA_FORMAT_LUMINANCE_UINT16,
545 NULL,
546 NULL,
547 NULL
548 },
549
550 {
551 MESA_FORMAT_LUMINANCE_UINT32,
552 NULL,
553 NULL,
554 NULL
555 },
556
557 {
558 MESA_FORMAT_LUMINANCE_INT8,
559 NULL,
560 NULL,
561 NULL
562 },
563
564 {
565 MESA_FORMAT_LUMINANCE_INT16,
566 NULL,
567 NULL,
568 NULL
569 },
570
571 {
572 MESA_FORMAT_LUMINANCE_INT32,
573 NULL,
574 NULL,
575 NULL
576 },
577
578
579 {
580 MESA_FORMAT_LUMINANCE_ALPHA_UINT8,
581 NULL,
582 NULL,
583 NULL
584 },
585
586 {
587 MESA_FORMAT_LUMINANCE_ALPHA_UINT16,
588 NULL,
589 NULL,
590 NULL
591 },
592
593 {
594 MESA_FORMAT_LUMINANCE_ALPHA_UINT32,
595 NULL,
596 NULL,
597 NULL
598 },
599
600 {
601 MESA_FORMAT_LUMINANCE_ALPHA_INT8,
602 NULL,
603 NULL,
604 NULL
605 },
606
607 {
608 MESA_FORMAT_LUMINANCE_ALPHA_INT16,
609 NULL,
610 NULL,
611 NULL
612 },
613
614 {
615 MESA_FORMAT_LUMINANCE_ALPHA_INT32,
616 NULL,
617 NULL,
618 NULL
619 },
620
621 {
622 MESA_FORMAT_RGB_INT8,
623 NULL,
624 NULL,
625 NULL
626 },
627
628 /* non-normalized, signed int */
629 {
630 MESA_FORMAT_RGBA_INT8,
631 fetch_texel_1d_rgba_int8,
632 fetch_texel_2d_rgba_int8,
633 fetch_texel_3d_rgba_int8
634 },
635 {
636 MESA_FORMAT_RGB_INT16,
637 NULL,
638 NULL,
639 NULL
640 },
641 {
642 MESA_FORMAT_RGBA_INT16,
643 fetch_texel_1d_rgba_int16,
644 fetch_texel_2d_rgba_int16,
645 fetch_texel_3d_rgba_int16
646 },
647 {
648 MESA_FORMAT_RGB_INT32,
649 NULL,
650 NULL,
651 NULL
652 },
653 {
654 MESA_FORMAT_RGBA_INT32,
655 fetch_texel_1d_rgba_int32,
656 fetch_texel_2d_rgba_int32,
657 fetch_texel_3d_rgba_int32
658 },
659
660 /* non-normalized, unsigned int */
661 {
662 MESA_FORMAT_RGB_UINT8,
663 NULL,
664 NULL,
665 NULL
666 },
667 {
668 MESA_FORMAT_RGBA_UINT8,
669 fetch_texel_1d_rgba_uint8,
670 fetch_texel_2d_rgba_uint8,
671 fetch_texel_3d_rgba_uint8
672 },
673 {
674 MESA_FORMAT_RGB_UINT16,
675 NULL,
676 NULL,
677 NULL
678 },
679 {
680 MESA_FORMAT_RGBA_UINT16,
681 fetch_texel_1d_rgba_uint16,
682 fetch_texel_2d_rgba_uint16,
683 fetch_texel_3d_rgba_uint16
684 },
685 {
686 MESA_FORMAT_RGB_UINT32,
687 NULL,
688 NULL,
689 NULL
690 },
691 {
692 MESA_FORMAT_RGBA_UINT32,
693 fetch_texel_1d_rgba_uint32,
694 fetch_texel_2d_rgba_uint32,
695 fetch_texel_3d_rgba_uint32
696 },
697
698 /* dudv */
699 {
700 MESA_FORMAT_DUDV8,
701 fetch_texel_1d_dudv8,
702 fetch_texel_2d_dudv8,
703 fetch_texel_3d_dudv8
704 },
705
706 /* signed, normalized */
707 {
708 MESA_FORMAT_SIGNED_RGBA_16,
709 fetch_texel_1d_signed_rgba_16,
710 fetch_texel_2d_signed_rgba_16,
711 fetch_texel_3d_signed_rgba_16
712 },
713 {
714 MESA_FORMAT_RGBA_16,
715 fetch_texel_1d_rgba_16,
716 fetch_texel_2d_rgba_16,
717 fetch_texel_3d_rgba_16
718 },
719 {
720 MESA_FORMAT_Z32_FLOAT,
721 fetch_texel_1d_f_r_f32, /* Reuse the R32F functions. */
722 fetch_texel_2d_f_r_f32,
723 fetch_texel_3d_f_r_f32
724 },
725 {
726 MESA_FORMAT_Z32_FLOAT_X24S8,
727 fetch_texel_1d_z32f_x24s8,
728 fetch_texel_2d_z32f_x24s8,
729 fetch_texel_3d_z32f_x24s8
730 }
731 };
732
733
734 FetchTexelFunc
735 _mesa_get_texel_fetch_func(gl_format format, GLuint dims)
736 {
737 #ifdef DEBUG
738 /* check that the table entries are sorted by format name */
739 gl_format fmt;
740 for (fmt = 0; fmt < MESA_FORMAT_COUNT; fmt++) {
741 assert(texfetch_funcs[fmt].Name == fmt);
742 }
743 #endif
744
745 STATIC_ASSERT(Elements(texfetch_funcs) == MESA_FORMAT_COUNT);
746
747 assert(format < MESA_FORMAT_COUNT);
748
749 switch (dims) {
750 case 1:
751 return texfetch_funcs[format].Fetch1D;
752 case 2:
753 return texfetch_funcs[format].Fetch2D;
754 case 3:
755 return texfetch_funcs[format].Fetch3D;
756 default:
757 assert(0 && "bad dims in _mesa_get_texel_fetch_func");
758 return NULL;
759 }
760 }
761
762
763 /**
764 * Initialize the texture image's FetchTexel methods.
765 */
766 static void
767 set_fetch_functions(struct swrast_texture_image *texImage, GLuint dims)
768 {
769 gl_format format = texImage->Base.TexFormat;
770
771 ASSERT(dims == 1 || dims == 2 || dims == 3);
772
773 if (_mesa_get_format_color_encoding(format) == GL_SRGB) {
774 format = _mesa_get_srgb_format_linear(format);
775 }
776
777 texImage->FetchTexel = _mesa_get_texel_fetch_func(format, dims);
778 ASSERT(texImage->FetchTexel);
779 }
780
781 void
782 _mesa_update_fetch_functions(struct gl_texture_object *texObj)
783 {
784 GLuint face, i;
785 GLuint dims;
786
787 dims = _mesa_get_texture_dimensions(texObj->Target);
788
789 for (face = 0; face < 6; face++) {
790 for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
791 if (texObj->Image[face][i]) {
792 set_fetch_functions(swrast_texture_image(texObj->Image[face][i]),
793 dims);
794 }
795 }
796 }
797 }