📄 savage_3d_reg.h
字号:
/* * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sub license, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */#ifndef SAVAGE_3D_REG_H#define SAVAGE_3D_REG_H#define VIDEO_MEM_ADR 0x02#define SYSTEM_MEM_ADR 0x01#define AGP_MEM_ADR 0x03/*********************************************************** ----------- 3D ENGINE UNIT Registers ------------- *********************************************************/typedef union{ struct { unsigned reserved : 4; unsigned ofs : 28; }ni; u_int32_t ui;} savageRegZPixelOffset;/* This reg exists only on Savage4. */typedef union{ struct { unsigned cmpFunc : 3; unsigned stencilEn : 1; unsigned readMask : 8; unsigned writeMask : 8; unsigned failOp : 3; unsigned passZfailOp : 3; unsigned passZpassOp : 3; unsigned reserved : 3; }ni; u_int32_t ui;} savageRegStencilCtrl;/************************** Texture Registers**************************//* The layout of this reg differs between Savage4 and Savage3D. */typedef union{ struct { unsigned tex0Width : 4; unsigned tex0Height : 4; unsigned tex0Fmt : 4; unsigned tex1Width : 4; unsigned tex1Height : 4; unsigned tex1Fmt : 4; unsigned texBLoopEn : 1; unsigned tex0En : 1; unsigned tex1En : 1; unsigned orthProjEn : 1; unsigned reserved : 1; unsigned palSize : 2; unsigned newPal : 1; }ni; u_int32_t ui;} savageRegTexDescr_s4;typedef union{ struct { unsigned texWidth : 4; unsigned reserved1 : 4; unsigned texHeight : 4; unsigned reserved2 : 4; /* Savage3D supports only the first 8 texture formats defined in enum TexFmt in savge_bci.h. */ unsigned texFmt : 3; unsigned palSize : 2; unsigned reserved3 : 10; unsigned newPal : 1; }ni; u_int32_t ui;} savageRegTexDescr_s3d;/* The layout of this reg is the same on Savage4 and Savage3D, but the Savage4 has two of them, Savage3D has only one. */typedef union{ struct { unsigned inSysTex : 1; unsigned inAGPTex : 1; unsigned reserved : 1; unsigned addr : 29; }ni; u_int32_t ui;} savageRegTexAddr;/* The layout of this reg is the same on Savage4 and Savage3D. */typedef union{ struct { unsigned reserved : 3; unsigned addr : 29; }ni; u_int32_t ui;} savageRegTexPalAddr;/* The layout of this reg on Savage4 and Savage3D are very similar. */typedef union{ struct { unsigned xprClr0 : 16; unsigned xprClr1 : 16; /* this is reserved on Savage3D */ }ni; u_int32_t ui;} savageRegTexXprClr; /* transparency color in RGB565 format*//* The layout of this reg differs between Savage4 and Savage3D. * Savage4 has two of them, Savage3D has only one. */typedef union{ struct { unsigned filterMode : 2; unsigned mipmapEnable : 1; unsigned dBias : 9; unsigned dMax : 4; unsigned uMode : 2; unsigned vMode : 2; unsigned useDFraction : 1; unsigned texXprEn : 1; unsigned clrBlendAlphaSel : 2; unsigned clrArg1CopyAlpha : 1; unsigned clrArg2CopyAlpha : 1; unsigned clrArg1Invert : 1; unsigned clrArg2Invert : 1; unsigned alphaBlendAlphaSel : 2; unsigned alphaArg1Invert : 1; unsigned alphaArg2Invert : 1; }ni; u_int32_t ui;} savageRegTexCtrl_s4;typedef union{ struct { unsigned filterMode : 2; unsigned mipmapDisable : 1; unsigned dBias : 9; unsigned uWrapEn : 1; unsigned vWrapEn : 1; unsigned wrapMode : 2; unsigned texEn : 1; unsigned useDFraction : 1; unsigned reserved1 : 1; /* Color Compare Alpha Blend Control 0 - reduce dest alpha to 0 or 1 1 - blend with destination The Utah-Driver doesn't know how to use it and sets it to 0. */ unsigned CCA : 1; unsigned texXprEn : 1; unsigned reserved2 : 11; }ni; u_int32_t ui;} savageRegTexCtrl_s3d;/* This reg exists only on Savage4. */typedef union{ struct { unsigned colorArg1Sel : 2; unsigned colorArg2Sel : 3; unsigned colorInvAlphaEn : 1; unsigned colorInvArg2En : 1; unsigned colorPremodSel : 1; unsigned colorMod1Sel : 1; unsigned colorMod2Sel : 2; unsigned colorAddSel : 2; unsigned colorDoBlend : 1; unsigned colorDo2sCompl : 1; unsigned colorAddBiasEn : 1; unsigned alphaArg1Sel : 2; unsigned alphaArg2Sel : 3; unsigned alphaMod1Sel : 1; unsigned alphaMod2Sel : 2; unsigned alphaAdd0Sel : 1; unsigned alphaDoBlend : 1; unsigned alphaDo2sCompl : 1; unsigned colorStageClamp : 1; unsigned alphaStageClamp : 1; unsigned colorDoDiffMul : 1; unsigned LeftShiftVal : 2; }ni; u_int32_t ui;} savageRegTexBlendCtrl;/* This reg exists only on Savage4. */typedef union{ struct { unsigned blue : 8; unsigned green : 8; unsigned red : 8; unsigned alpha : 8; }ni; u_int32_t ui;} savageRegTexBlendColor;/******************************** Tiled Surface Registers**********************************/typedef union{ struct { unsigned frmBufOffset : 13; unsigned reserved : 12; unsigned widthInTile : 6; unsigned bitPerPixel : 1; }ni; u_int32_t ui;} savageRegTiledSurface;/******************************** Draw/Shading Control Registers**********************************//* This reg exists only on Savage4. */typedef union{ struct { unsigned scissorXStart : 11; unsigned dPerfAccelEn : 1; unsigned scissorYStart : 12; unsigned alphaRefVal : 8; }ni; u_int32_t ui;} savageRegDrawCtrl0;/* This reg exists only on Savage4. */typedef union{ struct { unsigned scissorXEnd : 11; unsigned xyOffsetEn : 1; unsigned scissorYEnd : 12; unsigned ditherEn : 1; unsigned nonNormTexCoord : 1; unsigned cullMode : 2; unsigned alphaTestCmpFunc : 3; unsigned alphaTestEn : 1; }ni; u_int32_t ui;} savageRegDrawCtrl1;/* This reg exists only on Savage4. */typedef union{ struct { unsigned dstAlphaMode : 3; /** * This bit enables \c GL_FUNC_SUBTRACT. Like most DirectX oriented * hardware, there's no way to do \c GL_FUNC_REVERSE_SUBTRACT. * * \todo * Add support for \c GL_FUNC_SUBTRACT! */ unsigned dstMinusSrc : 1; unsigned srcAlphaMode : 3; unsigned binaryFinalAlpha : 1; unsigned dstAlphaModeHighBit : 1; unsigned srcAlphaModeHighBit : 1; unsigned reserved1 : 15; unsigned wrZafterAlphaTst : 1; unsigned drawUpdateEn : 1; unsigned zUpdateEn : 1; unsigned flatShadeEn : 1; unsigned specShadeEn : 1; unsigned flushPdDestWrites : 1; unsigned flushPdZbufWrites : 1; }ni; u_int32_t ui;} savageRegDrawLocalCtrl;/* This reg exists only on Savage3D. */typedef union{ struct { unsigned ditherEn : 1; unsigned xyOffsetEn : 1; unsigned cullMode : 2; unsigned vertexCountReset : 1; unsigned flatShadeEn : 1; unsigned specShadeEn : 1; unsigned dstAlphaMode : 3; unsigned srcAlphaMode : 3; unsigned reserved1 : 1; unsigned alphaTestCmpFunc : 3; unsigned alphaTestEn : 1; unsigned alphaRefVal : 8; unsigned texBlendCtrl : 3; unsigned flushPdDestWrites : 1; unsigned flushPdZbufWrites : 1; /** * Disable perspective correct interpolation for vertex color, vertex * fog, and vertex alpha. For OpenGL, this should \b always be zero. */ unsigned interpMode : 1; }ni; u_int32_t ui;} savageRegDrawCtrl;#define SAVAGETBC_DECAL_S3D 0#define SAVAGETBC_MODULATE_S3D 1#define SAVAGETBC_DECALALPHA_S3D 2#define SAVAGETBC_MODULATEALPHA_S3D 3#define SAVAGETBC_4_S3D 4#define SAVAGETBC_5_S3D 5#define SAVAGETBC_COPY_S3D 6#define SAVAGETBC_7_S3D 7
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -