Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
554 changes: 279 additions & 275 deletions Lorr/Engine/Asset/Asset.cc

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions Lorr/Engine/Asset/Asset.hh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ struct AssetManager : Handle<AssetManager> {
auto get_scene(SceneID scene_id) -> Scene *;

auto set_material_dirty(MaterialID material_id) -> void;
auto get_materials_buffer() -> vuk::Value<vuk::Buffer>;
auto get_materials_descriptor_set() -> vuk::PersistentDescriptorSet *;
auto get_dirty_material_ids() -> std::vector<MaterialID>;
};
} // namespace lr
17 changes: 5 additions & 12 deletions Lorr/Engine/Asset/Model.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Engine/Asset/UUID.hh"

#include "Engine/Graphics/Vulkan.hh"
#include "Engine/Scene/GPUScene.hh"

namespace lr {
struct TextureSamplerInfo {
Expand Down Expand Up @@ -65,10 +66,7 @@ struct Model {
using Index = u32;

struct Primitive {
u32 material_index = 0;
u32 meshlet_count = 0;
u32 meshlet_offset = 0;
u32 local_triangle_indices_offset = 0;
MaterialID material_id = MaterialID::Invalid;
u32 vertex_count = 0;
u32 vertex_offset = 0;
u32 index_count = 0;
Expand Down Expand Up @@ -101,14 +99,9 @@ struct Model {
std::vector<Node> nodes = {};
std::vector<Scene> scenes = {};

usize default_scene_index = 0;
std::vector<GPU::Mesh> gpu_meshes = {};
std::vector<Buffer> gpu_mesh_buffers = {};

Buffer indices = {};
Buffer vertex_positions = {};
Buffer vertex_normals = {};
Buffer texture_coords = {};
Buffer meshlets = {};
Buffer meshlet_bounds = {};
Buffer local_triangle_indices = {};
usize default_scene_index = 0;
};
} // namespace lr
6 changes: 4 additions & 2 deletions Lorr/Engine/Core/JobManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ auto JobManager::worker(this JobManager &self, u32 id) -> void {
memory::ScopedStack stack;

this_thread_worker.id = id;
os::set_thread_name(stack.format("Worker {}", id));
fmtlog::setThreadName(stack.format_char("Worker {}", id));

const auto *thread_name = stack.format_char("Worker {}", id);
os::set_thread_name(thread_name);
fmtlog::setThreadName(thread_name);

LS_DEFER() {
this_thread_worker.id = ~0_u32;
Expand Down
5 changes: 3 additions & 2 deletions Lorr/Engine/Graphics/Slang/Compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ auto SlangCompiler::new_session(const SlangSessionInfo &info) -> ls::option<Slan
slang::CompilerOptionEntry entries[] = {
{ .name = slang::CompilerOptionName::Optimization, .value = { .kind = slang::CompilerOptionValueKind::Int, .intValue0 = SLANG_OPTIMIZATION_LEVEL_MAXIMAL } },
#if LS_DEBUG
{ .name = slang::CompilerOptionName::DebugInformationFormat, .value = { .kind = slang::CompilerOptionValueKind::Int, .intValue0 = SLANG_DEBUG_INFO_FORMAT_C7 } },
{ .name = slang::CompilerOptionName::DebugInformationFormat, .value = { .kind = slang::CompilerOptionValueKind::Int, .intValue0 = SLANG_DEBUG_INFO_FORMAT_DEFAULT } },
{ .name = slang::CompilerOptionName::DebugInformation, .value = { .kind = slang::CompilerOptionValueKind::Int, .intValue0 = SLANG_DEBUG_INFO_LEVEL_MAXIMAL } },
#endif
{ .name = slang::CompilerOptionName::UseUpToDateBinaryModule, .value = { .kind = slang::CompilerOptionValueKind::Int, .intValue0 = 1 } },
{ .name = slang::CompilerOptionName::GLSLForceScalarLayout, .value = { .kind = slang::CompilerOptionValueKind::Int, .intValue0 = 1 } },
Expand All @@ -343,7 +344,7 @@ auto SlangCompiler::new_session(const SlangSessionInfo &info) -> ls::option<Slan
{ .name = slang::CompilerOptionName::DisableWarning, .value = { .kind = slang::CompilerOptionValueKind::String, .stringValue0 = "41017" } },
{ .name = slang::CompilerOptionName::Capability, .value = { .kind = slang::CompilerOptionValueKind::String, .stringValue0 = "vk_mem_model" } },
{ .name = slang::CompilerOptionName::Capability, .value = { .kind = slang::CompilerOptionValueKind::String, .stringValue0 = "spvGroupNonUniformBallot" } },
{ .name = slang::CompilerOptionName::Capability, .value = { .kind = slang::CompilerOptionValueKind::String, .stringValue0 = "spvGroupNonUniformShuffle" } }
{ .name = slang::CompilerOptionName::Capability, .value = { .kind = slang::CompilerOptionValueKind::String, .stringValue0 = "spvGroupNonUniformShuffle" } },
// { .name = slang::CompilerOptionName::DumpIntermediates, .value = { .kind = slang::CompilerOptionValueKind::Int, .intValue0 = 1 } },
};
// clang-format on
Expand Down
6 changes: 5 additions & 1 deletion Lorr/Engine/Graphics/Vulkan.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ enum class PipelineID : u64 { Invalid = ~0_u64 };
struct Device;

struct Buffer {
static auto create(Device &, u64 size, vuk::MemoryUsage memory_usage = vuk::MemoryUsage::eGPUonly, LR_THISCALL)
[[nodiscard]] static auto create(Device &, u64 size, vuk::MemoryUsage memory_usage = vuk::MemoryUsage::eGPUonly, LR_THISCALL)
-> std::expected<Buffer, vuk::VkException>;

auto data_size() const -> u64;
auto device_address() const -> u64;
auto host_ptr() const -> u8 *;
auto id() const -> BufferID;

// if new_size is smaller than current size, this will do nothing
[[nodiscard]] auto resize(Device &, u64 new_size, vuk::MemoryUsage memory_usage = vuk::MemoryUsage::eGPUonly, LR_THISCALL)
-> std::expected<Buffer, vuk::VkException>;

auto acquire(Device &, vuk::Name name, vuk::Access access, u64 offset = 0, u64 size = ~0_u64) -> vuk::Value<vuk::Buffer>;
auto discard(Device &, vuk::Name name, u64 offset = 0, u64 size = ~0_u64) -> vuk::Value<vuk::Buffer>;
auto subrange(Device &, u64 offset = 0, u64 size = ~0_u64) -> vuk::Buffer;
Expand Down
13 changes: 13 additions & 0 deletions Lorr/Engine/Graphics/Vulkan/Buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ auto Buffer::id() const -> BufferID {
return id_;
}

auto Buffer::resize(Device &device, u64 new_size, vuk::MemoryUsage memory_usage, LR_CALLSTACK) -> std::expected<Buffer, vuk::VkException> {
if (new_size > this->data_size()) {
if (this->id() != BufferID::Invalid) {
device.wait();
device.destroy(this->id());
}

return Buffer::create(device, new_size, memory_usage, LOC);
}

return *this;
}

auto Buffer::acquire(Device &device, vuk::Name name, vuk::Access access, u64 offset, u64 size) -> vuk::Value<vuk::Buffer> {
ZoneScoped;

Expand Down
Loading
Loading