annotate TaskManager/Test/test_render/spe/ChainInit.cc @ 467:839e34d0cc3c draft

fix all examples. test_render is not working now.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 01 Oct 2009 19:25:25 +0900
parents 60f44d3ea452
children f979728101e7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
395
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
1 #include <stdio.h>
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
2 #include <string.h>
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
3 #include "ChainInit.h"
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
4 #include "Func.h"
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
5
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
6 /* これは必須 */
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
7 SchedDefineTask(ChainInit);
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
8
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
9 /*
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
10 spe の global 領域に MemList を生成する
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
11 */
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
12
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
13 typedef struct {
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
14 double x, y, next_x, next_y;
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
15 double vx, vy, next_vx, next_vy;
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
16 int can_move;
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
17 uint32 parent;
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
18 } CHAIN_VARS;
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
19
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
20
467
839e34d0cc3c fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 463
diff changeset
21 static int
839e34d0cc3c fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 463
diff changeset
22 run(SchedTask *s,void *rbuf, void *wbuf)
395
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
23 {
467
839e34d0cc3c fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 463
diff changeset
24 CHAIN_VARS* idata = (CHAIN_VARS*)s->get_input(rbuf, 0);
839e34d0cc3c fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 463
diff changeset
25 uint32 chain_len = s->get_param(0);
395
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
26
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
27 // property は spe 上で allocate している(global)
467
839e34d0cc3c fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 463
diff changeset
28 CHAIN_VARS *property = (CHAIN_VARS*)global_alloc(DATA_ID, sizeof(CHAIN_VARS)*chain_len);
395
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
29 memcpy(property, idata, sizeof(CHAIN_VARS)*chain_len);
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
30
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
31 return 0;
208ba3551474 chain on SPE
game@localhost.localdomain
parents:
diff changeset
32 }