[Shadows] Set shadow settings per layer (5/n)
- Save global shadow settings set by WindowManager
- Add ShadowSettings to renderengine per layer rendering info
Bug: 136561771
Test: go/wm-smoke
Change-Id: I89cf84c7e089273ae3edea02e2ac24690055ba47
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index c555f79..682932b 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -5512,9 +5512,19 @@
getRenderEngine().unbindExternalTextureBuffer(clientCacheId.id);
}
-status_t SurfaceFlinger::setGlobalShadowSettings(const half4& /*ambientColor*/,
- const half4& /*spotColor*/, float /*lightPosY*/,
- float /*lightPosZ*/, float /*lightRadius*/) {
+status_t SurfaceFlinger::setGlobalShadowSettings(const half4& ambientColor, const half4& spotColor,
+ float lightPosY, float lightPosZ,
+ float lightRadius) {
+ Mutex::Autolock _l(mStateLock);
+ mCurrentState.globalShadowSettings.ambientColor = vec4(ambientColor);
+ mCurrentState.globalShadowSettings.spotColor = vec4(spotColor);
+ mCurrentState.globalShadowSettings.lightPos.y = lightPosY;
+ mCurrentState.globalShadowSettings.lightPos.z = lightPosZ;
+ mCurrentState.globalShadowSettings.lightRadius = lightRadius;
+
+ // these values are overridden when calculating the shadow settings for a layer.
+ mCurrentState.globalShadowSettings.lightPos.x = 0.f;
+ mCurrentState.globalShadowSettings.length = 0.f;
return NO_ERROR;
}