Skip to content

Commit 0c53994

Browse files
committed
FidelityFX Parallel Sort v1.1.1
1 parent 40b1a9c commit 0c53994

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ffx-parallelsort/FFX_ParallelSort.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@
248248
void FFX_ParallelSort_ScanPrefix(uint numValuesToScan, uint localID, uint groupID, uint BinOffset, uint BaseIndex, bool AddPartialSums,
249249
FFX_ParallelSortCB CBuffer, RWStructuredBuffer<uint> ScanSrc, RWStructuredBuffer<uint> ScanDst, RWStructuredBuffer<uint> ScanScratch)
250250
{
251+
uint i;
251252
// Perform coalesced loads into LDS
252-
for (uint i = 0; i < FFX_PARALLELSORT_ELEMENTS_PER_THREAD; i++)
253+
for (i = 0; i < FFX_PARALLELSORT_ELEMENTS_PER_THREAD; i++)
253254
{
254255
uint DataIndex = BaseIndex + (i * FFX_PARALLELSORT_THREADGROUP_SIZE) + localID;
255256

@@ -263,7 +264,7 @@
263264

264265
uint threadgroupSum = 0;
265266
// Calculate the local scan-prefix for current thread
266-
for (uint i = 0; i < FFX_PARALLELSORT_ELEMENTS_PER_THREAD; i++)
267+
for (i = 0; i < FFX_PARALLELSORT_ELEMENTS_PER_THREAD; i++)
267268
{
268269
uint tmp = gs_FFX_PARALLELSORT_LDS[i][localID];
269270
gs_FFX_PARALLELSORT_LDS[i][localID] = threadgroupSum;
@@ -283,14 +284,14 @@
283284
}
284285

285286
// Add the block scanned-prefixes back in
286-
for (uint i = 0; i < FFX_PARALLELSORT_ELEMENTS_PER_THREAD; i++)
287+
for (i = 0; i < FFX_PARALLELSORT_ELEMENTS_PER_THREAD; i++)
287288
gs_FFX_PARALLELSORT_LDS[i][localID] += threadgroupSum;
288289

289290
// Wait for everyone to catch up
290291
GroupMemoryBarrierWithGroupSync();
291292

292293
// Perform coalesced writes to scan dst
293-
for (uint i = 0; i < FFX_PARALLELSORT_ELEMENTS_PER_THREAD; i++)
294+
for (i = 0; i < FFX_PARALLELSORT_ELEMENTS_PER_THREAD; i++)
294295
{
295296
uint DataIndex = BaseIndex + (i * FFX_PARALLELSORT_THREADGROUP_SIZE) + localID;
296297

@@ -378,7 +379,7 @@
378379
uint bitKey = (keyIndex >> bitShift) & 0x3;
379380

380381
// Create a packed histogram
381-
uint packedHistogram = 1 << (bitKey * 8);
382+
uint packedHistogram = 1U << (bitKey * 8);
382383

383384
// Sum up all the packed keys (generates counted offsets up to current thread group)
384385
uint localSum = FFX_ParallelSort_BlockScanPrefix(packedHistogram, localID);

0 commit comments

Comments
 (0)