tf.h 2.87 KB
/*
 *  tf.h -- texture filter unit
 *
 *  types and macros
 *
 */

#ifndef TF_UNIT_INCLD
#define TF_UNIT_INCLD


typedef struct tf
{
  /* R E Q U I R E D    by C-sim */

    char *label;
    char **argv;
    int argc;
    int gclk_old;

  /* I N P U T    signals (must be int) */

    int gclk;		/* gated clock */

    int st_span;	/* start of span */
    int ncyc;		/* number of cycles per pixel */
    int bilerp0m;	/* cycle 0 mode bit */
    int bilerp1m;	/* cycle 1 mode bit */
    int convert_one;	/* loopback mode */
    int mid_texel;	/* mid mode (for 4 texel avg) */

    int k0_coeff;	/* [8:0], color convert coeffs */
    int k1_coeff;	/* [8:0], color convert coeffs */
    int k2_coeff;	/* [8:0], color convert coeffs */
    int k3_coeff;	/* [8:0], color convert coeffs */

    int lod_frac;	/* [8:0], s,8.0, pipe through to CCU */
    int lge1;		/* lod >= 1.0 */

    int sfrac_rg;	/* [7:0], 0.8, bilerp alphas */
    int tfrac_rg;	/* [7:0], 0.8, bilerp alphas */
    int sfrac_ba;	/* [7:0], 0.8, bilerp alphas */
    int tfrac_ba;	/* [7:0], 0.8, bilerp alphas */


    int tm_ra;		/* [8:0], s,8.0, texel A */
    int tm_ga;
    int tm_ba;
    int tm_aa;

    int tm_rb;		/* [8:0], s,8.0, texel B */
    int tm_gb;
    int tm_bb;
    int tm_ab;

    int tm_rc;		/* [8:0], s,8.0, texel C */
    int tm_gc;
    int tm_bc;
    int tm_ac;

    int tm_rd;		/* [8:0], s,8.0, texel D */
    int tm_gd;
    int tm_bd;
    int tm_ad;

  /* O U T P U T   signals (must be int) */

    int tf_r;		/* [8:0], s,8.0, filtered texel */
    int tf_g;
    int tf_b;
    int tf_a;
    int tf_lod_frac;	/* [8:0], s,8.0, delayed lod fraction */
    int tf_lge1;	/* delayed lod >= 1.0 signal */

  /* O T H E R    signals */

    unsigned int cycle: 1;
    unsigned int loop_d1: 1;
    unsigned int lod_frac_d1: 9;
    unsigned int lge1_d1: 9;

    /* red channel */
    unsigned int txtrb_d1: 9; /* s,8 */
    unsigned int xar: 9;
    unsigned int yar: 9;
    unsigned int xbr: 9;
    unsigned int ybr: 9;
    unsigned int txtr_sfuv_d1: 9;
    unsigned int txtg_tfuv_d1: 9;
    unsigned int por: 9;
    unsigned int ptr: 9;

    /* green channel */
    unsigned int txtgb_d1: 9;
    unsigned int xag: 9;
    unsigned int yag: 9;
    unsigned int xbg: 9;
    unsigned int ybg: 9;
    unsigned int pog: 9;
    unsigned int ptg: 9;
   
    /* blue channel */
    unsigned int txtb_d1: 9;
    unsigned int xab: 9;
    unsigned int yab: 9;
    unsigned int xbb: 9;
    unsigned int ybb: 9;
    unsigned int txtr_sfy_d1: 9;
    unsigned int txtg_tfy_d1: 9;
    unsigned int pob: 9;
    unsigned int ptb: 9;

    /* alpha channel */
    unsigned int txta_d1: 9;
    unsigned int xaa: 9;
    unsigned int yaa: 9;
    unsigned int xba: 9;
    unsigned int yba: 9;
    unsigned int poa: 9;
    unsigned int pta: 9;

} tf_t;

/*
 *  P r o t o t y p e s
 */

void tf(tf_t **pp0, tf_t **pp1);
void tf_init(tf_t *p0, tf_t *p1);

#endif /* TF_UNIT_INCLD */