|
248 | 248 | void FFX_ParallelSort_ScanPrefix(uint numValuesToScan, uint localID, uint groupID, uint BinOffset, uint BaseIndex, bool AddPartialSums, |
249 | 249 | FFX_ParallelSortCB CBuffer, RWStructuredBuffer<uint> ScanSrc, RWStructuredBuffer<uint> ScanDst, RWStructuredBuffer<uint> ScanScratch) |
250 | 250 | { |
| 251 | + uint i; |
251 | 252 | // 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++) |
253 | 254 | { |
254 | 255 | uint DataIndex = BaseIndex + (i * FFX_PARALLELSORT_THREADGROUP_SIZE) + localID; |
255 | 256 |
|
|
263 | 264 |
|
264 | 265 | uint threadgroupSum = 0; |
265 | 266 | // 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++) |
267 | 268 | { |
268 | 269 | uint tmp = gs_FFX_PARALLELSORT_LDS[i][localID]; |
269 | 270 | gs_FFX_PARALLELSORT_LDS[i][localID] = threadgroupSum; |
|
283 | 284 | } |
284 | 285 |
|
285 | 286 | // 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++) |
287 | 288 | gs_FFX_PARALLELSORT_LDS[i][localID] += threadgroupSum; |
288 | 289 |
|
289 | 290 | // Wait for everyone to catch up |
290 | 291 | GroupMemoryBarrierWithGroupSync(); |
291 | 292 |
|
292 | 293 | // 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++) |
294 | 295 | { |
295 | 296 | uint DataIndex = BaseIndex + (i * FFX_PARALLELSORT_THREADGROUP_SIZE) + localID; |
296 | 297 |
|
|
378 | 379 | uint bitKey = (keyIndex >> bitShift) & 0x3; |
379 | 380 |
|
380 | 381 | // Create a packed histogram |
381 | | - uint packedHistogram = 1 << (bitKey * 8); |
| 382 | + uint packedHistogram = 1U << (bitKey * 8); |
382 | 383 |
|
383 | 384 | // Sum up all the packed keys (generates counted offsets up to current thread group) |
384 | 385 | uint localSum = FFX_ParallelSort_BlockScanPrefix(packedHistogram, localID); |
|
0 commit comments