# HG changeset patch # User yutaka@localhost.localdomain # Date 1292972442 -32400 # Node ID c5797afaaff1e3754880d70b9495a792917533ff # Parent c0dc96c6f209beb6b092ec5cad9f7c583b851641 fix getTapestry return index. debug bus error diff -r c0dc96c6f209 -r c5797afaaff1 Renderer/Engine/spe/CreateSpan.cc --- 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; diff -r c0dc96c6f209 -r c5797afaaff1 Renderer/Engine/task/CreateSpan.cc --- 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; } diff -r c0dc96c6f209 -r c5797afaaff1 TaskManager/Cell/spe/CellDmaManager.cc --- 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); diff -r c0dc96c6f209 -r c5797afaaff1 TaskManager/kernel/ppe/TaskManagerImpl.h --- 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 class MemList; extern QueueInfo *taskQueuePool ;