Nugget
Loading...
Searching...
No Matches
Functions | Variables
gte-lighting.c File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 CESTER_TEST (ncs_z_normal_white_light, gte_tests, gte_set_simple_light();gte_set_white_light_color();gte_set_zero_bk();cop2_put(0, 0x00000000);cop2_put(1, 0x1000);cop2_put(6, 0x00808080);gte_clear_flag();cop2_cmd(COP2_NCS(1, 1));int32_t mac1, mac2, mac3;uint32_t rgb2;cop2_get(25, mac1);cop2_get(26, mac2);cop2_get(27, mac3);cop2_get(22, rgb2);ramsyscall_printf("NCS z-normal: MAC=(%d,%d,%d) RGB2=0x%08x\n", mac1, mac2, mac3, rgb2);cester_assert_int_eq(0, mac1);cester_assert_int_eq(0, mac2);cester_assert_int_eq(4096, mac3);cester_assert_uint_eq(0x00ff0000, rgb2);) CESTER_TEST(ncs_with_background
 
 gte_set_simple_light ()
 
 gte_set_white_light_color ()
 
 cop2_putc (13, 0x800)
 
 cop2_putc (14, 0x400)
 
 cop2_putc (15, 0x200)
 
 cop2_put (0, 0x00000000)
 
 cop2_put (1, 0x1000)
 
 cop2_put (6, 0x00000000)
 
 gte_clear_flag ()
 
 cop2_cmd (COP2_NCS(1, 1))
 
 cop2_get (25, mac1)
 
 cop2_get (26, mac2)
 
 cop2_get (27, mac3)
 
 cester_assert_int_eq (0x800, mac1)
 
 cester_assert_int_eq (0x400, mac2)
 
 cester_assert_int_eq (0x1200, mac3)
 
 CESTER_TEST (nct_three_normals, gte_tests, gte_set_simple_light();gte_set_white_light_color();gte_set_zero_bk();cop2_put(0, 0x00000000);cop2_put(1, 0x1000);cop2_put(2,(0<< 16)|0x1000);cop2_put(3, 0);cop2_put(4,(0x1000<< 16)|0);cop2_put(5, 0);cop2_put(6, 0x00000000);gte_clear_flag();cop2_cmd(COP2_NCT(1, 1));uint32_t rgb0, rgb1, rgb2;cop2_get(20, rgb0);cop2_get(21, rgb1);cop2_get(22, rgb2);ramsyscall_printf("NCT: RGB0=0x%08x RGB1=0x%08x RGB2=0x%08x\n", rgb0, rgb1, rgb2);cester_assert_uint_eq(0x00ff0000, rgb0);cester_assert_uint_eq(0x00000000, rgb1);cester_assert_uint_eq(0x00000000, rgb2);) CESTER_TEST(nccs_basic
 
 gte_set_zero_bk ()
 
 cop2_put (6, 0x00808080)
 
 cop2_cmd (COP2_NCCS(1, 1))
 
 cop2_get (22, rgb2)
 
 ramsyscall_printf ("NCCS: MAC=(%d,%d,%d) RGB2=0x%08x\n", mac1, mac2, mac3, rgb2)
 
 cester_assert_int_eq (0, mac1)
 
 cester_assert_int_eq (0, mac2)
 
 cester_assert_int_eq (2048, mac3)
 
 cester_assert_uint_eq (0x00800000, rgb2)
 
 CESTER_TEST (ncct_basic, gte_tests, gte_set_simple_light();gte_set_white_light_color();gte_set_zero_bk();cop2_put(0, 0x00000000);cop2_put(1, 0x1000);cop2_put(2, 0x00000000);cop2_put(3, 0x1000);cop2_put(4, 0x00000000);cop2_put(5, 0x1000);cop2_put(6, 0x00808080);gte_clear_flag();cop2_cmd(COP2_NCCT(1, 1));uint32_t rgb0, rgb1, rgb2;cop2_get(20, rgb0);cop2_get(21, rgb1);cop2_get(22, rgb2);ramsyscall_printf("NCCT: RGB0=0x%08x RGB1=0x%08x RGB2=0x%08x\n", rgb0, rgb1, rgb2);cester_assert_uint_eq(0x00800000, rgb0);cester_assert_uint_eq(0x00800000, rgb1);cester_assert_uint_eq(0x00800000, rgb2);) CESTER_TEST(ncds_no_depth
 
 gte_set_far_color (0, 0, 0)
 
 cop2_put (8, 0)
 
 cop2_cmd (COP2_NCDS(1, 1))
 
 CESTER_TEST (ncds_with_depth, gte_tests, gte_set_simple_light();gte_set_white_light_color();gte_set_zero_bk();gte_set_far_color(0x1000, 0x1000, 0x1000);cop2_put(0, 0x00000000);cop2_put(1, 0x1000);cop2_put(6, 0x00808080);cop2_put(8, 0x0800);gte_clear_flag();cop2_cmd(COP2_NCDS(1, 1));int32_t mac1, mac2, mac3;uint32_t rgb2, flag;cop2_get(25, mac1);cop2_get(26, mac2);cop2_get(27, mac3);cop2_get(22, rgb2);flag=gte_read_flag();ramsyscall_printf("NCDS depth: MAC=(%d,%d,%d) RGB2=0x%08x FLAG=0x%08x\n", mac1, mac2, mac3, rgb2, flag);cester_assert_int_eq(2048, mac1);cester_assert_int_eq(2048, mac2);cester_assert_int_eq(3072, mac3);cester_assert_uint_eq(0x00c08080, rgb2);cester_assert_uint_eq(0x00000000, flag);) CESTER_TEST(ncdt_basic
 
 cop2_put (2, 0x00000000)
 
 cop2_put (3, 0x0800)
 
 cop2_put (4, 0x00000000)
 
 cop2_put (5, 0x0400)
 
 cop2_cmd (COP2_NCDT(1, 1))
 
 cop2_get (20, rgb0)
 
 cop2_get (21, rgb1)
 
 cester_assert_uint_eq (0x00800000, rgb0)
 
 cester_assert_uint_eq (0x00400000, rgb1)
 
 cester_assert_uint_eq (0x00200000, rgb2)
 
 CESTER_TEST (cc_basic, gte_tests, gte_set_white_light_color();gte_set_zero_bk();cop2_put(9, 0x1000);cop2_put(10, 0x0800);cop2_put(11, 0x0400);cop2_put(6, 0x00808080);gte_clear_flag();cop2_cmd(COP2_CC(1, 1));int32_t mac1, mac2, mac3;uint32_t rgb2;cop2_get(25, mac1);cop2_get(26, mac2);cop2_get(27, mac3);cop2_get(22, rgb2);ramsyscall_printf("CC: MAC=(%d,%d,%d) RGB2=0x%08x\n", mac1, mac2, mac3, rgb2);cester_assert_int_eq(2048, mac1);cester_assert_int_eq(1024, mac2);cester_assert_int_eq(512, mac3);cester_assert_uint_eq(0x00204080, rgb2);) CESTER_TEST(cdp_basic
 
 gte_set_far_color (0x1000, 0x1000, 0x1000)
 
 cop2_put (9, 0x1000)
 
 cop2_put (10, 0x1000)
 
 cop2_put (11, 0x1000)
 
 cop2_cmd (COP2_CDP(1, 1))
 
 cester_assert_int_eq (2048, mac1)
 
 cester_assert_int_eq (2048, mac2)
 
 cester_assert_uint_eq (0x00808080, rgb2)
 
 CESTER_TEST (cdp_with_depth, gte_tests, gte_set_white_light_color();gte_set_zero_bk();gte_set_far_color(0x1000, 0x1000, 0x1000);cop2_put(9, 0x1000);cop2_put(10, 0x1000);cop2_put(11, 0x1000);cop2_put(6, 0x00808080);cop2_put(8, 0x0800);gte_clear_flag();cop2_cmd(COP2_CDP(1, 1));int32_t mac1, mac2, mac3;uint32_t rgb2, flag;cop2_get(25, mac1);cop2_get(26, mac2);cop2_get(27, mac3);cop2_get(22, rgb2);flag=gte_read_flag();ramsyscall_printf("CDP depth: MAC=(%d,%d,%d) RGB2=0x%08x FLAG=0x%08x\n", mac1, mac2, mac3, rgb2, flag);cester_assert_int_eq(3072, mac1);cester_assert_int_eq(3072, mac2);cester_assert_int_eq(3072, mac3);cester_assert_uint_eq(0x00c0c0c0, rgb2);cester_assert_uint_eq(0x00000000, flag);) CESTER_TEST(ncs_full_light_matrix
 
 cop2_putc (8, 0x00000b50)
 
 cop2_putc (9, 0x00000000)
 
 cop2_putc (10, 0x00000000)
 
 cop2_putc (11, 0x00000000)
 
 cop2_putc (12, 0x0b50)
 
 cop2_put (0,(0<< 16)|0x1000)
 
 cop2_put (1, 0)
 
 cester_assert_int_eq (0x0b50, mac1)
 
 cester_assert_int_eq (0, mac3)
 

Variables

 gte_tests
 
int32_t mac1
 
int32_t mac2
 
int32_t mac3
 
uint32_t rgb2
 
uint32_t rgb0
 
uint32_t rgb1
 

Function Documentation

◆ cester_assert_int_eq() [1/10]

cester_assert_int_eq ( ,
mac1   
)

◆ cester_assert_int_eq() [2/10]

cester_assert_int_eq ( ,
mac2   
)

◆ cester_assert_int_eq() [3/10]

cester_assert_int_eq ( ,
mac3   
)

◆ cester_assert_int_eq() [4/10]

cester_assert_int_eq ( 0x0b50  ,
mac1   
)

◆ cester_assert_int_eq() [5/10]

cester_assert_int_eq ( 0x1200  ,
mac3   
)

◆ cester_assert_int_eq() [6/10]

cester_assert_int_eq ( 0x400  ,
mac2   
)

◆ cester_assert_int_eq() [7/10]

cester_assert_int_eq ( 0x800  ,
mac1   
)

◆ cester_assert_int_eq() [8/10]

cester_assert_int_eq ( 2048  ,
mac1   
)

◆ cester_assert_int_eq() [9/10]

cester_assert_int_eq ( 2048  ,
mac2   
)

◆ cester_assert_int_eq() [10/10]

cester_assert_int_eq ( 2048  ,
mac3   
)

◆ cester_assert_uint_eq() [1/5]

cester_assert_uint_eq ( 0x00200000  ,
rgb2   
)

◆ cester_assert_uint_eq() [2/5]

cester_assert_uint_eq ( 0x00400000  ,
rgb1   
)

◆ cester_assert_uint_eq() [3/5]

cester_assert_uint_eq ( 0x00800000  ,
rgb0   
)

◆ cester_assert_uint_eq() [4/5]

cester_assert_uint_eq ( 0x00800000  ,
rgb2   
)

◆ cester_assert_uint_eq() [5/5]

cester_assert_uint_eq ( 0x00808080  ,
rgb2   
)

◆ CESTER_TEST() [1/6]

CESTER_TEST ( cc_basic  ,
gte_tests  ,
gte_set_white_light_color();gte_set_zero_bk();cop2_put(9, 0x1000);cop2_put(10, 0x0800);cop2_put(11, 0x0400);cop2_put(6, 0x00808080);gte_clear_flag();cop2_cmd(COP2_CC(1, 1));int32_t  mac1,
mac2  ,
mac3;uint32_t rgb2;cop2_get(25, mac1);cop2_get(26, mac2);cop2_get(27, mac3);cop2_get(22, rgb2);ramsyscall_printf("CC: MAC=(%d,%d,%d) RGB2=0x%08x\n", mac1, mac2, mac3, rgb2);cester_assert_int_eq(2048, mac1);cester_assert_int_eq(1024, mac2);cester_assert_int_eq(512, mac3);cester_assert_uint_eq(0x00204080, rgb2);   
)

◆ CESTER_TEST() [2/6]

CESTER_TEST ( cdp_with_depth  ,
gte_tests  ,
gte_set_white_light_color();gte_set_zero_bk();gte_set_far_color(0x1000, 0x1000, 0x1000);cop2_put(9, 0x1000);cop2_put(10, 0x1000);cop2_put(11, 0x1000);cop2_put(6, 0x00808080);cop2_put(8, 0x0800);gte_clear_flag();cop2_cmd(COP2_CDP(1, 1));int32_t  mac1,
mac2  ,
mac3;uint32_t  rgb2,
flag;cop2_get(25, mac1);cop2_get(26, mac2);cop2_get(27, mac3);cop2_get(22, rgb2);  flag = gte_read_flag(); ramsyscall_printf("CDP depth: MAC=(%d,%d,%d) RGB2=0x%08x FLAG=0x%08x\n",                      mac1mac2mac3rgb2flag); cester_assert_int_eq(3072, mac1); cester_assert_int_eq(3072, mac2); cester_assert_int_eq(3072, mac3); cester_assert_uint_eq(0x00c0c0c0, rgb2); cester_assert_uint_eq(0x00000000, flag); 
)

◆ CESTER_TEST() [3/6]

CESTER_TEST ( ncct_basic  ,
gte_tests  ,
gte_set_simple_light();gte_set_white_light_color();gte_set_zero_bk();cop2_put(0, 0x00000000);cop2_put(1, 0x1000);cop2_put(2, 0x00000000);cop2_put(3, 0x1000);cop2_put(4, 0x00000000);cop2_put(5, 0x1000);cop2_put(6, 0x00808080);gte_clear_flag();cop2_cmd(COP2_NCCT(1, 1));uint32_t  rgb0,
rgb1  ,
rgb2;cop2_get(20, rgb0);cop2_get(21, rgb1);cop2_get(22, rgb2);ramsyscall_printf("NCCT: RGB0=0x%08x RGB1=0x%08x RGB2=0x%08x\n", rgb0, rgb1, rgb2);cester_assert_uint_eq(0x00800000, rgb0);cester_assert_uint_eq(0x00800000, rgb1);cester_assert_uint_eq(0x00800000, rgb2);   
)

◆ CESTER_TEST() [4/6]

CESTER_TEST ( ncds_with_depth  ,
gte_tests  ,
gte_set_simple_light();gte_set_white_light_color();gte_set_zero_bk();gte_set_far_color(0x1000, 0x1000, 0x1000);cop2_put(0, 0x00000000);cop2_put(1, 0x1000);cop2_put(6, 0x00808080);cop2_put(8, 0x0800);gte_clear_flag();cop2_cmd(COP2_NCDS(1, 1));int32_t  mac1,
mac2  ,
mac3;uint32_t  rgb2,
flag;cop2_get(25, mac1);cop2_get(26, mac2);cop2_get(27, mac3);cop2_get(22, rgb2);  flag = gte_read_flag(); ramsyscall_printf("NCDS depth: MAC=(%d,%d,%d) RGB2=0x%08x FLAG=0x%08x\n",                      mac1mac2mac3rgb2flag); cester_assert_int_eq(2048, mac1); cester_assert_int_eq(2048, mac2); cester_assert_int_eq(3072, mac3); cester_assert_uint_eq(0x00c08080, rgb2); cester_assert_uint_eq(0x00000000, flag); 
)

◆ CESTER_TEST() [5/6]

CESTER_TEST ( ncs_z_normal_white_light  ,
gte_tests  ,
gte_set_simple_light();gte_set_white_light_color();gte_set_zero_bk();cop2_put(0, 0x00000000);cop2_put(1, 0x1000);cop2_put(6, 0x00808080);gte_clear_flag();cop2_cmd(COP2_NCS(1, 1));int32_t  mac1,
mac2  ,
mac3;uint32_t rgb2;cop2_get(25, mac1);cop2_get(26, mac2);cop2_get(27, mac3);cop2_get(22, rgb2);ramsyscall_printf("NCS z-normal: MAC=(%d,%d,%d) RGB2=0x%08x\n", mac1, mac2, mac3, rgb2);cester_assert_int_eq(0, mac1);cester_assert_int_eq(0, mac2);cester_assert_int_eq(4096, mac3);cester_assert_uint_eq(0x00ff0000, rgb2);   
)

◆ CESTER_TEST() [6/6]

CESTER_TEST ( nct_three_normals  ,
gte_tests  ,
gte_set_simple_light();gte_set_white_light_color();gte_set_zero_bk();cop2_put(0, 0x00000000);cop2_put(1, 0x1000);cop2_put(2,(0<< 16)|0x1000);cop2_put(3, 0);cop2_put(4,(0x1000<< 16)|0);cop2_put(5, 0);cop2_put(6, 0x00000000);gte_clear_flag();cop2_cmd(COP2_NCT(1, 1));uint32_t  rgb0,
rgb1  ,
rgb2;cop2_get(20, rgb0);cop2_get(21, rgb1);cop2_get(22, rgb2);ramsyscall_printf("NCT: RGB0=0x%08x RGB1=0x%08x RGB2=0x%08x\n", rgb0, rgb1, rgb2);cester_assert_uint_eq(0x00ff0000, rgb0);cester_assert_uint_eq(0x00000000, rgb1);cester_assert_uint_eq(0x00000000, rgb2);   
)

◆ cop2_cmd() [1/5]

cop2_cmd ( COP2_CDP(1, 1)  )

◆ cop2_cmd() [2/5]

cop2_cmd ( COP2_NCCS(1, 1)  )

◆ cop2_cmd() [3/5]

cop2_cmd ( COP2_NCDS(1, 1)  )

◆ cop2_cmd() [4/5]

cop2_cmd ( COP2_NCDT(1, 1)  )

◆ cop2_cmd() [5/5]

cop2_cmd ( COP2_NCS(1, 1)  )

◆ cop2_get() [1/6]

cop2_get ( 20  ,
rgb0   
)

◆ cop2_get() [2/6]

cop2_get ( 21  ,
rgb1   
)

◆ cop2_get() [3/6]

cop2_get ( 22  ,
rgb2   
)

◆ cop2_get() [4/6]

cop2_get ( 25  ,
mac1   
)

◆ cop2_get() [5/6]

cop2_get ( 26  ,
mac2   
)

◆ cop2_get() [6/6]

cop2_get ( 27  ,
mac3   
)

◆ cop2_put() [1/14]

cop2_put ( ,
0x00000000   
)

◆ cop2_put() [2/14]

cop2_put ( ,
(0<< 16)|  0x1000 
)

◆ cop2_put() [3/14]

cop2_put ( ,
 
)

◆ cop2_put() [4/14]

cop2_put ( ,
0x1000   
)

◆ cop2_put() [5/14]

cop2_put ( 10  ,
0x1000   
)

◆ cop2_put() [6/14]

cop2_put ( 11  ,
0x1000   
)

◆ cop2_put() [7/14]

cop2_put ( ,
0x00000000   
)

◆ cop2_put() [8/14]

cop2_put ( ,
0x0800   
)

◆ cop2_put() [9/14]

cop2_put ( ,
0x00000000   
)

◆ cop2_put() [10/14]

cop2_put ( ,
0x0400   
)

◆ cop2_put() [11/14]

cop2_put ( ,
0x00000000   
)

◆ cop2_put() [12/14]

cop2_put ( ,
0x00808080   
)

◆ cop2_put() [13/14]

cop2_put ( ,
 
)

◆ cop2_put() [14/14]

cop2_put ( ,
0x1000   
)

◆ cop2_putc() [1/8]

cop2_putc ( 10  ,
0x00000000   
)

◆ cop2_putc() [2/8]

cop2_putc ( 11  ,
0x00000000   
)

◆ cop2_putc() [3/8]

cop2_putc ( 12  ,
0x0b50   
)

◆ cop2_putc() [4/8]

cop2_putc ( 13  ,
0x800   
)

◆ cop2_putc() [5/8]

cop2_putc ( 14  ,
0x400   
)

◆ cop2_putc() [6/8]

cop2_putc ( 15  ,
0x200   
)

◆ cop2_putc() [7/8]

cop2_putc ( ,
0x00000b50   
)

◆ cop2_putc() [8/8]

cop2_putc ( ,
0x00000000   
)

◆ gte_clear_flag()

gte_clear_flag ( )

◆ gte_set_far_color() [1/2]

gte_set_far_color ( ,
,
 
)

◆ gte_set_far_color() [2/2]

gte_set_far_color ( 0x1000  ,
0x1000  ,
0x1000   
)

◆ gte_set_simple_light()

gte_set_simple_light ( )

◆ gte_set_white_light_color()

gte_set_white_light_color ( )

◆ gte_set_zero_bk()

gte_set_zero_bk ( )

◆ ramsyscall_printf()

ramsyscall_printf ( )

Variable Documentation

◆ gte_tests

gte_tests

◆ mac1

int32_t mac1

◆ mac2

int32_t mac2

◆ mac3

int32_t mac3

◆ rgb0

uint32_t rgb0

◆ rgb1

uint32_t rgb1

◆ rgb2

uint32_t rgb2