Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/task/DataAllocate.cc @ 988:0b6f8c82625a akira
fix for double buffer
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 02 Oct 2010 03:48:39 +0900 |
parents | ac437c3cf766 |
children | 1b018a00cd17 |
rev | line source |
---|---|
751 | 1 #include <stdio.h> |
2 #include <string.h> | |
915
ad10d6d39ca6
create_polygon_task ..not worked yet.
yutaka@localhost.localdomain
parents:
823
diff
changeset
|
3 #include "DataAllocate.h" |
751 | 4 #include "Func.h" |
5 | |
6 /* これは必須 */ | |
915
ad10d6d39ca6
create_polygon_task ..not worked yet.
yutaka@localhost.localdomain
parents:
823
diff
changeset
|
7 SchedDefineTask(DataAllocate); |
751 | 8 |
9 static int | |
10 run(SchedTask *s, void *rbuf, void *wbuf) | |
11 { | |
12 | |
988 | 13 int count = (int)s->get_param(0); |
986
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
14 for(int i=0;i<count;i++) { |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
15 void *idata = s->get_input(rbuf, i); |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
16 long size = (long)s->get_param(i*2+1); |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
17 long load_id = (long)s->get_param(i*2+2); |
751 | 18 |
986
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
19 void *buff = s->global_alloc(load_id, size); |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
20 if (idata != NULL) { |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
21 memcpy(buff,idata,size); |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
22 } |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
915
diff
changeset
|
23 } |
751 | 24 |
25 return 0; | |
26 } | |
27 |