changeset 1090:c5797afaaff1 draft

fix getTapestry return index. debug bus error
author yutaka@localhost.localdomain
date Wed, 22 Dec 2010 08:00:42 +0900
parents c0dc96c6f209
children 49f404f9d51c
files Renderer/Engine/spe/CreateSpan.cc Renderer/Engine/task/CreateSpan.cc TaskManager/Cell/spe/CellDmaManager.cc TaskManager/kernel/ppe/TaskManagerImpl.h
diffstat 4 files changed, 27 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/spe/CreateSpan.cc	Wed Dec 22 04:21:11 2010 +0900
+++ b/Renderer/Engine/spe/CreateSpan.cc	Wed Dec 22 08:00:42 2010 +0900
@@ -2,6 +2,8 @@
 #include "error.h"
 #include "CreateSpan.h"
 #include "viewer_types.h"
+#include "matrix_calc.h"
+#include "Tapestry.h"
 
 // DMA channel
 static const int SPAN_PACK_LOAD    =  5;
@@ -121,11 +123,14 @@
 getTapestry(int tw, int th, int scale, uint32 *addr_top)
 {
     int index = 0;
+    int diff = TEXTURE_SPLIT_PIXEL;
 
     for (int s = 1; s < scale; s <<= 1) {
-	index += tw*th;
-	tw >>= 1; /* tw /= 2 */
-	th >>= 1;
+
+        // makeTapestry の作り方をみると、こんな感じでindexだせるはず。眠いんでこれで勘弁(ry
+	index += (align(tw, diff) / diff) * (align(th, diff) / diff) * TEXTURE_BLOCK_SIZE;
+	diff <<= 1;
+
     }
 
     return addr_top + index;
--- a/Renderer/Engine/task/CreateSpan.cc	Wed Dec 22 04:21:11 2010 +0900
+++ b/Renderer/Engine/task/CreateSpan.cc	Wed Dec 22 08:00:42 2010 +0900
@@ -1,6 +1,10 @@
+// #define DEBUG
 #include "CreateSpan.h"
 #include "viewer_types.h"
+#include "matrix_calc.h"
+#include "Tapestry.h"
 
+// DMA channel
 static const int SPAN_PACK_LOAD    =  5;
 static const int SPAN_PACK_STORE   =  6;
 static const int POLYGON_PACK_LOAD =  7;
@@ -122,13 +126,17 @@
 getTapestry(int tw, int th, int scale, uint32 *addr_top)
 {
     int index = 0;
+    int diff = TEXTURE_SPLIT_PIXEL;
 
     for (int s = 1; s < scale; s <<= 1) {
-	index += tw*th;
-	tw >>= 1; /* tw /= 2 */
-	th >>= 1;
+
+        // makeTapestry の作り方をみると、こんな感じでindexだせるはず。眠いんでこれで勘弁(ry
+	index += (align(tw, diff) / diff) * (align(th, diff) / diff) * TEXTURE_BLOCK_SIZE;
+	diff <<= 1;
+
     }
 
+
     return addr_top + index;
 }
 
--- a/TaskManager/Cell/spe/CellDmaManager.cc	Wed Dec 22 04:21:11 2010 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.cc	Wed Dec 22 08:00:42 2010 +0900
@@ -16,6 +16,13 @@
 */
 void CellDmaManager::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask)
 {
+  /*
+    if ((unsigned long)addr&0xf) {
+      printf("dma_load is not aligned. addr = 0x%lx, size = %d\n",
+	     (unsigned long)addr, size);
+      return ;
+   }
+  */
     if (size == 0) return ;
     mfc_get((volatile void *)buf, addr, size, mask, 0, 0);
 
--- a/TaskManager/kernel/ppe/TaskManagerImpl.h	Wed Dec 22 04:21:11 2010 +0900
+++ b/TaskManager/kernel/ppe/TaskManagerImpl.h	Wed Dec 22 08:00:42 2010 +0900
@@ -7,6 +7,7 @@
 #include "TaskQueue.h"
 #include "HTask.h"
 #include "Scheduler.h"
+#include <malloc.h>
 class MemList;
 
 extern QueueInfo<TaskQueue> *taskQueuePool ;