diff --git a/.gitignore b/.gitignore
index 9efb5f82..8b75980d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,7 +8,6 @@ Library
obj
obj.meta
# User-specific files
-*.csproj.meta
*.csproj.user
*.suo
*.user
@@ -177,6 +176,7 @@ ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
+!*CodeGen~
*.dbmdl
*.dbproj.schemaview
*.pfx
diff --git a/.yamato/upm-ci.yml b/.yamato/upm-ci.yml
index ee8ad143..27b41405 100644
--- a/.yamato/upm-ci.yml
+++ b/.yamato/upm-ci.yml
@@ -1,72 +1,89 @@
build_platforms:
- name: windows
type: Unity::VM
- image: sdet/burst-devimage:stable
+ image: package-ci/win10:v4
flavor: b1.large
- name: linux
- image: package-ci/ubuntu:stable
+ image: package-ci/ubuntu-22.04:v4
type: Unity::VM
flavor: b1.large
- name: macOS
- image: burst/burst_mac:stable
+ image: package-ci/macos-13:v4
type: Unity::VM::osx
flavor: b1.large
upmci_platforms:
- name: windows
type: Unity::VM
- image: package-ci/win10:stable
+ image: package-ci/win10:v4
flavor: b1.large
- name: linux
- image: package-ci/ubuntu:stable
+ image: package-ci/ubuntu-22.04:v4
type: Unity::VM
flavor: b1.large
- name: macOS
- image: package-ci/mac:stable
+ image: package-ci/macos-13:v4
type: Unity::VM::osx
flavor: b1.large
-editor_versions:
- - version: "2018.4"
- display_name: "2018.4"
- - version: "2019.2"
- display_name: "2019.2"
- - version: "2019.3"
- display_name: "2019.3"
- - version: "2020.2/partner/staging"
- display_name: "2020.2_partner_staging"
- - version: "trunk"
- display_name: "trunk"
+validate_editor_versions:
+ - version: "6000.0"
+ display_name: "6000.0"
+ - version: "6000.3"
+ display_name: "6000.3"
+
+package_tests_editor_versions:
+ - version: "6000.0"
+ display_name: "6000.0"
+ - version: "6000.3"
+ display_name: "6000.3"
---
-{% for platform in build_platforms %}
-{% unless platform.name == "linux" %}
-run_tests_on_mono_{{platform.name}}:
- name: Tests NUnit on {{platform.name}}
+{% for platform in upmci_platforms %}
+{% for editor in package_tests_editor_versions %}
+package_tests_{{platform.name}}_{{editor.display_name}}:
+ name: Package tests {{platform.name}} {{editor.display_name}}
agent:
- type: {{platform.type}}
- image: {{platform.image}}
- flavor: {{platform.flavor}}
+ image: {{platform.image}}
+ type: {{platform.type}}
+ flavor: {{platform.flavor}}
commands:
- {% if platform.name == "windows" %}
- - choco install nuget.commandline
- {% endif %}
- - nuget restore src
- - msbuild src/Unity.Mathematics.sln
- - mono src/packages/NUnit.ConsoleRunner.3.9.0/tools/nunit3-console.exe src/Tests/bin/Debug/Unity.Mathematics.Tests.dll --process=single
-{% endunless %}
+ - npm install upm-ci-utils@stable --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm -g
+ - upm-ci package pack --package-path src/
+ - upm-ci package test --type package-tests --package-path src/ --unity-version {{ editor.version }}
+ artifacts:
+ test_results:
+ paths:
+ - "upm-ci~/**/*"
+{% endfor %}
{% endfor %}
+package_tests_all:
+ name: Package tests all
+ dependencies:
+ {% for platform in upmci_platforms %}
+ {% for editor in package_tests_editor_versions %}
+ - .yamato/upm-ci.yml#package_tests_{{platform.name}}_{{editor.display_name}}
+ {% endfor %}
+ {% endfor %}
+
+package_tests_minimal:
+ name: Package tests minimal
+ dependencies:
+ {% for platform in upmci_platforms %}
+ - .yamato/upm-ci.yml#package_tests_{{platform.name}}_6000.3
+ {% endfor %}
+
validate_package_minimal:
name: Validate Package Linux Minimal
agent:
- image: package-ci/ubuntu:stable
+ image: package-ci/ubuntu-22.04:v4
type: Unity::VM
flavor: b1.large
commands:
- npm install upm-ci-utils@stable --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm -g
- upm-ci package pack --package-path src/
- - upm-ci package test --package-path src/ --unity-version 2019.1
+ - upm-ci package test --package-path src/ --unity-version 6000.3
artifacts:
packages:
paths:
@@ -74,15 +91,9 @@ validate_package_minimal:
test_results:
paths:
- "upm-ci~/**/*"
- dependencies:
- {% for platform in build_platforms %}
- {% unless platform.name == "linux" %}
- - .yamato/upm-ci.yml#run_tests_on_mono_{{platform.name}}
- {% endunless %}
- {% endfor %}
- {% for platform in upmci_platforms %}
- {% for editor in editor_versions %}
+{% for platform in upmci_platforms %}
+{% for editor in validate_editor_versions %}
validate_package_{{platform.name}}_{{editor.display_name}}:
name: Validate package {{platform.name}} {{editor.display_name}}
agent:
@@ -100,22 +111,26 @@ validate_package_{{platform.name}}_{{editor.display_name}}:
results_{{platform.name}}_{{editor.display_name}}:
paths:
- "upm-ci~/**/*"
+{% endfor %}
+{% endfor %}
+
+validate_package_all:
+ name: Validate package all
dependencies:
- {% for platform in build_platforms %}
- {% unless platform.name == "linux" %}
- - .yamato/upm-ci.yml#run_tests_on_mono_{{platform.name}}
- {% endunless %}
+ {% for platform in upmci_platforms %}
+ {% for editor in validate_editor_versions %}
+ - .yamato/upm-ci.yml#validate_package_{{platform.name}}_{{editor.display_name}}
+ {% endfor %}
{% endfor %}
- {% endfor %}
- {% endfor %}
-
publish:
name: Publish
agent:
type: Unity::VM
- image: package-ci/win10:stable
+ image: package-ci/win10:v4
flavor: b1.large
+ variables:
+ UPMCI_ENABLE_PACKAGE_SIGNING: 1
commands:
- npm install upm-ci-utils@stable --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm -g
- upm-ci package publish --package-path src/
@@ -124,14 +139,18 @@ publish:
paths:
- "upm-ci~/packages/**/*"
dependencies:
- - .yamato/upm-ci.yml#validate_package_minimal
-
+ {% for platform in build_platforms %}
+ {% for editor in validate_editor_versions %}
+ - .yamato/upm-ci.yml#validate_package_{{platform.name}}_{{editor.display_name}}
+ {% endfor %}
+ {% endfor %}
+ - .yamato/upm-ci.yml#package_tests_minimal
promote:
name: Promote
agent:
type: Unity::VM
- image: package-ci/win10:stable
+ image: package-ci/win10:v4
flavor: b1.large
variables:
UPMCI_PROMOTION: 1
@@ -145,7 +164,6 @@ promote:
dependencies:
- .yamato/upm-ci.yml#publish
-
publish_ci:
name: all Publish Pipeline
triggers:
@@ -162,18 +180,13 @@ nightly_ci:
- branch: master
frequency: daily
dependencies:
- {% for platform in build_platforms %}
- {% for editor in editor_versions %}
- - .yamato/upm-ci.yml#validate_package_{{platform.name}}_{{editor.display_name}}
- {% endfor %}
- {% endfor %}
-
+ - .yamato/upm-ci.yml#validate_package_all
commit_ci:
- name: all CI pipeline
+ name: Commit CI pipeline
triggers:
branches:
only:
- "/.*/"
dependencies:
- - .yamato/upm-ci.yml#validate_package_minimal
+ - .yamato/upm-ci.yml#package_tests_minimal
diff --git a/LICENSE.md b/LICENSE.md
index 311c9904..0c7f3fac 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,30 +1,4 @@
-Unity Companion License (“License”)
-Software Copyright © 2019 Unity Technologies ApS
-
-Unity Technologies ApS (“Unity”) grants to you a worldwide, non-exclusive, no-charge, and royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the software that is made available under this License (“Software”), subject to the following terms and conditions:
-
-1. Unity Companion Use Only. Exercise of the license granted herein is limited to exercise for the creation, use, and/or distribution of applications, software, or other content pursuant to a valid Unity content authoring and rendering engine software license (“Engine License”). That means while use of the Software is not limited to use in the software licensed under the Engine License, the Software may not be used for any purpose other than the creation, use, and/or distribution of Engine License-dependent applications, software, or other content. No other exercise of the license granted herein is permitted, and in no event may the Software be used for competitive analysis or to develop a competing product or service.
-
-2. No Modification of Engine License. Neither this License nor any exercise of the license granted herein modifies the Engine License in any way.
-
-3. Ownership & Grant Back to You.
+com.unity.mathematics copyright © 2023 Unity Technologies ApS
-3.1 You own your content. In this License, “derivative works” means derivatives of the Software itself--works derived only from the Software by you under this License (for example, modifying the code of the Software itself to improve its efficacy); “derivative works” of the Software do not include, for example, games, apps, or content that you create using the Software. You keep all right, title, and interest to your own content.
-
-3.2 Unity owns its content. While you keep all right, title, and interest to your own content per the above, as between Unity and you, Unity will own all right, title, and interest to all intellectual property rights (including patent, trademark, and copyright) in the Software and derivative works of the Software, and you hereby assign and agree to assign all such rights in those derivative works to Unity.
-
-3.3 You have a license to those derivative works. Subject to this License, Unity grants to you the same worldwide, non-exclusive, no-charge, and royalty-free copyright license to derivative works of the Software you create as is granted to you for the Software under this License.
-
-4. Trademarks. You are not granted any right or license under this License to use any trademarks, service marks, trade names, products names, or branding of Unity or its affiliates (“Trademarks”). Descriptive uses of Trademarks are permitted; see, for example, Unity’s Branding Usage Guidelines at https://unity3d.com/public-relations/brand.
-
-5. Notices & Third-Party Rights. This License, including the copyright notice associated with the Software, must be provided in all substantial portions of the Software and derivative works thereof (or, if that is impracticable, in any other location where such notices are customarily placed). Further, if the Software is accompanied by a Unity “third-party notices” or similar file, you acknowledge and agree that software identified in that file is governed by those separate license terms.
-
-6. DISCLAIMER, LIMITATION OF LIABILITY. THE SOFTWARE AND ANY DERIVATIVE WORKS THEREOF IS PROVIDED ON AN "AS IS" BASIS, AND IS PROVIDED WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR NONINFRINGEMENT. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES (WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL, INCLUDING PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS, AND BUSINESS INTERRUPTION), OR OTHER LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM OR OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR ANY DERIVATIVE WORKS THEREOF OR THE USE OF OR OTHER DEALINGS IN SAME, EVEN WHERE ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-7. USE IS ACCEPTANCE and License Versions. Your receipt and use of the Software constitutes your acceptance of this License and its terms and conditions. Software released by Unity under this License may be modified or updated and the License with it; upon any such modification or update, you will comply with the terms of the updated License for any use of any of the Software under the updated License.
-
-8. Use in Compliance with Law and Termination. Your exercise of the license granted herein will at all times be in compliance with applicable law and will not infringe any proprietary rights (including intellectual property rights); this License will terminate immediately on any breach by you of this License.
-
-9. Severability. If any provision of this License is held to be unenforceable or invalid, that provision will be enforced to the maximum extent possible and the other provisions will remain in full force and effect.
-
-10. Governing Law and Venue. This License is governed by and construed in accordance with the laws of Denmark, except for its conflict of laws rules; the United Nations Convention on Contracts for the International Sale of Goods will not apply. If you reside (or your principal place of business is) within the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the state and federal courts located in San Francisco County, California concerning any dispute arising out of this License (“Dispute”). If you reside (or your principal place of business is) outside the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the courts located in Copenhagen, Denmark concerning any Dispute.
\ No newline at end of file
+Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license).
+Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions.
diff --git a/Unity.Mathematics.TestProject/Assets/Scenes/SampleScene.unity b/Unity.Mathematics.TestProject/Assets/Scenes/SampleScene.unity
index 7cdec2a0..b819a102 100644
--- a/Unity.Mathematics.TestProject/Assets/Scenes/SampleScene.unity
+++ b/Unity.Mathematics.TestProject/Assets/Scenes/SampleScene.unity
@@ -38,24 +38,23 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
- m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
+ m_IndirectSpecularColor: {r: 0.44402242, g: 0.49316543, b: 0.5722324, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
- serializedVersion: 11
+ serializedVersion: 12
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
- m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
- serializedVersion: 10
+ serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
@@ -63,6 +62,7 @@ LightmapSettings:
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
+ m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
@@ -77,10 +77,16 @@ LightmapSettings:
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
+ m_PVREnvironmentSampleCount: 500
+ m_PVREnvironmentReferencePointCount: 2048
+ m_PVRFilteringMode: 2
+ m_PVRDenoiserTypeDirect: 0
+ m_PVRDenoiserTypeIndirect: 0
+ m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
- m_PVRFilteringMode: 1
+ m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
@@ -88,15 +94,18 @@ LightmapSettings:
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
- m_ShowResolutionOverlay: 1
+ m_ExportTrainingData: 0
+ m_TrainingDataDestination: TrainingData
+ m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
- m_UseShadowmask: 1
+ m_LightingSettings: {fileID: 4890085278179872738, guid: 20c8488ac153b4f45944c2d7c85a094e,
+ type: 2}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
- serializedVersion: 2
+ serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
@@ -109,15 +118,49 @@ NavMeshSettings:
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
- accuratePlacement: 0
+ buildHeightMesh: 0
+ maxJobWorkers: 0
+ preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
+--- !u!1 &206998647
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 206998649}
+ m_Layer: 0
+ m_Name: GameObject
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &206998649
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 206998647}
+ serializedVersion: 2
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 705507995}
@@ -133,15 +176,18 @@ GameObject:
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_Enabled: 1
- serializedVersion: 8
+ serializedVersion: 10
m_Type: 1
+ m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
+ m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
@@ -151,6 +197,24 @@ Light:
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
+ m_CullingMatrixOverride:
+ e00: 1
+ e01: 0
+ e02: 0
+ e03: 0
+ e10: 0
+ e11: 1
+ e12: 0
+ e13: 0
+ e20: 0
+ e21: 0
+ e22: 1
+ e23: 0
+ e30: 0
+ e31: 0
+ e32: 0
+ e33: 1
+ m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
@@ -158,32 +222,39 @@ Light:
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
+ m_RenderingLayerMask: 1
m_Lightmapping: 1
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
+ m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
+ m_UseBoundingSphereOverride: 0
+ m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &705507995
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
+ serializedVersion: 2
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
- m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &963194225
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 963194228}
@@ -200,24 +271,35 @@ GameObject:
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
--- !u!20 &963194227
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
- m_SensorSize: {x: 36, y: 24}
- m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
+ m_FOVAxisMode: 0
+ m_Iso: 200
+ m_ShutterSpeed: 0.005
+ m_Aperture: 16
+ m_FocusDistance: 10
m_FocalLength: 50
+ m_BladeCount: 5
+ m_Curvature: {x: 2, y: 11}
+ m_BarrelClipping: 0.25
+ m_Anamorphism: 0
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
@@ -248,12 +330,21 @@ Camera:
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInternal: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
+ serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
- m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1660057539 &9223372036854775807
+SceneRoots:
+ m_ObjectHideFlags: 0
+ m_Roots:
+ - {fileID: 963194228}
+ - {fileID: 705507995}
+ - {fileID: 206998649}
diff --git a/Unity.Mathematics.TestProject/Assets/Scenes/SampleSceneSettings.lighting b/Unity.Mathematics.TestProject/Assets/Scenes/SampleSceneSettings.lighting
new file mode 100644
index 00000000..e595ed65
--- /dev/null
+++ b/Unity.Mathematics.TestProject/Assets/Scenes/SampleSceneSettings.lighting
@@ -0,0 +1,66 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!850595691 &4890085278179872738
+LightingSettings:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: SampleSceneSettings
+ serializedVersion: 6
+ m_GIWorkflowMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 1
+ m_RealtimeEnvironmentLighting: 1
+ m_BounceScale: 1
+ m_AlbedoBoost: 1
+ m_IndirectOutputScale: 1
+ m_UsingShadowmask: 1
+ m_BakeBackend: 1
+ m_LightmapMaxSize: 1024
+ m_BakeResolution: 40
+ m_Padding: 2
+ m_LightmapCompression: 3
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_ExtractAO: 0
+ m_MixedBakeMode: 2
+ m_LightmapsBakeMode: 1
+ m_FilterMode: 1
+ m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
+ m_ExportTrainingData: 0
+ m_TrainingDataDestination: TrainingData
+ m_RealtimeResolution: 2
+ m_ForceWhiteAlbedo: 0
+ m_ForceUpdates: 0
+ m_FinalGather: 0
+ m_FinalGatherRayCount: 256
+ m_FinalGatherFiltering: 1
+ m_PVRCulling: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 512
+ m_PVREnvironmentSampleCount: 512
+ m_PVREnvironmentReferencePointCount: 2048
+ m_LightProbeSampleCountMultiplier: 4
+ m_PVRBounces: 2
+ m_PVRMinBounces: 2
+ m_PVREnvironmentImportanceSampling: 0
+ m_PVRFilteringMode: 2
+ m_PVRDenoiserTypeDirect: 0
+ m_PVRDenoiserTypeIndirect: 0
+ m_PVRDenoiserTypeAO: 0
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_PVRTiledBaking: 0
+ m_NumRaysToShootPerTexel: -1
+ m_RespectSceneVisibilityWhenBakingGI: 0
diff --git a/Unity.Mathematics.TestProject/Assets/Scenes/SampleSceneSettings.lighting.meta b/Unity.Mathematics.TestProject/Assets/Scenes/SampleSceneSettings.lighting.meta
new file mode 100644
index 00000000..daa2a351
--- /dev/null
+++ b/Unity.Mathematics.TestProject/Assets/Scenes/SampleSceneSettings.lighting.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 20c8488ac153b4f45944c2d7c85a094e
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 4890085278179872738
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity.Mathematics.TestProject/Assets/Tests/Tests.asmdef b/Unity.Mathematics.TestProject/Assets/Tests/Tests.asmdef
deleted file mode 100644
index 45bb135b..00000000
--- a/Unity.Mathematics.TestProject/Assets/Tests/Tests.asmdef
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "Tests",
- "optionalUnityReferences": [
- "TestAssemblies"
- ]
-}
diff --git a/Unity.Mathematics.TestProject/Assets/Tests/Tests.asmdef.meta b/Unity.Mathematics.TestProject/Assets/Tests/Tests.asmdef.meta
deleted file mode 100644
index cf7cb66a..00000000
--- a/Unity.Mathematics.TestProject/Assets/Tests/Tests.asmdef.meta
+++ /dev/null
@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 5f5c2087bc52f4f7c8326e51ec5a628d
-AssemblyDefinitionImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Unity.Mathematics.TestProject/Packages/manifest.json b/Unity.Mathematics.TestProject/Packages/manifest.json
index 5b27463f..932cc93d 100644
--- a/Unity.Mathematics.TestProject/Packages/manifest.json
+++ b/Unity.Mathematics.TestProject/Packages/manifest.json
@@ -1,13 +1,15 @@
{
"dependencies": {
- "com.unity.burst": "1.2.3",
- "com.unity.ide.rider": "1.1.4",
- "com.unity.ide.vscode": "1.1.4",
+ "com.unity.ai.navigation": "2.0.0",
+ "com.unity.burst": "1.8.11",
+ "com.unity.ide.rider": "3.0.27",
+ "com.unity.ide.visualstudio": "2.0.22",
"com.unity.mathematics": "file:../../src",
- "com.unity.package-validation-suite": "0.8.1-preview",
- "com.unity.properties": "0.10.4-preview",
- "com.unity.test-framework": "1.1.11",
- "com.unity.test-framework.performance": "2.8.0-preview"
+ "com.unity.package-validation-suite": "0.62.0-preview",
+ "com.unity.properties": "2.1.0-exp.3",
+ "com.unity.test-framework": "1.3.9",
+ "com.unity.test-framework.performance": "3.0.3",
+ "com.unity.modules.accessibility": "1.0.0"
},
"testables": [
"com.unity.mathematics"
diff --git a/Unity.Mathematics.TestProject/ProjectSettings/EditorBuildSettings.asset b/Unity.Mathematics.TestProject/ProjectSettings/EditorBuildSettings.asset
index 0147887e..40917b05 100644
--- a/Unity.Mathematics.TestProject/ProjectSettings/EditorBuildSettings.asset
+++ b/Unity.Mathematics.TestProject/ProjectSettings/EditorBuildSettings.asset
@@ -4,5 +4,8 @@
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
- m_Scenes: []
+ m_Scenes:
+ - enabled: 1
+ path: Assets/Scenes/SampleScene.unity
+ guid: 9fc0d4010bbf28b4594072e72b8655ab
m_configObjects: {}
diff --git a/Unity.Mathematics.TestProject/ProjectSettings/GraphicsSettings.asset b/Unity.Mathematics.TestProject/ProjectSettings/GraphicsSettings.asset
index 35a0fa7f..bea55798 100644
--- a/Unity.Mathematics.TestProject/ProjectSettings/GraphicsSettings.asset
+++ b/Unity.Mathematics.TestProject/ProjectSettings/GraphicsSettings.asset
@@ -36,6 +36,10 @@ GraphicsSettings:
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
+ - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
+ - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
+ - {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
+ - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
diff --git a/Unity.Mathematics.TestProject/ProjectSettings/ProjectSettings.asset b/Unity.Mathematics.TestProject/ProjectSettings/ProjectSettings.asset
index f8345c9f..9eb3e0b5 100644
--- a/Unity.Mathematics.TestProject/ProjectSettings/ProjectSettings.asset
+++ b/Unity.Mathematics.TestProject/ProjectSettings/ProjectSettings.asset
@@ -3,7 +3,7 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
- serializedVersion: 20
+ serializedVersion: 26
productGUID: 50c0163089a174a7ab9f46f0020a809f
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
@@ -48,12 +48,15 @@ PlayerSettings:
defaultScreenHeightWeb: 600
m_StereoRenderingPath: 0
m_ActiveColorSpace: 0
+ m_SpriteBatchVertexThreshold: 300
m_MTRendering: 1
+ mipStripping: 0
+ numberOfMipsStripped: 0
+ numberOfMipsStrippedPerMipmapLimitGroup: {}
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
iosUseCustomAppBackgroundBehavior: 0
- iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1
allowedAutorotateToLandscapeRight: 1
@@ -66,6 +69,12 @@ PlayerSettings:
androidRenderOutsideSafeArea: 1
androidUseSwappy: 0
androidBlitType: 0
+ androidResizableWindow: 0
+ androidDefaultWindowWidth: 1920
+ androidDefaultWindowHeight: 1080
+ androidMinimumWindowWidth: 400
+ androidMinimumWindowHeight: 300
+ androidFullscreenMode: 1
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 1
@@ -103,6 +112,7 @@ PlayerSettings:
xboxOneMonoLoggingLevel: 0
xboxOneLoggingLevel: 1
xboxOneDisableEsram: 0
+ xboxOneEnableTypeOptimization: 0
xboxOnePresentImmediateThreshold: 0
switchQueueCommandMemory: 0
switchQueueControlMemory: 16384
@@ -110,14 +120,19 @@ PlayerSettings:
switchNVNShaderPoolsGranularity: 33554432
switchNVNDefaultPoolsGranularity: 16777216
switchNVNOtherPoolsGranularity: 16777216
+ switchGpuScratchPoolGranularity: 2097152
+ switchAllowGpuScratchShrinking: 0
+ switchNVNMaxPublicTextureIDCount: 0
+ switchNVNMaxPublicSamplerIDCount: 0
+ switchNVNGraphicsFirmwareMemory: 32
+ stadiaPresentMode: 0
+ stadiaTargetFramerate: 0
vulkanNumSwapchainBuffers: 3
vulkanEnableSetSRGBWrite: 0
- m_SupportedAspectRatios:
- 4:3: 1
- 5:4: 1
- 16:10: 1
- 16:9: 1
- Others: 1
+ vulkanEnablePreTransform: 0
+ vulkanEnableLateAcquireNextImage: 0
+ vulkanEnableCommandBufferRecycling: 1
+ loadStoreDebugModeEnabled: 0
bundleVersion: 0.1
preloadedAssets: []
metroInputSource: 0
@@ -126,45 +141,28 @@ PlayerSettings:
xboxOneDisableKinectGpuReservation: 0
xboxOneEnable7thCore: 0
vrSettings:
- cardboard:
- depthFormat: 0
- enableTransitionView: 0
- daydream:
- depthFormat: 0
- useSustainedPerformanceMode: 0
- enableVideoLayer: 0
- useProtectedVideoMemory: 0
- minimumSupportedHeadTracking: 0
- maximumSupportedHeadTracking: 1
- hololens:
- depthFormat: 1
- depthBufferSharingEnabled: 0
- lumin:
- depthFormat: 0
- frameTiming: 2
- enableGLCache: 0
- glCacheMaxBlobSize: 524288
- glCacheMaxFileSize: 8388608
- oculus:
- sharedDepthBuffer: 1
- dashSupport: 1
- lowOverheadMode: 0
- protectedContext: 0
- v2Signing: 1
enable360StereoCapture: 0
isWsaHolographicRemotingEnabled: 0
enableFrameTimingStats: 0
+ enableOpenGLProfilerGPURecorders: 1
useHDRDisplay: 0
- D3DHDRBitDepth: 0
+ hdrBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30
resolutionScalingMode: 0
+ resetResolutionOnWindowResize: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
- applicationIdentifier: {}
- buildNumber: {}
+ applicationIdentifier:
+ Android: com.UnityTestRunner.UnityTestRunner
+ buildNumber:
+ Standalone: 0
+ VisionOS: 0
+ iPhone: 0
+ tvOS: 0
+ overrideDefaultApplicationIdentifier: 1
AndroidBundleVersionCode: 1
- AndroidMinSdkVersion: 19
+ AndroidMinSdkVersion: 22
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:
@@ -177,34 +175,21 @@ PlayerSettings:
APKExpansionFiles: 0
keepLoadedShadersAlive: 0
StripUnusedMeshComponents: 1
+ strictShaderVariantMatching: 0
VertexChannelCompressionMask: 4054
iPhoneSdkVersion: 988
- iOSTargetOSVersionString: 10.0
+ iOSTargetOSVersionString: 12.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
- tvOSTargetOSVersionString: 10.0
+ tvOSTargetOSVersionString: 12.0
+ VisionOSSdkVersion: 0
+ VisionOSTargetOSVersionString: 1.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
uIStatusBarHidden: 1
uIExitOnSuspend: 0
uIStatusBarStyle: 0
- iPhoneSplashScreen: {fileID: 0}
- iPhoneHighResSplashScreen: {fileID: 0}
- iPhoneTallHighResSplashScreen: {fileID: 0}
- iPhone47inSplashScreen: {fileID: 0}
- iPhone55inPortraitSplashScreen: {fileID: 0}
- iPhone55inLandscapeSplashScreen: {fileID: 0}
- iPhone58inPortraitSplashScreen: {fileID: 0}
- iPhone58inLandscapeSplashScreen: {fileID: 0}
- iPadPortraitSplashScreen: {fileID: 0}
- iPadHighResPortraitSplashScreen: {fileID: 0}
- iPadLandscapeSplashScreen: {fileID: 0}
- iPadHighResLandscapeSplashScreen: {fileID: 0}
- iPhone65inPortraitSplashScreen: {fileID: 0}
- iPhone65inLandscapeSplashScreen: {fileID: 0}
- iPhone61inPortraitSplashScreen: {fileID: 0}
- iPhone61inLandscapeSplashScreen: {fileID: 0}
appleTVSplashScreen: {fileID: 0}
appleTVSplashScreen2x: {fileID: 0}
tvOSSmallIconLayers: []
@@ -232,32 +217,47 @@ PlayerSettings:
iOSLaunchScreeniPadFillPct: 100
iOSLaunchScreeniPadSize: 100
iOSLaunchScreeniPadCustomXibPath:
- iOSUseLaunchScreenStoryboard: 0
iOSLaunchScreenCustomStoryboardPath:
+ iOSLaunchScreeniPadCustomStoryboardPath:
iOSDeviceRequirements: []
iOSURLSchemes: []
+ macOSURLSchemes: []
iOSBackgroundModes: 0
iOSMetalForceHardShadows: 0
metalEditorSupport: 1
metalAPIValidation: 1
iOSRenderExtraFrameOnPause: 0
+ iosCopyPluginsCodeInsteadOfSymlink: 0
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
+ VisionOSManualSigningProvisioningProfileID:
iOSManualSigningProvisioningProfileType: 0
tvOSManualSigningProvisioningProfileType: 0
+ VisionOSManualSigningProvisioningProfileType: 0
appleEnableAutomaticSigning: 0
iOSRequireARKit: 0
iOSAutomaticallyDetectAndAddCapabilities: 1
appleEnableProMotion: 0
+ shaderPrecisionModel: 0
clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea
templatePackageId: com.unity.template.3d@1.0.11
templateDefaultScene: Assets/Scenes/SampleScene.unity
+ useCustomMainManifest: 0
+ useCustomLauncherManifest: 0
+ useCustomMainGradleTemplate: 0
+ useCustomLauncherGradleManifest: 0
+ useCustomBaseGradleTemplate: 0
+ useCustomGradlePropertiesTemplate: 0
+ useCustomGradleSettingsTemplate: 0
+ useCustomProguardFile: 0
AndroidTargetArchitectures: 1
+ AndroidTargetDevices: 0
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName: '{inproject}: '
AndroidKeyaliasName:
+ AndroidEnableArmv9SecurityFeatures: 0
AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 0
AndroidIsGame: 1
@@ -270,10 +270,105 @@ PlayerSettings:
height: 180
banner: {fileID: 0}
androidGamepadSupportLevel: 0
+ chromeosInputEmulation: 1
+ AndroidMinifyRelease: 0
+ AndroidMinifyDebug: 0
AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 100
m_BuildTargetIcons: []
- m_BuildTargetPlatformIcons: []
+ m_BuildTargetPlatformIcons:
+ - m_BuildTarget: Android
+ m_Icons:
+ - m_Textures: []
+ m_Width: 432
+ m_Height: 432
+ m_Kind: 2
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 324
+ m_Height: 324
+ m_Kind: 2
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 216
+ m_Height: 216
+ m_Kind: 2
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 162
+ m_Height: 162
+ m_Kind: 2
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 108
+ m_Height: 108
+ m_Kind: 2
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 81
+ m_Height: 81
+ m_Kind: 2
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 192
+ m_Height: 192
+ m_Kind: 0
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 144
+ m_Height: 144
+ m_Kind: 0
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 96
+ m_Height: 96
+ m_Kind: 0
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 72
+ m_Height: 72
+ m_Kind: 0
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 48
+ m_Height: 48
+ m_Kind: 0
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 36
+ m_Height: 36
+ m_Kind: 0
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 192
+ m_Height: 192
+ m_Kind: 1
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 144
+ m_Height: 144
+ m_Kind: 1
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 96
+ m_Height: 96
+ m_Kind: 1
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 72
+ m_Height: 72
+ m_Kind: 1
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 48
+ m_Height: 48
+ m_Kind: 1
+ m_SubKind:
+ - m_Textures: []
+ m_Width: 36
+ m_Height: 36
+ m_Kind: 1
+ m_SubKind:
m_BuildTargetBatching:
- m_BuildTarget: Standalone
m_StaticBatching: 1
@@ -290,6 +385,7 @@ PlayerSettings:
- m_BuildTarget: WebGL
m_StaticBatching: 0
m_DynamicBatching: 0
+ m_BuildTargetShaderSettings: []
m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport
m_GraphicsJobs: 0
@@ -325,13 +421,13 @@ PlayerSettings:
m_BuildTargetGraphicsAPIs:
- m_BuildTarget: AndroidPlayer
m_APIs: 150000000b000000
- m_Automatic: 0
+ m_Automatic: 1
- m_BuildTarget: iOSSupport
m_APIs: 10000000
m_Automatic: 1
- m_BuildTarget: AppleTVSupport
m_APIs: 10000000
- m_Automatic: 0
+ m_Automatic: 1
- m_BuildTarget: WebGLSupport
m_APIs: 0b000000
m_Automatic: 1
@@ -341,6 +437,8 @@ PlayerSettings:
m_Devices:
- Oculus
- OpenVR
+ m_DefaultShaderChunkSizeInMB: 16
+ m_DefaultShaderChunkCount: 0
openGLRequireES31: 0
openGLRequireES31AEP: 0
openGLRequireES32: 0
@@ -350,7 +448,11 @@ PlayerSettings:
iPhone: 1
tvOS: 1
m_BuildTargetGroupLightmapEncodingQuality: []
+ m_BuildTargetGroupHDRCubemapEncodingQuality: []
m_BuildTargetGroupLightmapSettings: []
+ m_BuildTargetGroupLoadStoreDebugModeSettings: []
+ m_BuildTargetNormalMapEncoding: []
+ m_BuildTargetDefaultTextureCompressionFormat: []
playModeTestRunnerEnabled: 0
runPlayModeTestAsEditModeTest: 0
actionOnDotNetUnhandledException: 1
@@ -360,14 +462,20 @@ PlayerSettings:
cameraUsageDescription:
locationUsageDescription:
microphoneUsageDescription:
+ bluetoothUsageDescription:
+ macOSTargetOSVersion: 10.13.0
+ switchNMETAOverride:
switchNetLibKey:
switchSocketMemoryPoolSize: 6144
switchSocketAllocatorPoolSize: 128
switchSocketConcurrencyLimit: 14
switchScreenResolutionBehavior: 2
switchUseCPUProfiler: 0
+ switchUseGOLDLinker: 0
+ switchLTOSetting: 0
switchApplicationID: 0x01004b9000490000
switchNSODependencies:
+ switchCompilerFlags:
switchTitleNames_0:
switchTitleNames_1:
switchTitleNames_2:
@@ -383,6 +491,7 @@ PlayerSettings:
switchTitleNames_12:
switchTitleNames_13:
switchTitleNames_14:
+ switchTitleNames_15:
switchPublisherNames_0:
switchPublisherNames_1:
switchPublisherNames_2:
@@ -398,6 +507,7 @@ PlayerSettings:
switchPublisherNames_12:
switchPublisherNames_13:
switchPublisherNames_14:
+ switchPublisherNames_15:
switchIcons_0: {fileID: 0}
switchIcons_1: {fileID: 0}
switchIcons_2: {fileID: 0}
@@ -413,6 +523,7 @@ PlayerSettings:
switchIcons_12: {fileID: 0}
switchIcons_13: {fileID: 0}
switchIcons_14: {fileID: 0}
+ switchIcons_15: {fileID: 0}
switchSmallIcons_0: {fileID: 0}
switchSmallIcons_1: {fileID: 0}
switchSmallIcons_2: {fileID: 0}
@@ -428,6 +539,7 @@ PlayerSettings:
switchSmallIcons_12: {fileID: 0}
switchSmallIcons_13: {fileID: 0}
switchSmallIcons_14: {fileID: 0}
+ switchSmallIcons_15: {fileID: 0}
switchManualHTML:
switchAccessibleURLs:
switchLegalInformation:
@@ -437,7 +549,6 @@ PlayerSettings:
switchReleaseVersion: 0
switchDisplayVersion: 1.0.0
switchStartupUserAccount: 0
- switchTouchScreenUsage: 0
switchSupportedLanguagesMask: 0
switchLogoType: 0
switchApplicationErrorCodeCategory:
@@ -479,6 +590,7 @@ PlayerSettings:
switchNativeFsCacheSize: 32
switchIsHoldTypeHorizontal: 0
switchSupportedNpadCount: 8
+ switchEnableTouchScreen: 1
switchSocketConfigEnabled: 0
switchTcpInitialSendBufferSize: 32
switchTcpInitialReceiveBufferSize: 64
@@ -490,6 +602,12 @@ PlayerSettings:
switchSocketInitializeEnabled: 1
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
+ switchUseNewStyleFilepaths: 1
+ switchUseLegacyFmodPriorities: 0
+ switchUseMicroSleepForYield: 1
+ switchEnableRamDiskSupport: 0
+ switchMicroSleepForYieldTime: 25
+ switchRamDiskSpaceSize: 12
ps4NPAgeRating: 12
ps4NPTitleSecret:
ps4NPTrophyPackPath:
@@ -516,6 +634,7 @@ PlayerSettings:
ps4ShareFilePath:
ps4ShareOverlayImagePath:
ps4PrivacyGuardImagePath:
+ ps4ExtraSceSysFile:
ps4NPtitleDatPath:
ps4RemotePlayKeyAssignment: -1
ps4RemotePlayKeyMappingDir:
@@ -541,6 +660,7 @@ PlayerSettings:
ps4UseResolutionFallback: 0
ps4ReprojectionSupport: 0
ps4UseAudio3dBackend: 0
+ ps4UseLowGarlicFragmentationMode: 1
ps4SocialScreenEnabled: 0
ps4ScriptOptimizationLevel: 0
ps4Audio3dVirtualSpeakerCount: 14
@@ -557,6 +677,9 @@ PlayerSettings:
ps4disableAutoHideSplash: 0
ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
+ ps4CompatibilityPS5: 0
+ ps4AllowPS5Detection: 0
+ ps4GPU800MHz: 1
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
ps4attribVROutputEnabled: 0
@@ -568,6 +691,7 @@ PlayerSettings:
webGLMemorySize: 16
webGLExceptionSupport: 1
webGLNameFilesAsHashes: 0
+ webGLShowDiagnostics: 0
webGLDataCaching: 1
webGLDebugSymbols: 0
webGLEmscriptenArgs:
@@ -576,16 +700,45 @@ PlayerSettings:
webGLAnalyzeBuildSize: 0
webGLUseEmbeddedResources: 0
webGLCompressionFormat: 1
+ webGLWasmArithmeticExceptions: 0
webGLLinkerTarget: 1
webGLThreadsSupport: 0
- webGLWasmStreaming: 0
+ webGLDecompressionFallback: 0
+ webGLInitialMemorySize: 32
+ webGLMaximumMemorySize: 2048
+ webGLMemoryGrowthMode: 2
+ webGLMemoryLinearGrowthStep: 16
+ webGLMemoryGeometricGrowthStep: 0.2
+ webGLMemoryGeometricGrowthCap: 96
+ webGLPowerPreference: 2
scriptingDefineSymbols: {}
+ additionalCompilerArguments: {}
platformArchitecture: {}
- scriptingBackend: {}
+ scriptingBackend:
+ Android: 1
+ Standalone: 1
il2cppCompilerConfiguration: {}
- managedStrippingLevel: {}
+ il2cppCodeGeneration: {}
+ managedStrippingLevel:
+ Android: 1
+ EmbeddedLinux: 1
+ GameCoreScarlett: 1
+ GameCoreXboxOne: 1
+ Nintendo Switch: 1
+ PS4: 1
+ PS5: 1
+ QNX: 1
+ Stadia: 1
+ VisionOS: 1
+ WebGL: 1
+ Windows Store Apps: 1
+ XboxOne: 1
+ iPhone: 1
+ tvOS: 1
incrementalIl2cppBuild: {}
- allowUnsafeCode: 0
+ suppressCommonWarnings: 1
+ allowUnsafeCode: 1
+ useDeterministicCompilation: 1
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 0
@@ -620,6 +773,7 @@ PlayerSettings:
metroFTAName:
metroFTAFileTypes: []
metroProtocolName:
+ vcxProjDefaultLanguage:
XboxOneProductId:
XboxOneUpdateKey:
XboxOneSandboxId:
@@ -638,6 +792,7 @@ PlayerSettings:
XboxOneCapability: []
XboxOneGameRating: {}
XboxOneIsContentPackage: 0
+ XboxOneEnhancedXboxCompatibilityMode: 0
XboxOneEnableGPUVariability: 0
XboxOneSockets: {}
XboxOneSplashScreen: {fileID: 0}
@@ -645,10 +800,8 @@ PlayerSettings:
XboxOnePersistentLocalStorageSize: 0
XboxOneXTitleMemory: 8
XboxOneOverrideIdentityName:
- vrEditorSettings:
- daydream:
- daydreamIconForeground: {fileID: 0}
- daydreamIconBackground: {fileID: 0}
+ XboxOneOverrideIdentityPublisher:
+ vrEditorSettings: {}
cloudServicesEnabled:
UNet: 1
luminIcon:
@@ -662,12 +815,22 @@ PlayerSettings:
luminVersion:
m_VersionCode: 1
m_VersionName:
+ hmiPlayerDataPath:
+ hmiForceSRGBBlit: 1
+ embeddedLinuxEnableGamepadInput: 1
+ hmiLogStartupTiming: 0
+ hmiCpuConfiguration:
apiCompatibilityLevel: 6
+ activeInputHandler: 0
+ windowsGamepadBackendHint: 0
cloudProjectId:
framebufferDepthMemorylessMode: 0
+ qualitySettingsNames: []
projectName:
organizationId:
cloudEnabled: 0
- enableNativePlatformBackendsForNewInputSystem: 0
- disableOldInputManagerSupport: 0
legacyClampBlendShapeWeights: 1
+ hmiLoadingImage: {fileID: 0}
+ platformRequiresReadableAssets: 0
+ virtualTexturingSupportEnabled: 0
+ insecureHttpOption: 0
diff --git a/Unity.Mathematics.TestProject/ProjectSettings/ProjectVersion.txt b/Unity.Mathematics.TestProject/ProjectSettings/ProjectVersion.txt
index 798259ba..78a77889 100644
--- a/Unity.Mathematics.TestProject/ProjectSettings/ProjectVersion.txt
+++ b/Unity.Mathematics.TestProject/ProjectSettings/ProjectVersion.txt
@@ -1,2 +1,2 @@
-m_EditorVersion: 2019.3.0f6
-m_EditorVersionWithRevision: 2019.3.0f6 (27ab2135bccf)
+m_EditorVersion: 2022.3.7f1
+m_EditorVersionWithRevision: 2022.3.7f1 (b16b3b16c7a0)
diff --git a/Unity.Mathematics.TestProject/ProjectSettings/UnityConnectSettings.asset b/Unity.Mathematics.TestProject/ProjectSettings/UnityConnectSettings.asset
index fa0b1465..a88bee0f 100644
--- a/Unity.Mathematics.TestProject/ProjectSettings/UnityConnectSettings.asset
+++ b/Unity.Mathematics.TestProject/ProjectSettings/UnityConnectSettings.asset
@@ -9,6 +9,7 @@ UnityConnectSettings:
m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
m_ConfigUrl: https://config.uca.cloud.unity3d.com
+ m_DashboardUrl: https://dashboard.unity3d.com
m_TestInitMode: 0
CrashReportingSettings:
m_EventUrl: https://perf-events.cloud.unity3d.com
@@ -22,6 +23,7 @@ UnityConnectSettings:
m_Enabled: 0
m_TestMode: 0
m_InitializeOnStartup: 1
+ m_PackageRequiringCoreStatsPresent: 0
UnityAdsSettings:
m_Enabled: 0
m_InitializeOnStartup: 1
diff --git a/src/.npmignore b/src/.npmignore
index 72855d0d..e2e54865 100755
--- a/src/.npmignore
+++ b/src/.npmignore
@@ -10,7 +10,6 @@ QAReport.md
QAReport.md.meta
Unity.Mathematics.CodeGen*
Unity.Mathematics.PerformanceTests*
-Unity.Mathematics.Shaders*
*.sln*
*.db*
**/*.csproj*
diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md
index 7f0d7db1..595ffd52 100755
--- a/src/CHANGELOG.md
+++ b/src/CHANGELOG.md
@@ -1,30 +1,63 @@
# Changelog
## [Unreleased]
+* Added a documentation remark for Random NextFloat and NextDouble methods with a min and max parameter.
+
+## [1.3.2] - 2024-01-11
+
+### Fixed
+* Fixed `math.hash` crash when using IL2CPP builds on Arm 32 bit devices.
+* Fixed obsolete method usage warnings for `MatrixDrawer.CanCacheInspectorGUI` and `PrimitiveVectorDrawer.CanCacheInspectorGUI` in UNITY_2023_2_OR_NEWER.
+* Updated minimum editor version to 2021.3
+
+## [1.3.1] - 2023-07-12
+
+### Added
+* Added `math.square` to compute the square (x * x).
+* Added `math.orthonormal_basis` to compute an orthonormal basis from a single unit length vector.
+* Added `math.sign` for int, int2, int3 and int4.
+* Added `math.chgsign` for float, float2, float3, and float4.
+* Added `math.Euler` to convert a quaternion to Euler angles.
+* Added `math.angle` to compute the angle between two unit quaternions.
+* Added `math.rotation` to extract a quaternion rotation from a float3x3 (that may have scale).
+* Added `math.mulScale` to scale columns of a float3x3 with scaling coefficients in a float3.
+* Added `math.scaleMul` to scale rows of a float3x3 with scaling coefficients in a float3.
+* Added `AffineTransform` type.
+* Added `PI2`, `PIHALF`, `TAU`, `TODEGREES` and `TORADIANS` constants.
+
+### Changed
+* `asfloat(uint)`, `asuint(float)`, `asint(float)` and other related methods are now faster in mono without Burst. Other methods which use these will see a performance improvement.
+* Modified `quaternion.nlerp` to be branchless.
+* More descriptive parameter names for many methods in `math` class.
+* Made `Il2CppEagerStaticClassConstructionAttribute` internal to avoid conflicts with other definitions outside of the package.
+
+## [1.2.6] - 2022-02-11
+
+### Changed
+* Made Il2CppEagerStaticClassConstructionAttribute internal to avoid conflicts with other definitions outside of the package.
+
+## [1.2.5] - 2021-11-01
+
+### Fixed
+* Fixed property drawing when manually drawing a property that was hidden with [HideInInspector].
+
+## [1.2.4] - 2021-09-22
+
### Added
* Added `[Il2CppEagerStaticClassConstruction]` to Unity.Mathematics types to run static constructors at startup. This improves IL2CPP performance slightly for types that have static constructors.
-* Added `math.square()` to compute the square (x * x).
-* Added `math.orthonormal_basis()` to compute an orthonormal basis from a single unit length vector.
-* Added `math.sign(x)` for int, int2, int3 and int4.
### Changed
+* License file updated to satisfy Unity's package validation tests.
* Changed noise documentation in comments to xmldoc comments.
-### Deprecated
-### Removed
### Fixed
* Fixed Equals(object) override which did not check type before casting. This could cause exceptions to be thrown when the object did not match the expected type.
* Fixed incorrect `math.tzcnt` documentation which mentioned leading zero counts instead of trailing zero counts.
* Fixed `float2x2.Rotate` documentation to mention radians instead of degrees.
-
-### Internal (Not ready for production)
+* Fixed documentation for methods and properties that were previously undocumented.
## [1.2.1] - 2020-08-06
-### Added
-### Changed
-### Deprecated
-### Removed
### Fixed
* Fixed warnings for meta files existing even though the files they represent did not exist.
@@ -48,9 +81,6 @@
* Added some performance tests which can be run from the Unity test project.
* Added `Random.CreateFromIndex()` to assist in creating Random instances from loop indices.
-### Changed
-### Deprecated
-### Removed
### Fixed
* Fixed documentation bug where `quaternion.RotateX/Y/Z` referred to a `float4x4` instead of quaternion.
* Fixed code generation bugs which could cause Windows and Mac to generate different test code.
diff --git a/src/Documentation~/4x4-matrices.md b/src/Documentation~/4x4-matrices.md
new file mode 100644
index 00000000..266ec670
--- /dev/null
+++ b/src/Documentation~/4x4-matrices.md
@@ -0,0 +1,48 @@
+# 4×4 matrices
+
+To create a 4×4 transformation matrix, use the constructors in [`float4x4`](xref:Unity.Mathematics.float4x4) to assign one value to all elements of the matrix, or individually set all 16 elements directly:
+
+
+```c#
+// Unity Mathematics example
+void Build4x4UnityMathematics()
+{
+ var c0 = new float4(1.0f, 0.0f, 0.0f, 0.0f);
+ var c1 = new float4(0.0f, 1.0f, 0.0f, 0.0f);
+ var c2 = new float4(0.0f, 0.0f, 1.0f, 0.0f);
+ var c3 = new float4(0.0f, 0.0f, 0.0f, 1.0f);
+ var m = new float4x4(c0, c1, c2, c3);
+}
+```
+
+## Multiplying a 4×4 matrix
+
+Unity Mathematics and `UnityEngine` define the `*` operator differently. The `*` operator for [`float4x4`](xref:Unity.Mathematics.float4x4) implements componentwise multiplication. If you multiply a `float4x4` of all 1s with 0.5 on the diagonal, you get back the half identity because the upper and lower triangles of the matrix are multiplied by the respective zero entries from `f4x4_HalfIdentity`:
+
+```c#
+// Unity Mathematics example
+void OperatorMultiply4x4UnityMathematics()
+{
+ float4x4 result = f4x4_Ones * f4x4_HalfIdentity;
+ // result:
+ // 0.5, 0.0, 0.0, 0.0,
+ // 0.0, 0.5, 0.0, 0.0,
+ // 0.0, 0.0, 0.5, 0.0,
+ // 0.0, 0.0, 0.0, 0.5
+}
+```
+
+## Multiplying a 4×4 matrix and a 4D vector
+
+Use the [`math.mul`](xref:Unity.Mathematics.math.mul*) method to multiply a 4×4 matrix and a 4D vector. If you supply a `float4x4` as the first parameter and a `float4` as the second, it performs a 4×4 matrix multiplication with a 4×1 column vector, which returns a 4×1 column vector as a `float4`.
+
+`math.mul` can also multiply a 1×4 row vector by a 4×4 matrix to produce a 1×4 row vector by taking a `float4` as the first parameter and a `float4×4` as the second. Unity Mathematics stores the row vector in a `float4` and it isn't treated as a separate type.
+
+```c#
+// Unity Mathematics example
+void Multiply4x4AndVector4UnityMathematics()
+{
+ float4 result1 = math.mul(f4x4, f4); // 4x4 * 4x1 = 4x1
+ float4 result2 = math.mul(f4, f4x4); // 1x4 * 4x4 = 1x4
+}
+```
\ No newline at end of file
diff --git a/src/Documentation~/TableOfContents.md b/src/Documentation~/TableOfContents.md
new file mode 100644
index 00000000..1dc7d3b2
--- /dev/null
+++ b/src/Documentation~/TableOfContents.md
@@ -0,0 +1,8 @@
+* [Unity Mathematics](index.md)
+* [Compatibility with Mathf](compatibility.md)
+* [Getting started](getting-started.md)
+* Common operations
+ * [4×4 matrices](4x4-matrices.md)
+ * [Vector multiplication](vector-multiplication.md)
+ * [Quaternion multiplication](quaternion-multiplication.md)
+ * [Random numbers](random-numbers.md)
diff --git a/src/Documentation~/compatibility.md b/src/Documentation~/compatibility.md
new file mode 100644
index 00000000..9113e0a4
--- /dev/null
+++ b/src/Documentation~/compatibility.md
@@ -0,0 +1,17 @@
+# Compatibility with `UnityEngine` mathematics
+
+If you want to Burst-compile your project, it's best practice to use the Unity Mathematics package by default and only use `Mathf` when necessary. Unity Mathematics isn't implemented in the same way as the [`UnityEngine.Mathf`](https://docs.unity3d.com/ScriptReference/Mathf.html) struct in the core Unity engine. Because of this, if your application relies on the specific behaviors of `Mathf`, you'll have to reimplement them to get similar behavior in Unity Mathematics.
+
+>[!IMPORTANT]
+>For performance reasons, if your project uses the Mono compiler, you should continue to use the mathematical operations in `Mathf`, rather than Unity Mathematics.
+
+You can use both `Mathf` and Unity Mathematics methods in your project, but it might impact on the performance of your application because the conversions between the `UnityEngine` and `Unity.Mathematics` types such as `Vector3` to `float3` and vice-versa are performance-intensive.
+
+## Porting `UnityEngine` code to `Unity.Mathematics`
+
+If you want to migrate code from `UnityEngine` to `Unity.Mathematics`, you need to make the following changes first:
+
+* Update `UnityEngine` types to `Unity.Mathematics` types. For example, [`Vector4`](https://docs.unity3d.com/ScriptReference/Vector4.html) to [`float4`](xref:Unity.Mathematics.float4), and [`Quaternion`](https://docs.unity3d.com/ScriptReference/Quaternion.html) to [`quaternion`](xref:Unity.Mathematics.quaternion). These examples aren't exhaustive: see the [Scripting API reference](https://docs.unity3d.com/Packages/com.unity.mathematics@latest/index.html?subfolder=/api/index.html) for the full list of Unity Mathematics types available.
+* Update any operators involved in matrices or vectors. For example, the `Matrix4x4` multiplication operator implements matrix multiplication, but the `float4x4` multiplication operator implements componentwise multiplication.
+* Degrees to radians
+* How your code generates random numbers. `Random` in `Unity.Mathematics` works differently to [`Random`](https://docs.unity3d.com/ScriptReference/Random.html) in `UnityEngine`. You can completely control random number generation with `Random` in `Unity.Mathematics`, and it's instanced, rather than static. It's also exclusive with its upper bound, which is important to bear in mind if you want to convert `UnityEngine` code which is sensitive to the bounds. For more information, see the documentation on [Random numbers](random-numbers.md).
diff --git a/src/Documentation~/getting-started.md b/src/Documentation~/getting-started.md
new file mode 100644
index 00000000..7ed246e5
--- /dev/null
+++ b/src/Documentation~/getting-started.md
@@ -0,0 +1,29 @@
+# Getting started
+
+To use Unity Mathematics, add `using Unity.Mathematics` to your code:
+
+```C#
+using static Unity.Mathematics.math;
+namespace MyNamespace
+{
+ using Unity.Mathematics;
+
+ ...
+ var v1 = float3(1,2,3);
+ var v2 = float3(4,5,6);
+ v1 = normalize(v1);
+ v2 = normalize(v2);
+ var v3 = dot(v1, v2);
+ ...
+}
+```
+
+## Naming convention
+
+In C# `int` and `float` are built-in types. The Burst compiler extends this set of built-in types to also include vectors, matrices, and quaternions. These types are built-in because the Burst compiler already has implementations of these types, and so can use them to generate better code than for custom types.
+
+To signify that these types are built-in their type names are in all lower case. The operators on these built-in types in [`Unity.Mathematics.math`](xref:Unity.Mathematics.math) are intrinsics and are always in lower case.
+
+There are no plans to extend the set of intrinsic types beyond the current set of vectors (`typeN`), matrices (`typeNxN`) and quaternions (`quaternion`).
+
+This convention has the added benefit of making the library highly compatible with shader code and makes porting or sharing code between the two almost frictionless.
diff --git a/src/Documentation~/index.md b/src/Documentation~/index.md
new file mode 100644
index 00000000..0b61abb2
--- /dev/null
+++ b/src/Documentation~/index.md
@@ -0,0 +1,30 @@
+# Unity Mathematics
+
+Unity Mathematics is a C# math library that provides vector types and math functions that have a shader-like
+syntax, similar to [SIMD](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data) or [HLSL](https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl). The [Burst compiler](https://docs.unity3d.com/Packages/com.unity.burst@latest) uses Unity Mathematics to compile C#/IL code into highly efficient native code.
+
+It implements the following vector and matrix types:
+
+* floatN, quaternion
+* float3×3, float4×4
+
+Plus elementary functions:
+* min, max, fabs, etc.
+* sin, cos, sqrt, normalize, dot, cross, etc.
+
+## Installation
+
+You can install the Mathematics package through Unity's Package Manager. For more information, see the Unity User Manual documentation on [Adding and removing packages](https://docs.unity3d.com/Manual/upm-ui-actions.html).
+
+>[!IMPORTANT]
+>From Unity 6.5, Unity Mathematics is a built-in module of the core Editor and Engine and its APIs are available to user code by default in the `Unity.Mathematics` namespace, with no package installation required. Accordingly, from Unity 6.5 the Unity Mathematics API documentation is part of the [core Scripting API reference](https://docs.unity3d.com/ScriptReference/Unity.Mathematics.math.html), and the user manual is integrated with [the core Unity user manual](https://docs.unity3d.com/Manual/unity-mathematics.html).
+
+### Editor config
+
+Unity Mathematics uses [editorconfig](http://editorconfig.org/) to keep files formatted for EOL and spaces.
+
+Your IDE should have support for `editorconfig`. If it doesn't, you can get the extension for it here:
+
+* [VS2015/VS2017 EditorConfig extension](https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig)
+* [Visual Studio Code EditorConfig extension](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
+* [SublimeText EditorConfig extension](https://github.com/sindresorhus/editorconfig-sublime)
diff --git a/src/Documentation~/mathematics.md b/src/Documentation~/mathematics.md
deleted file mode 100644
index 992642fc..00000000
--- a/src/Documentation~/mathematics.md
+++ /dev/null
@@ -1,79 +0,0 @@
-# Unity.Mathematics
-
-A C# math library providing vector types and math functions with a shader like
-syntax. Used by the Burst compiler to compile C#/IL to highly efficient
-native code.
-
-The main goal of this library is to provide a friendly Math API familiar to SIMD and graphic/shaders developers, using the well known `float4`, `float3` types...etc. with all intrinsics functions provided by a static class `math` that can be imported easily into your C# program with `using static Unity.Mathematics.math`.
-
-In addition to this, the Burst compiler is able to recognize these types and provide the optimized SIMD type for the running CPU on all supported platforms (x64, ARMv7a...etc.)
-
-NOTICE: The API is a work in progress and we may introduce breaking changes (API and underlying behavior)
-
-## Usage
-
-You can use this library in your Unity game by using the Package Manager and referencing the package `com.unity.mathematics`. See the forum [Welcome](https://forum.unity.com/threads/welcome.522627) page for more details.
-
-```C#
-using static Unity.Mathematics.math;
-namespace MyNamespace
-{
- using Unity.Mathematics;
-
- ...
- var v1 = float3(1,2,3);
- var v2 = float3(4,5,6);
- v1 = normalize(v1);
- v2 = normalize(v2);
- var v3 = dot(v1, v2);
- ...
-}
-```
-
-## Building
-
-Open the `src\Unity.Mathematics.sln` under Visual Studio 2015 or MonoDevelop and compile in Debug\Release.
-
-## Contributing
-
-We don't yet accept PR on this repository. See the FAQ below.
-
-The project is using [editorconfig](http://editorconfig.org/) to keep files correctly formatted for EOL and spaces.
-
-We assume that your IDE has support for `editorconfig`, you can download the following extensions if your IDE is listed:
-
-- [VS2015/VS2017 EditorConfig extension](https://marketplace.visualstudio.com/items?itemName=EditorConfigTeam.EditorConfig)
-- [Visual Studio Code EditorConfig extension](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
-- [SublimeText EditorConfig extension](https://github.com/sindresorhus/editorconfig-sublime)
-
-## Frequently Asked Question
-
-### Why developing another Math library instead of using existing Unity Vector3...etc.?
-
-After years of feedback and experience with the previous API, we believe that providing an API that is closer to the way graphics developers have been using math libraries should better help its adoption and the ease of its usage. HLSL / GLSL math library is a very well designed, well understood math library leading to greater consistency.
-
-### Why not using `System.Numerics.Vectors`?
-
-Mainly for the reason mentioned above, `System.Numerics.Vectors` is in many ways similar to our previous Vector library (more object oriented than graphics programming oriented).
-Also the fact that our Burst compiler is able to recognize a lot more patterns for SIMD types and math intrinsics makes it easier to work with a dedicated API that reflects this ability.
-
-### Naming convention
-
-In C# `int` and `float` are considered builtin types. Burst extends this set of bultin types to also include vectors, matrices and quaternions. These types are bultin in the sense that Burst knows about them and is be able to generate better code using these types than what would be possible with equivalent code using custom types.
-
-To signify that these types are bultin their type names are in all lower case. The operators on these bultin types found in `Unity.Mathematics.math` are considered intrinsics and are thus always in lower case.
-
-There are no plans to extend the set of intrinsic types beyond the current set of vectors (`typeN`), matrices (`typeNxN`) and quaternions (`quaternion`).
-
-This convention has the added benefit of making the library highly compatible with shader code and makes porting or sharing code between the two almost frictionless.
-
-### Why can't we send a PR yet?
-
-We are working on providing a Contributor License Agreement (CLA) with a sign-over functionality and our UCL License doesn't cover this yet.
-
-## Licensing
-
-Unity Companion License (“License”) Software Copyright © 2019 Unity Technologies ApS
-
-For licensing details see [LICENSE.md](LICENSE.md)
-
diff --git a/src/Documentation~/quaternion-multiplication.md b/src/Documentation~/quaternion-multiplication.md
new file mode 100644
index 00000000..d6f70f4d
--- /dev/null
+++ b/src/Documentation~/quaternion-multiplication.md
@@ -0,0 +1,17 @@
+# Quaternion multiplication
+
+To rotate a quaternion, use the [`AxisAngle`](xref:Unity.Mathematics.quaternion.AxisAngle*) method. You need to specify the axis of rotation and the angle of rotation, in that order. All are in radians rather than degrees. `math.mul` multiplies the quaternion, just as with [matrices](4x4-matrices.md) and vectors.
+
+```c#
+// Unity Mathematics example
+void QuaternionMultiplicationUnityMathematics()
+{
+ var axis = new float3(0.0f, 1.0f, 0.0f);
+ var q = quaternion.AxisAngle(axis,math.radians(45.0f));
+ var orientation = quaternion.Euler(
+ math.radians(45.0f),
+ math.radians(90.0f),
+ math.radians(180.0f));
+ var result = math.mul(q, orientation);
+}
+```
diff --git a/src/Documentation~/random-numbers.md b/src/Documentation~/random-numbers.md
new file mode 100644
index 00000000..5a09e9d9
--- /dev/null
+++ b/src/Documentation~/random-numbers.md
@@ -0,0 +1,21 @@
+## Random numbers
+
+To generate random numbers, you must create and manage the random number generator state yourself with the [`Random`](xref:Unity.Mathematics.Random) struct. You can control the random number generator state explicitly, which is useful if you're using parallel code, or if you want to make sure that one source of random numbers is seeded differently than another source. You can also have as many `Random` instances as you like.
+
+Once you set up the state, use [`NextFloat`](xref:Unity.Mathematics.Random.NextFloat) to get random floats. By default it returns random numbers between `[0, 1)`, exclusive:
+
+```c#
+// Unity Mathematics example
+void RandomNumberUnityMathematics()
+{
+ // Choose some non-zero seed and set up the random number generator state.
+ uint seed = 1;
+ Unity.Mathematics.Random rng = new Unity.Mathematics.Random(seed);
+
+ // [0, 1) exclusive
+ float randomFloat1 = rng.NextFloat();
+
+ // [-5, 5) exclusive
+ float randomFloat2 = rng.NextFloat(-5.0f, 5.0f);
+}
+```
diff --git a/src/Documentation~/vector-multiplication.md b/src/Documentation~/vector-multiplication.md
new file mode 100644
index 00000000..123fe6bb
--- /dev/null
+++ b/src/Documentation~/vector-multiplication.md
@@ -0,0 +1,16 @@
+# Vector multiplication
+
+To multiply vectors, use the `*`:
+
+```c#
+// Unity Mathematics example
+void ComponentwiseVectorMultiplyUnityMathematics()
+{
+ var v0 = new float4(2.0f, 4.0f, 6.0f, 8.0f);
+ var v1 = new float4(1.0f, -1.0f, 1.0f, -1.0f);
+ var result = v0 * v1;
+ // result == new float4(2.0f, -4.0f, 6.0f, -8.0f).
+}
+```
+
+This is a common way of writing [SIMD](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data) code, which applies a single instruction to multiple data elements. Other operators such as addition, subtraction, and division work in the same way.
\ No newline at end of file
diff --git a/src/LICENSE.md b/src/LICENSE.md
index 311c9904..1f5c0f44 100755
--- a/src/LICENSE.md
+++ b/src/LICENSE.md
@@ -1,30 +1,4 @@
-Unity Companion License (“License”)
-Software Copyright © 2019 Unity Technologies ApS
-
-Unity Technologies ApS (“Unity”) grants to you a worldwide, non-exclusive, no-charge, and royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the software that is made available under this License (“Software”), subject to the following terms and conditions:
-
-1. Unity Companion Use Only. Exercise of the license granted herein is limited to exercise for the creation, use, and/or distribution of applications, software, or other content pursuant to a valid Unity content authoring and rendering engine software license (“Engine License”). That means while use of the Software is not limited to use in the software licensed under the Engine License, the Software may not be used for any purpose other than the creation, use, and/or distribution of Engine License-dependent applications, software, or other content. No other exercise of the license granted herein is permitted, and in no event may the Software be used for competitive analysis or to develop a competing product or service.
-
-2. No Modification of Engine License. Neither this License nor any exercise of the license granted herein modifies the Engine License in any way.
-
-3. Ownership & Grant Back to You.
+com.unity.mathematics copyright © 2023 Unity Technologies ApS
-3.1 You own your content. In this License, “derivative works” means derivatives of the Software itself--works derived only from the Software by you under this License (for example, modifying the code of the Software itself to improve its efficacy); “derivative works” of the Software do not include, for example, games, apps, or content that you create using the Software. You keep all right, title, and interest to your own content.
-
-3.2 Unity owns its content. While you keep all right, title, and interest to your own content per the above, as between Unity and you, Unity will own all right, title, and interest to all intellectual property rights (including patent, trademark, and copyright) in the Software and derivative works of the Software, and you hereby assign and agree to assign all such rights in those derivative works to Unity.
-
-3.3 You have a license to those derivative works. Subject to this License, Unity grants to you the same worldwide, non-exclusive, no-charge, and royalty-free copyright license to derivative works of the Software you create as is granted to you for the Software under this License.
-
-4. Trademarks. You are not granted any right or license under this License to use any trademarks, service marks, trade names, products names, or branding of Unity or its affiliates (“Trademarks”). Descriptive uses of Trademarks are permitted; see, for example, Unity’s Branding Usage Guidelines at https://unity3d.com/public-relations/brand.
-
-5. Notices & Third-Party Rights. This License, including the copyright notice associated with the Software, must be provided in all substantial portions of the Software and derivative works thereof (or, if that is impracticable, in any other location where such notices are customarily placed). Further, if the Software is accompanied by a Unity “third-party notices” or similar file, you acknowledge and agree that software identified in that file is governed by those separate license terms.
-
-6. DISCLAIMER, LIMITATION OF LIABILITY. THE SOFTWARE AND ANY DERIVATIVE WORKS THEREOF IS PROVIDED ON AN "AS IS" BASIS, AND IS PROVIDED WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND/OR NONINFRINGEMENT. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES (WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL, INCLUDING PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS, AND BUSINESS INTERRUPTION), OR OTHER LIABILITY WHATSOEVER, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM OR OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR ANY DERIVATIVE WORKS THEREOF OR THE USE OF OR OTHER DEALINGS IN SAME, EVEN WHERE ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-7. USE IS ACCEPTANCE and License Versions. Your receipt and use of the Software constitutes your acceptance of this License and its terms and conditions. Software released by Unity under this License may be modified or updated and the License with it; upon any such modification or update, you will comply with the terms of the updated License for any use of any of the Software under the updated License.
-
-8. Use in Compliance with Law and Termination. Your exercise of the license granted herein will at all times be in compliance with applicable law and will not infringe any proprietary rights (including intellectual property rights); this License will terminate immediately on any breach by you of this License.
-
-9. Severability. If any provision of this License is held to be unenforceable or invalid, that provision will be enforced to the maximum extent possible and the other provisions will remain in full force and effect.
-
-10. Governing Law and Venue. This License is governed by and construed in accordance with the laws of Denmark, except for its conflict of laws rules; the United Nations Convention on Contracts for the International Sale of Goods will not apply. If you reside (or your principal place of business is) within the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the state and federal courts located in San Francisco County, California concerning any dispute arising out of this License (“Dispute”). If you reside (or your principal place of business is) outside the United States, you and Unity agree to submit to the personal and exclusive jurisdiction of and venue in the courts located in Copenhagen, Denmark concerning any Dispute.
\ No newline at end of file
+Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license).
+Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions.
\ No newline at end of file
diff --git a/src/Tests/Tests/Shared/TestAffineTransform.cs b/src/Tests/Tests/Shared/TestAffineTransform.cs
new file mode 100644
index 00000000..b663fd65
--- /dev/null
+++ b/src/Tests/Tests/Shared/TestAffineTransform.cs
@@ -0,0 +1,173 @@
+using NUnit.Framework;
+using static Unity.Mathematics.math;
+using Burst.Compiler.IL.Tests;
+
+namespace Unity.Mathematics.Tests
+{
+ [TestFixture]
+ class TestAffineTransform
+ {
+ [TestCompiler]
+ public static void affine_transform_construct_from_float3x3()
+ {
+ const float tolerance = 1e-6f;
+
+ float3x3 m3x3 = TestMatrix.test3x3_zyx;
+ AffineTransform tx = AffineTransform(m3x3);
+
+ float3x3 testM3x3 = float3x3(tx);
+
+ TestUtils.AreEqual(m3x3, testM3x3, tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_construct_from_float3x4()
+ {
+ const float tolerance = 1e-6f;
+
+ float3x4 m3x4 = float3x4(TestMatrix.test3x3_zyx.c0, TestMatrix.test3x3_zyx.c1, TestMatrix.test3x3_zyx.c2, float3(1f, 2f, 3f));
+ AffineTransform tx = AffineTransform(m3x4);
+
+ float3x4 testM3x4 = float3x4(tx);
+
+ TestUtils.AreEqual(m3x4, testM3x4, tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_construct_from_float4x4()
+ {
+ const float tolerance = 1e-6f;
+
+ float4x4 m4x4 = TestMatrix.test4x4_zyx;
+ AffineTransform tx = AffineTransform(m4x4);
+
+ float4x4 testM4x4 = float4x4(tx);
+
+ TestUtils.AreEqual(m4x4, testM4x4, tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_construct_from_RigidTransform()
+ {
+ const float tolerance = 1e-6f;
+
+ RigidTransform r = RigidTransform(TestMatrix.test4x4_xyz);
+ AffineTransform tx = AffineTransform(r);
+
+ TestUtils.AreEqual(math.float3x3(r.rot), tx.rs, tolerance);
+ TestUtils.AreEqual(r.pos, tx.t, tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_inverse()
+ {
+ const float tolerance = 1e-6f;
+
+ var tx = AffineTransform(float3(5f, 6f, 7f), normalize(math.float4(1f, 2f, 3f, 4f)), float3(2f, 3f, 4f));
+ var invTx = inverse(tx);
+
+ TestUtils.AreEqual(float4x4.identity, mul(tx, invTx), tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_inverse_zero_rs_returns_zero()
+ {
+ const float tolerance = 1e-30f;
+
+ var tx = AffineTransform(float3(5f, 6f, 7f), normalize(float4(1f, 2f, 3f, 4f)), float3.zero);
+ var invTx = inverse(tx);
+
+ TestUtils.AreEqual(float3x4.zero, invTx, tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_inverse_pico_scale()
+ {
+ // slightly larger tolerance (vs 1e-6f) for PS4
+ const float tolerance = 2e-6f;
+
+ var tx = AffineTransform(float3(5f, 6f, 7f), normalize(float4(1f, 2f, 3f, 4f)), float3(1e-12f, 1e-12f, 1e-12f));
+ var invTx = inverse(tx);
+
+ TestUtils.AreEqual(float4x4.identity, mul(tx, invTx), tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_inverse_singular()
+ {
+ // it needs a bit larger tolerance for singular
+ // since it uses the svd iterative solver
+ const float tolerance = 1e-1f;
+
+ var tx = AffineTransform(float3(5f, 6f, 7f), normalize(float4(1f, 2f, 3f, 4f)), float3(0f, 3f, 4f));
+ var invTx = inverse(tx);
+
+ // pseudo inverse penrose #1 test
+ var testTx = mul(mul(tx, invTx), tx);
+ TestUtils.AreEqual(float4x4(tx), float4x4(testTx), tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_decompose()
+ {
+ const float tolerance = 1e-6f;
+
+ var tx = AffineTransform(float3(5f, 6f, 7f), normalize(float4(1f, 2f, 3f, 4f)), float3(2f, 3f, 4f));
+ decompose(tx, out var t, out var r, out var s);
+
+ // Recompose matrix
+ var testTx = AffineTransform(t, r, s);
+ TestUtils.AreEqual(float4x4(tx), float4x4(testTx), tolerance);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_mul_vector()
+ {
+ float4x4 m = TestMatrix.test4x4_xyz;
+ AffineTransform tx = AffineTransform(m);
+
+ float3 vector = float3(1.1f, -2.2f, 3.5f);
+
+ float4 mvector0 = mul(m, float4(vector, 0f));
+ float4 txvector0 = mul(tx, float4(vector, 0f));
+ TestUtils.AreEqual(mvector0, txvector0, 0.0001f);
+
+ float4 mvector1 = mul(m, float4(vector, 1f));
+ float4 txvector1 = mul(tx, float4(vector, 1f));
+ TestUtils.AreEqual(mvector1, txvector1, 0.0001f);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_rotate_vector()
+ {
+ float3x3 m = TestMatrix.test3x3_xyz;
+ AffineTransform tx = AffineTransform(m);
+
+ float3 vector = float3(1.1f, -2.2f, 3.5f);
+
+ float3 mvector0 = mul(m, vector);
+ float3 txvector0 = rotate(tx, vector);
+ TestUtils.AreEqual(mvector0, txvector0, 0.0001f);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_transform_point()
+ {
+ float4x4 m = float4x4(TestMatrix.test3x3_zyx, float3(1f, 2f, 3f));
+ AffineTransform tx = AffineTransform(m);
+
+ float3 pt = float3(1.1f, -2.2f, 3.5f);
+
+ float3 mPt0 = transform(m, pt);
+ float3 txPt0 = transform(tx, pt);
+ TestUtils.AreEqual(mPt0, txPt0, 0.0001f);
+ }
+
+ [TestCompiler]
+ public static void affine_transform_zero()
+ {
+ TestUtils.AreEqual(float3x3.zero, AffineTransform.zero.rs);
+ TestUtils.AreEqual(float3.zero, AffineTransform.zero.t);
+ }
+ }
+}
diff --git a/src/Unity.Mathematics.Shaders/hlsl.cs.meta b/src/Tests/Tests/Shared/TestAffineTransform.cs.meta
similarity index 83%
rename from src/Unity.Mathematics.Shaders/hlsl.cs.meta
rename to src/Tests/Tests/Shared/TestAffineTransform.cs.meta
index 9b45b04e..01d27e82 100644
--- a/src/Unity.Mathematics.Shaders/hlsl.cs.meta
+++ b/src/Tests/Tests/Shared/TestAffineTransform.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: f1451d4ccf06c1c4aa11ee0097e37220
+guid: 534e18de5e70ccf468bf46c917dfdac4
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/src/Tests/Tests/Shared/TestBool2.gen.cs b/src/Tests/Tests/Shared/TestBool2.gen.cs
index 3546ddd3..11c32ff2 100644
--- a/src/Tests/Tests/Shared/TestBool2.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool2.gen.cs
@@ -427,7 +427,7 @@ public static void bool2_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool2_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool2x2.gen.cs b/src/Tests/Tests/Shared/TestBool2x2.gen.cs
index dbfd2fa1..1646031c 100644
--- a/src/Tests/Tests/Shared/TestBool2x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool2x2.gen.cs
@@ -395,7 +395,7 @@ public static void bool2x2_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool2x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool2x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool2x3.gen.cs b/src/Tests/Tests/Shared/TestBool2x3.gen.cs
index e0f8f2d3..8157a008 100644
--- a/src/Tests/Tests/Shared/TestBool2x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool2x3.gen.cs
@@ -395,7 +395,7 @@ public static void bool2x3_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool2x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool2x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool2x4.gen.cs b/src/Tests/Tests/Shared/TestBool2x4.gen.cs
index 4200e9ee..fdfdb454 100644
--- a/src/Tests/Tests/Shared/TestBool2x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool2x4.gen.cs
@@ -395,7 +395,7 @@ public static void bool2x4_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool2x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool2x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool3.gen.cs b/src/Tests/Tests/Shared/TestBool3.gen.cs
index e6b69c43..ee345f1e 100644
--- a/src/Tests/Tests/Shared/TestBool3.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool3.gen.cs
@@ -431,7 +431,7 @@ public static void bool3_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool3_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool3x2.gen.cs b/src/Tests/Tests/Shared/TestBool3x2.gen.cs
index d41f918c..816c30fd 100644
--- a/src/Tests/Tests/Shared/TestBool3x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool3x2.gen.cs
@@ -395,7 +395,7 @@ public static void bool3x2_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool3x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool3x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool3x3.gen.cs b/src/Tests/Tests/Shared/TestBool3x3.gen.cs
index 4a2301d9..6c5b1b9b 100644
--- a/src/Tests/Tests/Shared/TestBool3x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool3x3.gen.cs
@@ -395,7 +395,7 @@ public static void bool3x3_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool3x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool3x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool3x4.gen.cs b/src/Tests/Tests/Shared/TestBool3x4.gen.cs
index c0981361..8d7d6245 100644
--- a/src/Tests/Tests/Shared/TestBool3x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool3x4.gen.cs
@@ -395,7 +395,7 @@ public static void bool3x4_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool3x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool3x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool4.gen.cs b/src/Tests/Tests/Shared/TestBool4.gen.cs
index 69e823ab..c2c8be05 100644
--- a/src/Tests/Tests/Shared/TestBool4.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool4.gen.cs
@@ -435,7 +435,7 @@ public static void bool4_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool4_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool4x2.gen.cs b/src/Tests/Tests/Shared/TestBool4x2.gen.cs
index 0a2a54ca..40511294 100644
--- a/src/Tests/Tests/Shared/TestBool4x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool4x2.gen.cs
@@ -395,7 +395,7 @@ public static void bool4x2_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool4x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool4x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool4x3.gen.cs b/src/Tests/Tests/Shared/TestBool4x3.gen.cs
index 8be23641..ea0d9fe2 100644
--- a/src/Tests/Tests/Shared/TestBool4x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool4x3.gen.cs
@@ -395,7 +395,7 @@ public static void bool4x3_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool4x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool4x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestBool4x4.gen.cs b/src/Tests/Tests/Shared/TestBool4x4.gen.cs
index c83c5d8d..11b5e424 100644
--- a/src/Tests/Tests/Shared/TestBool4x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestBool4x4.gen.cs
@@ -395,7 +395,7 @@ public static void bool4x4_operator_logical_not()
TestUtils.AreEqual(r3, !a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void bool4x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new bool4x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble2.gen.cs b/src/Tests/Tests/Shared/TestDouble2.gen.cs
index cd44e120..f07b51f5 100644
--- a/src/Tests/Tests/Shared/TestDouble2.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble2.gen.cs
@@ -1050,7 +1050,7 @@ public static void double2_shuffle_result_4()
TestUtils.AreEqual(double4(2, 0, 0, 0), shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double2_EqualsObjectOverride()
{
TestUtils.IsFalse(new double2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble2x2.gen.cs b/src/Tests/Tests/Shared/TestDouble2x2.gen.cs
index c7fc90d5..5b035267 100644
--- a/src/Tests/Tests/Shared/TestDouble2x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble2x2.gen.cs
@@ -945,7 +945,7 @@ public static void double2x2_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double2x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new double2x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble2x3.gen.cs b/src/Tests/Tests/Shared/TestDouble2x3.gen.cs
index d95bba8d..0b5cb5cf 100644
--- a/src/Tests/Tests/Shared/TestDouble2x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble2x3.gen.cs
@@ -938,7 +938,7 @@ public static void double2x3_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double2x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new double2x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble2x4.gen.cs b/src/Tests/Tests/Shared/TestDouble2x4.gen.cs
index aac05afe..c519d6f4 100644
--- a/src/Tests/Tests/Shared/TestDouble2x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble2x4.gen.cs
@@ -940,7 +940,7 @@ public static void double2x4_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double2x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new double2x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble3.gen.cs b/src/Tests/Tests/Shared/TestDouble3.gen.cs
index cc53ddbf..59b1478b 100644
--- a/src/Tests/Tests/Shared/TestDouble3.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble3.gen.cs
@@ -1057,7 +1057,7 @@ public static void double3_shuffle_result_4()
TestUtils.AreEqual(double4(2, 5, 0, 4), shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.RightY));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double3_EqualsObjectOverride()
{
TestUtils.IsFalse(new double3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble3x2.gen.cs b/src/Tests/Tests/Shared/TestDouble3x2.gen.cs
index 382e68b6..0fd677a3 100644
--- a/src/Tests/Tests/Shared/TestDouble3x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble3x2.gen.cs
@@ -938,7 +938,7 @@ public static void double3x2_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double3x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new double3x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble3x3.gen.cs b/src/Tests/Tests/Shared/TestDouble3x3.gen.cs
index 56364618..d066be3d 100644
--- a/src/Tests/Tests/Shared/TestDouble3x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble3x3.gen.cs
@@ -955,7 +955,7 @@ public static void double3x3_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double3x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new double3x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble3x4.gen.cs b/src/Tests/Tests/Shared/TestDouble3x4.gen.cs
index c54ef5be..03ea5969 100644
--- a/src/Tests/Tests/Shared/TestDouble3x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble3x4.gen.cs
@@ -944,7 +944,7 @@ public static void double3x4_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double3x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new double3x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble4.gen.cs b/src/Tests/Tests/Shared/TestDouble4.gen.cs
index 2d907e2a..0344dae9 100644
--- a/src/Tests/Tests/Shared/TestDouble4.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble4.gen.cs
@@ -1064,7 +1064,7 @@ public static void double4_shuffle_result_4()
TestUtils.AreEqual(double4(3, 7, 1, 5), shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.LeftY, ShuffleComponent.RightY));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double4_EqualsObjectOverride()
{
TestUtils.IsFalse(new double4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble4x2.gen.cs b/src/Tests/Tests/Shared/TestDouble4x2.gen.cs
index 0e02dc29..80b2e856 100644
--- a/src/Tests/Tests/Shared/TestDouble4x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble4x2.gen.cs
@@ -940,7 +940,7 @@ public static void double4x2_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double4x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new double4x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble4x3.gen.cs b/src/Tests/Tests/Shared/TestDouble4x3.gen.cs
index 66d6e952..6debf3f6 100644
--- a/src/Tests/Tests/Shared/TestDouble4x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble4x3.gen.cs
@@ -944,7 +944,7 @@ public static void double4x3_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double4x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new double4x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestDouble4x4.gen.cs b/src/Tests/Tests/Shared/TestDouble4x4.gen.cs
index bd638617..3fcaff74 100644
--- a/src/Tests/Tests/Shared/TestDouble4x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestDouble4x4.gen.cs
@@ -969,7 +969,7 @@ public static void double4x4_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void double4x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new double4x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat2.gen.cs b/src/Tests/Tests/Shared/TestFloat2.gen.cs
index b14288cc..885cbf2c 100644
--- a/src/Tests/Tests/Shared/TestFloat2.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat2.gen.cs
@@ -1050,7 +1050,7 @@ public static void float2_shuffle_result_4()
TestUtils.AreEqual(float4(2, 0, 0, 0), shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float2_EqualsObjectOverride()
{
TestUtils.IsFalse(new float2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat2x2.gen.cs b/src/Tests/Tests/Shared/TestFloat2x2.gen.cs
index 5b818da7..b56dd1c0 100644
--- a/src/Tests/Tests/Shared/TestFloat2x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat2x2.gen.cs
@@ -945,7 +945,7 @@ public static void float2x2_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float2x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new float2x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat2x3.gen.cs b/src/Tests/Tests/Shared/TestFloat2x3.gen.cs
index 8a93998c..ee756468 100644
--- a/src/Tests/Tests/Shared/TestFloat2x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat2x3.gen.cs
@@ -938,7 +938,7 @@ public static void float2x3_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float2x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new float2x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat2x4.gen.cs b/src/Tests/Tests/Shared/TestFloat2x4.gen.cs
index d959a802..769a761e 100644
--- a/src/Tests/Tests/Shared/TestFloat2x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat2x4.gen.cs
@@ -940,7 +940,7 @@ public static void float2x4_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float2x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new float2x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat3.gen.cs b/src/Tests/Tests/Shared/TestFloat3.gen.cs
index 48c5b1a4..29bbf5a0 100644
--- a/src/Tests/Tests/Shared/TestFloat3.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat3.gen.cs
@@ -1057,7 +1057,7 @@ public static void float3_shuffle_result_4()
TestUtils.AreEqual(float4(2, 5, 0, 4), shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.RightY));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float3_EqualsObjectOverride()
{
TestUtils.IsFalse(new float3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat3x2.gen.cs b/src/Tests/Tests/Shared/TestFloat3x2.gen.cs
index a497e7be..a9fcca5b 100644
--- a/src/Tests/Tests/Shared/TestFloat3x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat3x2.gen.cs
@@ -938,7 +938,7 @@ public static void float3x2_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float3x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new float3x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat3x3.gen.cs b/src/Tests/Tests/Shared/TestFloat3x3.gen.cs
index 37e72288..7561ab09 100644
--- a/src/Tests/Tests/Shared/TestFloat3x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat3x3.gen.cs
@@ -955,7 +955,7 @@ public static void float3x3_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float3x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new float3x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat3x4.gen.cs b/src/Tests/Tests/Shared/TestFloat3x4.gen.cs
index 57e75392..b688cda8 100644
--- a/src/Tests/Tests/Shared/TestFloat3x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat3x4.gen.cs
@@ -944,7 +944,7 @@ public static void float3x4_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float3x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new float3x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat4.gen.cs b/src/Tests/Tests/Shared/TestFloat4.gen.cs
index eec3bd88..1e0d3ab1 100644
--- a/src/Tests/Tests/Shared/TestFloat4.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat4.gen.cs
@@ -1064,7 +1064,7 @@ public static void float4_shuffle_result_4()
TestUtils.AreEqual(float4(3, 7, 1, 5), shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.LeftY, ShuffleComponent.RightY));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float4_EqualsObjectOverride()
{
TestUtils.IsFalse(new float4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat4x2.gen.cs b/src/Tests/Tests/Shared/TestFloat4x2.gen.cs
index ef36f471..9b0cd505 100644
--- a/src/Tests/Tests/Shared/TestFloat4x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat4x2.gen.cs
@@ -940,7 +940,7 @@ public static void float4x2_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float4x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new float4x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat4x3.gen.cs b/src/Tests/Tests/Shared/TestFloat4x3.gen.cs
index f14618d1..f2d4f21f 100644
--- a/src/Tests/Tests/Shared/TestFloat4x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat4x3.gen.cs
@@ -944,7 +944,7 @@ public static void float4x3_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float4x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new float4x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestFloat4x4.gen.cs b/src/Tests/Tests/Shared/TestFloat4x4.gen.cs
index cc444939..1e706448 100644
--- a/src/Tests/Tests/Shared/TestFloat4x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestFloat4x4.gen.cs
@@ -969,7 +969,7 @@ public static void float4x4_operator_postfix_dec()
TestUtils.AreEqual(r3, a3--);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void float4x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new float4x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt2.gen.cs b/src/Tests/Tests/Shared/TestInt2.gen.cs
index 78c07923..75f6aba0 100644
--- a/src/Tests/Tests/Shared/TestInt2.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt2.gen.cs
@@ -1334,7 +1334,7 @@ public static void int2_shuffle_result_4()
TestUtils.AreEqual(int4(2, 0, 0, 0), shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int2_EqualsObjectOverride()
{
TestUtils.IsFalse(new int2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt2x2.gen.cs b/src/Tests/Tests/Shared/TestInt2x2.gen.cs
index 517c4586..754451d3 100644
--- a/src/Tests/Tests/Shared/TestInt2x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt2x2.gen.cs
@@ -1229,7 +1229,7 @@ public static void int2x2_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int2x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new int2x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt2x3.gen.cs b/src/Tests/Tests/Shared/TestInt2x3.gen.cs
index e6b88941..8e25e359 100644
--- a/src/Tests/Tests/Shared/TestInt2x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt2x3.gen.cs
@@ -1222,7 +1222,7 @@ public static void int2x3_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int2x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new int2x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt2x4.gen.cs b/src/Tests/Tests/Shared/TestInt2x4.gen.cs
index f9650035..3fd7b8b3 100644
--- a/src/Tests/Tests/Shared/TestInt2x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt2x4.gen.cs
@@ -1224,7 +1224,7 @@ public static void int2x4_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int2x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new int2x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt3.gen.cs b/src/Tests/Tests/Shared/TestInt3.gen.cs
index 29f8ec66..7dac46ed 100644
--- a/src/Tests/Tests/Shared/TestInt3.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt3.gen.cs
@@ -1341,7 +1341,7 @@ public static void int3_shuffle_result_4()
TestUtils.AreEqual(int4(2, 5, 0, 4), shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.RightY));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int3_EqualsObjectOverride()
{
TestUtils.IsFalse(new int3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt3x2.gen.cs b/src/Tests/Tests/Shared/TestInt3x2.gen.cs
index 11b9edb4..db159df9 100644
--- a/src/Tests/Tests/Shared/TestInt3x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt3x2.gen.cs
@@ -1222,7 +1222,7 @@ public static void int3x2_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int3x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new int3x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt3x3.gen.cs b/src/Tests/Tests/Shared/TestInt3x3.gen.cs
index e5b804e0..5d82264a 100644
--- a/src/Tests/Tests/Shared/TestInt3x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt3x3.gen.cs
@@ -1239,7 +1239,7 @@ public static void int3x3_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int3x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new int3x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt3x4.gen.cs b/src/Tests/Tests/Shared/TestInt3x4.gen.cs
index 254a797c..f9b43392 100644
--- a/src/Tests/Tests/Shared/TestInt3x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt3x4.gen.cs
@@ -1228,7 +1228,7 @@ public static void int3x4_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int3x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new int3x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt4.gen.cs b/src/Tests/Tests/Shared/TestInt4.gen.cs
index 065bb609..3c712b61 100644
--- a/src/Tests/Tests/Shared/TestInt4.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt4.gen.cs
@@ -1348,7 +1348,7 @@ public static void int4_shuffle_result_4()
TestUtils.AreEqual(int4(3, 7, 1, 5), shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.LeftY, ShuffleComponent.RightY));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int4_EqualsObjectOverride()
{
TestUtils.IsFalse(new int4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt4x2.gen.cs b/src/Tests/Tests/Shared/TestInt4x2.gen.cs
index 564c7aa7..8eaa8828 100644
--- a/src/Tests/Tests/Shared/TestInt4x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt4x2.gen.cs
@@ -1224,7 +1224,7 @@ public static void int4x2_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int4x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new int4x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt4x3.gen.cs b/src/Tests/Tests/Shared/TestInt4x3.gen.cs
index 6fdd2f07..c8662413 100644
--- a/src/Tests/Tests/Shared/TestInt4x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt4x3.gen.cs
@@ -1228,7 +1228,7 @@ public static void int4x3_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int4x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new int4x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestInt4x4.gen.cs b/src/Tests/Tests/Shared/TestInt4x4.gen.cs
index 87f3887b..408529a2 100644
--- a/src/Tests/Tests/Shared/TestInt4x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestInt4x4.gen.cs
@@ -1253,7 +1253,7 @@ public static void int4x4_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void int4x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new int4x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestMath.cs b/src/Tests/Tests/Shared/TestMath.cs
index ffe458f6..d22d82a7 100644
--- a/src/Tests/Tests/Shared/TestMath.cs
+++ b/src/Tests/Tests/Shared/TestMath.cs
@@ -3838,5 +3838,363 @@ public static void orthonormal_basis_double()
TestUtils.IsTrue(OrthonormalBasisSquaredError(v1, v2, v3) < kOrthonormalBasisSqErrorTolerance);
}
}
+
+ [TestCompiler]
+ public static void chgsign_float()
+ {
+ float c = chgsign(1f, -1f);
+ TestUtils.AreEqual(-1f, c);
+
+ c = chgsign(1f, 1f);
+ TestUtils.AreEqual(1f, c);
+
+ c = chgsign(-1f, -1f);
+ TestUtils.AreEqual(1f, c);
+
+ c = chgsign(-1f, 1f);
+ TestUtils.AreEqual(-1f, c);
+
+ c = chgsign(-1f, 0f);
+ TestUtils.AreEqual(-1f, c);
+
+ c = chgsign(-1f, -0f);
+ TestUtils.AreEqual(1f, c);
+
+ c = chgsign(1f, TestUtils.SignedFloatQNaN());
+ TestUtils.AreEqual(-1f, c);
+
+ c = chgsign(-1f, TestUtils.SignedFloatQNaN());
+ TestUtils.AreEqual(1f, c);
+
+ c = chgsign(1f, TestUtils.UnsignedFloatQNaN());
+ TestUtils.AreEqual(1f, c);
+
+ c = chgsign(-1f, TestUtils.UnsignedFloatQNaN());
+ TestUtils.AreEqual(-1f, c);
+
+ c = chgsign(1f, INFINITY);
+ TestUtils.AreEqual(1f, c);
+
+ c = chgsign(-1f, INFINITY);
+ TestUtils.AreEqual(-1f, c);
+
+ c = chgsign(1f, -INFINITY);
+ TestUtils.AreEqual(-1f, c);
+
+ c = chgsign(-1f, -INFINITY);
+ TestUtils.AreEqual(1f, c);
+
+ c = chgsign(TestUtils.UnsignedFloatQNaN(), 1f);
+ TestUtils.IsTrue(isnan(c));
+ TestUtils.AreEqual(asuint(TestUtils.UnsignedFloatQNaN()), asuint(c));
+
+ c = chgsign(TestUtils.UnsignedFloatQNaN(), -1f);
+ TestUtils.IsTrue(isnan(c));
+ TestUtils.AreEqual(asuint(TestUtils.SignedFloatQNaN()), asuint(c));
+
+ c = chgsign(0f, 1f);
+ TestUtils.AreEqual(0f, c);
+ TestUtils.AreEqual(0u, asuint(c));
+
+ c = chgsign(0f, -1f);
+ TestUtils.AreEqual(0f, c);
+ TestUtils.AreEqual(asuint(TestUtils.SignedFloatZero()), asuint(c));
+ }
+
+ [TestCompiler]
+ public static void chgsign_float2()
+ {
+ float2 c = chgsign(float2(1f, -2f), float2(-1f, 23.548f));
+ TestUtils.AreEqual(float2(-1f, -2f), c);
+
+ c = chgsign(float2(-1f), float2(-1f, 1f));
+ TestUtils.AreEqual(float2(1f, -1f), c);
+
+ c = chgsign(float2(-1f), float2(1f, -1f));
+ TestUtils.AreEqual(float2(-1f, 1f), c);
+
+ c = chgsign(float2(-1f), float2(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN()));
+ TestUtils.AreEqual(float2(1f, -1f), c);
+
+ c = chgsign(float2(-1f), float2(TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN()));
+ TestUtils.AreEqual(float2(-1f, 1f), c);
+
+ c = chgsign(float2(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN()), float2(-1f, 1f));
+ TestUtils.IsTrue(all(isnan(c)));
+ TestUtils.AreEqual(asuint(float2(TestUtils.UnsignedFloatQNaN())), asuint(c));
+
+ c = chgsign(float2(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN()), float2(1f, -1f));
+ TestUtils.IsTrue(all(isnan(c)));
+ TestUtils.AreEqual(asuint(float2(TestUtils.SignedFloatQNaN())), asuint(c));
+
+ c = chgsign(float2(TestUtils.SignedFloatZero(), 0f), float2(TestUtils.SignedFloatZero(), 0f));
+ TestUtils.AreEqual(float2.zero, c);
+ TestUtils.AreEqual(uint2.zero, asuint(c));
+
+ c = chgsign(float2(TestUtils.SignedFloatZero(), 0f), float2(0f, TestUtils.SignedFloatZero()));
+ TestUtils.AreEqual(float2.zero, c);
+ TestUtils.AreEqual(asuint(math.float2(TestUtils.SignedFloatZero())), asuint(c));
+ }
+
+ [TestCompiler]
+ public static void chgsign_float3()
+ {
+ float3 c = chgsign(float3(1f, -2f, 3f), float3(-1f, 23.548f, -0f));
+ TestUtils.AreEqual(float3(-1f, -2f, -3f), c);
+
+ c = chgsign(float3(-1f), float3(-1f, 1f, -1f));
+ TestUtils.AreEqual(float3(1f, -1f, 1f), c);
+
+ c = chgsign(float3(-1f), float3(1f, -1f, 1f));
+ TestUtils.AreEqual(float3(-1f, 1f, -1f), c);
+
+ c = chgsign(float3(-1f), float3(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN()));
+ TestUtils.AreEqual(float3(1f, -1f, 1f), c);
+
+ c = chgsign(float3(-1f), float3(TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN()));
+ TestUtils.AreEqual(float3(-1f, 1f, -1f), c);
+
+ c = chgsign(float3(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN()), float3(-1f, 1f, -1f));
+ TestUtils.IsTrue(all(isnan(c)));
+ TestUtils.AreEqual(asuint(float3(TestUtils.UnsignedFloatQNaN())), asuint(c));
+
+ c = chgsign(float3(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN()), float3(1f, -1f, 1f));
+ TestUtils.IsTrue(all(isnan(c)));
+ TestUtils.AreEqual(asuint(float3(TestUtils.SignedFloatQNaN())), asuint(c));
+
+ c = chgsign(float3(TestUtils.SignedFloatZero(), 0f, TestUtils.SignedFloatZero()), float3(TestUtils.SignedFloatZero(), 0f, TestUtils.SignedFloatZero()));
+ TestUtils.AreEqual(float3.zero, c);
+ TestUtils.AreEqual(uint3.zero, asuint(c));
+
+ c = chgsign(float3(TestUtils.SignedFloatZero(), 0f, TestUtils.SignedFloatZero()), float3(0f, TestUtils.SignedFloatZero(), 0f));
+ TestUtils.AreEqual(float3.zero, c);
+ TestUtils.AreEqual(asuint(math.float3(TestUtils.SignedFloatZero())), asuint(c));
+ }
+
+ [TestCompiler]
+ public static void chgsign_float4()
+ {
+ float4 c = chgsign(float4(1f, 2f, 3f, -4f), float4(-1f, 0f, -0f, -23.56f));
+ TestUtils.AreEqual(float4(-1f, 2f, -3f, 4f), c);
+
+ c = chgsign(float4(-1f), float4(-1f, 1f, -1f, 1f));
+ TestUtils.AreEqual(float4(1f, -1f, 1f, -1f), c);
+
+ c = chgsign(float4(-1f), float4(1f, -1f, 1f, -1f));
+ TestUtils.AreEqual(float4(-1f, 1f, -1f, 1f), c);
+
+ c = chgsign(float4(-1f), float4(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN()));
+ TestUtils.AreEqual(float4(1f, -1f, 1f, -1f), c);
+
+ c = chgsign(float4(-1f), float4(TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN()));
+ TestUtils.AreEqual(float4(-1f, 1f, -1f, 1f), c);
+
+ c = chgsign(float4(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN()), float4(-1f, 1f, -1f, 1f));
+ TestUtils.IsTrue(all(isnan(c)));
+ TestUtils.AreEqual(asuint(float4(TestUtils.UnsignedFloatQNaN())), asuint(c));
+
+ c = chgsign(float4(TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN(), TestUtils.SignedFloatQNaN(), TestUtils.UnsignedFloatQNaN()), float4(1f, -1f, 1f, -1f));
+ TestUtils.IsTrue(all(isnan(c)));
+ TestUtils.AreEqual(asuint(float4(TestUtils.SignedFloatQNaN())), asuint(c));
+
+ c = chgsign(float4(TestUtils.SignedFloatZero(), 0f, TestUtils.SignedFloatZero(), 0f), float4(TestUtils.SignedFloatZero(), 0f, TestUtils.SignedFloatZero(), 0f));
+ TestUtils.AreEqual(float4.zero, c);
+ TestUtils.AreEqual(uint4.zero, asuint(c));
+
+ c = chgsign(float4(TestUtils.SignedFloatZero(), 0f, TestUtils.SignedFloatZero(), 0f), float4(0f, TestUtils.SignedFloatZero(), 0f, TestUtils.SignedFloatZero()));
+ TestUtils.AreEqual(float4.zero, c);
+ TestUtils.AreEqual(asuint(math.float4(TestUtils.SignedFloatZero())), asuint(c));
+ }
+
+ [TestCompiler]
+ public static unsafe void quaternion_to_euler()
+ {
+ const float epsilon = 0.0045f;
+ const float PI_div_6 = PI / 6f;
+ const int testAngleCount = 13 * 13 * 13 * 20;
+
+ float3* testAngles = stackalloc float3[testAngleCount];
+
+ int idx = 0;
+ for (int i = 0; i < 13; ++i)
+ {
+ float x = -PI + i * PI;
+ for (int j = 0; j < 13; ++j)
+ {
+ float y = -PI + j * PI_div_6;
+ for (int k = 0; k < 13; ++k)
+ {
+ float z = -PI + k * PI_div_6;
+ for (int l = 0; l < 20; ++l)
+ {
+ testAngles[idx++] = float3(x, y, z) * (0.99f + l * 0.001f);
+ }
+ }
+ }
+ }
+
+ for (int order = 0; order < 6; ++order)
+ {
+ for (int i = 0; i < testAngleCount; ++i)
+ {
+ // We cannot directly compare Euler angles, as different angles may represent the same rotation,
+ // so we have to transform them back to quats to test.
+ // We also need to create our initial test quaternion, as what we generated was euler angles.
+ quaternion expected = TestRefEulerToQuat(testAngles[i], math.RotationOrder.Default);
+
+ float3 actualEulers = Euler(expected, (math.RotationOrder)order);
+ quaternion actualQuat = TestRefEulerToQuat(actualEulers, (math.RotationOrder)order);
+
+ float error = angle(expected, actualQuat);
+ TestUtils.AreEqual(0f, error, epsilon);
+ }
+ }
+ }
+
+ static quaternion TestRefEulerToQuat(float3 angle, math.RotationOrder order)
+ {
+ float3 halfRot = angle * 0.5f;
+ sincos(halfRot, out float3 s, out float3 c);
+
+ quaternion qX = quaternion(s.x, 0f, 0f, c.x);
+ quaternion qY = quaternion(0f, s.y, 0f, c.y);
+ quaternion qZ = quaternion(0f, 0f, s.z, c.z);
+
+ switch (order)
+ {
+ case math.RotationOrder.XYZ:
+ return mul(mul(qZ, qY), qX);
+ case math.RotationOrder.XZY:
+ return mul(mul(qY, qZ), qX);
+ case math.RotationOrder.YXZ:
+ return mul(mul(qZ, qX), qY);
+ case math.RotationOrder.YZX:
+ return mul(mul(qX, qZ), qY);
+ case math.RotationOrder.ZXY:
+ return mul(mul(qY, qX), qZ);
+ case math.RotationOrder.ZYX:
+ return mul(mul(qX, qY), qZ);
+ default:
+ return quaternion(float4(1f));
+ }
+ }
+
+ [TestCompiler]
+ public static void mulScale()
+ {
+ var tolerance = 1e-5f;
+
+ // Random matrix.
+ var m = new float3x3(
+ 0.891724169254302978516f, 0.156217902898788452148f, 0.492261469364166259766f,
+ 0.562758803367614746094f, 0.00122839550022035837173f, 0.437942296266555786133f,
+ 0.2576503753662109375f, 0.200372591614723205566f, 0.515525519847869873047f);
+
+ // Random scale.
+ var scale = new float3(0.235540181398391723633f, 0.215966641902923583984f, 0.533130943775177001953f);
+ var actual = math.mulScale(m, scale);
+ var expected = new float3x3(
+ 0.210036873817443847656f, 0.0337378568947315216064f, 0.262439817190170288086f,
+ 0.132552310824394226074f, 0.000265292444964870810509f, 0.233480587601661682129f,
+ 0.0606870166957378387451f, 0.043273795396089553833f, 0.274842619895935058594f);
+
+ TestUtils.AreEqual(expected, actual, tolerance);
+ }
+
+ [TestCompiler]
+ public static void scaleMul()
+ {
+ var tolerance = 1e-5f;
+
+ // Random matrix, same as in mulScale test.
+ var m = new float3x3(
+ 0.891724169254302978516f, 0.156217902898788452148f, 0.492261469364166259766f,
+ 0.562758803367614746094f, 0.00122839550022035837173f, 0.437942296266555786133f,
+ 0.2576503753662109375f, 0.200372591614723205566f, 0.515525519847869873047f);
+
+ // Random scale, same as in mulScale test.
+ var scale = new float3(0.235540181398391723633f, 0.215966641902923583984f, 0.533130943775177001953f);
+ var actual = math.scaleMul(scale, m);
+ var expected = new float3x3(
+ 0.210036873817443847656f, 0.0367955937981605529785f, 0.115947358310222625732f,
+ 0.121537126600742340088f, 0.000265292444964870810509f, 0.0945809260010719299316f,
+ 0.137361392378807067871f, 0.106824830174446105957f, 0.274842619895935058594f);
+
+ TestUtils.AreEqual(expected, actual, tolerance);
+ }
+
+ [TestCompiler]
+ public static void piDoubleConstants()
+ {
+ var expectedPi = 3.141592653589793116;
+ TestUtils.AreEqual(expectedPi, PI_DBL);
+ TestUtils.AreEqual(expectedPi * 0.5, PIHALF_DBL);
+ TestUtils.AreEqual(expectedPi * 2.0, PI2_DBL);
+ TestUtils.AreEqual(expectedPi * 2.0, TAU_DBL);
+ }
+
+ [TestCompiler]
+ public static void piSingleConstants()
+ {
+ var expectedPi = 3.141592653589793116f;
+ TestUtils.AreEqual(expectedPi, PI);
+ TestUtils.AreEqual(expectedPi * 0.5f, PIHALF);
+ TestUtils.AreEqual(expectedPi * 2.0f, PI2);
+ TestUtils.AreEqual(expectedPi * 2.0f, TAU);
+ }
+
+ [TestCompiler]
+ public static void toDegreesConstants()
+ {
+ TestUtils.AreEqual(360.0, PI2_DBL * TODEGREES_DBL);
+ TestUtils.AreEqual(360.0, TAU_DBL * TODEGREES_DBL);
+ TestUtils.AreEqual(180.0, PI_DBL * TODEGREES_DBL);
+ TestUtils.AreEqual(90.0, PIHALF_DBL * TODEGREES_DBL);
+
+ TestUtils.AreEqual(360.0f, PI2 * TODEGREES);
+ TestUtils.AreEqual(360.0f, TAU * TODEGREES);
+ TestUtils.AreEqual(180.0f, PI * TODEGREES);
+ TestUtils.AreEqual(90.0f, PIHALF * TODEGREES);
+ }
+
+ [TestCompiler]
+ public static void toRadiansConstants()
+ {
+ TestUtils.AreEqual(PI2_DBL, 360.0 * TORADIANS_DBL);
+ TestUtils.AreEqual(TAU_DBL, 360.0 * TORADIANS_DBL);
+ TestUtils.AreEqual(PI_DBL, 180.0 * TORADIANS_DBL);
+ TestUtils.AreEqual(PIHALF_DBL, 90.0 * TORADIANS_DBL);
+
+ TestUtils.AreEqual(PI2, 360.0f * TORADIANS);
+ TestUtils.AreEqual(TAU, 360.0f * TORADIANS);
+ TestUtils.AreEqual(PI, 180.0f * TORADIANS);
+ TestUtils.AreEqual(PIHALF, 90.0f * TORADIANS);
+ }
+
+ [TestCompiler]
+ public static void degreesConversionGivesSameResult()
+ {
+ int n = 360;
+
+ for (int i = 0; i <= n; ++i)
+ {
+ double radians = math.unlerp((double)0, (double)n, (double)i) * PI_DBL;
+ TestUtils.AreEqual(math.degrees(radians), radians * TODEGREES_DBL);
+ TestUtils.AreEqual(math.degrees((float)radians), (float)radians * TODEGREES);
+ }
+ }
+
+ [TestCompiler]
+ public static void radiansConversionGivesSameResult()
+ {
+ int n = 360;
+
+ for (int i = 0; i <= n; ++i)
+ {
+ double degrees = (double)i;
+ TestUtils.AreEqual(math.radians(degrees), degrees * TORADIANS_DBL);
+ TestUtils.AreEqual(math.radians((float)degrees), (float)degrees * TORADIANS);
+ }
+ }
}
}
diff --git a/src/Tests/Tests/Shared/TestMatrix.cs b/src/Tests/Tests/Shared/TestMatrix.cs
index 5bc45842..558ce482 100644
--- a/src/Tests/Tests/Shared/TestMatrix.cs
+++ b/src/Tests/Tests/Shared/TestMatrix.cs
@@ -1169,5 +1169,46 @@ public static void float3x3_from_float4x4_without_new()
TestUtils.AreEqual(expected, float3x3(f4x4));
}
+
+ [TestCompiler]
+ public static void float3x3_pseudoinverse_non_singular()
+ {
+ const float kTolerance = 1e-5f;
+
+ // A random 3x3 matrix, non-singular, generated from octave.
+ var a = new float3x3(
+ 0.806710600852966308594f, 0.985506594181060791016f, 0.593669593334197998047f,
+ 0.0869068726897239685059f, 0.754145503044128417969f, 0.222692146897315979004f,
+ 0.917483031749725341797f, 0.443894535303115844727f, 0.138771042227745056152f);
+
+ // The regular inverse of a, as computed by octave.
+ var expected = new float3x3(
+ -0.0299495235085487365723f, -0.654392063617706298828f, 1.17825806140899658203f,
+ -0.992458224296569824219f, 2.23384380340576171875f, 0.661037027835845947266f,
+ 3.37264156341552734375f, -2.81901407241821289063f, -2.69841933250427246094f);
+
+ TestUtils.AreEqual(expected, pseudoinverse(a), kTolerance);
+ TestUtils.AreEqual(expected, inverse(a), kTolerance);
+ }
+
+ [TestCompiler]
+ public static void float3x3_pseudoinverse_singular()
+ {
+ const float kTolerance = 1e-5f;
+
+ // A singular matrix.
+ var a = new float3x3(
+ 0.0548239313066005706787f, 0.462397903203964233398f, 0.0501357726752758026123f,
+ 0.0548239313066005706787f, 0.462397903203964233398f, 0.0501357726752758026123f,
+ 0.938165545463562011719f, 0.542225778102874755859f, 0.10684439539909362793f);
+
+ // The pseudoinverse computed by octave.
+ var expected = new float3x3(
+ -0.675357639789581298828f, -0.675357699394226074219f, 1.14166188240051269531f,
+ 1.15268361568450927734f, 1.15268361568450927734f, -0.140613287687301635742f,
+ 0.0803283303976058959961f, 0.0803283303976058959961f, 0.0484490357339382171631f);
+
+ TestUtils.AreEqual(expected, pseudoinverse(a), kTolerance);
+ }
}
}
diff --git a/src/Tests/Tests/Shared/TestPlane.cs b/src/Tests/Tests/Shared/TestPlane.cs
index 91e60044..2fbd3251 100644
--- a/src/Tests/Tests/Shared/TestPlane.cs
+++ b/src/Tests/Tests/Shared/TestPlane.cs
@@ -263,4 +263,4 @@ public static void CreateFromUnitNormalAndPointInPlane()
TestUtils.AreEqual(expected, p.NormalAndDistance, Tolerance);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Tests/Tests/Shared/TestQuaternion.cs b/src/Tests/Tests/Shared/TestQuaternion.cs
index 9bd5ebf6..301725ee 100644
--- a/src/Tests/Tests/Shared/TestQuaternion.cs
+++ b/src/Tests/Tests/Shared/TestQuaternion.cs
@@ -89,7 +89,7 @@ public static void quaternion_axis_angle_consistency()
}
[TestCompiler]
- public static void quaternion_euler()
+ public static void euler_to_quaternion()
{
float3 test_angles = TestMatrix.test_angles;
quaternion q0 = quaternion.Euler(test_angles);
@@ -344,5 +344,121 @@ public static void quaternion_EqualsObjectOverride()
TestUtils.IsFalse(new quaternion().Equals((object) new int()));
TestUtils.IsTrue(new quaternion().Equals((object) new quaternion()));
}
+
+ [TestCase]
+ public static void quaternion_angle()
+ {
+ // Test variations of angles
+ for (int i = 0; i < 18; ++i)
+ {
+ for (int j = 0; j < 18; ++j)
+ {
+ float angle1 = radians(i * 10f);
+ float angle2 = radians(j * 10f);
+
+ quaternion q1 = quaternion.Euler(0f, angle1, 0f);
+ quaternion q2 = quaternion.Euler(0f, angle2, 0f);
+ TestUtils.AreEqual(abs(angle2 - angle1), math.angle(q1, q2), 1e-5f);
+ }
+ }
+
+ quaternion q = quaternion.identity;
+ float angle = math.angle(q, q);
+ TestUtils.AreEqual(0f, angle);
+
+ quaternion nq = -q.value;
+ angle = math.angle(q, nq);
+ TestUtils.AreEqual(0f, angle);
+
+ // Nearly normalized quaternion to self is zero
+ q = new quaternion(0.6244676f, -0.7761726f, -0.06790633f, -0.05463386f); // dot(q, q) = 0.999999816753
+ angle = math.angle(q, q);
+ TestUtils.AreEqual(0f, angle);
+
+ // Nearly normalized quaternion to negative self is zero
+ nq = -q.value; // dot(q, nq) = -0.999999816753
+ angle = math.angle(q, nq);
+ TestUtils.AreEqual(0f, angle);
+ }
+
+ [TestCompiler]
+ public static void quaternion_rotation_from_3x3_identity()
+ {
+ const float tolerance = 1e-5f;
+ var q = rotation(float3x3.identity);
+ TestUtils.AreEqual(quaternion.identity, q, tolerance);
+ }
+
+ [TestCompiler]
+ public static void quaternion_rotation_from_3x3_with_uniform_scale()
+ {
+ const float tolerance = 1e-5f;
+ var random = new Random(6173u);
+ var expectedQuaternion = random.NextQuaternionRotation();
+ var m = new float3x3(expectedQuaternion);
+ m = mul(m, float3x3.Scale(5.18f));
+ var actualQuaternion = rotation(m);
+ TestUtils.AreEqual(0.0f, angle(actualQuaternion, expectedQuaternion) % PI * 2.0f, tolerance);
+ }
+
+ [TestCompiler]
+ public static void quaternion_rotation_from_3x3_with_nonuniform_scale()
+ {
+ const float tolerance = 1e-5f;
+ var m = new float3x3(
+ 2.0f, 0.0f, 0.0f,
+ 0.0f, 1.5f, 0.0f,
+ 0.0f, 0.0f, 3.1f);
+ var q = rotation(m);
+ TestUtils.AreEqual(quaternion.identity, q, tolerance);
+ }
+
+ [TestCompiler]
+ public static void quaternion_rotation_from_3x3_with_negative_scale_x()
+ {
+ const float tolerance = 1e-5f;
+ var random = new Random(281u);
+ var expectedQuaternion = random.NextQuaternionRotation();
+ var m = new float3x3(expectedQuaternion);
+ m = mul(m, float3x3.Scale(-1.5f, 0.2f, 51.281f));
+ var actualQuaternion = rotation(m);
+ TestUtils.AreEqual(0.0f, angle(actualQuaternion, expectedQuaternion) % PI * 2.0f, tolerance);
+ }
+
+ [TestCompiler]
+ public static void quaternion_rotation_from_3x3_with_negative_scale_y()
+ {
+ const float tolerance = 1e-5f;
+ var random = new Random(10000u);
+ var expectedQuaternion = random.NextQuaternionRotation();
+ var m = new float3x3(expectedQuaternion);
+ m = mul(m, float3x3.Scale(1.5f, -0.2f, 51.281f));
+ var actualQuaternion = rotation(m);
+ TestUtils.AreEqual(0.0f, angle(actualQuaternion, expectedQuaternion) % PI * 2.0f, tolerance);
+ }
+
+ [TestCompiler]
+ public static void quaternion_rotation_from_3x3_with_negative_scale_z()
+ {
+ const float tolerance = 1e-5f;
+ var random = new Random(9891712u);
+ var expectedQuaternion = random.NextQuaternionRotation();
+ var m = new float3x3(expectedQuaternion);
+ m = mul(m, float3x3.Scale(1.5f, 0.2f, -51.281f));
+ var actualQuaternion = rotation(m);
+ TestUtils.AreEqual(0.0f, angle(actualQuaternion, expectedQuaternion) % PI * 2.0f, tolerance);
+ }
+
+ [TestCompiler]
+ public static void quaternion_rotation_from_3x3_with_negative_nonuniform_scale()
+ {
+ const float tolerance = 1e-5f;
+ var random = new Random(912u);
+ var expectedQuaternion = random.NextQuaternionRotation();
+ var m = new float3x3(expectedQuaternion);
+ m = mul(m, float3x3.Scale(-1.5f, -0.2f, -51.281f));
+ var actualQuaternion = rotation(m);
+ TestUtils.AreEqual(0.0f, angle(actualQuaternion, expectedQuaternion) % PI * 2.0f, tolerance);
+ }
}
}
diff --git a/src/Tests/Tests/Shared/TestSvd.cs b/src/Tests/Tests/Shared/TestSvd.cs
new file mode 100644
index 00000000..e75cf04f
--- /dev/null
+++ b/src/Tests/Tests/Shared/TestSvd.cs
@@ -0,0 +1,185 @@
+using System.Collections.Generic;
+using NUnit.Framework;
+using Burst.Compiler.IL.Tests;
+
+namespace Unity.Mathematics.Tests
+{
+ [TestFixture]
+ public class TestSvd
+ {
+ const float k_SVDTolerance = 1e-4f;
+
+ static bool QuaternionEquals(quaternion expected, quaternion actual, float tolerance) =>
+ (math.lengthsq(expected) == 0f && math.lengthsq(actual) == 0f) || math.abs(math.dot(expected, actual)) > (1f - tolerance);
+
+ // Validate Penrose condition that [aba = a]
+ static void ValidatePenrose1(in float3x3 a, in float3x3 b)
+ {
+ var testA = math.mul(math.mul(a, b), a);
+
+ TestUtils.AreEqual(a.c0.x, testA.c0.x, k_SVDTolerance);
+ TestUtils.AreEqual(a.c0.y, testA.c0.y, k_SVDTolerance);
+ TestUtils.AreEqual(a.c0.z, testA.c0.z, k_SVDTolerance);
+ TestUtils.AreEqual(a.c1.x, testA.c1.x, k_SVDTolerance);
+ TestUtils.AreEqual(a.c1.y, testA.c1.y, k_SVDTolerance);
+ TestUtils.AreEqual(a.c1.z, testA.c1.z, k_SVDTolerance);
+ TestUtils.AreEqual(a.c2.x, testA.c2.x, k_SVDTolerance);
+ TestUtils.AreEqual(a.c2.y, testA.c2.y, k_SVDTolerance);
+ TestUtils.AreEqual(a.c2.z, testA.c2.z, k_SVDTolerance);
+ }
+
+ // Validate Penrose condition that [transpose(ab) = ab]
+ static void ValidatePenrose2(in float3x3 a, in float3x3 b)
+ {
+ var ab = math.mul(a, b);
+ var testAB = math.transpose(ab);
+
+ TestUtils.AreEqual(ab.c0.x, testAB.c0.x, k_SVDTolerance);
+ TestUtils.AreEqual(ab.c0.y, testAB.c0.y, k_SVDTolerance);
+ TestUtils.AreEqual(ab.c0.z, testAB.c0.z, k_SVDTolerance);
+ TestUtils.AreEqual(ab.c1.x, testAB.c1.x, k_SVDTolerance);
+ TestUtils.AreEqual(ab.c1.y, testAB.c1.y, k_SVDTolerance);
+ TestUtils.AreEqual(ab.c1.z, testAB.c1.z, k_SVDTolerance);
+ TestUtils.AreEqual(ab.c2.x, testAB.c2.x, k_SVDTolerance);
+ TestUtils.AreEqual(ab.c2.y, testAB.c2.y, k_SVDTolerance);
+ TestUtils.AreEqual(ab.c2.z, testAB.c2.z, k_SVDTolerance);
+ }
+
+ static void ValidateSingular(in float3x3 a) =>
+ TestUtils.AreEqual(0.0f, math.determinant(a), k_SVDTolerance);
+
+ [TestCompiler]
+ public static void CanSVDInverseNonSingularFloat3x3()
+ {
+ var mat = math.float3x3(
+ math.float3(9f, 1f, 2f),
+ math.float3(3f, 8f, 4f),
+ math.float3(5f, 6f, 7f)
+ );
+
+ var inv = svd.svdInverse(mat);
+ var testIdentity = math.mul(mat, inv);
+
+ TestUtils.AreEqual(1f, testIdentity.c0.x, k_SVDTolerance);
+ TestUtils.AreEqual(0f, testIdentity.c0.y, k_SVDTolerance);
+ TestUtils.AreEqual(0f, testIdentity.c0.z, k_SVDTolerance);
+ TestUtils.AreEqual(0f, testIdentity.c1.x, k_SVDTolerance);
+ TestUtils.AreEqual(1f, testIdentity.c1.y, k_SVDTolerance);
+ TestUtils.AreEqual(0f, testIdentity.c1.z, k_SVDTolerance);
+ TestUtils.AreEqual(0f, testIdentity.c2.x, k_SVDTolerance);
+ TestUtils.AreEqual(0f, testIdentity.c2.y, k_SVDTolerance);
+ TestUtils.AreEqual(1f, testIdentity.c2.z, k_SVDTolerance);
+ }
+
+ [TestCompiler]
+ public static void CanSVDInverseFloat3x3With_NullColumn()
+ {
+ var mat = math.float3x3(
+ math.float3(9f, 1f, 0f),
+ math.float3(3f, 8f, 0f),
+ math.float3(5f, 6f, 0f)
+ );
+
+ ValidateSingular(mat);
+ var inv = svd.svdInverse(mat);
+
+ ValidatePenrose1(mat, inv);
+ ValidatePenrose1(inv, mat);
+ ValidatePenrose2(mat, inv);
+ ValidatePenrose2(inv, mat);
+ }
+
+ [TestCompiler]
+ public static void CanSVDInverseFloat3x3With_NullRow()
+ {
+ var mat = math.float3x3(
+ math.float3(9f, 1f, 2f),
+ math.float3(0f, 0f, 0f),
+ math.float3(5f, 6f, 7f)
+ );
+
+ ValidateSingular(mat);
+ var inv = svd.svdInverse(mat);
+
+ ValidatePenrose1(mat, inv);
+ ValidatePenrose1(inv, mat);
+ ValidatePenrose2(mat, inv);
+ ValidatePenrose2(inv, mat);
+ }
+
+ [TestCompiler]
+ public static void CanSVDInverseFloat3x3With_LinearDependentColumn()
+ {
+ var mat = math.float3x3(
+ math.float3(9f, 4f, 2f),
+ math.float3(3f, 8f, 4f),
+ math.float3(5f, 14f, 7f)
+ );
+
+ ValidateSingular(mat);
+ var inv = svd.svdInverse(mat);
+
+ ValidatePenrose1(mat, inv);
+ ValidatePenrose1(inv, mat);
+ ValidatePenrose2(mat, inv);
+ ValidatePenrose2(inv, mat);
+ }
+
+ [TestCompiler]
+ public static void CanSVDInverseFloat3x3With_LinearDependentRow()
+ {
+ var mat = math.float3x3(
+ math.float3(9f, 1f, 2f),
+ math.float3(10f, 12f, 14f),
+ math.float3(5f, 6f, 7f)
+ );
+
+ ValidateSingular(mat);
+ var inv = svd.svdInverse(mat);
+
+ ValidatePenrose1(mat, inv);
+ ValidatePenrose1(inv, mat);
+ ValidatePenrose2(mat, inv);
+ ValidatePenrose2(inv, mat);
+ }
+
+ [TestCompiler]
+ public static void CanSVDInverseFloat3x3With_RotatedZeroScale()
+ {
+ var m102030 = math.float3x3(quaternion.Euler(math.radians(10f), math.radians(20f), math.radians(30f)));
+ var parent = math.mulScale(m102030, math.float3(1f, 1f, 0f));
+ var mat = math.mul(parent, m102030);
+
+ ValidateSingular(mat);
+ var inv = svd.svdInverse(mat);
+
+ ValidatePenrose1(mat, inv);
+ ValidatePenrose1(inv, mat);
+ ValidatePenrose2(mat, inv);
+ ValidatePenrose2(inv, mat);
+ }
+
+ // Case 928598: The errors appear, when GameObject has a child with ParticleSystem which is rotated along the y-axis to -180 and is moved
+ [TestCompiler]
+ public static void CanExtractSVDRotationFromFloat3x3With_X180_Y0_Z181()
+ {
+ var q = quaternion.Euler(math.radians(180f), math.radians(0f), math.radians(181f));
+ var qSVD = svd.svdRotation(math.float3x3(q));
+
+ TestUtils.IsTrue(QuaternionEquals(q, qSVD, k_SVDTolerance));
+ }
+
+ // Case 938548: Assertion failed on expression: 'CompareApproximately(det, 1.0F, .005f)' when scaling system to 0 on at least 2 axes
+ [TestCompiler]
+ public static void CanExtractSVDRotationFromFloat3x3With_ZeroScaleXY()
+ {
+ var q0 = quaternion.Euler(math.radians(10f), math.radians(20f), math.radians(30f));
+ var m0 = math.float3x3(q0);
+ var m0Scaled = math.mulScale(m0, math.float3(1f, 0f, 0f));
+ var q1 = svd.svdRotation(m0Scaled);
+ var m1 = math.float3x3(q1);
+
+ TestUtils.AreEqual(0.0f, math.length(m0.c0 - m1.c0), k_SVDTolerance);
+ }
+ }
+}
diff --git a/src/Tests/Tests/Shared/TestSvd.cs.meta b/src/Tests/Tests/Shared/TestSvd.cs.meta
new file mode 100644
index 00000000..824a25f5
--- /dev/null
+++ b/src/Tests/Tests/Shared/TestSvd.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8218cb7d87dac4432871cd5bd00fd333
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/src/Tests/Tests/Shared/TestUint2.gen.cs b/src/Tests/Tests/Shared/TestUint2.gen.cs
index 67c0813b..d853e034 100644
--- a/src/Tests/Tests/Shared/TestUint2.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint2.gen.cs
@@ -1334,7 +1334,7 @@ public static void uint2_shuffle_result_4()
TestUtils.AreEqual(uint4(2, 0, 0, 0), shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint2_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint2x2.gen.cs b/src/Tests/Tests/Shared/TestUint2x2.gen.cs
index a5f371ec..012db8aa 100644
--- a/src/Tests/Tests/Shared/TestUint2x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint2x2.gen.cs
@@ -1229,7 +1229,7 @@ public static void uint2x2_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint2x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint2x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint2x3.gen.cs b/src/Tests/Tests/Shared/TestUint2x3.gen.cs
index d8aa9b0a..ac053495 100644
--- a/src/Tests/Tests/Shared/TestUint2x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint2x3.gen.cs
@@ -1222,7 +1222,7 @@ public static void uint2x3_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint2x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint2x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint2x4.gen.cs b/src/Tests/Tests/Shared/TestUint2x4.gen.cs
index 7783684e..f9a8f210 100644
--- a/src/Tests/Tests/Shared/TestUint2x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint2x4.gen.cs
@@ -1224,7 +1224,7 @@ public static void uint2x4_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint2x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint2x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint3.gen.cs b/src/Tests/Tests/Shared/TestUint3.gen.cs
index 6fca57ce..6443db9b 100644
--- a/src/Tests/Tests/Shared/TestUint3.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint3.gen.cs
@@ -1341,7 +1341,7 @@ public static void uint3_shuffle_result_4()
TestUtils.AreEqual(uint4(2, 5, 0, 4), shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.RightY));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint3_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint3x2.gen.cs b/src/Tests/Tests/Shared/TestUint3x2.gen.cs
index 106b90dc..0072a061 100644
--- a/src/Tests/Tests/Shared/TestUint3x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint3x2.gen.cs
@@ -1222,7 +1222,7 @@ public static void uint3x2_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint3x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint3x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint3x3.gen.cs b/src/Tests/Tests/Shared/TestUint3x3.gen.cs
index 5861b8a2..9e91fc32 100644
--- a/src/Tests/Tests/Shared/TestUint3x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint3x3.gen.cs
@@ -1239,7 +1239,7 @@ public static void uint3x3_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint3x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint3x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint3x4.gen.cs b/src/Tests/Tests/Shared/TestUint3x4.gen.cs
index 9832a2a7..4768c755 100644
--- a/src/Tests/Tests/Shared/TestUint3x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint3x4.gen.cs
@@ -1228,7 +1228,7 @@ public static void uint3x4_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint3x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint3x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint4.gen.cs b/src/Tests/Tests/Shared/TestUint4.gen.cs
index 49e0be49..8d0b8a6b 100644
--- a/src/Tests/Tests/Shared/TestUint4.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint4.gen.cs
@@ -1348,7 +1348,7 @@ public static void uint4_shuffle_result_4()
TestUtils.AreEqual(uint4(3, 7, 1, 5), shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.LeftY, ShuffleComponent.RightY));
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint4_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint4().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint4x2.gen.cs b/src/Tests/Tests/Shared/TestUint4x2.gen.cs
index 4cf1fc14..7f42bc6a 100644
--- a/src/Tests/Tests/Shared/TestUint4x2.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint4x2.gen.cs
@@ -1224,7 +1224,7 @@ public static void uint4x2_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint4x2_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint4x2().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint4x3.gen.cs b/src/Tests/Tests/Shared/TestUint4x3.gen.cs
index 0bcde5e9..f750426b 100644
--- a/src/Tests/Tests/Shared/TestUint4x3.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint4x3.gen.cs
@@ -1228,7 +1228,7 @@ public static void uint4x3_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint4x3_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint4x3().Equals((object)new int()));
diff --git a/src/Tests/Tests/Shared/TestUint4x4.gen.cs b/src/Tests/Tests/Shared/TestUint4x4.gen.cs
index 67f34ee1..b9fc3f5e 100644
--- a/src/Tests/Tests/Shared/TestUint4x4.gen.cs
+++ b/src/Tests/Tests/Shared/TestUint4x4.gen.cs
@@ -1253,7 +1253,7 @@ public static void uint4x4_operator_bitwise_not()
TestUtils.AreEqual(r3, ~a3);
}
- [TestCase]
+ [TestCase /* For player builds */]
public static void uint4x4_EqualsObjectOverride()
{
TestUtils.IsFalse(new uint4x4().Equals((object)new int()));
diff --git a/src/Tests/Tests/TestMath2.cs b/src/Tests/Tests/TestMath2.cs
index 09e2d3a9..02b48ddb 100644
--- a/src/Tests/Tests/TestMath2.cs
+++ b/src/Tests/Tests/TestMath2.cs
@@ -1,6 +1,7 @@
using NUnit.Framework;
using static Unity.Mathematics.math;
using Burst.Compiler.IL.Tests;
+using System;
namespace Unity.Mathematics.Tests
{
@@ -59,5 +60,71 @@ public unsafe void hash_blob()
}
}
}
+
+ [TestCompiler]
+ public unsafe void hash_blob_unaligned()
+ {
+ byte[] testData = {
+ 0x0d, 0x26, 0x1c, 0xeb, 0x56, 0x3a, 0x9c, 0x18, 0x93, 0xb6,
+ 0xc1, 0x99, 0x5e, 0x04, 0x92, 0x4f, 0x6e, 0xb7, 0x42, 0x53,
+ 0x23, 0xcf, 0xe3, 0xbf, 0x16, 0x64, 0x79, 0x08, 0xc1, 0x01,
+ 0x43, 0x89, 0x73, 0x8f, 0x76, 0x22, 0x0c, 0xee, 0x9b, 0x80,
+ 0x31, 0x83, 0xce, 0x33, 0x8b, 0xc7, 0x3f, 0x94, 0x33
+ };
+
+ uint[] resultsWithZeroSeed =
+ {
+ 0x02cc5d05, 0x376a5b3f, 0x8ae13198, 0xf5b14d72, 0xcc7ddc84,
+ 0x763e5905, 0x58759392, 0x6bccbd00, 0x7d0f80c8, 0xef01ae48,
+ 0xe40aa3ad, 0x805e04ad, 0xf98a471c, 0xdd960ac1, 0x76a71750,
+ 0xd35e2baa, 0x0219f7da, 0xd5bd1fbd, 0x5f28c87e, 0xfe6f7995,
+ 0x69a43ac5, 0xec1a1a15, 0x7ae9f103, 0x8d04a688, 0xce3b35be,
+ 0x6b3f040c, 0xd5ea2e8c, 0x6989e79c, 0x8772f1fb, 0x0d7b7bf6,
+ 0x0796214b, 0x98ea65c4, 0x3884dd82, 0x59632484, 0x91c92822,
+ 0x72d28404, 0x167061b0, 0x32adc2ef, 0xbac3e672, 0xd39936b7,
+ 0x94e2c154, 0x8b4ff46c, 0x68976fd4, 0x04bee59a, 0x2ed62c69,
+ 0xabee69fd, 0xda11e266, 0xcebd9d38, 0x28eea5fd, 0x0210d6ee
+ };
+
+
+ uint[] resultsWith_0xeb69cf40_seed =
+ {
+ 0x12c3b280, 0x9bc1f68d, 0x2f900b51, 0xdb77e20e, 0xf6e8f561,
+ 0x3f3f72f6, 0x15f9700f, 0x28beb671, 0xceece5e1, 0x7a9b5c81,
+ 0x62a84642, 0xf75666af, 0x8939f8ca, 0x6b84792b, 0x527ee836,
+ 0xa0782090, 0xce6b9926, 0xa608c73b, 0xa08ee6a3, 0xab77a6b2,
+ 0x4e174e68, 0x596f10d5, 0xa14c4d85, 0x509ab88d, 0xd14698a4,
+ 0xbaad2308, 0xbd04c3df, 0x5715fed1, 0x5cf23a74, 0xd4e844f9,
+ 0x166dcfba, 0xe3495e37, 0x1b18b2b3, 0x2e8c2aab, 0x40993321,
+ 0x4b84998a, 0xd062937d, 0x1b2c9f7b, 0x8a613ed3, 0x70d71291,
+ 0x1af38ea4, 0x460cb7e9, 0xf806e3a9, 0xec9b6b2e, 0x9972a843,
+ 0x1ff06d2a, 0xe8c5007b, 0x37d8fc40, 0x0dc4f639, 0x36edff4f
+ };
+
+ byte* buffer = stackalloc byte[testData.Length + 1];
+ fixed (byte* p = testData)
+ {
+ UIntPtr address = (UIntPtr)p;
+ bool isUnaligned = ((ulong)address & 1) > 0;
+ byte* unalignedPtr = buffer;
+
+ if (!isUnaligned)
+ {
+ ++unalignedPtr;
+ }
+
+ Buffer.MemoryCopy(p, unalignedPtr, testData.Length + 1, testData.Length);
+
+ for (int i = 0; i < 50; ++i)
+ {
+ TestUtils.AreEqual(hash(unalignedPtr, i, 0), resultsWithZeroSeed[i]);
+ }
+
+ for (int i = 0; i < 50; ++i)
+ {
+ TestUtils.AreEqual(hash(unalignedPtr, i, 0xeb69cf40), resultsWith_0xeb69cf40_seed[i]);
+ }
+ }
+ }
}
}
diff --git a/src/Tests/Unity.Mathematics.Tests.asmdef b/src/Tests/Unity.Mathematics.Tests.asmdef
index 6b374c8a..29a41728 100644
--- a/src/Tests/Unity.Mathematics.Tests.asmdef
+++ b/src/Tests/Unity.Mathematics.Tests.asmdef
@@ -1,13 +1,21 @@
{
"name": "Unity.Mathematics.Tests",
- "optionalUnityReferences": [
- "TestAssemblies"
- ],
+ "rootNamespace": "",
"references": [
- "Unity.Mathematics"
+ "Unity.Mathematics",
+ "UnityEngine.TestRunner"
+ ],
+ "includePlatforms": [],
+ "excludePlatforms": [],
+ "allowUnsafeCode": true,
+ "overrideReferences": true,
+ "precompiledReferences": [
+ "nunit.framework.dll"
],
- "includePlatforms": [
- "Editor"
+ "autoReferenced": false,
+ "defineConstraints": [
+ "UNITY_INCLUDE_TESTS"
],
- "allowUnsafeCode": true
-}
+ "versionDefines": [],
+ "noEngineReferences": false
+}
\ No newline at end of file
diff --git a/src/Tests/Unity.Mathematics.Tests.csproj b/src/Tests/Unity.Mathematics.Tests.csproj
index 4ca36bde..db3c9463 100644
--- a/src/Tests/Unity.Mathematics.Tests.csproj
+++ b/src/Tests/Unity.Mathematics.Tests.csproj
@@ -12,6 +12,7 @@
v4.7.1
512
+ latest
true
@@ -49,6 +50,7 @@
+
@@ -106,6 +108,7 @@
+
@@ -142,4 +145,4 @@
-->
-
\ No newline at end of file
+
diff --git a/Unity.Mathematics.TestProject/Assets/Tests.meta b/src/Tests/Unity.Mathematics.Tests.csproj.meta
similarity index 67%
rename from Unity.Mathematics.TestProject/Assets/Tests.meta
rename to src/Tests/Unity.Mathematics.Tests.csproj.meta
index 9f5f1a30..24e5c128 100644
--- a/Unity.Mathematics.TestProject/Assets/Tests.meta
+++ b/src/Tests/Unity.Mathematics.Tests.csproj.meta
@@ -1,6 +1,5 @@
fileFormatVersion: 2
-guid: 6ea92fda216cb44a1b5e2bf49e9ef2ad
-folderAsset: yes
+guid: e393530e16da0c6498af8f6417806c74
DefaultImporter:
externalObjects: {}
userData:
diff --git a/src/Unity.Mathematics.CodeGen/Program.cs b/src/Unity.Mathematics.CodeGen~/Program.cs
similarity index 100%
rename from src/Unity.Mathematics.CodeGen/Program.cs
rename to src/Unity.Mathematics.CodeGen~/Program.cs
diff --git a/src/Unity.Mathematics.CodeGen/Program.cs.meta b/src/Unity.Mathematics.CodeGen~/Program.cs.meta
similarity index 100%
rename from src/Unity.Mathematics.CodeGen/Program.cs.meta
rename to src/Unity.Mathematics.CodeGen~/Program.cs.meta
diff --git a/src/Unity.Mathematics.CodeGen/Properties.meta b/src/Unity.Mathematics.CodeGen~/Properties.meta
similarity index 100%
rename from src/Unity.Mathematics.CodeGen/Properties.meta
rename to src/Unity.Mathematics.CodeGen~/Properties.meta
diff --git a/src/Unity.Mathematics.CodeGen/Properties/AssemblyInfo.cs b/src/Unity.Mathematics.CodeGen~/Properties/AssemblyInfo.cs
similarity index 100%
rename from src/Unity.Mathematics.CodeGen/Properties/AssemblyInfo.cs
rename to src/Unity.Mathematics.CodeGen~/Properties/AssemblyInfo.cs
diff --git a/src/Unity.Mathematics.CodeGen/Properties/AssemblyInfo.cs.meta b/src/Unity.Mathematics.CodeGen~/Properties/AssemblyInfo.cs.meta
similarity index 100%
rename from src/Unity.Mathematics.CodeGen/Properties/AssemblyInfo.cs.meta
rename to src/Unity.Mathematics.CodeGen~/Properties/AssemblyInfo.cs.meta
diff --git a/src/Unity.Mathematics.CodeGen/Unity.Mathematics.CodeGen.csproj b/src/Unity.Mathematics.CodeGen~/Unity.Mathematics.CodeGen.csproj
similarity index 100%
rename from src/Unity.Mathematics.CodeGen/Unity.Mathematics.CodeGen.csproj
rename to src/Unity.Mathematics.CodeGen~/Unity.Mathematics.CodeGen.csproj
diff --git a/src/Unity.Mathematics.CodeGen/VectorGenerator.cs b/src/Unity.Mathematics.CodeGen~/VectorGenerator.cs
similarity index 93%
rename from src/Unity.Mathematics.CodeGen/VectorGenerator.cs
rename to src/Unity.Mathematics.CodeGen~/VectorGenerator.cs
index 35d58e12..c53afabc 100644
--- a/src/Unity.Mathematics.CodeGen/VectorGenerator.cs
+++ b/src/Unity.Mathematics.CodeGen~/VectorGenerator.cs
@@ -2079,7 +2079,7 @@ private void BeginTest(StringBuilder str, string name, bool testCompiler = true)
}
else
{
- str.Append("\t\t[TestCase]\n");
+ str.Append("\t\t[TestCase /* For player builds */]\n");
}
str.AppendFormat("\t\tpublic static void {0}()\n", name);
@@ -3224,6 +3224,9 @@ void GenerateInversePerformanceTests(StringBuilder str)
GeneratePerformanceTest(str, "quaternion_inverse", new PerformanceTestArrayArgument[] {
new PerformanceTestArrayArgument { m_ElementType = "quaternion", m_MemberName = "q", m_ElementInitializer = "quaternion.identity" },
}, "args.q[i] = math.inverse(args.q[i]);", 10000);
+ GeneratePerformanceTest(str, "pseudoinverse", new PerformanceTestArrayArgument[] {
+ new PerformanceTestArrayArgument { m_ElementType = "float3x3", m_MemberName = "m", m_ElementInitializer = "new float3x3(0.054824f, 0.462398f, 0.050136f, 0.054824f, 0.462398f, 0.050136f, 0.938166f, 0.542226f, 0.106844f)" },
+ }, "args.m[i] = math.pseudoinverse(args.m[i]);", 1000);
EndPerformanceTestCodeGen(str);
}
@@ -3295,55 +3298,43 @@ void GenerateRandomPerformanceTests(StringBuilder str)
BeginPerformanceTestCodeGen(str, "TestRandom");
GeneratePerformanceTest(str, "Random_NextUint", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "uint", m_MemberName = "u", m_ElementInitializer = "0" },
- }, "args.u[i] = args.rng[i].NextUInt();", 10000);
+ }, "args.u[i] = args.rng.NextUInt();", 10000);
GeneratePerformanceTest(str, "Random_NextUint2", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "uint2", m_MemberName = "u", m_ElementInitializer = "0" },
- }, "args.u[i] = args.rng[i].NextUInt2();", 10000);
+ }, "args.u[i] = args.rng.NextUInt2();", 10000);
GeneratePerformanceTest(str, "Random_NextUint3", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "uint3", m_MemberName = "u", m_ElementInitializer = "0" },
- }, "args.u[i] = args.rng[i].NextUInt3();", 10000);
+ }, "args.u[i] = args.rng.NextUInt3();", 10000);
GeneratePerformanceTest(str, "Random_NextUint4", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "uint4", m_MemberName = "u", m_ElementInitializer = "0" },
- }, "args.u[i] = args.rng[i].NextUInt4();", 10000);
+ }, "args.u[i] = args.rng.NextUInt4();", 10000);
GeneratePerformanceTest(str, "Random_NextFloat", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "f", m_ElementInitializer = "0.0f" },
- }, "args.f[i] = args.rng[i].NextFloat();", 10000);
+ }, "args.f[i] = args.rng.NextFloat();", 10000);
GeneratePerformanceTest(str, "Random_NextFloat2", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "float2", m_MemberName = "f", m_ElementInitializer = "new float2(0.0f)" },
- }, "args.f[i] = args.rng[i].NextFloat2();", 10000);
+ }, "args.f[i] = args.rng.NextFloat2();", 10000);
GeneratePerformanceTest(str, "Random_NextFloat3", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "f", m_ElementInitializer = "new float3(0.0f)" },
- }, "args.f[i] = args.rng[i].NextFloat3();", 10000);
+ }, "args.f[i] = args.rng.NextFloat3();", 10000);
GeneratePerformanceTest(str, "Random_NextFloat4", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "float4", m_MemberName = "f", m_ElementInitializer = "new float4(0.0f)" },
- }, "args.f[i] = args.rng[i].NextFloat4();", 10000);
+ }, "args.f[i] = args.rng.NextFloat4();", 10000);
GeneratePerformanceTest(str, "Random_NextDouble", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "double", m_MemberName = "f", m_ElementInitializer = "0.0" },
- }, "args.f[i] = args.rng[i].NextDouble();", 10000);
+ }, "args.f[i] = args.rng.NextDouble();", 10000);
GeneratePerformanceTest(str, "Random_NextDouble2", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "double2", m_MemberName = "f", m_ElementInitializer = "new double2(0.0)" },
- }, "args.f[i] = args.rng[i].NextDouble2();", 10000);
+ }, "args.f[i] = args.rng.NextDouble2();", 10000);
GeneratePerformanceTest(str, "Random_NextDouble3", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "double3", m_MemberName = "f", m_ElementInitializer = "new double3(0.0)" },
- }, "args.f[i] = args.rng[i].NextDouble3();", 10000);
+ }, "args.f[i] = args.rng.NextDouble3();", 10000);
GeneratePerformanceTest(str, "Random_NextDouble4", new PerformanceTestArrayArgument[] {
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Unity.Mathematics.Random(1)" },
new PerformanceTestArrayArgument { m_ElementType = "double4", m_MemberName = "f", m_ElementInitializer = "new double4(0.0)" },
- }, "args.f[i] = args.rng[i].NextDouble4();", 10000);
+ }, "args.f[i] = args.rng.NextDouble4();", 10000);
EndPerformanceTestCodeGen(str);
}
@@ -3691,22 +3682,221 @@ public void GenerateMathPerformanceTests(StringBuilder str)
GeneratePerformanceTest(str, "orthonormal_basis_float", new PerformanceTestArrayArgument[]
{
- // This rng array is totally wasteful since we create loopIterations of them when we just need one.
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Random(1234u)" },
- new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "v1", m_ElementInitializer = "rng[0].NextFloat3Direction()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "v1", m_ElementInitializer = "rng.NextFloat3Direction()" },
new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "v2", m_ElementInitializer = "new float3()" },
new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "v3", m_ElementInitializer = "new float3()" },
}, "math.orthonormal_basis(args.v1[i], out args.v2[i], out args.v3[i]);", 1000000);
GeneratePerformanceTest(str, "orthonormal_basis_double", new PerformanceTestArrayArgument[]
{
- // This rng array is totally wasteful since we create loopIterations of them when we just need one.
- new PerformanceTestArrayArgument { m_ElementType = "Random", m_MemberName = "rng", m_ElementInitializer = "new Random(1234u)" },
- new PerformanceTestArrayArgument { m_ElementType = "double3", m_MemberName = "v1", m_ElementInitializer = "rng[0].NextDouble3Direction()" },
+ new PerformanceTestArrayArgument { m_ElementType = "double3", m_MemberName = "v1", m_ElementInitializer = "rng.NextDouble3Direction()" },
new PerformanceTestArrayArgument { m_ElementType = "double3", m_MemberName = "v2", m_ElementInitializer = "new double()" },
new PerformanceTestArrayArgument { m_ElementType = "double3", m_MemberName = "v3", m_ElementInitializer = "new double()" },
}, "math.orthonormal_basis(args.v1[i], out args.v2[i], out args.v3[i]);", 1000000);
+ GeneratePerformanceTest(str, "asuint_float", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "uint", m_MemberName = "result", m_ElementInitializer = "new uint()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "v", m_ElementInitializer = "rng.NextFloat(-1.0f, 1.0f)" },
+ }, "args.result[i] = math.asuint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asuint_float2", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "uint2", m_MemberName = "result", m_ElementInitializer = "new uint2()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float2", m_MemberName = "v", m_ElementInitializer = "rng.NextFloat2(-1.0f, 1.0f)" },
+ }, "args.result[i] = math.asuint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asuint_float3", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "uint3", m_MemberName = "result", m_ElementInitializer = "new uint3()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "v", m_ElementInitializer = "rng.NextFloat3(-1.0f, 1.0f)" },
+ }, "args.result[i] = math.asuint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asuint_float4", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "uint4", m_MemberName = "result", m_ElementInitializer = "new uint4()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float4", m_MemberName = "v", m_ElementInitializer = "rng.NextFloat4(-1.0f, 1.0f)" },
+ }, "args.result[i] = math.asuint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asint_float", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "int", m_MemberName = "result", m_ElementInitializer = "new int()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "v", m_ElementInitializer = "rng.NextFloat(-1.0f, 1.0f)" },
+ }, "args.result[i] = math.asint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asint_float2", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "int2", m_MemberName = "result", m_ElementInitializer = "new int2()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float2", m_MemberName = "v", m_ElementInitializer = "rng.NextFloat2(-1.0f, 1.0f)" },
+ }, "args.result[i] = math.asint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asint_float3", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "int3", m_MemberName = "result", m_ElementInitializer = "new int3()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "v", m_ElementInitializer = "rng.NextFloat3(-1.0f, 1.0f)" },
+ }, "args.result[i] = math.asint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asint_float4", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "int4", m_MemberName = "result", m_ElementInitializer = "new int4()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float4", m_MemberName = "v", m_ElementInitializer = "rng.NextFloat4(-1.0f, 1.0f)" },
+ }, "args.result[i] = math.asint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asfloat_uint", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "result", m_ElementInitializer = "new uint()" },
+ new PerformanceTestArrayArgument { m_ElementType = "uint", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt()" },
+ }, "args.result[i] = math.asfloat(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asfloat_uint2", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float2", m_MemberName = "result", m_ElementInitializer = "new uint2()" },
+ new PerformanceTestArrayArgument { m_ElementType = "uint2", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt2()" },
+ }, "args.result[i] = math.asfloat(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asfloat_uint3", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "result", m_ElementInitializer = "new uint3()" },
+ new PerformanceTestArrayArgument { m_ElementType = "uint3", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt3()" },
+ }, "args.result[i] = math.asfloat(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asfloat_uint4", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float4", m_MemberName = "result", m_ElementInitializer = "new uint4()" },
+ new PerformanceTestArrayArgument { m_ElementType = "uint4", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt4()" },
+ }, "args.result[i] = math.asfloat(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asfloat_int", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "result", m_ElementInitializer = "new int()" },
+ new PerformanceTestArrayArgument { m_ElementType = "int", m_MemberName = "v", m_ElementInitializer = "rng.NextInt()" },
+ }, "args.result[i] = math.asfloat(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asfloat_int2", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float2", m_MemberName = "result", m_ElementInitializer = "new int2()" },
+ new PerformanceTestArrayArgument { m_ElementType = "int2", m_MemberName = "v", m_ElementInitializer = "rng.NextInt2()" },
+ }, "args.result[i] = math.asfloat(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asfloat_int3", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "result", m_ElementInitializer = "new int3()" },
+ new PerformanceTestArrayArgument { m_ElementType = "int3", m_MemberName = "v", m_ElementInitializer = "rng.NextInt3()" },
+ }, "args.result[i] = math.asfloat(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asfloat_int4", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float4", m_MemberName = "result", m_ElementInitializer = "new int4()" },
+ new PerformanceTestArrayArgument { m_ElementType = "int4", m_MemberName = "v", m_ElementInitializer = "rng.NextInt4()" },
+ }, "args.result[i] = math.asfloat(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asdouble_ulong", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "double", m_MemberName = "result", m_ElementInitializer = "new double()" },
+ new PerformanceTestArrayArgument { m_ElementType = "ulong", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt()" },
+ }, "args.result[i] = math.asdouble(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asdouble_long", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "double", m_MemberName = "result", m_ElementInitializer = "new double()" },
+ new PerformanceTestArrayArgument { m_ElementType = "long", m_MemberName = "v", m_ElementInitializer = "rng.NextInt()" },
+ }, "args.result[i] = math.asdouble(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "aslong_double", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "long", m_MemberName = "result", m_ElementInitializer = "new long()" },
+ new PerformanceTestArrayArgument { m_ElementType = "double", m_MemberName = "v", m_ElementInitializer = "rng.NextDouble(-1.0, 1.0)" },
+ }, "args.result[i] = math.aslong(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asulong_double", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "ulong", m_MemberName = "result", m_ElementInitializer = "new ulong()" },
+ new PerformanceTestArrayArgument { m_ElementType = "double", m_MemberName = "v", m_ElementInitializer = "rng.NextDouble(-1.0, 1.0)" },
+ }, "args.result[i] = math.asulong(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asuint_int", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "uint", m_MemberName = "result", m_ElementInitializer = "new uint()" },
+ new PerformanceTestArrayArgument { m_ElementType = "int", m_MemberName = "v", m_ElementInitializer = "rng.NextInt()" },
+ }, "args.result[i] = math.asuint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asuint_int2", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "uint2", m_MemberName = "result", m_ElementInitializer = "new uint2()" },
+ new PerformanceTestArrayArgument { m_ElementType = "int2", m_MemberName = "v", m_ElementInitializer = "rng.NextInt2()" },
+ }, "args.result[i] = math.asuint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asuint_int3", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "uint3", m_MemberName = "result", m_ElementInitializer = "new uint3()" },
+ new PerformanceTestArrayArgument { m_ElementType = "int3", m_MemberName = "v", m_ElementInitializer = "rng.NextInt3()" },
+ }, "args.result[i] = math.asuint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asuint_int4", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "uint4", m_MemberName = "result", m_ElementInitializer = "new uint4()" },
+ new PerformanceTestArrayArgument { m_ElementType = "int4", m_MemberName = "v", m_ElementInitializer = "rng.NextInt4()" },
+ }, "args.result[i] = math.asuint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asint_uint", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "int", m_MemberName = "result", m_ElementInitializer = "new int()" },
+ new PerformanceTestArrayArgument { m_ElementType = "uint", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt()" },
+ }, "args.result[i] = math.asint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asint_uint2", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "int2", m_MemberName = "result", m_ElementInitializer = "new int2()" },
+ new PerformanceTestArrayArgument { m_ElementType = "uint2", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt2()" },
+ }, "args.result[i] = math.asint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asint_uint3", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "int3", m_MemberName = "result", m_ElementInitializer = "new int3()" },
+ new PerformanceTestArrayArgument { m_ElementType = "uint3", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt3()" },
+ }, "args.result[i] = math.asint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "asint_uint4", new[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "int4", m_MemberName = "result", m_ElementInitializer = "new int4()" },
+ new PerformanceTestArrayArgument { m_ElementType = "uint4", m_MemberName = "v", m_ElementInitializer = "rng.NextUInt4()" },
+ }, "args.result[i] = math.asint(args.v[i]);", 400000);
+
+ GeneratePerformanceTest(str, "chgsign_float", new PerformanceTestArrayArgument[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "f", m_ElementInitializer = "1.0f" },
+ new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "sign", m_ElementInitializer = "rng.NextFloat(-1.0f, 1.0f)" },
+ new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "result", m_ElementInitializer = "0.0f" },
+ }, "args.result[i] = math.chgsign(args.f[i], args.sign[i]);", 100000);
+
+ GeneratePerformanceTest(str, "chgsign_float2", new PerformanceTestArrayArgument[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float2", m_MemberName = "f", m_ElementInitializer = "new float2(1.0f)" },
+ new PerformanceTestArrayArgument { m_ElementType = "float2", m_MemberName = "sign", m_ElementInitializer = "rng.NextFloat2(-1.0f, 1.0f)" },
+ new PerformanceTestArrayArgument { m_ElementType = "float2", m_MemberName = "result", m_ElementInitializer = "new float2()" },
+ }, "args.result[i] = math.chgsign(args.f[i], args.sign[i]);", 100000);
+
+ GeneratePerformanceTest(str, "chgsign_float3", new PerformanceTestArrayArgument[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "f", m_ElementInitializer = "new float3(1.0f)" },
+ new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "sign", m_ElementInitializer = "rng.NextFloat3(-1.0f, 1.0f)" },
+ new PerformanceTestArrayArgument { m_ElementType = "float3", m_MemberName = "result", m_ElementInitializer = "new float3()" },
+ }, "args.result[i] = math.chgsign(args.f[i], args.sign[i]);", 100000);
+
+ GeneratePerformanceTest(str, "chgsign_float4", new PerformanceTestArrayArgument[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "float4", m_MemberName = "f", m_ElementInitializer = "new float4(1.0f)" },
+ new PerformanceTestArrayArgument { m_ElementType = "float4", m_MemberName = "sign", m_ElementInitializer = "rng.NextFloat4(-1.0f, 1.0f)" },
+ new PerformanceTestArrayArgument { m_ElementType = "float4", m_MemberName = "result", m_ElementInitializer = "new float4()" },
+ }, "args.result[i] = math.chgsign(args.f[i], args.sign[i]);", 100000);
+
+ GeneratePerformanceTest(str, "angle_quaternion_quaternion", new PerformanceTestArrayArgument[]
+ {
+ new PerformanceTestArrayArgument { m_ElementType = "quaternion", m_MemberName = "q1", m_ElementInitializer = "rng.NextQuaternionRotation()" },
+ new PerformanceTestArrayArgument { m_ElementType = "quaternion", m_MemberName = "q2", m_ElementInitializer = "rng.NextQuaternionRotation()" },
+ new PerformanceTestArrayArgument { m_ElementType = "float", m_MemberName = "result", m_ElementInitializer = "new float()" },
+ }, "args.result[i] = math.angle(args.q1[i], args.q2[i]);", 10000);
+
EndPerformanceTestCodeGen(str);
}
@@ -3717,13 +3907,15 @@ public struct PerformanceTestArrayArgument
public string m_ElementInitializer;
}
- void GeneratePerformanceTest(StringBuilder str, string testName, PerformanceTestArrayArgument[] testArguments, string loopBody, int loopIterations)
+ void GeneratePerformanceTest(StringBuilder str, string testName, PerformanceTestArrayArgument[] testArguments, string loopBody, int loopIterations, uint rngSeed = 1u)
{
str.AppendFormat("\t\t[BurstCompile(CompileSynchronously = true)]\n");
str.AppendFormat("\t\tpublic unsafe class {0}\n", testName);
str.AppendFormat("\t\t{{\n");
+ str.AppendFormat("\t\t\tpublic const int iterations = {0};\n\n", loopIterations);
str.AppendFormat("\t\t\tpublic struct Arguments : IDisposable\n");
str.AppendFormat("\t\t\t{{\n");
+ str.AppendFormat("\t\t\t\tpublic Random rng;\n");
foreach (var argument in testArguments)
{
@@ -3733,11 +3925,12 @@ void GeneratePerformanceTest(StringBuilder str, string testName, PerformanceTest
str.AppendFormat("\n");
str.AppendFormat("\t\t\t\tpublic void Init()\n");
str.AppendFormat("\t\t\t\t{{\n");
+ str.AppendFormat("\t\t\t\t\trng = new Random({0});\n", rngSeed);
foreach (var argument in testArguments)
{
- str.AppendFormat("\t\t\t\t\t{0} = ({1}*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf<{1}>() * {2}, UnsafeUtility.AlignOf<{1}>(), Allocator.Persistent);\n", argument.m_MemberName, argument.m_ElementType, loopIterations);
- str.AppendFormat("\t\t\t\t\tfor (int i = 0; i < {0}; ++i)\n", loopIterations);
+ str.AppendFormat("\t\t\t\t\t{0} = ({1}*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf<{1}>() * iterations, UnsafeUtility.AlignOf<{1}>(), Allocator.Persistent);\n", argument.m_MemberName, argument.m_ElementType);
+ str.AppendFormat("\t\t\t\t\tfor (int i = 0; i < iterations; ++i)\n");
str.AppendFormat("\t\t\t\t\t{{\n");
str.AppendFormat("\t\t\t\t\t {0}[i] = {1};\n", argument.m_MemberName, argument.m_ElementInitializer);
str.AppendFormat("\t\t\t\t\t}}\n\n");
@@ -3758,7 +3951,7 @@ void GeneratePerformanceTest(StringBuilder str, string testName, PerformanceTest
str.AppendFormat("\t\t\tpublic static void CommonTestFunction(ref Arguments args)\n");
str.AppendFormat("\t\t\t{{\n");
- str.AppendFormat("\t\t\t\tfor (int i = 0; i < {0}; ++i)\n", loopIterations);
+ str.AppendFormat("\t\t\t\tfor (int i = 0; i < iterations; ++i)\n");
str.AppendFormat("\t\t\t\t{{\n");
str.AppendFormat("\t\t\t\t\t{0}\n", loopBody);
str.AppendFormat("\t\t\t\t}}\n");
diff --git a/src/Unity.Mathematics.CodeGen/VectorGenerator.cs.meta b/src/Unity.Mathematics.CodeGen~/VectorGenerator.cs.meta
similarity index 100%
rename from src/Unity.Mathematics.CodeGen/VectorGenerator.cs.meta
rename to src/Unity.Mathematics.CodeGen~/VectorGenerator.cs.meta
diff --git a/src/Unity.Mathematics.Editor/MatrixDrawer.cs b/src/Unity.Mathematics.Editor/MatrixDrawer.cs
index 3f31a0c7..f59d2c91 100644
--- a/src/Unity.Mathematics.Editor/MatrixDrawer.cs
+++ b/src/Unity.Mathematics.Editor/MatrixDrawer.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using UnityEditor;
@@ -23,10 +23,12 @@ namespace Unity.Mathematics.Editor
[CustomPropertyDrawer(typeof(uint4x2)), CustomPropertyDrawer(typeof(uint4x3)), CustomPropertyDrawer(typeof(uint4x4))]
class MatrixDrawer : PropertyDrawer
{
+#if !UNITY_2023_2_OR_NEWER
public override bool CanCacheInspectorGUI(SerializedProperty property)
{
return false;
}
+#endif
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
diff --git a/src/Unity.Mathematics.Editor/PostNormalizedVectorDrawer.cs b/src/Unity.Mathematics.Editor/PostNormalizedVectorDrawer.cs
index d4189eda..eaa2a07d 100644
--- a/src/Unity.Mathematics.Editor/PostNormalizedVectorDrawer.cs
+++ b/src/Unity.Mathematics.Editor/PostNormalizedVectorDrawer.cs
@@ -12,8 +12,10 @@ class PostNormalizedVectorDrawer : PrimitiveVectorDrawer
{
static class Content
{
- public static readonly string tooltip =
- L10n.Tr("Values you enter will be post-normalized. You will see the normalized result if you change selection and view the values again.");
+ public static readonly GUIContent Tooltip = new (
+ string.Empty,
+ L10n.Tr("Values you enter will be post-normalized. You will see the normalized result if you "
+ + "change selection and view the values again."));
}
class VectorPropertyGUIData
@@ -181,8 +183,12 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
return;
}
+ // Avoid polluting the passed-in GUIContent - it might be static and shared.
if (string.IsNullOrEmpty(label.tooltip))
- label.tooltip = Content.tooltip;
+ {
+ Content.Tooltip.text = label.text;
+ label = Content.Tooltip;
+ }
guiData.RebuildIfDirty();
guiData.ApplyPreNormalizedValues();
diff --git a/src/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs b/src/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs
index d84d81f9..5353bdcb 100644
--- a/src/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs
+++ b/src/Unity.Mathematics.Editor/PrimitiveVectorDrawer.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using UnityEditor;
using UnityEngine;
@@ -36,18 +36,20 @@ static class Content
public static readonly string doNotNormalizeCompatibility = L10n.Tr(
$"{typeof(DoNotNormalizeAttribute).Name} only works with {typeof(quaternion)} and primitive vector types."
);
- public static readonly string doNotNormalizeTooltip =
- L10n.Tr("This value is not normalized, which may produce unexpected results.");
+ public static readonly GUIContent doNotNormalizeContent = new GUIContent("",
+ L10n.Tr("This value is not normalized, which may produce unexpected results."));
public static readonly GUIContent[] labels2 = { new GUIContent("X"), new GUIContent("Y") };
public static readonly GUIContent[] labels3 = { new GUIContent("X"), new GUIContent("Y"), new GUIContent("Z") };
public static readonly GUIContent[] labels4 = { new GUIContent("X"), new GUIContent("Y"), new GUIContent("Z"), new GUIContent("W") };
}
+#if !UNITY_2023_2_OR_NEWER
public override bool CanCacheInspectorGUI(SerializedProperty property)
{
return false;
}
+#endif
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
@@ -87,11 +89,156 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
}
if (attribute is DoNotNormalizeAttribute && string.IsNullOrEmpty(label.tooltip))
- label.tooltip = Content.doNotNormalizeTooltip;
-
- EditorGUI.BeginProperty(position, label, property);
- EditorGUI.MultiPropertyField(position, subLabels, property.FindPropertyRelative(startIter), label);
+ {
+ Content.doNotNormalizeContent.text = label.text;
+ label = Content.doNotNormalizeContent;
+ }
+ label = EditorGUI.BeginProperty(position, label, property);
+ var valuesIterator = property.FindPropertyRelative(startIter);
+ MultiPropertyField(position, subLabels, valuesIterator, label);
EditorGUI.EndProperty();
}
+
+ void MultiPropertyField(Rect position, GUIContent[] subLabels, SerializedProperty valuesIterator, GUIContent label)
+ {
+#if UNITY_2022_1_OR_NEWER
+ EditorGUI.MultiPropertyField(position, subLabels, valuesIterator, label, EditorGUI.PropertyVisibility.All);
+#else
+ EditorGUICopy.MultiPropertyField(position, subLabels, valuesIterator, label);
+#endif
+ }
+ }
+
+#if !UNITY_2022_1_OR_NEWER
+ internal class EditorGUICopy
+ {
+ internal const float kSpacingSubLabel = 4;
+ private const float kIndentPerLevel = 15;
+ internal const float kPrefixPaddingRight = 2;
+ internal static int indentLevel = 0;
+ private static readonly int s_FoldoutHash = "Foldout".GetHashCode();
+
+ // internal static readonly SVC kVerticalSpacingMultiField = new SVC("--theme-multifield-vertical-spacing", 0.0f);
+ // kVerticalSpacingMultiField should actually look like the above line ^^^ but we don't have access to SVC,
+ // so instead we just set this value to what is observed in the debugger with the Unity dark theme.
+ internal const float kVerticalSpacingMultiField = 2;
+
+ internal enum PropertyVisibility
+ {
+ All,
+ OnlyVisible
+ }
+
+ // This code is basically EditorGUI.MultiPropertyField(Rect, GUIContent[], SerializedProperty, GUIContent),
+ // but with the property visibility assumed to be "All" instead of "OnlyVisible". We really want to have "All"
+ // because it's possible for someone to hide something in the inspector with [HideInInspector] but then manually
+ // draw it themselves later. In this case, if you called EditorGUI.MultiPropertyField() directly, you'd
+ // end up with some fields that point to some unrelated visible property.
+ public static void MultiPropertyField(Rect position, GUIContent[] subLabels, SerializedProperty valuesIterator, GUIContent label)
+ {
+ int id = GUIUtility.GetControlID(s_FoldoutHash, FocusType.Keyboard, position);
+ position = MultiFieldPrefixLabel(position, id, label, subLabels.Length);
+ position.height = EditorGUIUtility.singleLineHeight;
+ MultiPropertyFieldInternal(position, subLabels, valuesIterator, PropertyVisibility.All);
+ }
+
+ internal static void BeginDisabled(bool disabled)
+ {
+ // Unused, but left here to minimize changes in EditorGUICopy.MultiPropertyFieldInternal().
+ }
+
+ internal static void EndDisabled()
+ {
+ // Unused, but left here to minimize changes in EditorGUICopy.MultiPropertyFieldInternal().
+ }
+
+ internal static float CalcPrefixLabelWidth(GUIContent label, GUIStyle style = null)
+ {
+ if (style == null)
+ style = EditorStyles.label;
+ return style.CalcSize(label).x;
+ }
+
+ internal static void MultiPropertyFieldInternal(Rect position, GUIContent[] subLabels, SerializedProperty valuesIterator, PropertyVisibility visibility, bool[] disabledMask = null, float prefixLabelWidth = -1)
+ {
+ int eCount = subLabels.Length;
+ float w = (position.width - (eCount - 1) * kSpacingSubLabel) / eCount;
+ Rect nr = new Rect(position) {width = w};
+ float t = EditorGUIUtility.labelWidth;
+ int l = indentLevel;
+ indentLevel = 0;
+ for (int i = 0; i < subLabels.Length; i++)
+ {
+ EditorGUIUtility.labelWidth = prefixLabelWidth > 0 ? prefixLabelWidth : CalcPrefixLabelWidth(subLabels[i]);
+
+ if (disabledMask != null)
+ BeginDisabled(disabledMask[i]);
+ EditorGUI.PropertyField(nr, valuesIterator, subLabels[i]);
+ if (disabledMask != null)
+ EndDisabled();
+ nr.x += w + kSpacingSubLabel;
+
+ switch (visibility)
+ {
+ case PropertyVisibility.All:
+ valuesIterator.Next(false);
+ break;
+
+ case PropertyVisibility.OnlyVisible:
+ valuesIterator.NextVisible(false);
+ break;
+ }
+ }
+ EditorGUIUtility.labelWidth = t;
+ indentLevel = l;
+ }
+
+ internal static bool LabelHasContent(GUIContent label)
+ {
+ if (label == null)
+ {
+ return true;
+ }
+ // @TODO: find out why checking for GUIContent.none doesn't work
+ return label.text != string.Empty || label.image != null;
+ }
+
+ internal static float indent => indentLevel * kIndentPerLevel;
+
+ internal static Rect MultiFieldPrefixLabel(Rect totalPosition, int id, GUIContent label, int columns)
+ {
+ if (!LabelHasContent(label))
+ {
+ return EditorGUI.IndentedRect(totalPosition);
+ }
+
+ if (EditorGUIUtility.wideMode)
+ {
+ Rect labelPosition = new Rect(totalPosition.x + indent, totalPosition.y, EditorGUIUtility.labelWidth - indent, EditorGUIUtility.singleLineHeight);
+ Rect fieldPosition = totalPosition;
+ fieldPosition.xMin += EditorGUIUtility.labelWidth + kPrefixPaddingRight;
+
+ // If there are 2 columns we use the same column widths as if there had been 3 columns
+ // in order to make columns line up neatly.
+ if (columns == 2)
+ {
+ float columnWidth = (fieldPosition.width - (3 - 1) * kSpacingSubLabel) / 3f;
+ fieldPosition.xMax -= (columnWidth + kSpacingSubLabel);
+ }
+
+ EditorGUI.HandlePrefixLabel(totalPosition, labelPosition, label, id);
+ return fieldPosition;
+ }
+ else
+ {
+ Rect labelPosition = new Rect(totalPosition.x + indent, totalPosition.y, totalPosition.width - indent, EditorGUIUtility.singleLineHeight);
+ Rect fieldPosition = totalPosition;
+ fieldPosition.xMin += indent + kIndentPerLevel;
+ fieldPosition.yMin += EditorGUIUtility.singleLineHeight + kVerticalSpacingMultiField;
+ EditorGUI.HandlePrefixLabel(totalPosition, labelPosition, label, id);
+ return fieldPosition;
+ }
+ }
}
+#endif
}
diff --git a/src/Unity.Mathematics.PerformanceTests/TestConversions.gen.cs b/src/Unity.Mathematics.PerformanceTests/TestConversions.gen.cs
index 08266759..3050d7f5 100644
--- a/src/Unity.Mathematics.PerformanceTests/TestConversions.gen.cs
+++ b/src/Unity.Mathematics.PerformanceTests/TestConversions.gen.cs
@@ -21,21 +21,25 @@ partial class TestConversions
[BurstCompile(CompileSynchronously = true)]
public unsafe class quaternion_to_float3x3
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public quaternion* q;
public float3x3* f3x3;
public void Init()
{
- q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
q[i] = quaternion.identity;
}
- f3x3 = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ f3x3 = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f3x3[i] = float3x3.identity;
}
@@ -51,7 +55,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.f3x3[i] = new float3x3(args.q[i]);
}
@@ -109,21 +113,25 @@ public void quaternion_to_float3x3_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float3x3_to_quaternion
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public quaternion* q;
public float3x3* f3x3;
public void Init()
{
- q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
q[i] = quaternion.identity;
}
- f3x3 = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ f3x3 = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f3x3[i] = float3x3.identity;
}
@@ -139,7 +147,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.q[i] = new quaternion(args.f3x3[i]);
}
@@ -197,21 +205,25 @@ public void float3x3_to_quaternion_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float4_to_half4
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4* f4;
public half4* h4;
public void Init()
{
- f4 = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ f4 = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f4[i] = new float4(1.0f, 2.0f, 3.0f, 4.0f);
}
- h4 = (half4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ h4 = (half4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
h4[i] = new half4(new float4(-1.0f, -2.0f, -3.0f, -4.0f));
}
@@ -227,7 +239,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.h4[i] = new half4(args.f4[i]);
}
@@ -285,21 +297,25 @@ public void float4_to_half4_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class half4_to_float4
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4* f4;
public half4* h4;
public void Init()
{
- f4 = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ f4 = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f4[i] = new float4(1.0f, 2.0f, 3.0f, 4.0f);
}
- h4 = (half4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ h4 = (half4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
h4[i] = new half4(new float4(-1.0f, -2.0f, -3.0f, -4.0f));
}
@@ -315,7 +331,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.f4[i] = new float4(args.h4[i]);
}
@@ -373,28 +389,32 @@ public void half4_to_float4_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class quaternion_to_RigidTransform
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public quaternion* q;
public RigidTransform* rt;
public float3* pos;
public void Init()
{
- q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
q[i] = quaternion.identity;
}
- rt = (RigidTransform*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rt = (RigidTransform*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
rt[i] = RigidTransform.identity;
}
- pos = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ pos = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
pos[i] = new float3();
}
@@ -411,7 +431,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.rt[i] = new RigidTransform(args.q[i], args.pos[i]);
}
@@ -469,21 +489,25 @@ public void quaternion_to_RigidTransform_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class quaternion_to_float4x4
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public quaternion* q;
public float4x4* f4x4;
public void Init()
{
- q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
q[i] = quaternion.identity;
}
- f4x4 = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ f4x4 = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f4x4[i] = float4x4.identity;
}
@@ -499,7 +523,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.q[i] = new quaternion(args.f4x4[i]);
}
@@ -557,28 +581,32 @@ public void quaternion_to_float4x4_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float4x4_to_quaternion
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public quaternion* q;
public float4x4* f4x4;
public float3* f3;
public void Init()
{
- q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
q[i] = quaternion.identity;
}
- f4x4 = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ f4x4 = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f4x4[i] = float4x4.identity;
}
- f3 = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ f3 = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f3[i] = new float3();
}
@@ -595,7 +623,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.f4x4[i] = new float4x4(args.q[i], args.f3[i]);
}
@@ -653,21 +681,25 @@ public void float4x4_to_quaternion_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float4_to_uint4
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4* f4;
public uint4* u4;
public void Init()
{
- f4 = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ f4 = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f4[i] = new float4(1.0f, 2.0f, 3.0f, 4.0f);
}
- u4 = (uint4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ u4 = (uint4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
u4[i] = new uint4(100, 101, 102, 103);
}
@@ -683,7 +715,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.u4[i] = new uint4(args.f4[i]);
}
@@ -741,21 +773,25 @@ public void float4_to_uint4_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class uint4_to_float4
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4* f4;
public uint4* u4;
public void Init()
{
- f4 = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ f4 = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
f4[i] = new float4(1.0f, 2.0f, 3.0f, 4.0f);
}
- u4 = (uint4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ u4 = (uint4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
u4[i] = new uint4(100, 101, 102, 103);
}
@@ -771,7 +807,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.f4[i] = new float4(args.u4[i]);
}
diff --git a/src/Unity.Mathematics.PerformanceTests/TestFastInverse.gen.cs b/src/Unity.Mathematics.PerformanceTests/TestFastInverse.gen.cs
index b133ff85..570951dd 100644
--- a/src/Unity.Mathematics.PerformanceTests/TestFastInverse.gen.cs
+++ b/src/Unity.Mathematics.PerformanceTests/TestFastInverse.gen.cs
@@ -21,14 +21,18 @@ partial class TestFastInverse
[BurstCompile(CompileSynchronously = true)]
public unsafe class float4x4_fastinverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4x4* m1;
public void Init()
{
- m1 = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ m1 = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
m1[i] = float4x4.identity;
}
@@ -43,7 +47,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.m1[i] = math.fastinverse(args.m1[i]);
}
@@ -101,14 +105,18 @@ public void float4x4_fastinverse_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class double4x4_fastinverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public double4x4* m1;
public void Init()
{
- m1 = (double4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ m1 = (double4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
m1[i] = double4x4.identity;
}
@@ -123,7 +131,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.m1[i] = math.fastinverse(args.m1[i]);
}
diff --git a/src/Unity.Mathematics.PerformanceTests/TestHash.cs b/src/Unity.Mathematics.PerformanceTests/TestHash.cs
new file mode 100644
index 00000000..106f451f
--- /dev/null
+++ b/src/Unity.Mathematics.PerformanceTests/TestHash.cs
@@ -0,0 +1,58 @@
+using Unity.Burst;
+using Unity.PerformanceTesting;
+using NUnit.Framework;
+using Unity.Collections.LowLevel.Unsafe;
+using System;
+using UnityEngine;
+
+namespace Unity.Mathematics.PerformanceTests
+{
+ [BurstCompile]
+ partial class TestHash
+ {
+ static readonly long kBufferBytes = 1024 * 1024;
+ static readonly long kBytesToHash = kBufferBytes - 1;
+ static readonly uint kExpectedHash = 1781740882;
+
+ [Test, Performance]
+ public static unsafe void HashAligned()
+ {
+ Assert.AreEqual(kExpectedHash, Hash(false));
+ }
+
+ [Test, Performance]
+ public static unsafe void HashUnaligned()
+ {
+ Assert.AreEqual(kExpectedHash, Hash(true));
+ }
+
+ [BurstCompile(CompileSynchronously = true)]
+ static unsafe uint Hash(bool useUnalignedBuffer)
+ {
+ var ptr = (ulong)(UIntPtr)UnsafeUtility.Malloc(kBufferBytes, 16, Collections.Allocator.Persistent);
+ var ulongptr = (ulong)ptr;
+ uint seed = 0;
+
+ if (useUnalignedBuffer && ((ulongptr & 1) == 0))
+ {
+ ++ulongptr;
+ }
+
+ var buffer = (void*)ulongptr;
+
+ for (int i = 0; i < kBytesToHash; ++i)
+ {
+ ((byte*)buffer)[i] = 123;
+ }
+
+ for (int i = 0; i < 100; ++i)
+ {
+ seed = math.hash(buffer, (int)kBytesToHash, seed);
+ }
+
+ UnsafeUtility.Free((void*)ptr, Collections.Allocator.Persistent);
+
+ return seed;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Unity.Mathematics.PerformanceTests/TestHash.cs.meta b/src/Unity.Mathematics.PerformanceTests/TestHash.cs.meta
new file mode 100644
index 00000000..fcfb809b
--- /dev/null
+++ b/src/Unity.Mathematics.PerformanceTests/TestHash.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c1a8761ebc1ffa240aa484721a63ba9f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/src/Unity.Mathematics.PerformanceTests/TestHash.gen.cs b/src/Unity.Mathematics.PerformanceTests/TestHash.gen.cs
index b26397f9..e90cf82c 100644
--- a/src/Unity.Mathematics.PerformanceTests/TestHash.gen.cs
+++ b/src/Unity.Mathematics.PerformanceTests/TestHash.gen.cs
@@ -21,21 +21,25 @@ partial class TestHash
[BurstCompile(CompileSynchronously = true)]
public unsafe class float2_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float2* v;
public uint* hash;
public void Init()
{
- v = (float2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float2(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -51,7 +55,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -109,21 +113,25 @@ public void float2_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float3_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float3* v;
public uint* hash;
public void Init()
{
- v = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float3(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -139,7 +147,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -197,21 +205,25 @@ public void float3_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float4_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4* v;
public uint* hash;
public void Init()
{
- v = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float4(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -227,7 +239,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -285,21 +297,25 @@ public void float4_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class double2_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public double2* v;
public uint* hash;
public void Init()
{
- v = (double2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (double2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new double2(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -315,7 +331,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -373,21 +389,25 @@ public void double2_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class double3_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public double3* v;
public uint* hash;
public void Init()
{
- v = (double3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (double3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new double3(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -403,7 +423,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -461,21 +481,25 @@ public void double3_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class double4_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public double4* v;
public uint* hash;
public void Init()
{
- v = (double4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (double4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new double4(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -491,7 +515,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -549,21 +573,25 @@ public void double4_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float2x2_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float2x2* v;
public uint* hash;
public void Init()
{
- v = (float2x2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float2x2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float2x2(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -579,7 +607,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -637,21 +665,25 @@ public void float2x2_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float3x3_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float3x3* v;
public uint* hash;
public void Init()
{
- v = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float3x3(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -667,7 +699,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -725,21 +757,25 @@ public void float3x3_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float4x4_hash
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4x4* v;
public uint* hash;
public void Init()
{
- v = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float4x4(1.0f);
}
- hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -755,7 +791,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hash(args.v[i]);
}
@@ -813,21 +849,25 @@ public void float4x4_hash_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float2x2_hashwide
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float2x2* v;
public uint2* hash;
public void Init()
{
- v = (float2x2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float2x2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float2x2(1.0f);
}
- hash = (uint2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -843,7 +883,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hashwide(args.v[i]);
}
@@ -901,21 +941,25 @@ public void float2x2_hashwide_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float3x3_hashwide
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float3x3* v;
public uint3* hash;
public void Init()
{
- v = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float3x3(1.0f);
}
- hash = (uint3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -931,7 +975,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hashwide(args.v[i]);
}
@@ -989,21 +1033,25 @@ public void float3x3_hashwide_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float4x4_hashwide
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4x4* v;
public uint4* hash;
public void Init()
{
- v = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float4x4(1.0f);
}
- hash = (uint4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = 0;
}
@@ -1019,7 +1067,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hashwide(args.v[i]);
}
@@ -1077,21 +1125,25 @@ public void float4x4_hashwide_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float2_hashwide
{
+ public const int iterations = 100000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float2* v;
public uint2* hash;
public void Init()
{
- v = (float2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ rng = new Random(1);
+ v = (float2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v[i] = new float2(1.0f);
}
- hash = (uint2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 100000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 100000; ++i)
+ hash = (uint2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
hash[i] = new uint2();
}
@@ -1107,7 +1159,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 100000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.hash[i] = math.hashwide(args.v[i]);
}
diff --git a/src/Unity.Mathematics.PerformanceTests/TestInverse.gen.cs b/src/Unity.Mathematics.PerformanceTests/TestInverse.gen.cs
index 5450d48c..26bfc7da 100644
--- a/src/Unity.Mathematics.PerformanceTests/TestInverse.gen.cs
+++ b/src/Unity.Mathematics.PerformanceTests/TestInverse.gen.cs
@@ -21,14 +21,18 @@ partial class TestInverse
[BurstCompile(CompileSynchronously = true)]
public unsafe class float4x4_inverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float4x4* m1;
public void Init()
{
- m1 = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ m1 = (float4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
m1[i] = float4x4.identity;
}
@@ -43,7 +47,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.m1[i] = math.inverse(args.m1[i]);
}
@@ -101,14 +105,18 @@ public void float4x4_inverse_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float3x3_inverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float3x3* m1;
public void Init()
{
- m1 = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ m1 = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
m1[i] = float3x3.identity;
}
@@ -123,7 +131,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.m1[i] = math.inverse(args.m1[i]);
}
@@ -181,14 +189,18 @@ public void float3x3_inverse_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class float2x2_inverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public float2x2* m1;
public void Init()
{
- m1 = (float2x2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ m1 = (float2x2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
m1[i] = float2x2.identity;
}
@@ -203,7 +215,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.m1[i] = math.inverse(args.m1[i]);
}
@@ -261,14 +273,18 @@ public void float2x2_inverse_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class double4x4_inverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public double4x4* m1;
public void Init()
{
- m1 = (double4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ m1 = (double4x4*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
m1[i] = double4x4.identity;
}
@@ -283,7 +299,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.m1[i] = math.inverse(args.m1[i]);
}
@@ -341,14 +357,18 @@ public void double4x4_inverse_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class double3x3_inverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public double3x3* m1;
public void Init()
{
- m1 = (double3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ m1 = (double3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
m1[i] = double3x3.identity;
}
@@ -363,7 +383,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.m1[i] = math.inverse(args.m1[i]);
}
@@ -421,14 +441,18 @@ public void double3x3_inverse_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class double2x2_inverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public double2x2* m1;
public void Init()
{
- m1 = (double2x2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ m1 = (double2x2*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
m1[i] = double2x2.identity;
}
@@ -443,7 +467,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.m1[i] = math.inverse(args.m1[i]);
}
@@ -501,14 +525,18 @@ public void double2x2_inverse_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class quaternion_inverse
{
+ public const int iterations = 10000;
+
public struct Arguments : IDisposable
{
+ public Random rng;
public quaternion* q;
public void Init()
{
- q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 10000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 10000; ++i)
+ rng = new Random(1);
+ q = (quaternion*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
q[i] = quaternion.identity;
}
@@ -523,7 +551,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 10000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
args.q[i] = math.inverse(args.q[i]);
}
@@ -568,6 +596,90 @@ public void quaternion_inverse_burst()
var args = new quaternion_inverse.Arguments();
args.Init();
+ var burstSampleGroup = new SampleGroup("Burst", SampleUnit.Microsecond); Measure.Method(() =>
+ {
+ testFunction.Invoke(ref args);
+ })
+ .SampleGroup(burstSampleGroup)
+ .WarmupCount(1)
+ .MeasurementCount(10)
+ .Run();
+ args.Dispose();
+ }
+ [BurstCompile(CompileSynchronously = true)]
+ public unsafe class pseudoinverse
+ {
+ public const int iterations = 1000;
+
+ public struct Arguments : IDisposable
+ {
+ public Random rng;
+ public float3x3* m;
+
+ public void Init()
+ {
+ rng = new Random(1);
+ m = (float3x3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
+ {
+ m[i] = new float3x3(0.054824f, 0.462398f, 0.050136f, 0.054824f, 0.462398f, 0.050136f, 0.938166f, 0.542226f, 0.106844f);
+ }
+
+ }
+
+ public void Dispose()
+ {
+ UnsafeUtility.Free(m, Allocator.Persistent);
+ }
+ }
+
+ public static void CommonTestFunction(ref Arguments args)
+ {
+ for (int i = 0; i < iterations; ++i)
+ {
+ args.m[i] = math.pseudoinverse(args.m[i]);
+ }
+ }
+
+ public static void MonoTestFunction(ref Arguments args)
+ {
+ CommonTestFunction(ref args);
+ }
+
+ [BurstCompile(CompileSynchronously = true)]
+ public static void BurstTestFunction(ref Arguments args)
+ {
+ CommonTestFunction(ref args);
+ }
+
+ public delegate void TestFunction(ref Arguments args);
+ }
+
+ [Test, Performance]
+ public void pseudoinverse_mono()
+ {
+ pseudoinverse.TestFunction testFunction = pseudoinverse.MonoTestFunction;
+ var args = new pseudoinverse.Arguments();
+ args.Init();
+
+ var monoSampleGroup = new SampleGroup("Mono", SampleUnit.Microsecond); Measure.Method(() =>
+ {
+ testFunction.Invoke(ref args);
+ })
+ .SampleGroup(monoSampleGroup)
+ .WarmupCount(1)
+ .MeasurementCount(10)
+ .Run();
+ args.Dispose();
+ }
+
+ [Test, Performance]
+ public void pseudoinverse_burst()
+ {
+ FunctionPointer testFunction = BurstCompiler.CompileFunctionPointer(pseudoinverse.BurstTestFunction);
+ var args = new pseudoinverse.Arguments();
+ args.Init();
+
var burstSampleGroup = new SampleGroup("Burst", SampleUnit.Microsecond); Measure.Method(() =>
{
testFunction.Invoke(ref args);
diff --git a/src/Unity.Mathematics.PerformanceTests/TestMath.gen.cs b/src/Unity.Mathematics.PerformanceTests/TestMath.gen.cs
index d2efa23f..dfab18d9 100644
--- a/src/Unity.Mathematics.PerformanceTests/TestMath.gen.cs
+++ b/src/Unity.Mathematics.PerformanceTests/TestMath.gen.cs
@@ -21,35 +21,32 @@ partial class TestMath
[BurstCompile(CompileSynchronously = true)]
public unsafe class orthonormal_basis_float
{
+ public const int iterations = 1000000;
+
public struct Arguments : IDisposable
{
- public Random* rng;
+ public Random rng;
public float3* v1;
public float3* v2;
public float3* v3;
public void Init()
{
- rng = (Random*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 1000000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 1000000; ++i)
- {
- rng[i] = new Random(1234u);
- }
-
- v1 = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 1000000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 1000000; ++i)
+ rng = new Random(1);
+ v1 = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
- v1[i] = rng[0].NextFloat3Direction();
+ v1[i] = rng.NextFloat3Direction();
}
- v2 = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 1000000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 1000000; ++i)
+ v2 = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v2[i] = new float3();
}
- v3 = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 1000000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 1000000; ++i)
+ v3 = (float3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v3[i] = new float3();
}
@@ -58,7 +55,6 @@ public void Init()
public void Dispose()
{
- UnsafeUtility.Free(rng, Allocator.Persistent);
UnsafeUtility.Free(v1, Allocator.Persistent);
UnsafeUtility.Free(v2, Allocator.Persistent);
UnsafeUtility.Free(v3, Allocator.Persistent);
@@ -67,7 +63,7 @@ public void Dispose()
public static void CommonTestFunction(ref Arguments args)
{
- for (int i = 0; i < 1000000; ++i)
+ for (int i = 0; i < iterations; ++i)
{
math.orthonormal_basis(args.v1[i], out args.v2[i], out args.v3[i]);
}
@@ -125,35 +121,32 @@ public void orthonormal_basis_float_burst()
[BurstCompile(CompileSynchronously = true)]
public unsafe class orthonormal_basis_double
{
+ public const int iterations = 1000000;
+
public struct Arguments : IDisposable
{
- public Random* rng;
+ public Random rng;
public double3* v1;
public double3* v2;
public double3* v3;
public void Init()
{
- rng = (Random*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 1000000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 1000000; ++i)
- {
- rng[i] = new Random(1234u);
- }
-
- v1 = (double3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 1000000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 1000000; ++i)
+ rng = new Random(1);
+ v1 = (double3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
- v1[i] = rng[0].NextDouble3Direction();
+ v1[i] = rng.NextDouble3Direction();
}
- v2 = (double3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 1000000, UnsafeUtility.AlignOf(), Allocator.Persistent);
- for (int i = 0; i < 1000000; ++i)
+ v2 = (double3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * iterations, UnsafeUtility.AlignOf(), Allocator.Persistent);
+ for (int i = 0; i < iterations; ++i)
{
v2[i] = new double();
}
- v3 = (double3*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf() * 1000000, UnsafeUtility.AlignOf