Restore Stardust temporal coverage
This commit is contained in:
parent
68c12f2201
commit
d8a01339cc
10 changed files with 92 additions and 17 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Aetheria.Editor
|
||||
|
|
@ -18,6 +20,39 @@ namespace Aetheria.Editor
|
|||
public float Size;
|
||||
}
|
||||
|
||||
internal static void VerifyTemporalDitherMaterial(Material material, bool requireAuthoredSource)
|
||||
{
|
||||
if (material == null || material.shader == null)
|
||||
throw new ArgumentNullException(nameof(material));
|
||||
if (!material.HasProperty("_DitheringTex"))
|
||||
throw new InvalidOperationException("Stardust render material has no temporal dither texture port.");
|
||||
var shaderPath = AssetDatabase.GetAssetPath(material.shader);
|
||||
var source = string.IsNullOrWhiteSpace(shaderPath) || !File.Exists(shaderPath)
|
||||
? ""
|
||||
: File.ReadAllText(shaderPath);
|
||||
if (string.IsNullOrWhiteSpace(source))
|
||||
{
|
||||
if (requireAuthoredSource)
|
||||
throw new InvalidOperationException("Stardust authored shader source is unavailable for verification.");
|
||||
return;
|
||||
}
|
||||
var required = new[]
|
||||
{
|
||||
"_FrameNumber",
|
||||
"SAMPLE_TEXTURE2D",
|
||||
"clip(alpha - dither",
|
||||
"Blend One Zero",
|
||||
"ZWrite On"
|
||||
};
|
||||
foreach (var token in required)
|
||||
if (!source.Contains(token, StringComparison.Ordinal))
|
||||
throw new InvalidOperationException(
|
||||
$"Stardust render shader lost required temporal coverage token '{token}'.");
|
||||
if (source.Contains("_AlphaClip", StringComparison.Ordinal))
|
||||
throw new InvalidOperationException(
|
||||
"Stardust render shader regressed to a fixed alpha threshold instead of temporal coverage.");
|
||||
}
|
||||
|
||||
internal static void VerifyOneCellShift(ComputeShader program)
|
||||
{
|
||||
if (program == null) throw new ArgumentNullException(nameof(program));
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ namespace Aetheria.Editor
|
|||
.ToArray();
|
||||
if (assetNames.Length == 0)
|
||||
throw new InvalidOperationException("Aetheria Eve bundle has no provider Unity assets.");
|
||||
var authoredStardustMaterial = AssetDatabase.LoadAssetAtPath<Material>(
|
||||
"Assets/Shaders/Compute/Stardust/Stardust.mat");
|
||||
AetheriaStardustContinuityVerifier.VerifyTemporalDitherMaterial(
|
||||
authoredStardustMaterial,
|
||||
requireAuthoredSource: true);
|
||||
|
||||
var manifest = BuildPipeline.BuildAssetBundles(
|
||||
output,
|
||||
|
|
@ -593,6 +598,9 @@ namespace Aetheria.Editor
|
|||
"Assets/Shaders/Compute/Stardust/Stardust.mat");
|
||||
if (stardustMaterial == null || stardustMaterial.shader == null || !stardustMaterial.shader.isSupported)
|
||||
throw new InvalidOperationException("Aetheria Eve bundle has no supported Stardust render material.");
|
||||
AetheriaStardustContinuityVerifier.VerifyTemporalDitherMaterial(
|
||||
stardustMaterial,
|
||||
requireAuthoredSource: false);
|
||||
var stardustColors = LoadAuthoredAsset<Texture2D>(bundle, assetNames,
|
||||
"Assets/Resources/Gradients/blackbody.png");
|
||||
if (stardustColors == null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue