Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [7.5.0] - 2020-06-08

Version Updated
The version number for this package has increased due to a version update of a related graphics package.

### Added
- Added option to enable/disable Adaptive Performance when it's package is available.

### Fixed

- Fixed an issue where URP Simple Lit shader had attributes swapped incorrectly for BaseMap and BaseColor properties.
- Fixed an issue where camera stacking with MSAA on OpenGL resulted in a black screen. [case 1250602](https://issuetracker.unity3d.com/issues/urp-camera-stacking-results-in-black-screen-when-msaa-and-opengl-graphics-api-are-used)
- Fixed issue with Model Importer materials using the Legacy standard shader instead of URP's Lit shader when import happens at Editor startup.

## [7.4.1] - 2020-06-03

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using UnityEditor.AssetImporters;
using UnityEngine;
using UnityEngine.Rendering.Universal;

namespace UnityEditor.Rendering.Universal
{
Expand All @@ -25,8 +26,9 @@ public void OnPreprocessMaterialDescription(MaterialDescription description, Mat
var lowerCaseExtension = Path.GetExtension(assetPath).ToLower();
if (lowerCaseExtension != ".fbx" && lowerCaseExtension != ".obj" && lowerCaseExtension != ".blend" && lowerCaseExtension != ".mb" && lowerCaseExtension != ".ma" && lowerCaseExtension != ".max")
return;

var shader = Shader.Find("Universal Render Pipeline/Lit");

string path = AssetDatabase.GUIDToAssetPath(ShaderUtils.GetShaderGUID(ShaderPathID.Lit));
var shader = AssetDatabase.LoadAssetAtPath<Shader>(path);
if (shader == null)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using UnityEngine;
using UnityEditor.AssetImporters;
using UnityEngine.Rendering.Universal;

namespace UnityEditor.Rendering.Universal
{
Expand All @@ -27,7 +28,8 @@ public void OnPreprocessMaterialDescription(MaterialDescription description, Mat
if (lowerCasePath != ".skp")
return;

var shader = Shader.Find("Universal Render Pipeline/Lit");
string path = AssetDatabase.GUIDToAssetPath(ShaderUtils.GetShaderGUID(ShaderPathID.Lit));
var shader = AssetDatabase.LoadAssetAtPath<Shader>(path);
if (shader == null)
return;
material.shader = shader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using UnityEngine;
using UnityEditor.AssetImporters;
using UnityEngine.Rendering.Universal;

namespace UnityEditor.Rendering.Universal
{
Expand All @@ -27,7 +28,8 @@ public void OnPreprocessMaterialDescription(MaterialDescription description, Mat
if (lowerCasePath != ".3ds")
return;

var shader = Shader.Find("Universal Render Pipeline/Lit");
string path = AssetDatabase.GUIDToAssetPath(ShaderUtils.GetShaderGUID(ShaderPathID.Lit));
var shader = AssetDatabase.LoadAssetAtPath<Shader>(path);
if (shader == null)
return;
material.shader = shader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
using UnityEditor;
using UnityEditor.ProjectWindowCallback;
using System.IO;
using UnityEditorInternal;
#endif
using System.ComponentModel;
using System.Linq;

namespace UnityEngine.Rendering.LWRP
{
Expand Down Expand Up @@ -296,9 +298,10 @@ UniversalRenderPipelineEditorResources editorResources
{
if (m_EditorResourcesAsset != null && !m_EditorResourcesAsset.Equals(null))
return m_EditorResourcesAsset;

string resourcePath = AssetDatabase.GUIDToAssetPath(editorResourcesGUID);
m_EditorResourcesAsset = AssetDatabase.LoadAssetAtPath<UniversalRenderPipelineEditorResources>(resourcePath);
var objs = InternalEditorUtility.LoadSerializedFileAndForget(resourcePath);
m_EditorResourcesAsset = objs != null && objs.Length > 0 ? objs.First() as UniversalRenderPipelineEditorResources : null;
return m_EditorResourcesAsset;
}
}
Expand Down Expand Up @@ -756,6 +759,12 @@ public override Shader defaultShader
if (defaultShader != null)
return defaultShader;
}

if (m_DefaultShader == null)
{
string path = AssetDatabase.GUIDToAssetPath(ShaderUtils.GetShaderGUID(ShaderPathID.Lit));
m_DefaultShader = AssetDatabase.LoadAssetAtPath<Shader>(path);
}
#endif

if (m_DefaultShader == null)
Expand Down
26 changes: 26 additions & 0 deletions com.unity.render-pipelines.universal/Runtime/ShaderUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,31 @@ public static bool IsLWShader(Shader shader)
{
return s_ShaderPaths.Contains(shader.name);
}

#if UNITY_EDITOR
static readonly string[] s_ShaderGUIDs =
{
"933532a4fcc9baf4fa0491de14d08ed7",
"8d2bb70cbf9db8d4da26e15b26e74248",
"650dd9526735d5b46b79224bc6e94025",
"69c1f799e772cb6438f56c23efccb782",
"b7839dad95683814aa64166edc107ae2",
"8516d7a69675844a7a0b7095af7c46af",
"0406db5a14f94604a8c57ccfbc9f3b46",
"0ca6dca7396eb48e5849247ffd444914",
};

internal static string GetShaderGUID(ShaderPathID id)
{
int index = (int)id;
if (index < 0 && index >= (int)ShaderPathID.Count)
{
Debug.LogError("Trying to access universal shader path out of bounds");
return "";
}

return s_ShaderGUIDs[index];
}
#endif
}
}
18 changes: 18 additions & 0 deletions com.unity.render-pipelines.universal/Tests/Editor/EditorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ public void ValidateBuiltinResourceFiles()
Assert.IsFalse(string.IsNullOrEmpty(editorResourcesPath));
}

// Validate that ShaderUtils.GetShaderGUID results are valid and that ShaderUtils.GetShaderPath match shader names.
[TestCase(ShaderPathID.Lit)]
[TestCase(ShaderPathID.SimpleLit)]
[TestCase(ShaderPathID.Unlit)]
[TestCase(ShaderPathID.TerrainLit)]
[TestCase(ShaderPathID.ParticlesLit)]
[TestCase(ShaderPathID.ParticlesSimpleLit)]
[TestCase(ShaderPathID.ParticlesUnlit)]
[TestCase(ShaderPathID.BakedLit)]
public void ValidateShaderResources(ShaderPathID shaderPathID)
{
string path = AssetDatabase.GUIDToAssetPath(ShaderUtils.GetShaderGUID(shaderPathID));
Assert.IsFalse(string.IsNullOrEmpty(path));

var shader = AssetDatabase.LoadAssetAtPath<Shader>(path);
Assert.AreEqual(shader.name, ShaderUtils.GetShaderPath(shaderPathID));
}

// When creating URP all required resources should be initialized.
[Test]
public void ValidateNewAssetResources()
Expand Down