@@ -383,10 +383,6 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
383
383
384
384
ParallelScratchHelper scratchHelper;
385
385
386
- // uint64_t histogramIndices[VectorizationBoundSTL];
387
- // std::fill_n(histogramIndices, VectorizationBoundSTL, ~0ull);
388
- // std::mutex scratchLock;
389
-
390
386
constexpr bool is_seq_policy_v = std::is_same_v<std::remove_reference_t <ExecutionPolicy>, core::execution::sequenced_policy>;
391
387
392
388
struct DummyTexelType
@@ -396,23 +392,6 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
396
392
std::for_each (policy, reinterpret_cast <DummyTexelType*>(intermediateStorage[axis]), reinterpret_cast <DummyTexelType*>(intermediateStorage[axis] + outputTexelCount*MaxChannels), [&sampler, outFormat, &histograms, &scratchHelper, alphaChannel, state](const DummyTexelType& dummyTexel)
397
393
{
398
394
const uint32_t index = scratchHelper.alloc <is_seq_policy_v>();
399
- #if 0
400
- uint32_t index = ~0u;
401
- {
402
- std::unique_lock<std::mutex> lock(scratchLock);
403
- for (uint32_t j = 0u; j < VectorizationBoundSTL; ++j)
404
- {
405
- int32_t firstFree = core::findLSB(histogramIndices[j]);
406
- if (firstFree != -1)
407
- {
408
- index = j * 64u + firstFree;
409
- histogramIndices[j] ^= (0x1u << firstFree); // mark using
410
- break;
411
- }
412
- }
413
- assert(false);
414
- }
415
- #endif
416
395
417
396
value_type texelAlpha = dummyTexel.texel [alphaChannel];
418
397
texelAlpha -= double (sampler.nextSample ()) * (asset::getFormatPrecision<value_type>(outFormat, alphaChannel, texelAlpha) / double (~0u ));
@@ -422,13 +401,6 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
422
401
histograms[index*state->alphaBinCount +binIndex]++;
423
402
424
403
scratchHelper.free <is_seq_policy_v>(index);
425
-
426
- #if 0
427
- {
428
- std::unique_lock<std::mutex> lock(scratchLock);
429
- histogramIndices[index/64u] ^= (0x1u<<(index%64u)); // mark free
430
- }
431
- #endif
432
404
});
433
405
434
406
uint32_t * mergedHistogram = histograms;
@@ -527,39 +499,7 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
527
499
//
528
500
assert (is_seq_policy_v || std::thread::hardware_concurrency ()<=64u );
529
501
ParallelScratchHelper scratchHelper;
530
- #if 0
531
- uint64_t decodeScratchAllocs[VectorizationBoundSTL];
532
- std::fill_n(decodeScratchAllocs,VectorizationBoundSTL,~0u);
533
- std::mutex scratchLock;
534
- auto alloc_decode_scratch = [is_seq_policy_v,&scratchLock,&decodeScratchAllocs]() -> int32_t
535
- {
536
- if /*constexpr*/ (is_seq_policy_v)
537
- return 0;
538
- else
539
- {
540
- std::unique_lock<std::mutex> lock(scratchLock);
541
- for (uint32_t j=0u; j<VectorizationBoundSTL; j++)
542
- {
543
- int32_t firstFree = core::findLSB(decodeScratchAllocs[j]);
544
- if (firstFree==-1)
545
- continue;
546
- decodeScratchAllocs[j] ^= 0x1u<<firstFree;
547
- return j*64u+firstFree;
548
- }
549
- assert(false);
550
- return 0xdeadbeef;
551
- }
552
- };
553
- auto free_decode_scratch = [is_seq_policy_v,&scratchLock,&decodeScratchAllocs](int32_t addr)
554
- {
555
- if /*constexpr*/ (!is_seq_policy_v)
556
- {
557
- std::unique_lock<std::mutex> lock(scratchLock);
558
- decodeScratchAllocs[addr/64u] ^= 0x1u<<(addr%64u);
559
- }
560
- };
561
- //
562
- #endif
502
+
563
503
constexpr uint32_t batch_dims = 2u ;
564
504
const uint32_t batchExtent[batch_dims] = {
565
505
static_cast <uint32_t >(intermediateExtent[axis][loopCoordID[0 ]]),
@@ -584,7 +524,6 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
584
524
else
585
525
{
586
526
const auto inputEnd = inExtent.width +real_window_size.x ;
587
- // decode_offset = alloc_decode_scratch();
588
527
decode_offset = scratchHelper.alloc <is_seq_policy_v>();
589
528
lineBuffer = intermediateStorage[1 ]+decode_offset*MaxChannels*inputEnd;
590
529
for (auto & i=localTexCoord.x ; i<inputEnd; i++)
0 commit comments