Skip to content

Commit e477903

Browse files
author
Pier-Olivier Boulianne
committed
WIP: trying to fix gpu time, and missing lib to compile with actions
1 parent cf65167 commit e477903

7 files changed

Lines changed: 16 additions & 7 deletions

File tree

12.8 MB
Binary file not shown.
12.7 MB
Binary file not shown.
18.8 MB
Binary file not shown.
402 KB
Binary file not shown.
5.31 MB
Binary file not shown.
401 KB
Binary file not shown.

Sandbox/Source/Sandbox2D.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,15 @@ void Sandbox2D::OnUpdate(Lux::Timestep ts)
167167
m_Renderer2D->BeginScene(m_EditorCamera.GetViewProjection(),
168168
m_EditorCamera.GetViewMatrix());
169169

170-
// Draw geometry at z=0 (the camera's focal point) so it appears
171-
// centred in the viewport. The initial camera sits at {-5,5,5}
172-
// looking at {0,0,0}; objects at z=-5 project to the top-left corner.
173-
m_Renderer2D->DrawQuad({ 0.0f, 0.0f, 0.0f }, { 20.0f, 20.0f }, bgTexture, 10.0f);
170+
// Background at z=-0.1 so it is always behind the rotating quad.
171+
// Pass uv1={10,10} so the texture coordinates actually span 0→10
172+
// across the quad, giving the repeating tile effect. The tilingFactor
173+
// argument alone doesn't scale UVs - the shader uses it as a multiplier
174+
// only when the vertex UVs cover the full 0→1 range first.
175+
m_Renderer2D->DrawQuad({ 0.0f, 0.0f, -0.1f }, { 20.0f, 20.0f }, bgTexture,
176+
1.0f, glm::vec4(1.0f), glm::vec2(0.0f), glm::vec2(10.0f));
177+
178+
// Rotating quad at z=0, clearly in front of the background.
174179
m_Renderer2D->DrawRotatedQuad({ 1.0f, 0.0f, 0.0f }, { 0.8f, 0.8f },
175180
glm::radians(rotation),
176181
{ 0.8f, 0.2f, 0.3f, 1.0f });
@@ -327,9 +332,13 @@ void Sandbox2D::UpdatePerformanceTimers()
327332
{
328333
auto& app = Lux::Application::Get();
329334
m_FrameTime = (float)app.GetFrametime().GetMilliseconds();
330-
auto perf = app.GetPerformanceTimers();
331-
m_GPUTime = perf.RenderThreadGPUWaitTime;
332-
m_CPUTime = m_FrameTime - m_GPUTime;
335+
336+
// MainThreadWorkTime is the CPU time actually measured in Application::Run().
337+
// RenderThreadGPUWaitTime exists in the struct but is never populated by the
338+
// engine yet, so GPU time is shown as (FrameTime - CPU) as a best approximation.
339+
const auto& perf = app.GetPerformanceTimers();
340+
m_CPUTime = perf.MainThreadWorkTime;
341+
m_GPUTime = m_FrameTime - m_CPUTime;
333342
}
334343

335344
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)