Mercurial > hg > Game > Cerium
annotate example/renew_task/spe/RenewStart.cc @ 2054:2e7a6f40672f draft
add param(4) in FileMapReduce.cc
author | masa |
---|---|
date | Fri, 29 Jan 2016 15:56:28 +0900 |
parents | f40558ec00a8 |
children |
rev | line source |
---|---|
192 | 1 #include <stdio.h> |
2 #include "RenewStart.h" | |
3 #include "SpeProfile.h" | |
4 #include "Func.h" | |
5 | |
298 | 6 /* これは必須 */ |
192 | 7 SchedDefineTask(RenewStart); |
8 | |
467
839e34d0cc3c
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
9 static int |
839e34d0cc3c
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
10 run(SchedTask *s, void *rbuf, void *wbuf) |
192 | 11 { |
467
839e34d0cc3c
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
12 s->printf("[SPE] ** running RenewStart\n"); |
192 | 13 |
467
839e34d0cc3c
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
14 void *tmp = s->global_alloc(sizeof(SpeProfile), 0); |
839e34d0cc3c
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
15 // overlay で動くの? |
192 | 16 SpeProfile *profile = new (tmp) SpeProfile; |
17 | |
626
0e91ddaad798
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
538
diff
changeset
|
18 int id = (long)s->get_param(0); |
538 | 19 s->printf("[SPE] Create Task : Renew1 %d\n", id); |
626
0e91ddaad798
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
538
diff
changeset
|
20 HTaskPtr nextTask = s->create_task(RENEW1); |
487 | 21 |
626
0e91ddaad798
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
538
diff
changeset
|
22 int *test_num = (int*)s->get_param(1); |
0e91ddaad798
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
538
diff
changeset
|
23 int *local_num = (int*)s->allocate(sizeof(int)); |
538 | 24 *local_num = 555; |
487 | 25 |
538 | 26 // この add_inData は、メインメモリのアドレスになる。 |
1412
f40558ec00a8
remove duplicated spe task code source
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
27 nextTask->set_inData(0,test_num, sizeof(int)); |
538 | 28 // local なアドレスを渡したい時には、set_param を使う。 |
1412
f40558ec00a8
remove duplicated spe task code source
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
626
diff
changeset
|
29 nextTask->set_param(0,local_num); |
487 | 30 |
626
0e91ddaad798
64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
538
diff
changeset
|
31 nextTask->spawn(); |
192 | 32 |
467
839e34d0cc3c
fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
356
diff
changeset
|
33 s->printf("[SPE] ** finish RenewStart\n\n"); |
192 | 34 |
35 profile->ProfStart(); | |
36 | |
37 return 0; | |
38 } |