Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e848a5e
lock when updating bindless set
exdal May 13, 2025
554e405
fix aerial perspective
exdal May 16, 2025
e6fe70c
bring back blending
exdal May 16, 2025
14494b7
overall bugfixing and thread sanitization
exdal May 19, 2025
9ea83e7
assetman: fix model asset refcounting
exdal May 20, 2025
bb6217c
material improvements
exdal May 21, 2025
97fca3b
add FFX core
exdal May 22, 2025
6418e3a
add HiZ SPD
exdal May 25, 2025
488cee9
rewriting scene renderer
exdal Jun 14, 2025
ed00b7c
fix observers
exdal Jun 20, 2025
cd9876b
occlusion culling
exdal Jul 17, 2025
c88b432
clear some shaders
exdal Jul 17, 2025
f0d1de8
BFS transform updating
exdal Jul 18, 2025
bc85ca6
fix windows fmtlog linker error
exdal Jul 18, 2025
6d56e13
fix racing frame allocator
exdal Jul 18, 2025
12d807c
use UASTC for KTX2
exdal Jul 18, 2025
c28e940
bump LLVM
exdal Jul 19, 2025
a4a307f
make fmtlog static
exdal Jul 19, 2025
1e22a58
bump imgui
exdal Jul 19, 2025
8bc413a
fix imgui font rendering
exdal Jul 20, 2025
626dc9d
destroy imgui on quit
exdal Jul 20, 2025
128fc0c
fix imgui assert
exdal Jul 20, 2025
72f271e
add non uniform shuffle capability
exdal Jul 20, 2025
cadb7ab
use correct alignment for transient buffers
exdal Jul 20, 2025
6adfb51
decrease meshlet visibility mask by one bit
exdal Jul 20, 2025
fdef9f3
fix material descriptor read before write VVL
exdal Jul 20, 2025
37602e4
fix hiz sync error
exdal Jul 20, 2025
fc5bc5d
Merge branch 'dev' of https://github.com/exdal/Lorr into dev
exdal Jul 20, 2025
6068a58
use super frame allocator
exdal Jul 21, 2025
db93da6
investigate fmtlog build
exdal Jul 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:
branches: [ master ]

env:
VULKAN_VERSION: 1.3.261.1
LLVM_VERSION: 19
LLVM_VERSION: 20

jobs:
build:
Expand All @@ -19,7 +18,7 @@ jobs:
platform:
- { runner: windows-latest, os: windows, arch: x64, toolchain: msvc, runtime: MT }
- { runner: windows-latest, os: windows, arch: x64, toolchain: clang-cl, runtime: MT }
- { runner: ubuntu-latest, os: linux, arch: x86_64, toolchain: clang-19, runtime: c++_static }
- { runner: ubuntu-latest, os: linux, arch: x86_64, toolchain: clang-20, runtime: c++_static }
- { runner: ubuntu-latest, os: linux, arch: x86_64, toolchain: gcc-14, runtime: stdc++_static }
mode: [ debug, release ]

Expand Down Expand Up @@ -80,7 +79,7 @@ jobs:
key: ${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ matrix.mode }}-${{ matrix.platform.runtime }}-${{ matrix.platform.toolchain }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}

- name: Configure xmake and install dependencies
run: xmake config -v --toolchain=${{ matrix.platform.toolchain }} --arch=${{ matrix.platform.arch }} --mode=${{ matrix.mode }} --runtimes=${{ matrix.platform.runtime }} --yes --policies=package.precompiled:n
run: xmake config -vD --toolchain=${{ matrix.platform.toolchain }} --arch=${{ matrix.platform.arch }} --mode=${{ matrix.mode }} --runtimes=${{ matrix.platform.runtime }} --yes --policies=package.precompiled:n

# Save dependencies
- name: Save cached xmake dependencies
Expand Down
24 changes: 14 additions & 10 deletions Lorr/Editor/EditorApp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "Editor/Themes.hh"

#include "Engine/Memory/Stack.hh"
#include "Engine/OS/File.hh"
#include "Engine/Util/JsonWriter.hh"

Expand All @@ -31,7 +32,7 @@ static auto read_project_file(const fs::path &path) -> ls::option<ProjectFileInf
sj::ondemand::parser parser;
auto doc = parser.iterate(json);
if (doc.error()) {
lr::LOG_ERROR("Failed to parse project file! {}", sj::error_message(doc.error()));
LOG_ERROR("Failed to parse project file! {}", sj::error_message(doc.error()));
return ls::nullopt;
}

