[optimization] Split csm ubo v3.6.0 (#12072)

* split csm ubo v3.6.0

* update

* Modify *.meta  file to ignore material upgrade

* update

* update

* update 2

* use better struct padding and save memory

* update mate

* fix ci error

* memory alignment

* update

* update 2

* chenge func name

* update
This commit is contained in:
troublemaker52025
2022-07-20 22:58:25 +08:00
committed by GitHub
parent e7eeab9340
commit d5f77d0af1
36 changed files with 345 additions and 183 deletions
@@ -77,6 +77,12 @@ void ShadowFlow::activate(RenderPipeline *pipeline) {
const int32_t isLinear = 0;
pipeline->setValue("CC_SHADOWMAP_USE_LINEAR_DEPTH", isLinear);
// 0: UNIFORM_VECTORS_LESS_EQUAL_64, 1: UNIFORM_VECTORS_GREATER_EQUAL_125.
const auto csmSupported = pipeline->getDevice()->getCapabilities().maxFragmentUniformVectors >=
CSM_UNIFORM_VECTORS + GLOBAL_UNIFORM_VECTORS;
pipeline->getPipelineSceneData()->setCSMSupported(csmSupported);
pipeline->setValue("CC_SUPPORT_CASCADED_SHADOW_MAP", csmSupported);
pipeline->onGlobalPipelineStateChanged();
}
@@ -117,7 +123,8 @@ void ShadowFlow::render(scene::Camera *camera) {
if (mainLight->isShadowFixedArea()) {
renderStage(globalDS, camera, mainLight, shadowFrameBuffer);
} else {
for (uint32_t i = 0; i < static_cast<uint32_t>(mainLight->getCSMLevel()); ++i) {
const auto level = _pipeline->getPipelineSceneData()->getCSMSupported() ? static_cast<uint32_t>(mainLight->getCSMLevel()) : 1U;
for (uint32_t i = 0; i < level; ++i) {
renderStage(globalDS, camera, mainLight, shadowFrameBuffer, i);
}
}