Changeset 724 for soft/giet_vm/applications/raycast
- Timestamp:
- Nov 21, 2015, 2:25:14 PM (9 years ago)
- Location:
- soft/giet_vm/applications/raycast
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/raycast/disp.c
r708 r724 19 19 20 20 extern unsigned char* g_tex[5]; 21 extern unsigned char* buf[2]; 22 extern void* sts[2]; 23 extern unsigned int cur_buf; 21 extern unsigned char* buf; 22 extern void* sts; 24 23 extern unsigned int slice_x; 25 24 extern unsigned int slice_count; … … 38 37 int ymax = (y1 < FBUF_Y_SIZE ? y1 : FBUF_Y_SIZE); 39 38 40 for (; y < ymax; y++) { 39 for (; y < ymax; y++) 40 { 41 41 // Find texture coordinate 42 42 int ty = (y - y0) * TEX_SIZE / (y1 - y0); 43 43 44 buf[ cur_buf][y * FBUF_X_SIZE + x] = line[ty];44 buf[y * FBUF_X_SIZE + x] = line[ty]; 45 45 } 46 46 } … … 52 52 int ymax = (y1 < FBUF_Y_SIZE ? y1 : FBUF_Y_SIZE); 53 53 54 for (; y < ymax; y++) { 55 buf[cur_buf][y * FBUF_X_SIZE + x] = color; 54 for (; y < ymax; y++) 55 { 56 buf[y * FBUF_X_SIZE + x] = color; 56 57 } 57 58 } -
soft/giet_vm/applications/raycast/raycast.c
r712 r724 9 9 /////////////////////// 10 10 11 unsigned char* buf[2]; // one image per buffer 12 void * sts[2]; // for fbf_cma 13 unsigned int cur_buf; // current buffer 11 unsigned char* buf; // one image buffer 12 void * sts; // buffer status 14 13 volatile unsigned int slice_x; // slice index (shared) 15 14 volatile unsigned int slice_count; // slice count (shared) … … 84 83 sqt_lock_init( &slice_done_lock, w , h , p ); 85 84 86 // Allocate buffers 87 buf[0] = malloc(FBUF_X_SIZE * FBUF_Y_SIZE); 88 buf[1] = malloc(FBUF_X_SIZE * FBUF_Y_SIZE); 89 sts[0] = malloc(64); 90 sts[1] = malloc(64); 85 // Allocate buffer and status for CMA 86 buf = malloc(FBUF_X_SIZE * FBUF_Y_SIZE); 87 sts = malloc(64); 91 88 92 // Initialize frame buffer and start Chained buffer DMA89 // Get frame buffer ownership 93 90 giet_fbf_alloc(); 94 giet_fbf_cma_alloc(); 95 giet_fbf_cma_init_buf(buf[0], buf[1], sts[0], sts[1]); 96 giet_fbf_cma_start(FBUF_X_SIZE * FBUF_Y_SIZE); 97 cur_buf = 0; 91 92 // Get a CMA channel for one single user buffer 93 giet_fbf_cma_alloc( 1 ); 94 95 // Register the user buffer and status 96 giet_fbf_cma_init_buf( 0 , buf , sts ); 97 98 // Start Chained buffer DMA 99 giet_fbf_cma_start(); 98 100 99 101 // Load textures … … 122 124 } 123 125 124 125 126 126 // Game main loop : display one frame 127 127 // and get one player move per iteration 128 128 while ( game.exit == 0 ) 129 129 { 130 // initialise synchronisation variables 131 // this actually allows the render threads to make useful work 130 // check user buffer empty 131 giet_fbf_cma_check( 0 ); 132 133 // re-initialise synchronisation variables 134 // to start parallel synthesis 132 135 slice_count = 0; 133 136 slice_x = 0; 134 137 135 // contribute to build current buffer138 // contribute to synthesis 136 139 unsigned int slice; 137 140 while ( dispRenderSlice( &slice ) ); … … 140 143 while (slice_count < FBUF_X_SIZE) giet_tty_printf(" "); 141 144 142 // Flip buffer 143 giet_fbf_cma_display(cur_buf); 144 cur_buf = 1 - cur_buf; 145 // display image 146 giet_fbf_cma_display( 0 ); 145 147 146 148 // get new player position [x,y,dir]
Note: See TracChangeset
for help on using the changeset viewer.