Mercurial > hg > Game > Cerium
changeset 725:3a97fdd53a8e draft
Light data load fix (general load routine)
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 19 Dec 2009 15:02:43 +0900 |
parents | 6e9e4726113e |
children | 92035a11633d |
files | Renderer/Engine/RenderingGlobal.h Renderer/Engine/SgChange.cc Renderer/Engine/global_alloc.h Renderer/Engine/spe/DataLoad.cc Renderer/Engine/spe/DataUpdate.cc Renderer/Engine/spe/Set_Texture.cc Renderer/Engine/spe/Set_Texture.h Renderer/Engine/spe/spe-main.cc Renderer/Engine/task/DataLoad.cc Renderer/Engine/task/DataUpdate.cc Renderer/Engine/task/Set_Texture.cc Renderer/Engine/task/Set_Texture.h Renderer/Engine/task/task_init.cc Renderer/Engine/viewer.cc |
diffstat | 14 files changed, 27 insertions(+), 130 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/RenderingGlobal.h Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/RenderingGlobal.h Sat Dec 19 15:02:43 2009 +0900 @@ -1,1 +1,1 @@ - DATA_ID, + Light,
--- a/Renderer/Engine/SgChange.cc Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/SgChange.cc Sat Dec 19 15:02:43 2009 +0900 @@ -97,7 +97,7 @@ sgroot_B = new SceneGraphRoot(this->width, this->height); sgroot_B->tmanager = manager; - int size = 4; + int size = sizeof(float)*4; light_xyz[0] = 0.0f; light_xyz[1] = 0.0f; light_xyz[2] = 0.0f; @@ -348,7 +348,7 @@ //Light info update HTaskPtr data_update; HTaskPtr data_update_wait; - int size = 4; + int size = sizeof(float)*4; light_xyz[0] = light_xyz_stock[0]; light_xyz[1] = light_xyz_stock[1]; @@ -356,7 +356,7 @@ light_xyz[3] = light_xyz_stock[3]; data_update_wait = manager->create_task(DataUpdate); - data_update_wait->add_inData(light_xyz, sizeof(float)*size); + data_update_wait->add_inData(light_xyz, size); data_update_wait->set_param(0, size); data_update_wait->set_param(1, LOAD_ID); data_update_wait->set_cpu((CPU_TYPE)((int)SPE_0));
--- a/Renderer/Engine/global_alloc.h Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/global_alloc.h Sat Dec 19 15:02:43 2009 +0900 @@ -8,7 +8,6 @@ */ enum global_allocate_id { - TEXTURE_ID, GLOBAL_TEXTURE_HASH, GLOBAL_TILE_LIST, KEY_STATUS,
--- a/Renderer/Engine/spe/DataLoad.cc Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/spe/DataLoad.cc Sat Dec 19 15:02:43 2009 +0900 @@ -10,12 +10,12 @@ run(SchedTask *s, void *rbuf, void *wbuf) { - int length = (int)s->get_param(0); + int size = (int)s->get_param(0); int load_id = (int)s->get_param(1); //printf("size %d",sizeof(float)*length); - s->global_alloc(load_id, sizeof(float)*length); + s->global_alloc(load_id, size); //MemList *ml = s->createMemList(length,length); //s->global_set(load_id, (void *)ml);
--- a/Renderer/Engine/spe/DataUpdate.cc Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/spe/DataUpdate.cc Sat Dec 19 15:02:43 2009 +0900 @@ -1,6 +1,7 @@ #include <stdio.h> #include "DataUpdate.h" #include "Func.h" +#include "string.h" /* これは必須 */ SchedDefineTask(DataUpdate); @@ -9,20 +10,12 @@ run(SchedTask *s, void *rbuf, void *wbuf) { - float *idata = (float*)s->get_input(rbuf, 0); - int load_id = (int)s->get_param(0); - float *global_data = (float*)s->global_get(load_id); + void *idata = (void*)s->get_input(rbuf, 0); + int size = (int)s->get_param(0); + int load_id = (int)s->get_param(1); + void *global_data = (void*)s->global_get(load_id); - global_data[0] = idata[0]; - global_data[1] = idata[1]; - global_data[2] = idata[2]; - global_data[3] = idata[3]; - -#if 0 - s->printf("spe %f ",idata[0]); - s->printf("spe %f ",idata[1]); - s->printf("spe %f\n",idata[2]); -#endif + memcpy(global_data,idata,size); return 0; }
--- a/Renderer/Engine/spe/Set_Texture.cc Sat Dec 19 14:36:37 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -// #define DEBUG -#include "error.h" -#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) -{ - __debug_spe(s, "SetTexture\n"); - 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; -}
--- a/Renderer/Engine/spe/Set_Texture.h Sat Dec 19 14:36:37 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef INCLUDED_TASK_LOAD_TEXTURE -#define INCLUDED_TASK_LOAD_TEXTURE - -#include "SchedTask.h" - - -#endif -
--- a/Renderer/Engine/spe/spe-main.cc Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/spe/spe-main.cc Sat Dec 19 15:02:43 2009 +0900 @@ -5,7 +5,6 @@ SchedExternTask(DataUpdate); SchedExternTask(LoadTexture); -SchedExternTask(SetTexture); SchedExternTask(DrawSpan); SchedExternTask(DrawSpanEnd); SchedExternTask(DrawSpanRenew); @@ -30,7 +29,6 @@ SchedRegister( DataUpdate); SchedRegister( LoadTexture); - SchedRegister( SetTexture); SchedRegister( DrawSpan); SchedRegister( ChainCal);
--- a/Renderer/Engine/task/DataLoad.cc Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/task/DataLoad.cc Sat Dec 19 15:02:43 2009 +0900 @@ -10,12 +10,12 @@ run(SchedTask *s, void *rbuf, void *wbuf) { - int length = (int)s->get_param(0); + int size = (int)s->get_param(0); int load_id = (int)s->get_param(1); //printf("size %d",sizeof(float)*length); - s->global_alloc(load_id, sizeof(float)*length); + s->global_alloc(load_id, size); //MemList *ml = s->createMemList(length,length); //s->global_set(load_id, (void *)ml);
--- a/Renderer/Engine/task/DataUpdate.cc Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/task/DataUpdate.cc Sat Dec 19 15:02:43 2009 +0900 @@ -1,6 +1,7 @@ #include <stdio.h> #include "DataUpdate.h" #include "Func.h" +#include "string.h" /* これは必須 */ SchedDefineTask(DataUpdate); @@ -8,21 +9,12 @@ static int run(SchedTask *s, void *rbuf, void *wbuf) { - - float *idata = (float*)s->get_input(rbuf, 0); - int load_id = (int)s->get_param(0); - float *global_data = (float*)s->global_get(load_id); - - global_data[0] = idata[0]; - global_data[1] = idata[1]; - global_data[2] = idata[2]; - global_data[3] = idata[3]; - -#if 0 - s->printf("spe %f ",idata[0]); - s->printf("spe %f ",idata[1]); - s->printf("spe %f\n",idata[2]); -#endif + void *idata = (void*)s->get_input(rbuf, 0); + int size = (int)s->get_param(0); + int load_id = (int)s->get_param(1); + void *global_data = (void*)s->global_get(load_id); + + memcpy(global_data,idata,size); return 0; }
--- a/Renderer/Engine/task/Set_Texture.cc Sat Dec 19 14:36:37 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#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*)((memaddr)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); - memcpy((void*)((memaddr)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); - memcpy((void*)((memaddr)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); - } - - return 0; -}
--- a/Renderer/Engine/task/Set_Texture.h Sat Dec 19 14:36:37 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef INCLUDED_TASK_LOAD_TEXTURE -#define INCLUDED_TASK_LOAD_TEXTURE - -#include "SchedTask.h" - - -#endif -
--- a/Renderer/Engine/task/task_init.cc Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/task/task_init.cc Sat Dec 19 15:02:43 2009 +0900 @@ -14,7 +14,6 @@ SchedExternTask(DrawBack); SchedExternTask(LoadTexture); -SchedExternTask(SetTexture); SchedExternTask(Move); SchedExternTask(Draw); @@ -49,7 +48,6 @@ SchedRegister( DrawBack); SchedRegister( LoadTexture); - SchedRegister( SetTexture); SchedRegister( Move); SchedRegister( Draw);
--- a/Renderer/Engine/viewer.cc Sat Dec 19 14:36:37 2009 +0900 +++ b/Renderer/Engine/viewer.cc Sat Dec 19 15:02:43 2009 +0900 @@ -106,7 +106,7 @@ sgroot = new SceneGraphRoot(this->width, this->height); sgroot->tmanager = manager; - int size = 4; + int size = sizeof(float)*4; light_xyz[0] = 0.0f; light_xyz[1] = 0.0f; @@ -117,7 +117,7 @@ for(int i = 0; i < spe_num; i++) { data_load = manager->create_task(DataLoad); data_load->set_param(0,(memaddr)size); - data_load->set_param(1,(memaddr)LOAD_ID); + data_load->set_param(1,(memaddr)Light); data_load->set_cpu((CPU_TYPE)((int)SPE_0 + i)); data_load->spawn(); } @@ -502,7 +502,7 @@ HTaskPtr data_update; HTaskPtr data_update_wait; - int size = 4; + int size = sizeof(float)*4; light_xyz[0] = light_xyz_stock[0]; light_xyz[1] = light_xyz_stock[1]; @@ -510,9 +510,9 @@ light_xyz[3] = light_xyz_stock[3]; data_update_wait = manager->create_task(DataUpdate); - data_update_wait->add_inData(light_xyz,sizeof(float)*size); + data_update_wait->add_inData(light_xyz,size); data_update_wait->set_param(0,size); - data_update_wait->set_param(1,LOAD_ID); + data_update_wait->set_param(1,Light); data_update_wait->set_cpu((CPU_TYPE)((int)SPE_0)); @@ -520,7 +520,7 @@ data_update = manager->create_task(DataUpdate); data_update->add_inData(light_xyz,sizeof(float)*size); data_update->set_param(0,size); - data_update->set_param(1,LOAD_ID); + data_update->set_param(1,Light); data_update->set_cpu((CPU_TYPE)((int)SPE_0 + i)); data_update_wait->wait_for(data_update); data_update->spawn();