Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 18fc14a0 authored by TAVERNIER Vincent's avatar TAVERNIER Vincent
Browse files

Update iTimeDelta automatically on all buffers

parent b64949f8
No related branches found
No related tags found
No related merge requests found
......@@ -397,8 +397,6 @@ int render(GLFWwindow* window,
<< "ns fps: " << (1e9 / renderTime)
<< " mpx/s: " << (contextConfig.width * contextConfig.height / (renderTime / 1e3))
<< std::endl;
state.V<shadertoy::iTimeDelta>() = renderTime / 1e9;
}
// Buffer swapping
......
......@@ -101,6 +101,7 @@ void RenderContext::Initialize()
{
// Initialize constant uniforms
state.V<iResolution>() = glm::vec3(config.width, config.height, 1.0f);
// Note that this will be overriden once query measurements are available
state.V<iTimeDelta>() = 1.0f / (float) config.targetFramerate;
state.V<iFrameRate>() = (float) config.targetFramerate;
......
......@@ -144,6 +144,18 @@ void ToyBuffer::Render()
resolutions[i][2] = 1.0f;
}
// Try to set iTimeDelta
GLint available = 0;
timeDeltaQuery.GetObjectiv(GL_QUERY_RESULT_AVAILABLE, &available);
if (available)
{
// Result available, set uniform value
GLuint64 timeDelta;
timeDeltaQuery.GetObjectui64v(GL_QUERY_RESULT, &timeDelta);
static_pointer_cast<ShaderInputsType::BoundInputs>(boundInputs[0])
->State.V<iTimeDelta>() = timeDelta / 1e9;
}
// Set all uniforms
for (auto &inputs : boundInputs)
inputs->Apply();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment