├── .editorconfig ├── .github ├── dependabot.yaml └── workflows │ ├── build-debug.yaml │ ├── build-release.yaml │ ├── prevent-github-change.yaml │ └── stale.yaml ├── .gitignore ├── Directory.Build.props ├── Icon.png ├── LICENSE.md ├── README.md ├── StructureOfArraysGenerator.sln ├── docs ├── graph.xlsx └── images.pptx ├── opensource.snk ├── sandbox ├── Benchmark │ ├── Benchmark.csproj │ └── Program.cs ├── ConsoleApp1 │ ├── ConsoleApp1.csproj │ └── Program.cs └── ConsoleAppRoslyn3 │ ├── ConsoleAppRoslyn3.csproj │ └── Program.cs ├── src ├── StructureOfArraysGenerator.Roslyn3 │ ├── Generator.Roslyn3.cs │ ├── IncrementalGeneratorShims.cs │ ├── Properties │ │ └── launchSettings.json │ └── StructureOfArraysGenerator.Roslyn3.csproj ├── StructureOfArraysGenerator.Unity │ ├── .vsconfig │ ├── Assets │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── PackageExporter.cs │ │ │ └── PackageExporter.cs.meta │ │ ├── Plugins.meta │ │ ├── Plugins │ │ │ ├── StructureOfArraysGenerator.meta │ │ │ ├── StructureOfArraysGenerator │ │ │ │ ├── Runtime.meta │ │ │ │ ├── Runtime │ │ │ │ │ ├── StructureOfArraysGenerator.Roslyn3.dll │ │ │ │ │ └── StructureOfArraysGenerator.Roslyn3.dll.meta │ │ │ │ ├── package.json │ │ │ │ └── package.json.meta │ │ │ ├── System.Runtime.CompilerServices.Unsafe.dll │ │ │ └── System.Runtime.CompilerServices.Unsafe.dll.meta │ │ ├── Scenes.meta │ │ └── Scenes │ │ │ ├── SampleScene.unity │ │ │ ├── SampleScene.unity.meta │ │ │ ├── SampleScript.cs │ │ │ └── SampleScript.cs.meta │ ├── Packages │ │ ├── manifest.json │ │ └── packages-lock.json │ ├── ProjectSettings │ │ ├── AudioManager.asset │ │ ├── ClusterInputManager.asset │ │ ├── DynamicsManager.asset │ │ ├── EditorBuildSettings.asset │ │ ├── EditorSettings.asset │ │ ├── GraphicsSettings.asset │ │ ├── InputManager.asset │ │ ├── MemorySettings.asset │ │ ├── NavMeshAreas.asset │ │ ├── NetworkManager.asset │ │ ├── PackageManagerSettings.asset │ │ ├── Physics2DSettings.asset │ │ ├── PresetManager.asset │ │ ├── ProjectSettings.asset │ │ ├── ProjectVersion.txt │ │ ├── QualitySettings.asset │ │ ├── SceneTemplateSettings.json │ │ ├── TagManager.asset │ │ ├── TimeManager.asset │ │ ├── UnityConnectSettings.asset │ │ ├── VFXManager.asset │ │ ├── VersionControlSettings.asset │ │ ├── XRSettings.asset │ │ └── boot.config │ └── UserSettings │ │ ├── EditorUserSettings.asset │ │ └── Search.settings └── StructureOfArraysGenerator │ ├── DiagnosticDescriptors.cs │ ├── EmitHelper.cs │ ├── Generator.cs │ ├── MetaMember.cs │ ├── Properties │ └── launchSettings.json │ └── StructureOfArraysGenerator.csproj └── tests ├── StructureOfArraysGenerator.Tests.Roslyn3 └── StructureOfArraysGenerator.Tests.Roslyn3.csproj └── StructureOfArraysGenerator.Tests ├── DiagnosticsTest.cs ├── MemoryPackTest.cs ├── MultiArrayTest.cs ├── MultiListTest.cs ├── StructureOfArraysGenerator.Tests.csproj └── Utils └── CSharpGeneratorRunner.cs /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_style = space 8 | indent_size = 2 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | # Visual Studio Spell checker configs (https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022#how-to-customize-the-spell-checker) 13 | spelling_exclusion_path = ./exclusion.dic 14 | 15 | [*.cs] 16 | indent_size = 4 17 | charset = utf-8-bom 18 | end_of_line = unset 19 | 20 | # Solution files 21 | [*.{sln,slnx}] 22 | end_of_line = unset 23 | 24 | # MSBuild project files 25 | [*.{csproj,props,targets}] 26 | end_of_line = unset 27 | 28 | # Xml config files 29 | [*.{ruleset,config,nuspec,resx,runsettings,DotSettings}] 30 | end_of_line = unset 31 | 32 | [*{_AssemblyInfo.cs,.notsupported.cs}] 33 | generated_code = true 34 | 35 | # C# code style settings 36 | [*.{cs}] 37 | charset = utf-8-bom 38 | indent_size = 4 39 | 40 | csharp_style_namespace_declarations = file_scoped 41 | dotnet_style_require_accessibility_modifiers = never 42 | 43 | # VSTHRD101: Avoid async void 44 | # VSTHRD101: Avoid unsupported async delegates 45 | dotnet_diagnostic.VSTHRD100.severity = none 46 | dotnet_diagnostic.VSTHRD101.severity = none 47 | 48 | # VSTHRD003: Avoid awaiting foreign Tasks 49 | dotnet_diagnostic.VSTHRD003.severity = none 50 | 51 | # VSTHRD111: Use ConfigureAwait(bool) 52 | dotnet_diagnostic.VSTHRD111.severity = error 53 | -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | # ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" # Check for updates to GitHub Actions every week 8 | ignore: 9 | # I just want update action when major/minor version is updated. patch updates are too noisy. 10 | - dependency-name: '*' 11 | update-types: 12 | - version-update:semver-patch 13 | -------------------------------------------------------------------------------- /.github/workflows/build-debug.yaml: -------------------------------------------------------------------------------- 1 | name: Build-Debug 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - "main" 8 | pull_request: 9 | branches: 10 | - "main" 11 | 12 | jobs: 13 | build-dotnet: 14 | permissions: 15 | contents: read 16 | runs-on: ubuntu-24.04 17 | timeout-minutes: 10 18 | steps: 19 | - uses: Cysharp/Actions/.github/actions/checkout@main 20 | - uses: Cysharp/Actions/.github/actions/setup-dotnet@main 21 | - run: dotnet build -c Debug 22 | - run: dotnet test -c Debug --no-build 23 | 24 | build-unity: 25 | if: ${{ ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:')) && github.triggering_actor != 'dependabot[bot]' }} 26 | strategy: 27 | matrix: 28 | unity: ["2021.3.41f1"] 29 | permissions: 30 | contents: read 31 | runs-on: ubuntu-24.04 32 | timeout-minutes: 15 33 | steps: 34 | - name: Load secrets 35 | id: op-load-secret 36 | uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0 37 | with: 38 | export-env: false 39 | env: 40 | OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }} 41 | UNITY_EMAIL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username" 42 | UNITY_PASSWORD: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential" 43 | UNITY_SERIAL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial" 44 | 45 | - uses: Cysharp/Actions/.github/actions/checkout@main 46 | - name: Build Unity (.unitypacakge) 47 | uses: Cysharp/Actions/.github/actions/unity-builder@main 48 | env: 49 | UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }} 50 | UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }} 51 | UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }} 52 | with: 53 | projectPath: src/StructureOfArraysGenerator.Unity 54 | unityVersion: ${{ matrix.unity }} 55 | targetPlatform: StandaloneLinux64 56 | buildMethod: PackageExporter.Export 57 | 58 | - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files 59 | with: 60 | directory: src/StructureOfArraysGenerator.Unity 61 | 62 | # Store artifacts. 63 | - uses: Cysharp/Actions/.github/actions/upload-artifact@main 64 | with: 65 | name: StructureOfArraysGenerator.${{ matrix.unity }}.unitypackage 66 | path: ./src/StructureOfArraysGenerator.Unity/*.unitypackage 67 | retention-days: 1 68 | -------------------------------------------------------------------------------- /.github/workflows/build-release.yaml: -------------------------------------------------------------------------------- 1 | name: Build-Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | tag: 7 | description: "tag: git tag you want create. (sample 1.0.0)" 8 | required: true 9 | dry-run: 10 | description: "dry-run: false = create release/nuget. true = never create release/nuget." 11 | required: true 12 | default: false 13 | type: boolean 14 | 15 | jobs: 16 | update-packagejson: 17 | permissions: 18 | actions: read 19 | contents: write 20 | uses: Cysharp/Actions/.github/workflows/update-packagejson.yaml@main 21 | with: 22 | file-path: | 23 | ./src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator/package.json 24 | tag: ${{ inputs.tag }} 25 | dry-run: ${{ inputs.dry-run }} 26 | push-tag: false 27 | 28 | build-dotnet: 29 | needs: [update-packagejson] 30 | permissions: 31 | contents: read 32 | runs-on: ubuntu-24.04 33 | timeout-minutes: 10 34 | steps: 35 | - run: echo ${{ needs.update-packagejson.outputs.sha }} 36 | - uses: Cysharp/Actions/.github/actions/checkout@main 37 | with: 38 | ref: ${{ needs.update-packagejson.outputs.sha }} 39 | - uses: Cysharp/Actions/.github/actions/setup-dotnet@main 40 | # pack nuget 41 | - run: dotnet build -c Release -p:Version=${{ inputs.tag }} 42 | - run: dotnet test -c Release --no-build 43 | - run: dotnet pack -c Release --no-build -p:Version=${{ inputs.tag }} -o ./publish 44 | - uses: Cysharp/Actions/.github/actions/upload-artifact@main 45 | with: 46 | name: nuget 47 | path: ./publish 48 | retention-days: 1 49 | 50 | build-unity: 51 | needs: [update-packagejson] 52 | strategy: 53 | matrix: 54 | unity: ["2021.3.41f1"] 55 | permissions: 56 | contents: read 57 | runs-on: ubuntu-24.04 58 | timeout-minutes: 15 59 | steps: 60 | - name: Load secrets 61 | id: op-load-secret 62 | uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0 63 | with: 64 | export-env: false 65 | env: 66 | OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }} 67 | UNITY_EMAIL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/username" 68 | UNITY_PASSWORD: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/credential" 69 | UNITY_SERIAL: "op://${{ vars.OP_VAULT_ACTIONS_PUBLIC }}/UNITY_LICENSE/serial" 70 | 71 | - run: echo ${{ needs.update-packagejson.outputs.sha }} 72 | - uses: Cysharp/Actions/.github/actions/checkout@main 73 | with: 74 | ref: ${{ needs.update-packagejson.outputs.sha }} 75 | # Execute scripts: Export Package 76 | # /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export 77 | - name: Build Unity (.unitypacakge) 78 | uses: Cysharp/Actions/.github/actions/unity-builder@main 79 | env: 80 | UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }} 81 | UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }} 82 | UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }} 83 | with: 84 | projectPath: src/StructureOfArraysGenerator.Unity 85 | unityVersion: ${{ matrix.unity }} 86 | targetPlatform: StandaloneLinux64 87 | buildMethod: PackageExporter.Export 88 | # check meta files 89 | - uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files 90 | with: 91 | directory: src/StructureOfArraysGenerator.Unity 92 | # Store artifacts. 93 | - uses: Cysharp/Actions/.github/actions/upload-artifact@main 94 | with: 95 | name: StructureOfArraysGenerator.${{ inputs.tag }}.unitypackage 96 | path: ./src/StructureOfArraysGenerator.Unity/StructureOfArraysGenerator.${{ inputs.tag }}.unitypackage 97 | if-no-files-found: error 98 | retention-days: 1 99 | 100 | # release 101 | create-release: 102 | needs: [update-packagejson, build-dotnet, build-unity] 103 | permissions: 104 | contents: write 105 | uses: Cysharp/Actions/.github/workflows/create-release.yaml@main 106 | with: 107 | dry-run: ${{ inputs.dry-run }} 108 | commit-id: ${{ needs.update-packagejson.outputs.sha }} 109 | tag: ${{ inputs.tag }} 110 | nuget-push: true 111 | release-upload: true 112 | release-asset-path: ./StructureOfArraysGenerator.${{ inputs.tag }}.unitypackage/StructureOfArraysGenerator.${{ inputs.tag }}.unitypackage 113 | secrets: inherit 114 | 115 | cleanup: 116 | if: ${{ needs.update-packagejson.outputs.is-branch-created == 'true' }} 117 | needs: [update-packagejson, create-release] 118 | permissions: 119 | contents: write 120 | uses: Cysharp/Actions/.github/workflows/clean-packagejson-branch.yaml@main 121 | with: 122 | branch: ${{ needs.update-packagejson.outputs.branch-name }} 123 | -------------------------------------------------------------------------------- /.github/workflows/prevent-github-change.yaml: -------------------------------------------------------------------------------- 1 | name: Prevent github change 2 | on: 3 | pull_request: 4 | paths: 5 | - ".github/**/*.yaml" 6 | - ".github/**/*.yml" 7 | 8 | jobs: 9 | detect: 10 | permissions: 11 | contents: read 12 | uses: Cysharp/Actions/.github/workflows/prevent-github-change.yaml@main 13 | -------------------------------------------------------------------------------- /.github/workflows/stale.yaml: -------------------------------------------------------------------------------- 1 | name: "Close stale issues" 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: "0 0 * * *" 7 | 8 | jobs: 9 | stale: 10 | permissions: 11 | contents: read 12 | pull-requests: write 13 | issues: write 14 | uses: Cysharp/Actions/.github/workflows/stale-issue.yaml@main 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | *_i.c 20 | *_p.c 21 | *.ilk 22 | *.obj 23 | *.pch 24 | *.pdb 25 | *.pgc 26 | *.pgd 27 | *.rsp 28 | *.sbr 29 | *.tlb 30 | *.tli 31 | *.tlh 32 | *.tmp 33 | *.log 34 | *.vspscc 35 | *.vssscc 36 | .builds 37 | 38 | # Visual C++ cache files 39 | ipch/ 40 | *.aps 41 | *.ncb 42 | *.opensdf 43 | *.sdf 44 | 45 | # Visual Studio profiler 46 | *.psess 47 | *.vsp 48 | *.vspx 49 | 50 | # Guidance Automation Toolkit 51 | *.gpState 52 | 53 | # ReSharper is a .NET coding add-in 54 | _ReSharper* 55 | 56 | # NCrunch 57 | *.ncrunch* 58 | .*crunch*.local.xml 59 | 60 | # Installshield output folder 61 | [Ee]xpress 62 | 63 | # DocProject is a documentation generator add-in 64 | DocProject/buildhelp/ 65 | DocProject/Help/*.HxT 66 | DocProject/Help/*.HxC 67 | DocProject/Help/*.hhc 68 | DocProject/Help/*.hhk 69 | DocProject/Help/*.hhp 70 | DocProject/Help/Html2 71 | DocProject/Help/html 72 | 73 | # Click-Once directory 74 | publish 75 | 76 | # Publish Web Output 77 | *.Publish.xml 78 | 79 | # NuGet Packages Directory 80 | # packages # upm pacakge will use Packages 81 | 82 | # Windows Azure Build Output 83 | csx 84 | *.build.csdef 85 | 86 | # Windows Store app package directory 87 | AppPackages/ 88 | 89 | # Others 90 | [Bb]in 91 | [Oo]bj 92 | sql 93 | TestResults 94 | [Tt]est[Rr]esult* 95 | *.Cache 96 | ClientBin 97 | [Ss]tyle[Cc]op.* 98 | ~$* 99 | *.dbmdl 100 | Generated_Code #added for RIA/Silverlight projects 101 | 102 | # Backup & report files from converting an old project file to a newer 103 | # Visual Studio version. Backup files are not needed, because we have git ;-) 104 | _UpgradeReport_Files/ 105 | Backup*/ 106 | UpgradeLog*.XML 107 | .vs/config/applicationhost.config 108 | .vs/restore.dg 109 | 110 | nuget/tools/* 111 | nuget/*.nupkg 112 | nuget/*.unitypackage 113 | .vs/ 114 | 115 | # Jetbrains Rider 116 | .idea/ 117 | 118 | __packages/ 119 | 120 | sandbox/SandboxConsoleApp/MemoryPackLogs/ 121 | /sandbox/SandboxWebApp/node_modules 122 | 123 | # Unity 124 | 125 | src/*.Unity/Library/* 126 | src/*.Unity/Temp/* 127 | src/*.Unity/Logs/* 128 | 129 | src/*.Unity/*.csproj 130 | src/*.Unity/*.sln 131 | src/*.Unity/*.*.unitypackage 132 | 133 | src/StructureOfArraysGenerator.Unity/UserSettings/Layouts/default-2021.dwlt 134 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | latest 4 | enable 5 | true 6 | $(NoWarn);CS1591 7 | true 8 | $(MSBuildThisFileDirectory)opensource.snk 9 | 10 | 11 | $(Version) 12 | Cysharp 13 | Cysharp 14 | © Cysharp, Inc. 15 | https://github.com/Cysharp/StructureOfArraysGenerator 16 | $(PackageProjectUrl) 17 | git 18 | MIT 19 | Icon.png 20 | $(MSBuildThisFileDirectory)opensource.snk 21 | 22 | -------------------------------------------------------------------------------- /Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/StructureOfArraysGenerator/236d5a0dade774b4571740f2fdcac6be28591aec/Icon.png -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Cysharp, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # StructureOfArraysGenerator 2 | [![GitHub Actions](https://github.com/Cysharp/StructureOfArraysGenerator/workflows/Build-Debug/badge.svg)](https://github.com/Cysharp/StructureOfArraysGenerator/actions) [![Releases](https://img.shields.io/github/release/Cysharp/StructureOfArraysGenerator.svg)](https://github.com/Cysharp/StructureOfArraysGenerator/releases) 3 | 4 | Structure of arrays source generator to make CPU Cache and SIMD friendly data structure for high-performance code in .NET and Unity. 5 | 6 | ![image](https://user-images.githubusercontent.com/46207/214814782-fd341e09-731a-4e2f-ba53-ef789a19160e.png) 7 | 8 | As described in Wikipedia [AoS and SoA](https://en.wikipedia.org/wiki/AoS_and_SoA), standard C# array is **array of structures(AoS)**, however the **structure of arrays(SoA)** is suitable for utilizing the CPU cache, which is faster than the main memory, and for ultra-fast parallel processing by SIMD. StructureOfArraysGenerator is inspired by [Zig language](https://ziglang.org/)'s `MultiArrayList`. See the great session [A Practical Guide to Applying Data-Oriented Design](https://vimeo.com/649009599) that talked by Andrew Kelley who is the Zig language author. 9 | 10 | Here is the simple Max .Y of Vector3(float X, float Y, float Z) array calculate result. 11 | 12 | ![image](https://user-images.githubusercontent.com/46207/215027253-6f94739f-b827-46ba-a395-690d1df89d46.png) 13 | 14 | MultiArray is x2 faster and SIMD version(SoA is easy to write SIMD) is x10 faster. 15 | 16 | StructureOfArraysGenerator actually generates not arrays, just a struct with a single `byte[]` field and `int` offsets of each fields to provide `Span` view, it minimizes memory and heap usage in C#. Source Generator generates `Span` property corresponding to each struct members so SoA structure can be realized with the same ease of use as a regular `T[]`. 17 | 18 | If you want to do aggregate operations to `Span`, you can use [Cysharp/SimdLinq](https://github.com/Cysharp/SimdLinq/) that easy to calculate faster SIMD way. 19 | 20 | Installation 21 | --- 22 | This library is distributed via NuGet. 23 | 24 | > PM> Install-Package [StructureOfArraysGenerator](https://www.nuget.org/packages/StructureOfArraysGenerator) 25 | 26 | And also a code editor requires Roslyn 4.3.1 support, for example Visual Studio 2022 version 17.3, .NET SDK 6.0.401. For details, see the [Roslyn Version Support](https://learn.microsoft.com/en-us/visualstudio/extensibility/roslyn-version-support) document. For Unity, the requirements and installation process are completely different. See the [Unity](#unity) section for details. 27 | 28 | Package provides only analyzer and generated code does not dependent any other libraries. 29 | 30 | Quick Start 31 | --- 32 | Make the `readonly partial struct` type with `[MultiArray]` attribute. 33 | 34 | ```csharp 35 | using StructureOfArraysGenerator; 36 | 37 | [MultiArray(typeof(Vector3))] 38 | public readonly partial struct Vector3MultiArray 39 | { 40 | } 41 | ``` 42 | 43 | C# Source Generator recognize `MultiArray` attribute and will generate code like below. 44 | 45 | ```csharp 46 | partial struct Vector3MultiArray 47 | { 48 | // constructor 49 | public Vector3MultiArray(int length) 50 | 51 | // Span properties for Vector3 each fields 52 | public Span X => ...; 53 | public Span Y => ...; 54 | public Span Z => ...; 55 | 56 | // indexer 57 | public Vector3 this[int index] { get{} set{} } 58 | 59 | // foreach 60 | public Enumerator GetEnumerator() 61 | } 62 | ``` 63 | 64 | You can use this array-like type like this. 65 | 66 | ```csharp 67 | var array = new Vector3MultiArray(4); 68 | 69 | array.X[0] = 10; 70 | array[1] = new Vector3(1.1f, 2.2f, 3.3f); 71 | 72 | // multiply Y 73 | foreach (ref var item in v.Y) 74 | { 75 | item *= 2; 76 | } 77 | 78 | // iterate Vector3 79 | foreach (var item in array) 80 | { 81 | Console.WriteLine($"{item.X}, {item.Y}, {item.Z}"); 82 | } 83 | ``` 84 | 85 | StructureOfArraysGenerator has two attributes [MultiArray](#multiarray) and [MultiArrayList](#multiarraylist), `MultiArray` is like a `T[]`, `MultiArrayList` is like a `List`. 86 | 87 | MultiArray 88 | --- 89 | StructureOfArraysGenerator emits this internal attribute to referenced assembly. 90 | 91 | ```csharp 92 | [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] 93 | internal sealed class MultiArrayAttribute : Attribute 94 | { 95 | public MultiArrayAttribute(Type type, bool includeProperty = false) 96 | public MultiArrayAttribute(Type type, params string[] members) 97 | } 98 | ``` 99 | 100 | Default target members are public or internal field, if you want to include property, use `[MultiArray(typeof(), includeProperty: true]`. `params string[] members` overload can choose which member to create array member. 101 | 102 | All target members are must be unmanaged type(struct which contains no reference types). 103 | 104 | `MultiArray` generates these methods. 105 | 106 | ```csharp 107 | // static methods 108 | static int GetByteSize(int length) 109 | static Vector3MultiArray Create(int length, ArraySegment arrayOffset) 110 | 111 | // constructor 112 | ctor(int length) 113 | ctor(int length, ArraySegment arrayOffset) 114 | 115 | // properties(length and target members Span MemberName) 116 | int Length => ...; 117 | Span ... => ...; 118 | 119 | // indexer 120 | T this[int index] { get{} set{} } 121 | 122 | // methods 123 | ReadOnlySpan GetRawSpan() 124 | bool SequenceEqual(TMultiArray other) 125 | IEnumerable AsEnumerable() 126 | 127 | // foreach 128 | Enumerator GetEnumerator() 129 | ``` 130 | 131 | `MultiArray` only allows `readonly` struct so recommend to use `in` to method for avoid copy. 132 | 133 | ```csharp 134 | void DoSomething(in Vector3MultiArray array) 135 | { 136 | } 137 | ``` 138 | 139 | `MultiArray` is single `byte[]` backed structure, if you use `ctor(int length, ArraySegment arrayOffset)` `with ArrayPool`, enable to avoid `byte[]` allocation. 140 | 141 | ```csharp 142 | // calculate bytesize of MultiArray 143 | var byteSize = Vector3MultiArray.GetByteSize(length: 10); 144 | 145 | var rentArray = ArrayPool.Shared.Rent(byteSize); 146 | try 147 | { 148 | // must need to zero clear before use in MultiArray 149 | Array.Clear(rentArray, 0, byteSize); 150 | 151 | // create ArrayPool byte[] backed MultiArray 152 | var array = new Vector3MultiArray(10, rentArray); 153 | 154 | // do something... 155 | } 156 | finally 157 | { 158 | // return after used. 159 | ArrayPool.Shared.Return(rentArray); 160 | } 161 | ``` 162 | 163 | `MultiArray` can use `foreach` directly that can be iterated with zero-allocation via a special struct. However does not implements `IEnumerable` so can't use LINQ and can't pass to other , if you want to do so use `AsEnumerable()`. 164 | 165 | `MultiArray` target struct supports immutable(readonly) struct. 166 | 167 | ```csharp 168 | public readonly struct Point2D 169 | { 170 | public readonly int X; 171 | public readonly int Y; 172 | 173 | public Point2D(int x, int y) 174 | { 175 | X = x; 176 | Y = y; 177 | } 178 | } 179 | 180 | [MultiArray(typeof(Point2D))] 181 | public readonly partial struct Point2DMultiArray { } 182 | ``` 183 | 184 | Target struct's constructor is choosed most matched by **name**(case insensitive). 185 | 186 | `MultiArray` is single `byte[]` backed data structure, `GetRawSpan()` can get inner data directly. `SequenceEqual` compares inner bytes so can check equality very fast. 187 | 188 | In addition, [Cysharp/MemoryPack](https://github.com/Cysharp/MemoryPack) enables fast serialization. Since MemoryPack is not supported by default, use the following helper class. 189 | 190 | ```csharp 191 | internal sealed class MultiArrayFormatter : MemoryPackFormatter 192 | where T : struct, IMultiArray 193 | { 194 | public override void Serialize(ref MemoryPackWriter writer, scoped ref T value) 195 | { 196 | writer.WriteUnmanaged(value.Length); 197 | writer.WriteUnmanagedSpan(value.GetRawSpan()); 198 | } 199 | 200 | public override void Deserialize(ref MemoryPackReader reader, scoped ref T value) 201 | { 202 | var length = reader.ReadUnmanaged(); 203 | var array = reader.ReadUnmanagedArray(); 204 | value = T.Create(length, array!); 205 | } 206 | } 207 | ``` 208 | 209 | And register formatter in startup to each generated `MultiArray`. 210 | 211 | ```csharp 212 | MemoryPackFormatterProvider.Register(new MultiArrayFormatter()); 213 | ``` 214 | 215 | MultiArrayList 216 | --- 217 | `MultiArrayList` is expandable `MultiArray` like `List`. Annotate the `MultiArrayListAttribute` at the same place with the `MultiArrayAttribute`. 218 | 219 | ```csharp 220 | [MultiArray(typeof(Vector3), MultiArrayList)] 221 | public readonly partial struct Vector3MultiArray 222 | { 223 | } 224 | ``` 225 | 226 | It generates `***MultiArrayList` class besides `MultiArray`. You can use `Add` method and does not need set capacity before use. 227 | 228 | ```csharp 229 | var list = new Vector3MultiArrayList(); 230 | list.Add(new Vector3()); 231 | 232 | var zeroX = list.X[0]; 233 | ``` 234 | 235 | In default, generated class name is `***MultiArrayList`. You can configure name via `(string typeName)` constructor parameter. 236 | 237 | ```csharp 238 | [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] 239 | internal sealed class MultiArrayListAttribute : Attribute 240 | { 241 | public MultiArrayListAttribute() 242 | public MultiArrayListAttribute(string typeName) 243 | } 244 | ``` 245 | 246 | `MultiArrayList` has generate these methods. 247 | 248 | ```csharp 249 | // constructor 250 | ctor() 251 | ctor(int capacity) 252 | 253 | // properties(length and target members Span MemberName) 254 | int Length => ...; 255 | Span ... => ...; 256 | 257 | // indexer 258 | T this[int index] { get{} set{} } 259 | 260 | // methods 261 | void Add(T item) 262 | void CopyTo(TMultiArray array) 263 | TMultiArray ToArray() 264 | IEnumerable AsEnumerable() 265 | 266 | // foreach 267 | Enumerator GetEnumerator() 268 | ``` 269 | 270 | You can convert to `MultiArray` by `ToArray()`. 271 | 272 | Unity 273 | --- 274 | Install via UPM git URL package or asset package (StructureOfArraysGenerator.*.*.*.unitypackage) available in [StructureOfArraysGenerator/releases](https://github.com/Cysharp/StructureOfArraysGenerator/releases) page. 275 | 276 | * https://github.com/Cysharp/StructureOfArraysGenerator.git?path=src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator 277 | 278 | If you want to set a target version, StructureOfArraysGenerator uses the `*.*.*` release tag, so you can specify a version like #1.0.0. For example `https://github.com/Cysharp/StructureOfArraysGenerator.git?path=src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator#1.0.0`. 279 | 280 | Minimum supported Unity version is `2021.3`. The dependency managed DLL `System.Runtime.CompilerServices.Unsafe/6.0.0` is included with unitypackage. For git references, you will need to add them in another way as they are not included to avoid unnecessary dependencies; either extract the dll from unitypackage or download it from the [NuGet page](https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/6.0.0). 281 | 282 | As with the .NET version, the code is generated by a code generator (`StructureOfArraysGenerator.Generator.Roslyn3.dll`). For more information on Unity and Source Generator, please refer to the [Unity documentation](https://docs.unity3d.com/Manual/roslyn-analyzers.html). 283 | 284 | License 285 | --- 286 | This library is licensed under the MIT License. 287 | -------------------------------------------------------------------------------- /StructureOfArraysGenerator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33103.184 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureOfArraysGenerator", "src\StructureOfArraysGenerator\StructureOfArraysGenerator.csproj", "{4795B3E9-A7C0-4AF7-8332-A61991F4BDCC}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{432B0AEF-C8D3-47FF-BDC0-B072C6FD49F3}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{A8277CC7-EEDE-4557-9B65-4E57A7060BF7}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sandbox", "sandbox", "{A013FDCB-2506-4383-B2F1-7942BA630078}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "sandbox\ConsoleApp1\ConsoleApp1.csproj", "{26153D75-8867-49CB-8ADB-04395ABE3FFB}" 15 | EndProject 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureOfArraysGenerator.Tests", "tests\StructureOfArraysGenerator.Tests\StructureOfArraysGenerator.Tests.csproj", "{F7847024-1CA2-4F30-A2F1-C3E5D3938F29}" 17 | EndProject 18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureOfArraysGenerator.Roslyn3", "src\StructureOfArraysGenerator.Roslyn3\StructureOfArraysGenerator.Roslyn3.csproj", "{7CAB3AD7-D110-4752-A6CF-55A90CCF6A76}" 19 | EndProject 20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAppRoslyn3", "sandbox\ConsoleAppRoslyn3\ConsoleAppRoslyn3.csproj", "{17C74E22-DB8D-4393-B309-BA869B3E825E}" 21 | EndProject 22 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructureOfArraysGenerator.Tests.Roslyn3", "tests\StructureOfArraysGenerator.Tests.Roslyn3\StructureOfArraysGenerator.Tests.Roslyn3.csproj", "{2B64CD80-E4D9-4815-9994-9C72F9A4A2DE}" 23 | EndProject 24 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "sandbox\Benchmark\Benchmark.csproj", "{EB93D4B8-6078-4887-B3D5-CF75FE859413}" 25 | EndProject 26 | Global 27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 28 | Debug|Any CPU = Debug|Any CPU 29 | Release|Any CPU = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {4795B3E9-A7C0-4AF7-8332-A61991F4BDCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {4795B3E9-A7C0-4AF7-8332-A61991F4BDCC}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {4795B3E9-A7C0-4AF7-8332-A61991F4BDCC}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {4795B3E9-A7C0-4AF7-8332-A61991F4BDCC}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {26153D75-8867-49CB-8ADB-04395ABE3FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {26153D75-8867-49CB-8ADB-04395ABE3FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {26153D75-8867-49CB-8ADB-04395ABE3FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {26153D75-8867-49CB-8ADB-04395ABE3FFB}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {F7847024-1CA2-4F30-A2F1-C3E5D3938F29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {F7847024-1CA2-4F30-A2F1-C3E5D3938F29}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {F7847024-1CA2-4F30-A2F1-C3E5D3938F29}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {F7847024-1CA2-4F30-A2F1-C3E5D3938F29}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {7CAB3AD7-D110-4752-A6CF-55A90CCF6A76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {7CAB3AD7-D110-4752-A6CF-55A90CCF6A76}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {7CAB3AD7-D110-4752-A6CF-55A90CCF6A76}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {7CAB3AD7-D110-4752-A6CF-55A90CCF6A76}.Release|Any CPU.Build.0 = Release|Any CPU 48 | {17C74E22-DB8D-4393-B309-BA869B3E825E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {17C74E22-DB8D-4393-B309-BA869B3E825E}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {17C74E22-DB8D-4393-B309-BA869B3E825E}.Release|Any CPU.ActiveCfg = Release|Any CPU 51 | {17C74E22-DB8D-4393-B309-BA869B3E825E}.Release|Any CPU.Build.0 = Release|Any CPU 52 | {2B64CD80-E4D9-4815-9994-9C72F9A4A2DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 53 | {2B64CD80-E4D9-4815-9994-9C72F9A4A2DE}.Debug|Any CPU.Build.0 = Debug|Any CPU 54 | {2B64CD80-E4D9-4815-9994-9C72F9A4A2DE}.Release|Any CPU.ActiveCfg = Release|Any CPU 55 | {2B64CD80-E4D9-4815-9994-9C72F9A4A2DE}.Release|Any CPU.Build.0 = Release|Any CPU 56 | {EB93D4B8-6078-4887-B3D5-CF75FE859413}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 57 | {EB93D4B8-6078-4887-B3D5-CF75FE859413}.Debug|Any CPU.Build.0 = Debug|Any CPU 58 | {EB93D4B8-6078-4887-B3D5-CF75FE859413}.Release|Any CPU.ActiveCfg = Release|Any CPU 59 | {EB93D4B8-6078-4887-B3D5-CF75FE859413}.Release|Any CPU.Build.0 = Release|Any CPU 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | GlobalSection(NestedProjects) = preSolution 65 | {4795B3E9-A7C0-4AF7-8332-A61991F4BDCC} = {432B0AEF-C8D3-47FF-BDC0-B072C6FD49F3} 66 | {26153D75-8867-49CB-8ADB-04395ABE3FFB} = {A013FDCB-2506-4383-B2F1-7942BA630078} 67 | {F7847024-1CA2-4F30-A2F1-C3E5D3938F29} = {A8277CC7-EEDE-4557-9B65-4E57A7060BF7} 68 | {7CAB3AD7-D110-4752-A6CF-55A90CCF6A76} = {432B0AEF-C8D3-47FF-BDC0-B072C6FD49F3} 69 | {17C74E22-DB8D-4393-B309-BA869B3E825E} = {A013FDCB-2506-4383-B2F1-7942BA630078} 70 | {2B64CD80-E4D9-4815-9994-9C72F9A4A2DE} = {A8277CC7-EEDE-4557-9B65-4E57A7060BF7} 71 | {EB93D4B8-6078-4887-B3D5-CF75FE859413} = {A013FDCB-2506-4383-B2F1-7942BA630078} 72 | EndGlobalSection 73 | GlobalSection(ExtensibilityGlobals) = postSolution 74 | SolutionGuid = {0B973688-CB3E-4DC9-87B2-9C7C62C8C45A} 75 | EndGlobalSection 76 | EndGlobal 77 | -------------------------------------------------------------------------------- /docs/graph.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/StructureOfArraysGenerator/236d5a0dade774b4571740f2fdcac6be28591aec/docs/graph.xlsx -------------------------------------------------------------------------------- /docs/images.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/StructureOfArraysGenerator/236d5a0dade774b4571740f2fdcac6be28591aec/docs/images.pptx -------------------------------------------------------------------------------- /opensource.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/StructureOfArraysGenerator/236d5a0dade774b4571740f2fdcac6be28591aec/opensource.snk -------------------------------------------------------------------------------- /sandbox/Benchmark/Benchmark.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | enable 7 | True 8 | enable 9 | true 10 | false 11 | 12 | 13 | $(WarningsAsErrors);NU1605; 14 | $(NoWarn);CS1591;CS8604;CS8032;CS8002;CS8600 15 | 16 | 17 | 18 | $(WarningsAsErrors);NU1605; 19 | $(NoWarn);CS1591;CS8604;CS8032;CS8002;CS8600 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Analyzer 30 | false 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /sandbox/Benchmark/Program.cs: -------------------------------------------------------------------------------- 1 | using StructureOfArraysGenerator; 2 | using BenchmarkDotNet.Configs; 3 | using BenchmarkDotNet.Diagnosers; 4 | using BenchmarkDotNet.Exporters; 5 | using BenchmarkDotNet.Jobs; 6 | using BenchmarkDotNet.Running; 7 | using System.Numerics; 8 | using System.Runtime.CompilerServices; 9 | using System.Runtime.InteropServices; 10 | using System.Runtime.Intrinsics; 11 | 12 | var config = ManualConfig.CreateMinimumViable() 13 | .AddDiagnoser(MemoryDiagnoser.Default) 14 | .AddExporter(MarkdownExporter.Default) 15 | .AddJob(Job.Default.WithWarmupCount(1).WithIterationCount(1)); 16 | 17 | #if !DEBUG 18 | 19 | BenchmarkRunner.Run(config, args); 20 | 21 | #else 22 | 23 | var v = new Benchmark().MultiArraySimdMax(); 24 | Console.WriteLine(v); 25 | 26 | #endif 27 | 28 | 29 | 30 | [MultiArray(typeof(Vector3))] 31 | public readonly partial struct Vector3MultiArray 32 | { 33 | } 34 | 35 | 36 | 37 | 38 | public class Benchmark 39 | { 40 | const int Count = 10000; 41 | 42 | Vector3[] vector3Array; 43 | Vector3MultiArray vector3MultiArray; 44 | 45 | public Benchmark() 46 | { 47 | var rand = new Random(124); 48 | 49 | var array = new Vector3[Count]; 50 | for (int i = 0; i < Count; i++) 51 | { 52 | array[i] = new Vector3(rand.NextSingle(), rand.NextSingle(), rand.NextSingle()); 53 | } 54 | 55 | var multiArray = new Vector3MultiArray(Count); 56 | for (int i = 0; i < multiArray.Length; i++) 57 | { 58 | multiArray[i] = array[i]; 59 | } 60 | 61 | this.vector3Array = array; 62 | this.vector3MultiArray = multiArray; 63 | 64 | var reference = vector3MultiArray.Y.ToArray().Max(); 65 | var v1 = ArrayMax(); 66 | var v2 = MultiArrayMax(); 67 | var v3 = MultiArraySimdMax(); 68 | if (v1 != reference || v1 != v2 || v1 != v3) 69 | { 70 | throw new Exception("different result"); 71 | } 72 | } 73 | 74 | [Benchmark] 75 | public float ArrayMax() 76 | { 77 | var array = vector3Array; 78 | var max = float.MinValue; 79 | for (int i = 0; i < array.Length; i++) 80 | { 81 | if (array[i].Y > max) 82 | { 83 | max = array[i].Y; 84 | } 85 | } 86 | return max; 87 | } 88 | 89 | [Benchmark] 90 | public float MultiArrayMax() 91 | { 92 | var array = vector3MultiArray.Y; 93 | var max = float.MinValue; 94 | for (int i = 0; i < array.Length; i++) 95 | { 96 | if (array[i] > max) 97 | { 98 | max = array[i]; 99 | } 100 | } 101 | return max; 102 | } 103 | 104 | [Benchmark] 105 | public float MultiArraySimdMax() 106 | { 107 | var array = vector3MultiArray.Y; 108 | ref var p = ref MemoryMarshal.GetReference(array); 109 | ref var to = ref Unsafe.Add(ref p, array.Length - Vector256.Count); 110 | 111 | var max = Vector256.LoadUnsafe(ref p); 112 | p = ref Unsafe.Add(ref p, Vector256.Count); 113 | 114 | while (Unsafe.IsAddressLessThan(ref p, ref to)) 115 | { 116 | var v = Vector256.LoadUnsafe(ref p); 117 | max = Vector256.Max(max, v); 118 | 119 | p = ref Unsafe.Add(ref p, Vector256.Count); 120 | } 121 | 122 | var result = float.MinValue; 123 | for (int i = 0; i < Vector256.Count; i++) 124 | { 125 | var v = max[i]; 126 | if (v > result) 127 | { 128 | result = v; 129 | } 130 | } 131 | 132 | ref var last = ref Unsafe.Add(ref MemoryMarshal.GetReference(array), array.Length); 133 | while (Unsafe.IsAddressLessThan(ref p, ref last)) 134 | { 135 | if (p > result) 136 | { 137 | result = p; 138 | } 139 | p = ref Unsafe.Add(ref p, 1); 140 | } 141 | 142 | return result; 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /sandbox/ConsoleApp1/ConsoleApp1.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net7.0 6 | enable 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Analyzer 18 | false 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sandbox/ConsoleApp1/Program.cs: -------------------------------------------------------------------------------- 1 | // See https://aka.ms/neVoyagew-console-template for more information 2 | using System.Buffers; 3 | using System.Collections; 4 | using System.Diagnostics; 5 | using System.Diagnostics.CodeAnalysis; 6 | using System.Numerics; 7 | using System.Runtime.CompilerServices; 8 | using System.Runtime.InteropServices; 9 | using System.Runtime.Intrinsics; 10 | using System.Runtime.Intrinsics.X86; 11 | using System.Runtime.Serialization.DataContracts; 12 | using System.Security.Cryptography.X509Certificates; 13 | using MemoryPack; 14 | using StructureOfArraysGenerator; 15 | 16 | 17 | 18 | //Avx2.LoadVector256( 19 | 20 | 21 | 22 | 23 | 24 | //MemoryPackFormatterProvider.Register(new MultiArrayFormatter()); 25 | 26 | // Vector3(float X, float Y, float Z) 27 | 28 | 29 | // calculate bytesize of MultiArray 30 | var byteSize = Vector3MultiArray.GetByteSize(length: 10); 31 | 32 | var rentArray = ArrayPool.Shared.Rent(byteSize); 33 | try 34 | { 35 | // must need to zero clear before use in MultiArray 36 | Array.Clear(rentArray, 0, byteSize); 37 | 38 | // create ArrayPool byte[] backed MultiArray 39 | var array = new Vector3MultiArray(10, rentArray); 40 | 41 | // do something... 42 | } 43 | finally 44 | { 45 | // return after used. 46 | ArrayPool.Shared.Return(rentArray); 47 | } 48 | 49 | 50 | 51 | 52 | 53 | //array.X[0] = 10; 54 | //array[1] = new Vector3(1.1f, 2.2f, 3.3f); 55 | 56 | //foreach (var item in array) 57 | //{ 58 | // Console.WriteLine($"{item.X}, {item.Y}, {item.Z}"); 59 | //} 60 | 61 | 62 | //var list = new Point3DMultiArrayList(); 63 | 64 | //list.Add(new Point3D { X = 10, Y = 20, Z = 30 }); 65 | //list.Add(new Point3D { X = 11, Y = 21, Z = 31 }); 66 | //list.Add(new Point3D { X = 12, Y = 22, Z = 32 }); 67 | //list.Add(new Point3D { X = 13, Y = 23, Z = 33 }); 68 | //list.Add(new Point3D { X = 15, Y = 25, Z = 35 }); 69 | 70 | 71 | 72 | new Point3DMultiArray(8); 73 | 74 | 75 | 76 | 77 | //Console.WriteLine(list.Length); 78 | 79 | public readonly struct Point2D 80 | { 81 | public readonly int X; 82 | public readonly int Y; 83 | 84 | public Point2D(int x, int y) 85 | { 86 | X = x; 87 | Y = y; 88 | } 89 | } 90 | 91 | [MultiArray(typeof(Point2D))] 92 | public readonly partial struct Point2DMultiArray { } 93 | 94 | 95 | public struct Point3D 96 | { 97 | public float X; 98 | public float Y; 99 | public float Z; 100 | 101 | public Point3D(float x, float y) 102 | { 103 | this.X = x; 104 | this.Y = y; 105 | } 106 | } 107 | 108 | [MultiArray(typeof(Point3D)), MultiArrayList] 109 | public readonly partial struct Point3DMultiArray 110 | { 111 | 112 | } 113 | 114 | 115 | 116 | 117 | [MultiArray(typeof(Vector3), includeProperty: true)] 118 | public readonly partial struct Vector3MultiArray 119 | { 120 | } 121 | 122 | 123 | 124 | 125 | 126 | [MultiArray(typeof(System.Numerics.Vector4))] 127 | public readonly partial struct Vector4MultiArray 128 | { 129 | 130 | } 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /sandbox/ConsoleAppRoslyn3/ConsoleAppRoslyn3.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net7.0 6 | enable 7 | enable 8 | false 9 | 10 | 11 | 12 | 13 | Analyzer 14 | false 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /sandbox/ConsoleAppRoslyn3/Program.cs: -------------------------------------------------------------------------------- 1 | using StructureOfArraysGenerator; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // See https://aka.ms/new-console-template for more information 6 | Console.WriteLine("Hello, World!"); 7 | 8 | 9 | 10 | public struct Point3D 11 | { 12 | public float X; 13 | public float Y; 14 | public float Z; 15 | 16 | public Point3D(float x, float y) 17 | { 18 | this.X = x; 19 | this.Y = y; 20 | } 21 | } 22 | 23 | [MultiArray(typeof(Point3D)), MultiArrayList] 24 | public readonly partial struct Point3DMultiArray 25 | { 26 | 27 | } 28 | 29 | 30 | 31 | 32 | public class MyClass 33 | { 34 | 35 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 36 | static ref T GetArrayDataReference(T[] array) 37 | { 38 | #if NET5_0_OR_GREATER 39 | return ref MemoryMarshal.GetArrayDataReference(array); 40 | #else 41 | return ref MemoryMarshal.GetReference(array.AsSpan()); 42 | #endif 43 | } 44 | } -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Roslyn3/Generator.Roslyn3.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | using Microsoft.CodeAnalysis.CSharp.Syntax; 3 | 4 | namespace StructureOfArraysGenerator; 5 | 6 | public partial class Generator : ISourceGenerator 7 | { 8 | const string MultiArrayAttribtue = "StructureOfArraysGenerator.MultiArrayAttribute"; 9 | const string MultiArrayListAttribtue = "StructureOfArraysGenerator.MultiArrayListAttribute"; 10 | 11 | public void Initialize(GeneratorInitializationContext context) 12 | { 13 | context.RegisterForPostInitialization(x => EmitAttributes(new IncrementalGeneratorPostInitializationContext(x))); 14 | 15 | context.RegisterForSyntaxNotifications(() => new CompositeReceiver( 16 | new ForAttributeWithMetadataName(MultiArrayAttribtue, (node, token) => node is StructDeclarationSyntax), 17 | new ForAttributeWithMetadataName(MultiArrayListAttribtue, (node, token) => node is StructDeclarationSyntax) 18 | )); 19 | } 20 | 21 | public void Execute(GeneratorExecutionContext context) 22 | { 23 | if (context.SyntaxContextReceiver is not CompositeReceiver compositeReceiver) 24 | { 25 | return; 26 | } 27 | 28 | var productionContext = new SourceProductionContext(context); 29 | 30 | foreach (var receiver in compositeReceiver.GetReceivers()) 31 | { 32 | if (receiver.FullyQualifiedMetadataName == MultiArrayAttribtue) 33 | { 34 | foreach (var item in receiver.Values) 35 | { 36 | EmitMultiArray(productionContext, item); 37 | } 38 | } 39 | else if (receiver.FullyQualifiedMetadataName == MultiArrayListAttribtue) 40 | { 41 | foreach (var item in receiver.Values) 42 | { 43 | EmitMultiArrayList(productionContext, item); 44 | } 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Roslyn3/IncrementalGeneratorShims.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | using Microsoft.CodeAnalysis.CSharp.Syntax; 3 | using System.Collections.Immutable; 4 | 5 | namespace StructureOfArraysGenerator; 6 | 7 | public interface IIncrementalGenerator 8 | { 9 | } 10 | 11 | public struct IncrementalGeneratorPostInitializationContext 12 | { 13 | GeneratorPostInitializationContext context; 14 | 15 | public IncrementalGeneratorPostInitializationContext(GeneratorPostInitializationContext context) 16 | { 17 | this.context = context; 18 | } 19 | 20 | public void AddSource(string hintName, string source) 21 | { 22 | context.AddSource(hintName, source); 23 | } 24 | } 25 | 26 | public struct SourceProductionContext 27 | { 28 | GeneratorExecutionContext context; 29 | 30 | public SourceProductionContext(GeneratorExecutionContext context) 31 | { 32 | this.context = context; 33 | } 34 | 35 | public CancellationToken CancellationToken => context.CancellationToken; 36 | 37 | public void ReportDiagnostic(Diagnostic diagnostic) 38 | { 39 | context.ReportDiagnostic(diagnostic); 40 | } 41 | 42 | public void AddSource(string hintName, string source) 43 | { 44 | context.AddSource(hintName, source); 45 | } 46 | } 47 | 48 | public struct GeneratorAttributeSyntaxContext 49 | { 50 | public SyntaxNode TargetNode { get; } 51 | public ISymbol TargetSymbol { get; } 52 | public SemanticModel SemanticModel { get; } 53 | public ImmutableArray Attributes { get; } 54 | 55 | public GeneratorAttributeSyntaxContext( 56 | SyntaxNode targetNode, 57 | ISymbol targetSymbol, 58 | SemanticModel semanticModel, 59 | ImmutableArray attributes) 60 | { 61 | TargetNode = targetNode; 62 | TargetSymbol = targetSymbol; 63 | SemanticModel = semanticModel; 64 | Attributes = attributes; 65 | } 66 | } 67 | 68 | public class CompositeReceiver : ISyntaxContextReceiver 69 | { 70 | ISyntaxContextReceiver[] receivers; 71 | 72 | public IEnumerable GetReceivers() => receivers.OfType(); 73 | 74 | public CompositeReceiver(params ISyntaxContextReceiver[] receivers) 75 | { 76 | this.receivers = receivers; 77 | } 78 | 79 | public void OnVisitSyntaxNode(GeneratorSyntaxContext context) 80 | { 81 | foreach (var item in receivers) 82 | { 83 | item.OnVisitSyntaxNode(context); 84 | } 85 | } 86 | } 87 | 88 | public class ForAttributeWithMetadataName : ISyntaxContextReceiver 89 | { 90 | string fullyQualifiedMetadataName; 91 | Func predicate; 92 | 93 | public string FullyQualifiedMetadataName => fullyQualifiedMetadataName; 94 | 95 | public ForAttributeWithMetadataName(string fullyQualifiedMetadataName, Func predicate) 96 | { 97 | this.fullyQualifiedMetadataName = fullyQualifiedMetadataName; 98 | this.predicate = predicate; 99 | } 100 | 101 | public List Values { get; } = new(); 102 | 103 | public void OnVisitSyntaxNode(GeneratorSyntaxContext context) 104 | { 105 | if (!predicate(context.Node, CancellationToken.None)) return; 106 | 107 | var targetNode = context.Node; 108 | var semanticModel = context.SemanticModel; 109 | 110 | var targetSymbol = semanticModel.GetDeclaredSymbol(targetNode); 111 | if (targetSymbol is null) return; 112 | 113 | var attributes = targetSymbol.GetAttributes(); 114 | foreach (var attribute in attributes) 115 | { 116 | if (attribute.AttributeClass == null) continue; 117 | 118 | var attrFullName = attribute.AttributeClass.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat).Replace("global::", ""); 119 | 120 | if (attrFullName == fullyQualifiedMetadataName) 121 | { 122 | Values.Add(new GeneratorAttributeSyntaxContext(targetNode, targetSymbol, semanticModel, ImmutableArray.Create(attribute))); 123 | } 124 | } 125 | } 126 | } -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Roslyn3/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Profile 1": { 4 | "commandName": "DebugRoslynComponent", 5 | "targetProject": "..\\..\\sandbox\\ConsoleAppRoslyn3\\ConsoleAppRoslyn3.csproj" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Roslyn3/StructureOfArraysGenerator.Roslyn3.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | enable 6 | ROSLYN3 7 | enable 8 | 11 9 | true 10 | cs 11 | StructureOfArraysGenerator 12 | $(TargetsForTfmSpecificContentInPackage);PackBuildOutputs 13 | false 14 | true 15 | false 16 | true 17 | codegenerator 18 | Structure of arrays code generator. 19 | false 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | all 32 | runtime; build; native; contentfiles; analyzers; buildtransitive 33 | 34 | 35 | 36 | 37 | $(MSBuildProjectDirectory)\..\StructureOfArraysGenerator.Unity\Assets\Plugins\StructureOfArraysGenerator\Runtime\ 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedGame" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc8e5f843e2b1654996d9aec71e59e0c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Editor/PackageExporter.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | 3 | using System; 4 | using System.IO; 5 | using System.Linq; 6 | using UnityEditor; 7 | using UnityEngine; 8 | 9 | public static class PackageExporter 10 | { 11 | [MenuItem("Tools/Export Unitypackage")] 12 | public static void Export() 13 | { 14 | var roots = new[] { "Plugins/StructureOfArraysGenerator" }; 15 | 16 | foreach (var root in roots) 17 | { 18 | var version = GetVersion(root); 19 | var fn = root.Split('/').Last(); 20 | 21 | var fileName = string.IsNullOrEmpty(version) ? $"{fn}.unitypackage" : $"{fn}.{version}.unitypackage"; 22 | var exportPath = "./" + fileName; 23 | 24 | var path = Path.Combine(Application.dataPath, root); 25 | var assets = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories) 26 | .Where(x => Path.GetExtension(x) is ".cs" or ".asmdef" or ".json" or ".meta" or ".dll") 27 | .Select(x => "Assets" + x.Replace(Application.dataPath, "").Replace(@"\", "/")) 28 | .ToArray(); 29 | 30 | var netStandardsAsset = Directory.EnumerateFiles(Path.Combine(Application.dataPath, "Plugins/"), "*", SearchOption.TopDirectoryOnly) 31 | .Select(x => "Assets" + x.Replace(Application.dataPath, "").Replace(@"\", "/")) 32 | .ToArray(); 33 | 34 | assets = netStandardsAsset.Concat(assets).ToArray(); 35 | 36 | AssetDatabase.ExportPackage( 37 | assets, 38 | exportPath, 39 | ExportPackageOptions.Default); 40 | 41 | UnityEngine.Debug.Log("Export complete: " + Path.GetFullPath(exportPath) + Environment.NewLine + string.Join(Environment.NewLine, assets)); 42 | } 43 | } 44 | 45 | static string GetVersion(string root) 46 | { 47 | var version = Environment.GetEnvironmentVariable("UNITY_PACKAGE_VERSION"); 48 | var versionJson = Path.Combine(Application.dataPath, root, "package.json"); 49 | 50 | if (File.Exists(versionJson)) 51 | { 52 | var v = JsonUtility.FromJson(File.ReadAllText(versionJson)); 53 | 54 | if (!string.IsNullOrEmpty(version)) 55 | { 56 | if (v.version != version) 57 | { 58 | var msg = $"package.json and env version are mismatched. UNITY_PACKAGE_VERSION:{version}, package.json:{v.version}"; 59 | 60 | if (Application.isBatchMode) 61 | { 62 | Console.WriteLine(msg); 63 | Application.Quit(1); 64 | } 65 | 66 | throw new Exception("package.json and env version are mismatched."); 67 | } 68 | } 69 | 70 | version = v.version; 71 | } 72 | 73 | return version; 74 | } 75 | 76 | public class Version 77 | { 78 | public string version; 79 | } 80 | } 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Editor/PackageExporter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f14e53a9b34d1747938b6962994711a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c5649a299d7ea841a1c2cd60d3a105e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0956ef77bdb5461498b262ffe727083e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d4aa9bfc2d59ff4cad414b236f4f9e6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator/Runtime/StructureOfArraysGenerator.Roslyn3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/StructureOfArraysGenerator/236d5a0dade774b4571740f2fdcac6be28591aec/src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator/Runtime/StructureOfArraysGenerator.Roslyn3.dll -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator/Runtime/StructureOfArraysGenerator.Roslyn3.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 944a8fe1e3f95d244a1951bb2178579e 3 | labels: 4 | - RoslynAnalyzer 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | defineConstraints: [] 11 | isPreloaded: 0 12 | isOverridable: 0 13 | isExplicitlyReferenced: 1 14 | validateReferences: 0 15 | platformData: 16 | - first: 17 | : Any 18 | second: 19 | enabled: 0 20 | settings: 21 | Exclude Editor: 1 22 | Exclude Linux64: 1 23 | Exclude OSXUniversal: 1 24 | Exclude Win: 1 25 | Exclude Win64: 1 26 | - first: 27 | Any: 28 | second: 29 | enabled: 0 30 | settings: {} 31 | - first: 32 | Editor: Editor 33 | second: 34 | enabled: 0 35 | settings: 36 | CPU: AnyCPU 37 | DefaultValueInitialized: true 38 | OS: AnyOS 39 | - first: 40 | Standalone: Linux64 41 | second: 42 | enabled: 0 43 | settings: 44 | CPU: None 45 | - first: 46 | Standalone: OSXUniversal 47 | second: 48 | enabled: 0 49 | settings: 50 | CPU: None 51 | - first: 52 | Standalone: Win 53 | second: 54 | enabled: 0 55 | settings: 56 | CPU: None 57 | - first: 58 | Standalone: Win64 59 | second: 60 | enabled: 0 61 | settings: 62 | CPU: None 63 | - first: 64 | Windows Store Apps: WindowsStoreApps 65 | second: 66 | enabled: 0 67 | settings: 68 | CPU: AnyCPU 69 | userData: 70 | assetBundleName: 71 | assetBundleVariant: 72 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.cysharp.soagenerator", 3 | "displayName": "Structure of Arrays Generator", 4 | "author": { "name": "Cysharp, Inc.", "url": "https://cysharp.co.jp/en/" }, 5 | "version": "1.1.0", 6 | "unity": "2021.3", 7 | "description": "Structure of Arrays Source Generator.", 8 | "keywords": [ "DataStructure" ], 9 | "license": "MIT", 10 | "category": "Scripting", 11 | "dependencies": {} 12 | } 13 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins/StructureOfArraysGenerator/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b68ed641a69419f48a55411dc8827b96 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/StructureOfArraysGenerator/236d5a0dade774b4571740f2fdcac6be28591aec/src/StructureOfArraysGenerator.Unity/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64ea9b25bfa7362448cfe4ff52bea102 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 0 29 | settings: 30 | CPU: AnyCPU 31 | userData: 32 | assetBundleName: 33 | assetBundleVariant: 34 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 131a6b21c8605f84396be9f6751fb6e3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Scenes/SampleScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 0 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 0} 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | maxJobWorkers: 0 122 | preserveTilesOutsideBounds: 0 123 | debug: 124 | m_Flags: 0 125 | m_NavMeshData: {fileID: 0} 126 | --- !u!1 &519420028 127 | GameObject: 128 | m_ObjectHideFlags: 0 129 | m_CorrespondingSourceObject: {fileID: 0} 130 | m_PrefabInstance: {fileID: 0} 131 | m_PrefabAsset: {fileID: 0} 132 | serializedVersion: 6 133 | m_Component: 134 | - component: {fileID: 519420032} 135 | - component: {fileID: 519420031} 136 | - component: {fileID: 519420029} 137 | - component: {fileID: 519420033} 138 | m_Layer: 0 139 | m_Name: Main Camera 140 | m_TagString: MainCamera 141 | m_Icon: {fileID: 0} 142 | m_NavMeshLayer: 0 143 | m_StaticEditorFlags: 0 144 | m_IsActive: 1 145 | --- !u!81 &519420029 146 | AudioListener: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 519420028} 152 | m_Enabled: 1 153 | --- !u!20 &519420031 154 | Camera: 155 | m_ObjectHideFlags: 0 156 | m_CorrespondingSourceObject: {fileID: 0} 157 | m_PrefabInstance: {fileID: 0} 158 | m_PrefabAsset: {fileID: 0} 159 | m_GameObject: {fileID: 519420028} 160 | m_Enabled: 1 161 | serializedVersion: 2 162 | m_ClearFlags: 2 163 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 164 | m_projectionMatrixMode: 1 165 | m_GateFitMode: 2 166 | m_FOVAxisMode: 0 167 | m_SensorSize: {x: 36, y: 24} 168 | m_LensShift: {x: 0, y: 0} 169 | m_FocalLength: 50 170 | m_NormalizedViewPortRect: 171 | serializedVersion: 2 172 | x: 0 173 | y: 0 174 | width: 1 175 | height: 1 176 | near clip plane: 0.3 177 | far clip plane: 1000 178 | field of view: 60 179 | orthographic: 1 180 | orthographic size: 5 181 | m_Depth: -1 182 | m_CullingMask: 183 | serializedVersion: 2 184 | m_Bits: 4294967295 185 | m_RenderingPath: -1 186 | m_TargetTexture: {fileID: 0} 187 | m_TargetDisplay: 0 188 | m_TargetEye: 0 189 | m_HDR: 1 190 | m_AllowMSAA: 0 191 | m_AllowDynamicResolution: 0 192 | m_ForceIntoRT: 0 193 | m_OcclusionCulling: 0 194 | m_StereoConvergence: 10 195 | m_StereoSeparation: 0.022 196 | --- !u!4 &519420032 197 | Transform: 198 | m_ObjectHideFlags: 0 199 | m_CorrespondingSourceObject: {fileID: 0} 200 | m_PrefabInstance: {fileID: 0} 201 | m_PrefabAsset: {fileID: 0} 202 | m_GameObject: {fileID: 519420028} 203 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 204 | m_LocalPosition: {x: 0, y: 0, z: -10} 205 | m_LocalScale: {x: 1, y: 1, z: 1} 206 | m_ConstrainProportionsScale: 0 207 | m_Children: [] 208 | m_Father: {fileID: 0} 209 | m_RootOrder: 0 210 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 211 | --- !u!114 &519420033 212 | MonoBehaviour: 213 | m_ObjectHideFlags: 0 214 | m_CorrespondingSourceObject: {fileID: 0} 215 | m_PrefabInstance: {fileID: 0} 216 | m_PrefabAsset: {fileID: 0} 217 | m_GameObject: {fileID: 519420028} 218 | m_Enabled: 1 219 | m_EditorHideFlags: 0 220 | m_Script: {fileID: 11500000, guid: 50f11851c0f4d2a42a41914712987bbe, type: 3} 221 | m_Name: 222 | m_EditorClassIdentifier: 223 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2cda990e2423bbf4892e6590ba056729 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Scenes/SampleScript.cs: -------------------------------------------------------------------------------- 1 | using StructureOfArraysGenerator; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | public class SampleScript : MonoBehaviour 7 | { 8 | // Start is called before the first frame update 9 | void Start() 10 | { 11 | var array = new Vector3MultiArray(10); 12 | array[0] = new Vector3 { x = 10, y = 20, z = 99 }; 13 | 14 | Debug.Log(array.x[0]); 15 | } 16 | 17 | // Update is called once per frame 18 | void Update() 19 | { 20 | 21 | } 22 | } 23 | 24 | 25 | [MultiArray(typeof(Vector3))] 26 | public readonly partial struct Vector3MultiArray 27 | { 28 | 29 | } -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Assets/Scenes/SampleScript.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50f11851c0f4d2a42a41914712987bbe 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "2.4.3", 4 | "com.unity.feature.2d": "2.0.1", 5 | "com.unity.ide.rider": "3.0.31", 6 | "com.unity.ide.visualstudio": "2.0.22", 7 | "com.unity.ide.vscode": "1.2.5", 8 | "com.unity.test-framework": "1.1.33", 9 | "com.unity.textmeshpro": "3.0.6", 10 | "com.unity.timeline": "1.6.5", 11 | "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.9", 12 | "com.unity.ugui": "1.0.0", 13 | "com.unity.visualscripting": "1.9.4", 14 | "com.unity.modules.ai": "1.0.0", 15 | "com.unity.modules.androidjni": "1.0.0", 16 | "com.unity.modules.animation": "1.0.0", 17 | "com.unity.modules.assetbundle": "1.0.0", 18 | "com.unity.modules.audio": "1.0.0", 19 | "com.unity.modules.cloth": "1.0.0", 20 | "com.unity.modules.director": "1.0.0", 21 | "com.unity.modules.imageconversion": "1.0.0", 22 | "com.unity.modules.imgui": "1.0.0", 23 | "com.unity.modules.jsonserialize": "1.0.0", 24 | "com.unity.modules.particlesystem": "1.0.0", 25 | "com.unity.modules.physics": "1.0.0", 26 | "com.unity.modules.physics2d": "1.0.0", 27 | "com.unity.modules.screencapture": "1.0.0", 28 | "com.unity.modules.terrain": "1.0.0", 29 | "com.unity.modules.terrainphysics": "1.0.0", 30 | "com.unity.modules.tilemap": "1.0.0", 31 | "com.unity.modules.ui": "1.0.0", 32 | "com.unity.modules.uielements": "1.0.0", 33 | "com.unity.modules.umbra": "1.0.0", 34 | "com.unity.modules.unityanalytics": "1.0.0", 35 | "com.unity.modules.unitywebrequest": "1.0.0", 36 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 37 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 38 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 39 | "com.unity.modules.unitywebrequestwww": "1.0.0", 40 | "com.unity.modules.vehicles": "1.0.0", 41 | "com.unity.modules.video": "1.0.0", 42 | "com.unity.modules.vr": "1.0.0", 43 | "com.unity.modules.wind": "1.0.0", 44 | "com.unity.modules.xr": "1.0.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.2d.animation": { 4 | "version": "7.1.1", 5 | "depth": 1, 6 | "source": "registry", 7 | "dependencies": { 8 | "com.unity.2d.common": "6.0.7", 9 | "com.unity.2d.sprite": "1.0.0", 10 | "com.unity.modules.animation": "1.0.0", 11 | "com.unity.modules.uielements": "1.0.0" 12 | }, 13 | "url": "https://packages.unity.com" 14 | }, 15 | "com.unity.2d.aseprite": { 16 | "version": "1.1.4", 17 | "depth": 1, 18 | "source": "registry", 19 | "dependencies": { 20 | "com.unity.2d.common": "6.0.6", 21 | "com.unity.2d.sprite": "1.0.0", 22 | "com.unity.mathematics": "1.2.6", 23 | "com.unity.modules.animation": "1.0.0" 24 | }, 25 | "url": "https://packages.unity.com" 26 | }, 27 | "com.unity.2d.common": { 28 | "version": "6.0.7", 29 | "depth": 2, 30 | "source": "registry", 31 | "dependencies": { 32 | "com.unity.2d.sprite": "1.0.0", 33 | "com.unity.mathematics": "1.1.0", 34 | "com.unity.modules.uielements": "1.0.0", 35 | "com.unity.burst": "1.5.1" 36 | }, 37 | "url": "https://packages.unity.com" 38 | }, 39 | "com.unity.2d.path": { 40 | "version": "5.0.2", 41 | "depth": 2, 42 | "source": "registry", 43 | "dependencies": {}, 44 | "url": "https://packages.unity.com" 45 | }, 46 | "com.unity.2d.pixel-perfect": { 47 | "version": "5.0.3", 48 | "depth": 1, 49 | "source": "registry", 50 | "dependencies": {}, 51 | "url": "https://packages.unity.com" 52 | }, 53 | "com.unity.2d.psdimporter": { 54 | "version": "6.0.9", 55 | "depth": 1, 56 | "source": "registry", 57 | "dependencies": { 58 | "com.unity.2d.common": "6.0.7", 59 | "com.unity.2d.sprite": "1.0.0", 60 | "com.unity.2d.animation": "7.1.0" 61 | }, 62 | "url": "https://packages.unity.com" 63 | }, 64 | "com.unity.2d.sprite": { 65 | "version": "1.0.0", 66 | "depth": 1, 67 | "source": "builtin", 68 | "dependencies": {} 69 | }, 70 | "com.unity.2d.spriteshape": { 71 | "version": "7.0.7", 72 | "depth": 1, 73 | "source": "registry", 74 | "dependencies": { 75 | "com.unity.2d.path": "5.0.2", 76 | "com.unity.2d.common": "6.0.6", 77 | "com.unity.mathematics": "1.1.0", 78 | "com.unity.modules.physics2d": "1.0.0" 79 | }, 80 | "url": "https://packages.unity.com" 81 | }, 82 | "com.unity.2d.tilemap": { 83 | "version": "1.0.0", 84 | "depth": 1, 85 | "source": "builtin", 86 | "dependencies": {} 87 | }, 88 | "com.unity.2d.tilemap.extras": { 89 | "version": "2.2.7", 90 | "depth": 1, 91 | "source": "registry", 92 | "dependencies": { 93 | "com.unity.ugui": "1.0.0", 94 | "com.unity.2d.tilemap": "1.0.0", 95 | "com.unity.modules.tilemap": "1.0.0", 96 | "com.unity.modules.jsonserialize": "1.0.0" 97 | }, 98 | "url": "https://packages.unity.com" 99 | }, 100 | "com.unity.burst": { 101 | "version": "1.8.14", 102 | "depth": 3, 103 | "source": "registry", 104 | "dependencies": { 105 | "com.unity.mathematics": "1.2.1", 106 | "com.unity.modules.jsonserialize": "1.0.0" 107 | }, 108 | "url": "https://packages.unity.com" 109 | }, 110 | "com.unity.collab-proxy": { 111 | "version": "2.4.3", 112 | "depth": 0, 113 | "source": "registry", 114 | "dependencies": {}, 115 | "url": "https://packages.unity.com" 116 | }, 117 | "com.unity.ext.nunit": { 118 | "version": "1.0.6", 119 | "depth": 1, 120 | "source": "registry", 121 | "dependencies": {}, 122 | "url": "https://packages.unity.com" 123 | }, 124 | "com.unity.feature.2d": { 125 | "version": "2.0.1", 126 | "depth": 0, 127 | "source": "builtin", 128 | "dependencies": { 129 | "com.unity.2d.animation": "7.1.1", 130 | "com.unity.2d.pixel-perfect": "5.0.3", 131 | "com.unity.2d.psdimporter": "6.0.9", 132 | "com.unity.2d.sprite": "1.0.0", 133 | "com.unity.2d.spriteshape": "7.0.7", 134 | "com.unity.2d.tilemap": "1.0.0", 135 | "com.unity.2d.tilemap.extras": "2.2.7", 136 | "com.unity.2d.aseprite": "1.1.4" 137 | } 138 | }, 139 | "com.unity.ide.rider": { 140 | "version": "3.0.31", 141 | "depth": 0, 142 | "source": "registry", 143 | "dependencies": { 144 | "com.unity.ext.nunit": "1.0.6" 145 | }, 146 | "url": "https://packages.unity.com" 147 | }, 148 | "com.unity.ide.visualstudio": { 149 | "version": "2.0.22", 150 | "depth": 0, 151 | "source": "registry", 152 | "dependencies": { 153 | "com.unity.test-framework": "1.1.9" 154 | }, 155 | "url": "https://packages.unity.com" 156 | }, 157 | "com.unity.ide.vscode": { 158 | "version": "1.2.5", 159 | "depth": 0, 160 | "source": "registry", 161 | "dependencies": {}, 162 | "url": "https://packages.unity.com" 163 | }, 164 | "com.unity.mathematics": { 165 | "version": "1.2.6", 166 | "depth": 2, 167 | "source": "registry", 168 | "dependencies": {}, 169 | "url": "https://packages.unity.com" 170 | }, 171 | "com.unity.sysroot": { 172 | "version": "2.0.10", 173 | "depth": 1, 174 | "source": "registry", 175 | "dependencies": {}, 176 | "url": "https://packages.unity.com" 177 | }, 178 | "com.unity.sysroot.linux-x86_64": { 179 | "version": "2.0.9", 180 | "depth": 1, 181 | "source": "registry", 182 | "dependencies": { 183 | "com.unity.sysroot": "2.0.10" 184 | }, 185 | "url": "https://packages.unity.com" 186 | }, 187 | "com.unity.test-framework": { 188 | "version": "1.1.33", 189 | "depth": 0, 190 | "source": "registry", 191 | "dependencies": { 192 | "com.unity.ext.nunit": "1.0.6", 193 | "com.unity.modules.imgui": "1.0.0", 194 | "com.unity.modules.jsonserialize": "1.0.0" 195 | }, 196 | "url": "https://packages.unity.com" 197 | }, 198 | "com.unity.textmeshpro": { 199 | "version": "3.0.6", 200 | "depth": 0, 201 | "source": "registry", 202 | "dependencies": { 203 | "com.unity.ugui": "1.0.0" 204 | }, 205 | "url": "https://packages.unity.com" 206 | }, 207 | "com.unity.timeline": { 208 | "version": "1.6.5", 209 | "depth": 0, 210 | "source": "registry", 211 | "dependencies": { 212 | "com.unity.modules.audio": "1.0.0", 213 | "com.unity.modules.director": "1.0.0", 214 | "com.unity.modules.animation": "1.0.0", 215 | "com.unity.modules.particlesystem": "1.0.0" 216 | }, 217 | "url": "https://packages.unity.com" 218 | }, 219 | "com.unity.toolchain.win-x86_64-linux-x86_64": { 220 | "version": "2.0.9", 221 | "depth": 0, 222 | "source": "registry", 223 | "dependencies": { 224 | "com.unity.sysroot": "2.0.10", 225 | "com.unity.sysroot.linux-x86_64": "2.0.9" 226 | }, 227 | "url": "https://packages.unity.com" 228 | }, 229 | "com.unity.ugui": { 230 | "version": "1.0.0", 231 | "depth": 0, 232 | "source": "builtin", 233 | "dependencies": { 234 | "com.unity.modules.ui": "1.0.0", 235 | "com.unity.modules.imgui": "1.0.0" 236 | } 237 | }, 238 | "com.unity.visualscripting": { 239 | "version": "1.9.4", 240 | "depth": 0, 241 | "source": "registry", 242 | "dependencies": { 243 | "com.unity.ugui": "1.0.0", 244 | "com.unity.modules.jsonserialize": "1.0.0" 245 | }, 246 | "url": "https://packages.unity.com" 247 | }, 248 | "com.unity.modules.ai": { 249 | "version": "1.0.0", 250 | "depth": 0, 251 | "source": "builtin", 252 | "dependencies": {} 253 | }, 254 | "com.unity.modules.androidjni": { 255 | "version": "1.0.0", 256 | "depth": 0, 257 | "source": "builtin", 258 | "dependencies": {} 259 | }, 260 | "com.unity.modules.animation": { 261 | "version": "1.0.0", 262 | "depth": 0, 263 | "source": "builtin", 264 | "dependencies": {} 265 | }, 266 | "com.unity.modules.assetbundle": { 267 | "version": "1.0.0", 268 | "depth": 0, 269 | "source": "builtin", 270 | "dependencies": {} 271 | }, 272 | "com.unity.modules.audio": { 273 | "version": "1.0.0", 274 | "depth": 0, 275 | "source": "builtin", 276 | "dependencies": {} 277 | }, 278 | "com.unity.modules.cloth": { 279 | "version": "1.0.0", 280 | "depth": 0, 281 | "source": "builtin", 282 | "dependencies": { 283 | "com.unity.modules.physics": "1.0.0" 284 | } 285 | }, 286 | "com.unity.modules.director": { 287 | "version": "1.0.0", 288 | "depth": 0, 289 | "source": "builtin", 290 | "dependencies": { 291 | "com.unity.modules.audio": "1.0.0", 292 | "com.unity.modules.animation": "1.0.0" 293 | } 294 | }, 295 | "com.unity.modules.imageconversion": { 296 | "version": "1.0.0", 297 | "depth": 0, 298 | "source": "builtin", 299 | "dependencies": {} 300 | }, 301 | "com.unity.modules.imgui": { 302 | "version": "1.0.0", 303 | "depth": 0, 304 | "source": "builtin", 305 | "dependencies": {} 306 | }, 307 | "com.unity.modules.jsonserialize": { 308 | "version": "1.0.0", 309 | "depth": 0, 310 | "source": "builtin", 311 | "dependencies": {} 312 | }, 313 | "com.unity.modules.particlesystem": { 314 | "version": "1.0.0", 315 | "depth": 0, 316 | "source": "builtin", 317 | "dependencies": {} 318 | }, 319 | "com.unity.modules.physics": { 320 | "version": "1.0.0", 321 | "depth": 0, 322 | "source": "builtin", 323 | "dependencies": {} 324 | }, 325 | "com.unity.modules.physics2d": { 326 | "version": "1.0.0", 327 | "depth": 0, 328 | "source": "builtin", 329 | "dependencies": {} 330 | }, 331 | "com.unity.modules.screencapture": { 332 | "version": "1.0.0", 333 | "depth": 0, 334 | "source": "builtin", 335 | "dependencies": { 336 | "com.unity.modules.imageconversion": "1.0.0" 337 | } 338 | }, 339 | "com.unity.modules.subsystems": { 340 | "version": "1.0.0", 341 | "depth": 1, 342 | "source": "builtin", 343 | "dependencies": { 344 | "com.unity.modules.jsonserialize": "1.0.0" 345 | } 346 | }, 347 | "com.unity.modules.terrain": { 348 | "version": "1.0.0", 349 | "depth": 0, 350 | "source": "builtin", 351 | "dependencies": {} 352 | }, 353 | "com.unity.modules.terrainphysics": { 354 | "version": "1.0.0", 355 | "depth": 0, 356 | "source": "builtin", 357 | "dependencies": { 358 | "com.unity.modules.physics": "1.0.0", 359 | "com.unity.modules.terrain": "1.0.0" 360 | } 361 | }, 362 | "com.unity.modules.tilemap": { 363 | "version": "1.0.0", 364 | "depth": 0, 365 | "source": "builtin", 366 | "dependencies": { 367 | "com.unity.modules.physics2d": "1.0.0" 368 | } 369 | }, 370 | "com.unity.modules.ui": { 371 | "version": "1.0.0", 372 | "depth": 0, 373 | "source": "builtin", 374 | "dependencies": {} 375 | }, 376 | "com.unity.modules.uielements": { 377 | "version": "1.0.0", 378 | "depth": 0, 379 | "source": "builtin", 380 | "dependencies": { 381 | "com.unity.modules.ui": "1.0.0", 382 | "com.unity.modules.imgui": "1.0.0", 383 | "com.unity.modules.jsonserialize": "1.0.0", 384 | "com.unity.modules.uielementsnative": "1.0.0" 385 | } 386 | }, 387 | "com.unity.modules.uielementsnative": { 388 | "version": "1.0.0", 389 | "depth": 1, 390 | "source": "builtin", 391 | "dependencies": { 392 | "com.unity.modules.ui": "1.0.0", 393 | "com.unity.modules.imgui": "1.0.0", 394 | "com.unity.modules.jsonserialize": "1.0.0" 395 | } 396 | }, 397 | "com.unity.modules.umbra": { 398 | "version": "1.0.0", 399 | "depth": 0, 400 | "source": "builtin", 401 | "dependencies": {} 402 | }, 403 | "com.unity.modules.unityanalytics": { 404 | "version": "1.0.0", 405 | "depth": 0, 406 | "source": "builtin", 407 | "dependencies": { 408 | "com.unity.modules.unitywebrequest": "1.0.0", 409 | "com.unity.modules.jsonserialize": "1.0.0" 410 | } 411 | }, 412 | "com.unity.modules.unitywebrequest": { 413 | "version": "1.0.0", 414 | "depth": 0, 415 | "source": "builtin", 416 | "dependencies": {} 417 | }, 418 | "com.unity.modules.unitywebrequestassetbundle": { 419 | "version": "1.0.0", 420 | "depth": 0, 421 | "source": "builtin", 422 | "dependencies": { 423 | "com.unity.modules.assetbundle": "1.0.0", 424 | "com.unity.modules.unitywebrequest": "1.0.0" 425 | } 426 | }, 427 | "com.unity.modules.unitywebrequestaudio": { 428 | "version": "1.0.0", 429 | "depth": 0, 430 | "source": "builtin", 431 | "dependencies": { 432 | "com.unity.modules.unitywebrequest": "1.0.0", 433 | "com.unity.modules.audio": "1.0.0" 434 | } 435 | }, 436 | "com.unity.modules.unitywebrequesttexture": { 437 | "version": "1.0.0", 438 | "depth": 0, 439 | "source": "builtin", 440 | "dependencies": { 441 | "com.unity.modules.unitywebrequest": "1.0.0", 442 | "com.unity.modules.imageconversion": "1.0.0" 443 | } 444 | }, 445 | "com.unity.modules.unitywebrequestwww": { 446 | "version": "1.0.0", 447 | "depth": 0, 448 | "source": "builtin", 449 | "dependencies": { 450 | "com.unity.modules.unitywebrequest": "1.0.0", 451 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 452 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 453 | "com.unity.modules.audio": "1.0.0", 454 | "com.unity.modules.assetbundle": "1.0.0", 455 | "com.unity.modules.imageconversion": "1.0.0" 456 | } 457 | }, 458 | "com.unity.modules.vehicles": { 459 | "version": "1.0.0", 460 | "depth": 0, 461 | "source": "builtin", 462 | "dependencies": { 463 | "com.unity.modules.physics": "1.0.0" 464 | } 465 | }, 466 | "com.unity.modules.video": { 467 | "version": "1.0.0", 468 | "depth": 0, 469 | "source": "builtin", 470 | "dependencies": { 471 | "com.unity.modules.audio": "1.0.0", 472 | "com.unity.modules.ui": "1.0.0", 473 | "com.unity.modules.unitywebrequest": "1.0.0" 474 | } 475 | }, 476 | "com.unity.modules.vr": { 477 | "version": "1.0.0", 478 | "depth": 0, 479 | "source": "builtin", 480 | "dependencies": { 481 | "com.unity.modules.jsonserialize": "1.0.0", 482 | "com.unity.modules.physics": "1.0.0", 483 | "com.unity.modules.xr": "1.0.0" 484 | } 485 | }, 486 | "com.unity.modules.wind": { 487 | "version": "1.0.0", 488 | "depth": 0, 489 | "source": "builtin", 490 | "dependencies": {} 491 | }, 492 | "com.unity.modules.xr": { 493 | "version": "1.0.0", 494 | "depth": 0, 495 | "source": "builtin", 496 | "dependencies": { 497 | "com.unity.modules.physics": "1.0.0", 498 | "com.unity.modules.jsonserialize": "1.0.0", 499 | "com.unity.modules.subsystems": "1.0.0" 500 | } 501 | } 502 | } 503 | } 504 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 0 20 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_DefaultMaxDepenetrationVelocity: 10 11 | m_SleepThreshold: 0.005 12 | m_DefaultContactOffset: 0.01 13 | m_DefaultSolverIterations: 6 14 | m_DefaultSolverVelocityIterations: 1 15 | m_QueriesHitBackfaces: 0 16 | m_QueriesHitTriggers: 1 17 | m_EnableAdaptiveForce: 0 18 | m_ClothInterCollisionDistance: 0.1 19 | m_ClothInterCollisionStiffness: 0.2 20 | m_ContactsGeneration: 1 21 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 22 | m_AutoSimulation: 1 23 | m_AutoSyncTransforms: 0 24 | m_ReuseCollisionCallbacks: 1 25 | m_ClothInterCollisionSettingsToggle: 0 26 | m_ClothGravity: {x: 0, y: -9.81, z: 0} 27 | m_ContactPairsMode: 0 28 | m_BroadphaseType: 0 29 | m_WorldBounds: 30 | m_Center: {x: 0, y: 0, z: 0} 31 | m_Extent: {x: 250, y: 250, z: 250} 32 | m_WorldSubdivisions: 8 33 | m_FrictionType: 0 34 | m_EnableEnhancedDeterminism: 0 35 | m_EnableUnifiedHeightmaps: 1 36 | m_SolverType: 0 37 | m_DefaultMaxAngularSpeed: 50 38 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/SampleScene.unity 10 | guid: 2cda990e2423bbf4892e6590ba056729 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_SerializationMode: 2 8 | m_LineEndingsForNewScripts: 0 9 | m_DefaultBehaviorMode: 1 10 | m_PrefabRegularEnvironment: {fileID: 0} 11 | m_PrefabUIEnvironment: {fileID: 0} 12 | m_SpritePackerMode: 4 13 | m_SpritePackerPaddingPower: 1 14 | m_EtcTextureCompressorBehavior: 1 15 | m_EtcTextureFastCompressor: 1 16 | m_EtcTextureNormalCompressor: 2 17 | m_EtcTextureBestCompressor: 4 18 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp 19 | m_ProjectGenerationRootNamespace: 20 | m_EnableTextureStreamingInEditMode: 1 21 | m_EnableTextureStreamingInPlayMode: 1 22 | m_AsyncShaderCompilation: 1 23 | m_CachingShaderPreprocessor: 1 24 | m_PrefabModeAllowAutoSave: 1 25 | m_EnterPlayModeOptionsEnabled: 0 26 | m_EnterPlayModeOptions: 3 27 | m_GameObjectNamingDigits: 1 28 | m_GameObjectNamingScheme: 0 29 | m_AssetNamingUsesSpace: 1 30 | m_UseLegacyProbeSampleCount: 0 31 | m_SerializeInlineMappingsOnOneLine: 1 32 | m_DisableCookiesInLightmapper: 1 33 | m_AssetPipelineMode: 1 34 | m_CacheServerMode: 0 35 | m_CacheServerEndpoint: 36 | m_CacheServerNamespacePrefix: default 37 | m_CacheServerEnableDownload: 1 38 | m_CacheServerEnableUpload: 1 39 | m_CacheServerEnableAuth: 0 40 | m_CacheServerEnableTls: 0 41 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_VideoShadersIncludeMode: 2 32 | m_AlwaysIncludedShaders: 33 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 42 | m_CustomRenderPipeline: {fileID: 0} 43 | m_TransparencySortMode: 0 44 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 45 | m_DefaultRenderingPath: 1 46 | m_DefaultMobileRenderingPath: 1 47 | m_TierSettings: [] 48 | m_LightmapStripping: 0 49 | m_FogStripping: 0 50 | m_InstancingStripping: 0 51 | m_LightmapKeepPlain: 1 52 | m_LightmapKeepDirCombined: 1 53 | m_LightmapKeepDynamicPlain: 1 54 | m_LightmapKeepDynamicDirCombined: 1 55 | m_LightmapKeepShadowMask: 1 56 | m_LightmapKeepSubtractive: 1 57 | m_FogKeepLinear: 1 58 | m_FogKeepExp: 1 59 | m_FogKeepExp2: 1 60 | m_AlbedoSwatchInfos: [] 61 | m_LightsUseLinearIntensity: 0 62 | m_LightsUseColorTemperature: 0 63 | m_DefaultRenderingLayerMask: 1 64 | m_LogWhenShaderIsCompiled: 0 65 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | - serializedVersion: 3 297 | m_Name: Enable Debug Button 1 298 | descriptiveName: 299 | descriptiveNegativeName: 300 | negativeButton: 301 | positiveButton: left ctrl 302 | altNegativeButton: 303 | altPositiveButton: joystick button 8 304 | gravity: 0 305 | dead: 0 306 | sensitivity: 0 307 | snap: 0 308 | invert: 0 309 | type: 0 310 | axis: 0 311 | joyNum: 0 312 | - serializedVersion: 3 313 | m_Name: Enable Debug Button 2 314 | descriptiveName: 315 | descriptiveNegativeName: 316 | negativeButton: 317 | positiveButton: backspace 318 | altNegativeButton: 319 | altPositiveButton: joystick button 9 320 | gravity: 0 321 | dead: 0 322 | sensitivity: 0 323 | snap: 0 324 | invert: 0 325 | type: 0 326 | axis: 0 327 | joyNum: 0 328 | - serializedVersion: 3 329 | m_Name: Debug Reset 330 | descriptiveName: 331 | descriptiveNegativeName: 332 | negativeButton: 333 | positiveButton: left alt 334 | altNegativeButton: 335 | altPositiveButton: joystick button 1 336 | gravity: 0 337 | dead: 0 338 | sensitivity: 0 339 | snap: 0 340 | invert: 0 341 | type: 0 342 | axis: 0 343 | joyNum: 0 344 | - serializedVersion: 3 345 | m_Name: Debug Next 346 | descriptiveName: 347 | descriptiveNegativeName: 348 | negativeButton: 349 | positiveButton: page down 350 | altNegativeButton: 351 | altPositiveButton: joystick button 5 352 | gravity: 0 353 | dead: 0 354 | sensitivity: 0 355 | snap: 0 356 | invert: 0 357 | type: 0 358 | axis: 0 359 | joyNum: 0 360 | - serializedVersion: 3 361 | m_Name: Debug Previous 362 | descriptiveName: 363 | descriptiveNegativeName: 364 | negativeButton: 365 | positiveButton: page up 366 | altNegativeButton: 367 | altPositiveButton: joystick button 4 368 | gravity: 0 369 | dead: 0 370 | sensitivity: 0 371 | snap: 0 372 | invert: 0 373 | type: 0 374 | axis: 0 375 | joyNum: 0 376 | - serializedVersion: 3 377 | m_Name: Debug Validate 378 | descriptiveName: 379 | descriptiveNegativeName: 380 | negativeButton: 381 | positiveButton: return 382 | altNegativeButton: 383 | altPositiveButton: joystick button 0 384 | gravity: 0 385 | dead: 0 386 | sensitivity: 0 387 | snap: 0 388 | invert: 0 389 | type: 0 390 | axis: 0 391 | joyNum: 0 392 | - serializedVersion: 3 393 | m_Name: Debug Persistent 394 | descriptiveName: 395 | descriptiveNegativeName: 396 | negativeButton: 397 | positiveButton: right shift 398 | altNegativeButton: 399 | altPositiveButton: joystick button 2 400 | gravity: 0 401 | dead: 0 402 | sensitivity: 0 403 | snap: 0 404 | invert: 0 405 | type: 0 406 | axis: 0 407 | joyNum: 0 408 | - serializedVersion: 3 409 | m_Name: Debug Multiplier 410 | descriptiveName: 411 | descriptiveNegativeName: 412 | negativeButton: 413 | positiveButton: left shift 414 | altNegativeButton: 415 | altPositiveButton: joystick button 3 416 | gravity: 0 417 | dead: 0 418 | sensitivity: 0 419 | snap: 0 420 | invert: 0 421 | type: 0 422 | axis: 0 423 | joyNum: 0 424 | - serializedVersion: 3 425 | m_Name: Debug Horizontal 426 | descriptiveName: 427 | descriptiveNegativeName: 428 | negativeButton: left 429 | positiveButton: right 430 | altNegativeButton: 431 | altPositiveButton: 432 | gravity: 1000 433 | dead: 0.001 434 | sensitivity: 1000 435 | snap: 0 436 | invert: 0 437 | type: 0 438 | axis: 0 439 | joyNum: 0 440 | - serializedVersion: 3 441 | m_Name: Debug Vertical 442 | descriptiveName: 443 | descriptiveNegativeName: 444 | negativeButton: down 445 | positiveButton: up 446 | altNegativeButton: 447 | altPositiveButton: 448 | gravity: 1000 449 | dead: 0.001 450 | sensitivity: 1000 451 | snap: 0 452 | invert: 0 453 | type: 0 454 | axis: 0 455 | joyNum: 0 456 | - serializedVersion: 3 457 | m_Name: Debug Vertical 458 | descriptiveName: 459 | descriptiveNegativeName: 460 | negativeButton: down 461 | positiveButton: up 462 | altNegativeButton: 463 | altPositiveButton: 464 | gravity: 1000 465 | dead: 0.001 466 | sensitivity: 1000 467 | snap: 0 468 | invert: 0 469 | type: 2 470 | axis: 6 471 | joyNum: 0 472 | - serializedVersion: 3 473 | m_Name: Debug Horizontal 474 | descriptiveName: 475 | descriptiveNegativeName: 476 | negativeButton: left 477 | positiveButton: right 478 | altNegativeButton: 479 | altPositiveButton: 480 | gravity: 1000 481 | dead: 0.001 482 | sensitivity: 1000 483 | snap: 0 484 | invert: 0 485 | type: 2 486 | axis: 5 487 | joyNum: 0 488 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | maxJobWorkers: 0 89 | preserveTilesOutsideBounds: 0 90 | debug: 91 | m_Flags: 0 92 | m_SettingNames: 93 | - Humanoid 94 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | m_SeeAllPackageVersions: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.com 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_UserSelectedRegistryName: 29 | m_UserAddingNewScopedRegistry: 0 30 | m_RegistryInfoDraft: 31 | m_ErrorMessage: 32 | m_Original: 33 | m_Id: 34 | m_Name: 35 | m_Url: 36 | m_Scopes: [] 37 | m_IsDefault: 0 38 | m_Capabilities: 0 39 | m_Modified: 0 40 | m_Name: 41 | m_Url: 42 | m_Scopes: 43 | - 44 | m_SelectedScopeIndex: 0 45 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_SimulationMode: 0 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 23 7 | productGUID: ca044f5d986e13b4bae057e344cb9257 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: StructureOfArraysGenerator.Unity 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1920 46 | defaultScreenHeight: 1080 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | mipStripping: 0 53 | numberOfMipsStripped: 0 54 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 55 | iosShowActivityIndicatorOnLoading: -1 56 | androidShowActivityIndicatorOnLoading: -1 57 | iosUseCustomAppBackgroundBehavior: 0 58 | iosAllowHTTPDownload: 1 59 | allowedAutorotateToPortrait: 1 60 | allowedAutorotateToPortraitUpsideDown: 1 61 | allowedAutorotateToLandscapeRight: 1 62 | allowedAutorotateToLandscapeLeft: 1 63 | useOSAutorotation: 1 64 | use32BitDisplayBuffer: 1 65 | preserveFramebufferAlpha: 0 66 | disableDepthAndStencilBuffers: 0 67 | androidStartInFullscreen: 1 68 | androidRenderOutsideSafeArea: 1 69 | androidUseSwappy: 1 70 | androidBlitType: 0 71 | androidResizableWindow: 0 72 | androidDefaultWindowWidth: 1920 73 | androidDefaultWindowHeight: 1080 74 | androidMinimumWindowWidth: 400 75 | androidMinimumWindowHeight: 300 76 | androidFullscreenMode: 1 77 | defaultIsNativeResolution: 1 78 | macRetinaSupport: 1 79 | runInBackground: 0 80 | captureSingleScreen: 0 81 | muteOtherAudioSources: 0 82 | Prepare IOS For Recording: 0 83 | Force IOS Speakers When Recording: 0 84 | deferSystemGesturesMode: 0 85 | hideHomeButton: 0 86 | submitAnalytics: 1 87 | usePlayerLog: 1 88 | bakeCollisionMeshes: 0 89 | forceSingleInstance: 0 90 | useFlipModelSwapchain: 1 91 | resizableWindow: 0 92 | useMacAppStoreValidation: 0 93 | macAppStoreCategory: public.app-category.games 94 | gpuSkinning: 0 95 | xboxPIXTextureCapture: 0 96 | xboxEnableAvatar: 0 97 | xboxEnableKinect: 0 98 | xboxEnableKinectAutoTracking: 0 99 | xboxEnableFitness: 0 100 | visibleInBackground: 1 101 | allowFullscreenSwitch: 1 102 | fullscreenMode: 1 103 | xboxSpeechDB: 0 104 | xboxEnableHeadOrientation: 0 105 | xboxEnableGuest: 0 106 | xboxEnablePIXSampling: 0 107 | metalFramebufferOnly: 0 108 | xboxOneResolution: 0 109 | xboxOneSResolution: 0 110 | xboxOneXResolution: 3 111 | xboxOneMonoLoggingLevel: 0 112 | xboxOneLoggingLevel: 1 113 | xboxOneDisableEsram: 0 114 | xboxOneEnableTypeOptimization: 0 115 | xboxOnePresentImmediateThreshold: 0 116 | switchQueueCommandMemory: 1048576 117 | switchQueueControlMemory: 16384 118 | switchQueueComputeMemory: 262144 119 | switchNVNShaderPoolsGranularity: 33554432 120 | switchNVNDefaultPoolsGranularity: 16777216 121 | switchNVNOtherPoolsGranularity: 16777216 122 | switchNVNMaxPublicTextureIDCount: 0 123 | switchNVNMaxPublicSamplerIDCount: 0 124 | stadiaPresentMode: 0 125 | stadiaTargetFramerate: 0 126 | vulkanNumSwapchainBuffers: 3 127 | vulkanEnableSetSRGBWrite: 0 128 | vulkanEnablePreTransform: 0 129 | vulkanEnableLateAcquireNextImage: 0 130 | vulkanEnableCommandBufferRecycling: 1 131 | m_SupportedAspectRatios: 132 | 4:3: 1 133 | 5:4: 1 134 | 16:10: 1 135 | 16:9: 1 136 | Others: 1 137 | bundleVersion: 1.0 138 | preloadedAssets: [] 139 | metroInputSource: 0 140 | wsaTransparentSwapchain: 0 141 | m_HolographicPauseOnTrackingLoss: 1 142 | xboxOneDisableKinectGpuReservation: 1 143 | xboxOneEnable7thCore: 1 144 | vrSettings: 145 | enable360StereoCapture: 0 146 | isWsaHolographicRemotingEnabled: 0 147 | enableFrameTimingStats: 0 148 | enableOpenGLProfilerGPURecorders: 1 149 | useHDRDisplay: 0 150 | D3DHDRBitDepth: 0 151 | m_ColorGamuts: 00000000 152 | targetPixelDensity: 30 153 | resolutionScalingMode: 0 154 | resetResolutionOnWindowResize: 0 155 | androidSupportedAspectRatio: 1 156 | androidMaxAspectRatio: 2.1 157 | applicationIdentifier: 158 | Standalone: com.DefaultCompany.2DProject 159 | buildNumber: 160 | Standalone: 0 161 | iPhone: 0 162 | tvOS: 0 163 | overrideDefaultApplicationIdentifier: 1 164 | AndroidBundleVersionCode: 1 165 | AndroidMinSdkVersion: 22 166 | AndroidTargetSdkVersion: 0 167 | AndroidPreferredInstallLocation: 1 168 | aotOptions: 169 | stripEngineCode: 1 170 | iPhoneStrippingLevel: 0 171 | iPhoneScriptCallOptimization: 0 172 | ForceInternetPermission: 0 173 | ForceSDCardPermission: 0 174 | CreateWallpaper: 0 175 | APKExpansionFiles: 0 176 | keepLoadedShadersAlive: 0 177 | StripUnusedMeshComponents: 0 178 | VertexChannelCompressionMask: 4054 179 | iPhoneSdkVersion: 988 180 | iOSTargetOSVersionString: 11.0 181 | tvOSSdkVersion: 0 182 | tvOSRequireExtendedGameController: 0 183 | tvOSTargetOSVersionString: 11.0 184 | uIPrerenderedIcon: 0 185 | uIRequiresPersistentWiFi: 0 186 | uIRequiresFullScreen: 1 187 | uIStatusBarHidden: 1 188 | uIExitOnSuspend: 0 189 | uIStatusBarStyle: 0 190 | appleTVSplashScreen: {fileID: 0} 191 | appleTVSplashScreen2x: {fileID: 0} 192 | tvOSSmallIconLayers: [] 193 | tvOSSmallIconLayers2x: [] 194 | tvOSLargeIconLayers: [] 195 | tvOSLargeIconLayers2x: [] 196 | tvOSTopShelfImageLayers: [] 197 | tvOSTopShelfImageLayers2x: [] 198 | tvOSTopShelfImageWideLayers: [] 199 | tvOSTopShelfImageWideLayers2x: [] 200 | iOSLaunchScreenType: 0 201 | iOSLaunchScreenPortrait: {fileID: 0} 202 | iOSLaunchScreenLandscape: {fileID: 0} 203 | iOSLaunchScreenBackgroundColor: 204 | serializedVersion: 2 205 | rgba: 0 206 | iOSLaunchScreenFillPct: 100 207 | iOSLaunchScreenSize: 100 208 | iOSLaunchScreenCustomXibPath: 209 | iOSLaunchScreeniPadType: 0 210 | iOSLaunchScreeniPadImage: {fileID: 0} 211 | iOSLaunchScreeniPadBackgroundColor: 212 | serializedVersion: 2 213 | rgba: 0 214 | iOSLaunchScreeniPadFillPct: 100 215 | iOSLaunchScreeniPadSize: 100 216 | iOSLaunchScreeniPadCustomXibPath: 217 | iOSLaunchScreenCustomStoryboardPath: 218 | iOSLaunchScreeniPadCustomStoryboardPath: 219 | iOSDeviceRequirements: [] 220 | iOSURLSchemes: [] 221 | macOSURLSchemes: [] 222 | iOSBackgroundModes: 0 223 | iOSMetalForceHardShadows: 0 224 | metalEditorSupport: 1 225 | metalAPIValidation: 1 226 | iOSRenderExtraFrameOnPause: 0 227 | iosCopyPluginsCodeInsteadOfSymlink: 0 228 | appleDeveloperTeamID: 229 | iOSManualSigningProvisioningProfileID: 230 | tvOSManualSigningProvisioningProfileID: 231 | iOSManualSigningProvisioningProfileType: 0 232 | tvOSManualSigningProvisioningProfileType: 0 233 | appleEnableAutomaticSigning: 0 234 | iOSRequireARKit: 0 235 | iOSAutomaticallyDetectAndAddCapabilities: 1 236 | appleEnableProMotion: 0 237 | shaderPrecisionModel: 0 238 | clonedFromGUID: 10ad67313f4034357812315f3c407484 239 | templatePackageId: com.unity.template.2d@6.1.1 240 | templateDefaultScene: Assets/Scenes/SampleScene.unity 241 | useCustomMainManifest: 0 242 | useCustomLauncherManifest: 0 243 | useCustomMainGradleTemplate: 0 244 | useCustomLauncherGradleManifest: 0 245 | useCustomBaseGradleTemplate: 0 246 | useCustomGradlePropertiesTemplate: 0 247 | useCustomProguardFile: 0 248 | AndroidTargetArchitectures: 1 249 | AndroidTargetDevices: 0 250 | AndroidSplashScreenScale: 0 251 | androidSplashScreen: {fileID: 0} 252 | AndroidKeystoreName: 253 | AndroidKeyaliasName: 254 | AndroidBuildApkPerCpuArchitecture: 0 255 | AndroidTVCompatibility: 0 256 | AndroidIsGame: 1 257 | AndroidEnableTango: 0 258 | androidEnableBanner: 1 259 | androidUseLowAccuracyLocation: 0 260 | androidUseCustomKeystore: 0 261 | m_AndroidBanners: 262 | - width: 320 263 | height: 180 264 | banner: {fileID: 0} 265 | androidGamepadSupportLevel: 0 266 | chromeosInputEmulation: 1 267 | AndroidMinifyWithR8: 0 268 | AndroidMinifyRelease: 0 269 | AndroidMinifyDebug: 0 270 | AndroidValidateAppBundleSize: 1 271 | AndroidAppBundleSizeToValidate: 150 272 | m_BuildTargetIcons: [] 273 | m_BuildTargetPlatformIcons: [] 274 | m_BuildTargetBatching: [] 275 | m_BuildTargetGraphicsJobs: 276 | - m_BuildTarget: MacStandaloneSupport 277 | m_GraphicsJobs: 0 278 | - m_BuildTarget: Switch 279 | m_GraphicsJobs: 0 280 | - m_BuildTarget: MetroSupport 281 | m_GraphicsJobs: 0 282 | - m_BuildTarget: AppleTVSupport 283 | m_GraphicsJobs: 0 284 | - m_BuildTarget: BJMSupport 285 | m_GraphicsJobs: 0 286 | - m_BuildTarget: LinuxStandaloneSupport 287 | m_GraphicsJobs: 0 288 | - m_BuildTarget: PS4Player 289 | m_GraphicsJobs: 0 290 | - m_BuildTarget: iOSSupport 291 | m_GraphicsJobs: 0 292 | - m_BuildTarget: WindowsStandaloneSupport 293 | m_GraphicsJobs: 0 294 | - m_BuildTarget: XboxOnePlayer 295 | m_GraphicsJobs: 0 296 | - m_BuildTarget: LuminSupport 297 | m_GraphicsJobs: 0 298 | - m_BuildTarget: AndroidPlayer 299 | m_GraphicsJobs: 0 300 | - m_BuildTarget: WebGLSupport 301 | m_GraphicsJobs: 0 302 | m_BuildTargetGraphicsJobMode: [] 303 | m_BuildTargetGraphicsAPIs: 304 | - m_BuildTarget: AndroidPlayer 305 | m_APIs: 150000000b000000 306 | m_Automatic: 1 307 | - m_BuildTarget: iOSSupport 308 | m_APIs: 10000000 309 | m_Automatic: 1 310 | m_BuildTargetVRSettings: [] 311 | openGLRequireES31: 0 312 | openGLRequireES31AEP: 0 313 | openGLRequireES32: 0 314 | m_TemplateCustomTags: {} 315 | mobileMTRendering: 316 | Android: 1 317 | iPhone: 1 318 | tvOS: 1 319 | m_BuildTargetGroupLightmapEncodingQuality: [] 320 | m_BuildTargetGroupLightmapSettings: [] 321 | m_BuildTargetNormalMapEncoding: [] 322 | m_BuildTargetDefaultTextureCompressionFormat: 323 | - m_BuildTarget: Android 324 | m_Format: 3 325 | playModeTestRunnerEnabled: 0 326 | runPlayModeTestAsEditModeTest: 0 327 | actionOnDotNetUnhandledException: 1 328 | enableInternalProfiler: 0 329 | logObjCUncaughtExceptions: 1 330 | enableCrashReportAPI: 0 331 | cameraUsageDescription: 332 | locationUsageDescription: 333 | microphoneUsageDescription: 334 | bluetoothUsageDescription: 335 | switchNMETAOverride: 336 | switchNetLibKey: 337 | switchSocketMemoryPoolSize: 6144 338 | switchSocketAllocatorPoolSize: 128 339 | switchSocketConcurrencyLimit: 14 340 | switchScreenResolutionBehavior: 2 341 | switchUseCPUProfiler: 0 342 | switchUseGOLDLinker: 0 343 | switchLTOSetting: 0 344 | switchApplicationID: 0x01004b9000490000 345 | switchNSODependencies: 346 | switchTitleNames_0: 347 | switchTitleNames_1: 348 | switchTitleNames_2: 349 | switchTitleNames_3: 350 | switchTitleNames_4: 351 | switchTitleNames_5: 352 | switchTitleNames_6: 353 | switchTitleNames_7: 354 | switchTitleNames_8: 355 | switchTitleNames_9: 356 | switchTitleNames_10: 357 | switchTitleNames_11: 358 | switchTitleNames_12: 359 | switchTitleNames_13: 360 | switchTitleNames_14: 361 | switchTitleNames_15: 362 | switchPublisherNames_0: 363 | switchPublisherNames_1: 364 | switchPublisherNames_2: 365 | switchPublisherNames_3: 366 | switchPublisherNames_4: 367 | switchPublisherNames_5: 368 | switchPublisherNames_6: 369 | switchPublisherNames_7: 370 | switchPublisherNames_8: 371 | switchPublisherNames_9: 372 | switchPublisherNames_10: 373 | switchPublisherNames_11: 374 | switchPublisherNames_12: 375 | switchPublisherNames_13: 376 | switchPublisherNames_14: 377 | switchPublisherNames_15: 378 | switchIcons_0: {fileID: 0} 379 | switchIcons_1: {fileID: 0} 380 | switchIcons_2: {fileID: 0} 381 | switchIcons_3: {fileID: 0} 382 | switchIcons_4: {fileID: 0} 383 | switchIcons_5: {fileID: 0} 384 | switchIcons_6: {fileID: 0} 385 | switchIcons_7: {fileID: 0} 386 | switchIcons_8: {fileID: 0} 387 | switchIcons_9: {fileID: 0} 388 | switchIcons_10: {fileID: 0} 389 | switchIcons_11: {fileID: 0} 390 | switchIcons_12: {fileID: 0} 391 | switchIcons_13: {fileID: 0} 392 | switchIcons_14: {fileID: 0} 393 | switchIcons_15: {fileID: 0} 394 | switchSmallIcons_0: {fileID: 0} 395 | switchSmallIcons_1: {fileID: 0} 396 | switchSmallIcons_2: {fileID: 0} 397 | switchSmallIcons_3: {fileID: 0} 398 | switchSmallIcons_4: {fileID: 0} 399 | switchSmallIcons_5: {fileID: 0} 400 | switchSmallIcons_6: {fileID: 0} 401 | switchSmallIcons_7: {fileID: 0} 402 | switchSmallIcons_8: {fileID: 0} 403 | switchSmallIcons_9: {fileID: 0} 404 | switchSmallIcons_10: {fileID: 0} 405 | switchSmallIcons_11: {fileID: 0} 406 | switchSmallIcons_12: {fileID: 0} 407 | switchSmallIcons_13: {fileID: 0} 408 | switchSmallIcons_14: {fileID: 0} 409 | switchSmallIcons_15: {fileID: 0} 410 | switchManualHTML: 411 | switchAccessibleURLs: 412 | switchLegalInformation: 413 | switchMainThreadStackSize: 1048576 414 | switchPresenceGroupId: 415 | switchLogoHandling: 0 416 | switchReleaseVersion: 0 417 | switchDisplayVersion: 1.0.0 418 | switchStartupUserAccount: 0 419 | switchTouchScreenUsage: 0 420 | switchSupportedLanguagesMask: 0 421 | switchLogoType: 0 422 | switchApplicationErrorCodeCategory: 423 | switchUserAccountSaveDataSize: 0 424 | switchUserAccountSaveDataJournalSize: 0 425 | switchApplicationAttribute: 0 426 | switchCardSpecSize: -1 427 | switchCardSpecClock: -1 428 | switchRatingsMask: 0 429 | switchRatingsInt_0: 0 430 | switchRatingsInt_1: 0 431 | switchRatingsInt_2: 0 432 | switchRatingsInt_3: 0 433 | switchRatingsInt_4: 0 434 | switchRatingsInt_5: 0 435 | switchRatingsInt_6: 0 436 | switchRatingsInt_7: 0 437 | switchRatingsInt_8: 0 438 | switchRatingsInt_9: 0 439 | switchRatingsInt_10: 0 440 | switchRatingsInt_11: 0 441 | switchRatingsInt_12: 0 442 | switchLocalCommunicationIds_0: 443 | switchLocalCommunicationIds_1: 444 | switchLocalCommunicationIds_2: 445 | switchLocalCommunicationIds_3: 446 | switchLocalCommunicationIds_4: 447 | switchLocalCommunicationIds_5: 448 | switchLocalCommunicationIds_6: 449 | switchLocalCommunicationIds_7: 450 | switchParentalControl: 0 451 | switchAllowsScreenshot: 1 452 | switchAllowsVideoCapturing: 1 453 | switchAllowsRuntimeAddOnContentInstall: 0 454 | switchDataLossConfirmation: 0 455 | switchUserAccountLockEnabled: 0 456 | switchSystemResourceMemory: 16777216 457 | switchSupportedNpadStyles: 22 458 | switchNativeFsCacheSize: 32 459 | switchIsHoldTypeHorizontal: 0 460 | switchSupportedNpadCount: 8 461 | switchSocketConfigEnabled: 0 462 | switchTcpInitialSendBufferSize: 32 463 | switchTcpInitialReceiveBufferSize: 64 464 | switchTcpAutoSendBufferSizeMax: 256 465 | switchTcpAutoReceiveBufferSizeMax: 256 466 | switchUdpSendBufferSize: 9 467 | switchUdpReceiveBufferSize: 42 468 | switchSocketBufferEfficiency: 4 469 | switchSocketInitializeEnabled: 1 470 | switchNetworkInterfaceManagerInitializeEnabled: 1 471 | switchPlayerConnectionEnabled: 1 472 | switchUseNewStyleFilepaths: 0 473 | switchUseMicroSleepForYield: 1 474 | switchEnableRamDiskSupport: 0 475 | switchMicroSleepForYieldTime: 25 476 | switchRamDiskSpaceSize: 12 477 | ps4NPAgeRating: 12 478 | ps4NPTitleSecret: 479 | ps4NPTrophyPackPath: 480 | ps4ParentalLevel: 11 481 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 482 | ps4Category: 0 483 | ps4MasterVersion: 01.00 484 | ps4AppVersion: 01.00 485 | ps4AppType: 0 486 | ps4ParamSfxPath: 487 | ps4VideoOutPixelFormat: 0 488 | ps4VideoOutInitialWidth: 1920 489 | ps4VideoOutBaseModeInitialWidth: 1920 490 | ps4VideoOutReprojectionRate: 60 491 | ps4PronunciationXMLPath: 492 | ps4PronunciationSIGPath: 493 | ps4BackgroundImagePath: 494 | ps4StartupImagePath: 495 | ps4StartupImagesFolder: 496 | ps4IconImagesFolder: 497 | ps4SaveDataImagePath: 498 | ps4SdkOverride: 499 | ps4BGMPath: 500 | ps4ShareFilePath: 501 | ps4ShareOverlayImagePath: 502 | ps4PrivacyGuardImagePath: 503 | ps4ExtraSceSysFile: 504 | ps4NPtitleDatPath: 505 | ps4RemotePlayKeyAssignment: -1 506 | ps4RemotePlayKeyMappingDir: 507 | ps4PlayTogetherPlayerCount: 0 508 | ps4EnterButtonAssignment: 2 509 | ps4ApplicationParam1: 0 510 | ps4ApplicationParam2: 0 511 | ps4ApplicationParam3: 0 512 | ps4ApplicationParam4: 0 513 | ps4DownloadDataSize: 0 514 | ps4GarlicHeapSize: 2048 515 | ps4ProGarlicHeapSize: 2560 516 | playerPrefsMaxSize: 32768 517 | ps4Passcode: bi9UOuSpM2Tlh01vOzwvSikHFswuzleh 518 | ps4pnSessions: 1 519 | ps4pnPresence: 1 520 | ps4pnFriends: 1 521 | ps4pnGameCustomData: 1 522 | playerPrefsSupport: 0 523 | enableApplicationExit: 0 524 | resetTempFolder: 1 525 | restrictedAudioUsageRights: 0 526 | ps4UseResolutionFallback: 0 527 | ps4ReprojectionSupport: 0 528 | ps4UseAudio3dBackend: 0 529 | ps4UseLowGarlicFragmentationMode: 1 530 | ps4SocialScreenEnabled: 0 531 | ps4ScriptOptimizationLevel: 2 532 | ps4Audio3dVirtualSpeakerCount: 14 533 | ps4attribCpuUsage: 0 534 | ps4PatchPkgPath: 535 | ps4PatchLatestPkgPath: 536 | ps4PatchChangeinfoPath: 537 | ps4PatchDayOne: 0 538 | ps4attribUserManagement: 0 539 | ps4attribMoveSupport: 0 540 | ps4attrib3DSupport: 0 541 | ps4attribShareSupport: 0 542 | ps4attribExclusiveVR: 0 543 | ps4disableAutoHideSplash: 0 544 | ps4videoRecordingFeaturesUsed: 0 545 | ps4contentSearchFeaturesUsed: 0 546 | ps4CompatibilityPS5: 0 547 | ps4AllowPS5Detection: 0 548 | ps4GPU800MHz: 1 549 | ps4attribEyeToEyeDistanceSettingVR: 0 550 | ps4IncludedModules: [] 551 | ps4attribVROutputEnabled: 0 552 | monoEnv: 553 | splashScreenBackgroundSourceLandscape: {fileID: 0} 554 | splashScreenBackgroundSourcePortrait: {fileID: 0} 555 | blurSplashScreenBackground: 1 556 | spritePackerPolicy: 557 | webGLMemorySize: 32 558 | webGLExceptionSupport: 1 559 | webGLNameFilesAsHashes: 0 560 | webGLDataCaching: 1 561 | webGLDebugSymbols: 0 562 | webGLEmscriptenArgs: 563 | webGLModulesDirectory: 564 | webGLTemplate: APPLICATION:Default 565 | webGLAnalyzeBuildSize: 0 566 | webGLUseEmbeddedResources: 0 567 | webGLCompressionFormat: 0 568 | webGLWasmArithmeticExceptions: 0 569 | webGLLinkerTarget: 1 570 | webGLThreadsSupport: 0 571 | webGLDecompressionFallback: 0 572 | scriptingDefineSymbols: {} 573 | additionalCompilerArguments: {} 574 | platformArchitecture: {} 575 | scriptingBackend: {} 576 | il2cppCompilerConfiguration: {} 577 | managedStrippingLevel: {} 578 | incrementalIl2cppBuild: {} 579 | suppressCommonWarnings: 1 580 | allowUnsafeCode: 0 581 | useDeterministicCompilation: 1 582 | enableRoslynAnalyzers: 1 583 | additionalIl2CppArgs: 584 | scriptingRuntimeVersion: 1 585 | gcIncremental: 1 586 | assemblyVersionValidation: 1 587 | gcWBarrierValidation: 0 588 | apiCompatibilityLevelPerPlatform: {} 589 | m_RenderingPath: 1 590 | m_MobileRenderingPath: 1 591 | metroPackageName: 2D_BuiltInRenderer 592 | metroPackageVersion: 593 | metroCertificatePath: 594 | metroCertificatePassword: 595 | metroCertificateSubject: 596 | metroCertificateIssuer: 597 | metroCertificateNotAfter: 0000000000000000 598 | metroApplicationDescription: 2D_BuiltInRenderer 599 | wsaImages: {} 600 | metroTileShortName: 601 | metroTileShowName: 0 602 | metroMediumTileShowName: 0 603 | metroLargeTileShowName: 0 604 | metroWideTileShowName: 0 605 | metroSupportStreamingInstall: 0 606 | metroLastRequiredScene: 0 607 | metroDefaultTileSize: 1 608 | metroTileForegroundText: 2 609 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 610 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} 611 | metroSplashScreenUseBackgroundColor: 0 612 | platformCapabilities: {} 613 | metroTargetDeviceFamilies: {} 614 | metroFTAName: 615 | metroFTAFileTypes: [] 616 | metroProtocolName: 617 | vcxProjDefaultLanguage: 618 | XboxOneProductId: 619 | XboxOneUpdateKey: 620 | XboxOneSandboxId: 621 | XboxOneContentId: 622 | XboxOneTitleId: 623 | XboxOneSCId: 624 | XboxOneGameOsOverridePath: 625 | XboxOnePackagingOverridePath: 626 | XboxOneAppManifestOverridePath: 627 | XboxOneVersion: 1.0.0.0 628 | XboxOnePackageEncryption: 0 629 | XboxOnePackageUpdateGranularity: 2 630 | XboxOneDescription: 631 | XboxOneLanguage: 632 | - enus 633 | XboxOneCapability: [] 634 | XboxOneGameRating: {} 635 | XboxOneIsContentPackage: 0 636 | XboxOneEnhancedXboxCompatibilityMode: 0 637 | XboxOneEnableGPUVariability: 1 638 | XboxOneSockets: {} 639 | XboxOneSplashScreen: {fileID: 0} 640 | XboxOneAllowedProductIds: [] 641 | XboxOnePersistentLocalStorageSize: 0 642 | XboxOneXTitleMemory: 8 643 | XboxOneOverrideIdentityName: 644 | XboxOneOverrideIdentityPublisher: 645 | vrEditorSettings: {} 646 | cloudServicesEnabled: {} 647 | luminIcon: 648 | m_Name: 649 | m_ModelFolderPath: 650 | m_PortalFolderPath: 651 | luminCert: 652 | m_CertPath: 653 | m_SignPackage: 1 654 | luminIsChannelApp: 0 655 | luminVersion: 656 | m_VersionCode: 1 657 | m_VersionName: 658 | apiCompatibilityLevel: 6 659 | activeInputHandler: 0 660 | cloudProjectId: 661 | framebufferDepthMemorylessMode: 0 662 | qualitySettingsNames: [] 663 | projectName: 664 | organizationId: 665 | cloudEnabled: 0 666 | legacyClampBlendShapeWeights: 0 667 | playerDataPath: 668 | forceSRGBBlit: 1 669 | virtualTexturingSupportEnabled: 0 670 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2021.3.41f1 2 | m_EditorVersionWithRevision: 2021.3.41f1 (6c5a9e20c022) 3 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | skinWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | customRenderPipeline: {fileID: 0} 44 | excludedTargetPlatforms: [] 45 | - serializedVersion: 2 46 | name: Low 47 | pixelLightCount: 0 48 | shadows: 0 49 | shadowResolution: 0 50 | shadowProjection: 1 51 | shadowCascades: 1 52 | shadowDistance: 20 53 | shadowNearPlaneOffset: 3 54 | shadowCascade2Split: 0.33333334 55 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 56 | shadowmaskMode: 0 57 | skinWeights: 2 58 | textureQuality: 0 59 | anisotropicTextures: 0 60 | antiAliasing: 0 61 | softParticles: 0 62 | softVegetation: 0 63 | realtimeReflectionProbes: 0 64 | billboardsFaceCameraPosition: 0 65 | vSyncCount: 0 66 | lodBias: 0.4 67 | maximumLODLevel: 0 68 | streamingMipmapsActive: 0 69 | streamingMipmapsAddAllCameras: 1 70 | streamingMipmapsMemoryBudget: 512 71 | streamingMipmapsRenderersPerFrame: 512 72 | streamingMipmapsMaxLevelReduction: 2 73 | streamingMipmapsMaxFileIORequests: 1024 74 | particleRaycastBudget: 16 75 | asyncUploadTimeSlice: 2 76 | asyncUploadBufferSize: 16 77 | asyncUploadPersistentBuffer: 1 78 | resolutionScalingFixedDPIFactor: 1 79 | customRenderPipeline: {fileID: 0} 80 | excludedTargetPlatforms: [] 81 | - serializedVersion: 2 82 | name: Medium 83 | pixelLightCount: 1 84 | shadows: 1 85 | shadowResolution: 0 86 | shadowProjection: 1 87 | shadowCascades: 1 88 | shadowDistance: 20 89 | shadowNearPlaneOffset: 3 90 | shadowCascade2Split: 0.33333334 91 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 92 | shadowmaskMode: 0 93 | skinWeights: 2 94 | textureQuality: 0 95 | anisotropicTextures: 1 96 | antiAliasing: 0 97 | softParticles: 0 98 | softVegetation: 0 99 | realtimeReflectionProbes: 0 100 | billboardsFaceCameraPosition: 0 101 | vSyncCount: 1 102 | lodBias: 0.7 103 | maximumLODLevel: 0 104 | streamingMipmapsActive: 0 105 | streamingMipmapsAddAllCameras: 1 106 | streamingMipmapsMemoryBudget: 512 107 | streamingMipmapsRenderersPerFrame: 512 108 | streamingMipmapsMaxLevelReduction: 2 109 | streamingMipmapsMaxFileIORequests: 1024 110 | particleRaycastBudget: 64 111 | asyncUploadTimeSlice: 2 112 | asyncUploadBufferSize: 16 113 | asyncUploadPersistentBuffer: 1 114 | resolutionScalingFixedDPIFactor: 1 115 | customRenderPipeline: {fileID: 0} 116 | excludedTargetPlatforms: [] 117 | - serializedVersion: 2 118 | name: High 119 | pixelLightCount: 2 120 | shadows: 2 121 | shadowResolution: 1 122 | shadowProjection: 1 123 | shadowCascades: 2 124 | shadowDistance: 40 125 | shadowNearPlaneOffset: 3 126 | shadowCascade2Split: 0.33333334 127 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 128 | shadowmaskMode: 1 129 | skinWeights: 2 130 | textureQuality: 0 131 | anisotropicTextures: 1 132 | antiAliasing: 0 133 | softParticles: 0 134 | softVegetation: 1 135 | realtimeReflectionProbes: 1 136 | billboardsFaceCameraPosition: 1 137 | vSyncCount: 1 138 | lodBias: 1 139 | maximumLODLevel: 0 140 | streamingMipmapsActive: 0 141 | streamingMipmapsAddAllCameras: 1 142 | streamingMipmapsMemoryBudget: 512 143 | streamingMipmapsRenderersPerFrame: 512 144 | streamingMipmapsMaxLevelReduction: 2 145 | streamingMipmapsMaxFileIORequests: 1024 146 | particleRaycastBudget: 256 147 | asyncUploadTimeSlice: 2 148 | asyncUploadBufferSize: 16 149 | asyncUploadPersistentBuffer: 1 150 | resolutionScalingFixedDPIFactor: 1 151 | customRenderPipeline: {fileID: 0} 152 | excludedTargetPlatforms: [] 153 | - serializedVersion: 2 154 | name: Very High 155 | pixelLightCount: 3 156 | shadows: 2 157 | shadowResolution: 2 158 | shadowProjection: 1 159 | shadowCascades: 2 160 | shadowDistance: 70 161 | shadowNearPlaneOffset: 3 162 | shadowCascade2Split: 0.33333334 163 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 164 | shadowmaskMode: 1 165 | skinWeights: 4 166 | textureQuality: 0 167 | anisotropicTextures: 2 168 | antiAliasing: 2 169 | softParticles: 1 170 | softVegetation: 1 171 | realtimeReflectionProbes: 1 172 | billboardsFaceCameraPosition: 1 173 | vSyncCount: 1 174 | lodBias: 1.5 175 | maximumLODLevel: 0 176 | streamingMipmapsActive: 0 177 | streamingMipmapsAddAllCameras: 1 178 | streamingMipmapsMemoryBudget: 512 179 | streamingMipmapsRenderersPerFrame: 512 180 | streamingMipmapsMaxLevelReduction: 2 181 | streamingMipmapsMaxFileIORequests: 1024 182 | particleRaycastBudget: 1024 183 | asyncUploadTimeSlice: 2 184 | asyncUploadBufferSize: 16 185 | asyncUploadPersistentBuffer: 1 186 | resolutionScalingFixedDPIFactor: 1 187 | customRenderPipeline: {fileID: 0} 188 | excludedTargetPlatforms: [] 189 | - serializedVersion: 2 190 | name: Ultra 191 | pixelLightCount: 4 192 | shadows: 2 193 | shadowResolution: 2 194 | shadowProjection: 1 195 | shadowCascades: 4 196 | shadowDistance: 150 197 | shadowNearPlaneOffset: 3 198 | shadowCascade2Split: 0.33333334 199 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 200 | shadowmaskMode: 1 201 | skinWeights: 255 202 | textureQuality: 0 203 | anisotropicTextures: 2 204 | antiAliasing: 2 205 | softParticles: 1 206 | softVegetation: 1 207 | realtimeReflectionProbes: 1 208 | billboardsFaceCameraPosition: 1 209 | vSyncCount: 1 210 | lodBias: 2 211 | maximumLODLevel: 0 212 | streamingMipmapsActive: 0 213 | streamingMipmapsAddAllCameras: 1 214 | streamingMipmapsMemoryBudget: 512 215 | streamingMipmapsRenderersPerFrame: 512 216 | streamingMipmapsMaxLevelReduction: 2 217 | streamingMipmapsMaxFileIORequests: 1024 218 | particleRaycastBudget: 4096 219 | asyncUploadTimeSlice: 2 220 | asyncUploadBufferSize: 16 221 | asyncUploadPersistentBuffer: 1 222 | resolutionScalingFixedDPIFactor: 1 223 | customRenderPipeline: {fileID: 0} 224 | excludedTargetPlatforms: [] 225 | m_PerPlatformDefaultQuality: 226 | Android: 2 227 | Lumin: 5 228 | GameCoreScarlett: 5 229 | GameCoreXboxOne: 5 230 | Nintendo Switch: 5 231 | PS4: 5 232 | PS5: 5 233 | Stadia: 5 234 | Standalone: 5 235 | WebGL: 3 236 | Windows Store Apps: 5 237 | XboxOne: 5 238 | iPhone: 2 239 | tvOS: 2 240 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/SceneTemplateSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "templatePinStates": [], 3 | "dependencyTypeInfos": [ 4 | { 5 | "userAdded": false, 6 | "type": "UnityEngine.AnimationClip", 7 | "ignore": false, 8 | "defaultInstantiationMode": 0, 9 | "supportsModification": true 10 | }, 11 | { 12 | "userAdded": false, 13 | "type": "UnityEditor.Animations.AnimatorController", 14 | "ignore": false, 15 | "defaultInstantiationMode": 0, 16 | "supportsModification": true 17 | }, 18 | { 19 | "userAdded": false, 20 | "type": "UnityEngine.AnimatorOverrideController", 21 | "ignore": false, 22 | "defaultInstantiationMode": 0, 23 | "supportsModification": true 24 | }, 25 | { 26 | "userAdded": false, 27 | "type": "UnityEditor.Audio.AudioMixerController", 28 | "ignore": false, 29 | "defaultInstantiationMode": 0, 30 | "supportsModification": true 31 | }, 32 | { 33 | "userAdded": false, 34 | "type": "UnityEngine.ComputeShader", 35 | "ignore": true, 36 | "defaultInstantiationMode": 1, 37 | "supportsModification": true 38 | }, 39 | { 40 | "userAdded": false, 41 | "type": "UnityEngine.Cubemap", 42 | "ignore": false, 43 | "defaultInstantiationMode": 0, 44 | "supportsModification": true 45 | }, 46 | { 47 | "userAdded": false, 48 | "type": "UnityEngine.GameObject", 49 | "ignore": false, 50 | "defaultInstantiationMode": 0, 51 | "supportsModification": true 52 | }, 53 | { 54 | "userAdded": false, 55 | "type": "UnityEditor.LightingDataAsset", 56 | "ignore": false, 57 | "defaultInstantiationMode": 0, 58 | "supportsModification": false 59 | }, 60 | { 61 | "userAdded": false, 62 | "type": "UnityEngine.LightingSettings", 63 | "ignore": false, 64 | "defaultInstantiationMode": 0, 65 | "supportsModification": true 66 | }, 67 | { 68 | "userAdded": false, 69 | "type": "UnityEngine.Material", 70 | "ignore": false, 71 | "defaultInstantiationMode": 0, 72 | "supportsModification": true 73 | }, 74 | { 75 | "userAdded": false, 76 | "type": "UnityEditor.MonoScript", 77 | "ignore": true, 78 | "defaultInstantiationMode": 1, 79 | "supportsModification": true 80 | }, 81 | { 82 | "userAdded": false, 83 | "type": "UnityEngine.PhysicMaterial", 84 | "ignore": false, 85 | "defaultInstantiationMode": 0, 86 | "supportsModification": true 87 | }, 88 | { 89 | "userAdded": false, 90 | "type": "UnityEngine.PhysicsMaterial2D", 91 | "ignore": false, 92 | "defaultInstantiationMode": 0, 93 | "supportsModification": true 94 | }, 95 | { 96 | "userAdded": false, 97 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", 98 | "ignore": false, 99 | "defaultInstantiationMode": 0, 100 | "supportsModification": true 101 | }, 102 | { 103 | "userAdded": false, 104 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", 105 | "ignore": false, 106 | "defaultInstantiationMode": 0, 107 | "supportsModification": true 108 | }, 109 | { 110 | "userAdded": false, 111 | "type": "UnityEngine.Rendering.VolumeProfile", 112 | "ignore": false, 113 | "defaultInstantiationMode": 0, 114 | "supportsModification": true 115 | }, 116 | { 117 | "userAdded": false, 118 | "type": "UnityEditor.SceneAsset", 119 | "ignore": false, 120 | "defaultInstantiationMode": 0, 121 | "supportsModification": false 122 | }, 123 | { 124 | "userAdded": false, 125 | "type": "UnityEngine.Shader", 126 | "ignore": true, 127 | "defaultInstantiationMode": 1, 128 | "supportsModification": true 129 | }, 130 | { 131 | "userAdded": false, 132 | "type": "UnityEngine.ShaderVariantCollection", 133 | "ignore": true, 134 | "defaultInstantiationMode": 1, 135 | "supportsModification": true 136 | }, 137 | { 138 | "userAdded": false, 139 | "type": "UnityEngine.Texture", 140 | "ignore": false, 141 | "defaultInstantiationMode": 0, 142 | "supportsModification": true 143 | }, 144 | { 145 | "userAdded": false, 146 | "type": "UnityEngine.Texture2D", 147 | "ignore": false, 148 | "defaultInstantiationMode": 0, 149 | "supportsModification": true 150 | }, 151 | { 152 | "userAdded": false, 153 | "type": "UnityEngine.Timeline.TimelineAsset", 154 | "ignore": false, 155 | "defaultInstantiationMode": 0, 156 | "supportsModification": true 157 | } 158 | ], 159 | "defaultDependencyTypeInfo": { 160 | "userAdded": false, 161 | "type": "", 162 | "ignore": false, 163 | "defaultInstantiationMode": 1, 164 | "supportsModification": true 165 | }, 166 | "newSceneOverride": 0 167 | } -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_DashboardUrl: https://dashboard.unity3d.com 13 | m_TestInitMode: 0 14 | CrashReportingSettings: 15 | m_EventUrl: https://perf-events.cloud.unity3d.com 16 | m_Enabled: 0 17 | m_LogBufferSize: 10 18 | m_CaptureEditorExceptions: 1 19 | UnityPurchasingSettings: 20 | m_Enabled: 0 21 | m_TestMode: 0 22 | UnityAnalyticsSettings: 23 | m_Enabled: 0 24 | m_TestMode: 0 25 | m_InitializeOnStartup: 1 26 | UnityAdsSettings: 27 | m_Enabled: 0 28 | m_InitializeOnStartup: 1 29 | m_TestMode: 0 30 | m_IosGameId: 31 | m_AndroidGameId: 32 | m_GameIds: {} 33 | m_GameId: 34 | PerformanceReportingSettings: 35 | m_Enabled: 0 36 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | m_CompiledVersion: 0 14 | m_RuntimeVersion: 0 15 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/ProjectSettings/boot.config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cysharp/StructureOfArraysGenerator/236d5a0dade774b4571740f2fdcac6be28591aec/src/StructureOfArraysGenerator.Unity/ProjectSettings/boot.config -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | RecentlyUsedSceneGuid-0: 9 | value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661 10 | flags: 0 11 | vcSharedLogLevel: 12 | value: 0d5e400f0650 13 | flags: 0 14 | m_VCAutomaticAdd: 1 15 | m_VCDebugCom: 0 16 | m_VCDebugCmd: 0 17 | m_VCDebugOut: 0 18 | m_SemanticMergeMode: 2 19 | m_DesiredImportWorkerCount: 9 20 | m_StandbyImportWorkerCount: 2 21 | m_IdleImportWorkerShutdownDelay: 60000 22 | m_VCShowFailedCheckout: 1 23 | m_VCOverwriteFailedCheckoutAssets: 1 24 | m_VCProjectOverlayIcons: 1 25 | m_VCHierarchyOverlayIcons: 1 26 | m_VCOtherOverlayIcons: 1 27 | m_VCAllowAsyncUpdate: 1 28 | m_ArtifactGarbageCollection: 1 29 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator.Unity/UserSettings/Search.settings: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator/DiagnosticDescriptors.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace StructureOfArraysGenerator; 4 | 5 | public static class DiagnosticDescriptors 6 | { 7 | const string Category = "GenerateStructureOfArrays"; 8 | 9 | public static readonly DiagnosticDescriptor MustBePartial = new( 10 | id: "SOA001", 11 | title: "MultiArray struct must be partial", 12 | messageFormat: "The MultiArray type '{0}' must be partial", 13 | category: Category, 14 | defaultSeverity: DiagnosticSeverity.Error, 15 | isEnabledByDefault: true); 16 | 17 | public static readonly DiagnosticDescriptor MustBeReadOnly = new( 18 | id: "SOA002", 19 | title: "MultiArray struct must be readonly", 20 | messageFormat: "The MultiArray struct '{0}' must be readonly", 21 | category: Category, 22 | defaultSeverity: DiagnosticSeverity.Error, 23 | isEnabledByDefault: true); 24 | 25 | public static readonly DiagnosticDescriptor ElementIsNotValueType = new( 26 | id: "SOA003", 27 | title: "MultiArray struct element type only allows value type", 28 | messageFormat: "The MultiArray struct '{0}' element '{1}' only allows value type", 29 | category: Category, 30 | defaultSeverity: DiagnosticSeverity.Error, 31 | isEnabledByDefault: true); 32 | 33 | public static readonly DiagnosticDescriptor MemberEmpty = new( 34 | id: "SOA004", 35 | title: "MultiArray struct element type members does not allow empty", 36 | messageFormat: "The MultiArray struct '{0}' element '{1}' does not allow empty", 37 | category: Category, 38 | defaultSeverity: DiagnosticSeverity.Error, 39 | isEnabledByDefault: true); 40 | 41 | public static readonly DiagnosticDescriptor MemberUnmanaged = new( 42 | id: "SOA005", 43 | title: "All MultiArray struct element type members must be unmanaged", 44 | messageFormat: "The MultiArray struct '{0}' element '{1}' members contains reference type", 45 | category: Category, 46 | defaultSeverity: DiagnosticSeverity.Error, 47 | isEnabledByDefault: true); 48 | 49 | public static readonly DiagnosticDescriptor MultiArrayIsNotExists = new( 50 | id: "SOA006", 51 | title: "MultiArrayList attribute require to annotate MultiArrayAttribute", 52 | messageFormat: "MultiArrayList annotated struct '{0}' requires MultiArrayAttribtue", 53 | category: Category, 54 | defaultSeverity: DiagnosticSeverity.Error, 55 | isEnabledByDefault: true); 56 | } -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator/EmitHelper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace StructureOfArraysGenerator; 4 | 5 | internal static class EmitHelper 6 | { 7 | public static string ToCode(this Accessibility accessibility) 8 | { 9 | switch (accessibility) 10 | { 11 | case Accessibility.NotApplicable: 12 | return ""; 13 | case Accessibility.Private: 14 | return "private"; 15 | case Accessibility.ProtectedAndInternal: 16 | return "private protected"; 17 | case Accessibility.Protected: 18 | return "protected"; 19 | case Accessibility.Internal: 20 | return "internal"; 21 | case Accessibility.ProtectedOrInternal: 22 | return "protected internal"; 23 | case Accessibility.Public: 24 | return "public"; 25 | default: 26 | return ""; 27 | } 28 | } 29 | 30 | public static string ForEachLine(string indent, IEnumerable values, Func lineSelector) 31 | { 32 | return string.Join(Environment.NewLine, values.Select(x => indent + lineSelector(x))); 33 | } 34 | 35 | public static string ForLine(string indent, int begin, int end, Func lineSelector) 36 | { 37 | return string.Join(Environment.NewLine, Enumerable.Range(begin, end - begin).Select(x => indent + lineSelector(x))); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator/Generator.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | using Microsoft.CodeAnalysis.CSharp; 3 | using Microsoft.CodeAnalysis.CSharp.Syntax; 4 | using System.Text; 5 | using static StructureOfArraysGenerator.EmitHelper; 6 | 7 | namespace StructureOfArraysGenerator; 8 | 9 | [Generator(LanguageNames.CSharp)] 10 | public partial class Generator : IIncrementalGenerator 11 | { 12 | #if !ROSLYN3 13 | 14 | public void Initialize(IncrementalGeneratorInitializationContext context) 15 | { 16 | context.RegisterPostInitializationOutput(EmitAttributes); 17 | 18 | { 19 | var source = context.SyntaxProvider.ForAttributeWithMetadataName( 20 | "StructureOfArraysGenerator.MultiArrayAttribute", 21 | static (node, token) => node is StructDeclarationSyntax, 22 | static (context, token) => context); 23 | 24 | context.RegisterSourceOutput(source, EmitMultiArray); 25 | } 26 | { 27 | var source = context.SyntaxProvider.ForAttributeWithMetadataName( 28 | "StructureOfArraysGenerator.MultiArrayListAttribute", 29 | static (node, token) => node is StructDeclarationSyntax, 30 | static (context, token) => context); 31 | 32 | context.RegisterSourceOutput(source, EmitMultiArrayList); 33 | } 34 | } 35 | 36 | #endif 37 | 38 | static void EmitAttributes(IncrementalGeneratorPostInitializationContext context) 39 | { 40 | context.AddSource("StructureOfArraysGeneratorAttributes.cs", """ 41 | using System; 42 | 43 | namespace StructureOfArraysGenerator 44 | { 45 | internal interface IMultiArray 46 | { 47 | int Length { get; } 48 | ReadOnlySpan GetRawSpan(); 49 | #if NET7_0_OR_GREATER 50 | static abstract int GetByteSize(int length); 51 | static abstract T Create(int length, ArraySegment arrayOffset); 52 | #endif 53 | } 54 | 55 | [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] 56 | internal sealed class MultiArrayAttribute : Attribute 57 | { 58 | public Type Type { get; } 59 | public string[] Members { get; } 60 | public bool IncludeProperty { get; } 61 | 62 | public MultiArrayAttribute(Type type, bool includeProperty = false) 63 | { 64 | this.Type = type; 65 | this.IncludeProperty = includeProperty; 66 | this.Members = Array.Empty(); 67 | } 68 | 69 | public MultiArrayAttribute(Type type, params string[] members) 70 | { 71 | this.Type = type; 72 | this.IncludeProperty = false; 73 | this.Members = members; 74 | } 75 | } 76 | 77 | [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] 78 | internal sealed class MultiArrayListAttribute : Attribute 79 | { 80 | public string TypeName { get; } 81 | 82 | public MultiArrayListAttribute() 83 | { 84 | this.TypeName = ""; 85 | } 86 | 87 | public MultiArrayListAttribute(string typeName) 88 | { 89 | this.TypeName = typeName; 90 | } 91 | } 92 | } 93 | """); 94 | } 95 | 96 | static void EmitMultiArray(SourceProductionContext context, GeneratorAttributeSyntaxContext source) 97 | { 98 | var attr = source.Attributes[0]; // allowMultiple:false 99 | var members = GetMultiArrayMembers(attr, out var elementType); 100 | 101 | var constructor = GetElementConstructorInfo(members, elementType); 102 | 103 | // Verify target 104 | if (!VerifyMultiArray(context, (TypeDeclarationSyntax)source.TargetNode, source.TargetSymbol, elementType, members)) 105 | { 106 | return; 107 | } 108 | 109 | // Generate Code 110 | var code = BuildMultiArray(source.TargetSymbol, elementType, constructor, members); 111 | 112 | AddSource(context, source.TargetSymbol, code); 113 | } 114 | 115 | static void EmitMultiArrayList(SourceProductionContext context, GeneratorAttributeSyntaxContext source) 116 | { 117 | var multiArrayAttr = source.TargetSymbol.GetAttributes() 118 | .FirstOrDefault(x => x.AttributeClass?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) == "global::StructureOfArraysGenerator.MultiArrayAttribute"); 119 | 120 | if (multiArrayAttr == null) 121 | { 122 | context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MultiArrayIsNotExists, ((TypeDeclarationSyntax)source.TargetNode).Identifier.GetLocation(), source.TargetSymbol.Name)); 123 | return; 124 | } 125 | 126 | string targetTypeName; 127 | if (source.Attributes[0].ConstructorArguments.Length == 0) 128 | { 129 | if (source.TargetSymbol.Name.EndsWith("MultiArray")) 130 | { 131 | targetTypeName = source.TargetSymbol.Name + "List"; 132 | } 133 | else 134 | { 135 | targetTypeName = source.TargetSymbol.Name + "MultiArrayList"; 136 | } 137 | } 138 | else 139 | { 140 | targetTypeName = (string)source.Attributes[0].ConstructorArguments[0].Value!; 141 | } 142 | 143 | var members = GetMultiArrayMembers(multiArrayAttr, out var elementType); 144 | 145 | var code = BuildMultiArrayList(targetTypeName, source.TargetSymbol, elementType, members); 146 | 147 | AddSource(context, source.TargetSymbol, code, ".MultiArrayList.g.cs"); 148 | } 149 | 150 | static MetaMember[] GetMultiArrayMembers(AttributeData attr, out INamedTypeSymbol elementType) 151 | { 152 | // Extract attribtue parameter 153 | // public MultiArrayAttribute(Type type, bool includeProperty = false) 154 | // public MultiArrayAttribute(Type type, params string[] members) 155 | 156 | elementType = (INamedTypeSymbol)attr.ConstructorArguments[0].Value!; 157 | var includeProperty = false; 158 | string[]? targetMembers = null; 159 | if (attr.AttributeConstructor!.Parameters[1].Type.SpecialType == SpecialType.System_Boolean) 160 | { 161 | // bool includeProperty 162 | includeProperty = (bool)attr.ConstructorArguments[1].Value!; 163 | targetMembers = null; 164 | } 165 | else 166 | { 167 | // string[] members 168 | includeProperty = false; 169 | targetMembers = attr.ConstructorArguments[1].Values.Select(x => (string)x.Value!).ToArray(); 170 | } 171 | 172 | // choose target members 173 | var members = elementType.GetMembers() 174 | .Where(x => 175 | { 176 | if (x.IsStatic) return false; 177 | 178 | if (!(x.DeclaredAccessibility is Accessibility.Public or Accessibility.Internal)) 179 | { 180 | return false; 181 | } 182 | 183 | if (x is IFieldSymbol) return true; 184 | 185 | if (includeProperty && x is IPropertySymbol p) 186 | { 187 | if (p.IsIndexer) return false; 188 | return true; 189 | } 190 | 191 | return false; 192 | }) 193 | .Where(x => 194 | { 195 | if (targetMembers == null || targetMembers.Length == 0) return true; 196 | 197 | return targetMembers.Any(y => x.Name == y); 198 | }) 199 | .Select(x => new MetaMember(x)) 200 | .ToArray(); 201 | 202 | return members; 203 | } 204 | 205 | static IMethodSymbol? GetElementConstructorInfo(MetaMember[] members, INamedTypeSymbol elementType) 206 | { 207 | IMethodSymbol? constructor = null; 208 | if (elementType.Constructors.Length != 0) 209 | { 210 | var nameDict = new HashSet(members.Select(x => x.Name), StringComparer.OrdinalIgnoreCase); 211 | 212 | var maxMatchCount = 0; 213 | foreach (var ctor in elementType.Constructors) 214 | { 215 | var matchCount = 0; 216 | foreach (var p in ctor.Parameters) 217 | { 218 | if (nameDict.Contains(p.Name)) 219 | { 220 | matchCount++; 221 | } 222 | else 223 | { 224 | matchCount = -1; 225 | break; 226 | } 227 | } 228 | 229 | if (matchCount > maxMatchCount) 230 | { 231 | constructor = ctor; // use this. 232 | maxMatchCount = matchCount; 233 | } 234 | } 235 | } 236 | 237 | return constructor; 238 | } 239 | 240 | static bool VerifyMultiArray(SourceProductionContext context, TypeDeclarationSyntax typeSyntax, ISymbol targetType, INamedTypeSymbol elementType, MetaMember[] members) 241 | { 242 | var hasError = false; 243 | 244 | // require partial 245 | if (!typeSyntax.Modifiers.Any(m => m.IsKind(SyntaxKind.PartialKeyword))) 246 | { 247 | context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MustBePartial, typeSyntax.Identifier.GetLocation(), targetType.Name)); 248 | hasError = true; 249 | } 250 | 251 | // require readonly 252 | if (!typeSyntax.Modifiers.Any(m => m.IsKind(SyntaxKind.ReadOnlyKeyword))) 253 | { 254 | context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MustBeReadOnly, typeSyntax.Identifier.GetLocation(), targetType.Name)); 255 | hasError = true; 256 | } 257 | 258 | // element is not valuetype 259 | if (!elementType.IsValueType) 260 | { 261 | context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.ElementIsNotValueType, typeSyntax.Identifier.GetLocation(), targetType.Name, elementType.Name)); 262 | hasError = true; 263 | } 264 | 265 | // empty member is not allowed 266 | if (members.Length == 0) 267 | { 268 | context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MemberEmpty, typeSyntax.Identifier.GetLocation(), targetType.Name, elementType.Name)); 269 | hasError = true; 270 | } 271 | 272 | // All target members should be unmanaged 273 | if (!members.All(x => x.MemberType.IsUnmanagedType)) 274 | { 275 | context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.MemberUnmanaged, typeSyntax.Identifier.GetLocation(), targetType.Name, elementType.Name)); 276 | hasError = true; 277 | } 278 | 279 | return !hasError; 280 | } 281 | 282 | static string BuildMultiArray(ISymbol targetType, INamedTypeSymbol elementType, IMethodSymbol? elementConstructor, MetaMember[] members) 283 | { 284 | var targetTypeName = targetType.Name; 285 | var elementTypeFullName = elementType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); 286 | 287 | var code = $$""" 288 | [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Auto)] 289 | partial struct {{targetTypeName}} : global::StructureOfArraysGenerator.IMultiArray<{{targetTypeName}}> 290 | { 291 | readonly byte[] __value; 292 | readonly int __length; 293 | readonly int __byteSize; 294 | {{ForEachLine(" ", members, x => $"readonly int __byteOffset{x.Name};")}} 295 | 296 | public int Length => __length; 297 | {{ForEachLine(" ", members, x => $"public Span<{x.MemberTypeFullName}> {x.Name} => MemoryMarshal.CreateSpan(ref Unsafe.As(ref Unsafe.Add(ref GetArrayDataReference(__value), __byteOffset{x.Name})), __length);")}} 298 | 299 | public static int GetByteSize(int length) 300 | { 301 | return 0 302 | {{ForEachLine(" ", members, x => $"+ Unsafe.SizeOf<{x.MemberTypeFullName}>() * length")}} 303 | ; 304 | } 305 | 306 | public static {{targetTypeName}} Create(int length, ArraySegment arrayOffset) 307 | { 308 | return new {{targetTypeName}}(length, arrayOffset); 309 | } 310 | 311 | public {{targetTypeName}}(int length) 312 | { 313 | if (length < 0) ThrowOutOfRangeException(); 314 | 315 | this.__byteOffset{{members[0].Name}} = 0; 316 | {{ForLine(" ", 1, members.Length, x => $"this.__byteOffset{members[x].Name} = __byteOffset{members[x - 1].Name} + (Unsafe.SizeOf<{members[x - 1].MemberTypeFullName}>() * length);")}} 317 | this.__byteSize = __byteOffset{{members[members.Length - 1].Name}} + (Unsafe.SizeOf<{{members[members.Length - 1].MemberTypeFullName}}>() * length); 318 | this.__value = new byte[__byteSize]; 319 | this.__length = length; 320 | } 321 | 322 | public {{targetTypeName}}(int length, ArraySegment arrayOffset) 323 | { 324 | if (length < 0) ThrowOutOfRangeException(); 325 | 326 | this.__byteOffset{{members[0].Name}} = arrayOffset.Offset; 327 | {{ForLine(" ", 1, members.Length, x => $"this.__byteOffset{members[x].Name} = __byteOffset{members[x - 1].Name} + (Unsafe.SizeOf<{members[x - 1].MemberTypeFullName}>() * length);")}} 328 | this.__byteSize = __byteOffset{{members[members.Length - 1].Name}} + (Unsafe.SizeOf<{{members[members.Length - 1].MemberTypeFullName}}>() * length) - __byteOffset{{members[0].Name}}; 329 | this.__value = arrayOffset.Array!; 330 | this.__length = length; 331 | 332 | if (arrayOffset.Count < this.__byteSize) ThrowOutOfRangeException(); 333 | } 334 | 335 | public {{elementTypeFullName}} this[int index] 336 | { 337 | get 338 | { 339 | if ((uint)index >= (uint)__length) ThrowOutOfRangeException(); 340 | {{ForEachLine(" ", members, x => $"ref var __{x.Name} = ref Unsafe.Add(ref Unsafe.As(ref Unsafe.Add(ref GetArrayDataReference(__value), __byteOffset{x.Name})), index);")}} 341 | return {{BuildElementNew(elementType, elementConstructor, members)}} 342 | { 343 | {{ForEachLine(" ", members.Where(x => !x.IsConstructorParameter), x => $"{x.Name} = __{x.Name},")}} 344 | }; 345 | } 346 | set 347 | { 348 | if ((uint)index >= (uint)__length) ThrowOutOfRangeException(); 349 | {{ForEachLine(" ", members, x => $"Unsafe.Add(ref Unsafe.As(ref Unsafe.Add(ref GetArrayDataReference(__value), __byteOffset{x.Name})), index) = value.{x.Name};")}} 350 | } 351 | } 352 | 353 | public ReadOnlySpan GetRawSpan() => __value.AsSpan(__byteOffset{{members[0].Name}}, __byteSize); 354 | 355 | public bool SequenceEqual({{targetTypeName}} other) 356 | { 357 | return GetRawSpan().SequenceEqual(other.GetRawSpan()); 358 | } 359 | 360 | public Enumerator GetEnumerator() 361 | { 362 | return new Enumerator(this); 363 | } 364 | 365 | public System.Collections.Generic.IEnumerable<{{elementTypeFullName}}> AsEnumerable() 366 | { 367 | foreach (var item in this) 368 | { 369 | yield return item; 370 | } 371 | } 372 | 373 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] 374 | static ref T GetArrayDataReference(T[] array) 375 | { 376 | #if NET5_0_OR_GREATER 377 | return ref MemoryMarshal.GetArrayDataReference(array); 378 | #else 379 | return ref MemoryMarshal.GetReference(array.AsSpan()); 380 | #endif 381 | } 382 | 383 | static void ThrowOutOfRangeException() 384 | { 385 | throw new ArgumentOutOfRangeException(); 386 | } 387 | 388 | public struct Enumerator 389 | { 390 | {{targetTypeName}} array; 391 | {{elementTypeFullName}} current; 392 | int index; 393 | 394 | public Enumerator({{targetTypeName}} array) 395 | { 396 | this.array = array; 397 | this.current = default; 398 | this.index = 0; 399 | } 400 | 401 | public {{elementTypeFullName}} Current => current; 402 | 403 | public bool MoveNext() 404 | { 405 | if (index >= array.Length) return false; 406 | current = array[index]; 407 | index++; 408 | return true; 409 | } 410 | } 411 | } 412 | """; 413 | 414 | return code; 415 | } 416 | 417 | static string BuildMultiArrayList(string targetTypeName, ISymbol multiArrayType, INamedTypeSymbol elementType, MetaMember[] members) 418 | { 419 | var multiArrayTypeFullName = multiArrayType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); 420 | var elementTypeFullName = elementType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); 421 | 422 | var code = $$""" 423 | {{multiArrayType.DeclaredAccessibility.ToCode()}} sealed partial class {{targetTypeName}} 424 | { 425 | const int DefaultCapacity = 4; 426 | 427 | {{multiArrayTypeFullName}} __array; 428 | int __length; 429 | 430 | public int Length => __length; 431 | {{ForEachLine(" ", members, x => $"public Span<{x.MemberTypeFullName}> {x.Name} => __array.{x.Name}.Slice(0, __length);")}} 432 | 433 | public {{targetTypeName}}() 434 | : this(DefaultCapacity) 435 | { 436 | } 437 | 438 | public {{targetTypeName}}(int capacity) 439 | { 440 | if (capacity < 0) ThrowOutOfRangeIndex(); 441 | __array = new {{multiArrayTypeFullName}}(capacity); 442 | } 443 | 444 | public {{elementTypeFullName}} this[int index] 445 | { 446 | get 447 | { 448 | if ((uint)index >= (uint)__length) ThrowOutOfRangeIndex(); 449 | return __array[index]; 450 | } 451 | set 452 | { 453 | if ((uint)index >= (uint)__length) ThrowOutOfRangeIndex(); 454 | __array[index] = value; 455 | } 456 | } 457 | 458 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 459 | public void Add({{elementTypeFullName}} item) 460 | { 461 | var array = __array; 462 | var size = __length; 463 | if ((uint)size < (uint)array.Length) 464 | { 465 | __length = size + 1; 466 | array[size] = item; 467 | } 468 | else 469 | { 470 | AddWithResize(item); 471 | } 472 | } 473 | 474 | [MethodImpl(MethodImplOptions.NoInlining)] 475 | private void AddWithResize({{elementTypeFullName}} item) 476 | { 477 | var size = __length; 478 | EnsureCapacity(size + 1); 479 | __length = size + 1; 480 | __array[size] = item; 481 | } 482 | 483 | void EnsureCapacity(int capacity) 484 | { 485 | int newCapacity = __array.Length == 0 ? DefaultCapacity : unchecked(2 * __array.Length); 486 | if ((uint)newCapacity > Array.MaxLength) newCapacity = Array.MaxLength; 487 | if (newCapacity < capacity) newCapacity = capacity; 488 | 489 | var newArray = new {{multiArrayTypeFullName}}(newCapacity); 490 | CopyTo(newArray); 491 | __array = newArray; 492 | } 493 | 494 | public void CopyTo({{multiArrayTypeFullName}} array) 495 | { 496 | {{ForEachLine(" ", members, x => $"this.__array.{x.Name}.Slice(0, __length).CopyTo(array.{x.Name});")}} 497 | } 498 | 499 | public {{multiArrayTypeFullName}} ToArray() 500 | { 501 | var newArray = new {{multiArrayTypeFullName}}(__length); 502 | CopyTo(newArray); 503 | return newArray; 504 | } 505 | 506 | public Enumerator GetEnumerator() 507 | { 508 | return new Enumerator(this); 509 | } 510 | 511 | public System.Collections.Generic.IEnumerable<{{elementTypeFullName}}> AsEnumerable() 512 | { 513 | foreach (var item in this) 514 | { 515 | yield return item; 516 | } 517 | } 518 | 519 | static void ThrowOutOfRangeIndex() 520 | { 521 | throw new ArgumentOutOfRangeException(); 522 | } 523 | 524 | public struct Enumerator 525 | { 526 | {{targetTypeName}} list; 527 | {{elementTypeFullName}} current; 528 | int index; 529 | 530 | public Enumerator({{targetTypeName}} list) 531 | { 532 | this.list = list; 533 | this.current = default; 534 | this.index = 0; 535 | } 536 | 537 | public {{elementTypeFullName}} Current => current; 538 | 539 | public bool MoveNext() 540 | { 541 | if (index >= list.Length) return false; 542 | current = list[index]; 543 | index++; 544 | return true; 545 | } 546 | } 547 | } 548 | """; 549 | 550 | return code; 551 | } 552 | 553 | static string BuildElementNew(INamedTypeSymbol elementType, IMethodSymbol? constructor, MetaMember[] members) 554 | { 555 | var elementTypeFullName = elementType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); 556 | 557 | if (constructor == null || constructor.Parameters.Length == 0) 558 | { 559 | return $"new {elementTypeFullName}()"; 560 | } 561 | else 562 | { 563 | var nameDict = members.ToDictionary(x => x.Name, x => x, StringComparer.OrdinalIgnoreCase); 564 | var parameters = constructor.Parameters 565 | .Select(x => 566 | { 567 | if (nameDict.TryGetValue(x.Name, out var member)) 568 | { 569 | member.IsConstructorParameter = true; 570 | return $"__{member.Name}"; 571 | } 572 | return null; // invalid, validated. 573 | }) 574 | .Where(x => x != null); 575 | 576 | return $"new {elementTypeFullName}({string.Join(", ", parameters)})"; 577 | } 578 | } 579 | 580 | static void AddSource(SourceProductionContext context, ISymbol targetSymbol, string code, string fileExtension = ".g.cs") 581 | { 582 | var fullType = targetSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) 583 | .Replace("global::", "") 584 | .Replace("<", "_") 585 | .Replace(">", "_"); 586 | 587 | var sb = new StringBuilder(); 588 | 589 | sb.AppendLine(""" 590 | // 591 | #nullable enable 592 | #pragma warning disable CS0108 593 | #pragma warning disable CS0162 594 | #pragma warning disable CS0164 595 | #pragma warning disable CS0219 596 | #pragma warning disable CS8600 597 | #pragma warning disable CS8601 598 | #pragma warning disable CS8602 599 | #pragma warning disable CS8604 600 | #pragma warning disable CS8619 601 | #pragma warning disable CS8620 602 | #pragma warning disable CS8631 603 | #pragma warning disable CS8765 604 | #pragma warning disable CS9074 605 | #pragma warning disable CA1050 606 | 607 | using System; 608 | using System.Runtime.CompilerServices; 609 | using System.Runtime.InteropServices; 610 | """); 611 | 612 | var ns = targetSymbol.ContainingNamespace; 613 | if (!ns.IsGlobalNamespace) 614 | { 615 | sb.AppendLine($"namespace {ns} {{"); 616 | } 617 | sb.AppendLine(); 618 | 619 | sb.AppendLine(code); 620 | 621 | if (!ns.IsGlobalNamespace) 622 | { 623 | sb.AppendLine($"}}"); 624 | } 625 | 626 | var sourceCode = sb.ToString(); 627 | context.AddSource($"{fullType}{fileExtension}", sourceCode); 628 | } 629 | } 630 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator/MetaMember.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace StructureOfArraysGenerator; 4 | 5 | public class MetaMember 6 | { 7 | public ITypeSymbol MemberType { get; } 8 | public string MemberTypeFullName { get; } 9 | public string Name { get; } 10 | public bool IsField { get; } 11 | 12 | // set when emit constructor. 13 | public bool IsConstructorParameter { get; set; } 14 | 15 | public MetaMember(ISymbol symbol) 16 | { 17 | this.Name = symbol.Name; 18 | if (symbol is IFieldSymbol f) 19 | { 20 | this.MemberType = f.Type; 21 | this.IsField = true; 22 | } 23 | else if (symbol is IPropertySymbol p) 24 | { 25 | this.MemberType = p.Type; 26 | this.IsField = false; 27 | } 28 | else 29 | { 30 | throw new InvalidOperationException("Symbol type is invalid. " + symbol.GetType().FullName); 31 | } 32 | this.MemberTypeFullName = this.MemberType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Profile 1": { 4 | "commandName": "DebugRoslynComponent", 5 | "targetProject": "..\\..\\sandbox\\ConsoleApp1\\ConsoleApp1.csproj" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/StructureOfArraysGenerator/StructureOfArraysGenerator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | 11 6 | enable 7 | cs 8 | enable 9 | $(TargetsForTfmSpecificContentInPackage);PackBuildOutputs 10 | false 11 | true 12 | false 13 | true 14 | true 15 | codegenerator 16 | Structure of arrays code generator. 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | all 27 | runtime; build; native; contentfiles; analyzers; buildtransitive 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tests/StructureOfArraysGenerator.Tests.Roslyn3/StructureOfArraysGenerator.Tests.Roslyn3.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | false 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | all 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Analyzer 30 | false 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /tests/StructureOfArraysGenerator.Tests/DiagnosticsTest.cs: -------------------------------------------------------------------------------- 1 | using MemoryPack.Tests.Utils; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace StructureOfArraysGenerator.Tests; 9 | 10 | public class DiagnosticsTest 11 | { 12 | void Compile(int id, string code, bool allowMultipleError = false) 13 | { 14 | var diagnostics = CSharpGeneratorRunner.RunGenerator(code); 15 | if (!allowMultipleError) 16 | { 17 | diagnostics.Length.Should().Be(1); 18 | diagnostics[0].Id.Should().Be("SOA" + id.ToString("000")); 19 | } 20 | else 21 | { 22 | diagnostics.Select(x => x.Id).Should().Contain("SOA" + id.ToString("000")); 23 | } 24 | } 25 | 26 | [Fact] 27 | public void SOA001_MustBePartial() 28 | { 29 | Compile(1, """ 30 | using StructureOfArraysGenerator; 31 | 32 | public struct Foo 33 | { 34 | public int X; 35 | } 36 | 37 | [MultiArray(typeof(Foo))] 38 | public readonly struct FooMultiArray 39 | { 40 | } 41 | """); 42 | } 43 | 44 | [Fact] 45 | public void SOA002_MustBeReadonly() 46 | { 47 | Compile(2, """ 48 | using StructureOfArraysGenerator; 49 | 50 | public struct Foo 51 | { 52 | public int X; 53 | } 54 | 55 | [MultiArray(typeof(Foo))] 56 | public partial struct FooMultiArray 57 | { 58 | } 59 | """); 60 | } 61 | 62 | [Fact] 63 | public void SOA003_ElementIsNotValueType() 64 | { 65 | Compile(3, """ 66 | using StructureOfArraysGenerator; 67 | 68 | public class Foo 69 | { 70 | public int X; 71 | } 72 | 73 | [MultiArray(typeof(Foo))] 74 | public readonly partial struct FooMultiArray 75 | { 76 | } 77 | """); 78 | } 79 | 80 | [Fact] 81 | public void SOA004_MemberEmpty() 82 | { 83 | Compile(4, """ 84 | using StructureOfArraysGenerator; 85 | 86 | public struct Foo 87 | { 88 | } 89 | 90 | [MultiArray(typeof(Foo))] 91 | public readonly partial struct FooMultiArray 92 | { 93 | } 94 | """); 95 | } 96 | 97 | [Fact] 98 | public void SOA005_MemberUnmanaged() 99 | { 100 | Compile(5, """ 101 | using StructureOfArraysGenerator; 102 | 103 | public struct Foo 104 | { 105 | public int X; 106 | public string Y; 107 | } 108 | 109 | [MultiArray(typeof(Foo))] 110 | public readonly partial struct FooMultiArray 111 | { 112 | } 113 | """); 114 | } 115 | 116 | [Fact] 117 | public void SOA006_MultiArrayIsNotExists() 118 | { 119 | Compile(6, """ 120 | using StructureOfArraysGenerator; 121 | 122 | public struct Foo 123 | { 124 | public int X; 125 | } 126 | 127 | [MultiArrayList] 128 | public readonly partial struct FooMultiArray 129 | { 130 | } 131 | """); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /tests/StructureOfArraysGenerator.Tests/MemoryPackTest.cs: -------------------------------------------------------------------------------- 1 | using MemoryPack; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace StructureOfArraysGenerator.Tests; 9 | 10 | public class MemoryPackTest 11 | { 12 | [Fact] 13 | public void Serialize() 14 | { 15 | var four = new ThreeVectorMultiArray(4); 16 | four[0] = new ThreeVector { X = 10, Y = false, Z = 324.4 }; 17 | four[1] = new ThreeVector { X = 20, Y = true, Z = 20.4 }; 18 | four.X[2] = 30; four.Y[2] = true; four.Z[2] = 44.99; 19 | four.X[3] = 40; four.Y[3] = false; four.Z[3] = 424.12; 20 | 21 | MemoryPackFormatterProvider.Register(new MultiArrayFormatter()); 22 | 23 | var bin = MemoryPackSerializer.Serialize(four); 24 | 25 | var four2 = MemoryPackSerializer.Deserialize(bin); 26 | 27 | four2.X.ToArray().Should().Equal(10, 20, 30, 40); 28 | four2.Y.ToArray().Should().Equal(false, true, true, false); 29 | four2.Z.ToArray().Should().Equal(324.4, 20.4, 44.99, 424.12); 30 | four2.AsEnumerable().Select(x => x.X).ToArray().Should().Equal(10, 20, 30, 40); 31 | four2.AsEnumerable().Select(x => x.Y).ToArray().Should().Equal(false, true, true, false); 32 | four2.AsEnumerable().Select(x => x.Z).ToArray().Should().Equal(324.4, 20.4, 44.99, 424.12); 33 | } 34 | } 35 | 36 | internal sealed class MultiArrayFormatter : MemoryPackFormatter 37 | where T : struct, IMultiArray 38 | { 39 | public override void Serialize(ref MemoryPackWriter writer, scoped ref T value) 40 | { 41 | writer.WriteUnmanaged(value.Length); 42 | writer.WriteUnmanagedSpan(value.GetRawSpan()); 43 | } 44 | 45 | public override void Deserialize(ref MemoryPackReader reader, scoped ref T value) 46 | { 47 | var length = reader.ReadUnmanaged(); 48 | var array = reader.ReadUnmanagedArray(); 49 | value = T.Create(length, array!); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/StructureOfArraysGenerator.Tests/MultiArrayTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Buffers; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace StructureOfArraysGenerator.Tests; 9 | 10 | public class MultiArrayTest 11 | { 12 | [Fact] 13 | public void SimpleOne() 14 | { 15 | var empty = new OneVectorMultiArray(); 16 | empty.Length.Should().Be(0); 17 | 18 | var one = new OneVectorMultiArray(1); 19 | one[0] = new OneVector { X = 99 }; 20 | one.X.ToArray().Should().Equal(99); 21 | 22 | var four = new OneVectorMultiArray(4); 23 | four[0] = new OneVector { X = 10 }; 24 | four[1] = new OneVector { X = 20 }; 25 | four.X[2] = 30; 26 | four.X[3] = 40; 27 | four.X.ToArray().Should().Equal(10, 20, 30, 40); 28 | four.AsEnumerable().Select(x => x.X).ToArray().Should().Equal(10, 20, 30, 40); 29 | } 30 | 31 | [Fact] 32 | public void SimpleTwo() 33 | { 34 | var empty = new TwoVectorMultiArray(); 35 | empty.Length.Should().Be(0); 36 | 37 | var one = new TwoVectorMultiArray(1); 38 | one[0] = new TwoVector { X = 99, Y = true }; 39 | one.X.ToArray().Should().Equal(99); 40 | one.Y.ToArray().Should().Equal(true); 41 | 42 | var four = new TwoVectorMultiArray(4); 43 | four[0] = new TwoVector { X = 10, Y = false }; 44 | four[1] = new TwoVector { X = 20, Y = true }; 45 | four.X[2] = 30; four.Y[2] = true; 46 | four.X[3] = 40; four.Y[3] = false; 47 | four.X.ToArray().Should().Equal(10, 20, 30, 40); 48 | four.Y.ToArray().Should().Equal(false, true, true, false); 49 | four.AsEnumerable().Select(x => x.X).ToArray().Should().Equal(10, 20, 30, 40); 50 | four.AsEnumerable().Select(x => x.Y).ToArray().Should().Equal(false, true, true, false); 51 | } 52 | 53 | [Fact] 54 | public void SimpleThree() 55 | { 56 | var empty = new ThreeVectorMultiArray(); 57 | empty.Length.Should().Be(0); 58 | 59 | var one = new ThreeVectorMultiArray(1); 60 | one[0] = new ThreeVector { X = 99, Y = true, Z = 19.3 }; 61 | one.X.ToArray().Should().Equal(99); 62 | one.Y.ToArray().Should().Equal(true); 63 | one.Z.ToArray().Should().Equal(19.3); 64 | 65 | var four = new ThreeVectorMultiArray(4); 66 | four[0] = new ThreeVector { X = 10, Y = false, Z = 324.4 }; 67 | four[1] = new ThreeVector { X = 20, Y = true, Z = 20.4 }; 68 | four.X[2] = 30; four.Y[2] = true; four.Z[2] = 44.99; 69 | four.X[3] = 40; four.Y[3] = false; four.Z[3] = 424.12; 70 | four.X.ToArray().Should().Equal(10, 20, 30, 40); 71 | four.Y.ToArray().Should().Equal(false, true, true, false); 72 | four.Z.ToArray().Should().Equal(324.4, 20.4, 44.99, 424.12); 73 | four.AsEnumerable().Select(x => x.X).ToArray().Should().Equal(10, 20, 30, 40); 74 | four.AsEnumerable().Select(x => x.Y).ToArray().Should().Equal(false, true, true, false); 75 | four.AsEnumerable().Select(x => x.Z).ToArray().Should().Equal(324.4, 20.4, 44.99, 424.12); 76 | } 77 | 78 | [Fact] 79 | public void OutOfRange() 80 | { 81 | Assert.Throws(() => new TwoVectorMultiArray(-1)); 82 | 83 | var array = new TwoVectorMultiArray(4); 84 | _ = array[0]; 85 | _ = array[1]; 86 | _ = array[2]; 87 | _ = array[3]; 88 | Assert.Throws(() => 89 | { 90 | _ = array[4]; 91 | }); 92 | Assert.Throws(() => 93 | { 94 | _ = array[-1]; 95 | }); 96 | } 97 | 98 | [Fact] 99 | public void DifferentOffset() 100 | { 101 | var byteSize = ThreeVectorMultiArray.GetByteSize(4); 102 | var array = ArrayPool.Shared.Rent(byteSize + 10); 103 | Array.Clear(array); 104 | try 105 | { 106 | var four = new ThreeVectorMultiArray(4, new ArraySegment(array, 10, byteSize)); 107 | four[0] = new ThreeVector { X = 10, Y = false, Z = 324.4 }; 108 | four[1] = new ThreeVector { X = 20, Y = true, Z = 20.4 }; 109 | four.X[2] = 30; four.Y[2] = true; four.Z[2] = 44.99; 110 | four.X[3] = 40; four.Y[3] = false; four.Z[3] = 424.12; 111 | four.X.ToArray().Should().Equal(10, 20, 30, 40); 112 | four.Y.ToArray().Should().Equal(false, true, true, false); 113 | four.Z.ToArray().Should().Equal(324.4, 20.4, 44.99, 424.12); 114 | four.AsEnumerable().Select(x => x.X).ToArray().Should().Equal(10, 20, 30, 40); 115 | four.AsEnumerable().Select(x => x.Y).ToArray().Should().Equal(false, true, true, false); 116 | four.AsEnumerable().Select(x => x.Z).ToArray().Should().Equal(324.4, 20.4, 44.99, 424.12); 117 | } 118 | finally 119 | { 120 | ArrayPool.Shared.Return(array); 121 | } 122 | } 123 | 124 | [Fact] 125 | public void SmallOffset() 126 | { 127 | var byteSize = ThreeVectorMultiArray.GetByteSize(4); 128 | 129 | // just: ok 130 | _ = new ThreeVectorMultiArray(4, new byte[byteSize]); 131 | 132 | // small: ng 133 | Assert.Throws(() => 134 | { 135 | _ = new ThreeVectorMultiArray(4, new byte[byteSize - 1]); 136 | }); 137 | } 138 | 139 | [Fact] 140 | public void Ctor() 141 | { 142 | var array = new CtorCheckerMultiArray(3); 143 | array[0] = new CtorChecker(10, 20.4) { Y = true }; 144 | array[1] = new CtorChecker(20, 30.4) { Y = false }; 145 | array[2] = new CtorChecker(30, 20.4) { Y = true }; 146 | 147 | (array[0].X, array[0].Y, array[0].Z).Should().Be((10, true, 20.4)); 148 | (array[1].X, array[1].Y, array[1].Z).Should().Be((20, false, 30.4)); 149 | (array[2].X, array[2].Y, array[2].Z).Should().Be((30, true, 20.4)); 150 | } 151 | } 152 | 153 | public struct OneVector 154 | { 155 | public int X; 156 | } 157 | 158 | public struct TwoVector 159 | { 160 | public int X; 161 | public bool Y; 162 | } 163 | 164 | 165 | public struct ThreeVector 166 | { 167 | public int X; 168 | public bool Y; 169 | public double Z; 170 | } 171 | 172 | [MultiArray(typeof(OneVector))] 173 | public readonly partial struct OneVectorMultiArray 174 | { 175 | } 176 | 177 | [MultiArray(typeof(TwoVector))] 178 | public readonly partial struct TwoVectorMultiArray 179 | { 180 | } 181 | 182 | 183 | [MultiArray(typeof(ThreeVector))] 184 | public readonly partial struct ThreeVectorMultiArray 185 | { 186 | } 187 | 188 | 189 | public struct CtorChecker 190 | { 191 | public readonly int X; 192 | public bool Y; 193 | public readonly double Z; 194 | 195 | public CtorChecker(int x, double z) 196 | { 197 | this.X = x; 198 | this.Z = z; 199 | } 200 | } 201 | 202 | 203 | [MultiArray(typeof(CtorChecker))] 204 | public readonly partial struct CtorCheckerMultiArray 205 | { 206 | } 207 | -------------------------------------------------------------------------------- /tests/StructureOfArraysGenerator.Tests/MultiListTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace StructureOfArraysGenerator.Tests; 8 | 9 | public class MultiListTest 10 | { 11 | [Fact] 12 | public void List() 13 | { 14 | var list = new Vector3IntMultiArrayList(3); 15 | list.Length.Should().Be(0); 16 | list.Add(new Vector3Int { ABC = 1, DEF = 10, GHI = 100 }); 17 | list.Length.Should().Be(1); 18 | list.Add(new Vector3Int { ABC = 2, DEF = 20, GHI = 200 }); 19 | list.Length.Should().Be(2); 20 | list.Add(new Vector3Int { ABC = 3, DEF = 30, GHI = 300 }); 21 | list.Length.Should().Be(3); 22 | list.Add(new Vector3Int { ABC = 4, DEF = 40, GHI = 400 }); 23 | list.Length.Should().Be(4); 24 | 25 | list.AsEnumerable().Select(x => (x.ABC, x.DEF, x.GHI)).ToArray().Should() 26 | .Equal((1, 10, 100), (2, 20, 200), (3, 30, 300), (4, 40, 400)); 27 | } 28 | 29 | [Fact] 30 | public void OutOfRange() 31 | { 32 | var list = new Vector3IntMultiArrayList(4); 33 | 34 | list.Add(new Vector3Int { ABC = 1, DEF = 10, GHI = 100 }); 35 | list.Add(new Vector3Int { ABC = 2, DEF = 20, GHI = 200 }); 36 | 37 | 38 | list[1].ABC.Should().Be(2); 39 | Assert.Throws(() => _ = list[2]); 40 | } 41 | 42 | [Fact] 43 | public void CopyTo() 44 | { 45 | var list = new Vector3IntMultiArrayList(0); 46 | list.Add(new Vector3Int { ABC = 1, DEF = 22, GHI = 333 }); 47 | list.Add(new Vector3Int { ABC = 4, DEF = 55, GHI = 666 }); 48 | 49 | var dest = new Vector3IntMultiArray(2); 50 | list.CopyTo(dest); 51 | 52 | dest[0].ABC.Should().Be(1); 53 | dest[1].ABC.Should().Be(4); 54 | } 55 | 56 | [Fact] 57 | public void ToArray() 58 | { 59 | var list = new Vector3IntMultiArrayList(0); 60 | list.Add(new Vector3Int { ABC = 1, DEF = 22, GHI = 333 }); 61 | list.Add(new Vector3Int { ABC = 4, DEF = 55, GHI = 666 }); 62 | 63 | var array = list.ToArray(); 64 | array.Length.Should().Be(2); 65 | array[0].ABC.Should().Be(1); 66 | array[1].ABC.Should().Be(4); 67 | } 68 | } 69 | 70 | 71 | public struct Vector3Int 72 | { 73 | public int ABC; 74 | public int DEF; 75 | public int GHI; 76 | } 77 | 78 | [MultiArray(typeof(Vector3Int)), MultiArrayList] 79 | public readonly partial struct Vector3IntMultiArray { } 80 | -------------------------------------------------------------------------------- /tests/StructureOfArraysGenerator.Tests/StructureOfArraysGenerator.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | enable 6 | false 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | all 19 | 20 | 21 | 22 | 23 | 24 | 25 | Analyzer 26 | false 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/StructureOfArraysGenerator.Tests/Utils/CSharpGeneratorRunner.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | using Microsoft.CodeAnalysis.CSharp; 3 | using Microsoft.CodeAnalysis.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Runtime.CompilerServices; 7 | 8 | namespace MemoryPack.Tests.Utils; 9 | 10 | public static class CSharpGeneratorRunner 11 | { 12 | static Compilation baseCompilation = default!; 13 | 14 | [ModuleInitializer] 15 | public static void InitializeCompilation() 16 | { 17 | // running .NET Core system assemblies dir path 18 | var baseAssemblyPath = Path.GetDirectoryName(typeof(object).Assembly.Location)!; 19 | var systemAssemblies = Directory.GetFiles(baseAssemblyPath) 20 | .Where(x => 21 | { 22 | var fileName = Path.GetFileName(x); 23 | if (fileName.EndsWith("Native.dll")) return false; 24 | return fileName.StartsWith("System") || (fileName is "mscorlib.dll" or "netstandard.dll"); 25 | }); 26 | 27 | var references = systemAssemblies 28 | .Select(x => MetadataReference.CreateFromFile(x)) 29 | .ToArray(); 30 | 31 | var compilation = CSharpCompilation.Create("generatortest", 32 | references: references, 33 | options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); 34 | 35 | baseCompilation = compilation; 36 | } 37 | 38 | public static Diagnostic[] RunGenerator(string source, string[]? preprocessorSymbols = null, AnalyzerConfigOptionsProvider? options = null) 39 | { 40 | if (preprocessorSymbols == null) 41 | { 42 | preprocessorSymbols = new[] { "NET7_0_OR_GREATER" }; 43 | } 44 | var parseOptions = new CSharpParseOptions(LanguageVersion.CSharp11, preprocessorSymbols: preprocessorSymbols); 45 | 46 | var driver = CSharpGeneratorDriver.Create(new StructureOfArraysGenerator.Generator()).WithUpdatedParseOptions(parseOptions); 47 | if (options != null) 48 | { 49 | driver = (Microsoft.CodeAnalysis.CSharp.CSharpGeneratorDriver)driver.WithUpdatedAnalyzerConfigOptions(options); 50 | } 51 | 52 | var compilation = baseCompilation.AddSyntaxTrees(CSharpSyntaxTree.ParseText(source, parseOptions)); 53 | 54 | driver.RunGeneratorsAndUpdateCompilation(compilation, out var newCompilation, out var diagnostics); 55 | 56 | // combine diagnostics as result.(ignore warning) 57 | var compilationDiagnostics = newCompilation.GetDiagnostics(); 58 | return diagnostics.Concat(compilationDiagnostics).Where(x => x.Severity == DiagnosticSeverity.Error).ToArray(); 59 | } 60 | } 61 | --------------------------------------------------------------------------------