inp009.c 3.18 KB
#include <bstring.h>
#include <stdio.h>

#include "inp.h"

static void varyHighBits(void);
static void sharpenMode(void);

int
main(int argc, char *argv[])
{
	printHeader();
	varyHighBits();
	sharpenMode();
	printTrailingCycles();
}

static void
varyHighBits(void)
{
	cc_t cc;
	cc_t *ccp = &cc;
	int i, j, k;

	bzero(ccp, sizeof(cc));

	ccp->ncyc = 0;		/* one cycle mode */

	/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,0) */

	ccp->cc_x_sel_1_r = CC_SUBA_ZERO;
	ccp->cc_y_sel_1_r = CC_SUBB_ZERO;
	ccp->cc_a_sel_1_r = CC_MULT_ZERO;
	ccp->cc_c_sel_1_r = CC_ADD_ONE;

	ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
	ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
	ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
	ccp->cc_c_sel_1_a = CC_ADD_PRIM_ALPHA;

	ccp->texture_edge_mode = 1;
	ccp->cvg_times_alpha = 1;
	ccp->alpha_cvg_select = 1;

	printf("# Vary high bits of alpha, coverage, and positive lod values\n");
	for (i = 0; i < 8; i++) {
		ccp->prim_a = i<<5;
		for (j = 0; j < 9; j++) {
			ccp->cvg =  j;
			for (k = 0; k < 9; k++) {
				if (k == 8)
					ccp->tf_lge1 = 1;
				else
					ccp->tf_lge1 = 0;
				ccp->tf_lod_frac = (k & 7) << 5;
				printf("#  alpha 0x%x", ccp->prim_a);
				printf(" coverage 0x%x ", ccp->cvg);
				printf(" tf_lge1 %d ", ccp->tf_lge1);
				printf(" tf_lod_frac 0x%x\n", ccp->tf_lod_frac);
				printVector(ccp, 1);
			}
		}
	}

	/* Once more with a maxed out alpha value */

	ccp->prim_a = 0xff;
	for (j = 0; j < 9; j++) {
		ccp->cvg =  j;
		for (k = 0; k < 9; k++) {
			if (k == 8)
				ccp->tf_lge1 = 1;
			else
				ccp->tf_lge1 = 0;
			ccp->tf_lod_frac = (k & 7) << 5;
			printf("#  alpha 0x%x", ccp->prim_a);
			printf(" coverage 0x%x ", ccp->cvg);
			printf(" tf_lge1 %d ", ccp->tf_lge1);
			printf(" tf_lod_frac 0x%x\n", ccp->tf_lod_frac);
			printVector(ccp, 1);
		}
	}
}

static void
sharpenMode(void)
{
	cc_t cc;
	cc_t *ccp = &cc;
	int i, j, k;

	bzero(ccp, sizeof(cc));

	ccp->ncyc = 0;		/* one cycle mode */

	/* Initialize mode 1 (x,y,a,c) selects to produce (0,0,0,0) */

	ccp->cc_x_sel_1_r = CC_SUBA_ZERO;
	ccp->cc_y_sel_1_r = CC_SUBB_ZERO;
	ccp->cc_a_sel_1_r = CC_MULT_ZERO;
	ccp->cc_c_sel_1_r = CC_ADD_ONE;

	ccp->cc_x_sel_1_a = CC_SUBA_ZERO_ALPHA;
	ccp->cc_y_sel_1_a = CC_SUBB_ZERO_ALPHA;
	ccp->cc_a_sel_1_a = CC_MULT_ZERO_ALPHA;
	ccp->cc_c_sel_1_a = CC_ADD_PRIM_ALPHA;

	ccp->texture_edge_mode = 1;
	ccp->cvg_times_alpha = 1;
	ccp->alpha_cvg_select = 1;
	ccp->tf_lge1 = 0;

	printf("# Vary high bits of alpha, coverage, and negative lod values\n");
	for (i = 0; i < 8; i++) {
		ccp->prim_a = i<<5;
		for (j = 0; j < 9; j++) {
			ccp->cvg =  j;
			for (k = 0; k < 4; k++) {
				ccp->tf_lod_frac = (1<<8) | (k<<6);
				printf("#  alpha 0x%x", ccp->prim_a);
				printf(" coverage 0x%x ", ccp->cvg);
				printf(" tf_lge1 %d ", ccp->tf_lge1);
				printf(" tf_lod_frac 0x%x\n", ccp->tf_lod_frac);
				printVector(ccp, 1);
			}
		}
	}

	/* Once more with a maxed out alpha value */

	ccp->prim_a = 0xff;
	for (j = 0; j < 9; j++) {
		ccp->cvg =  j;
		for (k = 0; k < 4; k++) {
			ccp->tf_lod_frac = (1<<8) | (k<<6);
			printf("#  alpha 0x%x", ccp->prim_a);
			printf(" coverage 0x%x ", ccp->cvg);
			printf(" tf_lge1 %d ", ccp->tf_lge1);
			printf(" tf_lod_frac 0x%x\n", ccp->tf_lod_frac);
			printVector(ccp, 1);
		}
	}
}