From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001
From: daoge_cmd <3523206925@qq.com>
Date: Sun, 1 Mar 2026 12:16:08 +0800
Subject: Initial commit
---
.../LevelRenderChunks/LevelRenderChunks.h | 19 ++++
.../LevelRenderChunks.spu.vcxproj | 94 +++++++++++++++++
.../LevelRenderChunks.spu.vcxproj.filters | 17 +++
.../LevelRenderChunks.spu.vcxproj.vspscc | 10 ++
.../LevelRenderChunks/LevelRenderChunks_main.cpp | 117 +++++++++++++++++++++
.../PS3/SPU_Tasks/LevelRenderChunks/stdafx.h | 0
6 files changed, 257 insertions(+)
create mode 100644 Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.h
create mode 100644 Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj
create mode 100644 Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj.filters
create mode 100644 Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj.vspscc
create mode 100644 Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks_main.cpp
create mode 100644 Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/stdafx.h
(limited to 'Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks')
diff --git a/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.h b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.h
new file mode 100644
index 00000000..4fabbb21
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.h
@@ -0,0 +1,19 @@
+#pragma once
+
+
+
+class RenderChunksSpuDataIn
+{
+public:
+ CellGcmContextData m_PPUGcmContext;
+ int m_numLists;
+ int m_padding[3];
+ int m_listArray[8000];
+};
+
+class RenderChunksSpuDataOut
+{
+public:
+ uint32_t m_commandBuffer[16*1024]; // 16*4 Kb
+ int m_commandBufferSize;
+};
diff --git a/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj
new file mode 100644
index 00000000..a2c46b29
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj
@@ -0,0 +1,94 @@
+
+
+
+
+ Debug
+ PS3
+
+
+ Release
+ PS3
+
+
+
+
+
+
+
+
+
+ {47EBEE93-F9E1-4AD3-B746-0D7D7ADCB0DA}
+ task_hello.spu
+ LevelRenderChunks
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+
+ Application
+ SPU
+
+
+ Application
+ SPU
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+ $(SolutionDir)$(Platform)_$(Configuration)\
+ $(Configuration)\
+ *.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);$(ExtensionsToDeleteOnClean)
+ $(SolutionDir)$(Platform)_$(Configuration)\
+ $(Configuration)\
+ *.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean)
+ $(ProjectName)
+ $(ProjectName)
+
+
+
+ $(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;..;%(AdditionalIncludeDirectories)
+ true
+ SN_TARGET_PS3_SPU;_DEBUG;__GCC__;SPU;%(PreprocessorDefinitions)
+ Levels
+
+
+ -mspurs-task %(AdditionalOptions)
+ $(SCE_PS3_ROOT)\target\spu\lib\libspurs.a;$(SCE_PS3_ROOT)\target\spu\lib\libdma.a;%(AdditionalDependencies)
+ false
+
+
+
+
+
+
+ $(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;..;%(AdditionalIncludeDirectories)
+ Levels
+ SN_TARGET_PS3_SPU;NDEBUG;__GCC__;SPU;%(PreprocessorDefinitions)
+ true
+
+
+ -mspurs-task %(AdditionalOptions)
+ $(SCE_PS3_ROOT)\target\spu\lib\libspurs.a;$(SCE_PS3_ROOT)\target\spu\lib\libdma.a;$(SCE_PS3_ROOT)\target\spu\lib\libgcm_spu.a;%(AdditionalDependencies)
+ false
+
+
+
+
+ ..\$(TargetName).ppu$(ObjectExt)
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj.filters b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj.filters
new file mode 100644
index 00000000..8712fab2
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj.filters
@@ -0,0 +1,17 @@
+
+
+
+
+ {881f28ee-ca74-4afc-94a6-2346cb88f86d}
+ cpp;c;cxx;cc;s;asm
+
+
+
+
+ Source Files
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj.vspscc b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj.vspscc
new file mode 100644
index 00000000..b6d32892
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks.spu.vcxproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks_main.cpp b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks_main.cpp
new file mode 100644
index 00000000..11c3604f
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/LevelRenderChunks_main.cpp
@@ -0,0 +1,117 @@
+/* SCE CONFIDENTIAL
+PlayStation(R)3 Programmer Tool Runtime Library 430.001
+* Copyright (C) 2007 Sony Computer Entertainment Inc.
+* All Rights Reserved.
+*/
+
+/* common headers */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+#include "..\Common\DmaData.h"
+#include "LevelRenderChunks.h"
+#include |
+
+#define SPU_HEAPSIZE (128*1024)
+#define SPU_STACKSIZE (16*1024)
+
+CELL_SPU_LS_PARAM(128*1024, 16*1024); // can't use #defines here as it seems to create an asm instruction
+
+
+static const bool sc_verbose = false;
+
+
+
+static int32_t gcmReserveFailed(CellGcmContextData *context, uint32_t count)
+{
+ (void)count;
+ spu_assert(0);
+ context->current = context->begin; // Back to the beginning so we don't trample memory.
+ return CELL_OK;
+}
+
+
+int cellSpursTaskMain(qword argTask, uint64_t argTaskset)
+{
+ (void)argTaskset;
+ int ret;
+ CellSpursTaskId idTask = cellSpursGetTaskId();
+ unsigned int idSpu = cellSpursGetCurrentSpuId();
+
+// if(sc_verbose)
+ spu_printf("[Task#%02u][SPU#%u] start\n", idTask, idSpu);
+
+ void* pVolatileMem = NULL;
+ uint32_t volatileSize = 0;
+ ret = cellSpursGetTaskVolatileArea(&pVolatileMem, &volatileSize);
+ spu_printf( "----------------- LevelRenderChunks SPU Memory ------------------\n"
+ "Stack : %dKb\n"
+ "Heap : %dKb\n"
+ "Prog : %dKb\n"
+ "Free : %dKb\n"
+ "-------------------------------------------------------------\n",
+ SPU_STACKSIZE/1024,
+ SPU_HEAPSIZE/1024,
+ 256 - ((SPU_HEAPSIZE+SPU_STACKSIZE+volatileSize)/1024),
+ volatileSize/1024);
+
+ uint32_t eaEventFlag = spu_extract((vec_uint4)argTask, 0);
+ uint32_t eaDataIn = spu_extract((vec_uint4)argTask, 1);
+ uint32_t eaDataOut = spu_extract((vec_uint4)argTask, 2);
+
+ cell::Spurs::EventFlagStub eventFlag;
+ eventFlag.setObject(eaEventFlag);
+
+ RenderChunksSpuDataIn* pDataIn = new RenderChunksSpuDataIn;
+ RenderChunksSpuDataOut* pDataOut = new RenderChunksSpuDataOut;
+ CellGcmContextData gcmContext;
+ cellGcmSetupContextData(&gcmContext, pDataOut->m_commandBuffer, sizeof(pDataOut->m_commandBuffer), gcmReserveFailed);
+
+
+ while(1)
+ {
+ // wait for the chunk rebuild thread to signal us
+ uint16_t mask = 0x1;
+ if(sc_verbose)
+ spu_printf("[Task#%02u][SPU#%u] waiting for event flag#0, mask = 0x%04x\n", idTask, idSpu, mask);
+ ret = eventFlag.wait(&mask, CELL_SPURS_EVENT_FLAG_AND);
+ if (ret) {
+ spu_printf("[Task#%02u][SPU#%u] eventFlag0.wait() failed : %x\n", idTask, idSpu, ret);
+ abort();
+ }
+
+ if(sc_verbose)
+ spu_printf("[Task#%02u][SPU#%u] woken up\n", idTask, idSpu);
+ eventFlag.clear(0x01);
+
+ DmaData_SPU::getAndWait(pDataIn, eaDataIn, sizeof(RenderChunksSpuDataIn));
+
+ for(int i=0;im_numLists; i++)
+ {
+ cellGcmSetCallCommand(&gcmContext, pDataIn->m_listArray[i]);
+ }
+
+ pDataOut->m_commandBufferSize = ((unsigned int)gcmContext.current) - ((unsigned int)gcmContext.begin);
+
+ DmaData_SPU::putAndWait(pDataOut, eaDataOut, sizeof(RenderChunksSpuDataOut));
+
+ mask = 0x2;
+ if(sc_verbose)
+ spu_printf("[Task#%02u][SPU#%u] set event flag#1, mask = 0x%04x\n", idTask, idSpu, mask);
+ ret = eventFlag.set(mask);
+ if (ret) {
+ spu_printf("[Task#%02u][SPU#%u] eventFlag1.set(mask) failed : %x\n", idTask, idSpu, ret);
+ abort();
+ }
+ }
+ spu_printf("[Task#%02u][SPU#%u] exit\n", idTask, idSpu);
+ return 0;
+}
+
diff --git a/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/stdafx.h b/Minecraft.Client/PS3/SPU_Tasks/LevelRenderChunks/stdafx.h
new file mode 100644
index 00000000..e69de29b
--
cgit v1.2.3
| | | | |