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"
40 #include "sis_context.h"
41 #include "sis_state.h"
44 #include "sis_alloc.h"
46 static GLint
TransferTexturePitch (GLint dwPitch
);
48 /* Handle texenv stuff, called from validate_texture (renderstart) */
50 sis_set_texture_env0( GLcontext
*ctx
, struct gl_texture_object
*texObj
,
53 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
56 __GLSiSHardware
*prev
= &smesa
->prev
;
57 __GLSiSHardware
*current
= &smesa
->current
;
59 struct gl_texture_unit
*texture_unit
= &ctx
->Texture
.Unit
[unit
];
61 sisTexObjPtr t
= texObj
->DriverData
;
63 switch (texture_unit
->EnvMode
)
69 current
->hwTexBlendColor0
= STAGE0_C_CF
;
70 current
->hwTexBlendAlpha0
= STAGE0_A_AS
;
75 current
->hwTexBlendColor0
= STAGE0_C_CS
;
76 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
79 case GL_LUMINANCE_ALPHA
:
81 current
->hwTexBlendColor0
= STAGE0_C_CS
;
82 current
->hwTexBlendAlpha0
= STAGE0_A_AS
;
85 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
93 current
->hwTexBlendColor0
= STAGE0_C_CF
;
94 current
->hwTexBlendAlpha0
= STAGE0_A_AFAS
;
99 current
->hwTexBlendColor0
= STAGE0_C_CFCS
;
100 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
103 case GL_LUMINANCE_ALPHA
:
105 current
->hwTexBlendColor0
= STAGE0_C_CFCS
;
106 current
->hwTexBlendAlpha0
= STAGE0_A_AFAS
;
109 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
118 current
->hwTexBlendColor0
= STAGE0_C_CS
;
119 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
122 current
->hwTexBlendColor0
= STAGE0_C_CFOMAS_CSAS
;
123 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
128 case GL_LUMINANCE_ALPHA
:
129 current
->hwTexBlendColor0
= STAGE0_C_CF
;
130 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
133 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
138 UNCLAMPED_FLOAT_TO_RGBA_CHAN(c
, texture_unit
->EnvColor
);
139 current
->hwTexEnvColor
= ((GLint
) (c
[3])) << 24 |
140 ((GLint
) (c
[0])) << 16 |
141 ((GLint
) (c
[1])) << 8 |
146 current
->hwTexBlendColor0
= STAGE0_C_CF
;
147 current
->hwTexBlendAlpha0
= STAGE0_A_AFAS
;
152 current
->hwTexBlendColor0
= STAGE0_C_CFOMCS_CCCS
;
153 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
156 current
->hwTexBlendColor0
= STAGE0_C_CFOMCS_CCCS
;
157 current
->hwTexBlendAlpha0
= STAGE0_A_AFOMAS_ACAS
;
159 case GL_LUMINANCE_ALPHA
:
161 current
->hwTexBlendColor0
= STAGE0_C_CFOMCS_CCCS
;
162 current
->hwTexBlendAlpha0
= STAGE0_A_AFAS
;
165 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
170 sis_fatal_error("unknown env mode 0x%x\n", texture_unit
->EnvMode
);
173 if ((current
->hwTexBlendColor0
!= prev
->hwTexBlendColor0
) ||
174 (current
->hwTexBlendAlpha0
!= prev
->hwTexBlendAlpha0
) ||
175 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
177 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
178 prev
->hwTexBlendColor0
= current
->hwTexBlendColor0
;
179 prev
->hwTexBlendAlpha0
= current
->hwTexBlendAlpha0
;
180 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV
;
184 /* Handle texenv stuff, called from validate_texture (renderstart) */
186 sis_set_texture_env1( GLcontext
*ctx
, struct gl_texture_object
*texObj
,
189 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
192 __GLSiSHardware
*prev
= &smesa
->prev
;
193 __GLSiSHardware
*current
= &smesa
->current
;
195 struct gl_texture_unit
*texture_unit
= &ctx
->Texture
.Unit
[unit
];
197 sisTexObjPtr t
= texObj
->DriverData
;
199 switch (texture_unit
->EnvMode
)
205 current
->hwTexBlendColor1
= STAGE1_C_CF
;
206 current
->hwTexBlendAlpha1
= STAGE1_A_AS
;
211 current
->hwTexBlendColor1
= STAGE1_C_CS
;
212 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
215 case GL_LUMINANCE_ALPHA
:
217 current
->hwTexBlendColor1
= STAGE1_C_CS
;
218 current
->hwTexBlendAlpha1
= STAGE1_A_AS
;
221 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
229 current
->hwTexBlendColor1
= STAGE1_C_CF
;
230 current
->hwTexBlendAlpha1
= STAGE1_A_AFAS
;
235 current
->hwTexBlendColor1
= STAGE1_C_CFCS
;
236 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
239 case GL_LUMINANCE_ALPHA
:
241 current
->hwTexBlendColor1
= STAGE1_C_CFCS
;
242 current
->hwTexBlendAlpha1
= STAGE1_A_AFAS
;
245 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
254 current
->hwTexBlendColor1
= STAGE1_C_CS
;
255 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
258 current
->hwTexBlendColor1
= STAGE1_C_CFOMAS_CSAS
;
259 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
264 case GL_LUMINANCE_ALPHA
:
265 current
->hwTexBlendColor1
= STAGE1_C_CF
;
266 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
269 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
274 UNCLAMPED_FLOAT_TO_RGBA_CHAN(c
, texture_unit
->EnvColor
);
275 current
->hwTexEnvColor
= ((GLint
) (c
[3])) << 24 |
276 ((GLint
) (c
[0])) << 16 |
277 ((GLint
) (c
[1])) << 8 |
282 current
->hwTexBlendColor1
= STAGE1_C_CF
;
283 current
->hwTexBlendAlpha1
= STAGE1_A_AFAS
;
288 current
->hwTexBlendColor1
= STAGE1_C_CFOMCS_CCCS
;
289 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
292 current
->hwTexBlendColor1
= STAGE1_C_CFOMCS_CCCS
;
293 current
->hwTexBlendAlpha1
= STAGE1_A_AFOMAS_ACAS
;
295 case GL_LUMINANCE_ALPHA
:
297 current
->hwTexBlendColor1
= STAGE1_C_CFOMCS_CCCS
;
298 current
->hwTexBlendAlpha1
= STAGE1_A_AFAS
;
301 sis_fatal_error("unknown base format 0x%x\n", t
->format
);
306 sis_fatal_error("unknown env mode 0x%x\n", texture_unit
->EnvMode
);
309 if ((current
->hwTexBlendColor1
!= prev
->hwTexBlendColor1
) ||
310 (current
->hwTexBlendAlpha1
!= prev
->hwTexBlendAlpha1
) ||
311 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
313 prev
->hwTexBlendColor1
= current
->hwTexBlendColor1
;
314 prev
->hwTexBlendAlpha1
= current
->hwTexBlendAlpha1
;
315 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
316 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV_1
;
320 /* Returns 0 if a software fallback is necessary */
322 sis_set_texobj_parm( GLcontext
*ctx
, struct gl_texture_object
*texObj
,
325 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
328 __GLSiSHardware
*prev
= &smesa
->prev
;
329 __GLSiSHardware
*current
= &smesa
->current
;
331 sisTexObjPtr t
= texObj
->DriverData
;
333 GLint firstLevel
, lastLevel
;
336 current
->texture
[hw_unit
].hwTextureMip
= 0UL;
337 current
->texture
[hw_unit
].hwTextureSet
= t
->hwformat
;
339 if ((texObj
->MinFilter
== GL_NEAREST
) || (texObj
->MinFilter
== GL_LINEAR
)) {
340 firstLevel
= lastLevel
= texObj
->BaseLevel
;
342 /* Compute which mipmap levels we really want to send to the hardware.
343 * This depends on the base image size, GL_TEXTURE_MIN_LOD,
344 * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL and GL_TEXTURE_MAX_LEVEL.
345 * Yes, this looks overly complicated, but it's all needed.
348 firstLevel
= texObj
->BaseLevel
+ (GLint
)(texObj
->MinLod
+ 0.5);
349 firstLevel
= MAX2(firstLevel
, texObj
->BaseLevel
);
350 lastLevel
= texObj
->BaseLevel
+ (GLint
)(texObj
->MaxLod
+ 0.5);
351 lastLevel
= MAX2(lastLevel
, texObj
->BaseLevel
);
352 lastLevel
= MIN2(lastLevel
, texObj
->BaseLevel
+
353 texObj
->Image
[0][texObj
->BaseLevel
]->MaxLog2
);
354 lastLevel
= MIN2(lastLevel
, texObj
->MaxLevel
);
355 lastLevel
= MAX2(firstLevel
, lastLevel
); /* need at least one level */
358 current
->texture
[hw_unit
].hwTextureSet
|= (lastLevel
<< 8);
360 switch (texObj
->MagFilter
)
363 current
->texture
[hw_unit
].hwTextureMip
|= TEXTURE_FILTER_NEAREST
;
366 current
->texture
[hw_unit
].hwTextureMip
|= (TEXTURE_FILTER_LINEAR
<< 3);
373 /* The mipmap lod biasing is based on experiment. It seems there's a
374 * limit of around +4/-4 to the bias value; we're being conservative.
376 b
= (GLint
) (ctx
->Texture
.Unit
[hw_unit
].LodBias
* 32.0);
382 current
->texture
[hw_unit
].hwTextureMip
|= ((b
<< 4) &
383 MASK_TextureMipmapLodBias
);
386 switch (texObj
->MinFilter
)
389 current
->texture
[hw_unit
].hwTextureMip
|= TEXTURE_FILTER_NEAREST
;
392 current
->texture
[hw_unit
].hwTextureMip
|= TEXTURE_FILTER_LINEAR
;
394 case GL_NEAREST_MIPMAP_NEAREST
:
395 current
->texture
[hw_unit
].hwTextureMip
|=
396 TEXTURE_FILTER_NEAREST_MIP_NEAREST
;
398 case GL_NEAREST_MIPMAP_LINEAR
:
399 current
->texture
[hw_unit
].hwTextureMip
|=
400 TEXTURE_FILTER_NEAREST_MIP_LINEAR
;
402 case GL_LINEAR_MIPMAP_NEAREST
:
403 current
->texture
[hw_unit
].hwTextureMip
|=
404 TEXTURE_FILTER_LINEAR_MIP_NEAREST
;
406 case GL_LINEAR_MIPMAP_LINEAR
:
407 current
->texture
[hw_unit
].hwTextureMip
|=
408 TEXTURE_FILTER_LINEAR_MIP_LINEAR
;
412 switch (texObj
->WrapS
)
415 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureWrapU
;
417 case GL_MIRRORED_REPEAT
:
418 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureMirrorU
;
421 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureClampU
;
422 /* XXX: GL_CLAMP isn't conformant, but falling back makes the situation
423 * worse in other programs at the moment.
427 case GL_CLAMP_TO_EDGE
:
428 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureClampU
;
430 case GL_CLAMP_TO_BORDER
:
431 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureBorderU
;
435 switch (texObj
->WrapT
)
438 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureWrapV
;
440 case GL_MIRRORED_REPEAT
:
441 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureMirrorV
;
444 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureClampV
;
445 /* XXX: GL_CLAMP isn't conformant, but falling back makes the situation
446 * worse in other programs at the moment.
450 case GL_CLAMP_TO_EDGE
:
451 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureClampV
;
453 case GL_CLAMP_TO_BORDER
:
454 current
->texture
[hw_unit
].hwTextureSet
|= MASK_TextureBorderV
;
460 CLAMPED_FLOAT_TO_UBYTE(c
[0], texObj
->BorderColor
[0]);
461 CLAMPED_FLOAT_TO_UBYTE(c
[1], texObj
->BorderColor
[1]);
462 CLAMPED_FLOAT_TO_UBYTE(c
[2], texObj
->BorderColor
[2]);
463 CLAMPED_FLOAT_TO_UBYTE(c
[3], texObj
->BorderColor
[3]);
465 current
->texture
[hw_unit
].hwTextureBorderColor
=
466 PACK_COLOR_8888(c
[3], c
[0], c
[1], c
[2]);
469 if (current
->texture
[hw_unit
].hwTextureBorderColor
!=
470 prev
->texture
[hw_unit
].hwTextureBorderColor
)
472 prev
->texture
[hw_unit
].hwTextureBorderColor
=
473 current
->texture
[hw_unit
].hwTextureBorderColor
;
475 smesa
->GlobalFlag
|= GFLAG_TEXBORDERCOLOR_1
;
477 smesa
->GlobalFlag
|= GFLAG_TEXBORDERCOLOR
;
480 current
->texture
[hw_unit
].hwTextureSet
|=
481 texObj
->Image
[0][firstLevel
]->WidthLog2
<< 4;
482 current
->texture
[hw_unit
].hwTextureSet
|=
483 texObj
->Image
[0][firstLevel
]->HeightLog2
;
486 smesa
->GlobalFlag
|= GFLAG_TEXTUREADDRESS
;
488 smesa
->GlobalFlag
|= GFLAG_TEXTUREADDRESS_1
;
490 for (i
= firstLevel
; i
<= lastLevel
; i
++)
492 GLuint texOffset
= 0;
493 GLuint texPitch
= TransferTexturePitch( t
->image
[i
].pitch
);
495 switch (t
->image
[i
].memType
)
498 texOffset
= ((unsigned long)t
->image
[i
].Data
- (unsigned long)smesa
->FbBase
);
501 texOffset
= ((unsigned long)t
->image
[i
].Data
- (unsigned long)smesa
->AGPBase
) +
502 (unsigned long) smesa
->AGPAddr
;
503 current
->texture
[hw_unit
].hwTextureMip
|=
504 (MASK_TextureLevel0InSystem
<< i
);
511 prev
->texture
[hw_unit
].texOffset0
= texOffset
;
512 prev
->texture
[hw_unit
].texPitch01
= texPitch
<< 16;
515 prev
->texture
[hw_unit
].texOffset1
= texOffset
;
516 prev
->texture
[hw_unit
].texPitch01
|= texPitch
;
519 prev
->texture
[hw_unit
].texOffset2
= texOffset
;
520 prev
->texture
[hw_unit
].texPitch23
= texPitch
<< 16;
523 prev
->texture
[hw_unit
].texOffset3
= texOffset
;
524 prev
->texture
[hw_unit
].texPitch23
|= texPitch
;
527 prev
->texture
[hw_unit
].texOffset4
= texOffset
;
528 prev
->texture
[hw_unit
].texPitch45
= texPitch
<< 16;
531 prev
->texture
[hw_unit
].texOffset5
= texOffset
;
532 prev
->texture
[hw_unit
].texPitch45
|= texPitch
;
535 prev
->texture
[hw_unit
].texOffset6
= texOffset
;
536 prev
->texture
[hw_unit
].texPitch67
= texPitch
<< 16;
539 prev
->texture
[hw_unit
].texOffset7
= texOffset
;
540 prev
->texture
[hw_unit
].texPitch67
|= texPitch
;
543 prev
->texture
[hw_unit
].texOffset8
= texOffset
;
544 prev
->texture
[hw_unit
].texPitch89
= texPitch
<< 16;
547 prev
->texture
[hw_unit
].texOffset9
= texOffset
;
548 prev
->texture
[hw_unit
].texPitch89
|= texPitch
;
551 prev
->texture
[hw_unit
].texOffset10
= texOffset
;
552 prev
->texture
[hw_unit
].texPitch10
= texPitch
<< 16;
555 prev
->texture
[hw_unit
].texOffset11
= texOffset
;
556 prev
->texture
[hw_unit
].texPitch10
|= texPitch
;
561 if (current
->texture
[hw_unit
].hwTextureSet
!=
562 prev
->texture
[hw_unit
].hwTextureSet
)
564 prev
->texture
[hw_unit
].hwTextureSet
=
565 current
->texture
[hw_unit
].hwTextureSet
;
567 smesa
->GlobalFlag
|= CFLAG_TEXTURERESET_1
;
569 smesa
->GlobalFlag
|= CFLAG_TEXTURERESET
;
571 if (current
->texture
[hw_unit
].hwTextureMip
!=
572 prev
->texture
[hw_unit
].hwTextureMip
)
574 prev
->texture
[hw_unit
].hwTextureMip
=
575 current
->texture
[hw_unit
].hwTextureMip
;
577 smesa
->GlobalFlag
|= GFLAG_TEXTUREMIPMAP_1
;
579 smesa
->GlobalFlag
|= GFLAG_TEXTUREMIPMAP
;
585 /* Disable a texture unit, called from validate_texture */
587 sis_reset_texture_env (GLcontext
*ctx
, int hw_unit
)
589 sisContextPtr smesa
= SIS_CONTEXT(ctx
);
591 __GLSiSHardware
*prev
= &smesa
->prev
;
592 __GLSiSHardware
*current
= &smesa
->current
;
596 current
->hwTexBlendColor1
= STAGE1_C_CF
;
597 current
->hwTexBlendAlpha1
= STAGE1_A_AF
;
599 if ((current
->hwTexBlendColor1
!= prev
->hwTexBlendColor1
) ||
600 (current
->hwTexBlendAlpha1
!= prev
->hwTexBlendAlpha1
) ||
601 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
603 prev
->hwTexBlendColor1
= current
->hwTexBlendColor1
;
604 prev
->hwTexBlendAlpha1
= current
->hwTexBlendAlpha1
;
605 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
606 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV_1
;
609 current
->hwTexBlendColor0
= STAGE0_C_CF
;
610 current
->hwTexBlendAlpha0
= STAGE0_A_AF
;
612 if ((current
->hwTexBlendColor0
!= prev
->hwTexBlendColor0
) ||
613 (current
->hwTexBlendAlpha0
!= prev
->hwTexBlendAlpha0
) ||
614 (current
->hwTexEnvColor
!= prev
->hwTexEnvColor
))
616 prev
->hwTexBlendColor0
= current
->hwTexBlendColor0
;
617 prev
->hwTexBlendAlpha0
= current
->hwTexBlendAlpha0
;
618 prev
->hwTexEnvColor
= current
->hwTexEnvColor
;
619 smesa
->GlobalFlag
|= GFLAG_TEXTUREENV
;
624 static void updateTextureUnit( GLcontext
*ctx
, int unit
)
626 sisContextPtr smesa
= SIS_CONTEXT( ctx
);
627 const struct gl_texture_unit
*texUnit
= &ctx
->Texture
.Unit
[unit
];
628 struct gl_texture_object
*texObj
= texUnit
->_Current
;
632 fallbackbit
= SIS_FALLBACK_TEXTURE0
;
634 fallbackbit
= SIS_FALLBACK_TEXTURE1
;
636 if (texUnit
->_ReallyEnabled
& (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
)) {
637 if (smesa
->TexStates
[unit
] & NEW_TEXTURING
) {
640 ok
= sis_set_texobj_parm (ctx
, texObj
, unit
);
641 FALLBACK( smesa
, fallbackbit
, !ok
);
643 if (smesa
->TexStates
[unit
] & NEW_TEXTURE_ENV
) {
645 sis_set_texture_env0( ctx
, texObj
, unit
);
647 sis_set_texture_env1( ctx
, texObj
, unit
);
649 smesa
->TexStates
[unit
] = 0;
650 } else if ( texUnit
->_ReallyEnabled
) {
652 FALLBACK( smesa
, fallbackbit
, 1 );
654 sis_reset_texture_env( ctx
, unit
);
655 FALLBACK( smesa
, fallbackbit
, 0 );
660 void sisUpdateTextureState( GLcontext
*ctx
)
662 sisContextPtr smesa
= SIS_CONTEXT( ctx
);
664 __GLSiSHardware
*current
= &smesa
->current
;
667 /* TODO : if unmark these, error in multitexture */ /* XXX */
668 for (i
= 0; i
< SIS_MAX_TEXTURES
; i
++)
669 smesa
->TexStates
[i
] |= (NEW_TEXTURING
| NEW_TEXTURE_ENV
);
672 updateTextureUnit( ctx
, 0 );
673 updateTextureUnit( ctx
, 1 );
675 /* XXX Issues with the 2nd unit but not the first being enabled? */
676 if ( ctx
->Texture
.Unit
[0]._ReallyEnabled
&
677 (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
) ||
678 ctx
->Texture
.Unit
[1]._ReallyEnabled
&
679 (TEXTURE_1D_BIT
| TEXTURE_2D_BIT
) )
681 current
->hwCapEnable
|= MASK_TextureEnable
;
682 current
->hwCapEnable
&= ~MASK_TextureNumUsed
;
683 if (ctx
->Texture
.Unit
[1]._ReallyEnabled
)
684 current
->hwCapEnable
|= 0x00002000;
686 current
->hwCapEnable
|= 0x00001000;
688 current
->hwCapEnable
&= ~MASK_TextureEnable
;
693 BitScanForward( GLshort w
)
697 for (i
= 0; i
< 16; i
++) {
705 TransferTexturePitch( GLint dwPitch
)
709 i
= BitScanForward( (GLshort
)dwPitch
);
710 dwRet
= dwPitch
>> i
;