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
;
459 current
->texture
[hw_unit
].hwTextureBorderColor
=
460 ((GLuint
) texObj
->_BorderChan
[3] << 24) +
461 ((GLuint
) texObj
->_BorderChan
[0] << 16) +
462 ((GLuint
) texObj
->_BorderChan
[1] << 8) +
463 ((GLuint
) texObj
->_BorderChan
[2]);
465 if (current
->texture
[hw_unit
].hwTextureBorderColor
!=
466 prev
->texture
[hw_unit
].hwTextureBorderColor
)
468 prev
->texture
[hw_unit
].hwTextureBorderColor
=
469 current
->texture
[hw_unit
].hwTextureBorderColor
;
471 smesa
->GlobalFlag
|= GFLAG_TEXBORDERCOLOR_1
;
473 smesa
->GlobalFlag
|= GFLAG_TEXBORDERCOLOR
;
476 current
->texture
[hw_unit
].hwTextureSet
|=
477 texObj
->Image
[0][firstLevel
]->WidthLog2
<< 4;
478 current
->texture
[hw_unit
].hwTextureSet
|=
479 texObj
->Image
[0][firstLevel
]->HeightLog2
;
482 smesa
->GlobalFlag
|= GFLAG_TEXTUREADDRESS
;
484 smesa
->GlobalFlag
|= GFLAG_TEXTUREADDRESS_1
;
486 for (i
= firstLevel
; i
<= lastLevel
; i
++)
488 GLuint texOffset
= 0;
489 GLuint texPitch
= TransferTexturePitch( t
->image
[i
].pitch
);
491 switch (t
->image
[i
].memType
)
494 texOffset
= ((unsigned long)t
->image
[i
].Data
- (unsigned long)smesa
->FbBase
);
497 texOffset
= ((unsigned long)t
->image
[i
].Data
- (unsigned long)smesa
->AGPBase
) +
498 (unsigned long) smesa
->AGPAddr
;
499 current
->texture
[hw_unit
].hwTextureMip
|=
500 (MASK_TextureLevel0InSystem
<< i
);
507 prev
->texture
[hw_unit
].texOffset0
= texOffset
;
508 prev
->texture
[hw_unit
].texPitch01
= texPitch
<< 16;
511 prev
->texture
[hw_unit
].texOffset1
= texOffset
;
512 prev
->texture
[hw_unit
].texPitch01
|= texPitch
;
515 prev
->texture
[hw_unit
].texOffset2
= texOffset
;
516 prev
->texture
[hw_unit
].texPitch23
= texPitch
<< 16;
519 prev
->texture
[hw_unit
].texOffset3
= texOffset
;
520 prev
->texture
[hw_unit
].texPitch23
|= texPitch
;
523 prev
->texture
[hw_unit
].texOffset4
= texOffset
;
524 prev
->texture
[hw_unit
].texPitch45
= texPitch
<< 16;
527 prev
->texture
[hw_unit
].texOffset5
= texOffset
;
528 prev
->texture
[hw_unit
].texPitch45
|= texPitch
;
531 prev
->texture
[hw_unit
].texOffset6
= texOffset
;
532 prev
->texture
[hw_unit
].texPitch67
= texPitch
<< 16;
535 prev
->texture
[hw_unit
].texOffset7
= texOffset
;
536 prev
->texture
[hw_unit
].texPitch67
|= texPitch
;
539 prev
->texture
[hw_unit
].texOffset8
= texOffset
;
540 prev
->texture
[hw_unit
].texPitch89
= texPitch
<< 16;
543 prev
->texture
[hw_unit
].texOffset9
= texOffset
;
544 prev
->texture
[hw_unit
].texPitch89
|= texPitch
;
547 prev
->texture
[hw_unit
].texOffset10
= texOffset
;
548 prev
->texture
[hw_unit
].texPitch10
= texPitch
<< 16;
551 prev
->texture
[hw_unit
].texOffset11
= texOffset
;
552 prev
->texture
[hw_unit
].texPitch10
|= texPitch
;
557 if (current
->texture
[hw_unit
].hwTextureSet
!=
558 prev
->texture
[hw_unit
].hwTextureSet
)
560 prev
->texture
[hw_unit
].hwTextureSet
=
561 current
->texture
[hw_unit
].hwTextureSet
;
563 smesa
->GlobalFlag
|= CFLAG_TEXTURERESET_1
;
565 smesa
->GlobalFlag
|= CFLAG_TEXTURERESET
;
567 if (current
->texture
[hw_unit
].hwTextureMip
!=
568 prev
->texture
[hw_unit
].hwTextureMip
)
570 prev
->texture
[hw_unit
].hwTextureMip
=
571 current
->texture
[hw_unit
].hwTextureMip
;
573 smesa
->GlobalFlag
|= GFLAG_TEXTUREMIPMAP_1
;
575 smesa
->GlobalFlag
|= GFLAG_TEXTUREMIPMAP
;
581 /* Disable a texture unit, called from validate_texture */
583 sis_reset_texture_env (GLcontext
*ctx
, int hw_unit
)
585 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
587 __GLSiSHardware
*prev
= &smesa
->prev
;
588 __GLSiSHardware
*current
= &smesa
->current
;
592 current
->hwTexBlendColor1
= STAGE1_C_CF
;
593 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
595 if ((current
->hwTexBlendColor1
!= prev
->hwTexBlendColor1
) ||
596 (current
->hwTexBlendAlpha1
!= prev
->hwTexBlendAlpha1
) ||
597 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
599 prev
->hwTexBlendColor1
= current
->hwTexBlendColor1
;
600 prev
->hwTexBlendAlpha1
= current
->hwTexBlendAlpha1
;
601 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
602 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV_1
;
605 current
->hwTexBlendColor0
= STAGE0_C_CF
;
606 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
608 if ((current
->hwTexBlendColor0
!= prev
->hwTexBlendColor0
) ||
609 (current
->hwTexBlendAlpha0
!= prev
->hwTexBlendAlpha0
) ||
610 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
612 prev
->hwTexBlendColor0
= current
->hwTexBlendColor0
;
613 prev
->hwTexBlendAlpha0
= current
->hwTexBlendAlpha0
;
614 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
615 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV
;
620 static void updateTextureUnit( GLcontext
*ctx
, int unit
)
622 sisContextPtr smesa
= SIS_CONTEXT( ctx
);
623 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[unit
];
624 struct gl_texture_object
*texObj
= texUnit
->_Current
;
628 fallbackbit
= SIS_FALLBACK_TEXTURE0
;
630 fallbackbit
= SIS_FALLBACK_TEXTURE1
;
632 if (texUnit
->_ReallyEnabled
& (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
)) {
633 if (smesa
->TexStates
[unit
] & NEW_TEXTURING
) {
636 ok
= sis_set_texobj_parm (ctx
, texObj
, unit
);
637 FALLBACK( smesa
, fallbackbit
, !ok
);
639 if (smesa
->TexStates
[unit
] & NEW_TEXTURE_ENV
) {
641 sis_set_texture_env0( ctx
, texObj
, unit
);
643 sis_set_texture_env1( ctx
, texObj
, unit
);
645 smesa
->TexStates
[unit
] = 0;
646 } else if ( texUnit
->_ReallyEnabled
) {
648 FALLBACK( smesa
, fallbackbit
, 1 );
650 sis_reset_texture_env( ctx
, unit
);
651 FALLBACK( smesa
, fallbackbit
, 0 );
656 void sisUpdateTextureState( GLcontext
*ctx
)
658 sisContextPtr smesa
= SIS_CONTEXT( ctx
);
660 __GLSiSHardware
*current
= &smesa
->current
;
663 /* TODO : if unmark these, error in multitexture */ /* XXX */
664 for (i
= 0; i
< SIS_MAX_TEXTURES
; i
++)
665 smesa
->TexStates
[i
] |= (NEW_TEXTURING
| NEW_TEXTURE_ENV
);
668 updateTextureUnit( ctx
, 0 );
669 updateTextureUnit( ctx
, 1 );
671 /* XXX Issues with the 2nd unit but not the first being enabled? */
672 if ( ctx
->Texture
.Unit
[0]._ReallyEnabled
&
673 (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
) ||
674 ctx
->Texture
.Unit
[1]._ReallyEnabled
&
675 (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
) )
677 current
->hwCapEnable
|= MASK_TextureEnable
;
678 current
->hwCapEnable
&= ~MASK_TextureNumUsed
;
679 if (ctx
->Texture
.Unit
[1]._ReallyEnabled
)
680 current
->hwCapEnable
|= 0x00002000;
682 current
->hwCapEnable
|= 0x00001000;
684 current
->hwCapEnable
&= ~MASK_TextureEnable
;
689 BitScanForward( GLshort w
)
693 for (i
= 0; i
< 16; i
++) {
701 TransferTexturePitch( GLint dwPitch
)
705 i
= BitScanForward( (GLshort
)dwPitch
);
706 dwRet
= dwPitch
>> i
;