Ignore:
Timestamp:
May 23, 2000, 10:41:28 PM (25 years ago)
Author:
jeroen
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/mesa/3dfx/fxdrv.h

    r2965 r3598  
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    7575#include "clip.h"
    7676#include "vbrender.h"
     77#include "mem.h"
    7778
    7879#ifdef XF86DRI
     
    8788
    8889
     90extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
    8991#if defined(MESA_DEBUG) && 0
    90 extern void fx_sanity_triangle( GrVertex *, GrVertex *, GrVertex * );
    9192#define grDrawTriangle fx_sanity_triangle
    9293#endif
     
    113114#if FX_USE_PARGB
    114115
    115 #define CLIP_XCOORD 0           /* normal place */
    116 #define CLIP_YCOROD 1           /* normal place */
    117 #define CLIP_ZCOORD 2           /* normal place */
    118 #define CLIP_WCOORD 3           /* normal place */
    119 #define CLIP_GCOORD 4           /* GR_VERTEX_PARGB_OFFSET */
    120 #define CLIP_BCOORD 5           /* GR_VERTEX_SOW_TMU0_OFFSET */
    121 #define CLIP_RCOORD 6           /* GR_VERTEX_TOW_TMU0_OFFSET */
    122 #define CLIP_ACOORD 7           /* GR_VERTEX_OOW_TMU0_OFFSET */
     116#define CLIP_XCOORD 0           /* normal place */
     117#define CLIP_YCOROD 1           /* normal place */
     118#define CLIP_ZCOORD 2           /* normal place */
     119#define CLIP_WCOORD 3           /* normal place */
     120#define CLIP_GCOORD 4           /* GR_VERTEX_PARGB_OFFSET */
     121#define CLIP_BCOORD 5           /* GR_VERTEX_SOW_TMU0_OFFSET */
     122#define CLIP_RCOORD 6           /* GR_VERTEX_TOW_TMU0_OFFSET */
     123#define CLIP_ACOORD 7           /* GR_VERTEX_OOW_TMU0_OFFSET */
    123124
    124125#else
    125126
    126 #define CLIP_XCOORD 0           /* normal place */
    127 #define CLIP_YCOROD 1           /* normal place */
    128 #define CLIP_ZCOORD 2           /* GR_VERTEX_Z_OFFSET */
    129 #define CLIP_WCOORD 3           /* GR_VERTEX_R_OFFSET */
    130 #define CLIP_GCOORD 4           /* normal place */
    131 #define CLIP_BCOORD 5           /* normal place */
    132 #define CLIP_RCOORD 6           /* GR_VERTEX_OOZ_OFFSET */
    133 #define CLIP_ACOORD 7           /* normal place */
     127#define CLIP_XCOORD 0           /* normal place */
     128#define CLIP_YCOROD 1           /* normal place */
     129#define CLIP_ZCOORD 2           /* GR_VERTEX_Z_OFFSET */
     130#define CLIP_WCOORD 3           /* GR_VERTEX_R_OFFSET */
     131#define CLIP_GCOORD 4           /* normal place */
     132#define CLIP_BCOORD 5           /* normal place */
     133#define CLIP_RCOORD 6           /* GR_VERTEX_OOZ_OFFSET */
     134#define CLIP_ACOORD 7           /* normal place */
    134135
    135136
     
    139140 */
    140141typedef struct {
    141    GLfloat f[15];               /* Same layout as GrVertex */
    142    GLubyte mask;                /* Unsued  */
    143    GLubyte usermask;            /* Unused */
     142   GLfloat f[15];               /* Same layout as GrVertex */
     143   GLubyte mask;                /* Unsued  */
     144   GLubyte usermask;            /* Unused */
    144145} fxVertex;
    145146
     
    166167#endif
    167168
    168 #define FX_VB_COLOR(fxm, color)                         \
    169   do {                                                  \
    170     if (sizeof(GLint) == 4*sizeof(GLubyte)) {           \
    171       if (fxm->constColor != *(GLuint*)color) {         \
    172         fxm->constColor = *(GLuint*)color;              \
    173         FX_grConstantColorValue(FXCOLOR4(color));       \
    174       }                                                 \
    175     } else {                                            \
    176       FX_grConstantColorValue(FXCOLOR4(color));         \
    177     }                                                   \
     169#define FX_VB_COLOR(fxm, color)                         \
     170  do {                                                  \
     171    if (sizeof(GLint) == 4*sizeof(GLubyte)) {           \
     172      if (fxm->constColor != *(GLuint*)color) {         \
     173        fxm->constColor = *(GLuint*)color;              \
     174        FX_grConstantColorValue(FXCOLOR4(color));       \
     175      }                                                 \
     176    } else {                                            \
     177      FX_grConstantColorValue(FXCOLOR4(color));         \
     178    }                                                   \
    178179  } while (0)
    179180
    180 #define GOURAUD(x) {                                    \
    181   GLubyte *col = VB->ColorPtr->data[(x)];               \
    182   gWin[(x)].v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
    183   gWin[(x)].v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \
    184   gWin[(x)].v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \
    185   gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
     181#define GOURAUD(x) {                                    \
     182  GLubyte *col = VB->ColorPtr->data[(x)];               \
     183  gWin[(x)].v.r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]); \
     184  gWin[(x)].v.g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]); \
     185  gWin[(x)].v.b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]); \
     186  gWin[(x)].v.a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]); \
    186187}
    187188
    188189#if FX_USE_PARGB
    189 #define GOURAUD2(v, c) {                                                                                                                                \
    190   GLubyte *col = c;                                                                                                                                     \
    191   v->argb=MESACOLOR2PARGB(col);                                                                                                                 \
     190#define GOURAUD2(v, c) {                                                                                                                                \
     191  GLubyte *col = c;                                                                                                                                     \
     192  v->argb=MESACOLOR2PARGB(col);                                                                                                                 \
    192193}
    193194#else
    194 #define GOURAUD2(v, c) {                        \
    195   GLubyte *col = c;                             \
    196   v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]);  \
    197   v->g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]);  \
    198   v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]);  \
    199   v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]);  \
     195#define GOURAUD2(v, c) {                        \
     196  GLubyte *col = c;                             \
     197  v->r=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[0]);  \
     198  v->g=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[1]);  \
     199  v->b=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[2]);  \
     200  v->a=UBYTE_COLOR_TO_FLOAT_255_COLOR(col[3]);  \
    200201}
    201202#endif
     
    230231#define FX_UM_E0_DECAL              0x00000004
    231232#define FX_UM_E0_BLEND              0x00000008
    232 #define FX_UM_E0_ADD                            0x00000010
     233#define FX_UM_E0_ADD                            0x00000010
    233234
    234235#define FX_UM_E1_REPLACE            0x00000020
     
    236237#define FX_UM_E1_DECAL              0x00000080
    237238#define FX_UM_E1_BLEND              0x00000100
    238 #define FX_UM_E1_ADD                            0x00000200
     239#define FX_UM_E1_ADD                            0x00000200
    239240
    240241#define FX_UM_E_ENVMODE             0x000003ff
     
    256257#define FX_UM_E_IFMT                0x00fff000
    257258
    258 #define FX_UM_COLOR_ITERATED        0x00100000
    259 #define FX_UM_COLOR_CONSTANT        0x00200000
    260 #define FX_UM_ALPHA_ITERATED        0x00400000
    261 #define FX_UM_ALPHA_CONSTANT        0x00800000
     259#define FX_UM_COLOR_ITERATED        0x01000000
     260#define FX_UM_COLOR_CONSTANT        0x02000000
     261#define FX_UM_ALPHA_ITERATED        0x04000000
     262#define FX_UM_ALPHA_CONSTANT        0x08000000
    262263
    263264typedef void (*tfxRenderVBFunc)(GLcontext *);
     
    272273
    273274typedef struct {
    274   GLsizei width, height;
    275   GLint glideFormat;
    276 
    277   unsigned short *data;
    278   GLboolean translated, used;
     275  GLsizei width, height;              /* image size */
     276  GrTextureFormat_t glideFormat;      /* Glide image format */
     277  unsigned short *data;         /* Glide-formated texture image */
     278  GLboolean translated;         /* True if data points to a reformated image */
     279  GLboolean used;               /* True if we've given the image to Glide */
    279280} tfxMipMapLevel;
    280281
     
    306307
    307308  GLfloat sScale, tScale;
    308   GLint int_sScale, int_tScale; /* x86 floating point trick for
    309                                 * multiplication by powers of 2.
    310                                 * Used in fxfasttmp.h
    311                                 */
     309  GLint int_sScale, int_tScale; /* x86 floating point trick for
     310                                * multiplication by powers of 2.
     311                                * Used in fxfasttmp.h
     312                                */
    312313
    313314  GuTexPalette palette;
     
    326327
    327328typedef void (*tfxTriViewClipFunc)( struct vertex_buffer *VB,
    328                                     GLuint v[],
    329                                     GLubyte mask );
     329                                    GLuint v[],
     330                                    GLubyte mask );
    330331
    331332typedef void (*tfxTriClipFunc)( struct vertex_buffer *VB,
    332                                 GLuint v[],
    333                                 GLuint mask );
     333                                GLuint v[],
     334                                GLuint mask );
    334335
    335336
    336337typedef void (*tfxLineClipFunc)( struct vertex_buffer *VB,
    337                                 GLuint v1, GLuint v2,
    338                                 GLubyte mask );
     338                                GLuint v1, GLuint v2,
     339                                GLubyte mask );
    339340
    340341
     
    396397   void *vert_store;
    397398#if defined(FX_GLIDE3)
    398    GrVertex **triangle_b;       /* Triangle buffer */
    399    GrVertex **strips_b;         /* Strips buffer */
     399   GrVertex **triangle_b;       /* Triangle buffer */
     400   GrVertex **strips_b;         /* Strips buffer */
    400401#endif
    401402
     
    438439  GrBuffer_t currentFB;
    439440
     441  GLboolean bgrOrder;
    440442  GrColor_t color;
    441443  GrColor_t clearC;
    442444  GrAlpha_t clearA;
    443445  GLuint constColor;
     446  GrCullMode_t cullMode;
    444447
    445448  tfxUnitsState unitsState;
     
    455458  GLuint render_index;
    456459  GLuint last_tri_caps;
    457   GLuint stw_hint_state;                /* for grHints */
     460  GLuint stw_hint_state;                /* for grHints */
    458461  GLuint is_in_hardware;
    459462  GLuint new_state;
     
    476479  GLenum fogTableMode;
    477480  GLfloat fogDensity;
     481  GLfloat fogStart, fogEnd;
    478482  GrFog_t *fogTable;
     483  GLint textureAlign;
    479484
    480485  /* Acc. functions */
     
    499504
    500505  GLboolean verbose;
    501   GLboolean haveTwoTMUs;        /* True if we really have 2 tmu's  */
    502   GLboolean emulateTwoTMUs;     /* True if we present 2 tmu's to mesa.  */
     506  GLboolean haveTwoTMUs;        /* True if we really have 2 tmu's  */
     507  GLboolean emulateTwoTMUs;     /* True if we present 2 tmu's to mesa.  */
    503508  GLboolean haveAlphaBuffer;
    504509  GLboolean haveZBuffer;
     
    530535extern int glbCurrentBoard;
    531536
     537extern void fxPrintSetupFlags( const char *msg, GLuint flags );
    532538extern void fxSetupFXUnits(GLcontext *);
    533539extern void fxSetupDDPointers(GLcontext *);
     
    542548
    543549extern void fxRenderClippedLine( struct vertex_buffer *VB,
    544                                 GLuint v1, GLuint v2 );
     550                                GLuint v1, GLuint v2 );
    545551
    546552extern void fxRenderClippedTriangle( struct vertex_buffer *VB,
    547                                      GLuint n, GLuint vlist[] );
     553                                     GLuint n, GLuint vlist[] );
    548554
    549555
     
    562568extern void fxSetupDDSpanPointers(GLcontext *);
    563569
    564 extern void fxDDBufferSize(GLcontext *, GLuint *, GLuint *);
    565 
    566570extern void fxPrintTextureData(tfxTexInfo *ti);
    567 extern void fxDDTexEnv(GLcontext *, GLenum, const GLfloat *);
    568571extern void fxDDTexImg(GLcontext *, GLenum, struct gl_texture_object *,
    569                        GLint, GLint, const struct gl_texture_image *);
     572                       GLint, GLint, const struct gl_texture_image *);
     573extern void fxDDTexSubImg(GLcontext *, GLenum, struct gl_texture_object *,
     574                          GLint, GLint, GLint, GLint, GLint, GLint,
     575                          const struct gl_texture_image *);
     576extern GLboolean fxDDTexImage2D(GLcontext *ctx, GLenum target, GLint level,
     577                              GLenum format, GLenum type, const GLvoid *pixels,
     578                              const struct gl_pixelstore_attrib *packing,
     579                              struct gl_texture_object *texObj,
     580                              struct gl_texture_image *texImage,
     581                              GLboolean *retainInternalCopy);
     582extern GLboolean fxDDTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
     583                              GLint xoffset, GLint yoffset,
     584                              GLsizei width, GLsizei height,
     585                              GLenum format, GLenum type, const GLvoid *pixels,
     586                              const struct gl_pixelstore_attrib *packing,
     587                              struct gl_texture_object *texObj,
     588                              struct gl_texture_image *texImage);
     589extern void fxDDTexEnv(GLcontext *, GLenum, GLenum, const GLfloat *);
    570590extern void fxDDTexParam(GLcontext *, GLenum, struct gl_texture_object *,
    571                         GLenum, const GLfloat *);
     591                        GLenum, const GLfloat *);
    572592extern void fxDDTexBind(GLcontext *, GLenum, struct gl_texture_object *);
    573593extern void fxDDTexDel(GLcontext *, struct gl_texture_object *);
    574594extern void fxDDTexPalette(GLcontext *, struct gl_texture_object *);
    575 extern void fxDDTexuseGlbPalette(GLcontext *, GLboolean);
    576 extern void fxDDTexSubImg(GLcontext *, GLenum, struct gl_texture_object *, GLint,
    577                           GLint, GLint, GLint, GLint, GLint, const struct gl_texture_image *);
    578595extern void fxDDTexUseGlbPalette(GLcontext *, GLboolean);
    579596
     
    589606
    590607extern void fxDDCheckMergeAndRender( GLcontext *ctx,
    591                                      struct gl_pipeline_stage *d );
     608                                     struct gl_pipeline_stage *d );
    592609
    593610extern void fxDDMergeAndRender( struct vertex_buffer *VB );
    594611
    595612extern void fxDDCheckPartialRasterSetup( GLcontext *ctx,
    596                                         struct gl_pipeline_stage *d );
     613                                        struct gl_pipeline_stage *d );
    597614
    598615extern void fxDDPartialRasterSetup( struct vertex_buffer *VB );
     
    601618
    602619extern GLuint fxDDRegisterPipelineStages( struct gl_pipeline_stage *out,
    603                                           const struct gl_pipeline_stage *in,
    604                                           GLuint nr );
     620                                          const struct gl_pipeline_stage *in,
     621                                          GLuint nr );
    605622
    606623extern GLboolean fxDDBuildPrecalcPipeline( GLcontext *ctx );
    607624
    608625extern void fxDDOptimizePrecalcPipeline( GLcontext *ctx,
    609                                         struct gl_pipeline *pipe );
     626                                        struct gl_pipeline *pipe );
    610627
    611628extern void fxDDRenderElementsDirect( struct vertex_buffer *VB );
     
    617634extern void fxTMInit(fxMesaContext ctx);
    618635extern void fxTMClose(fxMesaContext ctx);
     636extern void fxTMRestoreTextures_NoLock(fxMesaContext ctx);
    619637extern void fxTMMoveInTM(fxMesaContext, struct gl_texture_object *, GLint);
    620638extern void fxTMMoveOutTM(fxMesaContext, struct gl_texture_object *);
     639#define fxTMMoveOutTM_NoLock fxTMMoveOutTM
    621640extern void fxTMFreeTexture(fxMesaContext, struct gl_texture_object *);
    622641extern void fxTMReloadMipMapLevel(fxMesaContext, struct gl_texture_object *, GLint);
    623642extern void fxTMReloadSubMipMapLevel(fxMesaContext, struct gl_texture_object *,
    624                                      GLint, GLint, GLint);
     643                                     GLint, GLint, GLint);
    625644
    626645extern void fxTexGetFormat(GLenum, GrTextureFormat_t *, GLint *);
    627646extern int fxTexGetInfo(int, int, GrLOD_t *, GrAspectRatio_t *,
    628                         float *, float *, int *, int *, int *, int *);
     647                        float *, float *, int *, int *, int *, int *);
    629648
    630649extern void fxDDScissor( GLcontext *ctx,
    631                               GLint x, GLint y, GLsizei w, GLsizei h );
     650                              GLint x, GLint y, GLsizei w, GLsizei h );
    632651extern void fxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params );
    633652extern GLboolean fxDDColorMask(GLcontext *ctx,
    634                                GLboolean r, GLboolean g,
    635                                GLboolean b, GLboolean a );
    636 
    637 extern GLuint fxDDDepthTestSpanGeneric(GLcontext *ctx,
    638                                        GLuint n, GLint x, GLint y,
    639                                        const GLdepth z[],
    640                                        GLubyte mask[]);
    641 
    642 extern void fxDDDepthTestPixelsGeneric(GLcontext* ctx,
    643                                        GLuint n,
    644                                        const GLint x[], const GLint y[],
    645                                        const GLdepth z[], GLubyte mask[]);
    646 
    647 extern void fxDDReadDepthSpanFloat(GLcontext *ctx,
    648                                    GLuint n, GLint x, GLint y, GLfloat depth[]);
    649 
    650 extern void fxDDReadDepthSpanInt(GLcontext *ctx,
    651                                  GLuint n, GLint x, GLint y, GLdepth depth[]);
    652 
     653                               GLboolean r, GLboolean g,
     654                               GLboolean b, GLboolean a );
     655
     656extern void fxDDWriteDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
     657                               const GLdepth depth[], const GLubyte mask[]);
     658
     659extern void fxDDReadDepthSpan(GLcontext *ctx, GLuint n, GLint x, GLint y,
     660                              GLdepth depth[]);
     661
     662extern void fxDDWriteDepthPixels(GLcontext *ctx, GLuint n,
     663                                 const GLint x[], const GLint y[],
     664                                 const GLdepth depth[], const GLubyte mask[]);
     665
     666extern void fxDDReadDepthPixels(GLcontext *ctx, GLuint n,
     667                                const GLint x[], const GLint y[],
     668                                GLdepth depth[]);
    653669
    654670extern void fxDDFastPath( struct vertex_buffer *VB );
     
    669685extern void fxSetScissorValues(GLcontext *ctx);
    670686extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
    671                                 struct gl_texture_object *tObj,
    672                                 GLint where);
    673 extern void fxSetupTexture_NoLock(GLcontext *ctx);
    674 extern void fxSetupTexture(GLcontext *ctx);
    675 
    676 extern void fxInitPixelTables(GLboolean bgrOrder);
    677 
    678 #endif
     687                                struct gl_texture_object *tObj,
     688                                GLint where);
     689extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
     690
     691#endif
Note: See TracChangeset for help on using the changeset viewer.