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 --- .../PS3/SPU_Tasks/Texture_blit/Texture_blit.cpp | 122 ++++++++++++++++ .../PS3/SPU_Tasks/Texture_blit/Texture_blit.h | 18 +++ .../Texture_blit/Texture_blit.spu.vcxproj | 153 +++++++++++++++++++++ .../Texture_blit/Texture_blit.spu.vcxproj.vspscc | 10 ++ .../PS3/SPU_Tasks/Texture_blit/stdafx.h | 0 5 files changed, 303 insertions(+) create mode 100644 Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.cpp create mode 100644 Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.h create mode 100644 Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.spu.vcxproj create mode 100644 Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.spu.vcxproj.vspscc create mode 100644 Minecraft.Client/PS3/SPU_Tasks/Texture_blit/stdafx.h (limited to 'Minecraft.Client/PS3/SPU_Tasks/Texture_blit') diff --git a/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.cpp b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.cpp new file mode 100644 index 00000000..1430aa27 --- /dev/null +++ b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.cpp @@ -0,0 +1,122 @@ +/* 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 "Texture_blit.h" +#include "..\Common\DmaData.h" +#include + + + +static const bool sc_verbose = false; + +CellSpursJobContext2* g_pSpursJobContext; + + +void CopyPPUMemory(void* pSrc, void* pDst, int size) +{ + static const int bufferSize = 16384; + char spuBuffer[bufferSize]; + int dataLeft = size; + char* pSrcPos = (char*)pSrc; + char* pDstPos = (char*)pDst; + while(dataLeft > 0) + { + int sizeToDma = dataLeft; + if(sizeToDma > bufferSize) + sizeToDma = bufferSize; + + DmaData_SPU::getAndWait(spuBuffer, (uintptr_t)pSrcPos, sizeToDma); + DmaData_SPU::putAndWait(spuBuffer, (uintptr_t)pDstPos, sizeToDma); + pSrcPos += sizeToDma; + pDstPos += sizeToDma; + dataLeft -= sizeToDma; + } +} + + + + + + + +void blit(Texture_blit_DataIn& dataIn) +{ + int yy = dataIn.yy; + int xx = dataIn.xx; +// int hh = dataIn.hh; + int ww = dataIn.ww; + int shh = dataIn.shh; + int sww = dataIn.sww; + bool rotated = dataIn.rotated; + + for (int srcY = 0; srcY < shh; srcY++) + { + int dstY = yy + srcY; + int srcLine = srcY * sww * 4; + int dstLine = dstY * ww * 4; + + if (rotated) + { + dstY = yy + (shh - srcY); + } + + for (int srcX = 0; srcX < sww; srcX++) + { + int dstPos = dstLine + (srcX + xx) * 4; + int srcPos = srcLine + srcX * 4; + + if (rotated) + { + dstPos = (xx + srcX * ww * 4) + dstY * 4; + } + + uint32_t val = DmaData_SPU::getValue32((uintptr_t)&dataIn.pSrcData[srcPos]); + DmaData_SPU::putValue32(val, (uintptr_t)&dataIn.pDstData[dstPos]); + +// data[level]->put(dstPos + 0, srcBuffer->get(srcPos + 0)); +// data[level]->put(dstPos + 1, srcBuffer->get(srcPos + 1)); +// data[level]->put(dstPos + 2, srcBuffer->get(srcPos + 2)); +// data[level]->put(dstPos + 3, srcBuffer->get(srcPos + 3)); + } + } +} + + + +void cellSpursJobQueueMain(CellSpursJobContext2 *pContext, CellSpursJob256 *pJob) +{ + // CellSpursTaskId idTask = cellSpursGetTaskId(); + unsigned int idSpu = cellSpursGetCurrentSpuId(); + + if(sc_verbose) + spu_print("LevelRenderer_cull [SPU#%u] start\n", idSpu); + + g_pSpursJobContext = pContext; + uint32_t eaDataIn = pJob->workArea.userData[0]; +// uint32_t eaDataOut =pJob->workArea.userData[1]; + + Texture_blit_DataIn dataIn; + DmaData_SPU::getAndWait(&dataIn, eaDataIn, sizeof(Texture_blit_DataIn)); + + if(sc_verbose) + spu_print("Texture_blit [SPU#%u] \n", idSpu); + + blit(dataIn); + + + if(sc_verbose) + spu_print("Texture_blit [SPU#%u] exit\n", idSpu); +} + diff --git a/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.h b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.h new file mode 100644 index 00000000..9c4ada40 --- /dev/null +++ b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.h @@ -0,0 +1,18 @@ +#pragma once + + + +class Texture_blit_DataIn +{ +public: + uint8_t* pSrcData; + uint8_t* pDstData; + int yy; + int xx; + int hh; + int ww; + int shh; + int sww; + bool rotated; + int pad[3]; +}; diff --git a/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.spu.vcxproj b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.spu.vcxproj new file mode 100644 index 00000000..b12bc8bb --- /dev/null +++ b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.spu.vcxproj @@ -0,0 +1,153 @@ + + + + + ContentPackage + PS3 + + + Debug + PS3 + + + Release + PS3 + + + + + + + + + + {A71AAA51-6541-4348-9814-E5FE2D36183B} + Texture_blit + SAK + SAK + SAK + SAK + + + + Application + SPU + + + Application + SPU + + + Application + SPU + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + PS3_Debug\ + PS3_Debug\ + *.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean) + + false + PS3_Release\ + PS3_ContentPackage\ + PS3_Release\ + PS3_ContentPackage\ + *.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean) + *.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean) + + + false + false + $(ProjectName) + SpursInit + $(ProjectName) + $(ProjectName) + + + + -ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions) + $(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) + + + true + + + -Wl,--gc-sections -g %(AdditionalOptions) + -ldma;-lspurs_jq;%(AdditionalDependencies) + false + + + + + JobBin2 + ..\ObjFiles\Debug\$(TargetName).ppu$(ObjectExt) + + + + + -ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions) + $(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;%(AdditionalIncludeDirectories) + true + Level3 + SN_TARGET_PS3_SPU;NDEBUG;__GCC__;SPU;%(PreprocessorDefinitions) + true + + + true + + + -Wl,--gc-sections -g %(AdditionalOptions) + -ldma;-lspurs_jq;%(AdditionalDependencies) + false + + + + + JobBin2 + ..\ObjFiles\Release\$(TargetName).ppu$(ObjectExt) + + + + + -ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions) + $(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;%(AdditionalIncludeDirectories) + false + Level3 + SN_TARGET_PS3_SPU;NDEBUG;__GCC__;SPU;_CONTENT_PACKAGE;%(PreprocessorDefinitions) + true + + + true + + + -Wl,--gc-sections -g %(AdditionalOptions) + -ldma;-lspurs_jq;%(AdditionalDependencies) + false + + + + + JobBin2 + ..\ObjFiles\ContentPackage\$(TargetName).ppu$(ObjectExt) + Hard + + + + + + \ No newline at end of file diff --git a/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.spu.vcxproj.vspscc b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.spu.vcxproj.vspscc new file mode 100644 index 00000000..b6d32892 --- /dev/null +++ b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/Texture_blit.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/Texture_blit/stdafx.h b/Minecraft.Client/PS3/SPU_Tasks/Texture_blit/stdafx.h new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3