539
|
1 // #define DEBUG
|
|
2 #include "error.h"
|
|
3 #include <string.h>
|
|
4 #include "Set_Texture.h"
|
|
5 #include "texture.h"
|
|
6 #include "global_alloc.h"
|
|
7
|
|
8 SchedDefineTask(SetTexture);
|
|
9
|
|
10 //texture をglobal 領域にコピーするタスク
|
|
11 static int
|
|
12 run(SchedTask *s,void *rbuf, void *wbuf)
|
|
13 {
|
|
14 __debug_spe(s, "SetTexture\n");
|
|
15 void *src[4];
|
|
16
|
|
17 src[0] = s->get_input(rbuf, 0);
|
|
18 src[1] = s->get_input(rbuf, 1);
|
|
19 src[2] = s->get_input(rbuf, 2);
|
|
20 src[3] = s->get_input(rbuf, 3);
|
|
21
|
|
22 if (s->global_get(TEXTURE_ID)) {
|
|
23 return 0;
|
|
24 } else {
|
|
25 //タスクが共有できる領域確保
|
|
26 void *data = s->global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4);
|
|
27
|
|
28 memcpy(data, src[0], MAX_LOAD_SIZE);
|
|
29 memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE);
|
|
30 memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE);
|
|
31 memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE);
|
|
32 }
|
|
33
|
|
34 return 0;
|
|
35 }
|