Expand Down Expand Up @@ -64,7 +65,7 @@ auto EditorApp::load_editor_data(this EditorApp &self) -> void {
sj::ondemand::parser parser;
auto doc = parser.iterate(json);
if (doc.error()) {
lr::LOG_ERROR("Failed to parse editor data file! {}", sj::error_message(doc.error()));
LOG_ERROR("Failed to parse editor data file! {}", sj::error_message(doc.error()));
return;
}

Expand All @@ -77,7 +78,7 @@ auto EditorApp::load_editor_data(this EditorApp &self) -> void {

auto project_info = read_project_file(project_path.value_unsafe());
if (!project_info) {
lr::LOG_ERROR("Failed to read project information for {}!", project_path.value_unsafe());
LOG_ERROR("Failed to read project information for {}!", project_path.value_unsafe());
continue;
}

Expand Down Expand Up @@ -110,7 +111,7 @@ auto EditorApp::new_project(this EditorApp &self, const fs::path &root_path, con
ZoneScoped;

if (!fs::is_directory(root_path)) {
lr::LOG_ERROR("New projects must be inside a directory.");
LOG_ERROR("New projects must be inside a directory.");
return nullptr;
}

Expand All @@ -136,7 +137,7 @@ auto EditorApp::new_project(this EditorApp &self, const fs::path &root_path, con
std::error_code err;
fs::create_directories(proj_root_path, err);
if (err) {
lr::LOG_ERROR("Failed to create directory '{}'! {}", proj_root_path, err.message());
LOG_ERROR("Failed to create directory '{}'! {}", proj_root_path, err.message());
return nullptr;
}

Expand All @@ -162,7 +163,7 @@ auto EditorApp::new_project(this EditorApp &self, const fs::path &root_path, con

lr::File file(proj_file_path, lr::FileAccess::Write);
if (!file) {
lr::LOG_ERROR("Failed to open file {}!", proj_file_path);
LOG_ERROR("Failed to open file {}!", proj_file_path);
return nullptr;
}

Expand Down Expand Up @@ -327,6 +328,7 @@ static auto draw_menu_bar(EditorApp &self) -> void {
if (ImGui::BeginMenu("View")) {
if (ImGui::MenuItem("Frame Profiler")) {
self.show_profiler = !self.show_profiler;
self.frame_profiler.reset();
}

ImGui::EndMenu();
Expand Down Expand Up @@ -360,6 +362,8 @@ static auto draw_welcome_popup(EditorApp &self) -> void {
auto project = self.open_project(project_path);
ImGui::CloseCurrentPopup();
self.set_active_project(std::move(project));
ImGui::PopID();
break;
}
ImGui::SetItemTooltip("%s", path_str);
ImGui::PopID();
Expand Down Expand Up @@ -478,10 +482,6 @@ static auto draw_profiler(EditorApp &self) -> void {

ImPlot::EndPlot();
}

if (ImGui::Button("Reset")) {
self.frame_profiler.reset();
}
}

ImGui::End();
Expand Down Expand Up @@ -544,6 +544,10 @@ auto EditorApp::render(this EditorApp &self, vuk::Format format, vuk::Extent3D e
auto EditorApp::shutdown(this EditorApp &self) -> void {
ZoneScoped;

for (const auto &[name, uuid] : self.editor_assets) {
self.asset_man.unload_asset(uuid);
}

self.windows.clear();
self.active_project.reset();
}
Expand Down
3 changes: 2 additions & 1 deletion Lorr/Editor/EditorApp.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct EditorApp : lr::Application {
lr::FrameProfiler frame_profiler = {};

bool show_profiler = false;
bool show_debug = false;

auto load_editor_data(this EditorApp &) -> void;
auto save_editor_data(this EditorApp &) -> void;
Expand Down Expand Up @@ -60,7 +61,7 @@ struct EditorApp : lr::Application {

auto do_super_init([[maybe_unused]] ls::span<c8 *> args) -> bool override {
return true;
};
}
auto do_shutdown() -> void override {
shutdown();
}
Expand Down
19 changes: 14 additions & 5 deletions Lorr/Editor/Project.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,29 @@
namespace led {
Project::Project(fs::path root_path_, const ProjectFileInfo &info_) : root_dir(std::move(root_path_)), name(info_.name) {}
Project::Project(fs::path root_path_, std::string name_) : root_dir(std::move(root_path_)), name(std::move(name_)) {}
Project::~Project() = default;

auto Project::set_active_scene(this Project &self, const lr::UUID &scene_uuid) -> bool {
Project::~Project() {
ZoneScoped;

auto &app = EditorApp::get();
if (!app.asset_man.load_scene(scene_uuid)) {
return false;
if (active_scene_uuid && app.asset_man.get_asset(active_scene_uuid)) {
app.asset_man.unload_scene(active_scene_uuid);
}

app.scene_renderer.cleanup();
}

auto Project::set_active_scene(this Project &self, const lr::UUID &scene_uuid) -> bool {
ZoneScoped;

auto &app = EditorApp::get();
if (self.active_scene_uuid) {
app.asset_man.unload_scene(self.active_scene_uuid);
}

if (!app.asset_man.load_scene(scene_uuid)) {
return false;
}

app.scene_renderer.cleanup();
self.selected_entity = {};
self.active_scene_uuid = scene_uuid;
Expand Down
2 changes: 1 addition & 1 deletion Lorr/Editor/Themes/Dark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ auto Theme::dark() -> void {

style.WindowPadding = ImVec2(4.0f, 4.0f);
style.FramePadding = ImVec2(4.0f, 4.0f);
style.TabMinWidthForCloseButton = 0.1f;
style.TabCloseButtonMinWidthSelected = 0.1f;
style.CellPadding = ImVec2(8.0f, 4.0f);
style.ItemSpacing = ImVec2(8.0f, 3.0f);
style.ItemInnerSpacing = ImVec2(2.0f, 4.0f);
Expand Down
4 changes: 2 additions & 2 deletions Lorr/Editor/Themes/DarkGray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ auto Theme::dark_gray() -> void {

style.WindowPadding = ImVec2(4.0f, 4.0f);
style.FramePadding = ImVec2(4.0f, 4.0f);
style.TabMinWidthForCloseButton = 0.1f;
style.TabCloseButtonMinWidthSelected = 0.1f;
style.CellPadding = ImVec2(8.0f, 4.0f);
style.ItemSpacing = ImVec2(8.0f, 3.0f);
style.ItemInnerSpacing = ImVec2(2.0f, 4.0f);
Expand All @@ -92,4 +92,4 @@ auto Theme::dark_gray() -> void {
style.ScrollbarSize = 14;
style.GrabMinSize = 10;
}
}
} // namespace led
95 changes: 58 additions & 37 deletions Lorr/Editor/Window/ConsoleWindow.cc
Original file line number Diff line number Diff line change
@@ -1,52 +1,73 @@
#include "Editor/Window/ConsoleWindow.hh"

// #include "Engine/Core/Application.hh"
#include "Engine/Util/Icons/IconsMaterialDesignIcons.hh"

namespace led {
// void log_cb(void *user_Data, const loguru::Message &message) {
// auto *console = static_cast<ConsoleWindow *>(user_Data);
// auto &m = console->messages.emplace_back();
// m.verbosity = message.verbosity;
// m.message = fmt::format("{}", message.message);
// }

static auto log_messages = std::vector<ls::pair<std::string, fmtlog::LogLevel>>{};

void log_cb(
[[maybe_unused]] i64 ns,
[[maybe_unused]] fmtlog::LogLevel level,
[[maybe_unused]] fmt::string_view location,
[[maybe_unused]] usize basePos,
[[maybe_unused]] fmt::string_view threadName,
[[maybe_unused]] fmt::string_view msg,
[[maybe_unused]] usize bodyPos,
[[maybe_unused]] usize logFilePos
) {
ZoneScoped;

fmt::println("{}", msg);
msg.remove_prefix(bodyPos);
log_messages.emplace_back(std::string(msg.begin(), msg.end()), level);
}

ConsoleWindow::ConsoleWindow(std::string name_, bool open_) : IWindow(std::move(name_), open_) {
// loguru::add_callback("editor", log_cb, this, loguru::Verbosity_MAX);
ZoneScoped;

// acquire log cb
fmtlog::setLogCB(log_cb, fmtlog::DBG);
}

void ConsoleWindow::render(this ConsoleWindow &self) {
// auto &app = Application::get();
// auto &render_pipeline = app.world_render_pipeline;
auto ConsoleWindow::render(this ConsoleWindow &self) -> void {
ZoneScoped;

if (ImGui::Begin(self.name.data())) {
ImGuiListClipper clipper;
clipper.Begin(static_cast<i32>(self.messages.size()));
while (clipper.Step()) {
for (i32 line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++) {
auto &m = self.messages[line_no];

// ImGui::PushFont(render_pipeline.im_fa_big);
// switch (m.verbosity) {
// case loguru::Verbosity_WARNING:
// ImGui::TextColored(ImVec4(1.0, 1.0, 0.0, 1.0), Icon::fa::triangle_exclamation);
// break;
// case loguru::Verbosity_ERROR:
// case loguru::Verbosity_FATAL:
// ImGui::TextColored(ImVec4(0.90234375f, 0.296875f, 0.234375f, 1.0), Icon::fa::circle_exclamation);
// break;
// default:
// ImGui::TextUnformatted(Icon::fa::circle_info);
// break;
// }
//
// ImGui::PopFont();

ImGui::SameLine();
ImGui::TextUnformatted(m.message.c_str());
ImGui::Separator();
for (const auto &[message, verbosity] : log_messages) {
auto color = IM_COL32(255, 255, 255, 255);

switch (verbosity) {
case fmtlog::DBG: {
color = IM_COL32(155, 155, 155, 255);
ImGui::Text(" %s |", ICON_MDI_BUG);
} break;
case fmtlog::INF: {
color = IM_COL32(0, 255, 0, 255);
ImGui::Text(" %s |", ICON_MDI_INFORMATION_VARIANT_CIRCLE);
} break;
case fmtlog::WRN: {
color = IM_COL32(255, 255, 0, 255);
ImGui::Text(" %s |", ICON_MDI_ALERT);
} break;
case fmtlog::ERR: {
color = IM_COL32(255, 0, 0, 255);
ImGui::Text(" %s |", ICON_MDI_ALERT_OCTAGON);
} break;
default:
ImGui::Text(" ");
break;
}

auto rect_min = ImGui::GetItemRectMin();
auto spacing = ImGui::GetStyle().FramePadding.x / 2.0f;
auto *draw_list = ImGui::GetWindowDrawList();
auto rect_max = ImGui::GetItemRectMax();
draw_list->AddLine({ rect_min.x + spacing, rect_min.y }, { rect_min.x + spacing, rect_max.y }, color, 4);

ImGui::SameLine();
ImGui::TextUnformatted(message.c_str());
}
clipper.End();

if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) {
ImGui::SetScrollHereY(1.0f);
Expand Down
7 changes: 0 additions & 7 deletions Lorr/Editor/Window/ConsoleWindow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@

namespace led {
struct ConsoleWindow : IWindow {
struct Message {
u32 verbosity = {};
std::string message = {};
};

std::vector<Message> messages = {};

ConsoleWindow(std::string name_, bool open_ = true);

void render(this ConsoleWindow &);
Expand Down
15 changes: 13 additions & 2 deletions Lorr/Editor/Window/InspectorWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Editor/EditorApp.hh"

#include "Engine/Memory/Stack.hh"
#include "Engine/Scene/ECSModule/ComponentWrapper.hh"
#include "Engine/Util/Icons/IconsMaterialDesignIcons.hh"

Expand Down Expand Up @@ -74,7 +75,7 @@ static auto draw_inspector(InspectorWindow &) -> void {
}

lr::ECS::ComponentWrapper component(selected_entity, component_id);
if (!component.has_component()) {
if (!component.is_component()) {
return;
}

Expand Down Expand Up @@ -159,7 +160,17 @@ static auto draw_inspector(InspectorWindow &) -> void {

ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal);

for (const auto &v : removing_components) {
for (auto &v : removing_components) {
auto component = lr::ECS::ComponentWrapper(selected_entity, v);
component.for_each([&](usize &, std::string_view, lr::ECS::ComponentWrapper::Member &member) {
if (auto *component_uuid = std::get_if<lr::UUID *>(&member)) {
const auto &uuid = **component_uuid;
if (uuid) {
app.asset_man.unload_asset(uuid);
}
}
});

selected_entity.remove(v);
}
removing_components.clear();
Expand Down
4 changes: 4 additions & 0 deletions Lorr/Editor/Window/SceneBrowserWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ static auto draw_children(SceneBrowserWindow &self, flecs::entity root) -> void
child_entity.child_of(e);
}

if (ImGui::MenuItem("Delete")) {
active_scene->delete_entity(e);
}

ImGui::EndPopup();
}

Expand Down
Loading
Loading