Initial commit

This commit is contained in:
daoge_cmd
2026-03-01 12:16:08 +08:00
parent def8cb4153
commit b691c43c44
19437 changed files with 4363922 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
/* 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 "LevelRenderer_zSort.h"
#include "..\Common\DmaData.h"
#include <vectormath/c/vectormath_aos_v.h>
// #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;
CellSpursJobContext2* g_pSpursJobContext;
struct ListData
{
int index;
float zDepth;
};
int zGreater(const void * a, const void * b)
{
if ( ((ListData*)a)->zDepth < ((ListData*)b)->zDepth ) return -1;
if ( ((ListData*)a)->zDepth == ((ListData*)b)->zDepth ) return 0;
if ( ((ListData*)a)->zDepth > ((ListData*)b)->zDepth ) return 1;
}
int zLess(const void * a, const void * b)
{
if ( ((ListData*)a)->zDepth > ((ListData*)b)->zDepth ) return -1;
if ( ((ListData*)a)->zDepth == ((ListData*)b)->zDepth ) return 0;
if ( ((ListData*)a)->zDepth < ((ListData*)b)->zDepth ) return 1;
}
void zSort(LevelRenderer_cull_DataIn* dataIn, LevelRenderer_cull_DataIn* eaDataIn)
{
int num = dataIn->numToRender_layer0;
int* listArray_layer0 = (int*)alloca(DmaData_SPU::roundUpDMASize(num * sizeof(int)));
float* zDepth_layer0 = (float*)alloca(DmaData_SPU::roundUpDMASize(num * sizeof(float)));
ListData* list = (ListData*)alloca(DmaData_SPU::roundUpDMASize(num * sizeof(ListData)));
DmaData_SPU::getAndWait(listArray_layer0, (uintptr_t)dataIn->listArray_layer0, DmaData_SPU::roundUpDMASize(sizeof(int)*num));
DmaData_SPU::getAndWait(zDepth_layer0, (uintptr_t)dataIn->zDepth_layer0, DmaData_SPU::roundUpDMASize(sizeof(int)*num));
for(int i=0;i<num;i++)
{
list[i].index = listArray_layer0[i];
list[i].zDepth = zDepth_layer0[i];
}
// spu_print("qsorting %d values\n", num);
std::qsort(list, num, sizeof(ListData), zLess);
for(int i=0;i<num;i++)
{
listArray_layer0[i] = list[i].index;
zDepth_layer0[i] = list[i].zDepth;
// spu_print("i %d : %f\n", i, list[i].zDepth);
}
DmaData_SPU::putAndWait(listArray_layer0, (uintptr_t)dataIn->listArray_layer0, DmaData_SPU::roundUpDMASize(sizeof(int)*num));
DmaData_SPU::putAndWait(zDepth_layer0, (uintptr_t)dataIn->zDepth_layer0, DmaData_SPU::roundUpDMASize(sizeof(float)*num));
}
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];
LevelRenderer_cull_DataIn dataIn;
DmaData_SPU::getAndWait(&dataIn, eaDataIn, sizeof(LevelRenderer_cull_DataIn));
zSort(&dataIn, (LevelRenderer_cull_DataIn*)eaDataIn);
if(sc_verbose)
spu_print("LevelRenderer_cull [SPU#%u] exit\n", idSpu);
}

View File

@@ -0,0 +1,4 @@
#pragma once
#include <vectormath\cpp\vectormath_aos.h>
#include "../LevelRenderer_cull/LevelRenderer_cull.h"

View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<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="LevelRenderer_zSort.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="LevelRenderer_zSort.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BE7A14B2-1761-4FDF-82C0-B50F8BC9633A}</ProjectGuid>
<ProjectName>LevelRenderer_zSort</ProjectName>
<SccProjectName>%24/StoriesPark/Minecraft/MinecraftConsoles-dev/Minecraft.Client/PS3/SPU_Tasks/LevelRenderer_zSort</SccProjectName>
<SccAuxPath>https://tfs4jstudios.visualstudio.com/defaultcollection</SccAuxPath>
<SccLocalPath>.</SccLocalPath>
<SccProvider>{4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}</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>

View File

@@ -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"
}