Skip to content

Commit 53096ec

Browse files
Fixed invalid loop length for probe baking (case 1289680) (#2830)
* Fixed invalid loop length for probe baking (case 1289680) # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md * Update CHANGELOG.md Co-authored-by: sebastienlagarde <[email protected]>
1 parent 9cf8ac1 commit 53096ec

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

com.unity.render-pipelines.high-definition/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 ShaderGraph Decal material not showing exposed properties.
1919
- Fixed wrong coat normal space in shader graph
2020
- Fixed issue with faulty shadow transition when view is close to an object under some aspect ratio conditions
21+
- Fixed NullPointerException when baking probes from the lighting window (case 1289680)
2122

2223
### Changed
2324
- Removed the material pass probe volumes evaluation mode.

com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,20 +322,22 @@ IScriptableBakedReflectionSystemStageNotifier handle
322322
// == 5. ==
323323

324324
// Create new baked state array
325-
var targetSize = m_HDProbeBakedStates.Length + addCount - remCount;
325+
var targetSize = m_HDProbeBakedStates.Length - remCount + toBakeIndicesList.Count;
326326
var targetBakedStates = stackalloc HDProbeBakedState[targetSize];
327327
// Copy baked state that are not removed
328328
var targetI = 0;
329329
for (int i = 0; i < m_HDProbeBakedStates.Length; ++i)
330330
{
331331
if (CoreUnsafeUtils.IndexOf(remIndices, remCount, i) != -1)
332332
continue;
333+
Assert.IsTrue(targetI < targetSize);
333334
targetBakedStates[targetI++] = m_HDProbeBakedStates[i];
334335
}
335336
// Add new baked states
336337
for (int i = 0; i < toBakeIndicesList.Count; ++i)
337338
{
338339
var state = states[toBakeIndicesList.GetUnchecked(i)];
340+
Assert.IsTrue(targetI < targetSize);
339341
targetBakedStates[targetI++] = new HDProbeBakedState
340342
{
341343
instanceID = state.instanceID,

0 commit comments

Comments
 (0)