aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate')
-rw-r--r--Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.cpp89
-rw-r--r--Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.h16
-rw-r--r--Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.spu.vcxproj153
-rw-r--r--Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.spu.vcxproj.vspscc10
-rw-r--r--Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/stdafx.h0
5 files changed, 268 insertions, 0 deletions
diff --git a/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.cpp b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.cpp
new file mode 100644
index 00000000..10a9b611
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.cpp
@@ -0,0 +1,89 @@
+/* SCE CONFIDENTIAL
+PlayStation(R)3 Programmer Tool Runtime Library 430.001
+* Copyright (C) 2007 Sony Computer Entertainment Inc.
+* All Rights Reserved.
+*/
+
+/* common headers */
+#include <stdint.h>
+#include <stdlib.h>
+#include <alloca.h>
+#include <spu_intrinsics.h>
+#include <cell/spurs.h>
+#include <cell/dma.h>
+#include <cell/spurs/job_queue.h>
+
+#include "Renderer_TextureUpdate.h"
+#include "..\Common\DmaData.h"
+#include <vectormath/c/vectormath_aos_v.h>
+
+
+
+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 TextureDataUpdate(int xoffset, int yoffset, int width, int height, int pitch, void *pSrcData, void* pDstData, int level)
+{
+ int colourDepth = 4;
+ char* pTexData = (char*)pDstData;
+ char* pSrc = (char*) pSrcData;
+ int srcOffset = 0;
+ int dstOffset = 0;
+ for(int i=0; i<height;i++)
+ {
+ CopyPPUMemory(&pSrc[srcOffset], &pTexData[dstOffset], pitch*colourDepth);
+ srcOffset += width*colourDepth;
+ dstOffset += pitch;
+ }
+}
+
+
+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];
+
+ Renderer_TextureUpdate_DataIn dataIn;
+ DmaData_SPU::getAndWait(&dataIn, eaDataIn, sizeof(Renderer_TextureUpdate_DataIn));
+
+ if(sc_verbose)
+ spu_print("Renderer_TextureDataUpdate [SPU#%u] \n", idSpu);
+
+ TextureDataUpdate(dataIn.xoffset, dataIn.yoffset, dataIn.width, dataIn.height, dataIn.pitch, dataIn.pSrcData, dataIn.pDstData, dataIn.level );
+
+
+ if(sc_verbose)
+ spu_print("Renderer_TextureDataUpdate [SPU#%u] exit\n", idSpu);
+}
+
diff --git a/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.h b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.h
new file mode 100644
index 00000000..965b5807
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.h
@@ -0,0 +1,16 @@
+#pragma once
+
+
+
+class Renderer_TextureUpdate_DataIn
+{
+public:
+ int xoffset;
+ int yoffset;
+ int width;
+ int height;
+ int pitch;
+ void* pSrcData;
+ void* pDstData;
+ int level;
+};
diff --git a/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.spu.vcxproj b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.spu.vcxproj
new file mode 100644
index 00000000..77095098
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.spu.vcxproj
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="us-ascii"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="ContentPackage|PS3">
+ <Configuration>ContentPackage</Configuration>
+ <Platform>PS3</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|PS3">
+ <Configuration>Debug</Configuration>
+ <Platform>PS3</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|PS3">
+ <Configuration>Release</Configuration>
+ <Platform>PS3</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="Renderer_TextureUpdate.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="Renderer_TextureUpdate.h" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{AEC81E5C-04B5-4F77-91A0-D94065F885B7}</ProjectGuid>
+ <ProjectName>Renderer_TextureUpdate</ProjectName>
+ <SccProjectName>SAK</SccProjectName>
+ <SccAuxPath>SAK</SccAuxPath>
+ <SccLocalPath>SAK</SccLocalPath>
+ <SccProvider>SAK</SccProvider>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|PS3'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>SPU</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>SPU</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <PlatformToolset>SPU</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|PS3'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">PS3_Debug\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">PS3_Debug\</IntDir>
+ <ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">*.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'" />
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">false</GenerateManifest>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">PS3_Release\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">PS3_ContentPackage\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">PS3_Release\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">PS3_ContentPackage\</IntDir>
+ <ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">*.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
+ <ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">*.obj;*.d;*.map;*.lst;*.pch;$(TargetPath);undefined;$(ExtensionsToDeleteOnClean)</ExtensionsToDeleteOnClean>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|PS3'" />
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'" />
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">false</GenerateManifest>
+ <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">false</GenerateManifest>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">$(ProjectName)</TargetName>
+ <SpursUsage>SpursInit</SpursUsage>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">$(ProjectName)</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">$(ProjectName)</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|PS3'">
+ <ClCompile>
+ <AdditionalOptions>-ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>$(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <PreprocessorDefinitions>SN_TARGET_PS3_SPU;_DEBUG;__GCC__;SPU;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ <Link>
+ <AdditionalOptions>-Wl,--gc-sections -g %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>-ldma;-lspurs_jq;%(AdditionalDependencies)</AdditionalDependencies>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ <SpuElfConversion>
+ <EmbedFormat>JobBin2</EmbedFormat>
+ <OutputFile>..\ObjFiles\Debug\$(TargetName).ppu$(ObjectExt)</OutputFile>
+ </SpuElfConversion>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">
+ <ClCompile>
+ <AdditionalOptions>-ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>$(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <OptimizationLevel>Level3</OptimizationLevel>
+ <PreprocessorDefinitions>SN_TARGET_PS3_SPU;NDEBUG;__GCC__;SPU;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <UnrollLoops>true</UnrollLoops>
+ </ClCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ <Link>
+ <AdditionalOptions>-Wl,--gc-sections -g %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>-ldma;-lspurs_jq;%(AdditionalDependencies)</AdditionalDependencies>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ <SpuElfConversion>
+ <EmbedFormat>JobBin2</EmbedFormat>
+ <OutputFile>..\ObjFiles\Release\$(TargetName).ppu$(ObjectExt)</OutputFile>
+ </SpuElfConversion>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ContentPackage|PS3'">
+ <ClCompile>
+ <AdditionalOptions>-ffunction-sections -fdata-sections -fstack-check %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalIncludeDirectories>$(SN_PS3_PATH)\spu\include\sn;$(SCE_PS3_ROOT)\target\spu\include;$(SCE_PS3_ROOT)\target\common\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <OptimizationLevel>Level3</OptimizationLevel>
+ <PreprocessorDefinitions>SN_TARGET_PS3_SPU;NDEBUG;__GCC__;SPU;_CONTENT_PACKAGE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <UnrollLoops>true</UnrollLoops>
+ </ClCompile>
+ <ProjectReference>
+ <LinkLibraryDependencies>true</LinkLibraryDependencies>
+ </ProjectReference>
+ <Link>
+ <AdditionalOptions>-Wl,--gc-sections -g %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalDependencies>-ldma;-lspurs_jq;%(AdditionalDependencies)</AdditionalDependencies>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ <SpuElfConversion>
+ <EmbedFormat>JobBin2</EmbedFormat>
+ <OutputFile>..\ObjFiles\ContentPackage\$(TargetName).ppu$(ObjectExt)</OutputFile>
+ <StripMode>Hard</StripMode>
+ </SpuElfConversion>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.spu.vcxproj.vspscc b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.spu.vcxproj.vspscc
new file mode 100644
index 00000000..b6d32892
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/Renderer_TextureUpdate.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/Renderer_TextureUpdate/stdafx.h b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/stdafx.h
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Minecraft.Client/PS3/SPU_Tasks/Renderer_TextureUpdate/stdafx.h