diff --git a/Content/Shader/EdgePicker.shader b/Content/Shader/EdgePicker.shader index a12c811ed..cc74aa800 100644 --- a/Content/Shader/EdgePicker.shader +++ b/Content/Shader/EdgePicker.shader @@ -49,7 +49,7 @@ CGPROGRAM return o; } - float4 frag (v2f i) : COLOR + float4 frag (v2f i) : SV_Target { return i.color; } diff --git a/Content/Shader/FaceHighlight.shader b/Content/Shader/FaceHighlight.shader index 745bad138..ea8f6582c 100644 --- a/Content/Shader/FaceHighlight.shader +++ b/Content/Shader/FaceHighlight.shader @@ -45,7 +45,7 @@ Shader "Hidden/ProBuilder/FaceHighlight" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { i.pos.xy = floor(i.pos.xy * 1) * .5; float checker = -frac(i.pos.x + i.pos.y); diff --git a/Content/Shader/FacePicker.shader b/Content/Shader/FacePicker.shader index 78d729789..90ada9cc5 100644 --- a/Content/Shader/FacePicker.shader +++ b/Content/Shader/FacePicker.shader @@ -41,7 +41,7 @@ Shader "Hidden/ProBuilder/FacePicker" return o; } - float4 frag (v2f i) : COLOR + float4 frag (v2f i) : SV_Target { return i.color; } diff --git a/Content/Shader/HideVertices.shader b/Content/Shader/HideVertices.shader index fa83ce030..14148ae68 100644 --- a/Content/Shader/HideVertices.shader +++ b/Content/Shader/HideVertices.shader @@ -33,7 +33,7 @@ Shader "Hidden/ProBuilder/HideVertices" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { return fixed4(0,0,0,0); } diff --git a/Content/Shader/LineBillboard.shader b/Content/Shader/LineBillboard.shader index b2284b3a2..3e8a58616 100644 --- a/Content/Shader/LineBillboard.shader +++ b/Content/Shader/LineBillboard.shader @@ -94,7 +94,7 @@ Shader "Hidden/ProBuilder/LineBillboard" triStream.Append(geo_out); } - fixed4 frag (v2f i) : COLOR + fixed4 frag (v2f i) : SV_Target { return i.color * _Color; } diff --git a/Content/Shader/LineBillboardMetal.shader b/Content/Shader/LineBillboardMetal.shader index e433a7e98..fa03ee02f 100644 --- a/Content/Shader/LineBillboardMetal.shader +++ b/Content/Shader/LineBillboardMetal.shader @@ -67,7 +67,7 @@ Shader "Hidden/ProBuilder/LineBillboardMetal" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { return _Color; } diff --git a/Content/Shader/NormalPreview.shader b/Content/Shader/NormalPreview.shader index 992e28117..21d21a6da 100644 --- a/Content/Shader/NormalPreview.shader +++ b/Content/Shader/NormalPreview.shader @@ -44,7 +44,7 @@ Shader "Hidden/ProBuilder/NormalPreview" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { return i.color; } diff --git a/Content/Shader/PointBillboard.shader b/Content/Shader/PointBillboard.shader index 1c57b0d6c..42d8ed926 100644 --- a/Content/Shader/PointBillboard.shader +++ b/Content/Shader/PointBillboard.shader @@ -118,7 +118,7 @@ Shader "Hidden/ProBuilder/PointBillboard" triStream.Append(geo_out); } - float4 frag(FS_INPUT input) : COLOR + float4 frag(FS_INPUT input) : SV_Target { return _Color * input.color; } diff --git a/Content/Shader/ReferenceUnlit.shader b/Content/Shader/ReferenceUnlit.shader index 9f9582f0f..c01ded0af 100644 --- a/Content/Shader/ReferenceUnlit.shader +++ b/Content/Shader/ReferenceUnlit.shader @@ -56,7 +56,7 @@ Shader "ProBuilder/Reference Unlit" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { return tex2D(_MainTex, i.uv); } diff --git a/Content/Shader/ScrollHighlight.shader b/Content/Shader/ScrollHighlight.shader index e71c7b6ce..66d292064 100644 --- a/Content/Shader/ScrollHighlight.shader +++ b/Content/Shader/ScrollHighlight.shader @@ -54,7 +54,7 @@ Shader "Hidden/ProBuilder/ScrollHighlight" { o.pos = UnityObjectToClipPos(v.vertex ); return o; } - float4 frag(VertexOutput i, float facing : VFACE) : COLOR { + float4 frag(VertexOutput i, float facing : VFACE) : SV_Target { float isFrontFace = ( facing >= 0 ? 1 : 0 ); float faceSign = ( facing >= 0 ? 1 : -1 ); ////// Lighting: diff --git a/Content/Shader/SmoothingPreview.shader b/Content/Shader/SmoothingPreview.shader index fc2b44e43..af9846522 100644 --- a/Content/Shader/SmoothingPreview.shader +++ b/Content/Shader/SmoothingPreview.shader @@ -47,7 +47,7 @@ Shader "Hidden/ProBuilder/SmoothingPreview" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { i.pos.xy = floor(i.pos.xy * 1) * .5; float checker = -frac(i.pos.x + i.pos.y); diff --git a/Content/Shader/TransparentOverlay.shader b/Content/Shader/TransparentOverlay.shader index 350a2dae8..7acd6fc6e 100644 --- a/Content/Shader/TransparentOverlay.shader +++ b/Content/Shader/TransparentOverlay.shader @@ -50,7 +50,7 @@ Shader "Hidden/ProBuilder/TransparentOverlay" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { return tex2D(_MainTex, i.uv) * i.color; } diff --git a/Content/Shader/UnlitSolidColor.shader b/Content/Shader/UnlitSolidColor.shader index 24d61a3c2..52cebe5a8 100644 --- a/Content/Shader/UnlitSolidColor.shader +++ b/Content/Shader/UnlitSolidColor.shader @@ -44,7 +44,7 @@ Shader "ProBuilder/Unlit Solid Color" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { return _Color; } diff --git a/Content/Shader/UnlitVertexColor.shader b/Content/Shader/UnlitVertexColor.shader index 46be8269b..f1e3b117d 100644 --- a/Content/Shader/UnlitVertexColor.shader +++ b/Content/Shader/UnlitVertexColor.shader @@ -40,7 +40,7 @@ Shader "ProBuilder/UnlitVertexColor" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { return i.color; } diff --git a/Content/Shader/VertexPicker.shader b/Content/Shader/VertexPicker.shader index 3c8995c24..d4b153872 100644 --- a/Content/Shader/VertexPicker.shader +++ b/Content/Shader/VertexPicker.shader @@ -65,7 +65,7 @@ CGPROGRAM return o; } - float4 frag (v2f i) : COLOR + float4 frag (v2f i) : SV_Target { return i.color; } diff --git a/Content/Shader/VertexShader.shader b/Content/Shader/VertexShader.shader index 8bfb542d4..b29cce7be 100644 --- a/Content/Shader/VertexShader.shader +++ b/Content/Shader/VertexShader.shader @@ -71,7 +71,7 @@ Shader "Hidden/ProBuilder/VertexShader" return o; } - half4 frag (v2f i) : COLOR + half4 frag (v2f i) : SV_Target { return _Color; } diff --git a/Tests/Editor/Import/MeshImporterTests.cs b/Tests/Editor/Import/MeshImporterTests.cs index ba1c86934..2b9cf418a 100644 --- a/Tests/Editor/Import/MeshImporterTests.cs +++ b/Tests/Editor/Import/MeshImporterTests.cs @@ -37,9 +37,8 @@ public static void ImportQuads_MatchesWindingOrder() { var srcPath = TestUtility.temporarySavedAssetsDirectory + "maya-cube-quads.fbx"; - // do this song and dance because AssetDatabase.LoadAssetAtPath doesn't seem to work with models in the - // Package directories - File.Copy(TestUtility.templatesDirectory + "MeshImporter/maya-cube-quads.fbx", srcPath); + // overwrite: UTR retries in-fixture, and a leftover copy would fail every later attempt. + File.Copy(TestUtility.templatesDirectory + "MeshImporter/maya-cube-quads.fbx", srcPath, true); AssetDatabase.Refresh(); var source = AssetDatabase.LoadMainAssetAtPath(srcPath); var meshImporter = (ModelImporter)AssetImporter.GetAtPath(srcPath); diff --git a/Tests/Framework/TestUtility.cs b/Tests/Framework/TestUtility.cs index 1699c4beb..55320dbd5 100644 --- a/Tests/Framework/TestUtility.cs +++ b/Tests/Framework/TestUtility.cs @@ -1,9 +1,9 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Reflection; +using System.Runtime.CompilerServices; using NUnit.Framework; using UnityEditor; using UnityEditor.SceneManagement; @@ -333,14 +333,11 @@ public static bool MeshesAreEqual(Mesh expected, Mesh result) return true; } - public static string GetTemplatePath(string assetName, int methodOffset = 0) + public static string GetTemplatePath(string assetName, + [CallerFilePath] string callingFilePath = null, + [CallerMemberName] string callingMemberName = null) { - StackTrace trace = new StackTrace(1 + methodOffset, true); - StackFrame calling = trace.GetFrame(0); - - string filePath = calling.GetFileName(); - - if (string.IsNullOrEmpty(filePath)) + if (string.IsNullOrEmpty(callingFilePath)) { UnityEngine.Debug.LogError( "Cannot generate mesh templates directory path from calling method. Please use the explicit SaveMeshTemplate overload."); @@ -348,18 +345,16 @@ public static string GetTemplatePath(string assetName, int methodOffset = 0) } // Get the calling file path relative to the `Tests/` directory - string fullFilePath = Path.GetFullPath(filePath).Replace("\\", "/"); + string fullFilePath = Path.GetFullPath(callingFilePath).Replace("\\", "/"); string fullTestRootPath = Path.GetFullPath(testsRootDirectory).Replace("\\", "/"); string relativeTemplatePath = fullFilePath.Replace(fullTestRootPath, ""); string relativeTemplateDir = Path.GetDirectoryName(relativeTemplatePath).Replace("\\", "/").TrimStart('/'); - string methodName = calling.GetMethod().Name; - return string.Format("{0}/{1}/{2}/{3}/{4}.asset", typeof(T).ToString(), relativeTemplateDir, - Path.GetFileNameWithoutExtension(filePath), - methodName, + Path.GetFileNameWithoutExtension(callingFilePath), + callingMemberName, assetName); } @@ -367,11 +362,15 @@ public static string GetTemplatePath(string assetName, int methodOffset = 0) /// Get a mesh saved from the same path with name. Use SaveAssetTemplate to automatically generate this path. /// /// + /// + /// /// /// - public static T GetAssetTemplate(string name) where T : UObject + public static T GetAssetTemplate(string name, + [CallerFilePath] string callingFilePath = null, + [CallerMemberName] string callingMemberName = null) where T : UObject { - string assetPath = templatesDirectory + GetTemplatePath(name, 1); + string assetPath = templatesDirectory + GetTemplatePath(name, callingFilePath, callingMemberName); T asset = AssetDatabase.LoadAssetAtPath(assetPath); Assert.IsFalse(asset == null, "Failed loading asset template " + name + " at path " + assetPath); return asset; @@ -393,11 +392,14 @@ public static T GetAssetTemplateWithPath(string pathRelativeToTemplatesDirect /// /// /// - /// + /// + /// /// - public static void SaveAssetTemplate(T asset, string name = null, int methodOffset = 0) where T : UObject + public static void SaveAssetTemplate(T asset, string name = null, + [CallerFilePath] string callingFilePath = null, + [CallerMemberName] string callingMemberName = null) where T : UObject { - string templatePath = GetTemplatePath(string.IsNullOrEmpty(name) ? asset.name : name, methodOffset + 1); + string templatePath = GetTemplatePath(string.IsNullOrEmpty(name) ? asset.name : name, callingFilePath, callingMemberName); SaveAssetTemplateAtPath(asset, templatePath); } diff --git a/Tests/Runtime/MeshOps/BridgeEdgesTests.cs b/Tests/Runtime/MeshOps/BridgeEdgesTests.cs index f7ad39fcc..6abb70752 100644 --- a/Tests/Runtime/MeshOps/BridgeEdgesTests.cs +++ b/Tests/Runtime/MeshOps/BridgeEdgesTests.cs @@ -6,7 +6,11 @@ using UnityEngine.ProBuilder.Shapes; using UnityEngine.ProBuilder.Tests; using UnityEngine.ProBuilder.Tests.Framework; +using UnityEngine.TestTools; +#if ENABLE_CORECLR +[Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif static class BridgeEdgesTests { [Test] diff --git a/Tests/Runtime/MeshOps/CollapseVerticesTests.cs b/Tests/Runtime/MeshOps/CollapseVerticesTests.cs index 6926a1335..629267b7c 100644 --- a/Tests/Runtime/MeshOps/CollapseVerticesTests.cs +++ b/Tests/Runtime/MeshOps/CollapseVerticesTests.cs @@ -5,7 +5,11 @@ using UnityEngine.ProBuilder.Shapes; using UnityEngine.ProBuilder.Tests; using UnityEngine.ProBuilder.Tests.Framework; +using UnityEngine.TestTools; +#if ENABLE_CORECLR +[Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif static class CollapseVerticesTests { [Test] diff --git a/Tests/Runtime/MeshOps/DeleteElementsTests.cs b/Tests/Runtime/MeshOps/DeleteElementsTests.cs index a25b988ae..fb259cc27 100644 --- a/Tests/Runtime/MeshOps/DeleteElementsTests.cs +++ b/Tests/Runtime/MeshOps/DeleteElementsTests.cs @@ -8,6 +8,7 @@ using UnityEngine.ProBuilder.Shapes; using UnityEngine.ProBuilder.Tests; using UnityEngine.ProBuilder.Tests.Framework; +using UnityEngine.TestTools; static class DeleteElementsTests { @@ -89,6 +90,9 @@ public static void Cleanup() } [Test] +#if ENABLE_CORECLR + [Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif public static void DeleteFirstFace_CreatesValidMesh([ValueSource("shapeTypes")] Type shape) { var mesh = ShapeFactory.Instantiate(shape); diff --git a/Tests/Runtime/MeshOps/ExtrudeTests.cs b/Tests/Runtime/MeshOps/ExtrudeTests.cs index b33035edc..50bc050b3 100644 --- a/Tests/Runtime/MeshOps/ExtrudeTests.cs +++ b/Tests/Runtime/MeshOps/ExtrudeTests.cs @@ -81,6 +81,9 @@ public static void Extrude_MultipleEdges_CreatesValidGeometry() } [Test] +#if ENABLE_CORECLR + [Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif public static void ExtrudeAllFaces_FaceNormal([ValueSource("m_AvailableShapeTypes")] Type shape) { var mesh = ShapeFactory.Instantiate(shape); @@ -107,6 +110,9 @@ public static void ExtrudeAllFaces_FaceNormal([ValueSource("m_AvailableShapeType } [Test] +#if ENABLE_CORECLR + [Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif public static void ExtrudeAllFaces_IndividualFaces([ValueSource("m_AvailableShapeTypes")] Type shape) { var mesh = ShapeFactory.Instantiate(shape); @@ -135,6 +141,9 @@ public static void ExtrudeAllFaces_IndividualFaces([ValueSource("m_AvailableShap } [Test] +#if ENABLE_CORECLR + [Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif public static void ExtrudeAllFaces_VertexNormal([ValueSource("m_AvailableShapeTypes")] Type shape) { var mesh = ShapeFactory.Instantiate(shape); diff --git a/Tests/Runtime/MeshOps/TextureUnwrapTests.cs b/Tests/Runtime/MeshOps/TextureUnwrapTests.cs index 39fc38964..d5468fda7 100644 --- a/Tests/Runtime/MeshOps/TextureUnwrapTests.cs +++ b/Tests/Runtime/MeshOps/TextureUnwrapTests.cs @@ -6,7 +6,11 @@ using UnityEngine.ProBuilder.Shapes; using UnityEngine.ProBuilder.Tests; using UnityEngine.ProBuilder.Tests.Framework; +using UnityEngine.TestTools; +#if ENABLE_CORECLR +[Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif static class TextureUnwrapTests { static readonly Type[] offsetRotationShapes = new Type[] diff --git a/Tests/Runtime/MeshOps/VertexColorTests.cs b/Tests/Runtime/MeshOps/VertexColorTests.cs index ea67656cb..a7afcd89d 100644 --- a/Tests/Runtime/MeshOps/VertexColorTests.cs +++ b/Tests/Runtime/MeshOps/VertexColorTests.cs @@ -5,7 +5,11 @@ using UnityEngine.ProBuilder.Shapes; using UnityEngine.ProBuilder.Tests; using UnityEngine.ProBuilder.Tests.Framework; +using UnityEngine.TestTools; +#if ENABLE_CORECLR +[Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif static class VertexColorTests { [Test] diff --git a/Tests/Runtime/Shape/ShapeGeneratorTests.cs b/Tests/Runtime/Shape/ShapeGeneratorTests.cs index 0472224d8..76fc4a004 100644 --- a/Tests/Runtime/Shape/ShapeGeneratorTests.cs +++ b/Tests/Runtime/Shape/ShapeGeneratorTests.cs @@ -6,6 +6,7 @@ using System; using UnityEngine.ProBuilder.Shapes; using UnityEngine.ProBuilder.Tests.Framework; +using UnityEngine.TestTools; class ShapeGeneratorTests { @@ -25,6 +26,9 @@ public static List shapeTypes { } [Test] +#if ENABLE_CORECLR + [Explicit("ProBuilder test mesh templates resolve their asset path from StackTrace calling-method info, which fails on CoreCLR, see https://jira.unity3d.com/browse/UUM-148933")] +#endif public void ShapeGenerator_MatchesTemplate([ValueSource("shapeTypes")] Type type) { ProBuilderMesh pb = ShapeFactory.Instantiate(type); diff --git a/Tests/Runtime/Type/VertexTests.cs b/Tests/Runtime/Type/VertexTests.cs index 8b04df701..89bfbbb9b 100644 --- a/Tests/Runtime/Type/VertexTests.cs +++ b/Tests/Runtime/Type/VertexTests.cs @@ -4,6 +4,7 @@ using System.Linq; using System; using UnityEngine.ProBuilder; +using UnityEngine.TestTools; static class TestHashUtility { @@ -56,6 +57,9 @@ static Vertex RandVertex() } [Test] +#if ENABLE_CORECLR + [Explicit("ProBuilder IntVec3/VectorHash float hashing produces different values on CoreCLR, see https://jira.unity3d.com/browse/UUM-148935")] +#endif public static void TestHashCollisions_IVEC3() { #if UNITY_EDITOR_OSX @@ -68,6 +72,9 @@ public static void TestHashCollisions_IVEC3() } [Test] +#if ENABLE_CORECLR + [Explicit("ProBuilder IntVec3/VectorHash float hashing produces different values on CoreCLR, see https://jira.unity3d.com/browse/UUM-148935")] +#endif public static void TestVectorHashOverflow() { #if UNITY_EDITOR_OSX @@ -88,6 +95,9 @@ public static void TestVectorHashOverflow() } [Test] +#if ENABLE_CORECLR + [Explicit("ProBuilder IntVec3/VectorHash float hashing produces different values on CoreCLR, see https://jira.unity3d.com/browse/UUM-148935")] +#endif public static void TestComparison_IVEC3() { #if UNITY_EDITOR_OSX