Skip to content

Instantly share code, notes, and snippets.

@aras-p
Created December 2, 2019 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aras-p/277a3e841a694326ebf95837884577df to your computer and use it in GitHub Desktop.
Save aras-p/277a3e841a694326ebf95837884577df to your computer and use it in GitHub Desktop.
Unity LWRP 6.9.0 -> 6.9.1 diff
diff -Naur lwrp-690/CHANGELOG.md lwrp-691/CHANGELOG.md
--- lwrp-690/CHANGELOG.md 2019-07-05 22:48:46.000000000 +0300
+++ lwrp-691/CHANGELOG.md 2019-07-30 00:57:01.000000000 +0300
@@ -4,6 +4,15 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [6.9.1] - 2019-07-29
+
+### Fixed
+- Fixed fp16 overflow in Switch in specular calculation
+- Fixed shader compilation errors for Android XR projects.
+- Fixed garbage collection spikes caused by LWRP allocating heap memory every frame.
+- Fixed BeforeTransparent post-processing not working.
+- Fixed issue that caused scene to render darker in GLES3 and linear color space. [case 1169789](https://issuetracker.unity3d.com/issues/lwrp-android-scene-is-rendered-darker-in-build-when-graphics-api-set-to-gles3-and-color-space-set-to-linear)
+
## [6.9.0] - 2019-07-05
### Fixed
- Fixed an issue where using LWRP and Sprite Shape together would produce meta file conflicts.
diff -Naur lwrp-690/Editor/ShaderGraph/lightweight2DPBRPass.template lwrp-691/Editor/ShaderGraph/lightweight2DPBRPass.template
--- lwrp-690/Editor/ShaderGraph/lightweight2DPBRPass.template 2019-07-05 11:41:00.000000000 +0300
+++ lwrp-691/Editor/ShaderGraph/lightweight2DPBRPass.template 2019-07-30 00:57:01.000000000 +0300
@@ -32,13 +32,11 @@
float4 clipPos : SV_POSITION;
// Interpolators defined by graph
${VertexOutputStruct}
- UNITY_VERTEX_OUTPUT_STEREO
};
GraphVertexOutput vert (GraphVertexInput v)
{
GraphVertexOutput o = (GraphVertexOutput)0;
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
// Vertex transformations performed by graph
${VertexShader}
@@ -60,8 +58,6 @@
half4 frag (GraphVertexOutput IN ${FaceSign}) : SV_Target
{
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(IN);
-
// Pixel transformations performed by graph
${PixelShader}
SurfaceDescriptionInputs surfaceInput = (SurfaceDescriptionInputs)0;
diff -Naur lwrp-690/Runtime/ForwardRenderer.cs lwrp-691/Runtime/ForwardRenderer.cs
--- lwrp-690/Runtime/ForwardRenderer.cs 2019-07-05 22:48:46.000000000 +0300
+++ lwrp-691/Runtime/ForwardRenderer.cs 2019-07-30 00:57:01.000000000 +0300
@@ -173,7 +173,10 @@
EnqueuePass(m_RenderOpaqueForwardPass);
if (hasOpaquePostProcess)
+ {
m_OpaquePostProcessPass.Setup(cameraTargetDescriptor, m_ActiveCameraColorAttachment, m_ActiveCameraColorAttachment);
+ EnqueuePass(m_OpaquePostProcessPass);
+ }
if (camera.clearFlags == CameraClearFlags.Skybox && RenderSettings.skybox != null)
EnqueuePass(m_DrawSkyboxPass);
diff -Naur lwrp-690/Runtime/LightweightRenderPipeline.cs lwrp-691/Runtime/LightweightRenderPipeline.cs
--- lwrp-690/Runtime/LightweightRenderPipeline.cs 2019-07-05 22:48:46.000000000 +0300
+++ lwrp-691/Runtime/LightweightRenderPipeline.cs 2019-07-30 00:57:01.000000000 +0300
@@ -149,7 +149,7 @@
var settings = asset;
LWRPAdditionalCameraData additionalCameraData = null;
if (camera.cameraType == CameraType.Game || camera.cameraType == CameraType.VR)
-#if UNITY_2019_3_OR_NEWER
+#if UNITY_2019_2_OR_NEWER
camera.gameObject.TryGetComponent(out additionalCameraData);
#else
additionalCameraData = camera.gameObject.GetComponent<LWRPAdditionalCameraData>();
@@ -229,7 +229,7 @@
cameraData.isSceneViewCamera = camera.cameraType == CameraType.SceneView;
cameraData.isHdrEnabled = camera.allowHDR && settings.supportsHDR;
-#if UNITY_2019_3_OR_NEWER
+#if UNITY_2019_2_OR_NEWER
camera.TryGetComponent(out cameraData.postProcessLayer);
#else
cameraData.postProcessLayer = camera.GetComponent<PostProcessLayer>();
@@ -337,7 +337,7 @@
LWRPAdditionalLightData data = null;
if (light != null)
{
-#if UNITY_2019_3_OR_NEWER
+#if UNITY_2019_2_OR_NEWER
light.gameObject.TryGetComponent(out data);
#else
data = light.gameObject.GetComponent<LWRPAdditionalLightData>();
diff -Naur lwrp-690/Runtime/Passes/FinalBlitPass.cs lwrp-691/Runtime/Passes/FinalBlitPass.cs
--- lwrp-690/Runtime/Passes/FinalBlitPass.cs 2019-07-05 11:41:00.000000000 +0300
+++ lwrp-691/Runtime/Passes/FinalBlitPass.cs 2019-07-30 00:57:01.000000000 +0300
@@ -64,21 +64,18 @@
cmd.DisableShaderKeyword(ShaderKeywordStrings.KillAlpha);
ref CameraData cameraData = ref renderingData.cameraData;
+ // Use default blit for XR as we are not sure the UniversalRP blit handles stereo.
+ // The blit will be reworked for stereo along the XRSDK work.
+ Material blitMaterial = (cameraData.isStereoEnabled) ? null : m_BlitMaterial;
+ cmd.SetGlobalTexture("_BlitTex", m_Source.Identifier());
if (cameraData.isStereoEnabled || cameraData.isSceneViewCamera || cameraData.isDefaultViewport)
{
// This set render target is necessary so we change the LOAD state to DontCare.
cmd.SetRenderTarget(BuiltinRenderTextureType.CameraTarget, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store);
-
- // Clearing render target is cost free on mobile and it avoid tile loading
- if (m_IsMobileOrSwitch)
- cmd.ClearRenderTarget(true, true, Color.black);
-
- cmd.Blit(m_Source.Identifier(), BuiltinRenderTextureType.CameraTarget);
+ cmd.Blit(m_Source.Identifier(), BuiltinRenderTextureType.CameraTarget, blitMaterial);
}
else
{
- cmd.SetGlobalTexture("_BlitTex", m_Source.Identifier());
-
// TODO: Final blit pass should always blit to backbuffer. The first time we do we don't need to Load contents to tile.
// We need to keep in the pipeline of first render pass to each render target to propertly set load/store actions.
// meanwhile we set to load so split screen case works.
@@ -94,7 +91,7 @@
Camera camera = cameraData.camera;
cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity);
cmd.SetViewport(m_PixelRect != Rect.zero ? m_PixelRect : cameraData.camera.pixelRect);
- cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, m_BlitMaterial);
+ cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, blitMaterial);
cmd.SetViewProjectionMatrices(camera.worldToCameraMatrix, camera.projectionMatrix);
}
diff -Naur lwrp-690/ShaderLibrary/Input.hlsl lwrp-691/ShaderLibrary/Input.hlsl
--- lwrp-690/ShaderLibrary/Input.hlsl 2019-07-05 11:41:00.000000000 +0300
+++ lwrp-691/ShaderLibrary/Input.hlsl 2019-07-30 00:57:01.000000000 +0300
@@ -30,17 +30,12 @@
// Constant Buffers //
///////////////////////////////////////////////////////////////////////////////
-CBUFFER_START(_PerFrame)
half4 _GlossyEnvironmentColor;
half4 _SubtractiveShadowColor;
-CBUFFER_END
-CBUFFER_START(_PerCamera)
float4x4 _InvCameraViewProj;
float4 _ScaledScreenParams;
-CBUFFER_END
-CBUFFER_START(_LightBuffer)
float4 _MainLightPosition;
half4 _MainLightColor;
@@ -50,7 +45,6 @@
half4 _AdditionalLightsAttenuation[MAX_VISIBLE_LIGHTS];
half4 _AdditionalLightsSpotDir[MAX_VISIBLE_LIGHTS];
half4 _AdditionalLightsOcclusionProbes[MAX_VISIBLE_LIGHTS];
-CBUFFER_END
#define UNITY_MATRIX_M unity_ObjectToWorld
#define UNITY_MATRIX_I_M unity_WorldToObject
diff -Naur lwrp-690/ShaderLibrary/Lighting.hlsl lwrp-691/ShaderLibrary/Lighting.hlsl
--- lwrp-690/ShaderLibrary/Lighting.hlsl 2019-07-05 11:41:00.000000000 +0300
+++ lwrp-691/ShaderLibrary/Lighting.hlsl 2019-07-30 00:57:01.000000000 +0300
@@ -287,10 +287,10 @@
half LoH2 = LoH * LoH;
half specularTerm = brdfData.roughness2 / ((d * d) * max(0.1h, LoH2) * brdfData.normalizationTerm);
- // on mobiles (where half actually means something) denominator have risk of overflow
+ // On platforms where half actually means something, the denominator has a risk of overflow
// clamp below was added specifically to "fix" that, but dx compiler (we convert bytecode to metal/gles)
// sees that specularTerm have only non-negative terms, so it skips max(0,..) in clamp (leaving only min(100,...))
-#if defined (SHADER_API_MOBILE)
+#if defined (SHADER_API_MOBILE) || defined (SHADER_API_SWITCH)
specularTerm = specularTerm - HALF_MIN;
specularTerm = clamp(specularTerm, 0.0, 100.0); // Prevent FP16 overflow on mobiles
#endif
diff -Naur lwrp-690/ShaderLibrary/Shadows.hlsl lwrp-691/ShaderLibrary/Shadows.hlsl
--- lwrp-690/ShaderLibrary/Shadows.hlsl 2019-07-05 11:41:00.000000000 +0300
+++ lwrp-691/ShaderLibrary/Shadows.hlsl 2019-07-30 00:57:01.000000000 +0300
@@ -24,7 +24,6 @@
TEXTURE2D_SHADOW(_AdditionalLightsShadowmapTexture);
SAMPLER_CMP(sampler_AdditionalLightsShadowmapTexture);
-CBUFFER_START(_MainLightShadowBuffer)
// Last cascade is initialized with a no-op matrix. It always transforms
// shadow coord to half3(0, 0, NEAR_PLANE). We use this trick to avoid
// branching since ComputeCascadeIndex can return cascade index = MAX_SHADOW_CASCADES
@@ -40,9 +39,7 @@
half4 _MainLightShadowOffset3;
half4 _MainLightShadowData; // (x: shadowStrength)
float4 _MainLightShadowmapSize; // (xy: 1/width and 1/height, zw: width and height)
-CBUFFER_END
-CBUFFER_START(_AdditionalLightsShadowBuffer)
float4x4 _AdditionalLightsWorldToShadow[MAX_VISIBLE_LIGHTS];
half _AdditionalShadowStrength[MAX_VISIBLE_LIGHTS];
half4 _AdditionalShadowOffset0;
@@ -50,7 +47,6 @@
half4 _AdditionalShadowOffset2;
half4 _AdditionalShadowOffset3;
float4 _AdditionalShadowmapSize; // (xy: 1/width and 1/height, zw: width and height)
-CBUFFER_END
float4 _ShadowBias; // x: depth bias, y: normal bias
diff -Naur lwrp-690/ShaderLibrary/UnityInput.hlsl lwrp-691/ShaderLibrary/UnityInput.hlsl
--- lwrp-690/ShaderLibrary/UnityInput.hlsl 2019-07-05 11:41:00.000000000 +0300
+++ lwrp-691/ShaderLibrary/UnityInput.hlsl 2019-07-30 00:57:01.000000000 +0300
@@ -32,7 +32,6 @@
// ----------------------------------------------------------------------------
-CBUFFER_START(UnityPerCamera)
// Time (t = time since current level load) values from Unity
float4 _Time; // (t/20, t, t*2, t*3)
float4 _SinTime; // sin(t/8), sin(t/4), sin(t/2), sin(t)
@@ -73,10 +72,8 @@
// z = unused
// w = 1.0 if camera is ortho, 0.0 if perspective
float4 unity_OrthoParams;
-CBUFFER_END
-CBUFFER_START(UnityPerCameraRare)
float4 unity_CameraWorldClipPlanes[6];
#if !defined(USING_STEREO_MATRICES)
@@ -88,7 +85,6 @@
float4x4 unity_WorldToCamera;
float4x4 unity_CameraToWorld;
#endif
-CBUFFER_END
// ----------------------------------------------------------------------------
@@ -182,7 +178,6 @@
// ----------------------------------------------------------------------------
-CBUFFER_START(UnityPerFrame)
real4 glstate_lightmodel_ambient;
real4 unity_AmbientSky;
real4 unity_AmbientEquator;
@@ -201,7 +196,6 @@
#endif
real4 unity_ShadowColor;
-CBUFFER_END
// ----------------------------------------------------------------------------
@@ -223,7 +217,6 @@
// TODO: all affine matrices should be 3x4.
// TODO: sort these vars by the frequency of use (descending), and put commonly used vars together.
// Note: please use UNITY_MATRIX_X macros instead of referencing matrix variables directly.
-CBUFFER_START(UnityPerPass)
float4x4 _PrevViewProjMatrix;
float4x4 _ViewProjMatrix;
float4x4 _NonJitteredViewProjMatrix;
@@ -235,7 +228,6 @@
float4 _InvProjParam;
float4 _ScreenSize; // {w, h, 1/w, 1/h}
float4 _FrustumPlanes[6]; // {(a, b, c) = N, d = -dot(N, P)} [L, R, T, B, N, F]
-CBUFFER_END
float4x4 OptimizeProjectionMatrix(float4x4 M)
{
diff -Naur lwrp-690/Shaders/Utils/Lightweight2D.hlsl lwrp-691/Shaders/Utils/Lightweight2D.hlsl
--- lwrp-690/Shaders/Utils/Lightweight2D.hlsl 2019-07-05 11:41:00.000000000 +0300
+++ lwrp-691/Shaders/Utils/Lightweight2D.hlsl 2019-07-30 00:57:01.000000000 +0300
@@ -11,8 +11,6 @@
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
-
- UNITY_VERTEX_OUTPUT_STEREO
};
Varyings vert(Attributes input)
@@ -23,14 +21,11 @@
output.vertex = vertexInput.positionCS;
output.uv = TRANSFORM_TEX(input.uv, _BaseMap);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
return output;
}
half4 frag(Varyings input) : SV_Target
{
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
-
half2 uv = input.uv;
half4 texColor = SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv);
half3 color = texColor.rgb * _BaseColor.rgb;
diff -Naur lwrp-690/package.json lwrp-691/package.json
--- lwrp-690/package.json 2019-07-05 22:48:46.000000000 +0300
+++ lwrp-691/package.json 2019-07-30 00:57:01.000000000 +0300
@@ -1,19 +1,19 @@
{
"dependencies": {
"com.unity.postprocessing": "2.1.6",
- "com.unity.render-pipelines.core": "6.9.0",
- "com.unity.shadergraph": "6.9.0"
+ "com.unity.render-pipelines.core": "6.9.1",
+ "com.unity.shadergraph": "6.9.1"
},
"description": "The Lightweight Render Pipeline (LWRP) is a prebuilt Scriptable Render Pipeline, made by Unity. The technology offers graphics that are scalable to mobile platforms, and you can also use it for higher-end consoles and PCs. You\u2019re able to achieve quick rendering at a high quality without needing compute shader technology. LWRP uses simplified, physically based Lighting and Materials. The LWRP uses single-pass forward rendering. Use this pipeline to get optimized real-time performance on several platforms.",
"displayName": "Lightweight RP",
"name": "com.unity.render-pipelines.lightweight",
"repoPackagePath": "com.unity.render-pipelines.lightweight",
"repository": {
- "revision": "a0539b6e84abf8cedea2d4372f495135a6c5cba8",
+ "revision": "158ea4bd3c218879b64e573f3bc203420a89b673",
"type": "git",
"url": "ssh://git@github.com/Unity-Technologies/ScriptableRenderLoop.git"
},
"unity": "2019.2",
"unityRelease": "0b9",
- "version": "6.9.0"
+ "version": "6.9.1"
}
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment