浏览代码

temp commit

/shader-library-include-paths
Tim Cooper 7 年前
当前提交
c6f38d1a
共有 10 个文件被更改,包括 119 次插入10 次删除
  1. 14
      ScriptableRenderPipeline/Core/TextureCache.cs
  2. 6
      ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs
  3. 3
      ScriptableRenderPipeline/Core/Editor/CoreShaderIncludePaths.shaderIncludePaths
  4. 7
      ScriptableRenderPipeline/Core/Editor/CoreShaderIncludePaths.shaderIncludePaths.meta
  5. 21
      ScriptableRenderPipeline/Core/Editor/ShaderIncludePaths.cs
  6. 11
      ScriptableRenderPipeline/Core/Editor/ShaderIncludePaths.cs.meta
  7. 44
      ScriptableRenderPipeline/Core/Editor/ShaderIncludePathsImporter.cs
  8. 11
      ScriptableRenderPipeline/Core/Editor/ShaderIncludePathsImporter.cs.meta
  9. 1
      ScriptableRenderPipeline/Core/Editor/ShaderIncludePathsImporterEditor.cs
  10. 11
      ScriptableRenderPipeline/Core/Editor/ShaderIncludePathsImporterEditor.cs.meta

14
ScriptableRenderPipeline/Core/TextureCache.cs


if (mismatch)
{
if (!Graphics.ConvertTexture(texture, 0, m_Cache, sliceIndex))
if (!UnityEngine.Graphics.ConvertTexture(texture, 0, m_Cache, sliceIndex))
{
Debug.LogErrorFormat(texture, "Unable to convert texture \"{0}\" to match renderloop settings ({1}x{2} {3})",
texture.name, m_Cache.width, m_Cache.height, m_Cache.format);

{
Graphics.CopyTexture(texture, 0, m_Cache, sliceIndex);
UnityEngine.Graphics.CopyTexture(texture, 0, m_Cache, sliceIndex);
}
}

for (int f = 0; f < 6; f++)
{
if (!Graphics.ConvertTexture(texture, f, m_Cache, 6 * sliceIndex + f))
if (!UnityEngine.Graphics.ConvertTexture(texture, f, m_Cache, 6 * sliceIndex + f))
{
failed = true;
break;

else
{
for (int f = 0; f < 6; f++)
Graphics.CopyTexture(texture, f, m_Cache, 6 * sliceIndex + f);
UnityEngine.Graphics.CopyTexture(texture, f, m_Cache, 6 * sliceIndex + f);
}
}
}

for (int m = 0; m < m_NumPanoMipLevels; m++)
{
m_CubeBlitMaterial.SetInt(m_CubeMipLevelPropName, Mathf.Min(m_NumMipLevels - 1, m));
Graphics.SetRenderTarget(m_StagingRTs[m]);
Graphics.Blit(null, m_CubeBlitMaterial, 0);
UnityEngine.Graphics.SetRenderTarget(m_StagingRTs[m]);
UnityEngine.Graphics.Blit(null, m_CubeBlitMaterial, 0);
Graphics.CopyTexture(m_StagingRTs[m], 0, 0, m_CacheNoCubeArray, sliceIndex, m);
UnityEngine.Graphics.CopyTexture(m_StagingRTs[m], 0, 0, m_CacheNoCubeArray, sliceIndex, m);
}
}

6
ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs


