Skip to content

Commit df602a8

Browse files
adrien-de-tocquevilleEvergreen
authored andcommitted
[2023.2] Fix shader warning
Fixing HDRP shader compilation warning on Fine light tile pruning compute shader: for loop that is of length 1 requiring force unroll.
1 parent da0243d commit df602a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/lightlistbuild.compute

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,9 @@ void FinePruneLights(uint threadID, int iNrCoarseLights, uint2 viTilLL, float vL
434434
// reflection lights are kept in separate regions.
435435

436436
{
437-
for (uint it = 0; it < ((SHADEROPTIONS_FPTLMAX_LIGHT_COUNT+1) + NR_THREADS - 1)/NR_THREADS; ++it)
437+
#define MAX_FINE_PRUNE_LOOP_CNT (((SHADEROPTIONS_FPTLMAX_LIGHT_COUNT+1) + NR_THREADS - 1)/NR_THREADS)
438+
[unroll(MAX_FINE_PRUNE_LOOP_CNT)]
439+
for (uint it = 0; it < MAX_FINE_PRUNE_LOOP_CNT; ++it)
438440
{
439441
uint i = t + it * NR_THREADS;
440442
if (i < (uint)iNrCoarseLights)
@@ -567,7 +569,9 @@ void FinePruneLights(uint threadID, int iNrCoarseLights, uint2 viTilLL, float vL
567569

568570
if (t == 0) ldsNrLightsFinal = localCount;
569571

570-
for (uint it = 0; it < ((SHADEROPTIONS_FPTLMAX_LIGHT_COUNT+1) + NR_THREADS - 1)/NR_THREADS; ++it)
572+
#define MAX_LIGHT_WRITE_LOOP_CNT (((SHADEROPTIONS_FPTLMAX_LIGHT_COUNT+1) + NR_THREADS - 1)/NR_THREADS)
573+
[unroll(MAX_LIGHT_WRITE_LOOP_CNT)]
574+
for (uint it = 0; it < MAX_LIGHT_WRITE_LOOP_CNT; ++it)
571575
{
572576
uint i = t + it * NR_THREADS;
573577
uint lightsMask = ldsDoesLightIntersect[i >> 5];

0 commit comments

Comments
 (0)