Profiling under windows

This commit is contained in:
Kevin Trogant 2022-12-16 12:18:47 +01:00
parent ffe2764d29
commit 15a0b77960
10 changed files with 100 additions and 18 deletions

View File

@ -6,6 +6,16 @@ if (NOT WIN32)
message(FATAL_ERROR "Only windows builds from top-level CMakeLists.txt") message(FATAL_ERROR "Only windows builds from top-level CMakeLists.txt")
endif() endif()
include(FetchContent)
FetchContent_Declare(
tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG master
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(tracy)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)

View File

@ -1,5 +1,7 @@
#include "AssetManager.h" #include "AssetManager.h"
#include "Log.h" #include "Log.h"
#include "Profiling.h"
#define STBI_NO_STDIO #define STBI_NO_STDIO
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" #include "stb_image.h"
@ -11,6 +13,7 @@ AssetManager* AssetManager::ptr = nullptr;
bool AssetManager::loadTexture(const char* path, Texture* p_texture) bool AssetManager::loadTexture(const char* path, Texture* p_texture)
{ {
ZoneScoped;
FileBuffer texture_data = {}; FileBuffer texture_data = {};
if (!loadFile(path, &texture_data)) if (!loadFile(path, &texture_data))
return false; return false;
@ -30,6 +33,7 @@ bool AssetManager::loadTexture(const char* path, Texture* p_texture)
bool AssetManager::loadFontData(const char* path, float char_height, FontData* p_font) bool AssetManager::loadFontData(const char* path, float char_height, FontData* p_font)
{ {
ZoneScoped;
FileBuffer ttf_data = {}; FileBuffer ttf_data = {};
if (!loadFile(path, &ttf_data)) if (!loadFile(path, &ttf_data))
return false; return false;
@ -41,8 +45,10 @@ bool AssetManager::loadFontData(const char* path, float char_height, FontData* p
0, 0,
char_height, char_height,
bitmap_memory, bitmap_memory,
STBTT_PH_VALUE, STBTT_PH_VALUE, STBTT_PH_VALUE,
32, 225, // latin-1 printable characters range STBTT_PH_VALUE,
32,
225, // latin-1 printable characters range
font_data.char_data); font_data.char_data);
font_data.char_height = char_height; font_data.char_height = char_height;
int off = stbtt_GetFontOffsetForIndex(data, 0); int off = stbtt_GetFontOffsetForIndex(data, 0);
@ -71,6 +77,7 @@ bool AssetManager::loadFontData(const char* path, float char_height, FontData* p
bool AssetManager::loadFontBitmap(const char* path, float char_height, Texture* p_texture) bool AssetManager::loadFontBitmap(const char* path, float char_height, Texture* p_texture)
{ {
ZoneScoped;
FileBuffer ttf_data = {}; FileBuffer ttf_data = {};
if (!loadFile(path, &ttf_data)) if (!loadFile(path, &ttf_data))
return false; return false;
@ -80,8 +87,10 @@ bool AssetManager::loadFontBitmap(const char *path, float char_height, Texture*
0, 0,
char_height, char_height,
bitmap_memory, bitmap_memory,
STBTT_PH_VALUE, STBTT_PH_VALUE, STBTT_PH_VALUE,
32, 225, // latin-1 printable characters range STBTT_PH_VALUE,
32,
225, // latin-1 printable characters range
char_data); char_data);
*p_texture = Texture(STBTT_PH_VALUE, STBTT_PH_VALUE, bitmap_memory, GL_R8); *p_texture = Texture(STBTT_PH_VALUE, STBTT_PH_VALUE, bitmap_memory, GL_R8);
releaseFileBuffer(ttf_data); releaseFileBuffer(ttf_data);

View File

@ -1,8 +1,11 @@
cmake_minimum_required(VERSION 3.18.1) cmake_minimum_required(VERSION 3.18.1)
project("kde") project("kde")
set(CMAKE_CXX_STANDARD 14)
# INTEGRATION Füge deine CPP/H Dateien hier hinzu # INTEGRATION Füge deine CPP/H Dateien hier hinzu
set(kde_SRCS set(kde_SRCS
Profiling.h
Renderer.cpp Renderer.cpp
Renderer.h Renderer.h
Texture.cpp Texture.cpp
@ -47,6 +50,6 @@ elseif (WIN32)
glad.h glad.h
Win32AssetManager.cpp Win32AssetManager.cpp
Win32AssetManager.h) Win32AssetManager.h)
target_link_libraries(kde glfw) target_link_libraries(kde glfw TracyClient)
target_include_directories(kde PRIVATE ${PROJECT_SOURCE_DIR}/../../../glfw/include) target_include_directories(kde PRIVATE ${Tracy_SOURCE_DIR}/public)
endif() endif()

View File

@ -1,21 +1,16 @@
#include "Hash.h" #include "Hash.h"
#include "Profiling.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
Hash::Hash() Hash::Hash() : m_bucket_count(0), m_used_buckets(0), m_keys(nullptr), m_values(nullptr)
: m_bucket_count(0),
m_used_buckets(0),
m_keys(nullptr),
m_values(nullptr)
{ {
ZoneScoped;
} }
Hash::Hash(uint32_t bucket_count) Hash::Hash(uint32_t bucket_count) : m_bucket_count(0), m_used_buckets(0), m_keys(nullptr), m_values(nullptr)
: m_bucket_count(0),
m_used_buckets(0),
m_keys(nullptr),
m_values(nullptr)
{ {
ZoneScoped;
auto* mem = reinterpret_cast<uint64_t*>(malloc(sizeof(uint64_t) * 2 * bucket_count)); auto* mem = reinterpret_cast<uint64_t*>(malloc(sizeof(uint64_t) * 2 * bucket_count));
if (!mem) if (!mem)
return; return;
@ -31,6 +26,7 @@ Hash::Hash(const Hash& copy)
m_keys(nullptr), m_keys(nullptr),
m_values(nullptr) m_values(nullptr)
{ {
ZoneScoped;
auto* mem = reinterpret_cast<uint64_t*>(malloc(sizeof(uint64_t) * 2 * m_bucket_count)); auto* mem = reinterpret_cast<uint64_t*>(malloc(sizeof(uint64_t) * 2 * m_bucket_count));
if (!mem) if (!mem)
return; return;
@ -41,6 +37,7 @@ Hash::Hash(const Hash& copy)
Hash& Hash::operator=(const Hash& rhs) Hash& Hash::operator=(const Hash& rhs)
{ {
ZoneScoped;
if (m_keys) if (m_keys)
free(m_keys); free(m_keys);
m_bucket_count = rhs.m_bucket_count; m_bucket_count = rhs.m_bucket_count;
@ -60,6 +57,7 @@ Hash& Hash::operator=(const Hash& rhs)
Hash::~Hash() Hash::~Hash()
{ {
ZoneScoped;
free(m_keys); free(m_keys);
m_used_buckets = 0; m_used_buckets = 0;
m_bucket_count = 0; m_bucket_count = 0;
@ -69,6 +67,7 @@ Hash::~Hash()
uint64_t Hash::lookup(uint64_t key, uint64_t default_value) uint64_t Hash::lookup(uint64_t key, uint64_t default_value)
{ {
ZoneScoped;
if (m_bucket_count == 0) if (m_bucket_count == 0)
return default_value; return default_value;
uint64_t i = key % m_bucket_count; uint64_t i = key % m_bucket_count;
@ -84,6 +83,7 @@ uint64_t Hash::lookup(uint64_t key, uint64_t default_value)
bool Hash::insert(uint64_t key, uint64_t value) bool Hash::insert(uint64_t key, uint64_t value)
{ {
ZoneScoped;
if (key == HASH_EMPTY_KEY || key == HASH_TOMBSTONE_KEY) { if (key == HASH_EMPTY_KEY || key == HASH_TOMBSTONE_KEY) {
return false; return false;
} }
@ -138,6 +138,7 @@ bool Hash::insert(uint64_t key, uint64_t value)
void Hash::remove(uint64_t key) void Hash::remove(uint64_t key)
{ {
ZoneScoped;
if (m_bucket_count == 0) if (m_bucket_count == 0)
return; return;
uint64_t i = key % m_bucket_count; uint64_t i = key % m_bucket_count;

View File

@ -0,0 +1,16 @@
#ifndef KRIMI_DINNER_ENGINE_PROFILING_H
#define KRIMI_DINNER_ENGINE_PROFILING_H
#ifdef _WIN32
#include <tracy/Tracy.hpp>
#else
#define FrameMark
#define ZoneScoped
#endif
#endif

View File

@ -2,6 +2,7 @@
#include "Log.h" #include "Log.h"
#include "AssetManager.h" #include "AssetManager.h"
#include "Texture.h" #include "Texture.h"
#include "Profiling.h"
#include <assert.h> #include <assert.h>
@ -62,17 +63,20 @@ static const char* g_frag_src = "#version 300 es
void Renderer::create() void Renderer::create()
{ {
ZoneScoped;
Renderer::ptr = new Renderer; Renderer::ptr = new Renderer;
} }
void Renderer::destroy() void Renderer::destroy()
{ {
ZoneScoped;
delete Renderer::ptr; delete Renderer::ptr;
Renderer::ptr = nullptr; Renderer::ptr = nullptr;
} }
Renderer::Renderer() Renderer::Renderer()
{ {
ZoneScoped;
GLuint vertex = 0, fragment = 0; GLuint vertex = 0, fragment = 0;
vertex = glCreateShader(GL_VERTEX_SHADER); vertex = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertex, 1, &g_vert_src, nullptr); glShaderSource(vertex, 1, &g_vert_src, nullptr);
@ -143,6 +147,7 @@ Renderer::Renderer()
Renderer::~Renderer() Renderer::~Renderer()
{ {
ZoneScoped;
for (auto texture : m_textures) for (auto texture : m_textures)
texture.second.destroy(); texture.second.destroy();
glDeleteProgram(m_shader); glDeleteProgram(m_shader);
@ -152,21 +157,25 @@ Renderer::~Renderer()
void Renderer::addRect(float x, float y, float w, float h) void Renderer::addRect(float x, float y, float w, float h)
{ {
ZoneScoped;
addRect(x, y, w, h, 1.f, 1.f, 1.f, 1.f, m_dummy_texture, 0.f, 0.f, 1.f, 1.f); addRect(x, y, w, h, 1.f, 1.f, 1.f, 1.f, m_dummy_texture, 0.f, 0.f, 1.f, 1.f);
} }
void Renderer::addRect(float x, float y, float w, float h, StringHandle texture) void Renderer::addRect(float x, float y, float w, float h, StringHandle texture)
{ {
ZoneScoped;
addRect(x, y, w, h, 1.f, 1.f, 1.f, 1.f, texture, 0.f, 0.f, 1.f, 1.f); addRect(x, y, w, h, 1.f, 1.f, 1.f, 1.f, texture, 0.f, 0.f, 1.f, 1.f);
} }
void Renderer::addRect(float x, float y, float w, float h, float r, float g, float b, float a) void Renderer::addRect(float x, float y, float w, float h, float r, float g, float b, float a)
{ {
ZoneScoped;
addRect(x, y, w, h, r, g, b, a, m_dummy_texture, 0.f, 0.f, 1.f, 1.f); addRect(x, y, w, h, r, g, b, a, m_dummy_texture, 0.f, 0.f, 1.f, 1.f);
} }
void Renderer::addRect(float x, float y, float w, float h, float r, float g, float b, float a, StringHandle texture) void Renderer::addRect(float x, float y, float w, float h, float r, float g, float b, float a, StringHandle texture)
{ {
ZoneScoped;
addRect(x, y, w, h, r, g, b, a, texture, 0.f, 0.f, 1.f, 1.f); addRect(x, y, w, h, r, g, b, a, texture, 0.f, 0.f, 1.f, 1.f);
} }
@ -180,6 +189,7 @@ void Renderer::addRect(float x,
float src_w, float src_w,
float src_h) float src_h)
{ {
ZoneScoped;
addRect(x, y, w, h, 1.f, 1.f, 1.f, 1.f, texture, src_x, src_y, src_w, src_h); addRect(x, y, w, h, 1.f, 1.f, 1.f, 1.f, texture, src_x, src_y, src_w, src_h);
} }
@ -197,6 +207,7 @@ void Renderer::addRect(float x,
float src_w, float src_w,
float src_h) float src_h)
{ {
ZoneScoped;
if (m_textures.find(texture) == m_textures.end()) { if (m_textures.find(texture) == m_textures.end()) {
Texture tex; Texture tex;
if (!AssetManager::ptr->loadTexture(StringRepository::global->getString(texture), &tex)) { if (!AssetManager::ptr->loadTexture(StringRepository::global->getString(texture), &tex)) {
@ -236,6 +247,7 @@ void Renderer::addFontRect(float x,
float src_x1, float src_x1,
float src_y1) float src_y1)
{ {
ZoneScoped;
addFontRect(x, y, w, h, 0.f, 0.f, 0.f, 1.f, char_height, font, id, src_x0, src_y0, src_x1, src_y1); addFontRect(x, y, w, h, 0.f, 0.f, 0.f, 1.f, char_height, font, id, src_x0, src_y0, src_x1, src_y1);
} }
@ -255,6 +267,7 @@ void Renderer::addFontRect(float x,
float src_x1, float src_x1,
float src_y1) float src_y1)
{ {
ZoneScoped;
if (m_textures.find(id) == m_textures.end()) { if (m_textures.find(id) == m_textures.end()) {
Texture tex; Texture tex;
if (!AssetManager::ptr->loadFontBitmap(StringRepository::global->getString(font), char_height, &tex)) { if (!AssetManager::ptr->loadFontBitmap(StringRepository::global->getString(font), char_height, &tex)) {
@ -284,6 +297,7 @@ void Renderer::addFontRect(float x,
void Renderer::renderFrame(float width, float height) void Renderer::renderFrame(float width, float height)
{ {
ZoneScoped;
assert(m_rects.size() == m_draw_textures.size()); assert(m_rects.size() == m_draw_textures.size());
glViewport(0, 0, static_cast<int>(width), static_cast<int>(height)); glViewport(0, 0, static_cast<int>(width), static_cast<int>(height));
@ -348,6 +362,7 @@ void Renderer::renderFrame(float width, float height)
void Renderer::getTextureSize(StringHandle texture, unsigned int* w, unsigned int* h) void Renderer::getTextureSize(StringHandle texture, unsigned int* w, unsigned int* h)
{ {
ZoneScoped;
if (m_textures.find(texture) == m_textures.end()) { if (m_textures.find(texture) == m_textures.end()) {
Texture tex; Texture tex;
if (!AssetManager::ptr->loadTexture(StringRepository::global->getString(texture), &tex)) { if (!AssetManager::ptr->loadTexture(StringRepository::global->getString(texture), &tex)) {

View File

@ -1,4 +1,5 @@
#include "StringRepository.h" #include "StringRepository.h"
#include "Profiling.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -7,6 +8,7 @@ StringRepository* StringRepository::global = &g_global_repository;
static uint64_t hashString(const char* string, unsigned int length) static uint64_t hashString(const char* string, unsigned int length)
{ {
ZoneScoped;
uint64_t hash = 0xcbf29ce484222325; uint64_t hash = 0xcbf29ce484222325;
for (unsigned int i = 0; i < length; ++i) { for (unsigned int i = 0; i < length; ++i) {
hash = hash ^ string[i]; hash = hash ^ string[i];
@ -19,6 +21,7 @@ static uint64_t hashString(const char* string, unsigned int length)
StringRepository::StringRepository(const StringRepository& copy) StringRepository::StringRepository(const StringRepository& copy)
{ {
ZoneScoped;
if (m_buffer) if (m_buffer)
free(m_buffer); free(m_buffer);
m_one_past_last_char = copy.m_one_past_last_char; m_one_past_last_char = copy.m_one_past_last_char;
@ -30,6 +33,7 @@ StringRepository::StringRepository(const StringRepository& copy)
StringRepository::~StringRepository() StringRepository::~StringRepository()
{ {
ZoneScoped;
m_one_past_last_char = 0; m_one_past_last_char = 0;
m_buffer_size = 0; m_buffer_size = 0;
free(m_buffer); free(m_buffer);
@ -37,6 +41,7 @@ StringRepository::~StringRepository()
StringHandle StringRepository::internStringLength(const char* string, unsigned int length) StringHandle StringRepository::internStringLength(const char* string, unsigned int length)
{ {
ZoneScoped;
uint64_t hash = hashString(string, length); uint64_t hash = hashString(string, length);
uint32_t offset = static_cast<uint32_t>(m_hash.lookup(hash, UINT32_MAX)); uint32_t offset = static_cast<uint32_t>(m_hash.lookup(hash, UINT32_MAX));
if (offset == UINT32_MAX) { if (offset == UINT32_MAX) {
@ -61,11 +66,13 @@ StringHandle StringRepository::internStringLength(const char* string, unsigned i
StringHandle StringRepository::internString(const char* string) StringHandle StringRepository::internString(const char* string)
{ {
ZoneScoped;
return internStringLength(string, strlen(string)); return internStringLength(string, strlen(string));
} }
const char* StringRepository::getString(StringHandle handle) const char* StringRepository::getString(StringHandle handle)
{ {
ZoneScoped;
if (handle == 0 || handle >= m_one_past_last_char) if (handle == 0 || handle >= m_one_past_last_char)
return nullptr; return nullptr;
uint32_t offset = handle - 1; uint32_t offset = handle - 1;
@ -79,6 +86,7 @@ void StringRepository::releaseString(StringHandle)
void StringRepository::freeAll() void StringRepository::freeAll()
{ {
ZoneScoped;
m_one_past_last_char = 0; m_one_past_last_char = 0;
m_hash = Hash(); m_hash = Hash();
m_buffer_size = 0; m_buffer_size = 0;

View File

@ -1,7 +1,10 @@
#include "Texture.h" #include "Texture.h"
#include "Profiling.h"
Texture::Texture(unsigned int width, unsigned int height, const void* data) : m_texture(0) Texture::Texture(unsigned int width, unsigned int height, const void* data) : m_texture(0)
{ {
ZoneScoped;
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &m_texture); glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_2D, m_texture); glBindTexture(GL_TEXTURE_2D, m_texture);
@ -26,6 +29,8 @@ Texture::Texture(unsigned int width, unsigned int height, const void* data) : m_
Texture::Texture(unsigned int width, unsigned int height, const void* data, GLint format) : m_texture(0) Texture::Texture(unsigned int width, unsigned int height, const void* data, GLint format) : m_texture(0)
{ {
ZoneScoped;
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &m_texture); glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_2D, m_texture); glBindTexture(GL_TEXTURE_2D, m_texture);
@ -51,16 +56,19 @@ Texture::Texture(unsigned int width, unsigned int height, const void* data, GLin
void Texture::destroy() void Texture::destroy()
{ {
ZoneScoped;
glDeleteTextures(1, &m_texture); glDeleteTextures(1, &m_texture);
} }
void Texture::bind() const void Texture::bind() const
{ {
ZoneScoped;
glBindTexture(GL_TEXTURE_2D, m_texture); glBindTexture(GL_TEXTURE_2D, m_texture);
} }
void Texture::getTextureSize(unsigned int* w, unsigned int* h) void Texture::getTextureSize(unsigned int* w, unsigned int* h)
{ {
ZoneScoped;
if (w != nullptr) { if (w != nullptr) {
*w = width_px; *w = width_px;
} }

View File

@ -1,10 +1,12 @@
#include "Win32AssetManager.h" #include "Win32AssetManager.h"
#include "Profiling.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
void Win32AssetManager::create(const char* asset_root_dir) void Win32AssetManager::create(const char* asset_root_dir)
{ {
ZoneScoped;
static Win32AssetManager mgr; static Win32AssetManager mgr;
mgr.m_asset_root = asset_root_dir; mgr.m_asset_root = asset_root_dir;
AssetManager::ptr = &mgr; AssetManager::ptr = &mgr;
@ -12,6 +14,7 @@ void Win32AssetManager::create(const char* asset_root_dir)
bool Win32AssetManager::loadFile(const char* path, FileBuffer* p_file_buffer) bool Win32AssetManager::loadFile(const char* path, FileBuffer* p_file_buffer)
{ {
ZoneScoped;
// TODO(Kevin): We could totally optimize this via a custom allocator // TODO(Kevin): We could totally optimize this via a custom allocator
char _cp[MAX_PATH]; char _cp[MAX_PATH];
strncpy(_cp, m_asset_root, MAX_PATH); strncpy(_cp, m_asset_root, MAX_PATH);
@ -62,6 +65,7 @@ bool Win32AssetManager::loadFile(const char* path, FileBuffer* p_file_buffer)
void Win32AssetManager::releaseFileBuffer(FileBuffer& fb) void Win32AssetManager::releaseFileBuffer(FileBuffer& fb)
{ {
ZoneScoped;
void* data = const_cast<void*>(fb.data); void* data = const_cast<void*>(fb.data);
VirtualFree(data, 0, MEM_RELEASE); VirtualFree(data, 0, MEM_RELEASE);
fb.data = nullptr; fb.data = nullptr;
@ -70,6 +74,7 @@ void Win32AssetManager::releaseFileBuffer(FileBuffer& fb)
bool Win32AssetManager::writeFile(const char* path, const void* data, size_t size) bool Win32AssetManager::writeFile(const char* path, const void* data, size_t size)
{ {
ZoneScoped;
char _cp[MAX_PATH]; char _cp[MAX_PATH];
strncpy(_cp, m_asset_root, MAX_PATH); strncpy(_cp, m_asset_root, MAX_PATH);
strncat(_cp, "\\", MAX_PATH); strncat(_cp, "\\", MAX_PATH);
@ -104,5 +109,6 @@ bool Win32AssetManager::writeFile(const char* path, const void* data, size_t siz
bool Win32AssetManager::writeFile(const char* path, const FileBuffer& file_buffer) bool Win32AssetManager::writeFile(const char* path, const FileBuffer& file_buffer)
{ {
ZoneScoped;
return writeFile(path, file_buffer.data, file_buffer.size); return writeFile(path, file_buffer.data, file_buffer.size);
} }

View File

@ -7,6 +7,7 @@
#include "TouchInput.h" #include "TouchInput.h"
#include "Position.h" #include "Position.h"
#include "GameState.h" #include "GameState.h"
#include "Profiling.h"
#undef APIENTRY #undef APIENTRY
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -34,6 +35,8 @@ static void errorCallback(int error, const char* desc)
static void charCallback(GLFWwindow* window, unsigned int cp) static void charCallback(GLFWwindow* window, unsigned int cp)
{ {
ZoneScoped;
UserData* ud = reinterpret_cast<UserData*>(glfwGetWindowUserPointer(window)); UserData* ud = reinterpret_cast<UserData*>(glfwGetWindowUserPointer(window));
assert(ud != nullptr); assert(ud != nullptr);
if (ud->cp_array.count < ud->cp_array.cap) if (ud->cp_array.count < ud->cp_array.cap)
@ -42,6 +45,8 @@ static void charCallback(GLFWwindow* window, unsigned int cp)
static void scrollCallback(GLFWwindow* window, double /* xoffset */, double yoffset) static void scrollCallback(GLFWwindow* window, double /* xoffset */, double yoffset)
{ {
ZoneScoped;
UserData* ud = reinterpret_cast<UserData*>(glfwGetWindowUserPointer(window)); UserData* ud = reinterpret_cast<UserData*>(glfwGetWindowUserPointer(window));
assert(ud != nullptr); assert(ud != nullptr);
ud->scroll_offset = yoffset; ud->scroll_offset = yoffset;
@ -209,6 +214,7 @@ int main()
Renderer::ptr->renderFrame(static_cast<float>(w), static_cast<float>(h)); Renderer::ptr->renderFrame(static_cast<float>(w), static_cast<float>(h));
glfwSwapBuffers(window); glfwSwapBuffers(window);
FrameMark;
} }
glfwDestroyWindow(window); glfwDestroyWindow(window);