Skip to content

Commit 66bfe82

Browse files
improve AA and rayCount edge-cases
1 parent db31665 commit 66bfe82

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples_tests/22.RaytracedAO/Renderer.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ void Renderer::render(nbl::ITimer* timer)
11971197
// jitter with AA AntiAliasingSequence
11981198
const auto modifiedViewProj = [&](uint32_t frameID)
11991199
{
1200-
const float stddev = 0.707f;
1200+
const float stddev = 0.5f;
12011201
const float* sample = AntiAliasingSequence[frameID];
12021202
const float phi = core::PI<float>()*(2.f*sample[1]-1.f);
12031203
const float sinPhi = sinf(phi);
@@ -1326,11 +1326,10 @@ void Renderer::render(nbl::ITimer* timer)
13261326

13271327
uint32_t Renderer::traceBounce(uint32_t raycount)
13281328
{
1329-
if (raycount==0u)
1330-
return 0u;
1331-
13321329
const uint32_t readIx = (++m_raytraceCommonData.depth)&0x1u;
13331330
const uint32_t writeIx = readIx^0x1u;
1331+
if (raycount==0u)
1332+
return 0u;
13341333
// trace bounce (accumulate contributions and optionally generate rays)
13351334
{
13361335
const bool continuation = m_raytraceCommonData.depth!=1u;
@@ -1363,6 +1362,8 @@ uint32_t Renderer::traceBounce(uint32_t raycount)
13631362
m_raytraceCommonData.rayCountWriteIx = (++m_raytraceCommonData.rayCountWriteIx)&RAYCOUNT_N_BUFFERING_MASK;
13641363
glFinish(); // sync CPU to GL
13651364
const uint32_t nextTraceRaycount = *reinterpret_cast<uint32_t*>(m_littleDownloadBuffer->getBoundMemory()->getMappedPointer());
1365+
if (nextTraceRaycount==0u)
1366+
return 0u;
13661367

13671368
auto commandQueue = m_rrManager->getCLCommandQueue();
13681369
const cl_mem clObjects[] = {m_rayBuffer[writeIx].asRRBuffer.second,m_intersectionBuffer[writeIx].asRRBuffer.second};

0 commit comments

Comments
 (0)