data storage
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m23s
CI / Windows Release Package (push) Successful in 2m46s

This commit is contained in:
Aiden
2026-05-10 20:39:28 +10:00
parent 198639ae3f
commit 7777cfc194
29 changed files with 1364 additions and 25 deletions

View File

@@ -58,6 +58,7 @@ void TestValidManifest()
"textures": [{ "id": "maskTex", "path": "mask.png" }],
"fonts": [{ "id": "inter", "path": "Inter.ttf" }],
"temporal": { "enabled": true, "historySource": "source", "historyLength": 8 },
"feedback": { "enabled": true },
"parameters": [
{ "id": "gain", "label": "Gain", "description": "Scales the output intensity.", "type": "float", "default": 0.5, "min": 0, "max": 1 },
{ "id": "titleText", "label": "Title", "type": "text", "default": "LIVE", "font": "inter", "maxLength": 32 },
@@ -77,6 +78,7 @@ void TestValidManifest()
Expect(package.textureAssets.size() == 1 && package.textureAssets[0].id == "maskTex", "texture assets parse");
Expect(package.fontAssets.size() == 1 && package.fontAssets[0].id == "inter", "font assets parse");
Expect(package.temporal.enabled && package.temporal.effectiveHistoryLength == 4, "temporal history is capped");
Expect(package.feedback.enabled && package.feedback.writePassId == "main", "feedback defaults to the implicit main pass");
Expect(package.parameters.size() == 4, "parameters parse");
Expect(package.parameters[0].description == "Scales the output intensity.", "parameter descriptions parse");
Expect(package.parameters[1].type == ShaderParameterType::Text && package.parameters[1].defaultTextValue == "LIVE", "text parameter parses");
@@ -96,6 +98,7 @@ void TestExplicitPassManifest()
{ "id": "blurX", "source": "blur-x.slang", "entryPoint": "blurHorizontal", "inputs": ["layerInput"], "output": "blurredX" },
{ "id": "final", "source": "final.slang", "entryPoint": "finish", "inputs": ["blurredX"], "output": "layerOutput" }
],
"feedback": { "enabled": true, "writePass": "blurX" },
"parameters": []
})");
WriteFile(root / "multi" / "blur-x.slang", "float4 blurHorizontal(float2 uv) { return float4(uv, 0.0, 1.0); }\n");
@@ -109,6 +112,7 @@ void TestExplicitPassManifest()
Expect(package.passes[0].id == "blurX" && package.passes[0].entryPoint == "blurHorizontal", "first pass metadata parses");
Expect(package.passes[0].inputNames.size() == 1 && package.passes[0].inputNames[0] == "layerInput", "pass inputs parse");
Expect(package.passes[1].outputName == "layerOutput", "pass output parses");
Expect(package.feedback.enabled && package.feedback.writePassId == "blurX", "explicit feedback write pass parses");
std::filesystem::remove_all(root);
}
@@ -190,6 +194,25 @@ void TestInvalidTemporalSettings()
std::filesystem::remove_all(root);
}
void TestInvalidFeedbackSettings()
{
const std::filesystem::path root = MakeTestRoot();
WriteShaderPackage(root, "bad-feedback", R"({
"id": "bad-feedback",
"name": "Bad Feedback",
"feedback": { "enabled": true, "writePass": "missingPass" },
"parameters": []
})");
ShaderPackageRegistry registry(4);
ShaderPackage package;
std::string error;
Expect(!registry.ParseManifest(root / "bad-feedback" / "shader.json", package, error), "invalid feedback manifest is rejected");
Expect(error.find("writePass") != std::string::npos, "invalid feedback error names writePass");
std::filesystem::remove_all(root);
}
void TestDisabledTemporalSettingsAreIgnored()
{
const std::filesystem::path root = MakeTestRoot();
@@ -264,6 +287,7 @@ int main()
TestMissingFontAsset();
TestInvalidManifest();
TestInvalidTemporalSettings();
TestInvalidFeedbackSettings();
TestDisabledTemporalSettingsAreIgnored();
TestDuplicateScan();
TestInvalidPackageDoesNotFailScan();