Mercurial > hg > Game > Cerium
diff Renderer/Engine/GTaskArray.cc @ 1004:4ca9cbf53ad6 draft
add GTaskArray and merge.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 26 Oct 2010 17:34:41 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/Engine/GTaskArray.cc Tue Oct 26 17:34:41 2010 +0900 @@ -0,0 +1,56 @@ +#include "GTaskArray.h" + +GTaskArray::GTaskArray() +{ + game_task_array = NULL; + game_task = NULL; + + task_id = 0; + task_num = 0; + param_num = 0; + inData_num = 0; + outData_num = 0; +} + +GTaskArray::~GTaskArray() +{ + if (game_task_array !=NULL) { + delete game_task_array; + } + if (game_task !=NULL) { + delete game_task; + } +} + +void +GTaskArray::init(int id, int task, int param, int inData, int outData) +{ + game_task = 0; + + task_id = id; + task_num = task; + param_num = param; + inData_num = inData; + outData_num = outData; +} + +void +GTaskArray::create_task_array(TaskManager *manager) +{ + game_task_array = manager->create_task_array(task_id, task_num, param_num, inData_num, outData_num); + game_task = 0; +} + +void +GTaskArray::next_task_array(int id) +{ + game_task = game_task_array->next_task_array(id, game_task); +} + +void +GTaskArray::finish() +{ + game_task_array->spawn_task_array(game_task->next()); + game_task_array->set_cpu(SPE_ANY); + game_task_array->spawn(); +}