Hello !
I didn’t know the “forcing early-Z tests”, so I have implement it and now it seems to work perfectly, so thank you :-).
Now, I have question about it. I tryed to delete my pre depth pass and use “early-Z tests”, but it seems to be not faster than without pre depth pass.
With pre depth pass, I have to wait 10 ms to render all the scene with lights.
Without, I have to wait 15ms.
And without pre depth pass, but with early-Z tests, I’ve also 15 ms…
This is my code for the pre depth pass and rendering pass :-).
void SceneManager::renderDepthPass()
{
//Depth Pass
global->Model.command->bind(DRAW_INDIRECT);
global->Model.vaoDepth->bind();
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
synchronize(); // clear and dispatch
glMemoryBarrier(GL_COMMAND_BARRIER_BIT | GL_SHADER_STORAGE_BARRIER_BIT);
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_INT, nullptr, global->Model.command->numElements(), 0);
}
void SceneManager::renderModels()
{
// Rendering pass
global->Model.vao->bind();
synchronize();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthFunc(GL_EQUAL);
glDepthMask(GL_FALSE);
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_INT, nullptr, global->Model.command->numElements(), 0);
glDepthFunc(GL_LESS);
glDepthMask(GL_TRUE);
}
And when I delete the pre depth pass to use layout(early_fragment_tests) in;
I use this code
void SceneManager::renderModels()
{
global->Model.command->bind(DRAW_INDIRECT);
// Rendering pass
global->Model.vao->bind();
synchronize();
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_INT, nullptr, global->Model.command->numElements(), 0);
}
Synchronize is a function using fencing to wait gpu ^_^.
Thank you so much for your help :-).
Qnoper