Skip to content

Commit 21691b0

Browse files
committed
Remove some dead code from CBlitImageFilter.
1 parent 422c7e3 commit 21691b0

File tree

1 file changed

+1
-62
lines changed

1 file changed

+1
-62
lines changed

include/nbl/asset/filters/CBlitImageFilter.h

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,6 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
383383

384384
ParallelScratchHelper scratchHelper;
385385

386-
// uint64_t histogramIndices[VectorizationBoundSTL];
387-
// std::fill_n(histogramIndices, VectorizationBoundSTL, ~0ull);
388-
// std::mutex scratchLock;
389-
390386
constexpr bool is_seq_policy_v = std::is_same_v<std::remove_reference_t<ExecutionPolicy>, core::execution::sequenced_policy>;
391387

392388
struct DummyTexelType
@@ -396,23 +392,6 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
396392
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)
397393
{
398394
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
416395

417396
value_type texelAlpha = dummyTexel.texel[alphaChannel];
418397
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
422401
histograms[index*state->alphaBinCount+binIndex]++;
423402

424403
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
432404
});
433405

434406
uint32_t* mergedHistogram = histograms;
@@ -527,39 +499,7 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
527499
//
528500
assert(is_seq_policy_v || std::thread::hardware_concurrency()<=64u);
529501
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+
563503
constexpr uint32_t batch_dims = 2u;
564504
const uint32_t batchExtent[batch_dims] = {
565505
static_cast<uint32_t>(intermediateExtent[axis][loopCoordID[0]]),
@@ -584,7 +524,6 @@ class NBL_API CBlitImageFilter : public CImageFilter<CBlitImageFilter<Swizzle,Di
584524
else
585525
{
586526
const auto inputEnd = inExtent.width+real_window_size.x;
587-
// decode_offset = alloc_decode_scratch();
588527
decode_offset = scratchHelper.alloc<is_seq_policy_v>();
589528
lineBuffer = intermediateStorage[1]+decode_offset*MaxChannels*inputEnd;
590529
for (auto& i=localTexCoord.x; i<inputEnd; i++)

0 commit comments

Comments
 (0)