comparison TaskManager/Test/test_render/task/Set_Texture.cpp @ 352:9738837c225c draft

add global_alloc.h
author admin@mb22-no-macbook-2.local
date Mon, 13 Jul 2009 19:25:10 +0900
parents 13b43de5ef5d
children
comparison
equal deleted inserted replaced
351:10c1f6970f6a 352:9738837c225c
1 #include <string.h> 1 #include <string.h>
2 #include "Set_Texture.h" 2 #include "Set_Texture.h"
3 #include "texture.h" 3 #include "texture.h"
4 #include "global_alloc.h"
4 5
5 SchedDefineTask(SetTexture); 6 SchedDefineTask(SetTexture);
6 7
7 //texture をglobal 領域にコピーするタスク 8 //texture をglobal 領域にコピーするタスク
8 int 9 int
9 SetTexture::run(void *rbuf, void *wbuf) 10 SetTexture::run(void *rbuf, void *wbuf)
10 { 11 {
11 void *src[4]; 12 void *src[4];
12 13
13 src[0] = get_input(rbuf, 0); 14 src[0] = get_input(rbuf, 0);
14 src[1] = get_input(rbuf, 1); 15 src[1] = get_input(rbuf, 1);
15 src[2] = get_input(rbuf, 2); 16 src[2] = get_input(rbuf, 2);
16 src[3] = get_input(rbuf, 3); 17 src[3] = get_input(rbuf, 3);
17 18
18 if (global_get(TEXTURE_ID)) { 19 if (global_get(TEXTURE_ID)) {
19 return 0; 20 return 0;
20 } else { 21 } else {
21 //タスクが共有できる領域確保 22 //タスクが共有できる領域確保
22 void *data = global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); 23 void *data = global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4);
23 24
24 memcpy(data, src[0], MAX_LOAD_SIZE); 25 memcpy(data, src[0], MAX_LOAD_SIZE);
25 memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); 26 memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE);
26 memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); 27 memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE);
27 memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); 28 memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE);
28 } 29 }
29 30
30 return 0; 31 return 0;
31 } 32 }