int offset = 0;
for (int i = 0; i < 6; ++i)
{
Graphics.SetRenderTarget(m_SkyboxCubemapRT, 0, (CubemapFace)i);
UnityEngine.Graphics.SetRenderTarget(m_SkyboxCubemapRT, 0, (CubemapFace)i);
temp.ReadPixels(new Rect(0, 0, resolution, resolution), offset, 0);
temp.Apply();
offset += resolution;

// Temporarily disabled until proper API reaches trunk
Graphics.Blit(temp, tempRT, new Vector2(1.0f, -1.0f), new Vector2(0.0f, 0.0f));
UnityEngine.Graphics.Blit(temp, tempRT, new Vector2(1.0f, -1.0f), new Vector2(0.0f, 0.0f));
Graphics.SetRenderTarget(null);
UnityEngine.Graphics.SetRenderTarget(null);
Object.DestroyImmediate(temp);
Object.DestroyImmediate(tempRT);

3
ScriptableRenderPipeline/Core/Editor/CoreShaderIncludePaths.shaderIncludePaths


Assets/ScriptableRenderPipeline/ScriptableRenderPipeline/Core
Packages/com.unity.render-pipelines.core
Assets/IncludePath

7
ScriptableRenderPipeline/Core/Editor/CoreShaderIncludePaths.shaderIncludePaths.meta


fileFormatVersion: 2
guid: c81147e4149d34508b131b99d41bc924
ScriptedImporter:
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: fce39a6bcf80941908ab7ce5c60f5481, type: 3}

21
ScriptableRenderPipeline/Core/Editor/ShaderIncludePaths.cs


using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
public class ShaderIncludePaths : ScriptableObject, IShaderIncludePathGenerator
{
[SerializeField]
List<string> m_Paths = new List<string>();
public void AddPaths(IEnumerable<string> paths)
{
m_Paths.AddRange(paths);
}
public void GetShaderIncludePaths(List<string> paths)
{
foreach (var path in m_Paths)
paths.Add(Path.GetFullPath(path));
}
}

11
ScriptableRenderPipeline/Core/Editor/ShaderIncludePaths.cs.meta


fileFormatVersion: 2
guid: c7cdcda8f64024094b0a17fb1e42a6ab
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

44
ScriptableRenderPipeline/Core/Editor/ShaderIncludePathsImporter.cs


using System.Globalization;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditor.Experimental.AssetImporters;
using UnityEngine;
[ScriptedImporter(1, kExtension)]
public class ShaderIncludePathsImporter : ScriptedImporter
{
public const string kExtension = "ShaderIncludePaths";
public override void OnImportAsset(AssetImportContext ctx)
{
var pathStrings = File.ReadAllLines(ctx.assetPath);
var paths = ScriptableObject.CreateInstance<ShaderIncludePaths>();
paths.hideFlags |= HideFlags.NotEditable;
paths.AddPaths(pathStrings);
ctx.AddObjectToAsset("MainAsset", paths);
ctx.SetMainObject(paths);
}
}
class ShaderIncludePostProcess : AssetPostprocessor
{
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
if (importedAssets.Any(x => x.EndsWith(ShaderIncludePathsImporter.kExtension, true, CultureInfo.InvariantCulture))
|| deletedAssets.Any(x => x.EndsWith(ShaderIncludePathsImporter.kExtension, true, CultureInfo.InvariantCulture))
|| movedAssets.Any(x => x.EndsWith(ShaderIncludePathsImporter.kExtension, true, CultureInfo.InvariantCulture)))
{
ShaderUtil.UpdateShaderIncludePaths();
AssetDatabase.StartAssetEditing();
string[] allAssetPaths = AssetDatabase.GetAllAssetPaths();
foreach (string assetPath in allAssetPaths)
{
var shader = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Shader)) as Shader;
if (shader != null)
AssetDatabase.ImportAsset(assetPath);
}
AssetDatabase.StopAssetEditing();
}
}
}

11
ScriptableRenderPipeline/Core/Editor/ShaderIncludePathsImporter.cs.meta


fileFormatVersion: 2
guid: fce39a6bcf80941908ab7ce5c60f5481
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1
ScriptableRenderPipeline/Core/Editor/ShaderIncludePathsImporterEditor.cs




11
ScriptableRenderPipeline/Core/Editor/ShaderIncludePathsImporterEditor.cs.meta


fileFormatVersion: 2
guid: cf30acf439ada4fecad9d870b9bc4cf7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存