Fix gpudrivenrendering example on Linux
Skip the first frame because the content of m_drawcallInstanceCounts is uninitialized, and the atomicAdd used in RENDER_PASS_OCCLUDE_PROPS_ID can produce random results. Fixes #1794
This commit is contained in:
parent
d558315887
commit
ef3ad2bdd1
@ -695,6 +695,7 @@ public:
|
||||
m_timeOffset = bx::getHPCounter();
|
||||
|
||||
m_useIndirect = true;
|
||||
m_firstFrame = true;
|
||||
|
||||
imguiCreate();
|
||||
}
|
||||
@ -916,7 +917,9 @@ public:
|
||||
// Set "material" data (currently a color only)
|
||||
bgfx::setUniform(u_color, &m_materials[0].m_color, m_noofMaterials);
|
||||
|
||||
if (m_useIndirect)
|
||||
// We can't use indirect drawing for the first frame because the content of m_drawcallInstanceCounts
|
||||
// is initially undefined.
|
||||
if (m_useIndirect && !m_firstFrame)
|
||||
{
|
||||
// Set vertex and index buffer.
|
||||
bgfx::setVertexBuffer(0, m_allPropsVertexbufferHandle);
|
||||
@ -967,6 +970,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
m_firstFrame = false;
|
||||
}
|
||||
|
||||
bool update() override
|
||||
@ -1131,6 +1135,7 @@ public:
|
||||
uint8_t m_noofHiZMips;
|
||||
|
||||
bool m_useIndirect;
|
||||
bool m_firstFrame;
|
||||
|
||||
Camera m_camera;
|
||||
Mouse m_mouse;
|
||||
|
Loading…
Reference in New Issue
Block a user