Last change
on this file since 813 was
683,
checked in by guerin, 9 years ago
|
raycast: initial distributed implementation
The main task runs on processor (0,0,0). It manages game logic and
initialization, and participates in the rendering process.
The render task runs on all other processors. It tries to render a frame
slice when available, which is raycasting + pixel drawing for a pixel
column of the frame.
|
File size:
827 bytes
|
Line | |
---|
1 | #include "game.h" |
---|
2 | #include "disp.h" |
---|
3 | #include <stdio.h> |
---|
4 | #include <malloc.h> |
---|
5 | |
---|
6 | static volatile unsigned int init_sync = 0; |
---|
7 | |
---|
8 | // Exported functions |
---|
9 | |
---|
10 | __attribute__((constructor)) void render() |
---|
11 | { |
---|
12 | // Wait for main initialization |
---|
13 | while (!init_sync); |
---|
14 | |
---|
15 | Game *game = gameInstance(); |
---|
16 | |
---|
17 | // Render slices as soon as it's available |
---|
18 | while (1) { |
---|
19 | dispRenderSlice(game); |
---|
20 | } |
---|
21 | } |
---|
22 | |
---|
23 | __attribute__((constructor)) void main() |
---|
24 | { |
---|
25 | unsigned int w, h, p; |
---|
26 | unsigned int i, j; |
---|
27 | |
---|
28 | giet_tty_alloc(0); |
---|
29 | giet_tty_printf("[RAYCAST] entering main()\n"); |
---|
30 | |
---|
31 | // Initialize heap for each cluster |
---|
32 | giet_procs_number(&w, &h, &p); |
---|
33 | for (i = 0; i < w; i++) |
---|
34 | for (j = 0; j < h; j++) |
---|
35 | heap_init(i, j); |
---|
36 | |
---|
37 | // Initialize game |
---|
38 | dispInit(); |
---|
39 | |
---|
40 | init_sync = 1; |
---|
41 | |
---|
42 | while (1) { |
---|
43 | gameRun(); |
---|
44 | } |
---|
45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.