changeset 1087:20f09564c586 draft

fix (not yet tested)
author root@localhost.localdomain
date Fri, 17 Dec 2010 18:34:29 +0900
parents ae5db88526f8
children 560d18ef3077
files Renderer/Engine/Makefile.def Renderer/Engine/TextureHash.cc Renderer/Engine/spe/DrawSpan.cc TaskManager/Makefile.cell
diffstat 4 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def	Fri Dec 17 12:59:08 2010 +0900
+++ b/Renderer/Engine/Makefile.def	Fri Dec 17 18:34:29 2010 +0900
@@ -5,7 +5,7 @@
 ABIBIT = 64 
 ABI = -m$(ABIBIT)
 CC      = g++
-OPT	= -g # -O9 #-DSPE_CREATE_POLYGON_CHECK -DSPE_CREATE_POLYGON=1
+OPT	= -O9 #-DSPE_CREATE_POLYGON_CHECK -DSPE_CREATE_POLYGON=1
 CFLAGS  = -Wall $(ABI) $(OPT)  #  -DDEBUG
 
 INCLUDE = -I$(CERIUM)/include/TaskManager -I.
--- a/Renderer/Engine/TextureHash.cc	Fri Dec 17 12:59:08 2010 +0900
+++ b/Renderer/Engine/TextureHash.cc	Fri Dec 17 18:34:29 2010 +0900
@@ -6,8 +6,12 @@
 
 TextureHash::TextureHash(void)
 {
-    table = (hashtable*)malloc(sizeof(hashtable)*TABLE_SIZE);
-
+    int size = sizeof(hashtable)*TABLE_SIZE;
+#if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN)
+        table =  (hashtable*)malloc(size);
+#else
+        posix_memalign((void**)&table, alignment, size);
+#endif
     for (int i = 0; i < TABLE_SIZE; i++) {
         table[i].tx_id = -1;
         table[i].key = NULL;
--- a/Renderer/Engine/spe/DrawSpan.cc	Fri Dec 17 12:59:08 2010 +0900
+++ b/Renderer/Engine/spe/DrawSpan.cc	Fri Dec 17 18:34:29 2010 +0900
@@ -288,6 +288,8 @@
     tex_ypos = (int)((span->tex_height-1) * tey);
 
     if (zpos < g->zRow[localx + (rangex*localy)]) {
+        if (!span->tex_addr) return -1; // broken case, I'd like to write some thing...
+
         tex_addr = getTile(tex_xpos, tex_ypos,
                            span->tex_width, (memaddr)span->tex_addr);
         tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
@@ -395,7 +397,8 @@
             int tex_localx;
             int tex_localy;
 
-            tex_addr = getTile(tex_xpos, tex_ypos,
+	    if (!span->tex_addr) return -1; // broken case, I'd like to write some thing...
+		tex_addr = getTile(tex_xpos, tex_ypos,
                                span->tex_width, (memaddr)span->tex_addr);
             tex_localx = tex_xpos % TEXTURE_SPLIT_PIXEL;
             tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
--- a/TaskManager/Makefile.cell	Fri Dec 17 12:59:08 2010 +0900
+++ b/TaskManager/Makefile.cell	Fri Dec 17 18:34:29 2010 +0900
@@ -4,6 +4,7 @@
 ABI= -m$(ABIBIT)
 TARGET    = libCellManager.a
 SPETARGET = libspemanager.a
+CFLAGS += -DHAS_POSIX_MEMALIGN
 
 CELL_SPE_DIR  = $(IMPL_CELL_DIR)/spe