1 /**************************************************************************
3 Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
4 Copyright 2003 Eric Anholt
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the "Software"),
9 to deal in the Software without restriction, including without limitation
10 on the rights to use, copy, modify, merge, publish, distribute, sub
11 license, and/or sell copies of the Software, and to permit persons to whom
12 the Software is furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice (including the next
15 paragraph) shall be included in all copies or substantial portions of the
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 ERIC ANHOLT OR SILICON INTEGRATED SYSTEMS CORP BE LIABLE FOR ANY CLAIM,
22 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 * Sung-Ching Lin <sclin@sis.com.tw>
31 * Eric Anholt <anholt@FreeBSD.org>
34 #include "main/glheader.h"
35 #include "main/imports.h"
36 #include "main/colormac.h"
37 #include "main/context.h"
38 #include "main/macros.h"
39 #include "main/texformat.h"
41 #include "sis_context.h"
42 #include "sis_state.h"
45 #include "sis_alloc.h"
47 static GLint
TransferTexturePitch (GLint dwPitch
);
49 /* Handle texenv stuff, called from validate_texture (renderstart) */
51 sis_set_texture_env0( GLcontext
*ctx
, struct gl_texture_object
*texObj
,
54 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
57 __GLSiSHardware
*prev
= &smesa
->prev
;
58 __GLSiSHardware
*current
= &smesa
->current
;
60 struct gl_texture_unit
*texture_unit
= &ctx
->Texture
.Unit
[unit
];
62 sisTexObjPtr t
= texObj
->DriverData
;
64 switch (texture_unit
->EnvMode
)
70 current
->hwTexBlendColor0
= STAGE0_C_CF
;
71 current
->hwTexBlendAlpha0
= STAGE0_A_AS
;
76 current
->hwTexBlendColor0
= STAGE0_C_CS
;
77 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
80 case GL_LUMINANCE_ALPHA
:
82 current
->hwTexBlendColor0
= STAGE0_C_CS
;
83 current
->hwTexBlendAlpha0
= STAGE0_A_AS
;
86 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
94 current
->hwTexBlendColor0
= STAGE0_C_CF
;
95 current
->hwTexBlendAlpha0
= STAGE0_A_AFAS
;
100 current
->hwTexBlendColor0
= STAGE0_C_CFCS
;
101 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
104 case GL_LUMINANCE_ALPHA
:
106 current
->hwTexBlendColor0
= STAGE0_C_CFCS
;
107 current
->hwTexBlendAlpha0
= STAGE0_A_AFAS
;
110 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
119 current
->hwTexBlendColor0
= STAGE0_C_CS
;
120 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
123 current
->hwTexBlendColor0
= STAGE0_C_CFOMAS_CSAS
;
124 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
129 case GL_LUMINANCE_ALPHA
:
130 current
->hwTexBlendColor0
= STAGE0_C_CF
;
131 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
134 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
139 UNCLAMPED_FLOAT_TO_RGBA_CHAN(c
, texture_unit
->EnvColor
);
140 current
->hwTexEnvColor
= ((GLint
) (c
[3])) << 24 |
141 ((GLint
) (c
[0])) << 16 |
142 ((GLint
) (c
[1])) << 8 |
147 current
->hwTexBlendColor0
= STAGE0_C_CF
;
148 current
->hwTexBlendAlpha0
= STAGE0_A_AFAS
;
153 current
->hwTexBlendColor0
= STAGE0_C_CFOMCS_CCCS
;
154 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
157 current
->hwTexBlendColor0
= STAGE0_C_CFOMCS_CCCS
;
158 current
->hwTexBlendAlpha0
= STAGE0_A_AFOMAS_ACAS
;
160 case GL_LUMINANCE_ALPHA
:
162 current
->hwTexBlendColor0
= STAGE0_C_CFOMCS_CCCS
;
163 current
->hwTexBlendAlpha0
= STAGE0_A_AFAS
;
166 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
171 sis_fatal_error("unknown env mode 0x%x\n", texture_unit
->EnvMode
);
174 if ((current
->hwTexBlendColor0
!= prev
->hwTexBlendColor0
) ||
175 (current
->hwTexBlendAlpha0
!= prev
->hwTexBlendAlpha0
) ||
176 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
178 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
179 prev
->hwTexBlendColor0
= current
->hwTexBlendColor0
;
180 prev
->hwTexBlendAlpha0
= current
->hwTexBlendAlpha0
;
181 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV
;
185 /* Handle texenv stuff, called from validate_texture (renderstart) */
187 sis_set_texture_env1( GLcontext
*ctx
, struct gl_texture_object
*texObj
,
190 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
193 __GLSiSHardware
*prev
= &smesa
->prev
;
194 __GLSiSHardware
*current
= &smesa
->current
;
196 struct gl_texture_unit
*texture_unit
= &ctx
->Texture
.Unit
[unit
];
198 sisTexObjPtr t
= texObj
->DriverData
;
200 switch (texture_unit
->EnvMode
)
206 current
->hwTexBlendColor1
= STAGE1_C_CF
;
207 current
->hwTexBlendAlpha1
= STAGE1_A_AS
;
212 current
->hwTexBlendColor1
= STAGE1_C_CS
;
213 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
216 case GL_LUMINANCE_ALPHA
:
218 current
->hwTexBlendColor1
= STAGE1_C_CS
;
219 current
->hwTexBlendAlpha1
= STAGE1_A_AS
;
222 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
230 current
->hwTexBlendColor1
= STAGE1_C_CF
;
231 current
->hwTexBlendAlpha1
= STAGE1_A_AFAS
;
236 current
->hwTexBlendColor1
= STAGE1_C_CFCS
;
237 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
240 case GL_LUMINANCE_ALPHA
:
242 current
->hwTexBlendColor1
= STAGE1_C_CFCS
;
243 current
->hwTexBlendAlpha1
= STAGE1_A_AFAS
;
246 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
255 current
->hwTexBlendColor1
= STAGE1_C_CS
;
256 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
259 current
->hwTexBlendColor1
= STAGE1_C_CFOMAS_CSAS
;
260 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
265 case GL_LUMINANCE_ALPHA
:
266 current
->hwTexBlendColor1
= STAGE1_C_CF
;
267 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
270 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
275 UNCLAMPED_FLOAT_TO_RGBA_CHAN(c
, texture_unit
->EnvColor
);
276 current
->hwTexEnvColor
= ((GLint
) (c
[3])) << 24 |
277 ((GLint
) (c
[0])) << 16 |
278 ((GLint
) (c
[1])) << 8 |
283 current
->hwTexBlendColor1
= STAGE1_C_CF
;
284 current
->hwTexBlendAlpha1
= STAGE1_A_AFAS
;
289 current
->hwTexBlendColor1
= STAGE1_C_CFOMCS_CCCS
;
290 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
293 current
->hwTexBlendColor1
= STAGE1_C_CFOMCS_CCCS
;
294 current
->hwTexBlendAlpha1
= STAGE1_A_AFOMAS_ACAS
;
296 case GL_LUMINANCE_ALPHA
:
298 current
->hwTexBlendColor1
= STAGE1_C_CFOMCS_CCCS
;
299 current
->hwTexBlendAlpha1
= STAGE1_A_AFAS
;
302 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
307 sis_fatal_error("unknown env mode 0x%x\n", texture_unit
->EnvMode
);
310 if ((current
->hwTexBlendColor1
!= prev
->hwTexBlendColor1
) ||
311 (current
->hwTexBlendAlpha1
!= prev
->hwTexBlendAlpha1
) ||
312 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
314 prev
->hwTexBlendColor1
= current
->hwTexBlendColor1
;
315 prev
->hwTexBlendAlpha1
= current
->hwTexBlendAlpha1
;
316 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
317 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV_1
;
321 /* Returns 0 if a software fallback is necessary */
323 sis_set_texobj_parm( GLcontext
*ctx
, struct gl_texture_object
*texObj
,
326 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
329 __GLSiSHardware
*prev
= &smesa
->prev
;
330 __GLSiSHardware
*current
= &smesa
->current
;
332 sisTexObjPtr t
= texObj
->DriverData
;
334 GLint firstLevel
, lastLevel
;
337 current
->texture
[hw_unit
].hwTextureMip
= 0UL;
338 current
->texture
[hw_unit
].hwTextureSet
= t
->hwformat
;
340 if ((texObj
->MinFilter
== GL_NEAREST
) || (texObj
->MinFilter
== GL_LINEAR
)) {
341 firstLevel
= lastLevel
= texObj
->BaseLevel
;
343 /* Compute which mipmap levels we really want to send to the hardware.
344 * This depends on the base image size, GL_TEXTURE_MIN_LOD,
345 * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL.
346 * Yes, this looks overly complicated, but it's all needed.
349 firstLevel
= texObj
->BaseLevel
+ (GLint
)(texObj
->MinLod
+ 0.5);
350 firstLevel
= MAX2(firstLevel
, texObj
->BaseLevel
);
351 lastLevel
= texObj
->BaseLevel
+ (GLint
)(texObj
->MaxLod
+ 0.5);
352 lastLevel
= MAX2(lastLevel
, texObj
->BaseLevel
);
353 lastLevel
= MIN2(lastLevel
, texObj
->BaseLevel
+
354 texObj
->Image
[0][texObj
->BaseLevel
]->MaxLog2
);
355 lastLevel
= MIN2(lastLevel
, texObj
->MaxLevel
);
356 lastLevel
= MAX2(firstLevel
, lastLevel
); /* need at least one level */
359 current
->texture
[hw_unit
].hwTextureSet
|= (lastLevel
<< 8);
361 switch (texObj
->MagFilter
)
364 current
->texture
[hw_unit
].hwTextureMip
|= TEXTURE_FILTER_NEAREST
;
367 current
->texture
[hw_unit
].hwTextureMip
|= (TEXTURE_FILTER_LINEAR
<< 3);
374 /* The mipmap lod biasing is based on experiment. It seems there's a
375 * limit of around +4/-4 to the bias value; we're being conservative.
377 b
= (GLint
) (ctx
->Texture
.Unit
[hw_unit
].LodBias
* 32.0);
383 current
->texture
[hw_unit
].hwTextureMip
|= ((b
<< 4) &
384 MASK_TextureMipmapLodBias
);
387 switch (texObj
->MinFilter
)
390 current
->texture
[hw_unit
].hwTextureMip
|= TEXTURE_FILTER_NEAREST
;
393 current
->texture
[hw_unit
].hwTextureMip
|= TEXTURE_FILTER_LINEAR
;
395 case GL_NEAREST_MIPMAP_NEAREST
:
396 current
->texture
[hw_unit
].hwTextureMip
|=
397 TEXTURE_FILTER_NEAREST_MIP_NEAREST
;
399 case GL_NEAREST_MIPMAP_LINEAR
:
400 current
->texture
[hw_unit
].hwTextureMip
|=
401 TEXTURE_FILTER_NEAREST_MIP_LINEAR
;
403 case GL_LINEAR_MIPMAP_NEAREST
:
404 current
->texture
[hw_unit
].hwTextureMip
|=
405 TEXTURE_FILTER_LINEAR_MIP_NEAREST
;
407 case GL_LINEAR_MIPMAP_LINEAR
:
408 current
->texture
[hw_unit
].hwTextureMip
|=
409 TEXTURE_FILTER_LINEAR_MIP_LINEAR
;
413 switch (texObj
->WrapS
)
416 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureWrapU
;
418 case GL_MIRRORED_REPEAT
:
419 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureMirrorU
;
422 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureClampU
;
423 /* XXX: GL_CLAMP isn't conformant, but falling back makes the situation
424 * worse in other programs at the moment.
428 case GL_CLAMP_TO_EDGE
:
429 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureClampU
;
431 case GL_CLAMP_TO_BORDER
:
432 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureBorderU
;
436 switch (texObj
->WrapT
)
439 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureWrapV
;
441 case GL_MIRRORED_REPEAT
:
442 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureMirrorV
;
445 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureClampV
;
446 /* XXX: GL_CLAMP isn't conformant, but falling back makes the situation
447 * worse in other programs at the moment.
451 case GL_CLAMP_TO_EDGE
:
452 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureClampV
;
454 case GL_CLAMP_TO_BORDER
:
455 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureBorderV
;
461 CLAMPED_FLOAT_TO_UBYTE(c
[0], texObj
->BorderColor
[0]);
462 CLAMPED_FLOAT_TO_UBYTE(c
[1], texObj
->BorderColor
[1]);
463 CLAMPED_FLOAT_TO_UBYTE(c
[2], texObj
->BorderColor
[2]);
464 CLAMPED_FLOAT_TO_UBYTE(c
[3], texObj
->BorderColor
[3]);
466 current
->texture
[hw_unit
].hwTextureBorderColor
=
467 PACK_COLOR_8888(c
[3], c
[0], c
[1], c
[2]);
470 if (current
->texture
[hw_unit
].hwTextureBorderColor
!=
471 prev
->texture
[hw_unit
].hwTextureBorderColor
)
473 prev
->texture
[hw_unit
].hwTextureBorderColor
=
474 current
->texture
[hw_unit
].hwTextureBorderColor
;
476 smesa
->GlobalFlag
|= GFLAG_TEXBORDERCOLOR_1
;
478 smesa
->GlobalFlag
|= GFLAG_TEXBORDERCOLOR
;
481 current
->texture
[hw_unit
].hwTextureSet
|=
482 texObj
->Image
[0][firstLevel
]->WidthLog2
<< 4;
483 current
->texture
[hw_unit
].hwTextureSet
|=
484 texObj
->Image
[0][firstLevel
]->HeightLog2
;
487 smesa
->GlobalFlag
|= GFLAG_TEXTUREADDRESS
;
489 smesa
->GlobalFlag
|= GFLAG_TEXTUREADDRESS_1
;
491 for (i
= firstLevel
; i
<= lastLevel
; i
++)
493 GLuint texOffset
= 0;
494 GLuint texPitch
= TransferTexturePitch( t
->image
[i
].pitch
);
496 switch (t
->image
[i
].memType
)
499 texOffset
= ((unsigned long)t
->image
[i
].Data
- (unsigned long)smesa
->FbBase
);
502 texOffset
= ((unsigned long)t
->image
[i
].Data
- (unsigned long)smesa
->AGPBase
) +
503 (unsigned long) smesa
->AGPAddr
;
504 current
->texture
[hw_unit
].hwTextureMip
|=
505 (MASK_TextureLevel0InSystem
<< i
);
512 prev
->texture
[hw_unit
].texOffset0
= texOffset
;
513 prev
->texture
[hw_unit
].texPitch01
= texPitch
<< 16;
516 prev
->texture
[hw_unit
].texOffset1
= texOffset
;
517 prev
->texture
[hw_unit
].texPitch01
|= texPitch
;
520 prev
->texture
[hw_unit
].texOffset2
= texOffset
;
521 prev
->texture
[hw_unit
].texPitch23
= texPitch
<< 16;
524 prev
->texture
[hw_unit
].texOffset3
= texOffset
;
525 prev
->texture
[hw_unit
].texPitch23
|= texPitch
;
528 prev
->texture
[hw_unit
].texOffset4
= texOffset
;
529 prev
->texture
[hw_unit
].texPitch45
= texPitch
<< 16;
532 prev
->texture
[hw_unit
].texOffset5
= texOffset
;
533 prev
->texture
[hw_unit
].texPitch45
|= texPitch
;
536 prev
->texture
[hw_unit
].texOffset6
= texOffset
;
537 prev
->texture
[hw_unit
].texPitch67
= texPitch
<< 16;
540 prev
->texture
[hw_unit
].texOffset7
= texOffset
;
541 prev
->texture
[hw_unit
].texPitch67
|= texPitch
;
544 prev
->texture
[hw_unit
].texOffset8
= texOffset
;
545 prev
->texture
[hw_unit
].texPitch89
= texPitch
<< 16;
548 prev
->texture
[hw_unit
].texOffset9
= texOffset
;
549 prev
->texture
[hw_unit
].texPitch89
|= texPitch
;
552 prev
->texture
[hw_unit
].texOffset10
= texOffset
;
553 prev
->texture
[hw_unit
].texPitch10
= texPitch
<< 16;
556 prev
->texture
[hw_unit
].texOffset11
= texOffset
;
557 prev
->texture
[hw_unit
].texPitch10
|= texPitch
;
562 if (current
->texture
[hw_unit
].hwTextureSet
!=
563 prev
->texture
[hw_unit
].hwTextureSet
)
565 prev
->texture
[hw_unit
].hwTextureSet
=
566 current
->texture
[hw_unit
].hwTextureSet
;
568 smesa
->GlobalFlag
|= CFLAG_TEXTURERESET_1
;
570 smesa
->GlobalFlag
|= CFLAG_TEXTURERESET
;
572 if (current
->texture
[hw_unit
].hwTextureMip
!=
573 prev
->texture
[hw_unit
].hwTextureMip
)
575 prev
->texture
[hw_unit
].hwTextureMip
=
576 current
->texture
[hw_unit
].hwTextureMip
;
578 smesa
->GlobalFlag
|= GFLAG_TEXTUREMIPMAP_1
;
580 smesa
->GlobalFlag
|= GFLAG_TEXTUREMIPMAP
;
586 /* Disable a texture unit, called from validate_texture */
588 sis_reset_texture_env (GLcontext
*ctx
, int hw_unit
)
590 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
592 __GLSiSHardware
*prev
= &smesa
->prev
;
593 __GLSiSHardware
*current
= &smesa
->current
;
597 current
->hwTexBlendColor1
= STAGE1_C_CF
;
598 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
600 if ((current
->hwTexBlendColor1
!= prev
->hwTexBlendColor1
) ||
601 (current
->hwTexBlendAlpha1
!= prev
->hwTexBlendAlpha1
) ||
602 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
604 prev
->hwTexBlendColor1
= current
->hwTexBlendColor1
;
605 prev
->hwTexBlendAlpha1
= current
->hwTexBlendAlpha1
;
606 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
607 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV_1
;
610 current
->hwTexBlendColor0
= STAGE0_C_CF
;
611 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
613 if ((current
->hwTexBlendColor0
!= prev
->hwTexBlendColor0
) ||
614 (current
->hwTexBlendAlpha0
!= prev
->hwTexBlendAlpha0
) ||
615 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
617 prev
->hwTexBlendColor0
= current
->hwTexBlendColor0
;
618 prev
->hwTexBlendAlpha0
= current
->hwTexBlendAlpha0
;
619 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
620 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV
;
625 static void updateTextureUnit( GLcontext
*ctx
, int unit
)
627 sisContextPtr smesa
= SIS_CONTEXT( ctx
);
628 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[unit
];
629 struct gl_texture_object
*texObj
= texUnit
->_Current
;
633 fallbackbit
= SIS_FALLBACK_TEXTURE0
;
635 fallbackbit
= SIS_FALLBACK_TEXTURE1
;
637 if (texUnit
->_ReallyEnabled
& (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
)) {
638 if (smesa
->TexStates
[unit
] & NEW_TEXTURING
) {
641 ok
= sis_set_texobj_parm (ctx
, texObj
, unit
);
642 FALLBACK( smesa
, fallbackbit
, !ok
);
644 if (smesa
->TexStates
[unit
] & NEW_TEXTURE_ENV
) {
646 sis_set_texture_env0( ctx
, texObj
, unit
);
648 sis_set_texture_env1( ctx
, texObj
, unit
);
650 smesa
->TexStates
[unit
] = 0;
651 } else if ( texUnit
->_ReallyEnabled
) {
653 FALLBACK( smesa
, fallbackbit
, 1 );
655 sis_reset_texture_env( ctx
, unit
);
656 FALLBACK( smesa
, fallbackbit
, 0 );
661 void sisUpdateTextureState( GLcontext
*ctx
)
663 sisContextPtr smesa
= SIS_CONTEXT( ctx
);
665 __GLSiSHardware
*current
= &smesa
->current
;
668 /* TODO : if unmark these, error in multitexture */ /* XXX */
669 for (i
= 0; i
< SIS_MAX_TEXTURES
; i
++)
670 smesa
->TexStates
[i
] |= (NEW_TEXTURING
| NEW_TEXTURE_ENV
);
673 updateTextureUnit( ctx
, 0 );
674 updateTextureUnit( ctx
, 1 );
676 /* XXX Issues with the 2nd unit but not the first being enabled? */
677 if ( ctx
->Texture
.Unit
[0]._ReallyEnabled
&
678 (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
) ||
679 ctx
->Texture
.Unit
[1]._ReallyEnabled
&
680 (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
) )
682 current
->hwCapEnable
|= MASK_TextureEnable
;
683 current
->hwCapEnable
&= ~MASK_TextureNumUsed
;
684 if (ctx
->Texture
.Unit
[1]._ReallyEnabled
)
685 current
->hwCapEnable
|= 0x00002000;
687 current
->hwCapEnable
|= 0x00001000;
689 current
->hwCapEnable
&= ~MASK_TextureEnable
;
694 BitScanForward( GLshort w
)
698 for (i
= 0; i
< 16; i
++) {
706 TransferTexturePitch( GLint dwPitch
)
710 i
= BitScanForward( (GLshort
)dwPitch
);
711 dwRet
= dwPitch
>> i
;