浏览代码

Properly restore the 'current' render pipe when tests end.

/Branch_batcher
Tim Cooper 7 年前
当前提交
52f295af
共有 6 个文件被更改,包括 61 次插入21 次删除
  1. 30
      Assets/GraphicsTests/Editor/TestFramework.cs
  2. 9
      Assets/GraphicsTests/SetupSceneForRenderPipelineTest.cs
  3. 7
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
  4. 2
      ProjectSettings/GraphicsSettings.asset
  5. 22
      Assets/GraphicsTests/Editor/SetupSceneForRenderPipelineTestEditor.cs
  6. 12
      Assets/GraphicsTests/Editor/SetupSceneForRenderPipelineTestEditor.cs.meta

30
Assets/GraphicsTests/Editor/TestFramework.cs


name = p.Name,
relativePath = splitPaths.Last(),
threshold = 0.02f,
frameWait = 10
frameWait = 100
};
}
}

[TearDown]
public void TearDown()
{
var testSetup = Object.FindObjectOfType<SetupSceneForRenderPipelineTest>();
if (testSetup == null)
return;
testSetup.TearDown();
}
// [TestCaseSource(typeof(CollectScenes), "scenes") ]
public IEnumerator TestScene([ValueSource(typeof(CollectScenes), "scenes")]TestInfo testInfo)
{
var prjRelativeGraphsPath = s_Path.Aggregate("Assets", Path.Combine);

EditorSceneManager.OpenScene(filePath);
var testSetup = Object.FindObjectOfType<SetupSceneForRenderPipelineTest> ();
Assert.IsNotNull(testSetup, "No SetupSceneForRenderPipelineTest in scene " + testInfo.name);
Assert.IsNotNull(testSetup.cameraToUse, "No configured camera in <SetupSceneForRenderPipelineTest>");
testSetup.Setup();
yield return null;
yield return null;
var testSetup = Object.FindObjectOfType<SetupSceneForRenderPipelineTest> ();
Assert.IsNotNull(testSetup, "No SetupSceneForRenderPipelineTest in scene " + testInfo.name);
Assert.IsNotNull(testSetup.cameraToUse, "No configured camera in <SetupSceneForRenderPipelineTest>");
while (Lightmapping.isRunning)
{
yield return null;
}
var rtDesc = new RenderTextureDescriptor (
var rtDesc = new RenderTextureDescriptor (
testSetup.width,
testSetup.height,
testSetup.hdr ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB32,

9
Assets/GraphicsTests/SetupSceneForRenderPipelineTest.cs


using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
[ExecuteInEditMode]
public class SetupSceneForRenderPipelineTest : MonoBehaviour
{
private RenderPipelineAsset m_OriginalAsset;

public int width = 1280;
public int height = 720;
void OnEnable()
public void Setup()
void OnDisable()
public void TearDown()
{
GraphicsSettings.renderPipelineAsset = m_OriginalAsset;
}

7
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs


var additionalData = light.light.GetComponent<AdditionalLightData>();
if (additionalData == null)
{
// Don't display warning for the preview windows
if (camera.cameraType != CameraType.Preview)
{
Debug.LogWarningFormat(light.light, "Light entity {0} has no additional data, will be rendered using default values.", light.light.name);
}
}
LightCategory lightCategory = LightCategory.Count;
GPULightType gpuLightType = GPULightType.Point;

2
ProjectSettings/GraphicsSettings.asset


m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
m_CustomRenderPipeline: {fileID: 11400000, guid: 877878ed40e8ad94095582ff91179016,
m_CustomRenderPipeline: {fileID: 11400000, guid: e185fecca3c73cd47a09f1092663ef32,
type: 2}
m_TransparencySortMode: 0
m_TransparencySortAxis: {x: 0, y: 0, z: 1}

22
Assets/GraphicsTests/Editor/SetupSceneForRenderPipelineTestEditor.cs


using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
[CustomEditor(typeof(SetupSceneForRenderPipelineTest))]
public class SetupSceneForRenderPipelineTestEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
var sceneSetup = target as SetupSceneForRenderPipelineTest;
if (sceneSetup == null)
return;
if (GUILayout.Button("Set renderpipe"))
{
GraphicsSettings.renderPipelineAsset = sceneSetup.renderPipeline;
}
}
}

12
Assets/GraphicsTests/Editor/SetupSceneForRenderPipelineTestEditor.cs.meta


fileFormatVersion: 2
guid: a0fc54044084eca4894b2caa330d3f99
timeCreated: 1493802113
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存