Skip to content

Commit 93145cb

Browse files
Removed redundant HDShadowRequest storage (#103)
1 parent b52410b commit 93145cb

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,9 +2526,6 @@ internal static unsafe void CalculateShadowIndices(
25262526

25272527
int shadowSettingsCascadeShadowSplitCount = hdShadowSettings.cascadeShadowSplitCount.value;
25282528

2529-
NativeList<HDShadowResolutionRequest> hdShadowResolutionRequestStorage = unmanagedShadowManagerData.shadowResolutionRequestStorage;
2530-
2531-
25322529
UpdateShadowRequestsAndCalculateIndicesJob shadowRequestsAndIndicesJob = new UpdateShadowRequestsAndCalculateIndicesJob
25332530
{
25342531
shadowManager = unmanagedShadowManagerData,
@@ -2555,7 +2552,6 @@ internal static unsafe void CalculateShadowIndices(
25552552
dynamicAreaRectangleUpdateInfos = lightEntities.dynamicAreaRectangleUpdateInfos,
25562553
dynamicAreaOtherUpdateInfos = lightEntities.dynamicAreaOtherUpdateInfos,
25572554
dynamicDirectionalUpdateInfos = lightEntities.dynamicDirectionalUpdateInfos,
2558-
hdShadowResolutionRequestStorage = hdShadowResolutionRequestStorage,
25592555
kCubemapFaces = lightEntities.cachedCubeMapFaces,
25602556
frustumPlanesStorage = lightEntities.frustumPlanesStorage,
25612557

com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/UpdateShadowRequestsAndCalculateIndicesJob.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ internal unsafe struct UpdateShadowRequestsAndCalculateIndicesJob : IJob
3434
public NativeList<ShadowRequestIntermediateUpdateData> dynamicAreaRectangleUpdateInfos;
3535
public NativeList<ShadowRequestIntermediateUpdateData> dynamicAreaOtherUpdateInfos;
3636
public NativeList<ShadowRequestIntermediateUpdateData> dynamicDirectionalUpdateInfos;
37-
public NativeList<HDShadowResolutionRequest> hdShadowResolutionRequestStorage;
3837
public NativeList<ShadowIndicesAndVisibleLightData> visibleLightsAndIndicesBuffer; // sized to lightCounts
3938
public NativeList<ShadowIndicesAndVisibleLightData> splitVisibleLightsAndIndicesBuffer; // sized to lightCounts
4039
public NativeList<float4> frustumPlanesStorage;
@@ -364,7 +363,7 @@ public void Execute()
364363
int shadowRequestIndex = requestIndicesStorage[indexHandle.storageIndexForRequestIndex];
365364
HDShadowResolutionRequestHandle resolutionRequestHandle = HDShadowManager.GetResolutionRequestHandle(shadowRequestIndex, shadowManagerRequestCount);
366365

367-
ref HDShadowResolutionRequest resolutionRequest = ref hdShadowResolutionRequestStorage.ElementAt(resolutionRequestHandle.index);
366+
ref HDShadowResolutionRequest resolutionRequest = ref shadowManager.shadowResolutionRequestStorage.ElementAt(resolutionRequestHandle.index);
368367

369368
shadowRequest.isInCachedAtlas = (cachedDirectionalUpdateType == ShadowMapUpdateType.Cached);;
370369
shadowRequest.isMixedCached = cachedDirectionalUpdateType == ShadowMapUpdateType.Mixed;
@@ -412,7 +411,7 @@ public void Execute()
412411
HDShadowResolutionRequestHandle resolutionRequestHandle = HDShadowManager.GetResolutionRequestHandle(shadowRequestIndex, shadowManagerRequestCount);
413412
if (!resolutionRequestHandle.valid)
414413
continue;
415-
ref HDShadowResolutionRequest resolutionRequest = ref hdShadowResolutionRequestStorage.ElementAt(resolutionRequestHandle.index);
414+
ref HDShadowResolutionRequest resolutionRequest = ref shadowManager.shadowResolutionRequestStorage.ElementAt(resolutionRequestHandle.index);
416415

417416
shadowRequest.isInCachedAtlas = isSampledFromCache;
418417
shadowRequest.isMixedCached = updateType == ShadowMapUpdateType.Mixed;
@@ -442,7 +441,7 @@ public void Execute()
442441
using (cachedAreaRectangleRequestsMarker.Auto())
443442
{
444443
UpdateNonDirectionalCachedRequests(ShadowMapType.AreaLightAtlas, HDLightType.Area,
445-
cachedAreaRectangleVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, hdShadowResolutionRequestStorage, cachedAreaRectangleUpdateInfos,
444+
cachedAreaRectangleVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, shadowManager.shadowResolutionRequestStorage, cachedAreaRectangleUpdateInfos,
446445
shadowManager.cachedShadowManager.areaShadowAtlas.shadowRequests, shadowManager.areaShadowAtlas.shadowRequests,
447446
shadowManager.areaShadowAtlas.mixedRequestsPendingBlits, shadowManager.cachedShadowManager.areaShadowAtlas.transformCaches, shadowManager.cachedShadowManager.areaShadowAtlas.registeredLightDataPendingPlacement,
448447
shadowManager.cachedShadowManager.areaShadowAtlas.recordsPendingPlacement, shadowManager.cachedShadowManager.areaShadowAtlas.shadowsPendingRendering,
@@ -454,7 +453,7 @@ public void Execute()
454453
using (cachedAreaOtherRequestsMarker.Auto())
455454
{
456455
UpdateNonDirectionalCachedRequests(ShadowMapType.PunctualAtlas, HDLightType.Area,
457-
cachedAreaOtherVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, hdShadowResolutionRequestStorage, cachedAreaOtherUpdateInfos,
456+
cachedAreaOtherVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, shadowManager.shadowResolutionRequestStorage, cachedAreaOtherUpdateInfos,
458457
shadowManager.cachedShadowManager.punctualShadowAtlas.shadowRequests, shadowManager.atlas.shadowRequests,
459458
shadowManager.atlas.mixedRequestsPendingBlits, shadowManager.cachedShadowManager.areaShadowAtlas.transformCaches, shadowManager.cachedShadowManager.punctualShadowAtlas.registeredLightDataPendingPlacement,
460459
shadowManager.cachedShadowManager.punctualShadowAtlas.recordsPendingPlacement, shadowManager.cachedShadowManager.punctualShadowAtlas.shadowsPendingRendering,
@@ -466,7 +465,7 @@ public void Execute()
466465
using (cachedPointRequestsMarker.Auto())
467466
{
468467
UpdateNonDirectionalCachedRequests(ShadowMapType.PunctualAtlas, HDLightType.Point,
469-
cachedPointVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, hdShadowResolutionRequestStorage, cachedPointUpdateInfos,
468+
cachedPointVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, shadowManager.shadowResolutionRequestStorage, cachedPointUpdateInfos,
470469
shadowManager.cachedShadowManager.punctualShadowAtlas.shadowRequests, shadowManager.atlas.shadowRequests,
471470
shadowManager.atlas.mixedRequestsPendingBlits, shadowManager.cachedShadowManager.punctualShadowAtlas.transformCaches, shadowManager.cachedShadowManager.punctualShadowAtlas.registeredLightDataPendingPlacement,
472471
shadowManager.cachedShadowManager.punctualShadowAtlas.recordsPendingPlacement, shadowManager.cachedShadowManager.punctualShadowAtlas.shadowsPendingRendering,
@@ -478,7 +477,7 @@ public void Execute()
478477
using (cachedSpotRequestsMarker.Auto())
479478
{
480479
UpdateNonDirectionalCachedRequests(ShadowMapType.PunctualAtlas, HDLightType.Spot,
481-
cachedSpotVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, hdShadowResolutionRequestStorage, cachedSpotUpdateInfos,
480+
cachedSpotVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, shadowManager.shadowResolutionRequestStorage, cachedSpotUpdateInfos,
482481
shadowManager.cachedShadowManager.punctualShadowAtlas.shadowRequests, shadowManager.atlas.shadowRequests,
483482
shadowManager.atlas.mixedRequestsPendingBlits, shadowManager.cachedShadowManager.punctualShadowAtlas.transformCaches, shadowManager.cachedShadowManager.punctualShadowAtlas.registeredLightDataPendingPlacement,
484483
shadowManager.cachedShadowManager.punctualShadowAtlas.recordsPendingPlacement, shadowManager.cachedShadowManager.punctualShadowAtlas.shadowsPendingRendering,
@@ -490,7 +489,7 @@ public void Execute()
490489
using (dynamicAreaRectangleRequestsMarker.Auto())
491490
{
492491
UpdateNonDirectionalDynamicRequests(ShadowMapType.AreaLightAtlas, HDLightType.Area,
493-
dynamicAreaRectangleVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, hdShadowResolutionRequestStorage, dynamicAreaRectangleUpdateInfos,
492+
dynamicAreaRectangleVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, shadowManager.shadowResolutionRequestStorage, dynamicAreaRectangleUpdateInfos,
494493
shadowManager.cachedShadowManager.areaShadowAtlas.shadowRequests, shadowManager.areaShadowAtlas.shadowRequests,
495494
shadowManager.areaShadowAtlas.mixedRequestsPendingBlits, dynamicAreaRectangleCount, shadowManagerRequestCount);
496495
UpdateDynamicAreaShadowRequestsAndResolutionRequests(dynamicAreaRectangleUpdateInfos);
@@ -500,7 +499,7 @@ public void Execute()
500499
using (dynamicAreaOtherRequestsMarker.Auto())
501500
{
502501
UpdateNonDirectionalDynamicRequests(ShadowMapType.PunctualAtlas, HDLightType.Area,
503-
dynamicAreaOtherVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, hdShadowResolutionRequestStorage, dynamicAreaOtherUpdateInfos,
502+
dynamicAreaOtherVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, shadowManager.shadowResolutionRequestStorage, dynamicAreaOtherUpdateInfos,
504503
shadowManager.cachedShadowManager.punctualShadowAtlas.shadowRequests, shadowManager.atlas.shadowRequests,
505504
shadowManager.atlas.mixedRequestsPendingBlits, dynamicAreaOtherCount, shadowManagerRequestCount);
506505
UpdateDynamicAreaShadowRequestsAndResolutionRequests(dynamicAreaOtherUpdateInfos);
@@ -511,7 +510,7 @@ public void Execute()
511510
using (dynamicPointRequestsMarker.Auto())
512511
{
513512
UpdateNonDirectionalDynamicRequests(ShadowMapType.PunctualAtlas, HDLightType.Point,
514-
dynamicPointVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, hdShadowResolutionRequestStorage, dynamicPointUpdateInfos,
513+
dynamicPointVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, shadowManager.shadowResolutionRequestStorage, dynamicPointUpdateInfos,
515514
shadowManager.cachedShadowManager.punctualShadowAtlas.shadowRequests, shadowManager.atlas.shadowRequests,
516515
shadowManager.atlas.mixedRequestsPendingBlits, dynamicPointCount, shadowManagerRequestCount);
517516
UpdateDynamicPointShadowRequestsAndResolutionRequests();
@@ -522,7 +521,7 @@ public void Execute()
522521
using (dynamicSpotRequestsMarker.Auto())
523522
{
524523
UpdateNonDirectionalDynamicRequests(ShadowMapType.PunctualAtlas, HDLightType.Spot,
525-
dynamicSpotVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, hdShadowResolutionRequestStorage, dynamicSpotUpdateInfos,
524+
dynamicSpotVisibleLightsAndIndices, packedShadowRequestSetHandles, requestStorage, requestIndicesStorage, shadowManager.shadowResolutionRequestStorage, dynamicSpotUpdateInfos,
526525
shadowManager.cachedShadowManager.punctualShadowAtlas.shadowRequests, shadowManager.atlas.shadowRequests,
527526
shadowManager.atlas.mixedRequestsPendingBlits, dynamicSpotCount, shadowManagerRequestCount);
528527
UpdateDynamicSpotShadowRequestsAndResolutionRequests();

0 commit comments

Comments
 (0)