Lower final color into final output stage

This commit is contained in:
2026-04-06 16:15:19 +08:00
parent 6645d507d0
commit 33bb84f650
17 changed files with 1149 additions and 42 deletions

View File

@@ -211,6 +211,53 @@ TEST(BuiltinForwardPipeline_Test, BuiltinSkyboxShaderDeclaresExplicitEnvironment
delete shader;
}
TEST(BuiltinForwardPipeline_Test, BuiltinFinalColorShaderDeclaresExplicitFullscreenResourceContract) {
ShaderLoader loader;
LoadResult result = loader.Load(GetBuiltinFinalColorShaderPath());
ASSERT_TRUE(result);
ASSERT_NE(result.resource, nullptr);
Shader* shader = static_cast<Shader*>(result.resource);
ASSERT_NE(shader, nullptr);
const ShaderPass* pass = shader->FindPass("FinalColor");
ASSERT_NE(pass, nullptr);
ASSERT_EQ(pass->resources.Size(), 3u);
const ShaderPropertyDesc* colorScale = shader->FindProperty("_ColorScale");
ASSERT_NE(colorScale, nullptr);
EXPECT_EQ(colorScale->type, ShaderPropertyType::Color);
const ShaderPropertyDesc* exposure = shader->FindProperty("_Exposure");
ASSERT_NE(exposure, nullptr);
EXPECT_EQ(exposure->type, ShaderPropertyType::Float);
const ShaderPropertyDesc* outputTransferMode = shader->FindProperty("_OutputTransferMode");
ASSERT_NE(outputTransferMode, nullptr);
EXPECT_EQ(outputTransferMode->type, ShaderPropertyType::Float);
const ShaderPropertyDesc* toneMappingMode = shader->FindProperty("_ToneMappingMode");
ASSERT_NE(toneMappingMode, nullptr);
EXPECT_EQ(toneMappingMode->type, ShaderPropertyType::Float);
EXPECT_STREQ(pass->resources[0].name.CStr(), "FinalColorConstants");
EXPECT_EQ(pass->resources[0].type, ShaderResourceType::ConstantBuffer);
EXPECT_EQ(pass->resources[0].set, 0u);
EXPECT_EQ(pass->resources[0].binding, 0u);
EXPECT_STREQ(pass->resources[1].name.CStr(), "SourceColorTexture");
EXPECT_EQ(pass->resources[1].type, ShaderResourceType::Texture2D);
EXPECT_EQ(pass->resources[1].set, 1u);
EXPECT_EQ(pass->resources[1].binding, 0u);
EXPECT_STREQ(pass->resources[2].name.CStr(), "LinearClampSampler");
EXPECT_EQ(pass->resources[2].type, ShaderResourceType::Sampler);
EXPECT_EQ(pass->resources[2].set, 2u);
EXPECT_EQ(pass->resources[2].binding, 0u);
delete shader;
}
TEST(BuiltinForwardPipeline_Test, BuildsBuiltinPassResourceBindingPlanFromExplicitForwardResources) {
ShaderLoader loader;
LoadResult result = loader.Load(GetBuiltinForwardLitShaderPath());