the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 80 lines 2.4 kB view raw
1/* SCE CONFIDENTIAL 2PlayStation(R)3 Programmer Tool Runtime Library 430.001 3* Copyright (C) 2007 Sony Computer Entertainment Inc. 4* All Rights Reserved. 5*/ 6 7/* common headers */ 8#include <stdint.h> 9#include <stdlib.h> 10#include <spu_intrinsics.h> 11#include <cell/spurs.h> 12#include <cell/dma.h> 13 14#include "ChunkRebuildData.h" 15#include "TileRenderer_SPU.h" 16#include "..\Common\DmaData.h" 17 18// #define SPU_HEAPSIZE (0*1024) 19// #define SPU_STACKSIZE (64*1024) 20// 21// CELL_SPU_LS_PARAM(0*1024, 64*1024); // can't use #defines here as it seems to create an asm instruction 22 23 24static const bool sc_verbose = false; 25 26int g_lastHitBlockX = 0; 27int g_lastHitBlockY = 0; 28int g_lastHitBlockZ = 0; 29 30CellSpursJobContext2* g_pSpursJobContext; 31 32void cellSpursJobQueueMain(CellSpursJobContext2 *pContext, CellSpursJob256 *pJob) 33{ 34 CellSpursTaskId idTask = cellSpursGetTaskId(); 35 unsigned int idSpu = cellSpursGetCurrentSpuId(); 36 37 if(sc_verbose) 38 spu_print("ChunkUpdate [SPU#%u] start\n", idSpu); 39 40 g_pSpursJobContext = pContext; 41 42// void* pVolatileMem = NULL; 43// uint32_t volatileSize = 0; 44// ret = cellSpursGetTaskVolatileArea(&pVolatileMem, &volatileSize); 45// spu_print( "----------------- ChunkUpdate ------------------\n" 46// "Stack : %dKb\n" 47// "Heap : %dKb\n" 48// "Prog : %dKb\n" 49// "Free : %dKb\n" 50// "-------------------------------------------------------------\n", 51// SPU_STACKSIZE/1024, 52// SPU_HEAPSIZE/1024, 53// 256 - ((SPU_HEAPSIZE+SPU_STACKSIZE+volatileSize)/1024), 54// volatileSize/1024); 55 56// uint32_t eaEventFlag = spu_extract((vec_uint4)argTask, 0); 57 uint32_t eaDataIn = pJob->workArea.userData[0]; 58 uint32_t eaDataOut =pJob->workArea.userData[1]; 59 60 61 ChunkRebuildData rebuildData; 62 TileRenderer_SPU tileRenderer(&rebuildData); 63 unsigned int arrayData[4096+32]; 64 intArray_SPU tesselatorArray(arrayData); 65 Tile_SPU::initTilePointers(); 66 67 DmaData_SPU::getAndWait(&rebuildData, eaDataIn, sizeof(ChunkRebuildData)); 68 g_lastHitBlockX = rebuildData.m_lastHitBlockX; 69 g_lastHitBlockY = rebuildData.m_lastHitBlockY; 70 g_lastHitBlockZ = rebuildData.m_lastHitBlockZ; 71 72 rebuildData.m_tesselator._array = &tesselatorArray; 73 rebuildData.disableUnseenTiles(); 74 rebuildData.tesselateAllTiles(&tileRenderer); 75 DmaData_SPU::putAndWait(&rebuildData, eaDataOut, sizeof(ChunkRebuildData)); 76 77 if(sc_verbose) 78 spu_print("ChunkUpdate [SPU#%u] exit\n", idTask, idSpu); 79} 80