Mercurial > hg > Game > Cerium
changeset 1142:801d57ae1e29 draft
cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
And I found light error. see you tomorrow. (This version can work Mac OSX and Cell arch.)
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/Makefile.def Thu Feb 17 05:23:34 2011 +0900 @@ -5,7 +5,7 @@ ABIBIT = 64 ABI = -m$(ABIBIT) CC = g++ -OPT = -g +OPT = -O9 #-g CFLAGS = -Wall $(ABI) $(OPT) # -DDEBUG
--- a/Renderer/Engine/SceneGraph.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/SceneGraph.cc Thu Feb 17 05:23:34 2011 +0900 @@ -241,6 +241,9 @@ //delete [] data; free(pp); + free(matrix); + free(real_matrix); + free(texture_info); } @@ -251,6 +254,10 @@ void SceneGraph::finalize_copy() { + + free(matrix); + free(real_matrix); + }
--- a/Renderer/Engine/polygon.h Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/polygon.h Thu Feb 17 05:23:34 2011 +0900 @@ -49,6 +49,8 @@ #else posix_memalign(&buff, DEFAULT_ALIGNMENT, size); #endif + if (buff==0) + printf("Polygon:Can't allocate memory\n"); return buff; }
--- a/Renderer/Engine/polygon_pack.h Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/polygon_pack.h Thu Feb 17 05:23:34 2011 +0900 @@ -4,6 +4,7 @@ #include "types.h" #define MAX_SIZE_TRIANGLE 128 +//#define MAX_SIZE_TRIANGLE 1 typedef struct VertexPack { float x;
--- a/Renderer/Engine/spe/DataAllocate.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/spe/DataAllocate.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include <string.h> #include "DataAllocate.h" #include "Func.h"
--- a/Renderer/Engine/spe/DataFree.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/spe/DataFree.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include <string.h> #include "DataFree.h" #include "Func.h"
--- a/Renderer/Engine/spe/DataUpdate.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/spe/DataUpdate.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include "DataUpdate.h" #include "Func.h" #include "string.h"
--- a/Renderer/Engine/spe/Makefile Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/spe/Makefile Thu Feb 17 05:23:34 2011 +0900 @@ -5,7 +5,7 @@ TOP = ../$(CERIUM) SRCS_TMP = $(wildcard *.cc) -SRCS_EXCLUDE = #CreatePolygonFromSceneGraph.cc #CreatePolygon.cc +SRCS_EXCLUDE = CreatePolygonFromSceneGraph.cc #CreatePolygon.cc #SRCS_EXCLUDE = CreatePolygon.cc SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o)
--- a/Renderer/Engine/spe/spe-main.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/spe/spe-main.cc Thu Feb 17 05:23:34 2011 +0900 @@ -16,8 +16,7 @@ SchedExternTask(CreateSpan); SchedExternTask(CreatePolygon); -SchedExternTask(CreatePolygonFromSceneGraph); - +//SchedExternTask(CreatePolygonFromSceneGraph); SchedExternTask(ShowTime); SchedExternTask(InitKey); @@ -44,7 +43,7 @@ SchedRegister( CreateSpan); SchedRegister( CreatePolygon); - SchedRegister( CreatePolygonFromSceneGraph); + //SchedRegister( CreatePolygonFromSceneGraph); SchedRegister( ShowTime);
--- a/Renderer/Engine/viewer.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Engine/viewer.cc Thu Feb 17 05:23:34 2011 +0900 @@ -427,41 +427,6 @@ } -/* flag_drawable な Scenegraph の総数を求める */ -int -sg_drawable_num(SceneGraphPtr scenegraph) -{ - SceneGraphPtr sg = scenegraph; - - int sg_count = 0; - while (sg) { - if (sg->flag_drawable) { - sg_count++; - } - if (sg->children != NULL) { - sg = sg->children; - } else if (sg->brother != NULL) { - sg = sg->brother; - } else { - while (sg) { - if (sg->brother != NULL) { - sg = sg->brother; - break; - } else { - if (sg->parent == NULL) { - sg = NULL; - break; - } else { - sg = sg->parent; - } - } - } - } - } - return sg_count; -} - - void Viewer::rendering_pp(HTaskPtr task_next, SceneGraphRoot *sgroot) { @@ -477,8 +442,8 @@ //多分このsg_remove_listであってる?。チェック対象かも for (SceneGraphPtr t = sgroot->sg_remove_list; t != NULL; t = t->next) { - - for (int i = 0; i < t->pp_num; i++) { + if (t->size > 0) { + for (int i = 0; i < t->pp_num; i++) { HTaskPtr create_pp = manager->create_task(CreatePolygonFromSceneGraph); create_pp->add_inData(&t->pp[i], sizeof(PolygonPack)); @@ -503,16 +468,19 @@ if (game_task_array != NULL) { create_pp->wait_for(game_task_array); } + + PolygonPackPtr tmp_pp = (PolygonPackPtr)manager->allocate(sizeof(PolygonPack)); - PolygonPackPtr tmp_pp = (PolygonPackPtr)manager->allocate(sizeof(PolygonPack)); tmp_pp->init(); create_pp->set_param(0, (memaddr)tmp_pp); out_pp = tmp_pp; - create_pp->set_cpu(SPE_ANY); + //create_pp->set_cpu(SPE_ANY); + create_pp->set_cpu(CPU_PPE); task_next->wait_for(create_pp); create_pp->spawn(); } + } } }
--- a/Renderer/Test/Makefile.def Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Test/Makefile.def Thu Feb 17 05:23:34 2011 +0900 @@ -4,7 +4,7 @@ ABIBIT = 64 ABI = -m$(ABIBIT) CC = g++ -CFLAGS = -g -Wall $(ABI) #-O9 # -O -DDEBUG +CFLAGS = -Wall $(ABI) -O9 #-g # -O -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I$(CERIUM)/Renderer/Engine -I. -I$(CERIUM)/include/Cerium LIBS = -L$(CERIUM)/TaskManager -L$(CERIUM)/Renderer/Engine $(ABI)
--- a/Renderer/Test/ball_bound.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Test/ball_bound.cc Thu Feb 17 05:23:34 2011 +0900 @@ -117,6 +117,14 @@ sgroot->createFromXMLfile("xml_file/Ball.xml"); + //sgroot->OnLightSysSwitch(); + + SceneGraphPtr light = sgroot->getLight(0); + sgroot->OnLightSwitch(0); + light->xyz[0] = screen_w / 2; + light->xyz[1] = screen_h / 2; + light->xyz[2] = -100; + ball = sgroot->createSceneGraph("Ball"); ball->set_move_collision(ball_move, ball_collision);
--- a/Renderer/Test/gaplant.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/Renderer/Test/gaplant.cc Thu Feb 17 05:23:34 2011 +0900 @@ -11,6 +11,8 @@ sgroot->createFromXMLfile("xml_file/gap_plane_test.xml"); sgroot->createFromXMLfile("xml_file/Ball.xml"); + //sgroot->OnLightSysSwitch(); + back = sgroot->createSceneGraph(); back->set_move_collision(back_move, back_coll); gaplant = sgroot->createSceneGraph();
--- a/TaskManager/Cell/spe/CellDmaManager.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include <stdlib.h> #include "CellDmaManager.h" #include "Scheduler.h" @@ -18,8 +18,8 @@ { if ((unsigned long)addr&0xf) { - printf("dma_load is not aligned. addr = 0x%lx, size = %d\n", - (unsigned long)addr, size); + //s->printf("dma_load is not aligned. addr = 0x%lx, size = %d\n", + // (unsigned long)addr, size); return ; }
--- a/TaskManager/Cell/spe/CellScheduler.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/Cell/spe/CellScheduler.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include "CellScheduler.h" #include "CellDmaManager.h" #include "error.h"
--- a/TaskManager/Cell/spe/ShowTime.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/Cell/spe/ShowTime.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,5 +1,5 @@ #include "ShowTime.h" -#include "stdio.h" +//#include "stdio.h" #include "SchedTask.h" SchedDefineTask(ShowTime);
--- a/TaskManager/Cell/spe/StartProfile.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/Cell/spe/StartProfile.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,6 +1,6 @@ #include "StartProfile.h" #include "SchedTask.h" -#include "stdio.h" +//#include "stdio.h" SchedDefineTask(StartProfile);
--- a/TaskManager/Cell/spe/main.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/Cell/spe/main.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include "CellScheduler.h" #include "SpeTaskManagerImpl.h" #include "spu_mfcio.h"
--- a/TaskManager/kernel/memory/MemHash.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/memory/MemHash.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include <string.h> #include <stdlib.h> #include "MemHash.h" @@ -42,7 +42,6 @@ value += key * PRIME[n++ & 7]; data >>= 4; } -printf("hash value %0x => %0x\n",data0, value); return value % hashSize; } @@ -76,21 +75,16 @@ MemHash::get(memaddr key) { unsigned int hashval = hash(key); - //printf("get hash value %d\n",hashval); for (int i = 0; i < hashSize/2; i++) { unsigned int index = (hashval + i)%hashSize; if (table[index] != NULL && table[index]->address == key) { - //printf("get hash value %0x\n",index); - //printf("get hash value %d\n",index); return table[index]; } } - //printf("hoge\n"); - return NULL; }
--- a/TaskManager/kernel/memory/MemHash.h Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/memory/MemHash.h Thu Feb 17 05:23:34 2011 +0900 @@ -13,11 +13,8 @@ public: void clear(void); unsigned int hash(memaddr data); - unsigned int hash2(memaddr data); int put(memaddr addr, MemorySegmentPtr ms); - int put2(memaddr addr, MemorySegmentPtr ms); MemorySegmentPtr get(memaddr addr); - MemorySegmentPtr get2(memaddr addr); void remove(memaddr addr); };
--- a/TaskManager/kernel/memory/MemList.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/memory/MemList.cc Thu Feb 17 05:23:34 2011 +0900 @@ -2,7 +2,7 @@ MemList は空にならない。最低1個は要素が入っていて 1個目は特別扱いする。getFirst すると first->next を返す */ -#include <stdio.h> + #include "MemList.h" /*!
--- a/TaskManager/kernel/ppe/HTask.h Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/ppe/HTask.h Thu Feb 17 05:23:34 2011 +0900 @@ -6,7 +6,7 @@ #include "Task.h" #include "TaskQueue.h" #include "QueueInfo.h" -#include <stdio.h> +//#include <stdio.h> class TaskManagerImpl; class SchedTask;
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include "TaskManagerImpl.h" #include "types.h" #include "error.h" @@ -68,7 +68,7 @@ #ifdef EARLY_TOUCH if (rbuf) { if ((unsigned long)rbuf&0xf) { - printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n", + this->printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n", cmd, (unsigned long)rbuf, r_size); } char *p = (char *)rbuf; char b = *p; @@ -76,7 +76,7 @@ } if (wbuf) { if ((unsigned long)wbuf&0xf) { - printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n", + this->printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n", cmd, (unsigned long)wbuf, w_size); } char *p = (char *)wbuf; char b = *p; @@ -236,11 +236,11 @@ check_wait(TaskManagerImpl *tm, QueueInfo<TaskQueue> *wait_i) { for(TaskQueue *t = wait_i->getFirst(); t; t = wait_i->getNext(t)) { if (!tm->waitTaskQueue->find(t->task)) { - printf("stray waiting task%d %lx\n",t->task->command, (long)t->task); + this->printf("stray waiting task%d %lx\n",t->task->command, (long)t->task); } else if (tm->activeTaskQueue->find(t->task)) { - printf(" active task%d in waiting queue %lx\n",t->task->command, (long)t->task); + this->printf(" active task%d in waiting queue %lx\n",t->task->command, (long)t->task); } else - printf("."); + this->printf("."); } } #endif
--- a/TaskManager/kernel/schedule/SchedExit.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/schedule/SchedExit.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include "SchedExit.h" #include "error.h"
--- a/TaskManager/kernel/schedule/SchedNop.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/schedule/SchedNop.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include "SchedNop.h" #include "SchedMail.h" #include "error.h"
--- a/TaskManager/kernel/schedule/SchedNop2Ready.cc Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/schedule/SchedNop2Ready.cc Thu Feb 17 05:23:34 2011 +0900 @@ -1,4 +1,4 @@ -#include <stdio.h> +//#include <stdio.h> #include "SchedNop2Ready.h" #include "SchedTaskList.h" #include "SchedMail.h"
--- a/TaskManager/kernel/schedule/SchedTaskBase.h Thu Feb 17 20:28:26 2011 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskBase.h Thu Feb 17 05:23:34 2011 +0900 @@ -2,7 +2,7 @@ #define INCLUDED_SCHED_TASK_BASE #include "base.h" -#include <stdio.h> +//#include <stdio.h> #include <stdlib.h> class TaskManagerImpl;