Mercurial > hg > Game > Cerium
diff Renderer/Engine/task/Set_Texture.cc @ 539:3bc98f6d31ff draft
Reorganization..
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Oct 2009 09:39:35 +0900 |
parents | |
children | 92b0d490e839 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/Engine/task/Set_Texture.cc Mon Oct 12 09:39:35 2009 +0900 @@ -0,0 +1,32 @@ +#include <string.h> +#include "Set_Texture.h" +#include "texture.h" +#include "global_alloc.h" + +SchedDefineTask(SetTexture); + +//texture をglobal 領域にコピーするタスク +static int +run(SchedTask *s,void *rbuf, void *wbuf) +{ + void *src[4]; + + src[0] = s->get_input(rbuf, 0); + src[1] = s->get_input(rbuf, 1); + src[2] = s->get_input(rbuf, 2); + src[3] = s->get_input(rbuf, 3); + + if (s->global_get(TEXTURE_ID)) { + return 0; + } else { + //タスクが共有できる領域確保 + void *data = s->global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); + + memcpy(data, src[0], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); + memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); + } + + return 0; +}