Skip to content

Commit 62c7822

Browse files
authored
Fix light indexing (#6577)
* Fix light indexing with min16float4. * Update changelog.
1 parent fb4e2a6 commit 62c7822

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

com.unity.render-pipelines.universal/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1818
- Fixed inspector documentation URLs for the URP asset and Universal Renderer asset.
1919
- Fixed render scale setting unintentionally affecting the scene view camera.
2020
- Fixed property wrappers around material properties.
21+
- Fixed incorrect light indexing on Windows Editor with Android target. [case 1378103](https://issuetracker.unity3d.com/product/unity/issues/guid/1378103/)
2122
- Fixed missing depth for Depth of Field in an overlay camera. [case 1365623](https://issuetracker.unity3d.com/product/unity/issues/guid/1365623/)
2223
- Fixed FXAA quality issues when render scale is not 1.0.
2324

com.unity.render-pipelines.universal/ShaderLibrary/RealtimeLights.hlsl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,12 @@ int GetPerObjectLightIndex(uint index)
252252
// replacing unity_LightIndicesX[i] with a dp4 with identity matrix.
253253
// u_xlat16_40 = dot(unity_LightIndices[int(u_xlatu13)], ImmCB_0_0_0[u_xlati1]);
254254
// This increases both arithmetic and register pressure.
255-
return int(unity_LightIndices[index / 4][index % 4]);
255+
//
256+
// NOTE: min16float4 bug workaround.
257+
// Take the "vec4" part into float4 tmp variable in order to force float4 math.
258+
// It appears indexing half4 as min16float4 on DX11 can fail. (dp4 {min16f})
259+
float4 tmp = unity_LightIndices[index / 4];
260+
return int(tmp[index % 4]);
256261
#else
257262
// Fallback to GLES2. No bitfield magic here :(.
258263
// We limit to 4 indices per object and only sample unity_4LightIndices0.

0 commit comments

Comments
 (0)