From 21ceebbe4b0ed9ee9a5ac5e46b2641d338f46d3c Mon Sep 17 00:00:00 2001 From: Dynamitos Date: Fri, 24 Jan 2025 22:34:23 +0100 Subject: [PATCH] adding basic timing --- CMakeSettings.json | 13 +++++++++++++ src/scene/Scene.cpp | 4 +++- src/window/Window.cpp | 5 ++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index 7dc129b..7a02fa3 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -11,6 +11,19 @@ "buildCommandArgs": "", "ctestCommandArgs": "", "cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe" + }, + { + "name": "Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\bin\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeExecutable": "C:/Program Files/CMake/bin/cmake.exe", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] } ] } \ No newline at end of file diff --git a/src/scene/Scene.cpp b/src/scene/Scene.cpp index 4dc4c92..93d0efc 100644 --- a/src/scene/Scene.cpp +++ b/src/scene/Scene.cpp @@ -42,9 +42,11 @@ void Scene::render(Camera cam, RenderParameter params) } }); } + auto start = std::chrono::high_resolution_clock::now(); threadPool.runBatch(std::move(batch)); + auto end = std::chrono::high_resolution_clock::now(); + std::cout << std::chrono::duration_cast(end - start).count() << std::endl; std::memcpy(image.data(), accumulator.data(), accumulator.size() * sizeof(glm::vec3)); - std::cout << samp << std::endl; } }); } diff --git a/src/window/Window.cpp b/src/window/Window.cpp index eb05c44..96a2877 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -1,5 +1,4 @@ #include "Window.h" -#include #include #define GLSL(...) "#version 400\n" #__VA_ARGS__ @@ -7,13 +6,13 @@ Window::Window(int width, int height) : width(width), height(height) { glewExperimental = true; - assert(glfwInit()); + glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // We don't want the old OpenGL window = glfwCreateWindow(width, height, "RayTracer", nullptr, nullptr); glfwMakeContextCurrent(window); - assert(!glewInit()); + glewInit(); glGenVertexArrays(1, &vao); glBindVertexArray(vao); glGenTextures(1, &texture);