diff --git a/Editor/Source/ApplicationInfoPanel.cpp b/Editor/Source/ApplicationInfoPanel.cpp index c3aa5d48..348585b8 100644 --- a/Editor/Source/ApplicationInfoPanel.cpp +++ b/Editor/Source/ApplicationInfoPanel.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -135,6 +136,7 @@ namespace Lumos ImGui::Text("FPS : %5.2i", Engine::Get().Statistics().FramesPerSecond); ImGui::Text("UPS : %5.2i", Engine::Get().Statistics().UpdatesPerSecond); ImGui::Text("Frame Time : %5.2f ms", Engine::Get().Statistics().FrameTime); + ImGui::Text("Arena Count : %i", GetArenaCount()); ImGui::NewLine(); ImGui::Text("Scene : %s", Application::Get().GetSceneManager()->GetCurrentScene()->GetSceneName().c_str()); ImGui::TreePop(); diff --git a/Editor/Source/Editor.cpp b/Editor/Source/Editor.cpp index 6fcaef74..051b1337 100644 --- a/Editor/Source/Editor.cpp +++ b/Editor/Source/Editor.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ #include #include #include +#include #include #include @@ -63,6 +65,14 @@ #include #include +#include +#include +#include +#include +#include +#include +#include + namespace Lumos { Editor* Editor::s_Editor = nullptr; @@ -71,9 +81,11 @@ namespace Lumos : Application() , m_IniFile("") { +#if LUMOS_ENABLE_LOG spdlog::sink_ptr sink = std::make_shared(); Lumos::Debug::Log::AddSink(sink); +#endif // Remove? s_Editor = this; @@ -700,7 +712,7 @@ namespace Lumos { auto scenes = Application::Get().GetSceneManager()->GetSceneNames(); - for(size_t i = 0; i < scenes.size(); i++) + for(size_t i = 0; i < scenes.Size(); i++) { auto name = scenes[i]; if(ImGui::MenuItem(name.c_str())) @@ -780,7 +792,7 @@ namespace Lumos if(ImGui::MenuItem("Embed Shaders")) { std::string coreDataPath; - VFS::Get().ResolvePhysicalPath("//CoreShaders", coreDataPath, true); + FileSystem::Get().ResolvePhysicalPath("//CoreShaders", coreDataPath, true); auto shaderPath = std::filesystem::path(coreDataPath + "/CompiledSPV/"); int shaderCount = 0; if(std::filesystem::is_directory(shaderPath)) @@ -871,14 +883,18 @@ namespace Lumos ImGui::SameLine(); ImGui::TextUnformatted(m_ProjectSettings.m_ProjectName.c_str()); - ImGuiUtilities::Tooltip(("Current project (" + m_ProjectSettings.m_ProjectName + ".lmproj)").c_str()); + String8 projectString = PushStr8F(GetFrameArena(), "Current project ( %s.lmproj )", m_ProjectSettings.m_ProjectName.c_str()); + + ImGuiUtilities::Tooltip((const char*)projectString.str); ImGuiUtilities::DrawBorder(ImGuiUtilities::RectExpanded(ImGuiUtilities::GetItemRect(), 24.0f, 68.0f), 1.0f, 3.0f, 0.0f, -60.0f); ImGui::SameLine(); ImGui::Separator(); ImGui::SameLine(ImGui::GetCursorPosX() + 32.0f); ImGui::TextUnformatted(GetCurrentScene()->GetSceneName().c_str()); - ImGuiUtilities::Tooltip(("Current Scene (" + GetCurrentScene()->GetSceneName() + ".lsn)").c_str()); + String8 sceneString = PushStr8F(GetFrameArena(), "Current Scene ( %s.lsn )", GetCurrentScene()->GetSceneName().c_str()); + + ImGuiUtilities::Tooltip((const char*)sceneString.str); ImGuiUtilities::DrawBorder(ImGuiUtilities::RectExpanded(ImGuiUtilities::GetItemRect(), 24.0f, 68.0f), 1.0f, 3.0f, 0.0f, -60.0f); } @@ -1145,7 +1161,7 @@ namespace Lumos int sameNameCount = 0; auto sceneNames = m_SceneManager->GetSceneNames(); - while(FileSystem::FileExists("//Scenes/" + sceneName + ".lsn") || std::find(sceneNames.begin(), sceneNames.end(), sceneName) != sceneNames.end()) + while(FileSystem::FileExists("//Assets/Scenes/" + sceneName + ".lsn") || m_SceneManager->ContainsScene(sceneName)) { sameNameCount++; sceneName = fmt::format(newSceneName + "{0}", sameNameCount); @@ -1175,7 +1191,7 @@ namespace Lumos scene->Serialise(m_ProjectSettings.m_ProjectRoot + "Assets/Scenes/"); } Application::Get().GetSceneManager()->EnqueueScene(scene); - Application::Get().GetSceneManager()->SwitchScene((int)(Application::Get().GetSceneManager()->GetScenes().size()) - 1); + Application::Get().GetSceneManager()->SwitchScene((int)(Application::Get().GetSceneManager()->GetScenes().Size()) - 1); ImGui::CloseCurrentPopup(); } @@ -1685,9 +1701,9 @@ namespace Lumos #ifdef LUMOS_PLATFORM_WINDOWS Platform = "Windows"; #elif LUMOS_PLATFORM_LINUX - Platform = "Linux"; + Platform = "Linux"; #elif LUMOS_PLATFORM_MACOS - Platform = "MacOS"; + Platform = "MacOS"; #elif LUMOS_PLATFORM_IOS Platform = "iOS"; #endif @@ -2394,7 +2410,7 @@ namespace Lumos { LUMOS_PROFILE_FUNCTION(); std::string physicalPath; - if(!VFS::Get().ResolvePhysicalPath(filePath, physicalPath)) + if(!FileSystem::Get().ResolvePhysicalPath(filePath, physicalPath)) { LUMOS_LOG_ERROR("Failed to Load Lua script {0}", filePath); return; @@ -2533,7 +2549,7 @@ namespace Lumos else if(IsAudioFile(path)) { std::string physicalPath; - Lumos::VFS::Get().ResolvePhysicalPath(path, physicalPath); + Lumos::FileSystem::Get().ResolvePhysicalPath(path, physicalPath); auto sound = Sound::Create(physicalPath, StringUtilities::GetFilePathExtension(path)); auto soundNode = SharedPtr(SoundNode::Create()); @@ -2656,6 +2672,7 @@ namespace Lumos void Editor::AddDefaultEditorSettings() { LUMOS_PROFILE_FUNCTION(); + LUMOS_LOG_INFO("Setting default editor settings"); m_ProjectSettings.m_ProjectRoot = "../../ExampleProject/"; m_ProjectSettings.m_ProjectName = "Example"; @@ -2786,7 +2803,7 @@ namespace Lumos else { std::string physicalPath; - if(Lumos::VFS::Get().ResolvePhysicalPath("//Scenes/" + Application::Get().GetCurrentScene()->GetSceneName() + ".lsn", physicalPath)) + if(Lumos::FileSystem::Get().ResolvePhysicalPath("//Assets/Scenes/" + Application::Get().GetCurrentScene()->GetSceneName() + ".lsn", physicalPath)) { auto newPath = StringUtilities::RemoveName(physicalPath); Application::Get().GetCurrentScene()->Deserialise(newPath, false); diff --git a/Editor/Source/HierarchyPanel.cpp b/Editor/Source/HierarchyPanel.cpp index 46cc9386..ee68af81 100644 --- a/Editor/Source/HierarchyPanel.cpp +++ b/Editor/Source/HierarchyPanel.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -28,13 +29,19 @@ namespace Lumos : m_HadRecentDroppedEntity(entt::null) , m_DoubleClicked(entt::null) { - m_Name = "Hierarchy###hierarchy"; - m_SimpleName = "Hierarchy"; + m_Name = "Hierarchy###hierarchy"; + m_SimpleName = "Hierarchy"; + m_StringArena = ArenaAlloc(Megabytes(1)); + } + + HierarchyPanel::~HierarchyPanel() + { + ArenaRelease(m_StringArena); } void HierarchyPanel::DrawNode(entt::entity node, entt::registry& registry) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); bool show = true; if(!registry.valid(node)) @@ -44,11 +51,11 @@ namespace Lumos static const char* defaultName = "Entity"; const NameComponent* nameComponent = registry.try_get(node); - const char* name = nameComponent ? nameComponent->name.c_str() : defaultName; // StringUtilities::ToString(entt::to_integral(node)); + String8 name = PushStr8Copy(m_StringArena, nameComponent ? nameComponent->name.c_str() : defaultName); // StringUtilities::ToString(entt::to_integral(node)); if(m_HierarchyFilter.IsActive()) { - if(!m_HierarchyFilter.PassFilter(name)) + if(!m_HierarchyFilter.PassFilter((const char*)name.str)) { show = false; } @@ -93,53 +100,53 @@ namespace Lumos m_HadRecentDroppedEntity = entt::null; } - std::string icon = ICON_MDI_CUBE_OUTLINE; - auto& iconMap = m_Editor->GetComponentIconMap(); + String8 icon = Str8C((char*)ICON_MDI_CUBE_OUTLINE); + auto& iconMap = m_Editor->GetComponentIconMap(); if(registry.all_of(node)) { if(iconMap.find(typeid(Camera).hash_code()) != iconMap.end()) - icon = iconMap[typeid(Camera).hash_code()]; + icon = Str8C((char*)iconMap[typeid(Camera).hash_code()]); } if(registry.all_of(node)) { if(iconMap.find(typeid(LuaScriptComponent).hash_code()) != iconMap.end()) - icon = iconMap[typeid(LuaScriptComponent).hash_code()]; + icon = Str8C((char*)iconMap[typeid(LuaScriptComponent).hash_code()]); } else if(registry.all_of(node)) { if(iconMap.find(typeid(SoundComponent).hash_code()) != iconMap.end()) - icon = iconMap[typeid(SoundComponent).hash_code()]; + icon = Str8C((char*)iconMap[typeid(SoundComponent).hash_code()]); } else if(registry.all_of(node)) { if(iconMap.find(typeid(RigidBody2DComponent).hash_code()) != iconMap.end()) - icon = iconMap[typeid(RigidBody2DComponent).hash_code()]; + icon = Str8C((char*)iconMap[typeid(RigidBody2DComponent).hash_code()]); } else if(registry.all_of(node)) { if(iconMap.find(typeid(Graphics::Light).hash_code()) != iconMap.end()) - icon = iconMap[typeid(Graphics::Light).hash_code()]; + icon = Str8C((char*)iconMap[typeid(Graphics::Light).hash_code()]); } else if(registry.all_of(node)) { if(iconMap.find(typeid(Graphics::Environment).hash_code()) != iconMap.end()) - icon = iconMap[typeid(Graphics::Environment).hash_code()]; + icon = Str8C((char*)iconMap[typeid(Graphics::Environment).hash_code()]); } else if(registry.all_of(node)) { if(iconMap.find(typeid(Graphics::Sprite).hash_code()) != iconMap.end()) - icon = iconMap[typeid(Graphics::Sprite).hash_code()]; + icon = Str8C((char*)iconMap[typeid(Graphics::Sprite).hash_code()]); } else if(registry.all_of(node)) { if(iconMap.find(typeid(TextComponent).hash_code()) != iconMap.end()) - icon = iconMap[typeid(TextComponent).hash_code()]; + icon = Str8C((char*)iconMap[typeid(TextComponent).hash_code()]); } ImGui::PushStyleColor(ImGuiCol_Text, ImGuiUtilities::GetIconColour()); // ImGui::BeginGroup(); - bool nodeOpen = ImGui::TreeNodeEx((void*)(intptr_t)entt::to_integral(node), nodeFlags, "%s", icon.c_str()); + bool nodeOpen = ImGui::TreeNodeEx((void*)(intptr_t)entt::to_integral(node), nodeFlags, "%s", (const char*)icon.str); { // Allow clicking of icon and text. Need twice as they are separated if(ImGui::IsItemClicked(ImGuiMouseButton_Left) && !ImGui::IsItemToggledOpen()) @@ -182,7 +189,7 @@ namespace Lumos if(isPrefab) ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_CheckMark)); - ImGui::TextUnformatted(name); + ImGui::TextUnformatted((const char*)name.str); if(isPrefab) ImGui::PopStyleColor(); } @@ -190,11 +197,15 @@ namespace Lumos if(doubleClicked) { - static char objName[INPUT_BUF_SIZE]; - strcpy(objName, name); + String8 nameBuffer = { 0 }; + nameBuffer.str = PushArray(m_StringArena, uint8_t, INPUT_BUF_SIZE); + nameBuffer.size = INPUT_BUF_SIZE; + + MemoryCopy(nameBuffer.str, name.str, name.size); + ImGui::PushItemWidth(-1); - if(ImGui::InputText("##Name", objName, IM_ARRAYSIZE(objName), 0)) - registry.get_or_emplace(node).name = objName; + if(ImGui::InputText("##Name", (char*)nameBuffer.str, INPUT_BUF_SIZE, 0)) + registry.get_or_emplace(node).name = (const char*)nameBuffer.str; ImGui::PopStyleVar(); } @@ -202,7 +213,7 @@ namespace Lumos ImGui::PopStyleColor(); bool deleteEntity = false; - if(ImGui::BeginPopupContextItem(name)) + if(ImGui::BeginPopupContextItem((const char*)name.str)) { if(ImGui::Selectable("Copy")) { @@ -497,7 +508,9 @@ namespace Lumos m_SelectUp = Input::Get().GetKeyPressed(Lumos::InputCode::Key::Up); m_SelectDown = Input::Get().GetKeyPressed(Lumos::InputCode::Key::Down); - ImGui::Begin(m_Name.c_str(), &m_Active, flags); + ArenaClear(m_StringArena); + + if(ImGui::Begin(m_Name.c_str(), &m_Active, flags)) { auto scene = Application::Get().GetSceneManager()->GetCurrentScene(); diff --git a/Editor/Source/HierarchyPanel.h b/Editor/Source/HierarchyPanel.h index 47b6c01d..de642d30 100644 --- a/Editor/Source/HierarchyPanel.h +++ b/Editor/Source/HierarchyPanel.h @@ -1,7 +1,7 @@ #pragma once #include "EditorPanel.h" - +#include "Core/OS/Memory.h" #include #include @@ -11,7 +11,7 @@ namespace Lumos { public: HierarchyPanel(); - ~HierarchyPanel() = default; + ~HierarchyPanel(); void DrawNode(entt::entity node, entt::registry& registry); void OnImGui() override; @@ -26,5 +26,7 @@ namespace Lumos entt::entity m_CurrentPrevious; bool m_SelectUp; bool m_SelectDown; + + Arena* m_StringArena; }; } diff --git a/Editor/Source/InspectorPanel.cpp b/Editor/Source/InspectorPanel.cpp index df1c5988..c1003f6a 100644 --- a/Editor/Source/InspectorPanel.cpp +++ b/Editor/Source/InspectorPanel.cpp @@ -43,6 +43,8 @@ #include #include +#include +#include namespace MM { @@ -78,9 +80,9 @@ namespace MM if(ImGui::Button("New File", ImVec2(ImGui::GetContentRegionAvail().x, 0.0f))) { - std::string newFilePath = "//Scripts"; + std::string newFilePath = "//Assets/Scripts"; std::string physicalPath; - if(!Lumos::VFS::Get().ResolvePhysicalPath(newFilePath, physicalPath, true)) + if(!Lumos::FileSystem::Get().ResolvePhysicalPath(newFilePath, physicalPath, true)) { LUMOS_LOG_ERROR("Failed to Create Lua script {0}", physicalPath); } @@ -740,7 +742,7 @@ end if(ImGui::AcceptDragDropPayload("AssetFile")) { std::string physicalPath; - Lumos::VFS::Get().ResolvePhysicalPath(filePath, physicalPath); + Lumos::FileSystem::Get().ResolvePhysicalPath(filePath, physicalPath); auto newSound = Lumos::Sound::Create(physicalPath, Lumos::StringUtilities::GetFilePathExtension(filePath)); soundNode->SetSound(newSound); @@ -2000,9 +2002,9 @@ end ImGui::Indent(); if(ImGui::Button("Save to file")) { - std::string filePath = "//Meshes"; // Materials/" + matName + ".lmat"; + std::string filePath = "//Assets/Meshes"; // Materials/" + matName + ".lmat"; std::string physicalPath; - if(VFS::Get().ResolvePhysicalPath(filePath, physicalPath)) + if(FileSystem::Get().ResolvePhysicalPath(filePath, physicalPath)) { physicalPath += "/Materials/" + matName + ".lmat"; std::stringstream storage; @@ -2501,7 +2503,7 @@ namespace Lumos if(ImGui::Button("OK", ImVec2(120, 0))) { std::string physicalPath; - VFS::Get().ResolvePhysicalPath(prefabNamePath, physicalPath, true); + FileSystem::Get().ResolvePhysicalPath(prefabNamePath, physicalPath, true); std::string FullPath = physicalPath + prefabName + std::string(".lprefab"); Application::Get().GetSceneManager()->GetCurrentScene()->SavePrefab({ selected, Application::Get().GetSceneManager()->GetCurrentScene() }, FullPath); ImGui::CloseCurrentPopup(); diff --git a/Editor/Source/ResourcePanel.cpp b/Editor/Source/ResourcePanel.cpp index 1ae70d37..1ce35ad3 100644 --- a/Editor/Source/ResourcePanel.cpp +++ b/Editor/Source/ResourcePanel.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -13,6 +12,7 @@ #include #include #include +#include #ifdef LUMOS_PLATFORM_WINDOWS #include @@ -24,48 +24,45 @@ namespace Lumos { - static const std::unordered_map s_FileTypesToString = { - { FileType::Unknown, "Unknown" }, - { FileType::Scene, "Scene" }, - { FileType::Prefab, "Prefab" }, - { FileType::Script, "Script" }, - { FileType::Shader, "Shader" }, - { FileType::Texture, "Texture" }, - { FileType::Font, "Font" }, - { FileType::Cubemap, "Cubemap" }, - { FileType::Model, "Model" }, - { FileType::Audio, "Audio" }, + static const std::unordered_map s_FileTypesToString = { + { FileType::Unknown, Str8Lit("Unknown") }, + { FileType::Scene, Str8Lit("Scene") }, + { FileType::Prefab, Str8Lit("Prefab") }, + { FileType::Script, Str8Lit("Script") }, + { FileType::Shader, Str8Lit("Shader") }, + { FileType::Texture, Str8Lit("Texture") }, + { FileType::Font, Str8Lit("Font") }, + { FileType::Cubemap, Str8Lit("Cubemap") }, + { FileType::Model, Str8Lit("Model") }, + { FileType::Audio, Str8Lit("Audio") }, }; static const std::unordered_map s_FileTypes = { - { ".lsn", FileType::Scene }, - { ".lprefab", FileType::Prefab }, - { ".cs", FileType::Script }, - { ".lua", FileType::Script }, - { ".glsl", FileType::Shader }, - { ".shader", FileType::Shader }, - { ".frag", FileType::Shader }, - { ".vert", FileType::Shader }, - { ".comp", FileType::Shader }, - - { ".png", FileType::Texture }, - { ".jpg", FileType::Texture }, - { ".jpeg", FileType::Texture }, - { ".bmp", FileType::Texture }, - { ".gif", FileType::Texture }, - { ".tga", FileType::Texture }, - { ".ttf", FileType::Font }, - - { ".hdr", FileType::Cubemap }, - - { ".obj", FileType::Model }, - { ".fbx", FileType::Model }, - { ".gltf", FileType::Model }, - - { ".mp3", FileType::Audio }, - { ".m4a", FileType::Audio }, - { ".wav", FileType::Audio }, - { ".ogg", FileType::Audio }, + { "lsn", FileType::Scene }, + { "lprefab", FileType::Prefab }, + { "cs", FileType::Script }, + { "lua", FileType::Script }, + { "glsl", FileType::Shader }, + { "shader", FileType::Shader }, + { "frag", FileType::Shader }, + { "vert", FileType::Shader }, + { "comp", FileType::Shader }, + { "png", FileType::Texture }, + { "jpg", FileType::Texture }, + { "jpeg", FileType::Texture }, + { "bmp", FileType::Texture }, + { "gif", FileType::Texture }, + { "tga", FileType::Texture }, + { "ttf", FileType::Font }, + { "hdr", FileType::Cubemap }, + { "obj", FileType::Model }, + { "fbx", FileType::Model }, + { "gltf", FileType::Model }, + { "glb", FileType::Model }, + { "mp3", FileType::Audio }, + { "m4a", FileType::Audio }, + { "wav", FileType::Audio }, + { "ogg", FileType::Audio }, }; static const std::unordered_map s_TypeColors = { @@ -93,34 +90,29 @@ namespace Lumos { FileType::Audio, ICON_MDI_MICROPHONE }, }; -#ifdef LUMOS_PLATFORM_WINDOWS - std::string ResourcePanel::m_Delimiter = "\\"; -#else - std::string ResourcePanel::m_Delimiter = "/"; -#endif ResourcePanel::ResourcePanel() { LUMOS_PROFILE_FUNCTION(); m_Name = ICON_MDI_FOLDER_STAR " Resources###resources"; m_SimpleName = "Resources"; + m_Arena = ArenaAlloc(Megabytes(10)); +#ifdef LUMOS_PLATFORM_WINDOWS + m_Delimiter = Str8Lit("\\"); +#else + m_Delimiter = Str8Lit("/"); +#endif + m_GridSize = 180.0f; m_GridSize *= Application::Get().GetWindow()->GetDPIScale(); - // TODO: Get Project path from editor - // #ifdef LUMOS_PLATFORM_IOS - // m_BaseDirPath = "Assets"; - // #else - // m_BaseProjectDir = std::filesystem::path(m_Editor->GetProjectRoot() + "/ExampleProject/Assets"); - // //m_BaseDirPath = ROOT_DIR "/ExampleProject/Assets"; - // #endif - m_BasePath = Application::Get().GetProjectSettings().m_ProjectRoot + "Assets"; + m_BasePath = PushStr8F(m_Arena, "%sAssets", Application::Get().GetProjectSettings().m_ProjectRoot.c_str()); std::string assetsBasePath; - VFS::Get().ResolvePhysicalPath("//Assets", assetsBasePath); - m_AssetPath = std::filesystem::path(assetsBasePath); + FileSystem::Get().ResolvePhysicalPath("//Assets", assetsBasePath); + m_AssetPath = PushStr8Copy(m_Arena, Str8C((char*)std::filesystem::path(assetsBasePath).string().c_str())); - std::string baseDirectoryHandle = ProcessDirectory(std::filesystem::path(m_BasePath), nullptr); - m_BaseProjectDir = m_Directories[baseDirectoryHandle]; + String8 baseDirectoryHandle = ProcessDirectory(m_BasePath, nullptr, true); + m_BaseProjectDir = m_Directories[baseDirectoryHandle]; ChangeDirectory(m_BaseProjectDir); m_CurrentDir = m_BaseProjectDir; @@ -137,6 +129,7 @@ namespace Lumos desc.wrap = Graphics::TextureWrap::CLAMP; m_FileIcon = Graphics::Texture2D::CreateFromSource(browserFileWidth, browserFileHeight, (void*)browserFile, desc); m_FolderIcon = Graphics::Texture2D::CreateFromSource(browserFolderWidth, browserFolderHeight, (void*)browserFolder, desc); + m_Refresh = false; } void ResourcePanel::ChangeDirectory(SharedPtr& directory) @@ -147,6 +140,11 @@ namespace Lumos m_PreviousDirectory = m_CurrentDir; m_CurrentDir = directory; m_UpdateNavigationPath = true; + + if(!m_CurrentDir->Opened) + { + ProcessDirectory(m_CurrentDir->Path, m_CurrentDir->Parent, true); + } } void ResourcePanel::RemoveDirectory(SharedPtr& directory, bool removeFromParent) @@ -159,7 +157,7 @@ namespace Lumos for(auto& subdir : directory->Children) RemoveDirectory(subdir, false); - m_Directories.erase(m_Directories.find(directory->FilePath.string())); + m_Directories.erase(m_Directories.find(directory->Path)); } bool IsHidden(const std::filesystem::path& filePath) @@ -167,7 +165,8 @@ namespace Lumos try { std::filesystem::file_status status = std::filesystem::status(filePath); - return (status.permissions() & std::filesystem::perms::owner_read) == std::filesystem::perms::none; + std::string name = filePath.stem().string(); + return (status.permissions() & std::filesystem::perms::owner_read) == std::filesystem::perms::none || name == ".DS_Store"; } catch(const std::filesystem::filesystem_error& ex) { @@ -177,35 +176,46 @@ namespace Lumos return false; // Return false by default if any error occurs } - std::string ResourcePanel::ProcessDirectory(const std::filesystem::path& directoryPath, const SharedPtr& parent) + String8 ResourcePanel::ProcessDirectory(String8 directoryPath, const SharedPtr& parent, bool processChildren) { - const auto& directory = m_Directories[directoryPath.string()]; - if(directory) - return directory->FilePath.string(); + const auto& directory = m_Directories[directoryPath]; + if(directory && directory->Opened) + return directory->Path; - SharedPtr directoryInfo = CreateSharedPtr(directoryPath, !std::filesystem::is_directory(directoryPath)); + SharedPtr directoryInfo = directory ? directory : CreateSharedPtr(directoryPath, !std::filesystem::is_directory(std::string((const char*)directoryPath.str, directoryPath.size))); directoryInfo->Parent = parent; - if(directoryPath == m_BasePath) - directoryInfo->FilePath = m_BasePath; + if(Str8Match(directoryPath, m_BasePath, 0)) + directoryInfo->Path = m_BasePath; else - directoryInfo->FilePath = std::filesystem::relative(directoryPath, m_BasePath); + directoryInfo->Path = directoryPath; + + directoryInfo->Path = directoryPath; + String8 extension = Str8PathSkipLastPeriod(directoryInfo->Path); + directoryInfo->FileTypeID = GetParsedAssetID(extension); - directoryInfo->FullPath = directoryPath; - directoryInfo->FileTypeID = GetParsedAssetID(StringUtilities::GetFilePathExtension(directoryInfo->FilePath.string())); + auto stdPath = std::filesystem::path(std::string((const char*)directoryPath.str, directoryPath.size)); - if(std::filesystem::is_directory(directoryPath)) + if(std::filesystem::is_directory(stdPath)) { directoryInfo->IsFile = false; - directoryInfo->Name = directoryPath.filename().string(); - for(auto& entry : std::filesystem::directory_iterator(directoryPath)) + directoryInfo->Path = directoryPath; // .filename().string(); + directoryInfo->Leaf = true; + for(auto& entry : std::filesystem::directory_iterator(stdPath)) { if(!m_ShowHiddenFiles && IsHidden(entry.path())) { continue; } + + if(entry.is_directory()) + directoryInfo->Leaf = false; + + if(processChildren) { - std::string subdirHandle = ProcessDirectory(entry.path(), directoryInfo); + directoryInfo->Opened = true; + + String8 subdirHandle = ProcessDirectory(PushStr8Copy(m_Arena, Str8C((char*)entry.path().generic_string().c_str())), directoryInfo, false); directoryInfo->Children.push_back(m_Directories[subdirHandle]); } } @@ -213,34 +223,33 @@ namespace Lumos else { auto fileType = FileType::Unknown; - const auto& fileTypeIt = s_FileTypes.find(directoryPath.extension().string()); + const auto& fileTypeIt = s_FileTypes.find(std::string((const char*)extension.str, extension.size)); if(fileTypeIt != s_FileTypes.end()) fileType = fileTypeIt->second; - directoryInfo->IsFile = true; - directoryInfo->Type = fileType; - directoryInfo->Name = directoryPath.filename().string(); - directoryInfo->FileSize = std::filesystem::exists(directoryPath) ? StringUtilities::BytesToString(std::filesystem::file_size(directoryPath)) : ""; - - std::string_view fileTypeString = s_FileTypesToString.at(FileType::Unknown); - const auto& fileStringTypeIt = s_FileTypesToString.find(fileType); - if(fileStringTypeIt != s_FileTypesToString.end()) - fileTypeString = fileStringTypeIt->second; + directoryInfo->IsFile = true; + directoryInfo->Type = fileType; + directoryInfo->Path = directoryPath; // .filename().string(); + directoryInfo->FileSize = std::filesystem::exists(stdPath) ? std::filesystem::file_size(stdPath) : 0; + directoryInfo->FileSizeString = PushStr8Copy(m_Arena, StringUtilities::BytesToString(directoryInfo->FileSize).c_str()); + directoryInfo->Hidden = std::filesystem::exists(stdPath) ? IsHidden(stdPath) : true; + directoryInfo->Opened = true; + directoryInfo->Leaf = true; ImVec4 fileTypeColor = { 1.0f, 1.0f, 1.0f, 1.0f }; const auto& fileTypeColorIt = s_TypeColors.find(fileType); if(fileTypeColorIt != s_TypeColors.end()) fileTypeColor = fileTypeColorIt->second; - directoryInfo->FileTypeString = fileTypeString; directoryInfo->FileTypeColour = fileTypeColor; } - m_Directories[directoryInfo->FilePath.string()] = directoryInfo; - return directoryInfo->FilePath.string(); + if(!directory) + m_Directories[directoryInfo->Path] = directoryInfo; + return directoryInfo->Path; } - void ResourcePanel::DrawFolder(const SharedPtr& dirInfo, bool defaultOpen) + void ResourcePanel::DrawFolder(SharedPtr& dirInfo, bool defaultOpen) { LUMOS_PROFILE_FUNCTION(); ImGuiTreeNodeFlags nodeFlags = ((dirInfo == m_CurrentDir) ? ImGuiTreeNodeFlags_Selected : 0); @@ -255,17 +264,7 @@ namespace Lumos if(!dirInfo->IsFile) { - bool containsFolder = false; - - for(auto& file : dirInfo->Children) - { - if(!file->IsFile) - { - containsFolder = true; - break; - } - } - if(!containsFolder) + if(dirInfo->Leaf) nodeFlags |= ImGuiTreeNodeFlags_Leaf; if(defaultOpen) @@ -276,22 +275,21 @@ namespace Lumos bool isOpen = ImGui::TreeNodeEx((void*)(intptr_t)(dirInfo.get()), nodeFlags, ""); if(ImGui::IsItemClicked()) { - m_PreviousDirectory = m_CurrentDir; - m_CurrentDir = dirInfo; - m_UpdateNavigationPath = true; + ChangeDirectory(dirInfo); } - const char* folderIcon = ((isOpen && containsFolder) || m_CurrentDir == dirInfo) ? ICON_MDI_FOLDER_OPEN : ICON_MDI_FOLDER; + const char* folderIcon = ((isOpen && !dirInfo->Leaf) || m_CurrentDir == dirInfo) ? ICON_MDI_FOLDER_OPEN : ICON_MDI_FOLDER; ImGui::SameLine(); ImGui::PushStyleColor(ImGuiCol_Text, ImGuiUtilities::GetIconColour()); - ImGui::Text("%s ", folderIcon); + ImGui::TextUnformatted(folderIcon); ImGui::PopStyleColor(); ImGui::SameLine(); - ImGui::TextUnformatted((const char*)dirInfo->FilePath.filename().string().c_str()); + + ImGui::TextUnformatted((const char*)(Str8PathSkipLastSlash(dirInfo->Path).str)); ImVec2 verticalLineStart = ImGui::GetCursorScreenPos(); - if(isOpen && containsFolder) + if(isOpen && !dirInfo->Leaf) { verticalLineStart.x += SmallOffsetX; // to nicely line up with the arrow symbol ImVec2 verticalLineEnd = verticalLineStart; @@ -304,18 +302,9 @@ namespace Lumos ImGui::Indent(10.0f); - bool containsFolderTemp = false; - for(auto& file : dirInfo->Children[i]->Children) - { - if(!file->IsFile) - { - containsFolderTemp = true; - break; - } - } float HorizontalTreeLineSize = 16.0f * Application::Get().GetWindowDPI(); // chosen arbitrarily - if(containsFolderTemp) + if(!dirInfo->Children[i]->Leaf) HorizontalTreeLineSize *= 0.5f; DrawFolder(dirInfo->Children[i]); @@ -334,13 +323,13 @@ namespace Lumos ImGui::TreePop(); } - if(isOpen && !containsFolder) + if(isOpen && dirInfo->Leaf) ImGui::TreePop(); } if(m_IsDragging && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) { - m_MovePath = dirInfo->FilePath.string().c_str(); + m_MovePath = dirInfo->Path; } } @@ -357,6 +346,13 @@ namespace Lumos auto windowSize = ImGui::GetWindowSize(); bool vertical = windowSize.y > windowSize.x; static bool Init = false; + + if(m_Refresh) + { + Refresh(); + m_Refresh = false; + } + if(!vertical) { ImGui::BeginColumns("ResourcePanelColumns", 2, 0); @@ -371,8 +367,6 @@ namespace Lumos ImGui::BeginChild("##folders_common", ImVec2(0, ImGui::GetWindowHeight() / 3.0f)); { - RenderBreadCrumbs(); - { ImGui::BeginChild("##folders"); { @@ -389,10 +383,10 @@ namespace Lumos auto data = ImGui::AcceptDragDropPayload("selectable", ImGuiDragDropFlags_AcceptNoDrawDefaultRect); if(data) { - std::string file = (char*)data->Data; - if(MoveFile(file, m_MovePath)) + String8* file = (String8*)data->Data; + if(MoveFile(*file, m_MovePath)) { - LUMOS_LOG_INFO("Moved File: " + file + " to " + m_MovePath); + LUMOS_LOG_INFO("Moved File: {0} to {1}", (const char*)((*file).str), (const char*)m_MovePath.str); } m_IsDragging = false; } @@ -409,7 +403,6 @@ namespace Lumos ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal); } - // ImGui::BeginChild("##directory_structure", ImVec2(0, ImGui::GetWindowHeight() - ImGui::GetFrameHeightWithSpacing() * 2.6f - offset)); { { ImGui::BeginChild("##directory_breadcrumbs", ImVec2(ImGui::GetColumnWidth(), ImGui::GetFrameHeightWithSpacing() * 2.0f)); @@ -440,13 +433,13 @@ namespace Lumos if(ImGui::Selectable("Refresh")) { - Refresh(); + QueueRefresh(); } if(ImGui::Selectable("New folder")) { - std::filesystem::create_directory(std::filesystem::path(m_CurrentDir->FullPath / "NewFolder")); - Refresh(); + std::filesystem::create_directory(std::filesystem::path(std::string((char*)m_CurrentDir->Path.str, m_CurrentDir->Path.size)) / "NewFolder"); + QueueRefresh(); } if(!m_IsInListView) @@ -467,9 +460,7 @@ namespace Lumos { if(m_CurrentDir != m_BaseProjectDir) { - m_PreviousDirectory = m_CurrentDir; - m_CurrentDir = m_CurrentDir->Parent; - m_UpdateNavigationPath = true; + ChangeDirectory(m_CurrentDir->Parent); } } ImGui::SameLine(); @@ -502,25 +493,18 @@ namespace Lumos std::reverse(m_BreadCrumbData.begin(), m_BreadCrumbData.end()); m_UpdateNavigationPath = false; } - { int secIdx = 0, newPwdLastSecIdx = -1; - auto& AssetsDir = m_CurrentDir->FilePath; - - size_t PhysicalPathCount = 0; + // String8 AssetsDir = m_CurrentDir->Path; - for(auto& sec : m_AssetPath) - { - PhysicalPathCount++; - } + // String8List dirList = PathPartsFromStr8(scratch, m_AssetPath); int dirIndex = 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.1f, 0.2f, 0.7f, 0.0f)); for(auto& directory : m_BreadCrumbData) { - const std::string& directoryName = directory->FilePath.filename().string(); - if(ImGui::SmallButton(directoryName.c_str())) + if(ImGui::SmallButton((const char*)GetFileName(directory->Path).str)) ChangeDirectory(directory); ImGui::SameLine(); @@ -530,27 +514,27 @@ namespace Lumos if(newPwdLastSecIdx >= 0) { - int i = 0; - std::filesystem::path newPwd; - for(auto& sec : AssetsDir) + int i = 0; + auto stdPath = std::filesystem::path(std::string((const char*)m_CurrentDir->Path.str, m_CurrentDir->Path.size)); + + for(const auto& sec : stdPath) { if(i++ > newPwdLastSecIdx) break; - newPwd /= sec; + stdPath /= sec; } #ifdef _WIN32 if(newPwdLastSecIdx == 0) - newPwd /= "\\"; + stdPath /= "\\"; #endif m_PreviousDirectory = m_CurrentDir; - m_CurrentDir = m_Directories[newPwd.string()]; + m_CurrentDir = m_Directories[Str8C((char*)stdPath.string().c_str())]; m_UpdateNavigationPath = true; } ImGui::SameLine(); } - ImGui::EndChild(); } @@ -615,14 +599,14 @@ namespace Lumos { if(m_CurrentDir->Children.size() > 0) { - if(!m_ShowHiddenFiles && Lumos::StringUtilities::IsHiddenFile(m_CurrentDir->Children[i]->FilePath.filename().string())) + if(!m_ShowHiddenFiles && m_CurrentDir->Children[i]->Hidden) { continue; } if(m_Filter.IsActive()) { - if(!m_Filter.PassFilter(m_CurrentDir->Children[i]->FilePath.filename().string().c_str())) + if(!m_Filter.PassFilter((const char*)(Str8PathSkipLastSlash(m_CurrentDir->Children[i]->Path).str))) { continue; } @@ -641,14 +625,14 @@ namespace Lumos { for(int i = 0; i < m_CurrentDir->Children.size(); i++) { - if(!m_ShowHiddenFiles && Lumos::StringUtilities::IsHiddenFile(m_CurrentDir->Children[i]->FilePath.filename().string())) + if(!m_ShowHiddenFiles && m_CurrentDir->Children[i]->Hidden) { continue; } if(m_Filter.IsActive()) { - if(!m_Filter.PassFilter(m_CurrentDir->Children[i]->FilePath.filename().string().c_str())) + if(!m_Filter.PassFilter((const char*)(Str8PathSkipLastSlash(m_CurrentDir->Children[i]->Path).str))) { continue; } @@ -667,14 +651,14 @@ namespace Lumos if(ImGui::BeginPopupContextWindow("AssetPanelHierarchyContextWindow", ImGuiPopupFlags_MouseButtonRight | ImGuiPopupFlags_NoOpenOverItems)) { - if(std::filesystem::exists(m_CopiedPath) && ImGui::Selectable("Paste")) + if(std::filesystem::exists(ToStdString(m_CopiedPath)) && ImGui::Selectable("Paste")) { if(m_CutFile) { - const std::filesystem::path& fullPath = m_CopiedPath; + const std::filesystem::path& fullPath = ToStdString(m_CopiedPath); std::string filename = fullPath.stem().string(); std::string extension = fullPath.extension().string(); - std::filesystem::path destinationPath = m_BasePath / m_CurrentDir->FilePath / (filename + extension); + std::filesystem::path destinationPath = std::filesystem::path(ToStdString(m_CurrentDir->Path)) / (filename + extension); { while(std::filesystem::exists(destinationPath)) @@ -687,11 +671,10 @@ namespace Lumos } else { - const std::filesystem::path& fullPath = m_CopiedPath; + const std::filesystem::path& fullPath = ToStdString(m_CopiedPath); std::string filename = fullPath.stem().string(); std::string extension = fullPath.extension().string(); - std::filesystem::path destinationPath = m_BasePath / m_CurrentDir->FilePath / (filename + extension); - + std::filesystem::path destinationPath = std::filesystem::path(ToStdString(m_CurrentDir->Path)) / (filename + extension); { while(std::filesystem::exists(destinationPath)) { @@ -701,15 +684,16 @@ namespace Lumos } std::filesystem::copy(fullPath, destinationPath); } - m_CopiedPath = ""; - m_CutFile = false; + m_CopiedPath.str = nullptr; + m_CopiedPath.size = 0; + + m_CutFile = false; Refresh(); } if(ImGui::Selectable("Open Location")) { - auto fullPath = m_BasePath + "/" + m_CurrentDir->FilePath.string(); - Lumos::OS::Instance()->OpenFileLocation(fullPath); + Lumos::OS::Instance()->OpenFileLocation(ToStdString(m_CurrentDir->Path)); } ImGui::Separator(); @@ -726,7 +710,7 @@ namespace Lumos if(ImGui::Selectable("New folder")) { - std::filesystem::create_directory(std::filesystem::path(m_CurrentDir->Parent ? m_CurrentDir->Parent->FilePath.string() + "/NewFolder" : m_BasePath + "/NewFolder")); + std::filesystem::create_directory(std::filesystem::path(ToStdString(m_CurrentDir->Path))); Refresh(); } @@ -736,6 +720,7 @@ namespace Lumos } ImGui::EndPopup(); } + ImGui::EndTable(); } ImGui::PopStyleVar(); @@ -747,10 +732,10 @@ namespace Lumos auto data = ImGui::AcceptDragDropPayload("selectable", ImGuiDragDropFlags_AcceptNoDrawDefaultRect); if(data) { - std::string a = (char*)data->Data; - if(MoveFile(a, m_MovePath)) + String8* a = (String8*)data->Data; + if(MoveFile(*a, m_MovePath)) { - LUMOS_LOG_INFO("Moved File: " + a + " to " + m_MovePath); + LUMOS_LOG_INFO("Moved File: {0} to {1}", (const char*)((*a).str), (const char*)m_MovePath.str); } m_IsDragging = false; } @@ -760,52 +745,6 @@ namespace Lumos ImGui::End(); } - void ResourcePanel::RenderBreadCrumbs() - { - LUMOS_PROFILE_FUNCTION(); - // ImGui::BeginChild("##directory_breadcrumbs", ImVec2(ImGui::GetColumnWidth(), ImGui::GetFontSize() * 2.0f)); - // { - - // int dirIndex = 0; - // ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.1f, 0.2f, 0.7f, 0.0f)); - // - // for(auto& directory : m_BreadCrumbData) - // { - // std::string directoryName = directory->FilePath.filename().string(); - // if(ImGui::SmallButton(directoryName.c_str())) - // ChangeDirectory(directory); - // - // ImGui::SameLine(); - // } - // - // ImGui::PopStyleColor(); - // - // if(newPwdLastSecIdx >= 0) - // { - // int i = 0; - // std::filesystem::path newPwd; - // for(auto& sec : AssetsDir) - // { - // if(i++ > newPwdLastSecIdx) - // break; - // newPwd /= sec; - // } - // #ifdef _WIN32 - // if(newPwdLastSecIdx == 0) - // newPwd /= "\\"; - // #endif - // - // m_PreviousDirectory = m_CurrentDir; - // m_CurrentDir = m_Directories[newPwd.string()]; - // m_UpdateNavigationPath = true; - // } - // - // ImGui::SameLine(); - // } - - // ImGui::EndChild(); - } - bool ResourcePanel::RenderFile(int dirIndex, bool folder, int shownIndex, bool gridView) { LUMOS_PROFILE_FUNCTION(); @@ -845,7 +784,7 @@ namespace Lumos else if(!textureCreated) { textureCreated = true; - CurrentEnty->Thumbnail = m_TextureLibrary.GetResource(CurrentEnty->FullPath.string()); + CurrentEnty->Thumbnail = m_TextureLibrary.GetResource(std::string((const char*)CurrentEnty->Path.str, CurrentEnty->Path.size)); textureId = CurrentEnty->Thumbnail ? CurrentEnty->Thumbnail->GetHandle() : m_FileIcon->GetHandle(); } else @@ -861,15 +800,20 @@ namespace Lumos } else if(!textureCreated) { - auto sceneScreenShotPath = m_BasePath + "/Scenes/Cache/" + CurrentEnty->FilePath.stem().string() + ".png"; - if(std::filesystem::exists(std::filesystem::path(sceneScreenShotPath))) + ArenaTemp scratch = ArenaTempBegin(m_Arena); + + String8 sceneScreenShotPath = PushStr8F(scratch.arena, "%s/Scenes/Cache/%s.png", m_BasePath.str, CurrentEnty->Path); + // auto sceneScreenShotPath = m_BasePath + "/Scenes/Cache/" + CurrentEnty->FilePath.stem().string() + ".png"; + if(std::filesystem::exists(std::filesystem::path(std::string((const char*)sceneScreenShotPath.str, sceneScreenShotPath.size)))) { textureCreated = true; - CurrentEnty->Thumbnail = m_TextureLibrary.GetResource(sceneScreenShotPath); + CurrentEnty->Thumbnail = m_TextureLibrary.GetResource(std::string((const char*)sceneScreenShotPath.str, sceneScreenShotPath.size)); textureId = CurrentEnty->Thumbnail ? CurrentEnty->Thumbnail->GetHandle() : m_FileIcon->GetHandle(); } else textureId = m_FileIcon->GetHandle(); + + ArenaTempEnd(scratch); } else { @@ -901,26 +845,26 @@ namespace Lumos if(ImGui::Selectable("Cut")) { - m_CopiedPath = (m_BasePath / m_CurrentDir->Children[dirIndex]->FilePath).string(); + m_CopiedPath = m_CurrentDir->Children[dirIndex]->Path; m_CutFile = true; } if(ImGui::Selectable("Copy")) { - m_CopiedPath = (m_BasePath / m_CurrentDir->Children[dirIndex]->FilePath).string(); + m_CopiedPath = m_CurrentDir->Children[dirIndex]->Path; m_CutFile = false; } if(ImGui::Selectable("Delete")) { - auto& fullPath = m_CurrentDir->Children[dirIndex]->FullPath; - std::filesystem::remove_all(fullPath); - Refresh(); + auto fullPath = m_CurrentDir->Children[dirIndex]->Path; + std::filesystem::remove_all(std::string((const char*)fullPath.str, fullPath.size)); + QueueRefresh(); } if(ImGui::Selectable("Duplicate")) { - std::filesystem::path fullPath = m_BasePath + "/" + m_CurrentDir->Children[dirIndex]->FilePath.string(); + std::filesystem::path fullPath = std::string((const char*)m_CurrentDir->Children[dirIndex]->Path.str, m_CurrentDir->Children[dirIndex]->Path.size); std::filesystem::path destinationPath = fullPath; { @@ -934,19 +878,19 @@ namespace Lumos } } std::filesystem::copy(fullPath, destinationPath); - Refresh(); + QueueRefresh(); } if(ImGui::Selectable("Open Location")) { - auto& fullPath = m_CurrentDir->Children[dirIndex]->FullPath; - Lumos::OS::Instance()->OpenFileLocation(fullPath); + auto fullPath = m_CurrentDir->Children[dirIndex]->Path; + Lumos::OS::Instance()->OpenFileLocation(std::string((const char*)fullPath.str, fullPath.size)); } if(m_CurrentDir->Children[dirIndex]->IsFile && ImGui::Selectable("Open External")) { - auto& fullPath = m_CurrentDir->Children[dirIndex]->FullPath; - Lumos::OS::Instance()->OpenFileExternal(fullPath); + auto fullPath = m_CurrentDir->Children[dirIndex]->Path; + Lumos::OS::Instance()->OpenFileExternal(std::string((const char*)fullPath.str, fullPath.size)); } ImGui::Separator(); @@ -958,13 +902,13 @@ namespace Lumos if(ImGui::Selectable("Refresh")) { - Refresh(); + QueueRefresh(); } if(ImGui::Selectable("New folder")) { - std::filesystem::create_directory(std::filesystem::path(m_CurrentDir->FilePath.string() + "/NewFolder")); - Refresh(); + std::filesystem::create_directory(std::filesystem::path(std::string((const char*)m_CurrentDir->Path.str, m_CurrentDir->Path.size) + "/NewFolder")); + QueueRefresh(); } if(!m_IsInListView) @@ -978,26 +922,28 @@ namespace Lumos { ImGui::BeginTooltip(); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); - ImGui::TextUnformatted((m_CurrentDir->Children[dirIndex]->FullPath.string()).c_str()); + ImGui::TextUnformatted((const char*)(m_CurrentDir->Children[dirIndex]->Path.str)); ImGui::PopTextWrapPos(); ImGui::Image(m_CurrentDir->Children[dirIndex]->Thumbnail->GetHandle(), { 512, 512 }, ImVec2(0.0f, flipImage ? 1.0f : 0.0f), ImVec2(1.0f, flipImage ? 0.0f : 1.0f)); ImGui::EndTooltip(); } else - ImGuiUtilities::Tooltip((const char*)(m_CurrentDir->Children[dirIndex]->FullPath.string()).c_str()); + ImGuiUtilities::Tooltip((const char*)(m_CurrentDir->Children[dirIndex]->Path.str)); if(ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) { - ImGui::TextUnformatted(m_Editor->GetIconFontIcon(m_CurrentDir->Children[dirIndex]->FilePath.string())); + ImGui::TextUnformatted(m_Editor->GetIconFontIcon(ToStdString(m_CurrentDir->Children[dirIndex]->Path))); ImGui::SameLine(); - m_MovePath = m_BasePath + "/" + m_CurrentDir->Children[dirIndex]->FilePath.string(); - ImGui::TextUnformatted(m_MovePath.c_str()); - size_t size = sizeof(const char*) + strlen(m_MovePath.c_str()); - ImGui::SetDragDropPayload("AssetFile", m_MovePath.c_str(), size); + m_MovePath = m_CurrentDir->Children[dirIndex]->Path; + ImGui::TextUnformatted((const char*)m_MovePath.str); + + size_t size = sizeof(const char*) + m_MovePath.size; + ImGui::SetDragDropPayload("AssetFile", m_MovePath.str, size); m_IsDragging = true; ImGui::EndDragDropSource(); } + if(ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { doubleClicked = true; @@ -1020,25 +966,37 @@ namespace Lumos const ImRect clipRect = ImRect({ rectMin.x + padding * 2.0f, rectMin.y + padding * 4.0f }, { rectMin.x + rectSize.x, rectMin.y + scaledThumbnailSizeX - ImGui::GetIO().Fonts->Fonts[2]->FontSize - padding * 4.0f }); - ImGuiUtilities::ClippedText(clipRect.Min, clipRect.Max, CurrentEnty->Name.c_str(), nullptr, nullptr, { 0, 0 }, nullptr, clipRect.GetSize().x); + ImGuiUtilities::ClippedText(clipRect.Min, clipRect.Max, (const char*)(GetFileName(CurrentEnty->Path, !CurrentEnty->IsFile).str), nullptr, nullptr, { 0, 0 }, nullptr, clipRect.GetSize().x); if(CurrentEnty->IsFile) { ImGui::SetCursorPos({ cursorPos.x + padding * (float)m_Editor->GetWindow()->GetDPIScale(), cursorPos.y + backgroundThumbnailSize.y - (ImGui::GetIO().Fonts->Fonts[2]->FontSize - padding * (float)m_Editor->GetWindow()->GetDPIScale()) * 3.2f }); ImGui::BeginDisabled(); ImGuiUtilities::ScopedFont smallFont(ImGui::GetIO().Fonts->Fonts[2]); - ImGui::TextUnformatted(CurrentEnty->FileTypeString.data()); + ImGui::Indent(); + + String8 fileTypeString = s_FileTypesToString.at(FileType::Unknown); + const auto& fileStringTypeIt = s_FileTypesToString.find(CurrentEnty->Type); + if(fileStringTypeIt != s_FileTypesToString.end()) + fileTypeString = fileStringTypeIt->second; + + ImGui::TextUnformatted((const char*)(fileTypeString).str); + ImGui::Unindent(); cursorPos = ImGui::GetCursorPos(); ImGui::SetCursorPos({ cursorPos.x + padding * (float)m_Editor->GetWindow()->GetDPIScale(), cursorPos.y - (ImGui::GetIO().Fonts->Fonts[2]->FontSize * 0.6f - padding * (float)m_Editor->GetWindow()->GetDPIScale()) }); - ImGui::TextUnformatted(CurrentEnty->FileSize.c_str()); + ImGui::Indent(); + ImGui::TextUnformatted((const char*)CurrentEnty->FileSizeString.str); + ImGui::Unindent(); + ImGui::EndDisabled(); } } else { - ImGui::TextUnformatted(folder ? ICON_MDI_FOLDER : m_Editor->GetIconFontIcon(m_CurrentDir->Children[dirIndex]->FilePath.string())); + ImGui::TextUnformatted(folder ? ICON_MDI_FOLDER : m_Editor->GetIconFontIcon(std::string((const char*)m_CurrentDir->Children[dirIndex]->Path.str, m_CurrentDir->Children[dirIndex]->Path.size))); ImGui::SameLine(); - if(ImGui::Selectable(m_CurrentDir->Children[dirIndex]->FilePath.filename().string().c_str(), false, ImGuiSelectableFlags_AllowDoubleClick)) + + if(ImGui::Selectable((const char*)m_CurrentDir->Children[dirIndex]->Path.str, false, ImGuiSelectableFlags_AllowDoubleClick)) { if(ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { @@ -1046,17 +1004,18 @@ namespace Lumos } } - ImGuiUtilities::Tooltip((const char*)m_CurrentDir->Children[dirIndex]->FilePath.filename().string().c_str()); + ImGuiUtilities::Tooltip((const char*)m_CurrentDir->Children[dirIndex]->Path.str); if(ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)) { - ImGui::TextUnformatted(m_Editor->GetIconFontIcon(m_CurrentDir->Children[dirIndex]->FilePath.string())); + ImGui::TextUnformatted(m_Editor->GetIconFontIcon(ToStdString(m_CurrentDir->Children[dirIndex]->Path))); ImGui::SameLine(); - m_MovePath = m_BasePath + "/" + m_CurrentDir->Children[dirIndex]->FilePath.string(); - ImGui::TextUnformatted(m_MovePath.c_str()); - size_t size = sizeof(const char*) + strlen(m_MovePath.c_str()); - ImGui::SetDragDropPayload("AssetFile", m_MovePath.c_str(), size); + m_MovePath = m_CurrentDir->Children[dirIndex]->Path; + ImGui::TextUnformatted((const char*)m_MovePath.str); + + size_t size = sizeof(const char*) + m_MovePath.size; + ImGui::SetDragDropPayload("AssetFile", m_MovePath.str, size); m_IsDragging = true; ImGui::EndDragDropSource(); } @@ -1066,158 +1025,68 @@ namespace Lumos { if(folder) { - m_PreviousDirectory = m_CurrentDir; - m_CurrentDir = m_CurrentDir->Children[dirIndex]; - m_UpdateNavigationPath = true; + ChangeDirectory(m_CurrentDir->Children[dirIndex]); } else { - m_Editor->FileOpenCallback(m_BasePath + "/" + m_CurrentDir->Children[dirIndex]->FilePath.string()); + m_Editor->FileOpenCallback(std::string((const char*)m_CurrentDir->Children[dirIndex]->Path.str, m_CurrentDir->Children[dirIndex]->Path.size)); } } return doubleClicked; } - void ResourcePanel::RenderBottom() + bool ResourcePanel::MoveFile(const String8 filePath, String8 movePath) { LUMOS_PROFILE_FUNCTION(); - ImGui::BeginChild("##nav", ImVec2(ImGui::GetColumnWidth(), ImGui::GetFontSize() * 1.8f), true, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); - { - int secIdx = 0, newPwdLastSecIdx = -1; + std::string s = "move " + std::string((const char*)filePath.str, filePath.size) + " " + std::string((const char*)movePath.str, movePath.size); - auto& AssetsDir = m_CurrentDir->FilePath; - - size_t PhysicalPathCount = 0; - - for(auto& sec : m_AssetPath) - { - PhysicalPathCount++; - } - int dirIndex = 0; - ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.1f, 0.2f, 0.7f, 0.0f)); - - for(auto& directory : m_BreadCrumbData) - { - const std::string& directoryName = directory->FilePath.filename().string(); - if(ImGui::SmallButton(directoryName.c_str())) - ChangeDirectory(directory); - - ImGui::SameLine(); - } - - ImGui::PopStyleColor(); - - if(newPwdLastSecIdx >= 0) - { - int i = 0; - std::filesystem::path newPwd; - for(auto& sec : AssetsDir) - { - if(i++ > newPwdLastSecIdx) - break; - newPwd /= sec; - } -#ifdef _WIN32 - if(newPwdLastSecIdx == 0) - newPwd /= "\\"; -#endif - - m_PreviousDirectory = m_CurrentDir; - m_CurrentDir = m_Directories[newPwd.string()]; - m_UpdateNavigationPath = true; - } - - ImGui::SameLine(); - } - - if(!m_IsInListView) - { - ImGui::SliderFloat("##GridSize", &m_GridSize, 40.0f, 400.0f); - } - ImGui::EndChild(); - } - - std::vector ResourcePanel::SearchFiles(const std::string& query) - { - return std::vector(); - } - - bool ResourcePanel::MoveFile(const std::string& filePath, const std::string& movePath) - { - LUMOS_PROFILE_FUNCTION(); - std::string s = "move " + filePath + " " + movePath.c_str(); #ifndef LUMOS_PLATFORM_IOS system(s.c_str()); #endif - return std::filesystem::exists(std::filesystem::path(movePath + m_Delimiter + StringUtilities::GetFileName(filePath))); - } - - std::string ResourcePanel::StripExtras(const std::string& filename) - { - LUMOS_PROFILE_FUNCTION(); - std::vector out; - size_t start; - size_t end = 0; - - while((start = filename.find_first_not_of(".", end)) != std::string::npos) - { - end = filename.find(".", start); - out.push_back(filename.substr(start, end - start)); - } - - int maxChars = int(m_GridSize / (ImGui::GetFontSize() * 0.5f)); - - if(out[0].length() >= maxChars) - { - auto cutFilename = " " + out[0].substr(0, maxChars - 3) + "..."; - return cutFilename; - } - - auto filenameLength = out[0].length(); - // auto paddingToAdd = maxChars - 1 - filenameLength; - // - std::string newFileName; - // - // for(int i = 0; i <= paddingToAdd; i++) - // { - // newFileName += " "; - // } - - newFileName += out[0]; - - return newFileName; + return std::filesystem::exists(std::filesystem::path(std::string((const char*)movePath.str, movePath.size)) / StringUtilities::GetFileName(std::string((const char*)filePath.str, filePath.size))); } void ResourcePanel::OnNewProject() { - Refresh(); + QueueRefresh(); } void ResourcePanel::Refresh() { m_TextureLibrary.Destroy(); - m_BasePath = Application::Get().GetProjectSettings().m_ProjectRoot + "Assets"; + Arena* temp = ArenaAlloc(256); + String8 currentPath = PushStr8Copy(temp, m_CurrentDir->Path); - auto& currentPath = m_CurrentDir->FilePath; + ArenaClear(m_Arena); + m_Directories.clear(); + + m_BasePath = PushStr8F(m_Arena, "%sAssets", Application::Get().GetProjectSettings().m_ProjectRoot.c_str()); + String8 baseDirectoryHandle = ProcessDirectory(m_BasePath, nullptr, true); + m_BaseProjectDir = m_Directories[baseDirectoryHandle]; + ChangeDirectory(m_BaseProjectDir); m_UpdateNavigationPath = true; - m_Directories.clear(); - std::string baseDirectoryHandle = ProcessDirectory(std::filesystem::path(m_BasePath), nullptr); - m_BaseProjectDir = m_Directories[baseDirectoryHandle]; - m_PreviousDirectory = nullptr; - m_CurrentDir = nullptr; + m_BaseProjectDir = m_Directories[baseDirectoryHandle]; + m_PreviousDirectory = nullptr; + m_CurrentDir = nullptr; - if(m_Directories.find(currentPath.string()) != m_Directories.end()) - m_CurrentDir = m_Directories[currentPath.string()]; - else + bool dirFound = false; + for(auto dir : m_Directories) + { + if(Str8Match(dir.first, currentPath, 0)) + { + m_CurrentDir = dir.second; + dirFound = true; + break; + } + } + if(!dirFound) ChangeDirectory(m_BaseProjectDir); - std::string assetsBasePath; - VFS::Get().ResolvePhysicalPath("//Assets", assetsBasePath); - m_AssetPath = std::filesystem::path(assetsBasePath); + ArenaRelease(temp); } } diff --git a/Editor/Source/ResourcePanel.h b/Editor/Source/ResourcePanel.h index 5f496e89..52ec91f5 100644 --- a/Editor/Source/ResourcePanel.h +++ b/Editor/Source/ResourcePanel.h @@ -2,6 +2,7 @@ #include "EditorPanel.h" #include +#include #if __has_include() #include @@ -33,26 +34,25 @@ namespace Lumos SharedPtr Parent; std::vector> Children; - std::filesystem::path FilePath; - std::filesystem::path FullPath; bool IsFile; + bool Opened = false; + bool Leaf = true; - std::string Name; - std::string Extension; - std::filesystem::directory_entry DirectoryEntry; + String8 Path; SharedPtr Thumbnail = nullptr; - - ImVec4 FileTypeColour; FileType Type; - std::string_view FileTypeString; - std::string FileSize; - int FileTypeID; + uint64_t FileSize; + String8 FileSizeString; + int64_t FileTypeID; + bool Hidden; + ImVec4 FileTypeColour; public: - DirectoryInformation(const std::filesystem::path& fname, bool isF) + DirectoryInformation(String8 path, bool isF) { - FilePath = fname; - IsFile = isF; + Path = path; + IsFile = isF; + Hidden = false; } ~DirectoryInformation() @@ -67,15 +67,13 @@ namespace Lumos ~ResourcePanel() { m_TextureLibrary.Destroy(); + ArenaRelease(m_Arena); } void OnImGui() override; bool RenderFile(int dirIndex, bool folder, int shownIndex, bool gridView); - void DrawFolder(const SharedPtr& dirInfo, bool defaultOpen = false); - void RenderBreadCrumbs(); - void RenderBottom(); - // void GetDirectories(const std::string& path); + void DrawFolder(SharedPtr& dirInfo, bool defaultOpen = false); void DestroyGraphicsResources() override { @@ -99,11 +97,11 @@ namespace Lumos m_TextureLibrary.Destroy(); } - int GetParsedAssetID(const std::string& extension) + int GetParsedAssetID(String8 extension) { for(int i = 0; i < assetTypes.size(); i++) { - if(extension == assetTypes[i]) + if(Str8Match(extension, assetTypes[i], 0)) { return i; } @@ -112,27 +110,27 @@ namespace Lumos return -1; } - static std::string GetParentPath(const std::string& path); + // static String8 GetParentPath(String8 path); - static std::vector SearchFiles(const std::string& query); - static bool MoveFile(const std::string& filePath, const std::string& movePath); + static bool MoveFile(String8 filePath, String8 movePath); - std::string StripExtras(const std::string& filename); - std::string ProcessDirectory(const std::filesystem::path& directoryPath, const SharedPtr& parent); + // String8 StripExtras(String8& filename); + String8 ProcessDirectory(String8 directoryPath, const SharedPtr& parent, bool processChildren); void ChangeDirectory(SharedPtr& directory); void RemoveDirectory(SharedPtr& directory, bool removeFromParent = true); void OnNewProject() override; void Refresh(); + void QueueRefresh() { m_Refresh = true; } private: - static inline std::vector assetTypes = { - "fbx", "obj", "wav", "cs", "png", "blend", "lsc", "ogg", "lua" + static inline std::vector assetTypes = { + Str8Lit("fbx"), Str8Lit("obj"), Str8Lit("wav"), Str8Lit("cs"), Str8Lit("png"), Str8Lit("blend"), Str8Lit("lsc"), Str8Lit("ogg"), Str8Lit("lua") }; - std::string m_MovePath; - std::string m_LastNavPath; - static std::string m_Delimiter; + String8 m_MovePath; + String8 m_LastNavPath; + String8 m_Delimiter; size_t m_BasePathLen; bool m_IsDragging; @@ -144,14 +142,12 @@ namespace Lumos ImGuiTextFilter m_Filter; - char* inputText; - char* inputHint; - char inputBuffer[1024]; - bool textureCreated = false; - std::string m_BasePath; - std::filesystem::path m_AssetPath; + String8 m_BasePath; + String8 m_AssetPath; + + bool m_Refresh = false; bool m_UpdateNavigationPath = true; @@ -159,7 +155,30 @@ namespace Lumos SharedPtr m_BaseProjectDir; SharedPtr m_NextDirectory; SharedPtr m_PreviousDirectory; - std::unordered_map> m_Directories; + + struct cmp_str + { + bool operator()(String8 a, String8 b) const + { + return Str8Match(a, b, 0); + } + }; + + struct String8Hash + { + std::size_t operator()(const String8& s) const + { + // Simple hash function that combines the bytes of the string + std::size_t hash = 0; + for(uint64_t i = 0; i < s.size; ++i) + { + hash = hash * 31 + s.str[i]; + } + return hash; + } + }; + + std::unordered_map, String8Hash, cmp_str> m_Directories; std::vector> m_BreadCrumbData; SharedPtr m_FolderIcon; SharedPtr m_FileIcon; @@ -168,7 +187,9 @@ namespace Lumos Lumos::TextureLibrary m_TextureLibrary; - std::filesystem::path m_CopiedPath; + String8 m_CopiedPath; bool m_CutFile = false; + + Arena* m_Arena; }; } diff --git a/Editor/Source/SceneSettingsPanel.cpp b/Editor/Source/SceneSettingsPanel.cpp index d34dc539..7406eadd 100644 --- a/Editor/Source/SceneSettingsPanel.cpp +++ b/Editor/Source/SceneSettingsPanel.cpp @@ -47,7 +47,7 @@ namespace Lumos { m_NameUpdated = false; std::string scenePath; - if(VFS::Get().ResolvePhysicalPath("//Scenes/" + m_CurrentScene->GetSceneName() + ".lsn", scenePath)) + if(FileSystem::Get().ResolvePhysicalPath("//Assets/Scenes/" + m_CurrentScene->GetSceneName() + ".lsn", scenePath)) { m_CurrentScene->SetName(sceneName); // m_CurrentScene->Serialise(m_Editor->GetProjectSettings().m_ProjectRoot + "Assets/Scenes/"); @@ -74,23 +74,27 @@ namespace Lumos ImGuiUtilities::Property("Shadow Enabled", sceneSettings.RenderSettings.ShadowsEnabled); ImGuiUtilities::Property("Skybox Render Enabled", sceneSettings.RenderSettings.SkyboxRenderEnabled); ImGuiUtilities::Property("Skybox Mip Level", sceneSettings.RenderSettings.SkyboxMipLevel, 0.0f, 14.0f, 0.01f); - ImGuiUtilities::Property("Debug Renderer Enabled", sceneSettings.RenderSettings.DebugRenderEnabled); + + ImGui::Separator(); ImGuiUtilities::Property("FXAA Enabled", sceneSettings.RenderSettings.FXAAEnabled); ImGuiUtilities::Property("Debanding Enabled", sceneSettings.RenderSettings.DebandingEnabled); ImGuiUtilities::Property("ChromaticAberation Enabled", sceneSettings.RenderSettings.ChromaticAberationEnabled); ImGuiUtilities::Property("Filmic Grain Enabled", sceneSettings.RenderSettings.FilmicGrainEnabled); ImGuiUtilities::Property("Sharpen Enabled", sceneSettings.RenderSettings.SharpenEnabled); + ImGui::Separator(); ImGuiUtilities::Property("Bloom Enabled", sceneSettings.RenderSettings.BloomEnabled); - ImGuiUtilities::Property("Bloom Intensity", sceneSettings.RenderSettings.m_BloomIntensity); - ImGuiUtilities::Property("Bloom Upsample Scale", sceneSettings.RenderSettings.BloomUpsampleScale); - ImGuiUtilities::Property("Bloom Knee", sceneSettings.RenderSettings.BloomKnee); - ImGuiUtilities::Property("Bloom Threshold", sceneSettings.RenderSettings.BloomThreshold); + ImGuiUtilities::Property("Bloom Intensity", sceneSettings.RenderSettings.m_BloomIntensity, -1.0f, -1.0f, 0.1f); + ImGuiUtilities::Property("Bloom Upsample Scale", sceneSettings.RenderSettings.BloomUpsampleScale, -1.0f, -1.0f, 0.1f); + ImGuiUtilities::Property("Bloom Knee", sceneSettings.RenderSettings.BloomKnee, -1.0f, -1.0f, 0.1f); + ImGuiUtilities::Property("Bloom Threshold", sceneSettings.RenderSettings.BloomThreshold, -1.0f, -1.0f, 0.1f); + ImGui::Separator(); + ImGuiUtilities::Property("Depth Of Field Enabled", sceneSettings.RenderSettings.DepthOfFieldEnabled); ImGuiUtilities::Property("Depth Of Field Strength", sceneSettings.RenderSettings.DepthOfFieldStrength); ImGuiUtilities::Property("Depth Of Field Distance", sceneSettings.RenderSettings.DepthOfFieldDistance); - + ImGui::Separator(); // ImGui::BeginDisabled(); ImGuiUtilities::Property("SSAO Enabled", sceneSettings.RenderSettings.SSAOEnabled); ImGuiUtilities::Property("SSAO Sample Radius", sceneSettings.RenderSettings.SSAOSampleRadius, 0.0f, 16.0f, 0.01f); @@ -98,6 +102,7 @@ namespace Lumos ImGuiUtilities::Property("SSAO Blur Enabled", sceneSettings.RenderSettings.SSAOBlur); ImGuiUtilities::Property("SSAO Strength", sceneSettings.RenderSettings.SSAOStrength, 0.0f, 16.0f, 0.01f); // ImGui::EndDisabled(); + ImGui::Separator(); static const char* toneMaps[7] = { "None", @@ -113,6 +118,7 @@ namespace Lumos ImGuiUtilities::Property("Brightness", sceneSettings.RenderSettings.Brightness, -1.0f, 1.0f, 0.01f); ImGuiUtilities::Property("Contrast", sceneSettings.RenderSettings.Contrast, 0.0f, 2.0f, 0.01f); ImGuiUtilities::Property("Saturation", sceneSettings.RenderSettings.Saturation, 0.0f, 1.0f, 0.01f); + ImGui::Separator(); auto& registry = m_CurrentScene->GetRegistry(); int entityCount = (int)registry.storage().size(); diff --git a/Editor/Source/SceneViewPanel.h b/Editor/Source/SceneViewPanel.h index 34a4d06d..38570833 100644 --- a/Editor/Source/SceneViewPanel.h +++ b/Editor/Source/SceneViewPanel.h @@ -59,12 +59,23 @@ namespace Lumos ImGui::TextUnformatted(m_Editor->GetComponentIconMap()[typeid(T).hash_code()]); ImGui::PopStyleColor(); - ImGuiUtilities::Tooltip(StringUtilities::Demangle(typeid(T).name()).c_str()); + const char* demangledName = nullptr; + auto found = m_DemangledNames.find(typeid(T).hash_code()); + if(found == m_DemangledNames.end()) + { + m_DemangledNames[typeid(T).hash_code()] = StringUtilities::Demangle(typeid(T).name()); + demangledName = m_DemangledNames[typeid(T).hash_code()].c_str(); + } + else + demangledName = found->second.c_str(); + + ImGuiUtilities::Tooltip(demangledName); } } } std::unordered_map m_ShowComponentGizmoMap; + std::unordered_map m_DemangledNames; bool m_ShowStats = false; SharedPtr m_GameViewTexture = nullptr; diff --git a/Editor/Source/TextEditPanel.h b/Editor/Source/TextEditPanel.h index 5e240432..19c2806c 100644 --- a/Editor/Source/TextEditPanel.h +++ b/Editor/Source/TextEditPanel.h @@ -1,6 +1,7 @@ #pragma once #include "EditorPanel.h" #include +#include namespace Lumos { diff --git a/Editor/premake5.lua b/Editor/premake5.lua index ff33b48b..0468f1df 100755 --- a/Editor/premake5.lua +++ b/Editor/premake5.lua @@ -1,24 +1,3 @@ -IncludeDir = {} -IncludeDir["entt"] = "../Lumos/External/entt/src/" -IncludeDir["GLFW"] = "../Lumos/External/glfw/include/" -IncludeDir["Glad"] = "../Lumos/External/glad/include/" -IncludeDir["lua"] = "../Lumos/External/lua/src/" -IncludeDir["stb"] = "../Lumos/External/stb/" -IncludeDir["OpenAL"] = "../Lumos/External/OpenAL/include/" -IncludeDir["Box2D"] = "../Lumos/External/box2d/include/" -IncludeDir["vulkan"] = "../Lumos/External/vulkan/" -IncludeDir["Lumos"] = "../Lumos/Source" -IncludeDir["External"] = "../Lumos/External/" -IncludeDir["ImGui"] = "../Lumos/External/imgui/" -IncludeDir["freetype"] = "../Lumos/External/freetype/include" -IncludeDir["SpirvCross"] = "../Lumos/External/vulkan/SPIRV-Cross" -IncludeDir["cereal"] = "../Lumos/External/cereal/include" -IncludeDir["spdlog"] = "../Lumos/External/spdlog/include" -IncludeDir["glm"] = "../Lumos/External/glm" -IncludeDir["msdf_atlas_gen"] = "../Lumos/External/msdf-atlas-gen/msdf-atlas-gen" -IncludeDir["msdfgen"] = "../Lumos/External/msdf-atlas-gen/msdfgen" -IncludeDir["ozz"] = "../Lumos/External/ozz-animation/include" - project "LumosEditor" kind "WindowedApp" language "C++" @@ -328,7 +307,7 @@ project "LumosEditor" "glfw", } - links { "X11", "pthread", "dl", "atomic", "stdc++fs", "openal"} + links { "X11", "pthread", "dl", "atomic", "openal"} linkoptions { "-L%{cfg.targetdir}", "-Wl,-rpath=\\$$ORIGIN"} diff --git a/ExampleProject/Assets/Scenes/2D.lsn b/ExampleProject/Assets/Scenes/2D.lsn index 2fbf9404..a332657f 100644 --- a/ExampleProject/Assets/Scenes/2D.lsn +++ b/ExampleProject/Assets/Scenes/2D.lsn @@ -114,7 +114,7 @@ "value77": 1, "value78": 0, "value79": { - "FilePath": "//Scripts/FlappyBirdTest.lua" + "FilePath": "//Assets/Scripts/FlappyBirdTest.lua" }, "value80": 0, "value81": 0, diff --git a/ExampleProject/Assets/Scenes/CapsuleTest.lsn b/ExampleProject/Assets/Scenes/CapsuleTest.lsn index 445f8aa8..78e72213 100644 --- a/ExampleProject/Assets/Scenes/CapsuleTest.lsn +++ b/ExampleProject/Assets/Scenes/CapsuleTest.lsn @@ -369,7 +369,7 @@ "value86": 1, "value87": 0, "value88": { - "FilePath": "//Scripts/Projectile.lua" + "FilePath": "//Assets/Scripts/Projectile.lua" }, "value89": 0, "value90": 1, @@ -973,7 +973,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", diff --git a/ExampleProject/Assets/Scenes/ElasticTest.lsn b/ExampleProject/Assets/Scenes/ElasticTest.lsn index 03841932..7e201ef9 100644 --- a/ExampleProject/Assets/Scenes/ElasticTest.lsn +++ b/ExampleProject/Assets/Scenes/ElasticTest.lsn @@ -323,7 +323,7 @@ "value78": 1, "value79": 0, "value80": { - "FilePath": "//Scripts/Projectile.lua" + "FilePath": "//Assets/Scripts/Projectile.lua" }, "value81": 0, "value82": 1, @@ -784,7 +784,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", diff --git a/ExampleProject/Assets/Scenes/FrictionTest.lsn b/ExampleProject/Assets/Scenes/FrictionTest.lsn index 49463e94..5b474886 100644 --- a/ExampleProject/Assets/Scenes/FrictionTest.lsn +++ b/ExampleProject/Assets/Scenes/FrictionTest.lsn @@ -619,7 +619,7 @@ "value131": 1, "value132": 0, "value133": { - "FilePath": "//Scripts/Projectile.lua" + "FilePath": "//Assets/Scripts/Projectile.lua" }, "value134": 0, "value135": 1, @@ -1259,7 +1259,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", diff --git a/ExampleProject/Assets/Scenes/Material.lsn b/ExampleProject/Assets/Scenes/Material.lsn index 1091bb45..c6eb42ad 100644 --- a/ExampleProject/Assets/Scenes/Material.lsn +++ b/ExampleProject/Assets/Scenes/Material.lsn @@ -304,7 +304,7 @@ "value53": 1, "value54": { "PrimitiveType": 8, - "FilePath": "//Meshes/material_sphere/material_sphere.fbx", + "FilePath": "//Assets/Meshes/material_sphere/material_sphere.fbx", "Material": { "ptr_wrapper": { "valid": 1, @@ -353,7 +353,7 @@ "value55": 2, "value56": { "PrimitiveType": 8, - "FilePath": "//Meshes/material_sphere/material_sphere.fbx", + "FilePath": "//Assets/Meshes/material_sphere/material_sphere.fbx", "Material": { "ptr_wrapper": { "valid": 1, @@ -402,7 +402,7 @@ "value57": 3, "value58": { "PrimitiveType": 8, - "FilePath": "//Meshes/material_sphere/material_sphere.fbx", + "FilePath": "//Assets/Meshes/material_sphere/material_sphere.fbx", "Material": { "ptr_wrapper": { "valid": 1, @@ -451,7 +451,7 @@ "value59": 4, "value60": { "PrimitiveType": 8, - "FilePath": "//Meshes/material_sphere/material_sphere.fbx", + "FilePath": "//Assets/Meshes/material_sphere/material_sphere.fbx", "Material": { "ptr_wrapper": { "valid": 1, @@ -500,7 +500,7 @@ "value61": 5, "value62": { "PrimitiveType": 8, - "FilePath": "//Meshes/material_sphere/material_sphere.fbx", + "FilePath": "//Assets/Meshes/material_sphere/material_sphere.fbx", "Material": { "ptr_wrapper": { "valid": 1, @@ -549,7 +549,7 @@ "value63": 6, "value64": { "PrimitiveType": 8, - "FilePath": "//Meshes/material_sphere/material_sphere.fbx", + "FilePath": "//Assets/Meshes/material_sphere/material_sphere.fbx", "Material": { "ptr_wrapper": { "valid": 1, @@ -598,7 +598,7 @@ "value65": 7, "value66": { "PrimitiveType": 8, - "FilePath": "//Meshes/material_sphere/material_sphere.fbx", + "FilePath": "//Assets/Meshes/material_sphere/material_sphere.fbx", "Material": { "ptr_wrapper": { "valid": 1, @@ -647,7 +647,7 @@ "value67": 8, "value68": { "PrimitiveType": 8, - "FilePath": "//Meshes/material_sphere/material_sphere.fbx", + "FilePath": "//Assets/Meshes/material_sphere/material_sphere.fbx", "Material": { "ptr_wrapper": { "valid": 1, @@ -723,7 +723,7 @@ "value73": 1, "value74": 9, "value75": { - "value0": "//Textures/cubemap/Arches_E_PineTree", + "value0": "//Assets/Textures/cubemap/Arches_E_PineTree", "value1": 11, "value2": 3072, "value3": 4096, diff --git a/ExampleProject/Assets/Scenes/Physics.lsn b/ExampleProject/Assets/Scenes/Physics.lsn index 5eed1b02..eb52a60f 100755 --- a/ExampleProject/Assets/Scenes/Physics.lsn +++ b/ExampleProject/Assets/Scenes/Physics.lsn @@ -1,6 +1,6 @@ { "value0": { - "Version": 20, + "Version": 22, "Scene Name": "Physics", "PhysicsEnabled2D": true, "PhysicsEnabled3D": true, @@ -19,8 +19,8 @@ "FXAAEnabled": true, "DebandingEnabled": true, "ChromaticAberationEnabled": false, - "EyeAdaptation": true, - "SSAOEnabled": true, + "EyeAdaptation": false, + "SSAOEnabled": false, "BloomEnabled": true, "FilmicGrainEnabled": false, "DepthOfFieldEnabled": false, @@ -34,184 +34,185 @@ "value3": false }, "value1": 58, - "value2": 1048576, - "value3": 1, - "value4": 2097154, - "value5": 2097155, - "value6": 4, - "value7": 5, - "value8": 6, - "value9": 7, - "value10": 8, - "value11": 9, - "value12": 10, - "value13": 11, - "value14": 12, - "value15": 13, - "value16": 14, - "value17": 15, - "value18": 16, - "value19": 17, - "value20": 18, - "value21": 19, - "value22": 20, - "value23": 21, - "value24": 22, - "value25": 23, - "value26": 24, - "value27": 25, - "value28": 26, - "value29": 2097179, - "value30": 28, - "value31": 3145757, - "value32": 30, - "value33": 1048607, - "value34": 1048608, - "value35": 33, - "value36": 1048610, - "value37": 35, - "value38": 36, - "value39": 37, - "value40": 38, - "value41": 39, - "value42": 40, - "value43": 41, - "value44": 42, - "value45": 43, - "value46": 44, - "value47": 45, - "value48": 46, - "value49": 47, - "value50": 48, - "value51": 49, - "value52": 50, - "value53": 51, - "value54": 52, - "value55": 53, - "value56": 54, - "value57": 55, - "value58": 56, - "value59": 57, - "value60": 52, - "value61": 26, - "value62": { + "value2": 58, + "value3": 1048576, + "value4": 1, + "value5": 2097154, + "value6": 2097155, + "value7": 4, + "value8": 5, + "value9": 6, + "value10": 7, + "value11": 8, + "value12": 9, + "value13": 10, + "value14": 11, + "value15": 12, + "value16": 13, + "value17": 14, + "value18": 15, + "value19": 16, + "value20": 17, + "value21": 18, + "value22": 19, + "value23": 20, + "value24": 21, + "value25": 22, + "value26": 23, + "value27": 24, + "value28": 25, + "value29": 26, + "value30": 2097179, + "value31": 28, + "value32": 3145757, + "value33": 30, + "value34": 1048607, + "value35": 1048608, + "value36": 33, + "value37": 1048610, + "value38": 35, + "value39": 36, + "value40": 37, + "value41": 38, + "value42": 39, + "value43": 40, + "value44": 41, + "value45": 42, + "value46": 43, + "value47": 44, + "value48": 45, + "value49": 46, + "value50": 47, + "value51": 48, + "value52": 49, + "value53": 50, + "value54": 51, + "value55": 52, + "value56": 53, + "value57": 54, + "value58": 55, + "value59": 56, + "value60": 57, + "value61": 52, + "value62": 49, + "value63": { "Position": { - "value0": 0.002742767333984375, - "value1": 2.338712692260742, - "value2": 3.177652359008789 + "value0": -4.09690523147583, + "value1": 17.351110458374025, + "value2": 0.0 }, "Rotation": { - "value0": -0.26047149300575259, + "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 0.9654815196990967 + "value3": 0.9999998807907105 }, "Scale": { - "value0": 0.999993085861206, - "value1": 0.9999967813491821, - "value2": 0.9999943971633911 + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 } }, - "value63": 1, - "value64": { + "value64": 50, + "value65": { "Position": { - "value0": 0.0, - "value1": -1.5239448547363282, + "value0": -1.5656273365020753, + "value1": 17.825361251831056, "value2": 0.0 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 1.0 + "value3": 0.9999998807907105 }, "Scale": { - "value0": 200.0, - "value1": 1.0, - "value2": 200.0 + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 } }, - "value65": 28, - "value66": { + "value66": 51, + "value67": { "Position": { - "value0": 34.3039436340332, - "value1": 15.190068244934082, - "value2": 28.320514678955079 + "value0": -1.5656355619430543, + "value1": 16.815269470214845, + "value2": 0.0 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 1.0 + "value3": 0.9999998807907105 }, "Scale": { - "value0": 0.9999999403953552, - "value1": 0.9999999403953552, - "value2": 0.9999999403953552 + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 } }, - "value67": 30, - "value68": { + "value68": 52, + "value69": { "Position": { - "value0": 0.0, - "value1": 0.0, + "value0": 3.067514419555664, + "value1": 19.870115280151368, "value2": 0.0 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 1.0 + "value3": 0.9999998807907105 }, "Scale": { - "value0": 0.9999999403953552, - "value1": 0.9999999403953552, - "value2": 0.9999999403953552 + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 } }, - "value69": 4, - "value70": { + "value70": 53, + "value71": { "Position": { - "value0": 0.0, - "value1": 17.0, + "value0": -0.300402969121933, + "value1": 19.016862869262697, "value2": 0.0 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 1.0 + "value3": 0.9999998807907105 }, "Scale": { - "value0": 1.0, - "value1": 1.0, - "value2": 1.0 + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 } }, - "value71": 5, - "value72": { + "value72": 54, + "value73": { "Position": { - "value0": 1.017281413078308, - "value1": 17.0, - "value2": 0.00005555157258640975 + "value0": 8.74654483795166, + "value1": 19.018550872802736, + "value2": 0.0 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 1.0 + "value3": 0.9999998807907105 }, "Scale": { - "value0": 0.9999999403953552, - "value1": 0.9999999403953552, - "value2": 0.9999999403953552 + "value0": 0.699999988079071, + "value1": 0.699999988079071, + "value2": 0.699999988079071 } }, - "value73": 6, - "value74": { + "value74": 22, + "value75": { "Position": { - "value0": 2.0, - "value1": 17.0, + "value0": 8.0, + "value1": 18.0, "value2": 0.0 }, "Rotation": { @@ -226,11 +227,11 @@ "value2": 1.0 } }, - "value75": 7, - "value76": { + "value76": 21, + "value77": { "Position": { - "value0": 3.0, - "value1": 17.0, + "value0": 7.0, + "value1": 18.0, "value2": 0.0 }, "Rotation": { @@ -245,11 +246,11 @@ "value2": 1.0 } }, - "value77": 8, - "value78": { + "value78": 20, + "value79": { "Position": { - "value0": 4.0, - "value1": 17.0, + "value0": 6.0, + "value1": 18.0, "value2": 0.0 }, "Rotation": { @@ -264,11 +265,11 @@ "value2": 1.0 } }, - "value79": 9, - "value80": { + "value80": 19, + "value81": { "Position": { "value0": 5.0, - "value1": 17.0, + "value1": 18.0, "value2": 0.0 }, "Rotation": { @@ -283,11 +284,11 @@ "value2": 1.0 } }, - "value81": 10, - "value82": { + "value82": 18, + "value83": { "Position": { - "value0": 6.0, - "value1": 17.0, + "value0": 4.0, + "value1": 18.0, "value2": 0.0 }, "Rotation": { @@ -302,11 +303,11 @@ "value2": 1.0 } }, - "value83": 11, - "value84": { + "value84": 17, + "value85": { "Position": { - "value0": 7.0, - "value1": 17.0, + "value0": 3.0, + "value1": 18.0, "value2": 0.0 }, "Rotation": { @@ -321,11 +322,11 @@ "value2": 1.0 } }, - "value85": 12, - "value86": { + "value86": 16, + "value87": { "Position": { - "value0": 8.0, - "value1": 17.0, + "value0": 2.0, + "value1": 18.0, "value2": 0.0 }, "Rotation": { @@ -340,11 +341,11 @@ "value2": 1.0 } }, - "value87": 13, - "value88": { + "value88": 15, + "value89": { "Position": { - "value0": 9.0, - "value1": 17.0, + "value0": 1.0, + "value1": 18.0, "value2": 0.0 }, "Rotation": { @@ -359,8 +360,8 @@ "value2": 1.0 } }, - "value89": 14, - "value90": { + "value90": 14, + "value91": { "Position": { "value0": 0.0, "value1": 18.0, @@ -378,11 +379,11 @@ "value2": 1.0 } }, - "value91": 15, - "value92": { + "value92": 13, + "value93": { "Position": { - "value0": 1.0, - "value1": 18.0, + "value0": 9.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -397,11 +398,11 @@ "value2": 1.0 } }, - "value93": 16, - "value94": { + "value94": 12, + "value95": { "Position": { - "value0": 2.0, - "value1": 18.0, + "value0": 8.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -416,11 +417,11 @@ "value2": 1.0 } }, - "value95": 17, - "value96": { + "value96": 11, + "value97": { "Position": { - "value0": 3.0, - "value1": 18.0, + "value0": 7.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -435,11 +436,11 @@ "value2": 1.0 } }, - "value97": 18, - "value98": { + "value98": 10, + "value99": { "Position": { - "value0": 4.0, - "value1": 18.0, + "value0": 6.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -454,11 +455,11 @@ "value2": 1.0 } }, - "value99": 19, - "value100": { + "value100": 9, + "value101": { "Position": { "value0": 5.0, - "value1": 18.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -473,11 +474,11 @@ "value2": 1.0 } }, - "value101": 20, - "value102": { + "value102": 8, + "value103": { "Position": { - "value0": 6.0, - "value1": 18.0, + "value0": 4.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -492,11 +493,11 @@ "value2": 1.0 } }, - "value103": 21, - "value104": { + "value104": 7, + "value105": { "Position": { - "value0": 7.0, - "value1": 18.0, + "value0": 3.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -511,11 +512,11 @@ "value2": 1.0 } }, - "value105": 22, - "value106": { + "value106": 6, + "value107": { "Position": { - "value0": 8.0, - "value1": 18.0, + "value0": 2.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -530,12 +531,12 @@ "value2": 1.0 } }, - "value107": 23, - "value108": { + "value108": 5, + "value109": { "Position": { - "value0": 5.0, - "value1": 1.6939997673034669, - "value2": 2.0 + "value0": 1.017281413078308, + "value1": 17.0, + "value2": 0.00005555157258640975 }, "Rotation": { "value0": 0.0, @@ -544,35 +545,16 @@ "value3": 1.0 }, "Scale": { - "value0": 1.0000207424163819, - "value1": 1.0000123977661133, - "value2": 1.0 - } - }, - "value109": 25, - "value110": { - "Position": { - "value0": 26.0, - "value1": 22.0, - "value2": 48.5 - }, - "Rotation": { - "value0": -0.18377967178821565, - "value1": 0.2487904578447342, - "value2": 0.044185034930706027, - "value3": 0.9499346613883972 - }, - "Scale": { - "value0": 1.0000001192092896, - "value1": 0.9999997615814209, - "value2": 1.0000001192092896 + "value0": 0.9999999403953552, + "value1": 0.9999999403953552, + "value2": 0.9999999403953552 } }, - "value111": 3145757, - "value112": { + "value110": 4, + "value111": { "Position": { - "value0": -100.96780395507813, - "value1": 4.210052490234375, + "value0": 0.0, + "value1": 17.0, "value2": 0.0 }, "Rotation": { @@ -582,23 +564,23 @@ "value3": 1.0 }, "Scale": { - "value0": 6.000002384185791, - "value1": 14.199999809265137, - "value2": 200.000244140625 + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 } }, - "value113": 2097179, - "value114": { + "value112": 2097155, + "value113": { "Position": { - "value0": 89.11954498291016, - "value1": 8.354837417602539, - "value2": 0.04714982211589813 + "value0": -0.29128527641296389, + "value1": 4.3156633377075199, + "value2": 99.78291320800781 }, "Rotation": { - "value0": -0.0010500962380319834, - "value1": -0.001050095073878765, - "value2": 0.7071059942245483, - "value3": 0.7071059942245483 + "value0": 0.0, + "value1": 0.7094271779060364, + "value2": 0.0, + "value3": 0.7047786712646484 }, "Scale": { "value0": 6.0, @@ -606,8 +588,8 @@ "value2": 200.0 } }, - "value115": 2097154, - "value116": { + "value114": 2097154, + "value115": { "Position": { "value0": 0.01968160644173622, "value1": 4.281795501708984, @@ -625,30 +607,11 @@ "value2": 199.99998474121095 } }, - "value117": 2097155, - "value118": { + "value116": 1, + "value117": { "Position": { - "value0": -0.29128527641296389, - "value1": 4.3156633377075199, - "value2": 99.78291320800781 - }, - "Rotation": { "value0": 0.0, - "value1": 0.7094271779060364, - "value2": 0.0, - "value3": 0.7047786712646484 - }, - "Scale": { - "value0": 6.0, - "value1": 14.199999809265137, - "value2": 200.0 - } - }, - "value119": 1048576, - "value120": { - "Position": { - "value0": 9.0, - "value1": 18.0, + "value1": -1.5239448547363282, "value2": 0.0 }, "Rotation": { @@ -658,75 +621,18 @@ "value3": 1.0 }, "Scale": { - "value0": 1.0, + "value0": 200.0, "value1": 1.0, - "value2": 1.0 + "value2": 200.0 } }, - "value121": 1048607, - "value122": { + "value118": 1048576, + "value119": { "Position": { - "value0": -4.290985107421875, - "value1": 5.07811164855957, + "value0": 9.0, + "value1": 18.0, "value2": 0.0 }, - "Rotation": { - "value0": 0.004163129720836878, - "value1": 0.1351698637008667, - "value2": 0.0068052951246500019, - "value3": 0.9907903075218201 - }, - "Scale": { - "value0": 2.137307643890381, - "value1": 2.1373095512390138, - "value2": 2.1373074054718019 - } - }, - "value123": 33, - "value124": { - "Position": { - "value0": 35.72151184082031, - "value1": 22.028072357177736, - "value2": -40.00749969482422 - }, - "Rotation": { - "value0": -0.19185781478881837, - "value1": 0.657464861869812, - "value2": 0.7072034478187561, - "value3": 0.17548270523548127 - }, - "Scale": { - "value0": 0.9999915361404419, - "value1": 1.000016689300537, - "value2": 1.0000039339065552 - } - }, - "value125": 35, - "value126": { - "Position": { - "value0": 0.0, - "value1": -0.8354345560073853, - "value2": 76.22335815429688 - }, - "Rotation": { - "value0": 0.0, - "value1": 0.0, - "value2": 0.0, - "value3": 0.9999999403953552 - }, - "Scale": { - "value0": 0.9999998211860657, - "value1": 0.9999998211860657, - "value2": 0.9999998211860657 - } - }, - "value127": 36, - "value128": { - "Position": { - "value0": 0.0, - "value1": 2.349538803100586, - "value2": -0.00330352783203125 - }, "Rotation": { "value0": 0.0, "value1": 0.0, @@ -739,27 +645,8 @@ "value2": 1.0 } }, - "value129": 37, - "value130": { - "Position": { - "value0": -36.72534942626953, - "value1": 16.028718948364259, - "value2": 22.700944900512697 - }, - "Rotation": { - "value0": 0.0, - "value1": 0.0, - "value2": 0.0, - "value3": 1.0 - }, - "Scale": { - "value0": 0.9999998807907105, - "value1": 0.9999998211860657, - "value2": 0.9999997615814209 - } - }, - "value131": 38, - "value132": { + "value120": 38, + "value121": { "Position": { "value0": 98.88309478759766, "value1": 4.266810894012451, @@ -777,8 +664,8 @@ "value2": 200.0 } }, - "value133": 39, - "value134": { + "value122": 39, + "value123": { "Position": { "value0": 74.57472229003906, "value1": -0.869247317314148, @@ -796,8 +683,8 @@ "value2": 200.0 } }, - "value135": 40, - "value136": { + "value124": 40, + "value125": { "Position": { "value0": -15.478693962097168, "value1": 0.0, @@ -815,8 +702,8 @@ "value2": 0.9999998807907105 } }, - "value137": 41, - "value138": { + "value126": 41, + "value127": { "Position": { "value0": -29.563642501831056, "value1": 0.0, @@ -834,8 +721,8 @@ "value2": 1.0000109672546387 } }, - "value139": 42, - "value140": { + "value128": 42, + "value129": { "Position": { "value0": -14.91064453125, "value1": 0.0, @@ -853,8 +740,8 @@ "value2": 0.9999999403953552 } }, - "value141": 43, - "value142": { + "value130": 43, + "value131": { "Position": { "value0": -25.742326736450197, "value1": 0.0, @@ -872,8 +759,8 @@ "value2": 0.9999999403953552 } }, - "value143": 44, - "value144": { + "value132": 44, + "value133": { "Position": { "value0": 0.0, "value1": 1.0257916450500489, @@ -891,8 +778,8 @@ "value2": 0.9999999403953552 } }, - "value145": 45, - "value146": { + "value134": 45, + "value135": { "Position": { "value0": 16.0, "value1": 0.6939997673034668, @@ -910,8 +797,8 @@ "value2": 1.0000007152557374 } }, - "value147": 46, - "value148": { + "value136": 46, + "value137": { "Position": { "value0": 13.0, "value1": 0.6939997673034668, @@ -929,8 +816,8 @@ "value2": 1.0000007152557374 } }, - "value149": 47, - "value150": { + "value138": 47, + "value139": { "Position": { "value0": -2.8255271911621095, "value1": 9.712101936340332, @@ -948,8 +835,8 @@ "value2": 1.0 } }, - "value151": 48, - "value152": { + "value140": 48, + "value141": { "Position": { "value0": -36.306640625, "value1": 4.499866485595703, @@ -967,685 +854,799 @@ "value2": 1.0 } }, - "value153": 49, - "value154": { + "value142": 37, + "value143": { "Position": { - "value0": -4.09690523147583, - "value1": 17.351110458374025, - "value2": 0.0 + "value0": -36.72534942626953, + "value1": 16.028718948364259, + "value2": 22.700944900512697 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 0.9999998807907105 + "value3": 1.0 }, "Scale": { - "value0": 0.699999988079071, - "value1": 0.699999988079071, - "value2": 0.699999988079071 + "value0": 0.9999998807907105, + "value1": 0.9999998211860657, + "value2": 0.9999997615814209 } }, - "value155": 50, - "value156": { + "value144": 26, + "value145": { "Position": { - "value0": -1.5656273365020753, - "value1": 17.825361251831056, + "value0": 0.002742767333984375, + "value1": 2.338712692260742, + "value2": 3.177652359008789 + }, + "Rotation": { + "value0": -0.26047149300575259, + "value1": 0.0, + "value2": 0.0, + "value3": 0.9654815196990967 + }, + "Scale": { + "value0": 0.999993085861206, + "value1": 0.9999967813491821, + "value2": 0.9999943971633911 + } + }, + "value146": 1048607, + "value147": { + "Position": { + "value0": -4.290985107421875, + "value1": 5.07811164855957, "value2": 0.0 }, + "Rotation": { + "value0": 0.004163129720836878, + "value1": 0.1351698637008667, + "value2": 0.0068052951246500019, + "value3": 0.9907903075218201 + }, + "Scale": { + "value0": 2.137307643890381, + "value1": 2.1373095512390138, + "value2": 2.1373074054718019 + } + }, + "value148": 33, + "value149": { + "Position": { + "value0": 35.72151184082031, + "value1": 22.028072357177736, + "value2": -40.00749969482422 + }, + "Rotation": { + "value0": -0.19185781478881837, + "value1": 0.657464861869812, + "value2": 0.7072034478187561, + "value3": 0.17548270523548127 + }, + "Scale": { + "value0": 0.9999915361404419, + "value1": 1.000016689300537, + "value2": 1.0000039339065552 + } + }, + "value150": 28, + "value151": { + "Position": { + "value0": 34.3039436340332, + "value1": 15.190068244934082, + "value2": 28.320514678955079 + }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 0.9999998807907105 + "value3": 1.0 }, "Scale": { - "value0": 0.699999988079071, - "value1": 0.699999988079071, - "value2": 0.699999988079071 + "value0": 0.9999999403953552, + "value1": 0.9999999403953552, + "value2": 0.9999999403953552 } }, - "value157": 51, - "value158": { + "value152": 30, + "value153": { "Position": { - "value0": -1.5656355619430543, - "value1": 16.815269470214845, + "value0": 0.0, + "value1": 0.0, "value2": 0.0 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 0.9999998807907105 + "value3": 1.0 }, "Scale": { - "value0": 0.699999988079071, - "value1": 0.699999988079071, - "value2": 0.699999988079071 + "value0": 0.9999999403953552, + "value1": 0.9999999403953552, + "value2": 0.9999999403953552 } }, - "value159": 52, - "value160": { + "value154": 35, + "value155": { "Position": { - "value0": 3.067514419555664, - "value1": 19.870115280151368, - "value2": 0.0 + "value0": 0.0, + "value1": -0.8354345560073853, + "value2": 76.22335815429688 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 0.9999998807907105 + "value3": 0.9999999403953552 }, "Scale": { - "value0": 0.699999988079071, - "value1": 0.699999988079071, - "value2": 0.699999988079071 + "value0": 0.9999998211860657, + "value1": 0.9999998211860657, + "value2": 0.9999998211860657 } }, - "value161": 53, - "value162": { + "value156": 3145757, + "value157": { "Position": { - "value0": -0.300402969121933, - "value1": 19.016862869262697, + "value0": -100.96780395507813, + "value1": 4.210052490234375, "value2": 0.0 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 0.9999998807907105 + "value3": 1.0 }, "Scale": { - "value0": 0.699999988079071, - "value1": 0.699999988079071, - "value2": 0.699999988079071 + "value0": 6.000002384185791, + "value1": 14.199999809265137, + "value2": 200.000244140625 } }, - "value163": 54, - "value164": { + "value158": 2097179, + "value159": { "Position": { - "value0": 8.74654483795166, - "value1": 19.018550872802736, - "value2": 0.0 + "value0": 89.11954498291016, + "value1": 8.354837417602539, + "value2": 0.04714982211589813 + }, + "Rotation": { + "value0": -0.0010500962380319834, + "value1": -0.001050095073878765, + "value2": 0.7071059942245483, + "value3": 0.7071059942245483 + }, + "Scale": { + "value0": 6.0, + "value1": 14.199999809265137, + "value2": 200.0 + } + }, + "value160": 25, + "value161": { + "Position": { + "value0": 26.0, + "value1": 22.0, + "value2": 48.5 + }, + "Rotation": { + "value0": -0.18377967178821565, + "value1": 0.2487904578447342, + "value2": 0.044185034930706027, + "value3": 0.9499346613883972 + }, + "Scale": { + "value0": 1.0000001192092896, + "value1": 0.9999997615814209, + "value2": 1.0000001192092896 + } + }, + "value162": 36, + "value163": { + "Position": { + "value0": 0.0, + "value1": 2.349538803100586, + "value2": -0.00330352783203125 }, "Rotation": { "value0": 0.0, "value1": 0.0, "value2": 0.0, - "value3": 0.9999998807907105 + "value3": 1.0 }, "Scale": { - "value0": 0.699999988079071, - "value1": 0.699999988079071, - "value2": 0.699999988079071 + "value0": 1.0, + "value1": 1.0, + "value2": 1.0 + } + }, + "value164": 23, + "value165": { + "Position": { + "value0": 5.0, + "value1": 1.6939997673034669, + "value2": 2.0 + }, + "Rotation": { + "value0": 0.0, + "value1": 0.0, + "value2": 0.0, + "value3": 1.0 + }, + "Scale": { + "value0": 1.0000207424163819, + "value1": 1.0000123977661133, + "value2": 1.0 } }, - "value165": 46, - "value166": 30, - "value167": { + "value166": 46, + "value167": 30, + "value168": { "Name": "Spheres" }, - "value168": 1, - "value169": { + "value169": 1, + "value170": { "Name": "Ground" }, - "value170": 28, - "value171": { + "value171": 28, + "value172": { "Name": "Cat" }, - "value172": 4, - "value173": { + "value173": 4, + "value174": { "Name": "Sphere0" }, - "value174": 5, - "value175": { + "value175": 5, + "value176": { "Name": "Sphere1" }, - "value176": 6, - "value177": { + "value177": 6, + "value178": { "Name": "Sphere2" }, - "value178": 7, - "value179": { + "value179": 7, + "value180": { "Name": "Sphere3" }, - "value180": 8, - "value181": { + "value181": 8, + "value182": { "Name": "Sphere4" }, - "value182": 9, - "value183": { + "value183": 9, + "value184": { "Name": "Sphere5" }, - "value184": 10, - "value185": { + "value185": 10, + "value186": { "Name": "Sphere6" }, - "value186": 11, - "value187": { + "value187": 11, + "value188": { "Name": "Sphere7" }, - "value188": 12, - "value189": { + "value189": 12, + "value190": { "Name": "Sphere8" }, - "value190": 13, - "value191": { + "value191": 13, + "value192": { "Name": "Sphere9" }, - "value192": 14, - "value193": { + "value193": 14, + "value194": { "Name": "Sphere10" }, - "value194": 15, - "value195": { + "value195": 15, + "value196": { "Name": "Sphere11" }, - "value196": 16, - "value197": { + "value197": 16, + "value198": { "Name": "Sphere12" }, - "value198": 17, - "value199": { + "value199": 17, + "value200": { "Name": "Sphere13" }, - "value200": 18, - "value201": { + "value201": 18, + "value202": { "Name": "Sphere14" }, - "value202": 19, - "value203": { + "value203": 19, + "value204": { "Name": "Sphere15" }, - "value204": 20, - "value205": { + "value205": 20, + "value206": { "Name": "Sphere16" }, - "value206": 21, - "value207": { + "value207": 21, + "value208": { "Name": "Sphere17" }, - "value208": 22, - "value209": { + "value209": 22, + "value210": { "Name": "Sphere18" }, - "value210": 23, - "value211": { + "value211": 23, + "value212": { "Name": "Capsule" }, - "value212": 24, - "value213": { + "value213": 24, + "value214": { "Name": "Environment" }, - "value214": 25, - "value215": { + "value215": 25, + "value216": { "Name": "Light" }, - "value216": 26, - "value217": { + "value217": 26, + "value218": { "Name": "Camera" }, - "value218": 1048608, - "value219": { + "value219": 1048608, + "value220": { "Name": "Projectile" }, - "value220": 1048576, - "value221": { + "value221": 1048576, + "value222": { "Name": "Sphere19" }, - "value222": 35, - "value223": { + "value223": 35, + "value224": { "Name": "Bonfire" }, - "value224": 36, - "value225": { + "value225": 36, + "value226": { "Name": "Light" }, - "value226": 37, - "value227": { + "value227": 37, + "value228": { "Name": "Player" }, - "value228": 40, - "value229": { + "value229": 40, + "value230": { "Name": "Cube" }, - "value230": 41, - "value231": { + "value231": 41, + "value232": { "Name": "Cube" }, - "value232": 42, - "value233": { + "value233": 42, + "value234": { "Name": "Cube" }, - "value234": 43, - "value235": { + "value235": 43, + "value236": { "Name": "Sphere" }, - "value236": 44, - "value237": { + "value237": 44, + "value238": { "Name": "Capsule" }, - "value238": 45, - "value239": { + "value239": 45, + "value240": { "Name": "Capsule" }, - "value240": 46, - "value241": { + "value241": 46, + "value242": { "Name": "Capsule" }, - "value242": 47, - "value243": { + "value243": 47, + "value244": { "Name": "light Cube" }, - "value244": 48, - "value245": { + "value245": 48, + "value246": { "Name": "light Cube" }, - "value246": 1048607, - "value247": { + "value247": 1048607, + "value248": { "Name": "DamagedHelmet" }, - "value248": 55, - "value249": { + "value249": 55, + "value250": { "Name": "Sky" }, - "value250": 56, - "value251": { + "value251": 56, + "value252": { "Name": "TestArea" }, - "value252": 33, - "value253": { + "value253": 33, + "value254": { "Name": "TestGLTFModel" }, - "value254": 1048610, - "value255": { + "value255": 1048610, + "value256": { "Name": "TestAudio" }, - "value256": 57, - "value257": { + "value257": 57, + "value258": { "Name": "Capsules" }, - "value258": 4, - "value259": 41, - "value260": { + "value259": 4, + "value260": 41, + "value261": { "Active": true }, - "value261": 40, - "value262": { + "value262": 40, + "value263": { "Active": true }, - "value263": 42, - "value264": { + "value264": 42, + "value265": { "Active": true }, - "value265": 3145757, - "value266": { + "value266": 3145757, + "value267": { "Active": true }, - "value267": 51, - "value268": 1048576, - "value269": { + "value268": 51, + "value269": 1048576, + "value270": { "First": 1048575, "Next": 49, "Previous": 4, "Parent": 30 }, - "value270": 30, - "value271": { + "value271": 30, + "value272": { "First": 22, "Next": 1048575, "Previous": 1048575, "Parent": 1048575 }, - "value272": 22, - "value273": { + "value273": 22, + "value274": { "First": 1048575, "Next": 21, "Previous": 1048575, "Parent": 30 }, - "value274": 21, - "value275": { + "value275": 21, + "value276": { "First": 1048575, "Next": 20, "Previous": 22, "Parent": 30 }, - "value276": 20, - "value277": { + "value277": 20, + "value278": { "First": 1048575, "Next": 19, "Previous": 21, "Parent": 30 }, - "value278": 19, - "value279": { + "value279": 19, + "value280": { "First": 1048575, "Next": 18, "Previous": 20, "Parent": 30 }, - "value280": 18, - "value281": { + "value281": 18, + "value282": { "First": 1048575, "Next": 17, "Previous": 19, "Parent": 30 }, - "value282": 17, - "value283": { + "value283": 17, + "value284": { "First": 1048575, "Next": 16, "Previous": 18, "Parent": 30 }, - "value284": 16, - "value285": { + "value285": 16, + "value286": { "First": 1048575, "Next": 14, "Previous": 17, "Parent": 30 }, - "value286": 1048608, - "value287": { + "value287": 1048608, + "value288": { "First": 1048575, "Next": 1048575, "Previous": 26, "Parent": 37 }, - "value288": 14, - "value289": { + "value289": 14, + "value290": { "First": 1048575, "Next": 13, "Previous": 16, "Parent": 30 }, - "value290": 13, - "value291": { + "value291": 13, + "value292": { "First": 1048575, "Next": 12, "Previous": 14, "Parent": 30 }, - "value292": 12, - "value293": { + "value293": 12, + "value294": { "First": 1048575, "Next": 11, "Previous": 13, "Parent": 30 }, - "value294": 11, - "value295": { + "value295": 11, + "value296": { "First": 1048575, "Next": 10, "Previous": 12, "Parent": 30 }, - "value296": 10, - "value297": { + "value297": 10, + "value298": { "First": 1048575, "Next": 9, "Previous": 11, "Parent": 30 }, - "value298": 9, - "value299": { + "value299": 9, + "value300": { "First": 1048575, "Next": 8, "Previous": 10, "Parent": 30 }, - "value300": 8, - "value301": { + "value301": 8, + "value302": { "First": 1048575, "Next": 7, "Previous": 9, "Parent": 30 }, - "value302": 7, - "value303": { + "value303": 7, + "value304": { "First": 1048575, "Next": 6, "Previous": 8, "Parent": 30 }, - "value304": 6, - "value305": { + "value305": 6, + "value306": { "First": 1048575, "Next": 5, "Previous": 7, "Parent": 30 }, - "value306": 5, - "value307": { + "value307": 5, + "value308": { "First": 1048575, "Next": 4, "Previous": 6, "Parent": 30 }, - "value308": 4, - "value309": { + "value309": 4, + "value310": { "First": 1048575, "Next": 1048576, "Previous": 5, "Parent": 30 }, - "value310": 36, - "value311": { + "value311": 36, + "value312": { "First": 1048575, "Next": 1048575, "Previous": 1048575, "Parent": 35 }, - "value312": 35, - "value313": { + "value313": 35, + "value314": { "First": 36, "Next": 1048575, "Previous": 1048575, "Parent": 1048575 }, - "value314": 26, - "value315": { + "value315": 26, + "value316": { "First": 1048575, "Next": 1048608, "Previous": 1048575, "Parent": 37 }, - "value316": 37, - "value317": { + "value317": 37, + "value318": { "First": 26, "Next": 1048575, "Previous": 1048575, "Parent": 1048575 }, - "value318": 40, - "value319": { + "value319": 40, + "value320": { "First": 42, "Next": 1048575, "Previous": 1048575, "Parent": 41 }, - "value320": 41, - "value321": { + "value321": 41, + "value322": { "First": 40, "Next": 1048575, "Previous": 1048575, "Parent": 1048575 }, - "value322": 42, - "value323": { + "value323": 42, + "value324": { "First": 1048575, "Next": 1048575, "Previous": 1048575, "Parent": 40 }, - "value324": 49, - "value325": { + "value325": 49, + "value326": { "First": 1048575, "Next": 50, "Previous": 1048576, "Parent": 30 }, - "value326": 50, - "value327": { + "value327": 50, + "value328": { "First": 1048575, "Next": 51, "Previous": 49, "Parent": 30 }, - "value328": 51, - "value329": { + "value329": 51, + "value330": { "First": 1048575, "Next": 52, "Previous": 50, "Parent": 30 }, - "value330": 52, - "value331": { + "value331": 52, + "value332": { "First": 1048575, "Next": 53, "Previous": 51, "Parent": 30 }, - "value332": 53, - "value333": { + "value333": 53, + "value334": { "First": 1048575, "Next": 54, "Previous": 52, "Parent": 30 }, - "value334": 54, - "value335": { + "value335": 54, + "value336": { "First": 1048575, "Next": 15, "Previous": 53, "Parent": 30 }, - "value336": 25, - "value337": { + "value337": 25, + "value338": { "First": 1048575, "Next": 1048575, "Previous": 24, "Parent": 55 }, - "value338": 24, - "value339": { + "value339": 24, + "value340": { "First": 1048575, "Next": 25, "Previous": 1048575, "Parent": 55 }, - "value340": 55, - "value341": { + "value341": 55, + "value342": { "First": 24, "Next": 1048575, "Previous": 1048575, "Parent": 1048575 }, - "value342": 1, - "value343": { + "value343": 1, + "value344": { "First": 1048575, "Next": 2097154, "Previous": 1048575, "Parent": 56 }, - "value344": 56, - "value345": { + "value345": 56, + "value346": { "First": 1, "Next": 1048575, "Previous": 1048575, "Parent": 1048575 }, - "value346": 2097154, - "value347": { + "value347": 2097154, + "value348": { "First": 1048575, "Next": 39, "Previous": 1, "Parent": 56 }, - "value348": 39, - "value349": { + "value349": 39, + "value350": { "First": 1048575, "Next": 38, "Previous": 2097154, "Parent": 56 }, - "value350": 38, - "value351": { + "value351": 38, + "value352": { "First": 1048575, "Next": 3145757, "Previous": 39, "Parent": 56 }, - "value352": 3145757, - "value353": { + "value353": 3145757, + "value354": { "First": 1048575, "Next": 2097155, "Previous": 38, "Parent": 56 }, - "value354": 2097155, - "value355": { + "value355": 2097155, + "value356": { "First": 1048575, "Next": 2097179, "Previous": 3145757, "Parent": 56 }, - "value356": 2097179, - "value357": { + "value357": 2097179, + "value358": { "First": 1048575, "Next": 1048575, "Previous": 2097155, "Parent": 56 }, - "value358": 15, - "value359": { + "value359": 15, + "value360": { "First": 1048575, "Next": 1048575, "Previous": 54, "Parent": 30 }, - "value360": 23, - "value361": { + "value361": 23, + "value362": { "First": 1048575, "Next": 44, "Previous": 1048575, "Parent": 57 }, - "value362": 57, - "value363": { + "value363": 57, + "value364": { "First": 23, "Next": 1048575, "Previous": 1048575, "Parent": 1048575 }, - "value364": 44, - "value365": { + "value365": 44, + "value366": { "First": 1048575, "Next": 45, "Previous": 23, "Parent": 57 }, - "value366": 45, - "value367": { + "value367": 45, + "value368": { "First": 1048575, "Next": 46, "Previous": 44, "Parent": 57 }, - "value368": 46, - "value369": { + "value369": 46, + "value370": { "First": 1048575, "Next": 1048575, "Previous": 45, "Parent": 57 }, - "value370": 1, - "value371": 26, - "value372": { + "value371": 1, + "value372": 26, + "value373": { "Scale": 1.0, - "Aspect": 0.8098591566085815, + "Aspect": 0.7063711881637573, "FOV": 60.0, "Near": 0.10000000149011612, "Far": 1000.0, @@ -1653,23 +1654,23 @@ "ShutterSpeed": 0.01666666753590107, "Sensitivity": 400.0 }, - "value373": 3, - "value374": 1048608, - "value375": { - "FilePath": "//Scripts/Projectile.lua" + "value374": 3, + "value375": 1048608, + "value376": { + "FilePath": "//Assets/Scripts/Projectile.lua" }, - "value376": 36, - "value377": { - "FilePath": "//Scripts/Script.lua" + "value377": 36, + "value378": { + "FilePath": "//Assets/Scripts/Script.lua" }, - "value378": 37, - "value379": { - "FilePath": "//Scripts/Script(1).lua" + "value379": 37, + "value380": { + "FilePath": "//Assets/Scripts/Script(1).lua" }, - "value380": 0, - "value381": 4, - "value382": 25, - "value383": { + "value381": 0, + "value382": 4, + "value383": 25, + "value384": { "value0": { "value0": 26.0, "value1": 22.0, @@ -1693,8 +1694,8 @@ "value5": 120000.0, "value6": 1.0 }, - "value384": 36, - "value385": { + "value385": 36, + "value386": { "value0": { "value0": 0.0, "value1": 1.5141037702560425, @@ -1718,8 +1719,8 @@ "value5": 500000.0, "value6": 10.0 }, - "value386": 47, - "value387": { + "value387": 47, + "value388": { "value0": { "value0": -2.8255271911621095, "value1": 9.712101936340332, @@ -1743,8 +1744,8 @@ "value5": 120000.0, "value6": 17.015546798706056 }, - "value388": 48, - "value389": { + "value389": 48, + "value390": { "value0": { "value0": -36.306640625, "value1": 4.499866485595703, @@ -1768,11 +1769,11 @@ "value5": 120000.0, "value6": 28.037296295166017 }, - "value390": 14, - "value391": 1, - "value392": { + "value391": 14, + "value392": 1, + "value393": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": -0.09662866592407227, "value1": -1.5239448547363282, @@ -1823,13 +1824,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 18324315362260599196 } }, - "value393": 3145757, - "value394": { + "value394": 3145757, + "value395": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": -100.96780395507813, "value1": 4.210052490234375, @@ -1879,13 +1881,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 18034957781773796839 } }, - "value395": 2097179, - "value396": { + "value396": 2097179, + "value397": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": 89.11954498291016, "value1": 8.354837417602539, @@ -1935,13 +1938,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 13921465269714392457 } }, - "value397": 2097154, - "value398": { + "value398": 2097154, + "value399": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": 0.01968160644173622, "value1": 4.281795501708984, @@ -1991,13 +1995,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 17562730542721569670 } }, - "value399": 2097155, - "value400": { + "value400": 2097155, + "value401": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": -0.29128527641296389, "value1": 4.3156633377075199, @@ -2047,13 +2052,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 6437159088633846853 } }, - "value401": 23, - "value402": { + "value402": 23, + "value403": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": 5.0, "value1": 1.6939997673034669, @@ -2101,13 +2107,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 11633079189898300397 } }, - "value403": 37, - "value404": { + "value404": 37, + "value405": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": -36.72534942626953, "value1": 16.028718948364259, @@ -2154,13 +2161,14 @@ } }, "Trigger": false, - "AngularFactor": 0.0 + "AngularFactor": 0.0, + "UUID": 5839371535505720992 } }, - "value405": 38, - "value406": { + "value406": 38, + "value407": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": 98.88309478759766, "value1": 4.266810894012451, @@ -2210,13 +2218,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 17971526507790220447 } }, - "value407": 39, - "value408": { + "value408": 39, + "value409": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": 74.57472229003906, "value1": -0.869247317314148, @@ -2266,13 +2275,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 16998491185869658975 } }, - "value409": 44, - "value410": { + "value410": 44, + "value411": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": 0.0, "value1": 1.0257916450500489, @@ -2319,13 +2329,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 7543680007313057040 } }, - "value411": 45, - "value412": { + "value412": 45, + "value413": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": 16.0, "value1": 0.6939997673034668, @@ -2372,13 +2383,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 11420491490819571272 } }, - "value413": 46, - "value414": { + "value414": 46, + "value415": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": 13.0, "value1": 0.6939997673034668, @@ -2425,13 +2437,14 @@ } }, "Trigger": false, - "AngularFactor": 0.0 + "AngularFactor": 0.0, + "UUID": 2533852046872492880 } }, - "value415": 47, - "value416": { + "value416": 47, + "value417": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": -2.8255271911621095, "value1": 9.712101936340332, @@ -2481,13 +2494,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 17538674107823511781 } }, - "value417": 48, - "value418": { + "value418": 48, + "value419": { "value0": { - "Version": 1, + "Version": 2, "Position": { "value0": -36.306640625, "value1": 4.499866485595703, @@ -2537,13 +2551,14 @@ } }, "Trigger": false, - "AngularFactor": 1.0 + "AngularFactor": 1.0, + "UUID": 15141402071203317348 } }, - "value419": 1, - "value420": 24, - "value421": { - "value0": "//Textures/cubemap/noga", + "value420": 1, + "value421": 24, + "value422": { + "value0": "//Assets/Textures/cubemap/noga", "value1": 11, "value2": 3072, "value3": 4096, @@ -2557,17 +2572,17 @@ "value3": 0.0 } }, - "value422": 0, "value423": 0, - "value424": 1, - "value425": 26, - "value426": { + "value424": 0, + "value425": 1, + "value426": 26, + "value427": { "ControllerType": 1 }, - "value427": 1, - "value428": 28, - "value429": { - "TexturePath": "//Textures/cat.png", + "value428": 1, + "value429": 28, + "value430": { + "TexturePath": "//Assets/Textures/cat.png", "Position": { "value0": 0.0, "value1": 0.0 @@ -2609,111 +2624,112 @@ } }, { - "key": "RunUp", + "key": "RunLeft", "value": { "PlayMode": 0, "Frames": [ { "value0": 0.0, - "value1": 64.0 + "value1": 96.0 }, { "value0": 32.0, - "value1": 64.0 + "value1": 96.0 }, { "value0": 64.0, - "value1": 64.0 + "value1": 96.0 }, { "value0": 96.0, - "value1": 64.0 + "value1": 96.0 } ], "FrameDuration": 0.10000000149011612 } }, { - "key": "RunRight", + "key": "RunUp", "value": { "PlayMode": 0, "Frames": [ { "value0": 0.0, - "value1": 32.0 + "value1": 64.0 }, { "value0": 32.0, - "value1": 32.0 + "value1": 64.0 }, { "value0": 64.0, - "value1": 32.0 + "value1": 64.0 }, { "value0": 96.0, - "value1": 32.0 + "value1": 64.0 } ], "FrameDuration": 0.10000000149011612 } }, { - "key": "RunLeft", + "key": "Sleep", "value": { "PlayMode": 0, "Frames": [ { "value0": 0.0, - "value1": 96.0 + "value1": 192.0 }, { "value0": 32.0, - "value1": 96.0 + "value1": 192.0 }, { "value0": 64.0, - "value1": 96.0 + "value1": 192.0 }, { "value0": 96.0, - "value1": 96.0 + "value1": 192.0 } ], "FrameDuration": 0.10000000149011612 } }, { - "key": "Sleep", + "key": "RunRight", "value": { "PlayMode": 0, "Frames": [ { "value0": 0.0, - "value1": 192.0 + "value1": 32.0 }, { "value0": 32.0, - "value1": 192.0 + "value1": 32.0 }, { "value0": 64.0, - "value1": 192.0 + "value1": 32.0 }, { "value0": 96.0, - "value1": 192.0 + "value1": 32.0 } ], "FrameDuration": 0.10000000149011612 } } ], - "State": "RunRight" + "State": "RunRight", + "value0": 32 }, - "value430": 2, - "value431": 35, - "value432": { + "value431": 2, + "value432": 35, + "value433": { "value0": { "Position": { "value0": 0.0, @@ -2738,8 +2754,8 @@ "RollOffFactor": 6.0 } }, - "value433": 1048610, - "value434": { + "value434": 1048610, + "value435": { "value0": { "Position": { "value0": 0.10000000149011612, @@ -2760,251 +2776,251 @@ "Global": false, "TimeLeft": 120000.0, "Stationary": false, - "SoundNodePath": "//Sounds/ambientguitar.ogg", + "SoundNodePath": "//Assets/Sounds/ambientguitar.ogg", "RollOffFactor": 6.0 } }, - "value435": 1, - "value436": 26, - "value437": { + "value436": 1, + "value437": 26, + "value438": { "enabled": true }, - "value438": 58, - "value439": 36, - "value440": { + "value439": 58, + "value440": 36, + "value441": { "value0": 7142670811742260938 }, - "value441": 35, - "value442": { + "value442": 35, + "value443": { "value0": 11107416043673070741 }, - "value443": 1048610, - "value444": { + "value444": 1048610, + "value445": { "value0": 11900723286469007770 }, - "value445": 33, - "value446": { + "value446": 33, + "value447": { "value0": 7359062324725864355 }, - "value447": 1048608, - "value448": { + "value448": 1048608, + "value449": { "value0": 7055554476232666375 }, - "value449": 1048607, - "value450": { + "value450": 1048607, + "value451": { "value0": 17970324625984215606 }, - "value451": 30, - "value452": { + "value452": 30, + "value453": { "value0": 8167269343774118827 }, - "value453": 3145757, - "value454": { + "value454": 3145757, + "value455": { "value0": 17779826851189947480 }, - "value455": 28, - "value456": { + "value456": 28, + "value457": { "value0": 14937591263949305246 }, - "value457": 2097179, - "value458": { + "value458": 2097179, + "value459": { "value0": 7640771210261002049 }, - "value459": 26, - "value460": { + "value460": 26, + "value461": { "value0": 2839679583992163695 }, - "value461": 25, - "value462": { + "value462": 25, + "value463": { "value0": 15488722931219541607 }, - "value463": 24, - "value464": { + "value464": 24, + "value465": { "value0": 6226202769161346132 }, - "value465": 23, - "value466": { + "value466": 23, + "value467": { "value0": 7098989048976045174 }, - "value467": 22, - "value468": { + "value468": 22, + "value469": { "value0": 3439171724646251554 }, - "value469": 21, - "value470": { + "value470": 21, + "value471": { "value0": 16956239776263133194 }, - "value471": 20, - "value472": { + "value472": 20, + "value473": { "value0": 1990762703427919633 }, - "value473": 19, - "value474": { + "value474": 19, + "value475": { "value0": 423835867410576946 }, - "value475": 18, - "value476": { + "value476": 18, + "value477": { "value0": 11891685876785498577 }, - "value477": 17, - "value478": { + "value478": 17, + "value479": { "value0": 7067971027685025311 }, - "value479": 16, - "value480": { + "value480": 16, + "value481": { "value0": 233959796952139788 }, - "value481": 15, - "value482": { + "value482": 15, + "value483": { "value0": 14159927372598275186 }, - "value483": 14, - "value484": { + "value484": 14, + "value485": { "value0": 4435898066759924372 }, - "value485": 13, - "value486": { + "value486": 13, + "value487": { "value0": 3179284270372788909 }, - "value487": 12, - "value488": { + "value488": 12, + "value489": { "value0": 4586489471220893352 }, - "value489": 11, - "value490": { + "value490": 11, + "value491": { "value0": 12681453495343578024 }, - "value491": 10, - "value492": { + "value492": 10, + "value493": { "value0": 18014480495500914400 }, - "value493": 9, - "value494": { + "value494": 9, + "value495": { "value0": 9295814637906071280 }, - "value495": 8, - "value496": { + "value496": 8, + "value497": { "value0": 2152489098297605661 }, - "value497": 7, - "value498": { + "value498": 7, + "value499": { "value0": 4327025743306843849 }, - "value499": 6, - "value500": { + "value500": 6, + "value501": { "value0": 11046028634673225913 }, - "value501": 5, - "value502": { + "value502": 5, + "value503": { "value0": 7714213696942504533 }, - "value503": 4, - "value504": { + "value504": 4, + "value505": { "value0": 8008364231059824527 }, - "value505": 2097155, - "value506": { + "value506": 2097155, + "value507": { "value0": 18193252195915204467 }, - "value507": 2097154, - "value508": { + "value508": 2097154, + "value509": { "value0": 6603296929366748979 }, - "value509": 1, - "value510": { + "value510": 1, + "value511": { "value0": 9645706349408193021 }, - "value511": 1048576, - "value512": { + "value512": 1048576, + "value513": { "value0": 13961618126954569495 }, - "value513": 37, - "value514": { + "value514": 37, + "value515": { "value0": 12672391254482586722 }, - "value515": 38, - "value516": { + "value516": 38, + "value517": { "value0": 3185688625544513382 }, - "value517": 39, - "value518": { + "value518": 39, + "value519": { "value0": 478815009451712139 }, - "value519": 40, - "value520": { + "value520": 40, + "value521": { "value0": 16680644448984634936 }, - "value521": 41, - "value522": { + "value522": 41, + "value523": { "value0": 4838390566280914159 }, - "value523": 42, - "value524": { + "value524": 42, + "value525": { "value0": 16722696764297374778 }, - "value525": 43, - "value526": { + "value526": 43, + "value527": { "value0": 8076439804870629473 }, - "value527": 44, - "value528": { + "value528": 44, + "value529": { "value0": 2922988186484868607 }, - "value529": 45, - "value530": { + "value530": 45, + "value531": { "value0": 17620835260008345330 }, - "value531": 46, - "value532": { + "value532": 46, + "value533": { "value0": 16262140283655929216 }, - "value533": 47, - "value534": { + "value534": 47, + "value535": { "value0": 17900231230883469521 }, - "value535": 48, - "value536": { + "value536": 48, + "value537": { "value0": 6273149985837589589 }, - "value537": 49, - "value538": { + "value538": 49, + "value539": { "value0": 17413202261215926371 }, - "value539": 50, - "value540": { + "value540": 50, + "value541": { "value0": 24088390834734939 }, - "value541": 51, - "value542": { + "value542": 51, + "value543": { "value0": 4055617899937532868 }, - "value543": 52, - "value544": { + "value544": 52, + "value545": { "value0": 11267442642228032682 }, - "value545": 53, - "value546": { + "value546": 53, + "value547": { "value0": 1271265202659808170 }, - "value547": 54, - "value548": { + "value548": 54, + "value549": { "value0": 1493189173168838353 }, - "value549": 55, - "value550": { + "value550": 55, + "value551": { "value0": 4838382540867006819 }, - "value551": 56, - "value552": { + "value552": 56, + "value553": { "value0": 9875205724687178906 }, - "value553": 57, - "value554": { + "value554": 57, + "value555": { "value0": 14459952198224781056 }, - "value555": 40, - "value556": 35, - "value557": { + "value556": 40, + "value557": 35, + "value558": { "PrimitiveType": 8, "FilePath": "//Assets/Meshes/lowpoly_bonfire/scene.gltf", "Material": { @@ -3034,16 +3050,16 @@ "emissiveMapFactor": 1.0, "alphaCutOff": 0.4000000059604645, "workflow": 1.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value558": 33, - "value559": { + "value559": 33, + "value560": { "PrimitiveType": 8, - "FilePath": "//Meshes/Scene/scene.gltf", + "FilePath": "//Assets/Meshes/Scene/scene.gltf", "Material": { "ptr_wrapper": { "valid": 1, @@ -3071,16 +3087,16 @@ "emissiveMapFactor": 1.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value560": 1048607, - "value561": { + "value561": 1048607, + "value562": { "PrimitiveType": 8, - "FilePath": "//Meshes/DamagedHelmet/glTF/DamagedHelmet.gltf", + "FilePath": "//Assets/Meshes/DamagedHelmet/glTF/DamagedHelmet.gltf", "Material": { "ptr_wrapper": { "valid": 1, @@ -3108,21 +3124,21 @@ "emissiveMapFactor": 1.0, "alphaCutOff": 0.4000000059604645, "workflow": 1.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value562": 3145757, - "value563": { + "value563": 3145757, + "value564": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -3145,21 +3161,21 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value564": 2097179, - "value565": { + "value565": 2097179, + "value566": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -3182,14 +3198,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value566": 23, - "value567": { + "value567": 23, + "value568": { "PrimitiveType": 5, "FilePath": "Primitive", "Material": { @@ -3219,14 +3235,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value568": 22, - "value569": { + "value569": 22, + "value570": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3256,14 +3272,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value570": 21, - "value571": { + "value571": 21, + "value572": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3293,14 +3309,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value572": 20, - "value573": { + "value573": 20, + "value574": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3330,14 +3346,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value574": 19, - "value575": { + "value575": 19, + "value576": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3367,14 +3383,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value576": 18, - "value577": { + "value577": 18, + "value578": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3404,14 +3420,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value578": 17, - "value579": { + "value579": 17, + "value580": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3441,14 +3457,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value580": 16, - "value581": { + "value581": 16, + "value582": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3478,14 +3494,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value582": 15, - "value583": { + "value583": 15, + "value584": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3515,14 +3531,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value584": 14, - "value585": { + "value585": 14, + "value586": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3552,14 +3568,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value586": 13, - "value587": { + "value587": 13, + "value588": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3589,14 +3605,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value588": 12, - "value589": { + "value589": 12, + "value590": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3626,14 +3642,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value590": 11, - "value591": { + "value591": 11, + "value592": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3663,14 +3679,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value592": 10, - "value593": { + "value593": 10, + "value594": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3700,14 +3716,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value594": 9, - "value595": { + "value595": 9, + "value596": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3737,14 +3753,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value596": 8, - "value597": { + "value597": 8, + "value598": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3774,14 +3790,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value598": 7, - "value599": { + "value599": 7, + "value600": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3811,14 +3827,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value600": 6, - "value601": { + "value601": 6, + "value602": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3848,14 +3864,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value602": 5, - "value603": { + "value603": 5, + "value604": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3885,14 +3901,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value604": 4, - "value605": { + "value605": 4, + "value606": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -3922,21 +3938,21 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value606": 2097155, - "value607": { + "value607": 2097155, + "value608": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -3959,21 +3975,21 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value608": 2097154, - "value609": { + "value609": 2097154, + "value610": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -3996,21 +4012,21 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value610": 1, - "value611": { + "value611": 1, + "value612": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -4033,14 +4049,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value612": 1048576, - "value613": { + "value613": 1048576, + "value614": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -4070,21 +4086,21 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value614": 38, - "value615": { + "value615": 38, + "value616": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -4107,21 +4123,21 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value616": 39, - "value617": { + "value617": 39, + "value618": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -4144,14 +4160,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value618": 40, - "value619": { + "value619": 40, + "value620": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { @@ -4181,14 +4197,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value620": 41, - "value621": { + "value621": 41, + "value622": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { @@ -4218,14 +4234,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value622": 42, - "value623": { + "value623": 42, + "value624": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { @@ -4255,14 +4271,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value624": 43, - "value625": { + "value625": 43, + "value626": { "PrimitiveType": 4, "FilePath": "Primitive", "Material": { @@ -4292,14 +4308,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value626": 44, - "value627": { + "value627": 44, + "value628": { "PrimitiveType": 5, "FilePath": "Primitive", "Material": { @@ -4329,14 +4345,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value628": 45, - "value629": { + "value629": 45, + "value630": { "PrimitiveType": 5, "FilePath": "Primitive", "Material": { @@ -4366,14 +4382,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value630": 46, - "value631": { + "value631": 46, + "value632": { "PrimitiveType": 5, "FilePath": "Primitive", "Material": { @@ -4403,14 +4419,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value632": 47, - "value633": { + "value633": 47, + "value634": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { @@ -4440,14 +4456,14 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value634": 48, - "value635": { + "value635": 48, + "value636": { "PrimitiveType": 2, "FilePath": "Primitive", "Material": { @@ -4477,16 +4493,16 @@ "emissiveMapFactor": 0.0, "alphaCutOff": 0.4000000059604645, "workflow": 0.0, - "shader": "//CoreShaders/ForwardPBR.shader", + "shader": "C:/Dev/Lumos-Dev/Lumos/Assets/Shaders/ForwardPBR.shader", "Reflectance": 0.30000001192092898 } } } }, - "value636": 0, - "value637": 6, - "value638": 49, - "value639": { + "value637": 0, + "value638": 6, + "value639": 49, + "value640": { "TextString": "Metallic", "Path": "RobotoRegular", "Colour": { @@ -4506,8 +4522,8 @@ }, "OutlineWidth": 0.0 }, - "value640": 50, - "value641": { + "value641": 50, + "value642": { "TextString": "0.9", "Path": "RobotoRegular", "Colour": { @@ -4527,8 +4543,8 @@ }, "OutlineWidth": 0.0 }, - "value642": 51, - "value643": { + "value643": 51, + "value644": { "TextString": "0.2", "Path": "RobotoRegular", "Colour": { @@ -4548,8 +4564,8 @@ }, "OutlineWidth": 0.0 }, - "value644": 52, - "value645": { + "value645": 52, + "value646": { "TextString": "Roughness", "Path": "RobotoRegular", "Colour": { @@ -4569,8 +4585,8 @@ }, "OutlineWidth": 0.0 }, - "value646": 53, - "value647": { + "value647": 53, + "value648": { "TextString": "0.0", "Path": "RobotoRegular", "Colour": { @@ -4590,8 +4606,8 @@ }, "OutlineWidth": 0.0 }, - "value648": 54, - "value649": { + "value649": 54, + "value650": { "TextString": "1.0", "Path": "RobotoRegular", "Colour": { diff --git a/ExampleProject/Assets/Scenes/Platformer.lsn b/ExampleProject/Assets/Scenes/Platformer.lsn index 33aa27b2..f7703ea4 100644 --- a/ExampleProject/Assets/Scenes/Platformer.lsn +++ b/ExampleProject/Assets/Scenes/Platformer.lsn @@ -43,7 +43,7 @@ "value10": 1, "value11": 0, "value12": { - "FilePath": "//Scripts/Script(3).lua" + "FilePath": "//Assets/Scripts/Script(3).lua" }, "value13": 0, "value14": 0, diff --git a/ExampleProject/Assets/Scenes/Sandbox.lsn b/ExampleProject/Assets/Scenes/Sandbox.lsn index 6453d537..10fb03f8 100644 --- a/ExampleProject/Assets/Scenes/Sandbox.lsn +++ b/ExampleProject/Assets/Scenes/Sandbox.lsn @@ -111,7 +111,7 @@ "value26": 1, "value27": 3, "value28": { - "FilePath": "//Scripts/Projectile.lua" + "FilePath": "//Assets/Scripts/Projectile.lua" }, "value29": 0, "value30": 1, @@ -144,7 +144,7 @@ "value34": 1, "value35": 4, "value36": { - "value0": "//Textures/cubemap/noga", + "value0": "//Assets/Textures/cubemap/noga", "value1": 11, "value2": 3072, "value3": 4096, diff --git a/ExampleProject/Assets/Scenes/Sponza.lsn b/ExampleProject/Assets/Scenes/Sponza.lsn index 4b767227..a71c097b 100644 --- a/ExampleProject/Assets/Scenes/Sponza.lsn +++ b/ExampleProject/Assets/Scenes/Sponza.lsn @@ -209,7 +209,7 @@ "value43": 1, "value44": 3, "value45": { - "FilePath": "//Scripts/Projectile.lua" + "FilePath": "//Assets/Scripts/Projectile.lua" }, "value46": 0, "value47": 2, @@ -267,7 +267,7 @@ "value53": 1, "value54": 4, "value55": { - "value0": "//Textures/cubemap/noga", + "value0": "//Assets/Textures/cubemap/noga", "value1": 11, "value2": 3072, "value3": 4096, diff --git a/ExampleProject/Assets/Scenes/Terrain.lsn b/ExampleProject/Assets/Scenes/Terrain.lsn index 86f46da9..394b8f82 100644 --- a/ExampleProject/Assets/Scenes/Terrain.lsn +++ b/ExampleProject/Assets/Scenes/Terrain.lsn @@ -128,7 +128,7 @@ "value30": 1, "value31": 3, "value32": { - "FilePath": "//Scripts/Projectile.lua" + "FilePath": "//Assets/Scripts/Projectile.lua" }, "value33": 0, "value34": 1, @@ -161,7 +161,7 @@ "value38": 1, "value39": 4, "value40": { - "value0": "//Textures/cubemap/noga", + "value0": "//Assets/Textures/cubemap/noga", "value1": 11, "value2": 3072, "value3": 4096, diff --git a/ExampleProject/Assets/Scripts/FlappyBirdTest.lua b/ExampleProject/Assets/Scripts/FlappyBirdTest.lua index 02761a27..5dd50c00 100644 --- a/ExampleProject/Assets/Scripts/FlappyBirdTest.lua +++ b/ExampleProject/Assets/Scripts/FlappyBirdTest.lua @@ -60,7 +60,7 @@ function postSolve(a, b, coll, normalimpulse, tangentimpulse) end function CreatePlayer() - texture = LoadTextureWithParams("icon", "//Textures/TappyPlane/PNG/Planes/planeBlue1.png", TextureFilter.Linear, TextureWrap.ClampToEdge) + texture = LoadTextureWithParams("icon", "//Assets/Textures/TappyPlane/PNG/Planes/planeBlue1.png", TextureFilter.Linear, TextureWrap.ClampToEdge) player = entityManager:Create() player:AddSprite(Vector2.new(-0.9, -0.8), Vector2.new(1.7, 1.5), Vector4.new(1.0,1.0,1.0,1.0)):SetTexture(texture) @@ -147,8 +147,8 @@ end backgrounds = {} function OnInit() - iconTexture = LoadTextureWithParams("icon", "//Textures/TappyPlane/PNG/rock.png", TextureFilter.Linear, TextureWrap.ClampToEdge) - gameOverTexture = LoadTextureWithParams("gameOver", "//Textures/TappyPlane/PNG/UI/textGameOver.png", TextureFilter.Linear, TextureWrap.ClampToEdge) + iconTexture = LoadTextureWithParams("icon", "//Assets/Textures/TappyPlane/PNG/rock.png", TextureFilter.Linear, TextureWrap.ClampToEdge) + gameOverTexture = LoadTextureWithParams("gameOver", "//Assets/Textures/TappyPlane/PNG/UI/textGameOver.png", TextureFilter.Linear, TextureWrap.ClampToEdge) entityManager = scene:GetEntityManager() @@ -173,7 +173,7 @@ function OnInit() CreatePillar(i, (i + 2) * 10.0) end - backgroundTexture = LoadTextureWithParams("background", "//Textures/TappyPlane/PNG/background.png", TextureFilter.Linear, TextureWrap.ClampToEdge) + backgroundTexture = LoadTextureWithParams("background", "//Assets/Textures/TappyPlane/PNG/background.png", TextureFilter.Linear, TextureWrap.ClampToEdge) for i=1,50, 1 do CreateBackground(i) diff --git a/ExampleProject/Assets/Scripts/Script(3).lua b/ExampleProject/Assets/Scripts/Script(3).lua index cce91fc9..b7ff9a66 100644 --- a/ExampleProject/Assets/Scripts/Script(3).lua +++ b/ExampleProject/Assets/Scripts/Script(3).lua @@ -21,7 +21,7 @@ local player = {} local camera = {} function CreatePlayer() - texture = LoadTextureWithParams("icon", "//Textures/TappyPlane/PNG/Planes/planeBlue1.png", TextureFilter.Linear, TextureWrap.ClampToEdge) + texture = LoadTextureWithParams("icon", "//Assets/Textures/TappyPlane/PNG/Planes/planeBlue1.png", TextureFilter.Linear, TextureWrap.ClampToEdge) player = entityManager:Create() player:AddSprite(Vector2.new(-0.4, -0.4), Vector2.new(0.8, 0.8), Vector4.new(1.0,1.0,1.0,1.0)):SetTexture(texture) @@ -70,8 +70,8 @@ function OnInit() initPlayer(dungeon.levels[1]) initBoss(dungeon.levels[#dungeon.levels]) - SpriteSheetTexture = LoadTextureWithParams("icon", "//Textures/Dungeon/roguelikeDungeon_transparent.png", TextureFilter.Linear, TextureWrap.ClampToEdge) - gameOverTexture = LoadTextureWithParams("gameOver", "//Textures/TappyPlane/PNG/UI/textGameOver.png", TextureFilter.Linear, TextureWrap.ClampToEdge) + SpriteSheetTexture = LoadTextureWithParams("icon", "//Assets/Textures/Dungeon/roguelikeDungeon_transparent.png", TextureFilter.Linear, TextureWrap.ClampToEdge) + gameOverTexture = LoadTextureWithParams("gameOver", "//Assets/Textures/TappyPlane/PNG/UI/textGameOver.png", TextureFilter.Linear, TextureWrap.ClampToEdge) scoreEntity = entityManager:Create() scoreEntity:AddTransform() diff --git a/ExampleProject/Example.lmproj b/ExampleProject/Example.lmproj index ea604831..770dd81f 100644 --- a/ExampleProject/Example.lmproj +++ b/ExampleProject/Example.lmproj @@ -7,15 +7,15 @@ "ShowConsole": false, "Title": "Example", "Scenes": [ - "//Scenes/2D", - "//Scenes/Physics", - "//Scenes/Terrain", - "//Scenes/2DTest", - "//Scenes/ElasticTest", - "//Scenes/FrictionTest", - "//Scenes/Sandbox", - "//Scenes/Sponza", - "//Scenes/Platformer" + "//Assets/Scenes/2D", + "//Assets/Scenes/Physics", + "//Assets/Scenes/Terrain", + "//Assets/Scenes/2DTest", + "//Assets/Scenes/ElasticTest", + "//Assets/Scenes/FrictionTest", + "//Assets/Scenes/Sandbox", + "//Assets/Scenes/Sponza", + "//Assets/Scenes/Platformer" ], "SceneIndex": 0, "Borderless": false, diff --git a/ExampleProject/PrefabTest.lprefab b/ExampleProject/PrefabTest.lprefab index 8a4a85d7..4731e6f0 100644 --- a/ExampleProject/PrefabTest.lprefab +++ b/ExampleProject/PrefabTest.lprefab @@ -1623,15 +1623,15 @@ "value373": 3, "value374": 1048608, "value375": { - "FilePath": "//Scripts/Projectile.lua" + "FilePath": "//Assets/Scripts/Projectile.lua" }, "value376": 36, "value377": { - "FilePath": "//Scripts/Script.lua" + "FilePath": "//Assets/Scripts/Script.lua" }, "value378": 37, "value379": { - "FilePath": "//Scripts/Script(1).lua" + "FilePath": "//Assets/Scripts/Script(1).lua" }, "value380": 0, "value381": 4, @@ -2510,7 +2510,7 @@ "value419": 1, "value420": 24, "value421": { - "value0": "//Textures/cubemap/noga", + "value0": "//Assets/Textures/cubemap/noga", "value1": 11, "value2": 3072, "value3": 4096, @@ -2534,7 +2534,7 @@ "value427": 1, "value428": 28, "value429": { - "TexturePath": "//Textures/cat.png", + "TexturePath": "//Assets/Textures/cat.png", "Position": { "value0": 0.0, "value1": 0.0 @@ -2727,7 +2727,7 @@ "Global": false, "TimeLeft": 120000.0, "Stationary": false, - "SoundNodePath": "//Sounds/ambientguitar.ogg", + "SoundNodePath": "//Assets/Sounds/ambientguitar.ogg", "RollOffFactor": 6.0 } }, @@ -3010,7 +3010,7 @@ "value558": 33, "value559": { "PrimitiveType": 8, - "FilePath": "//Meshes/Scene/scene.gltf", + "FilePath": "//Assets/Meshes/Scene/scene.gltf", "Material": { "ptr_wrapper": { "valid": 1, @@ -3047,7 +3047,7 @@ "value560": 1048607, "value561": { "PrimitiveType": 8, - "FilePath": "//Meshes/DamagedHelmet/glTF/DamagedHelmet.gltf", + "FilePath": "//Assets/Meshes/DamagedHelmet/glTF/DamagedHelmet.gltf", "Material": { "ptr_wrapper": { "valid": 1, @@ -3089,7 +3089,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -3126,7 +3126,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -3903,7 +3903,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -3940,7 +3940,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -3977,7 +3977,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -4051,7 +4051,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", @@ -4088,7 +4088,7 @@ "ptr_wrapper": { "valid": 1, "data": { - "Albedo": "//Textures/checkerboard.tga", + "Albedo": "//Assets/Textures/checkerboard.tga", "Normal": "", "Metallic": "", "Roughness": "", diff --git a/Lumos/Assets/Shaders/CompileShadersMac.sh b/Lumos/Assets/Shaders/CompileShadersMac.sh index 185672dd..9c94c126 100755 --- a/Lumos/Assets/Shaders/CompileShadersMac.sh +++ b/Lumos/Assets/Shaders/CompileShadersMac.sh @@ -2,7 +2,7 @@ echo "Compiling shaders" cd "$(dirname "$0")" -COMPILER="/Users/jmorton/VulkanSDK/1.3.216.0/macOS/bin/glslc" +COMPILER="/Users/jmorton/VulkanSDK/1.3.261.1/macOS/bin/glslc" echo $COMPILER diff --git a/Lumos/Assets/Shaders/CompileShadersWindows.bat b/Lumos/Assets/Shaders/CompileShadersWindows.bat index 0e1d4542..40444597 100644 --- a/Lumos/Assets/Shaders/CompileShadersWindows.bat +++ b/Lumos/Assets/Shaders/CompileShadersWindows.bat @@ -1,11 +1,13 @@ - @echo off setLocal enableExtensions enableDelayedExpansion +cd /D "%~dp0" +set mypath=%cd% +@echo Compiling shaders in %mypath% to spv + set COMPILER=C:/VulkanSDK/1.3.216.0/Bin/glslc.exe set DSTDIR=CompiledSPV - -echo Compiling Shaders to spv +set CHECK_FILE_MODIFIED=0 if not exist "%DSTDIR%" ( mkdir "%DSTDIR%" @@ -14,21 +16,24 @@ if not exist "%DSTDIR%" ( for %%f in (*.vert *.frag *.comp) do ( set SRC=%%f - set DST=%DSTDIR%\!SRC:.vert=.vert.spv! set DST=!DST:.frag=.frag.spv! set DST=!DST:.comp=.comp.spv! - call :getModifiedDate "!SRC!" - set SRC_DATE=!DATE_MODIFIED! - - call :getModifiedDate "!DST!" - set DST_DATE=!DATE_MODIFIED! + if %CHECK_FILE_MODIFIED%==0 ( + echo Compiling "!SRC!" + %COMPILER% "!SRC!" -o "!DST!" + ) else ( + call :getModifiedDate "!SRC!" + set SRC_DATE=!DATE_MODIFIED! - if "!SRC_DATE!" gtr "!DST_DATE!" ( - echo Compiling "!SRC!" - %COMPILER% "!SRC!" -o "!DST!" + call :getModifiedDate "!DST!" + set DST_DATE=!DATE_MODIFIED! + if "!SRC_DATE!" gtr "!DST_DATE!" ( + echo Compiling "!SRC!" + %COMPILER% "!SRC!" -o "!DST!" + ) ) ) pause diff --git a/Lumos/Assets/Shaders/CompiledSPV/BRDFLUT.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/BRDFLUT.frag.spv index 024a1967..e4e0034e 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/BRDFLUT.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/BRDFLUT.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Batch2D.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Batch2D.frag.spv index 06d9804d..e4c0778e 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Batch2D.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Batch2D.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Batch2D.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/Batch2D.vert.spv index 546d1a94..51e7a6d2 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Batch2D.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/Batch2D.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Batch2DLine.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Batch2DLine.frag.spv index 4de02727..0a852ef2 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Batch2DLine.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Batch2DLine.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Batch2DLine.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/Batch2DLine.vert.spv index 0c6e986f..8acb5176 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Batch2DLine.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/Batch2DLine.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Batch2DPoint.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Batch2DPoint.frag.spv index 9652a357..bae59449 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Batch2DPoint.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Batch2DPoint.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Batch2DPoint.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/Batch2DPoint.vert.spv index 634d197b..fc4ff1a3 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Batch2DPoint.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/Batch2DPoint.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Bloom.comp.spv b/Lumos/Assets/Shaders/CompiledSPV/Bloom.comp.spv index ced68600..4b0afef4 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Bloom.comp.spv and b/Lumos/Assets/Shaders/CompiledSPV/Bloom.comp.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Bloom.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Bloom.frag.spv index 02526b93..2767a7a9 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Bloom.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Bloom.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/ChromaticAberation.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/ChromaticAberation.frag.spv index 3d8d990d..bf13c9f5 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/ChromaticAberation.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/ChromaticAberation.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/CreateEnvironmentMap.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/CreateEnvironmentMap.frag.spv index ffbadb20..5408bf95 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/CreateEnvironmentMap.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/CreateEnvironmentMap.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Debanding.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Debanding.frag.spv index 8112281f..0438ee49 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Debanding.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Debanding.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/DeferredColour.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/DeferredColour.frag.spv index 6de3a6c2..37d8b9af 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/DeferredColour.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/DeferredColour.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/DeferredColour.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/DeferredColour.vert.spv index 6287c5d6..3781ba26 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/DeferredColour.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/DeferredColour.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/DeferredColourAnim.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/DeferredColourAnim.vert.spv index 0e0638ef..187dc8b4 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/DeferredColourAnim.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/DeferredColourAnim.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/DeferredLight.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/DeferredLight.frag.spv index 368373e1..661aa594 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/DeferredLight.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/DeferredLight.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/DeferredLight.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/DeferredLight.vert.spv index b6352288..269269bf 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/DeferredLight.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/DeferredLight.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/DepthOfField.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/DepthOfField.frag.spv index 01dad16a..ef7d9422 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/DepthOfField.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/DepthOfField.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/DepthPrePass.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/DepthPrePass.frag.spv index 56acbecf..492f932e 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/DepthPrePass.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/DepthPrePass.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/EnvironmentIrradiance.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/EnvironmentIrradiance.frag.spv index 1e0c0ea4..4fe27a40 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/EnvironmentIrradiance.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/EnvironmentIrradiance.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/EnvironmentMipFilter.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/EnvironmentMipFilter.frag.spv index ee0eb88f..243c1bed 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/EnvironmentMipFilter.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/EnvironmentMipFilter.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/FXAA.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/FXAA.frag.spv index 592fc70a..b148dab1 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/FXAA.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/FXAA.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/FXAACompute.comp.spv b/Lumos/Assets/Shaders/CompiledSPV/FXAACompute.comp.spv index 316ab3a1..b5e2992c 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/FXAACompute.comp.spv and b/Lumos/Assets/Shaders/CompiledSPV/FXAACompute.comp.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/FilmicGrain.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/FilmicGrain.frag.spv index d49ffd55..7c140929 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/FilmicGrain.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/FilmicGrain.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/ForwardPBR.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/ForwardPBR.frag.spv index 40eeb66c..148340b2 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/ForwardPBR.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/ForwardPBR.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/ForwardPBR.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/ForwardPBR.vert.spv index 7693c9d0..c432118f 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/ForwardPBR.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/ForwardPBR.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Grid.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Grid.frag.spv index ac9c16c3..6d639123 100755 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Grid.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Grid.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Grid.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/Grid.vert.spv index 5a475cb3..32b456a2 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Grid.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/Grid.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/SSAO.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/SSAO.frag.spv index 829b1596..2145045f 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/SSAO.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/SSAO.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/SSAOBlur.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/SSAOBlur.frag.spv index 0dab3dca..15570878 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/SSAOBlur.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/SSAOBlur.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/ScreenPass.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/ScreenPass.frag.spv index f70f6270..bb322cef 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/ScreenPass.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/ScreenPass.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/ScreenPass.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/ScreenPass.vert.spv index ab0242d8..b6acd486 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/ScreenPass.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/ScreenPass.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Shadow.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Shadow.frag.spv index 87ae938d..1dc608ca 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Shadow.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Shadow.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Shadow.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/Shadow.vert.spv index b79aadbe..72fc2310 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Shadow.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/Shadow.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/ShadowAnim.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/ShadowAnim.vert.spv index 27cf3c83..1883b4d2 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/ShadowAnim.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/ShadowAnim.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Sharpen.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Sharpen.frag.spv index 7dde2861..5e41901d 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Sharpen.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Sharpen.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Skybox.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Skybox.frag.spv index 79f10e21..fa763e16 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Skybox.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Skybox.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Skybox.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/Skybox.vert.spv index 673ecde6..f352349b 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Skybox.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/Skybox.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Text.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/Text.frag.spv index 4e2c757d..2ec16cb7 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Text.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/Text.frag.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/Text.vert.spv b/Lumos/Assets/Shaders/CompiledSPV/Text.vert.spv index 482d9ab5..238c3b50 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/Text.vert.spv and b/Lumos/Assets/Shaders/CompiledSPV/Text.vert.spv differ diff --git a/Lumos/Assets/Shaders/CompiledSPV/ToneMapping.frag.spv b/Lumos/Assets/Shaders/CompiledSPV/ToneMapping.frag.spv index 7c70e210..adf15347 100644 Binary files a/Lumos/Assets/Shaders/CompiledSPV/ToneMapping.frag.spv and b/Lumos/Assets/Shaders/CompiledSPV/ToneMapping.frag.spv differ diff --git a/Lumos/Assets/Shaders/EnvironmentMipFilter.frag b/Lumos/Assets/Shaders/EnvironmentMipFilter.frag index cffef3f8..79f310b6 100644 --- a/Lumos/Assets/Shaders/EnvironmentMipFilter.frag +++ b/Lumos/Assets/Shaders/EnvironmentMipFilter.frag @@ -51,6 +51,9 @@ layout(location = 0) out vec4 FragColour; void main() { + float test = pushConsts.p0; + float test2 = pushConsts.p1; + vec3 N = normalize(GetCubeMapTexCoord2(int(pushConsts.cubeFaceIndex), outTexCoord)); vec3 R = N; diff --git a/Lumos/Assets/Shaders/ForwardPBR.frag b/Lumos/Assets/Shaders/ForwardPBR.frag index 757a4488..dbe4848e 100644 --- a/Lumos/Assets/Shaders/ForwardPBR.frag +++ b/Lumos/Assets/Shaders/ForwardPBR.frag @@ -19,6 +19,7 @@ layout(location = 0) in VertexData VertexOutput; #define BLEND_SHADOW_CASCADES 1 #define FILTER_SHADOWS 1 #define NUM_PCF_SAMPLES 8 +#define VOGEL_OFFSET 1 float ShadowFade = 1.0; struct Light @@ -85,7 +86,8 @@ layout(set = 2, binding = 5) uniform UBOLight int shadowEnabled; } ubo; -layout(location = 0) out vec4 outColor; + +layout(location = 0) out vec4 outColour; const float PBR_WORKFLOW_SEPARATE_TEXTURES = 0.0f; const float PBR_WORKFLOW_METALLIC_ROUGHNESS = 1.0f; @@ -112,15 +114,15 @@ vec4 GetAlbedo() { if(materialProperties.AlbedoMapFactor < 0.05) return materialProperties.AlbedoColour; - - return (1.0 - materialProperties.AlbedoMapFactor) * materialProperties.AlbedoColour + materialProperties.AlbedoMapFactor * DeGamma(texture(u_AlbedoMap, VertexOutput.TexCoord)); + + return /*(1.0 - materialProperties.AlbedoMapFactor) **/ materialProperties.AlbedoColour * (materialProperties.AlbedoMapFactor * DeGamma(texture(u_AlbedoMap, VertexOutput.TexCoord))); } vec3 GetMetallic() { if(materialProperties.MetallicMapFactor < 0.05) return materialProperties.Metallic.rrr; - + return (1.0 - materialProperties.MetallicMapFactor) * materialProperties.Metallic + materialProperties.MetallicMapFactor * texture(u_MetallicMap, VertexOutput.TexCoord).rgb; } @@ -135,7 +137,7 @@ float GetAO() { if(materialProperties.AOMapFactor < 0.05) return 1.0; - + return (1.0 - materialProperties.AOMapFactor) + materialProperties.AOMapFactor * texture(u_AOMap, VertexOutput.TexCoord).r; } @@ -150,17 +152,17 @@ vec3 GetNormalFromMap() { if (materialProperties.NormalMapFactor < 0.05) return normalize(VertexOutput.Normal); - - vec3 Normal = normalize(texture(u_NormalMap, VertexOutput.TexCoord).rgb * 2.0f - 1.0f); + + vec3 Normal = normalize(texture(u_NormalMap, VertexOutput.TexCoord).rgb * 2.0f - 1.0f); return normalize(VertexOutput.WorldNormal * Normal); } const mat4 BiasMatrix = mat4( - 0.5, 0.0, 0.0, 0.5, - 0.0, 0.5, 0.0, 0.5, - 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 1.0 - ); + 0.5, 0.0, 0.0, 0.5, + 0.0, 0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 + ); const vec2 PoissonDistribution16[16] = vec2[]( vec2(-0.94201624, -0.39906216), vec2(0.94558609, -0.76890725), vec2(-0.094184101, -0.92938870), vec2(0.34495938, 0.29387760), @@ -222,17 +224,17 @@ float rand(vec2 co) return fract(sin(sn) * c); } -vec2 VogelDiskSample(int sampleIndex, int samplesCount, float phi) +vec2 VogelDiskSample(int sampleIndex, float invSquareRootSamplesCount, float phi) { - float GoldenAngle = 2.4f; - - float r = sqrt(sampleIndex + 0.5f) / sqrt(samplesCount); - float theta = sampleIndex * GoldenAngle + phi; - - float sine = sin(theta); - float cosine = cos(theta); - - return vec2(r * cosine, r * sine); + float GoldenAngle = 2.4f; + + float r = sqrt(sampleIndex + 0.5f) * invSquareRootSamplesCount;/// sqrt(samplesCount); + float theta = sampleIndex * GoldenAngle + phi; + + float sine = sin(theta); + float cosine = cos(theta); + + return vec2(r * cosine, r * sine); } float Random(vec4 seed4) @@ -241,6 +243,12 @@ float Random(vec4 seed4) return fract(sin(dot_product) * 43758.5453); } +float Random(vec3 seed, int i) +{ + vec4 seed4 = vec4(seed,i); + return Random(seed4); +} + vec2 SearchRegionRadiusUV(float zWorld) { float light_zNear = 0.0; @@ -258,9 +266,10 @@ float GetShadowBias(vec3 lightDirection, vec3 normal, int shadowIndex) float PCFShadowDirectionalLight(sampler2DArray shadowMap, vec4 shadowCoords, float uvRadius, vec3 lightDirection, vec3 normal, vec3 wsPos, int cascadeIndex) { float bias = GetShadowBias(lightDirection, normal, cascadeIndex); - float sum = 0; + float sum = 0.0; float noise = Noise(wsPos.xy); - + float invSquareRootSamplesCount = 1.0 / sqrt(NUM_PCF_SAMPLES); + for (int i = 0; i < NUM_PCF_SAMPLES; i++) { //int index = int(16.0f*Random(vec4(wsPos, i)))%16; @@ -268,10 +277,15 @@ float PCFShadowDirectionalLight(sampler2DArray shadowMap, vec4 shadowCoords, flo //int index = int(float(NUM_PCF_SAMPLES)*Random(vec4(wsPos.xyz, 1)))%NUM_PCF_SAMPLES; //int index = int(float(NUM_PCF_SAMPLES)*Random(vec4(floor(wsPos*1000.0), 1)))%NUM_PCF_SAMPLES; //int index = int(NUM_PCF_SAMPLES*Random(vec4(floor(wsPos.xyz*1000.0), i)))%NUM_PCF_SAMPLES; - //int index = int(NUM_PCF_SAMPLES*Random(vec4(wsPos.xyy, i)))%NUM_PCF_SAMPLES; - //vec2 offset = (SamplePoisson(index) / 700.0f); - vec2 offset = VogelDiskSample(i, NUM_PCF_SAMPLES, noise) / 700.0f; + + int index = int(16.0*Random(floor(wsPos.xyz*1000.0), i))%16; +#if VOGEL_OFFSET + + vec2 offset = VogelDiskSample(index, invSquareRootSamplesCount, noise) / 700.0f; +#else + vec2 offset = SamplePoisson(index) / 700.0f; +#endif float z = texture(shadowMap, vec3(shadowCoords.xy + offset, cascadeIndex)).r; sum += step(shadowCoords.z - bias, z); @@ -325,19 +339,19 @@ float CalculateShadow(vec3 wsPos, int cascadeIndex, vec3 lightDirection, vec3 no shadowAmount = mix(shadowAmount, shadowAmount1, cascadeFade); } - #endif +#endif return 1.0 - ((1.0 - shadowAmount) * ShadowFade); } vec3 IsotropicLobe(const Material material, const Light light, const vec3 h, - float NoV, float NoL, float NoH, float LoH) { - + float NoV, float NoL, float NoH, float LoH) { + float D = distribution(material.Roughness, NoH, material.Normal, h); float V = visibility(material.Roughness, NoV, NoL); vec3 F = fresnel(material.F0, LoH); - + return (D * V) * F; } @@ -351,7 +365,7 @@ vec3 SpecularLobe(const Material material, const Light light, const vec3 h, floa return IsotropicLobe(material, light, h, NoV, NoL, NoH, LoH); } -#define NEW_LIGHTING 1 +#define NEW_LIGHTING 0 vec3 Lighting(vec3 F0, vec3 wsPos, Material material) { @@ -375,7 +389,7 @@ vec3 Lighting(vec3 F0, vec3 wsPos, Material material) // Attenuation float atten = light.radius / (pow(dist, 2.0) + 1.0); float attenuation = clamp(1.0 - (dist * dist) / (light.radius * light.radius), 0.0, 1.0); - + value = attenuation; light.direction = vec4(L,1.0); @@ -409,8 +423,8 @@ vec3 Lighting(vec3 F0, vec3 wsPos, Material material) vec3 Li = light.direction.xyz; vec3 Lradiance = light.colour.xyz * light.intensity; vec3 Lh = normalize(Li + material.View); - - #ifndef NEW_LIGHTING + +#if NEW_LIGHTING == 0 // Calculate angles between surface normal and various light vectors. float cosLi = max(0.0, dot(material.Normal, Li)); @@ -429,22 +443,22 @@ vec3 Lighting(vec3 F0, vec3 wsPos, Material material) specularBRDF = clamp(specularBRDF, vec3(0.0f), vec3(10.0f));//; result += (diffuseBRDF + specularBRDF) * Lradiance * cosLi * value * ComputeMicroShadowing(saturate(cosLi), material.AO); - + #else float lightNoL = saturate(dot(material.Normal, Li)); vec3 h = normalize(material.View + Li); - + float shading_NoV = clampNoV(dot(material.Normal, material.View)); float NoV = shading_NoV; float NoL = saturate(lightNoL); float NoH = saturate(dot(material.Normal, h)); float LoH = saturate(dot(Li, h)); - + vec3 Fd = DiffuseLobe(material, NoV, NoL, LoH); vec3 Fr = SpecularLobe(material, light, h, NoV, NoL, NoH, LoH);; - + vec3 colour = Fd + Fr;// * material.EnergyCompensation; - + result += (colour * Lradiance.rgb) * (value * NoL * ComputeMicroShadowing(NoL, material.AO)); #endif } @@ -468,27 +482,27 @@ vec3 IBL(vec3 F0, vec3 Lr, Material material) vec3 IBLNew(vec3 F0, vec3 Lr, Material material) { - // specular layer + // specular layer vec3 Fr = vec3(0.0); - + vec3 E = mix(material.dfg.xxx, material.dfg.yyy, material.F0); //specularDFG(pixel); vec3 r = Lr;//getReflectedVector(pixel, material.Normal); - + int u_EnvRadianceTexLevels = ubo.EnvMipCount; material.Roughness * u_EnvRadianceTexLevels; vec3 specularIrradiance = textureLod(uEnvMap, Lr, material.PerceptualRoughness * u_EnvRadianceTexLevels).rgb; //specularIrradiance = DeGamma(specularIrradiance); - + Fr = E * specularIrradiance; - + vec3 irradiance = texture(uIrrMap, material.Normal).rgb; //irradiance = DeGamma(irradiance); //vec3 diffuseIrradiance = diffuseIrradiance(shading_normal); vec3 Fd = material.Albedo.xyz * irradiance * (1.0 - E);// * diffuseBRDF; - - vec3 color = Fr + Fd; - return color; + + vec3 colour = Fr + Fd; + return colour; } void main() @@ -532,17 +546,17 @@ void main() material.Normal = normalize(VertexOutput.WorldNormal * material.Normal); material.Normal = normalize(material.Normal); } - + material.AO = GetAO(); material.Emissive = GetEmissive(material.Albedo.rgb); - + vec2 uv = gl_FragCoord.xy / vec2(ubo.Width, ubo.Height); float ssao = texture(uSSAOMap, uv).r; material.Albedo *= ssao; - + material.PerceptualRoughness = clamp(material.PerceptualRoughness, MIN_PERCEPTUAL_ROUGHNESS, 1.0); material.Roughness = perceptualRoughnessToRoughness(material.Roughness); - + // Specular anti-aliasing { const float strength = 1.0f; @@ -555,21 +569,21 @@ void main() float filteredRoughness2 = saturate(roughness2 + kernelRoughness2); material.Roughness = sqrt(filteredRoughness2); } - + material.Roughness = clamp(material.Roughness, MIN_ROUGHNESS, 1.0); - + vec3 wsPos = VertexOutput.Position.xyz; material.View = normalize(ubo.cameraPosition.xyz - wsPos); material.NDotV = max(dot(material.Normal, material.View), 1e-4); - + material.dfg = texture(uBRDFLUT, vec2(material.NDotV, material.PerceptualRoughness)).rg; float reflectance = computeDielectricF0(material.Reflectance); //vec3 F0 = mix(Fdielectric, material.Albedo.xyz, material.Metallic.x); vec3 F0 = computeF0(material.Albedo, material.Metallic.x, reflectance); material.F0 = F0; material.EnergyCompensation = 1.0 + material.F0 * (1.0 / max(0.1, material.dfg.y) - 1.0); - material.Albedo.xyz = computeDiffuseColor(material.Albedo, material.Metallic.x); - + material.Albedo.xyz = computeDiffuseColour(material.Albedo, material.Metallic.x); + float shadowDistance = ubo.MaxShadowDist; float transitionDistance = ubo.ShadowFade; @@ -585,38 +599,38 @@ void main() vec3 iblContribution = IBL(material.F0, Lr, material); vec3 finalColour = lightContribution + iblContribution + material.Emissive; - outColor = vec4(finalColour, 1.0); + outColour = vec4(finalColour, 1.0); if(ubo.Mode > 0) { switch(ubo.Mode) { case 1: - outColor = material.Albedo; + outColour = material.Albedo; break; case 2: - outColor = vec4(material.Metallic.rrr, 1.0); + outColour = vec4(material.Metallic.rrr, 1.0); break; case 3: - outColor = vec4(material.PerceptualRoughness.xxx,1.0); + outColour = vec4(material.PerceptualRoughness.xxx,1.0); break; case 4: - outColor = vec4(material.AO.xxx, 1.0); + outColour = vec4(material.AO.xxx, 1.0); break; case 5: - outColor = vec4(material.Emissive, 1.0); + outColour = vec4(material.Emissive, 1.0); break; case 6: - outColor = vec4(material.Normal,1.0); + outColour = vec4(material.Normal,1.0); break; case 7: int cascadeIndex = CalculateCascadeIndex(wsPos); switch(cascadeIndex) { - case 0 : outColor = outColor * vec4(0.8,0.2,0.2,1.0); break; - case 1 : outColor = outColor * vec4(0.2,0.8,0.2,1.0); break; - case 2 : outColor = outColor * vec4(0.2,0.2,0.8,1.0); break; - case 3 : outColor = outColor * vec4(0.8,0.8,0.2,1.0); break; + case 0 : outColour = outColour * vec4(0.8,0.2,0.2,1.0); break; + case 1 : outColour = outColour * vec4(0.2,0.8,0.2,1.0); break; + case 2 : outColour = outColour * vec4(0.2,0.2,0.8,1.0); break; + case 3 : outColour = outColour * vec4(0.8,0.8,0.2,1.0); break; } break; } diff --git a/Lumos/Assets/Shaders/ForwardPBR.vert b/Lumos/Assets/Shaders/ForwardPBR.vert index 481848b9..d19cca0b 100644 --- a/Lumos/Assets/Shaders/ForwardPBR.vert +++ b/Lumos/Assets/Shaders/ForwardPBR.vert @@ -45,7 +45,7 @@ void main() //VertexOutput.Normal = mat3(pushConsts.transform) * inNormal; mat3 transposeInv = transpose(inverse(mat3(pushConsts.transform))); VertexOutput.Normal = transposeInv * inNormal; - + VertexOutput.WorldNormal = transposeInv * mat3(inTangent, inBitangent, inNormal); - + } \ No newline at end of file diff --git a/Lumos/Assets/Shaders/PBR.glslh b/Lumos/Assets/Shaders/PBR.glslh index f6ab3d57..31993d20 100644 --- a/Lumos/Assets/Shaders/PBR.glslh +++ b/Lumos/Assets/Shaders/PBR.glslh @@ -84,9 +84,9 @@ float Diffuse(float roughness, float NoV, float NoL, float LoH) #endif } -vec3 ComputeF0(const vec4 baseColor, float metallic, float reflectance) +vec3 ComputeF0(const vec4 baseColour, float metallic, float reflectance) { - return baseColor.rgb * metallic + (reflectance * (1.0 - metallic)); + return baseColour.rgb * metallic + (reflectance * (1.0 - metallic)); } #if QUALITY_LOW @@ -98,27 +98,27 @@ vec3 ComputeF0(const vec4 baseColor, float metallic, float reflectance) #define MIN_ROUGHNESS 0.002025 #endif -#define MIN_N_DOT_V 1e-4 +#define MIN_N_DOT_V 0.1 // 1e-4 float clampNoV(float NoV) { // Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886" return max(NoV, MIN_N_DOT_V); } -vec3 computeDiffuseColor(const vec4 baseColor, float metallic) { - return baseColor.rgb * (1.0 - metallic); +vec3 computeDiffuseColour(const vec4 baseColour, float metallic) { + return baseColour.rgb * (1.0 - metallic); } -vec3 computeF0(const vec4 baseColor, float metallic, float reflectance) { - return baseColor.rgb * metallic + (reflectance * (1.0 - metallic)); +vec3 computeF0(const vec4 baseColour, float metallic, float reflectance) { + return baseColour.rgb * metallic + (reflectance * (1.0 - metallic)); } float computeDielectricF0(float reflectance) { return 0.16 * reflectance * reflectance; } -float computeMetallicFromSpecularColor(const vec3 specularColor) { - return max3(specularColor); +float computeMetallicFromSpecularColour(const vec3 specularColour) { + return max3(specularColour); } float computeRoughnessFromGlossiness(float glossiness) { diff --git a/Lumos/Assets/Shaders/Shadow.vert b/Lumos/Assets/Shaders/Shadow.vert index 23b3a61f..0d7040c7 100644 --- a/Lumos/Assets/Shaders/Shadow.vert +++ b/Lumos/Assets/Shaders/Shadow.vert @@ -55,6 +55,9 @@ void main() vec3 test3 = inTangent; //SPV vertex layout incorrect when not used vec3 test4 = inBitangent; //SPV vertex layout incorrect when not used vec3 test5 = inNormal; //SPV vertex layout incorrect when not used + float test6 = pushConsts.p0; + float test7 = pushConsts.p1; + float test8 = pushConsts.p2; uv = inTexCoord; } \ No newline at end of file diff --git a/Lumos/External/OpenFBX/LICENSE b/Lumos/External/ModelLoaders/OpenFBX/LICENSE similarity index 100% rename from Lumos/External/OpenFBX/LICENSE rename to Lumos/External/ModelLoaders/OpenFBX/LICENSE diff --git a/Lumos/External/OpenFBX/README.md b/Lumos/External/ModelLoaders/OpenFBX/README.md similarity index 100% rename from Lumos/External/OpenFBX/README.md rename to Lumos/External/ModelLoaders/OpenFBX/README.md diff --git a/Lumos/External/OpenFBX/miniz.c b/Lumos/External/ModelLoaders/OpenFBX/miniz.c similarity index 100% rename from Lumos/External/OpenFBX/miniz.c rename to Lumos/External/ModelLoaders/OpenFBX/miniz.c diff --git a/Lumos/External/OpenFBX/miniz.h b/Lumos/External/ModelLoaders/OpenFBX/miniz.h similarity index 100% rename from Lumos/External/OpenFBX/miniz.h rename to Lumos/External/ModelLoaders/OpenFBX/miniz.h diff --git a/Lumos/External/OpenFBX/ofbx.cpp b/Lumos/External/ModelLoaders/OpenFBX/ofbx.cpp similarity index 100% rename from Lumos/External/OpenFBX/ofbx.cpp rename to Lumos/External/ModelLoaders/OpenFBX/ofbx.cpp diff --git a/Lumos/External/OpenFBX/ofbx.h b/Lumos/External/ModelLoaders/OpenFBX/ofbx.h similarity index 100% rename from Lumos/External/OpenFBX/ofbx.h rename to Lumos/External/ModelLoaders/OpenFBX/ofbx.h diff --git a/Lumos/External/imgui/Plugins/ImFileBrowser.h b/Lumos/External/imgui/Plugins/ImFileBrowser.h index 03af412b..7de4a6e9 100644 --- a/Lumos/External/imgui/Plugins/ImFileBrowser.h +++ b/Lumos/External/imgui/Plugins/ImFileBrowser.h @@ -302,7 +302,7 @@ inline void ImGui::FileBrowser::Display() // display elements in pwd int secIdx = 0, newPwdLastSecIdx = -1; - for(auto &sec : pwd_) + for(const auto& sec : pwd_) { #ifdef _WIN32 if(secIdx == 1) @@ -327,7 +327,7 @@ inline void ImGui::FileBrowser::Display() { int i = 0; std::filesystem::path newPwd; - for(auto &sec : pwd_) + for(const auto& sec : pwd_) { if(i++ > newPwdLastSecIdx) break; diff --git a/Lumos/External/vulkan/volk/volk.c b/Lumos/External/vulkan/volk/volk.c index 8df800a2..6d68f0d7 100644 --- a/Lumos/External/vulkan/volk/volk.c +++ b/Lumos/External/vulkan/volk/volk.c @@ -6,7 +6,9 @@ typedef const char* LPCSTR; typedef struct HINSTANCE__* HINSTANCE; typedef HINSTANCE HMODULE; - #ifdef _WIN64 + #if defined(_MINWINDEF_) + /* minwindef.h defines FARPROC, and attempting to redefine it may conflict with -Wstrict-prototypes */ + #elif defined(_WIN64) typedef __int64 (__stdcall* FARPROC)(void); #else typedef int (__stdcall* FARPROC)(void); @@ -52,7 +54,9 @@ VkResult volkInitialize(void) // note: function pointer is cast through void function pointer to silence cast-function-type warning on gcc8 vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)(void(*)(void))GetProcAddress(module, "vkGetInstanceProcAddr"); #elif defined(__APPLE__) - void* module = dlopen("libvulkan.dylib", RTLD_NOW | RTLD_LOCAL); + void* module = dlopen("libvulkan.dylib", RTLD_NOW | RTLD_LOCAL); + if (!module) + module = dlopen("/usr/local/lib/libvulkan.dylib", RTLD_NOW | RTLD_LOCAL); if (!module) module = dlopen("libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL); if (!module) @@ -110,7 +114,7 @@ void volkLoadInstanceOnly(VkInstance instance) volkGenLoadInstance(instance, vkGetInstanceProcAddrStub); } -VkInstance volkGetLoadedInstance() +VkInstance volkGetLoadedInstance(void) { return loadedInstance; } @@ -121,7 +125,7 @@ void volkLoadDevice(VkDevice device) volkGenLoadDevice(device, vkGetDeviceProcAddrStub); } -VkDevice volkGetLoadedDevice() +VkDevice volkGetLoadedDevice(void) { return loadedDevice; } @@ -242,6 +246,9 @@ static void volkGenLoadInstance(void* context, PFN_vkVoidFunction (*load)(void*, #if defined(VK_KHR_android_surface) vkCreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)load(context, "vkCreateAndroidSurfaceKHR"); #endif /* defined(VK_KHR_android_surface) */ +#if defined(VK_KHR_cooperative_matrix) + vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR = (PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR)load(context, "vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR"); +#endif /* defined(VK_KHR_cooperative_matrix) */ #if defined(VK_KHR_device_group_creation) vkEnumeratePhysicalDeviceGroupsKHR = (PFN_vkEnumeratePhysicalDeviceGroupsKHR)load(context, "vkEnumeratePhysicalDeviceGroupsKHR"); #endif /* defined(VK_KHR_device_group_creation) */ @@ -296,6 +303,9 @@ static void volkGenLoadInstance(void* context, PFN_vkVoidFunction (*load)(void*, vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)load(context, "vkGetPhysicalDeviceSurfacePresentModesKHR"); vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)load(context, "vkGetPhysicalDeviceSurfaceSupportKHR"); #endif /* defined(VK_KHR_surface) */ +#if defined(VK_KHR_video_encode_queue) + vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR = (PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR)load(context, "vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR"); +#endif /* defined(VK_KHR_video_encode_queue) */ #if defined(VK_KHR_video_queue) vkGetPhysicalDeviceVideoCapabilitiesKHR = (PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)load(context, "vkGetPhysicalDeviceVideoCapabilitiesKHR"); vkGetPhysicalDeviceVideoFormatPropertiesKHR = (PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR)load(context, "vkGetPhysicalDeviceVideoFormatPropertiesKHR"); @@ -338,6 +348,9 @@ static void volkGenLoadInstance(void* context, PFN_vkVoidFunction (*load)(void*, #if defined(VK_NV_external_memory_capabilities) vkGetPhysicalDeviceExternalImageFormatPropertiesNV = (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)load(context, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV"); #endif /* defined(VK_NV_external_memory_capabilities) */ +#if defined(VK_NV_optical_flow) + vkGetPhysicalDeviceOpticalFlowImageFormatsNV = (PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV)load(context, "vkGetPhysicalDeviceOpticalFlowImageFormatsNV"); +#endif /* defined(VK_NV_optical_flow) */ #if defined(VK_QNX_screen_surface) vkCreateScreenSurfaceQNX = (PFN_vkCreateScreenSurfaceQNX)load(context, "vkCreateScreenSurfaceQNX"); vkGetPhysicalDeviceScreenPresentationSupportQNX = (PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX)load(context, "vkGetPhysicalDeviceScreenPresentationSupportQNX"); @@ -544,6 +557,15 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkQueueSubmit2 = (PFN_vkQueueSubmit2)load(context, "vkQueueSubmit2"); vkSetPrivateData = (PFN_vkSetPrivateData)load(context, "vkSetPrivateData"); #endif /* defined(VK_VERSION_1_3) */ +#if defined(VK_AMDX_shader_enqueue) + vkCmdDispatchGraphAMDX = (PFN_vkCmdDispatchGraphAMDX)load(context, "vkCmdDispatchGraphAMDX"); + vkCmdDispatchGraphIndirectAMDX = (PFN_vkCmdDispatchGraphIndirectAMDX)load(context, "vkCmdDispatchGraphIndirectAMDX"); + vkCmdDispatchGraphIndirectCountAMDX = (PFN_vkCmdDispatchGraphIndirectCountAMDX)load(context, "vkCmdDispatchGraphIndirectCountAMDX"); + vkCmdInitializeGraphScratchMemoryAMDX = (PFN_vkCmdInitializeGraphScratchMemoryAMDX)load(context, "vkCmdInitializeGraphScratchMemoryAMDX"); + vkCreateExecutionGraphPipelinesAMDX = (PFN_vkCreateExecutionGraphPipelinesAMDX)load(context, "vkCreateExecutionGraphPipelinesAMDX"); + vkGetExecutionGraphPipelineNodeIndexAMDX = (PFN_vkGetExecutionGraphPipelineNodeIndexAMDX)load(context, "vkGetExecutionGraphPipelineNodeIndexAMDX"); + vkGetExecutionGraphPipelineScratchSizeAMDX = (PFN_vkGetExecutionGraphPipelineScratchSizeAMDX)load(context, "vkGetExecutionGraphPipelineScratchSizeAMDX"); +#endif /* defined(VK_AMDX_shader_enqueue) */ #if defined(VK_AMD_buffer_marker) vkCmdWriteBufferMarkerAMD = (PFN_vkCmdWriteBufferMarkerAMD)load(context, "vkCmdWriteBufferMarkerAMD"); #endif /* defined(VK_AMD_buffer_marker) */ @@ -561,6 +583,9 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkGetAndroidHardwareBufferPropertiesANDROID = (PFN_vkGetAndroidHardwareBufferPropertiesANDROID)load(context, "vkGetAndroidHardwareBufferPropertiesANDROID"); vkGetMemoryAndroidHardwareBufferANDROID = (PFN_vkGetMemoryAndroidHardwareBufferANDROID)load(context, "vkGetMemoryAndroidHardwareBufferANDROID"); #endif /* defined(VK_ANDROID_external_memory_android_hardware_buffer) */ +#if defined(VK_EXT_attachment_feedback_loop_dynamic_state) + vkCmdSetAttachmentFeedbackLoopEnableEXT = (PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT)load(context, "vkCmdSetAttachmentFeedbackLoopEnableEXT"); +#endif /* defined(VK_EXT_attachment_feedback_loop_dynamic_state) */ #if defined(VK_EXT_buffer_device_address) vkGetBufferDeviceAddressEXT = (PFN_vkGetBufferDeviceAddressEXT)load(context, "vkGetBufferDeviceAddressEXT"); #endif /* defined(VK_EXT_buffer_device_address) */ @@ -581,36 +606,40 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkDebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)load(context, "vkDebugMarkerSetObjectNameEXT"); vkDebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)load(context, "vkDebugMarkerSetObjectTagEXT"); #endif /* defined(VK_EXT_debug_marker) */ +#if defined(VK_EXT_depth_bias_control) + vkCmdSetDepthBias2EXT = (PFN_vkCmdSetDepthBias2EXT)load(context, "vkCmdSetDepthBias2EXT"); +#endif /* defined(VK_EXT_depth_bias_control) */ +#if defined(VK_EXT_descriptor_buffer) + vkCmdBindDescriptorBufferEmbeddedSamplersEXT = (PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)load(context, "vkCmdBindDescriptorBufferEmbeddedSamplersEXT"); + vkCmdBindDescriptorBuffersEXT = (PFN_vkCmdBindDescriptorBuffersEXT)load(context, "vkCmdBindDescriptorBuffersEXT"); + vkCmdSetDescriptorBufferOffsetsEXT = (PFN_vkCmdSetDescriptorBufferOffsetsEXT)load(context, "vkCmdSetDescriptorBufferOffsetsEXT"); + vkGetBufferOpaqueCaptureDescriptorDataEXT = (PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT)load(context, "vkGetBufferOpaqueCaptureDescriptorDataEXT"); + vkGetDescriptorEXT = (PFN_vkGetDescriptorEXT)load(context, "vkGetDescriptorEXT"); + vkGetDescriptorSetLayoutBindingOffsetEXT = (PFN_vkGetDescriptorSetLayoutBindingOffsetEXT)load(context, "vkGetDescriptorSetLayoutBindingOffsetEXT"); + vkGetDescriptorSetLayoutSizeEXT = (PFN_vkGetDescriptorSetLayoutSizeEXT)load(context, "vkGetDescriptorSetLayoutSizeEXT"); + vkGetImageOpaqueCaptureDescriptorDataEXT = (PFN_vkGetImageOpaqueCaptureDescriptorDataEXT)load(context, "vkGetImageOpaqueCaptureDescriptorDataEXT"); + vkGetImageViewOpaqueCaptureDescriptorDataEXT = (PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT)load(context, "vkGetImageViewOpaqueCaptureDescriptorDataEXT"); + vkGetSamplerOpaqueCaptureDescriptorDataEXT = (PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT)load(context, "vkGetSamplerOpaqueCaptureDescriptorDataEXT"); +#endif /* defined(VK_EXT_descriptor_buffer) */ +#if defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) + vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT = (PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)load(context, "vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT"); +#endif /* defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) */ +#if defined(VK_EXT_device_fault) + vkGetDeviceFaultInfoEXT = (PFN_vkGetDeviceFaultInfoEXT)load(context, "vkGetDeviceFaultInfoEXT"); +#endif /* defined(VK_EXT_device_fault) */ #if defined(VK_EXT_discard_rectangles) vkCmdSetDiscardRectangleEXT = (PFN_vkCmdSetDiscardRectangleEXT)load(context, "vkCmdSetDiscardRectangleEXT"); #endif /* defined(VK_EXT_discard_rectangles) */ +#if defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 + vkCmdSetDiscardRectangleEnableEXT = (PFN_vkCmdSetDiscardRectangleEnableEXT)load(context, "vkCmdSetDiscardRectangleEnableEXT"); + vkCmdSetDiscardRectangleModeEXT = (PFN_vkCmdSetDiscardRectangleModeEXT)load(context, "vkCmdSetDiscardRectangleModeEXT"); +#endif /* defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 */ #if defined(VK_EXT_display_control) vkDisplayPowerControlEXT = (PFN_vkDisplayPowerControlEXT)load(context, "vkDisplayPowerControlEXT"); vkGetSwapchainCounterEXT = (PFN_vkGetSwapchainCounterEXT)load(context, "vkGetSwapchainCounterEXT"); vkRegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT)load(context, "vkRegisterDeviceEventEXT"); vkRegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT)load(context, "vkRegisterDisplayEventEXT"); #endif /* defined(VK_EXT_display_control) */ -#if defined(VK_EXT_extended_dynamic_state) - vkCmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT)load(context, "vkCmdBindVertexBuffers2EXT"); - vkCmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT)load(context, "vkCmdSetCullModeEXT"); - vkCmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT)load(context, "vkCmdSetDepthBoundsTestEnableEXT"); - vkCmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT)load(context, "vkCmdSetDepthCompareOpEXT"); - vkCmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT)load(context, "vkCmdSetDepthTestEnableEXT"); - vkCmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT)load(context, "vkCmdSetDepthWriteEnableEXT"); - vkCmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT)load(context, "vkCmdSetFrontFaceEXT"); - vkCmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT)load(context, "vkCmdSetPrimitiveTopologyEXT"); - vkCmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT)load(context, "vkCmdSetScissorWithCountEXT"); - vkCmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)load(context, "vkCmdSetStencilOpEXT"); - vkCmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)load(context, "vkCmdSetStencilTestEnableEXT"); - vkCmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT)load(context, "vkCmdSetViewportWithCountEXT"); -#endif /* defined(VK_EXT_extended_dynamic_state) */ -#if defined(VK_EXT_extended_dynamic_state2) - vkCmdSetDepthBiasEnableEXT = (PFN_vkCmdSetDepthBiasEnableEXT)load(context, "vkCmdSetDepthBiasEnableEXT"); - vkCmdSetLogicOpEXT = (PFN_vkCmdSetLogicOpEXT)load(context, "vkCmdSetLogicOpEXT"); - vkCmdSetPatchControlPointsEXT = (PFN_vkCmdSetPatchControlPointsEXT)load(context, "vkCmdSetPatchControlPointsEXT"); - vkCmdSetPrimitiveRestartEnableEXT = (PFN_vkCmdSetPrimitiveRestartEnableEXT)load(context, "vkCmdSetPrimitiveRestartEnableEXT"); - vkCmdSetRasterizerDiscardEnableEXT = (PFN_vkCmdSetRasterizerDiscardEnableEXT)load(context, "vkCmdSetRasterizerDiscardEnableEXT"); -#endif /* defined(VK_EXT_extended_dynamic_state2) */ #if defined(VK_EXT_external_memory_host) vkGetMemoryHostPointerPropertiesEXT = (PFN_vkGetMemoryHostPointerPropertiesEXT)load(context, "vkGetMemoryHostPointerPropertiesEXT"); #endif /* defined(VK_EXT_external_memory_host) */ @@ -621,22 +650,49 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c #if defined(VK_EXT_hdr_metadata) vkSetHdrMetadataEXT = (PFN_vkSetHdrMetadataEXT)load(context, "vkSetHdrMetadataEXT"); #endif /* defined(VK_EXT_hdr_metadata) */ +#if defined(VK_EXT_host_image_copy) + vkCopyImageToImageEXT = (PFN_vkCopyImageToImageEXT)load(context, "vkCopyImageToImageEXT"); + vkCopyImageToMemoryEXT = (PFN_vkCopyImageToMemoryEXT)load(context, "vkCopyImageToMemoryEXT"); + vkCopyMemoryToImageEXT = (PFN_vkCopyMemoryToImageEXT)load(context, "vkCopyMemoryToImageEXT"); + vkTransitionImageLayoutEXT = (PFN_vkTransitionImageLayoutEXT)load(context, "vkTransitionImageLayoutEXT"); +#endif /* defined(VK_EXT_host_image_copy) */ #if defined(VK_EXT_host_query_reset) vkResetQueryPoolEXT = (PFN_vkResetQueryPoolEXT)load(context, "vkResetQueryPoolEXT"); #endif /* defined(VK_EXT_host_query_reset) */ -#if defined(VK_EXT_image_compression_control) - vkGetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)load(context, "vkGetImageSubresourceLayout2EXT"); -#endif /* defined(VK_EXT_image_compression_control) */ #if defined(VK_EXT_image_drm_format_modifier) vkGetImageDrmFormatModifierPropertiesEXT = (PFN_vkGetImageDrmFormatModifierPropertiesEXT)load(context, "vkGetImageDrmFormatModifierPropertiesEXT"); #endif /* defined(VK_EXT_image_drm_format_modifier) */ #if defined(VK_EXT_line_rasterization) vkCmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT)load(context, "vkCmdSetLineStippleEXT"); #endif /* defined(VK_EXT_line_rasterization) */ +#if defined(VK_EXT_mesh_shader) + vkCmdDrawMeshTasksEXT = (PFN_vkCmdDrawMeshTasksEXT)load(context, "vkCmdDrawMeshTasksEXT"); + vkCmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT)load(context, "vkCmdDrawMeshTasksIndirectCountEXT"); + vkCmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT)load(context, "vkCmdDrawMeshTasksIndirectEXT"); +#endif /* defined(VK_EXT_mesh_shader) */ +#if defined(VK_EXT_metal_objects) + vkExportMetalObjectsEXT = (PFN_vkExportMetalObjectsEXT)load(context, "vkExportMetalObjectsEXT"); +#endif /* defined(VK_EXT_metal_objects) */ #if defined(VK_EXT_multi_draw) vkCmdDrawMultiEXT = (PFN_vkCmdDrawMultiEXT)load(context, "vkCmdDrawMultiEXT"); vkCmdDrawMultiIndexedEXT = (PFN_vkCmdDrawMultiIndexedEXT)load(context, "vkCmdDrawMultiIndexedEXT"); #endif /* defined(VK_EXT_multi_draw) */ +#if defined(VK_EXT_opacity_micromap) + vkBuildMicromapsEXT = (PFN_vkBuildMicromapsEXT)load(context, "vkBuildMicromapsEXT"); + vkCmdBuildMicromapsEXT = (PFN_vkCmdBuildMicromapsEXT)load(context, "vkCmdBuildMicromapsEXT"); + vkCmdCopyMemoryToMicromapEXT = (PFN_vkCmdCopyMemoryToMicromapEXT)load(context, "vkCmdCopyMemoryToMicromapEXT"); + vkCmdCopyMicromapEXT = (PFN_vkCmdCopyMicromapEXT)load(context, "vkCmdCopyMicromapEXT"); + vkCmdCopyMicromapToMemoryEXT = (PFN_vkCmdCopyMicromapToMemoryEXT)load(context, "vkCmdCopyMicromapToMemoryEXT"); + vkCmdWriteMicromapsPropertiesEXT = (PFN_vkCmdWriteMicromapsPropertiesEXT)load(context, "vkCmdWriteMicromapsPropertiesEXT"); + vkCopyMemoryToMicromapEXT = (PFN_vkCopyMemoryToMicromapEXT)load(context, "vkCopyMemoryToMicromapEXT"); + vkCopyMicromapEXT = (PFN_vkCopyMicromapEXT)load(context, "vkCopyMicromapEXT"); + vkCopyMicromapToMemoryEXT = (PFN_vkCopyMicromapToMemoryEXT)load(context, "vkCopyMicromapToMemoryEXT"); + vkCreateMicromapEXT = (PFN_vkCreateMicromapEXT)load(context, "vkCreateMicromapEXT"); + vkDestroyMicromapEXT = (PFN_vkDestroyMicromapEXT)load(context, "vkDestroyMicromapEXT"); + vkGetDeviceMicromapCompatibilityEXT = (PFN_vkGetDeviceMicromapCompatibilityEXT)load(context, "vkGetDeviceMicromapCompatibilityEXT"); + vkGetMicromapBuildSizesEXT = (PFN_vkGetMicromapBuildSizesEXT)load(context, "vkGetMicromapBuildSizesEXT"); + vkWriteMicromapsPropertiesEXT = (PFN_vkWriteMicromapsPropertiesEXT)load(context, "vkWriteMicromapsPropertiesEXT"); +#endif /* defined(VK_EXT_opacity_micromap) */ #if defined(VK_EXT_pageable_device_local_memory) vkSetDeviceMemoryPriorityEXT = (PFN_vkSetDeviceMemoryPriorityEXT)load(context, "vkSetDeviceMemoryPriorityEXT"); #endif /* defined(VK_EXT_pageable_device_local_memory) */ @@ -652,6 +708,19 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c #if defined(VK_EXT_sample_locations) vkCmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)load(context, "vkCmdSetSampleLocationsEXT"); #endif /* defined(VK_EXT_sample_locations) */ +#if defined(VK_EXT_shader_module_identifier) + vkGetShaderModuleCreateInfoIdentifierEXT = (PFN_vkGetShaderModuleCreateInfoIdentifierEXT)load(context, "vkGetShaderModuleCreateInfoIdentifierEXT"); + vkGetShaderModuleIdentifierEXT = (PFN_vkGetShaderModuleIdentifierEXT)load(context, "vkGetShaderModuleIdentifierEXT"); +#endif /* defined(VK_EXT_shader_module_identifier) */ +#if defined(VK_EXT_shader_object) + vkCmdBindShadersEXT = (PFN_vkCmdBindShadersEXT)load(context, "vkCmdBindShadersEXT"); + vkCreateShadersEXT = (PFN_vkCreateShadersEXT)load(context, "vkCreateShadersEXT"); + vkDestroyShaderEXT = (PFN_vkDestroyShaderEXT)load(context, "vkDestroyShaderEXT"); + vkGetShaderBinaryDataEXT = (PFN_vkGetShaderBinaryDataEXT)load(context, "vkGetShaderBinaryDataEXT"); +#endif /* defined(VK_EXT_shader_object) */ +#if defined(VK_EXT_swapchain_maintenance1) + vkReleaseSwapchainImagesEXT = (PFN_vkReleaseSwapchainImagesEXT)load(context, "vkReleaseSwapchainImagesEXT"); +#endif /* defined(VK_EXT_swapchain_maintenance1) */ #if defined(VK_EXT_transform_feedback) vkCmdBeginQueryIndexedEXT = (PFN_vkCmdBeginQueryIndexedEXT)load(context, "vkCmdBeginQueryIndexedEXT"); vkCmdBeginTransformFeedbackEXT = (PFN_vkCmdBeginTransformFeedbackEXT)load(context, "vkCmdBeginTransformFeedbackEXT"); @@ -666,9 +735,6 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkGetValidationCacheDataEXT = (PFN_vkGetValidationCacheDataEXT)load(context, "vkGetValidationCacheDataEXT"); vkMergeValidationCachesEXT = (PFN_vkMergeValidationCachesEXT)load(context, "vkMergeValidationCachesEXT"); #endif /* defined(VK_EXT_validation_cache) */ -#if defined(VK_EXT_vertex_input_dynamic_state) - vkCmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)load(context, "vkCmdSetVertexInputEXT"); -#endif /* defined(VK_EXT_vertex_input_dynamic_state) */ #if defined(VK_FUCHSIA_buffer_collection) vkCreateBufferCollectionFUCHSIA = (PFN_vkCreateBufferCollectionFUCHSIA)load(context, "vkCreateBufferCollectionFUCHSIA"); vkDestroyBufferCollectionFUCHSIA = (PFN_vkDestroyBufferCollectionFUCHSIA)load(context, "vkDestroyBufferCollectionFUCHSIA"); @@ -688,6 +754,10 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkGetPastPresentationTimingGOOGLE = (PFN_vkGetPastPresentationTimingGOOGLE)load(context, "vkGetPastPresentationTimingGOOGLE"); vkGetRefreshCycleDurationGOOGLE = (PFN_vkGetRefreshCycleDurationGOOGLE)load(context, "vkGetRefreshCycleDurationGOOGLE"); #endif /* defined(VK_GOOGLE_display_timing) */ +#if defined(VK_HUAWEI_cluster_culling_shader) + vkCmdDrawClusterHUAWEI = (PFN_vkCmdDrawClusterHUAWEI)load(context, "vkCmdDrawClusterHUAWEI"); + vkCmdDrawClusterIndirectHUAWEI = (PFN_vkCmdDrawClusterIndirectHUAWEI)load(context, "vkCmdDrawClusterIndirectHUAWEI"); +#endif /* defined(VK_HUAWEI_cluster_culling_shader) */ #if defined(VK_HUAWEI_invocation_mask) vkCmdBindInvocationMaskHUAWEI = (PFN_vkCmdBindInvocationMaskHUAWEI)load(context, "vkCmdBindInvocationMaskHUAWEI"); #endif /* defined(VK_HUAWEI_invocation_mask) */ @@ -818,6 +888,16 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkGetDeviceImageMemoryRequirementsKHR = (PFN_vkGetDeviceImageMemoryRequirementsKHR)load(context, "vkGetDeviceImageMemoryRequirementsKHR"); vkGetDeviceImageSparseMemoryRequirementsKHR = (PFN_vkGetDeviceImageSparseMemoryRequirementsKHR)load(context, "vkGetDeviceImageSparseMemoryRequirementsKHR"); #endif /* defined(VK_KHR_maintenance4) */ +#if defined(VK_KHR_maintenance5) + vkCmdBindIndexBuffer2KHR = (PFN_vkCmdBindIndexBuffer2KHR)load(context, "vkCmdBindIndexBuffer2KHR"); + vkGetDeviceImageSubresourceLayoutKHR = (PFN_vkGetDeviceImageSubresourceLayoutKHR)load(context, "vkGetDeviceImageSubresourceLayoutKHR"); + vkGetImageSubresourceLayout2KHR = (PFN_vkGetImageSubresourceLayout2KHR)load(context, "vkGetImageSubresourceLayout2KHR"); + vkGetRenderingAreaGranularityKHR = (PFN_vkGetRenderingAreaGranularityKHR)load(context, "vkGetRenderingAreaGranularityKHR"); +#endif /* defined(VK_KHR_maintenance5) */ +#if defined(VK_KHR_map_memory2) + vkMapMemory2KHR = (PFN_vkMapMemory2KHR)load(context, "vkMapMemory2KHR"); + vkUnmapMemory2KHR = (PFN_vkUnmapMemory2KHR)load(context, "vkUnmapMemory2KHR"); +#endif /* defined(VK_KHR_map_memory2) */ #if defined(VK_KHR_performance_query) vkAcquireProfilingLockKHR = (PFN_vkAcquireProfilingLockKHR)load(context, "vkAcquireProfilingLockKHR"); vkReleaseProfilingLockKHR = (PFN_vkReleaseProfilingLockKHR)load(context, "vkReleaseProfilingLockKHR"); @@ -883,6 +963,7 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c #endif /* defined(VK_KHR_video_decode_queue) */ #if defined(VK_KHR_video_encode_queue) vkCmdEncodeVideoKHR = (PFN_vkCmdEncodeVideoKHR)load(context, "vkCmdEncodeVideoKHR"); + vkGetEncodedVideoSessionParametersKHR = (PFN_vkGetEncodedVideoSessionParametersKHR)load(context, "vkGetEncodedVideoSessionParametersKHR"); #endif /* defined(VK_KHR_video_encode_queue) */ #if defined(VK_KHR_video_queue) vkBindVideoSessionMemoryKHR = (PFN_vkBindVideoSessionMemoryKHR)load(context, "vkBindVideoSessionMemoryKHR"); @@ -910,6 +991,10 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c #if defined(VK_NV_clip_space_w_scaling) vkCmdSetViewportWScalingNV = (PFN_vkCmdSetViewportWScalingNV)load(context, "vkCmdSetViewportWScalingNV"); #endif /* defined(VK_NV_clip_space_w_scaling) */ +#if defined(VK_NV_copy_memory_indirect) + vkCmdCopyMemoryIndirectNV = (PFN_vkCmdCopyMemoryIndirectNV)load(context, "vkCmdCopyMemoryIndirectNV"); + vkCmdCopyMemoryToImageIndirectNV = (PFN_vkCmdCopyMemoryToImageIndirectNV)load(context, "vkCmdCopyMemoryToImageIndirectNV"); +#endif /* defined(VK_NV_copy_memory_indirect) */ #if defined(VK_NV_device_diagnostic_checkpoints) vkCmdSetCheckpointNV = (PFN_vkCmdSetCheckpointNV)load(context, "vkCmdSetCheckpointNV"); vkGetQueueCheckpointDataNV = (PFN_vkGetQueueCheckpointDataNV)load(context, "vkGetQueueCheckpointDataNV"); @@ -922,6 +1007,11 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkDestroyIndirectCommandsLayoutNV = (PFN_vkDestroyIndirectCommandsLayoutNV)load(context, "vkDestroyIndirectCommandsLayoutNV"); vkGetGeneratedCommandsMemoryRequirementsNV = (PFN_vkGetGeneratedCommandsMemoryRequirementsNV)load(context, "vkGetGeneratedCommandsMemoryRequirementsNV"); #endif /* defined(VK_NV_device_generated_commands) */ +#if defined(VK_NV_device_generated_commands_compute) + vkCmdUpdatePipelineIndirectBufferNV = (PFN_vkCmdUpdatePipelineIndirectBufferNV)load(context, "vkCmdUpdatePipelineIndirectBufferNV"); + vkGetPipelineIndirectDeviceAddressNV = (PFN_vkGetPipelineIndirectDeviceAddressNV)load(context, "vkGetPipelineIndirectDeviceAddressNV"); + vkGetPipelineIndirectMemoryRequirementsNV = (PFN_vkGetPipelineIndirectMemoryRequirementsNV)load(context, "vkGetPipelineIndirectMemoryRequirementsNV"); +#endif /* defined(VK_NV_device_generated_commands_compute) */ #if defined(VK_NV_external_memory_rdma) vkGetMemoryRemoteAddressNV = (PFN_vkGetMemoryRemoteAddressNV)load(context, "vkGetMemoryRemoteAddressNV"); #endif /* defined(VK_NV_external_memory_rdma) */ @@ -931,11 +1021,21 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c #if defined(VK_NV_fragment_shading_rate_enums) vkCmdSetFragmentShadingRateEnumNV = (PFN_vkCmdSetFragmentShadingRateEnumNV)load(context, "vkCmdSetFragmentShadingRateEnumNV"); #endif /* defined(VK_NV_fragment_shading_rate_enums) */ +#if defined(VK_NV_memory_decompression) + vkCmdDecompressMemoryIndirectCountNV = (PFN_vkCmdDecompressMemoryIndirectCountNV)load(context, "vkCmdDecompressMemoryIndirectCountNV"); + vkCmdDecompressMemoryNV = (PFN_vkCmdDecompressMemoryNV)load(context, "vkCmdDecompressMemoryNV"); +#endif /* defined(VK_NV_memory_decompression) */ #if defined(VK_NV_mesh_shader) vkCmdDrawMeshTasksIndirectCountNV = (PFN_vkCmdDrawMeshTasksIndirectCountNV)load(context, "vkCmdDrawMeshTasksIndirectCountNV"); vkCmdDrawMeshTasksIndirectNV = (PFN_vkCmdDrawMeshTasksIndirectNV)load(context, "vkCmdDrawMeshTasksIndirectNV"); vkCmdDrawMeshTasksNV = (PFN_vkCmdDrawMeshTasksNV)load(context, "vkCmdDrawMeshTasksNV"); #endif /* defined(VK_NV_mesh_shader) */ +#if defined(VK_NV_optical_flow) + vkBindOpticalFlowSessionImageNV = (PFN_vkBindOpticalFlowSessionImageNV)load(context, "vkBindOpticalFlowSessionImageNV"); + vkCmdOpticalFlowExecuteNV = (PFN_vkCmdOpticalFlowExecuteNV)load(context, "vkCmdOpticalFlowExecuteNV"); + vkCreateOpticalFlowSessionNV = (PFN_vkCreateOpticalFlowSessionNV)load(context, "vkCreateOpticalFlowSessionNV"); + vkDestroyOpticalFlowSessionNV = (PFN_vkDestroyOpticalFlowSessionNV)load(context, "vkDestroyOpticalFlowSessionNV"); +#endif /* defined(VK_NV_optical_flow) */ #if defined(VK_NV_ray_tracing) vkBindAccelerationStructureMemoryNV = (PFN_vkBindAccelerationStructureMemoryNV)load(context, "vkBindAccelerationStructureMemoryNV"); vkCmdBuildAccelerationStructureNV = (PFN_vkCmdBuildAccelerationStructureNV)load(context, "vkCmdBuildAccelerationStructureNV"); @@ -950,6 +1050,9 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkGetAccelerationStructureMemoryRequirementsNV = (PFN_vkGetAccelerationStructureMemoryRequirementsNV)load(context, "vkGetAccelerationStructureMemoryRequirementsNV"); vkGetRayTracingShaderGroupHandlesNV = (PFN_vkGetRayTracingShaderGroupHandlesNV)load(context, "vkGetRayTracingShaderGroupHandlesNV"); #endif /* defined(VK_NV_ray_tracing) */ +#if defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 + vkCmdSetExclusiveScissorEnableNV = (PFN_vkCmdSetExclusiveScissorEnableNV)load(context, "vkCmdSetExclusiveScissorEnableNV"); +#endif /* defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 */ #if defined(VK_NV_scissor_exclusive) vkCmdSetExclusiveScissorNV = (PFN_vkCmdSetExclusiveScissorNV)load(context, "vkCmdSetExclusiveScissorNV"); #endif /* defined(VK_NV_scissor_exclusive) */ @@ -958,13 +1061,94 @@ static void volkGenLoadDevice(void* context, PFN_vkVoidFunction (*load)(void*, c vkCmdSetCoarseSampleOrderNV = (PFN_vkCmdSetCoarseSampleOrderNV)load(context, "vkCmdSetCoarseSampleOrderNV"); vkCmdSetViewportShadingRatePaletteNV = (PFN_vkCmdSetViewportShadingRatePaletteNV)load(context, "vkCmdSetViewportShadingRatePaletteNV"); #endif /* defined(VK_NV_shading_rate_image) */ +#if defined(VK_QCOM_tile_properties) + vkGetDynamicRenderingTilePropertiesQCOM = (PFN_vkGetDynamicRenderingTilePropertiesQCOM)load(context, "vkGetDynamicRenderingTilePropertiesQCOM"); + vkGetFramebufferTilePropertiesQCOM = (PFN_vkGetFramebufferTilePropertiesQCOM)load(context, "vkGetFramebufferTilePropertiesQCOM"); +#endif /* defined(VK_QCOM_tile_properties) */ +#if defined(VK_QNX_external_memory_screen_buffer) + vkGetScreenBufferPropertiesQNX = (PFN_vkGetScreenBufferPropertiesQNX)load(context, "vkGetScreenBufferPropertiesQNX"); +#endif /* defined(VK_QNX_external_memory_screen_buffer) */ #if defined(VK_VALVE_descriptor_set_host_mapping) vkGetDescriptorSetHostMappingVALVE = (PFN_vkGetDescriptorSetHostMappingVALVE)load(context, "vkGetDescriptorSetHostMappingVALVE"); vkGetDescriptorSetLayoutHostMappingInfoVALVE = (PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE)load(context, "vkGetDescriptorSetLayoutHostMappingInfoVALVE"); #endif /* defined(VK_VALVE_descriptor_set_host_mapping) */ +#if (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) + vkCmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT)load(context, "vkCmdBindVertexBuffers2EXT"); + vkCmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT)load(context, "vkCmdSetCullModeEXT"); + vkCmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT)load(context, "vkCmdSetDepthBoundsTestEnableEXT"); + vkCmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT)load(context, "vkCmdSetDepthCompareOpEXT"); + vkCmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT)load(context, "vkCmdSetDepthTestEnableEXT"); + vkCmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT)load(context, "vkCmdSetDepthWriteEnableEXT"); + vkCmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT)load(context, "vkCmdSetFrontFaceEXT"); + vkCmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT)load(context, "vkCmdSetPrimitiveTopologyEXT"); + vkCmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT)load(context, "vkCmdSetScissorWithCountEXT"); + vkCmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)load(context, "vkCmdSetStencilOpEXT"); + vkCmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)load(context, "vkCmdSetStencilTestEnableEXT"); + vkCmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT)load(context, "vkCmdSetViewportWithCountEXT"); +#endif /* (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) + vkCmdSetDepthBiasEnableEXT = (PFN_vkCmdSetDepthBiasEnableEXT)load(context, "vkCmdSetDepthBiasEnableEXT"); + vkCmdSetLogicOpEXT = (PFN_vkCmdSetLogicOpEXT)load(context, "vkCmdSetLogicOpEXT"); + vkCmdSetPatchControlPointsEXT = (PFN_vkCmdSetPatchControlPointsEXT)load(context, "vkCmdSetPatchControlPointsEXT"); + vkCmdSetPrimitiveRestartEnableEXT = (PFN_vkCmdSetPrimitiveRestartEnableEXT)load(context, "vkCmdSetPrimitiveRestartEnableEXT"); + vkCmdSetRasterizerDiscardEnableEXT = (PFN_vkCmdSetRasterizerDiscardEnableEXT)load(context, "vkCmdSetRasterizerDiscardEnableEXT"); +#endif /* (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) + vkCmdSetAlphaToCoverageEnableEXT = (PFN_vkCmdSetAlphaToCoverageEnableEXT)load(context, "vkCmdSetAlphaToCoverageEnableEXT"); + vkCmdSetAlphaToOneEnableEXT = (PFN_vkCmdSetAlphaToOneEnableEXT)load(context, "vkCmdSetAlphaToOneEnableEXT"); + vkCmdSetColorBlendAdvancedEXT = (PFN_vkCmdSetColorBlendAdvancedEXT)load(context, "vkCmdSetColorBlendAdvancedEXT"); + vkCmdSetColorBlendEnableEXT = (PFN_vkCmdSetColorBlendEnableEXT)load(context, "vkCmdSetColorBlendEnableEXT"); + vkCmdSetColorBlendEquationEXT = (PFN_vkCmdSetColorBlendEquationEXT)load(context, "vkCmdSetColorBlendEquationEXT"); + vkCmdSetColorWriteMaskEXT = (PFN_vkCmdSetColorWriteMaskEXT)load(context, "vkCmdSetColorWriteMaskEXT"); + vkCmdSetConservativeRasterizationModeEXT = (PFN_vkCmdSetConservativeRasterizationModeEXT)load(context, "vkCmdSetConservativeRasterizationModeEXT"); + vkCmdSetDepthClampEnableEXT = (PFN_vkCmdSetDepthClampEnableEXT)load(context, "vkCmdSetDepthClampEnableEXT"); + vkCmdSetDepthClipEnableEXT = (PFN_vkCmdSetDepthClipEnableEXT)load(context, "vkCmdSetDepthClipEnableEXT"); + vkCmdSetDepthClipNegativeOneToOneEXT = (PFN_vkCmdSetDepthClipNegativeOneToOneEXT)load(context, "vkCmdSetDepthClipNegativeOneToOneEXT"); + vkCmdSetExtraPrimitiveOverestimationSizeEXT = (PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT)load(context, "vkCmdSetExtraPrimitiveOverestimationSizeEXT"); + vkCmdSetLineRasterizationModeEXT = (PFN_vkCmdSetLineRasterizationModeEXT)load(context, "vkCmdSetLineRasterizationModeEXT"); + vkCmdSetLineStippleEnableEXT = (PFN_vkCmdSetLineStippleEnableEXT)load(context, "vkCmdSetLineStippleEnableEXT"); + vkCmdSetLogicOpEnableEXT = (PFN_vkCmdSetLogicOpEnableEXT)load(context, "vkCmdSetLogicOpEnableEXT"); + vkCmdSetPolygonModeEXT = (PFN_vkCmdSetPolygonModeEXT)load(context, "vkCmdSetPolygonModeEXT"); + vkCmdSetProvokingVertexModeEXT = (PFN_vkCmdSetProvokingVertexModeEXT)load(context, "vkCmdSetProvokingVertexModeEXT"); + vkCmdSetRasterizationSamplesEXT = (PFN_vkCmdSetRasterizationSamplesEXT)load(context, "vkCmdSetRasterizationSamplesEXT"); + vkCmdSetRasterizationStreamEXT = (PFN_vkCmdSetRasterizationStreamEXT)load(context, "vkCmdSetRasterizationStreamEXT"); + vkCmdSetSampleLocationsEnableEXT = (PFN_vkCmdSetSampleLocationsEnableEXT)load(context, "vkCmdSetSampleLocationsEnableEXT"); + vkCmdSetSampleMaskEXT = (PFN_vkCmdSetSampleMaskEXT)load(context, "vkCmdSetSampleMaskEXT"); + vkCmdSetTessellationDomainOriginEXT = (PFN_vkCmdSetTessellationDomainOriginEXT)load(context, "vkCmdSetTessellationDomainOriginEXT"); +#endif /* (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) + vkCmdSetViewportWScalingEnableNV = (PFN_vkCmdSetViewportWScalingEnableNV)load(context, "vkCmdSetViewportWScalingEnableNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) + vkCmdSetViewportSwizzleNV = (PFN_vkCmdSetViewportSwizzleNV)load(context, "vkCmdSetViewportSwizzleNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) + vkCmdSetCoverageToColorEnableNV = (PFN_vkCmdSetCoverageToColorEnableNV)load(context, "vkCmdSetCoverageToColorEnableNV"); + vkCmdSetCoverageToColorLocationNV = (PFN_vkCmdSetCoverageToColorLocationNV)load(context, "vkCmdSetCoverageToColorLocationNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) + vkCmdSetCoverageModulationModeNV = (PFN_vkCmdSetCoverageModulationModeNV)load(context, "vkCmdSetCoverageModulationModeNV"); + vkCmdSetCoverageModulationTableEnableNV = (PFN_vkCmdSetCoverageModulationTableEnableNV)load(context, "vkCmdSetCoverageModulationTableEnableNV"); + vkCmdSetCoverageModulationTableNV = (PFN_vkCmdSetCoverageModulationTableNV)load(context, "vkCmdSetCoverageModulationTableNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) + vkCmdSetShadingRateImageEnableNV = (PFN_vkCmdSetShadingRateImageEnableNV)load(context, "vkCmdSetShadingRateImageEnableNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) + vkCmdSetRepresentativeFragmentTestEnableNV = (PFN_vkCmdSetRepresentativeFragmentTestEnableNV)load(context, "vkCmdSetRepresentativeFragmentTestEnableNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) + vkCmdSetCoverageReductionModeNV = (PFN_vkCmdSetCoverageReductionModeNV)load(context, "vkCmdSetCoverageReductionModeNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) */ #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) vkGetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)load(context, "vkGetDeviceGroupSurfacePresentModes2EXT"); #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ +#if (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) + vkGetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)load(context, "vkGetImageSubresourceLayout2EXT"); +#endif /* (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) */ +#if (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) + vkCmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)load(context, "vkCmdSetVertexInputEXT"); +#endif /* (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) */ #if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) vkCmdPushDescriptorSetWithTemplateKHR = (PFN_vkCmdPushDescriptorSetWithTemplateKHR)load(context, "vkCmdPushDescriptorSetWithTemplateKHR"); #endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ @@ -1174,6 +1358,15 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkQueueSubmit2 = (PFN_vkQueueSubmit2)load(context, "vkQueueSubmit2"); table->vkSetPrivateData = (PFN_vkSetPrivateData)load(context, "vkSetPrivateData"); #endif /* defined(VK_VERSION_1_3) */ +#if defined(VK_AMDX_shader_enqueue) + table->vkCmdDispatchGraphAMDX = (PFN_vkCmdDispatchGraphAMDX)load(context, "vkCmdDispatchGraphAMDX"); + table->vkCmdDispatchGraphIndirectAMDX = (PFN_vkCmdDispatchGraphIndirectAMDX)load(context, "vkCmdDispatchGraphIndirectAMDX"); + table->vkCmdDispatchGraphIndirectCountAMDX = (PFN_vkCmdDispatchGraphIndirectCountAMDX)load(context, "vkCmdDispatchGraphIndirectCountAMDX"); + table->vkCmdInitializeGraphScratchMemoryAMDX = (PFN_vkCmdInitializeGraphScratchMemoryAMDX)load(context, "vkCmdInitializeGraphScratchMemoryAMDX"); + table->vkCreateExecutionGraphPipelinesAMDX = (PFN_vkCreateExecutionGraphPipelinesAMDX)load(context, "vkCreateExecutionGraphPipelinesAMDX"); + table->vkGetExecutionGraphPipelineNodeIndexAMDX = (PFN_vkGetExecutionGraphPipelineNodeIndexAMDX)load(context, "vkGetExecutionGraphPipelineNodeIndexAMDX"); + table->vkGetExecutionGraphPipelineScratchSizeAMDX = (PFN_vkGetExecutionGraphPipelineScratchSizeAMDX)load(context, "vkGetExecutionGraphPipelineScratchSizeAMDX"); +#endif /* defined(VK_AMDX_shader_enqueue) */ #if defined(VK_AMD_buffer_marker) table->vkCmdWriteBufferMarkerAMD = (PFN_vkCmdWriteBufferMarkerAMD)load(context, "vkCmdWriteBufferMarkerAMD"); #endif /* defined(VK_AMD_buffer_marker) */ @@ -1191,6 +1384,9 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkGetAndroidHardwareBufferPropertiesANDROID = (PFN_vkGetAndroidHardwareBufferPropertiesANDROID)load(context, "vkGetAndroidHardwareBufferPropertiesANDROID"); table->vkGetMemoryAndroidHardwareBufferANDROID = (PFN_vkGetMemoryAndroidHardwareBufferANDROID)load(context, "vkGetMemoryAndroidHardwareBufferANDROID"); #endif /* defined(VK_ANDROID_external_memory_android_hardware_buffer) */ +#if defined(VK_EXT_attachment_feedback_loop_dynamic_state) + table->vkCmdSetAttachmentFeedbackLoopEnableEXT = (PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT)load(context, "vkCmdSetAttachmentFeedbackLoopEnableEXT"); +#endif /* defined(VK_EXT_attachment_feedback_loop_dynamic_state) */ #if defined(VK_EXT_buffer_device_address) table->vkGetBufferDeviceAddressEXT = (PFN_vkGetBufferDeviceAddressEXT)load(context, "vkGetBufferDeviceAddressEXT"); #endif /* defined(VK_EXT_buffer_device_address) */ @@ -1211,36 +1407,40 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkDebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)load(context, "vkDebugMarkerSetObjectNameEXT"); table->vkDebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)load(context, "vkDebugMarkerSetObjectTagEXT"); #endif /* defined(VK_EXT_debug_marker) */ +#if defined(VK_EXT_depth_bias_control) + table->vkCmdSetDepthBias2EXT = (PFN_vkCmdSetDepthBias2EXT)load(context, "vkCmdSetDepthBias2EXT"); +#endif /* defined(VK_EXT_depth_bias_control) */ +#if defined(VK_EXT_descriptor_buffer) + table->vkCmdBindDescriptorBufferEmbeddedSamplersEXT = (PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)load(context, "vkCmdBindDescriptorBufferEmbeddedSamplersEXT"); + table->vkCmdBindDescriptorBuffersEXT = (PFN_vkCmdBindDescriptorBuffersEXT)load(context, "vkCmdBindDescriptorBuffersEXT"); + table->vkCmdSetDescriptorBufferOffsetsEXT = (PFN_vkCmdSetDescriptorBufferOffsetsEXT)load(context, "vkCmdSetDescriptorBufferOffsetsEXT"); + table->vkGetBufferOpaqueCaptureDescriptorDataEXT = (PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT)load(context, "vkGetBufferOpaqueCaptureDescriptorDataEXT"); + table->vkGetDescriptorEXT = (PFN_vkGetDescriptorEXT)load(context, "vkGetDescriptorEXT"); + table->vkGetDescriptorSetLayoutBindingOffsetEXT = (PFN_vkGetDescriptorSetLayoutBindingOffsetEXT)load(context, "vkGetDescriptorSetLayoutBindingOffsetEXT"); + table->vkGetDescriptorSetLayoutSizeEXT = (PFN_vkGetDescriptorSetLayoutSizeEXT)load(context, "vkGetDescriptorSetLayoutSizeEXT"); + table->vkGetImageOpaqueCaptureDescriptorDataEXT = (PFN_vkGetImageOpaqueCaptureDescriptorDataEXT)load(context, "vkGetImageOpaqueCaptureDescriptorDataEXT"); + table->vkGetImageViewOpaqueCaptureDescriptorDataEXT = (PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT)load(context, "vkGetImageViewOpaqueCaptureDescriptorDataEXT"); + table->vkGetSamplerOpaqueCaptureDescriptorDataEXT = (PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT)load(context, "vkGetSamplerOpaqueCaptureDescriptorDataEXT"); +#endif /* defined(VK_EXT_descriptor_buffer) */ +#if defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) + table->vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT = (PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)load(context, "vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT"); +#endif /* defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) */ +#if defined(VK_EXT_device_fault) + table->vkGetDeviceFaultInfoEXT = (PFN_vkGetDeviceFaultInfoEXT)load(context, "vkGetDeviceFaultInfoEXT"); +#endif /* defined(VK_EXT_device_fault) */ #if defined(VK_EXT_discard_rectangles) table->vkCmdSetDiscardRectangleEXT = (PFN_vkCmdSetDiscardRectangleEXT)load(context, "vkCmdSetDiscardRectangleEXT"); #endif /* defined(VK_EXT_discard_rectangles) */ +#if defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 + table->vkCmdSetDiscardRectangleEnableEXT = (PFN_vkCmdSetDiscardRectangleEnableEXT)load(context, "vkCmdSetDiscardRectangleEnableEXT"); + table->vkCmdSetDiscardRectangleModeEXT = (PFN_vkCmdSetDiscardRectangleModeEXT)load(context, "vkCmdSetDiscardRectangleModeEXT"); +#endif /* defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 */ #if defined(VK_EXT_display_control) table->vkDisplayPowerControlEXT = (PFN_vkDisplayPowerControlEXT)load(context, "vkDisplayPowerControlEXT"); table->vkGetSwapchainCounterEXT = (PFN_vkGetSwapchainCounterEXT)load(context, "vkGetSwapchainCounterEXT"); table->vkRegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT)load(context, "vkRegisterDeviceEventEXT"); table->vkRegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT)load(context, "vkRegisterDisplayEventEXT"); #endif /* defined(VK_EXT_display_control) */ -#if defined(VK_EXT_extended_dynamic_state) - table->vkCmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT)load(context, "vkCmdBindVertexBuffers2EXT"); - table->vkCmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT)load(context, "vkCmdSetCullModeEXT"); - table->vkCmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT)load(context, "vkCmdSetDepthBoundsTestEnableEXT"); - table->vkCmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT)load(context, "vkCmdSetDepthCompareOpEXT"); - table->vkCmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT)load(context, "vkCmdSetDepthTestEnableEXT"); - table->vkCmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT)load(context, "vkCmdSetDepthWriteEnableEXT"); - table->vkCmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT)load(context, "vkCmdSetFrontFaceEXT"); - table->vkCmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT)load(context, "vkCmdSetPrimitiveTopologyEXT"); - table->vkCmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT)load(context, "vkCmdSetScissorWithCountEXT"); - table->vkCmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)load(context, "vkCmdSetStencilOpEXT"); - table->vkCmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)load(context, "vkCmdSetStencilTestEnableEXT"); - table->vkCmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT)load(context, "vkCmdSetViewportWithCountEXT"); -#endif /* defined(VK_EXT_extended_dynamic_state) */ -#if defined(VK_EXT_extended_dynamic_state2) - table->vkCmdSetDepthBiasEnableEXT = (PFN_vkCmdSetDepthBiasEnableEXT)load(context, "vkCmdSetDepthBiasEnableEXT"); - table->vkCmdSetLogicOpEXT = (PFN_vkCmdSetLogicOpEXT)load(context, "vkCmdSetLogicOpEXT"); - table->vkCmdSetPatchControlPointsEXT = (PFN_vkCmdSetPatchControlPointsEXT)load(context, "vkCmdSetPatchControlPointsEXT"); - table->vkCmdSetPrimitiveRestartEnableEXT = (PFN_vkCmdSetPrimitiveRestartEnableEXT)load(context, "vkCmdSetPrimitiveRestartEnableEXT"); - table->vkCmdSetRasterizerDiscardEnableEXT = (PFN_vkCmdSetRasterizerDiscardEnableEXT)load(context, "vkCmdSetRasterizerDiscardEnableEXT"); -#endif /* defined(VK_EXT_extended_dynamic_state2) */ #if defined(VK_EXT_external_memory_host) table->vkGetMemoryHostPointerPropertiesEXT = (PFN_vkGetMemoryHostPointerPropertiesEXT)load(context, "vkGetMemoryHostPointerPropertiesEXT"); #endif /* defined(VK_EXT_external_memory_host) */ @@ -1251,22 +1451,49 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, #if defined(VK_EXT_hdr_metadata) table->vkSetHdrMetadataEXT = (PFN_vkSetHdrMetadataEXT)load(context, "vkSetHdrMetadataEXT"); #endif /* defined(VK_EXT_hdr_metadata) */ +#if defined(VK_EXT_host_image_copy) + table->vkCopyImageToImageEXT = (PFN_vkCopyImageToImageEXT)load(context, "vkCopyImageToImageEXT"); + table->vkCopyImageToMemoryEXT = (PFN_vkCopyImageToMemoryEXT)load(context, "vkCopyImageToMemoryEXT"); + table->vkCopyMemoryToImageEXT = (PFN_vkCopyMemoryToImageEXT)load(context, "vkCopyMemoryToImageEXT"); + table->vkTransitionImageLayoutEXT = (PFN_vkTransitionImageLayoutEXT)load(context, "vkTransitionImageLayoutEXT"); +#endif /* defined(VK_EXT_host_image_copy) */ #if defined(VK_EXT_host_query_reset) table->vkResetQueryPoolEXT = (PFN_vkResetQueryPoolEXT)load(context, "vkResetQueryPoolEXT"); #endif /* defined(VK_EXT_host_query_reset) */ -#if defined(VK_EXT_image_compression_control) - table->vkGetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)load(context, "vkGetImageSubresourceLayout2EXT"); -#endif /* defined(VK_EXT_image_compression_control) */ #if defined(VK_EXT_image_drm_format_modifier) table->vkGetImageDrmFormatModifierPropertiesEXT = (PFN_vkGetImageDrmFormatModifierPropertiesEXT)load(context, "vkGetImageDrmFormatModifierPropertiesEXT"); #endif /* defined(VK_EXT_image_drm_format_modifier) */ #if defined(VK_EXT_line_rasterization) table->vkCmdSetLineStippleEXT = (PFN_vkCmdSetLineStippleEXT)load(context, "vkCmdSetLineStippleEXT"); #endif /* defined(VK_EXT_line_rasterization) */ +#if defined(VK_EXT_mesh_shader) + table->vkCmdDrawMeshTasksEXT = (PFN_vkCmdDrawMeshTasksEXT)load(context, "vkCmdDrawMeshTasksEXT"); + table->vkCmdDrawMeshTasksIndirectCountEXT = (PFN_vkCmdDrawMeshTasksIndirectCountEXT)load(context, "vkCmdDrawMeshTasksIndirectCountEXT"); + table->vkCmdDrawMeshTasksIndirectEXT = (PFN_vkCmdDrawMeshTasksIndirectEXT)load(context, "vkCmdDrawMeshTasksIndirectEXT"); +#endif /* defined(VK_EXT_mesh_shader) */ +#if defined(VK_EXT_metal_objects) + table->vkExportMetalObjectsEXT = (PFN_vkExportMetalObjectsEXT)load(context, "vkExportMetalObjectsEXT"); +#endif /* defined(VK_EXT_metal_objects) */ #if defined(VK_EXT_multi_draw) table->vkCmdDrawMultiEXT = (PFN_vkCmdDrawMultiEXT)load(context, "vkCmdDrawMultiEXT"); table->vkCmdDrawMultiIndexedEXT = (PFN_vkCmdDrawMultiIndexedEXT)load(context, "vkCmdDrawMultiIndexedEXT"); #endif /* defined(VK_EXT_multi_draw) */ +#if defined(VK_EXT_opacity_micromap) + table->vkBuildMicromapsEXT = (PFN_vkBuildMicromapsEXT)load(context, "vkBuildMicromapsEXT"); + table->vkCmdBuildMicromapsEXT = (PFN_vkCmdBuildMicromapsEXT)load(context, "vkCmdBuildMicromapsEXT"); + table->vkCmdCopyMemoryToMicromapEXT = (PFN_vkCmdCopyMemoryToMicromapEXT)load(context, "vkCmdCopyMemoryToMicromapEXT"); + table->vkCmdCopyMicromapEXT = (PFN_vkCmdCopyMicromapEXT)load(context, "vkCmdCopyMicromapEXT"); + table->vkCmdCopyMicromapToMemoryEXT = (PFN_vkCmdCopyMicromapToMemoryEXT)load(context, "vkCmdCopyMicromapToMemoryEXT"); + table->vkCmdWriteMicromapsPropertiesEXT = (PFN_vkCmdWriteMicromapsPropertiesEXT)load(context, "vkCmdWriteMicromapsPropertiesEXT"); + table->vkCopyMemoryToMicromapEXT = (PFN_vkCopyMemoryToMicromapEXT)load(context, "vkCopyMemoryToMicromapEXT"); + table->vkCopyMicromapEXT = (PFN_vkCopyMicromapEXT)load(context, "vkCopyMicromapEXT"); + table->vkCopyMicromapToMemoryEXT = (PFN_vkCopyMicromapToMemoryEXT)load(context, "vkCopyMicromapToMemoryEXT"); + table->vkCreateMicromapEXT = (PFN_vkCreateMicromapEXT)load(context, "vkCreateMicromapEXT"); + table->vkDestroyMicromapEXT = (PFN_vkDestroyMicromapEXT)load(context, "vkDestroyMicromapEXT"); + table->vkGetDeviceMicromapCompatibilityEXT = (PFN_vkGetDeviceMicromapCompatibilityEXT)load(context, "vkGetDeviceMicromapCompatibilityEXT"); + table->vkGetMicromapBuildSizesEXT = (PFN_vkGetMicromapBuildSizesEXT)load(context, "vkGetMicromapBuildSizesEXT"); + table->vkWriteMicromapsPropertiesEXT = (PFN_vkWriteMicromapsPropertiesEXT)load(context, "vkWriteMicromapsPropertiesEXT"); +#endif /* defined(VK_EXT_opacity_micromap) */ #if defined(VK_EXT_pageable_device_local_memory) table->vkSetDeviceMemoryPriorityEXT = (PFN_vkSetDeviceMemoryPriorityEXT)load(context, "vkSetDeviceMemoryPriorityEXT"); #endif /* defined(VK_EXT_pageable_device_local_memory) */ @@ -1282,6 +1509,19 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, #if defined(VK_EXT_sample_locations) table->vkCmdSetSampleLocationsEXT = (PFN_vkCmdSetSampleLocationsEXT)load(context, "vkCmdSetSampleLocationsEXT"); #endif /* defined(VK_EXT_sample_locations) */ +#if defined(VK_EXT_shader_module_identifier) + table->vkGetShaderModuleCreateInfoIdentifierEXT = (PFN_vkGetShaderModuleCreateInfoIdentifierEXT)load(context, "vkGetShaderModuleCreateInfoIdentifierEXT"); + table->vkGetShaderModuleIdentifierEXT = (PFN_vkGetShaderModuleIdentifierEXT)load(context, "vkGetShaderModuleIdentifierEXT"); +#endif /* defined(VK_EXT_shader_module_identifier) */ +#if defined(VK_EXT_shader_object) + table->vkCmdBindShadersEXT = (PFN_vkCmdBindShadersEXT)load(context, "vkCmdBindShadersEXT"); + table->vkCreateShadersEXT = (PFN_vkCreateShadersEXT)load(context, "vkCreateShadersEXT"); + table->vkDestroyShaderEXT = (PFN_vkDestroyShaderEXT)load(context, "vkDestroyShaderEXT"); + table->vkGetShaderBinaryDataEXT = (PFN_vkGetShaderBinaryDataEXT)load(context, "vkGetShaderBinaryDataEXT"); +#endif /* defined(VK_EXT_shader_object) */ +#if defined(VK_EXT_swapchain_maintenance1) + table->vkReleaseSwapchainImagesEXT = (PFN_vkReleaseSwapchainImagesEXT)load(context, "vkReleaseSwapchainImagesEXT"); +#endif /* defined(VK_EXT_swapchain_maintenance1) */ #if defined(VK_EXT_transform_feedback) table->vkCmdBeginQueryIndexedEXT = (PFN_vkCmdBeginQueryIndexedEXT)load(context, "vkCmdBeginQueryIndexedEXT"); table->vkCmdBeginTransformFeedbackEXT = (PFN_vkCmdBeginTransformFeedbackEXT)load(context, "vkCmdBeginTransformFeedbackEXT"); @@ -1296,9 +1536,6 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkGetValidationCacheDataEXT = (PFN_vkGetValidationCacheDataEXT)load(context, "vkGetValidationCacheDataEXT"); table->vkMergeValidationCachesEXT = (PFN_vkMergeValidationCachesEXT)load(context, "vkMergeValidationCachesEXT"); #endif /* defined(VK_EXT_validation_cache) */ -#if defined(VK_EXT_vertex_input_dynamic_state) - table->vkCmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)load(context, "vkCmdSetVertexInputEXT"); -#endif /* defined(VK_EXT_vertex_input_dynamic_state) */ #if defined(VK_FUCHSIA_buffer_collection) table->vkCreateBufferCollectionFUCHSIA = (PFN_vkCreateBufferCollectionFUCHSIA)load(context, "vkCreateBufferCollectionFUCHSIA"); table->vkDestroyBufferCollectionFUCHSIA = (PFN_vkDestroyBufferCollectionFUCHSIA)load(context, "vkDestroyBufferCollectionFUCHSIA"); @@ -1318,6 +1555,10 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkGetPastPresentationTimingGOOGLE = (PFN_vkGetPastPresentationTimingGOOGLE)load(context, "vkGetPastPresentationTimingGOOGLE"); table->vkGetRefreshCycleDurationGOOGLE = (PFN_vkGetRefreshCycleDurationGOOGLE)load(context, "vkGetRefreshCycleDurationGOOGLE"); #endif /* defined(VK_GOOGLE_display_timing) */ +#if defined(VK_HUAWEI_cluster_culling_shader) + table->vkCmdDrawClusterHUAWEI = (PFN_vkCmdDrawClusterHUAWEI)load(context, "vkCmdDrawClusterHUAWEI"); + table->vkCmdDrawClusterIndirectHUAWEI = (PFN_vkCmdDrawClusterIndirectHUAWEI)load(context, "vkCmdDrawClusterIndirectHUAWEI"); +#endif /* defined(VK_HUAWEI_cluster_culling_shader) */ #if defined(VK_HUAWEI_invocation_mask) table->vkCmdBindInvocationMaskHUAWEI = (PFN_vkCmdBindInvocationMaskHUAWEI)load(context, "vkCmdBindInvocationMaskHUAWEI"); #endif /* defined(VK_HUAWEI_invocation_mask) */ @@ -1448,6 +1689,16 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkGetDeviceImageMemoryRequirementsKHR = (PFN_vkGetDeviceImageMemoryRequirementsKHR)load(context, "vkGetDeviceImageMemoryRequirementsKHR"); table->vkGetDeviceImageSparseMemoryRequirementsKHR = (PFN_vkGetDeviceImageSparseMemoryRequirementsKHR)load(context, "vkGetDeviceImageSparseMemoryRequirementsKHR"); #endif /* defined(VK_KHR_maintenance4) */ +#if defined(VK_KHR_maintenance5) + table->vkCmdBindIndexBuffer2KHR = (PFN_vkCmdBindIndexBuffer2KHR)load(context, "vkCmdBindIndexBuffer2KHR"); + table->vkGetDeviceImageSubresourceLayoutKHR = (PFN_vkGetDeviceImageSubresourceLayoutKHR)load(context, "vkGetDeviceImageSubresourceLayoutKHR"); + table->vkGetImageSubresourceLayout2KHR = (PFN_vkGetImageSubresourceLayout2KHR)load(context, "vkGetImageSubresourceLayout2KHR"); + table->vkGetRenderingAreaGranularityKHR = (PFN_vkGetRenderingAreaGranularityKHR)load(context, "vkGetRenderingAreaGranularityKHR"); +#endif /* defined(VK_KHR_maintenance5) */ +#if defined(VK_KHR_map_memory2) + table->vkMapMemory2KHR = (PFN_vkMapMemory2KHR)load(context, "vkMapMemory2KHR"); + table->vkUnmapMemory2KHR = (PFN_vkUnmapMemory2KHR)load(context, "vkUnmapMemory2KHR"); +#endif /* defined(VK_KHR_map_memory2) */ #if defined(VK_KHR_performance_query) table->vkAcquireProfilingLockKHR = (PFN_vkAcquireProfilingLockKHR)load(context, "vkAcquireProfilingLockKHR"); table->vkReleaseProfilingLockKHR = (PFN_vkReleaseProfilingLockKHR)load(context, "vkReleaseProfilingLockKHR"); @@ -1513,6 +1764,7 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, #endif /* defined(VK_KHR_video_decode_queue) */ #if defined(VK_KHR_video_encode_queue) table->vkCmdEncodeVideoKHR = (PFN_vkCmdEncodeVideoKHR)load(context, "vkCmdEncodeVideoKHR"); + table->vkGetEncodedVideoSessionParametersKHR = (PFN_vkGetEncodedVideoSessionParametersKHR)load(context, "vkGetEncodedVideoSessionParametersKHR"); #endif /* defined(VK_KHR_video_encode_queue) */ #if defined(VK_KHR_video_queue) table->vkBindVideoSessionMemoryKHR = (PFN_vkBindVideoSessionMemoryKHR)load(context, "vkBindVideoSessionMemoryKHR"); @@ -1540,6 +1792,10 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, #if defined(VK_NV_clip_space_w_scaling) table->vkCmdSetViewportWScalingNV = (PFN_vkCmdSetViewportWScalingNV)load(context, "vkCmdSetViewportWScalingNV"); #endif /* defined(VK_NV_clip_space_w_scaling) */ +#if defined(VK_NV_copy_memory_indirect) + table->vkCmdCopyMemoryIndirectNV = (PFN_vkCmdCopyMemoryIndirectNV)load(context, "vkCmdCopyMemoryIndirectNV"); + table->vkCmdCopyMemoryToImageIndirectNV = (PFN_vkCmdCopyMemoryToImageIndirectNV)load(context, "vkCmdCopyMemoryToImageIndirectNV"); +#endif /* defined(VK_NV_copy_memory_indirect) */ #if defined(VK_NV_device_diagnostic_checkpoints) table->vkCmdSetCheckpointNV = (PFN_vkCmdSetCheckpointNV)load(context, "vkCmdSetCheckpointNV"); table->vkGetQueueCheckpointDataNV = (PFN_vkGetQueueCheckpointDataNV)load(context, "vkGetQueueCheckpointDataNV"); @@ -1552,6 +1808,11 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkDestroyIndirectCommandsLayoutNV = (PFN_vkDestroyIndirectCommandsLayoutNV)load(context, "vkDestroyIndirectCommandsLayoutNV"); table->vkGetGeneratedCommandsMemoryRequirementsNV = (PFN_vkGetGeneratedCommandsMemoryRequirementsNV)load(context, "vkGetGeneratedCommandsMemoryRequirementsNV"); #endif /* defined(VK_NV_device_generated_commands) */ +#if defined(VK_NV_device_generated_commands_compute) + table->vkCmdUpdatePipelineIndirectBufferNV = (PFN_vkCmdUpdatePipelineIndirectBufferNV)load(context, "vkCmdUpdatePipelineIndirectBufferNV"); + table->vkGetPipelineIndirectDeviceAddressNV = (PFN_vkGetPipelineIndirectDeviceAddressNV)load(context, "vkGetPipelineIndirectDeviceAddressNV"); + table->vkGetPipelineIndirectMemoryRequirementsNV = (PFN_vkGetPipelineIndirectMemoryRequirementsNV)load(context, "vkGetPipelineIndirectMemoryRequirementsNV"); +#endif /* defined(VK_NV_device_generated_commands_compute) */ #if defined(VK_NV_external_memory_rdma) table->vkGetMemoryRemoteAddressNV = (PFN_vkGetMemoryRemoteAddressNV)load(context, "vkGetMemoryRemoteAddressNV"); #endif /* defined(VK_NV_external_memory_rdma) */ @@ -1561,11 +1822,21 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, #if defined(VK_NV_fragment_shading_rate_enums) table->vkCmdSetFragmentShadingRateEnumNV = (PFN_vkCmdSetFragmentShadingRateEnumNV)load(context, "vkCmdSetFragmentShadingRateEnumNV"); #endif /* defined(VK_NV_fragment_shading_rate_enums) */ +#if defined(VK_NV_memory_decompression) + table->vkCmdDecompressMemoryIndirectCountNV = (PFN_vkCmdDecompressMemoryIndirectCountNV)load(context, "vkCmdDecompressMemoryIndirectCountNV"); + table->vkCmdDecompressMemoryNV = (PFN_vkCmdDecompressMemoryNV)load(context, "vkCmdDecompressMemoryNV"); +#endif /* defined(VK_NV_memory_decompression) */ #if defined(VK_NV_mesh_shader) table->vkCmdDrawMeshTasksIndirectCountNV = (PFN_vkCmdDrawMeshTasksIndirectCountNV)load(context, "vkCmdDrawMeshTasksIndirectCountNV"); table->vkCmdDrawMeshTasksIndirectNV = (PFN_vkCmdDrawMeshTasksIndirectNV)load(context, "vkCmdDrawMeshTasksIndirectNV"); table->vkCmdDrawMeshTasksNV = (PFN_vkCmdDrawMeshTasksNV)load(context, "vkCmdDrawMeshTasksNV"); #endif /* defined(VK_NV_mesh_shader) */ +#if defined(VK_NV_optical_flow) + table->vkBindOpticalFlowSessionImageNV = (PFN_vkBindOpticalFlowSessionImageNV)load(context, "vkBindOpticalFlowSessionImageNV"); + table->vkCmdOpticalFlowExecuteNV = (PFN_vkCmdOpticalFlowExecuteNV)load(context, "vkCmdOpticalFlowExecuteNV"); + table->vkCreateOpticalFlowSessionNV = (PFN_vkCreateOpticalFlowSessionNV)load(context, "vkCreateOpticalFlowSessionNV"); + table->vkDestroyOpticalFlowSessionNV = (PFN_vkDestroyOpticalFlowSessionNV)load(context, "vkDestroyOpticalFlowSessionNV"); +#endif /* defined(VK_NV_optical_flow) */ #if defined(VK_NV_ray_tracing) table->vkBindAccelerationStructureMemoryNV = (PFN_vkBindAccelerationStructureMemoryNV)load(context, "vkBindAccelerationStructureMemoryNV"); table->vkCmdBuildAccelerationStructureNV = (PFN_vkCmdBuildAccelerationStructureNV)load(context, "vkCmdBuildAccelerationStructureNV"); @@ -1580,6 +1851,9 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkGetAccelerationStructureMemoryRequirementsNV = (PFN_vkGetAccelerationStructureMemoryRequirementsNV)load(context, "vkGetAccelerationStructureMemoryRequirementsNV"); table->vkGetRayTracingShaderGroupHandlesNV = (PFN_vkGetRayTracingShaderGroupHandlesNV)load(context, "vkGetRayTracingShaderGroupHandlesNV"); #endif /* defined(VK_NV_ray_tracing) */ +#if defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 + table->vkCmdSetExclusiveScissorEnableNV = (PFN_vkCmdSetExclusiveScissorEnableNV)load(context, "vkCmdSetExclusiveScissorEnableNV"); +#endif /* defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 */ #if defined(VK_NV_scissor_exclusive) table->vkCmdSetExclusiveScissorNV = (PFN_vkCmdSetExclusiveScissorNV)load(context, "vkCmdSetExclusiveScissorNV"); #endif /* defined(VK_NV_scissor_exclusive) */ @@ -1588,13 +1862,94 @@ static void volkGenLoadDeviceTable(struct VolkDeviceTable* table, void* context, table->vkCmdSetCoarseSampleOrderNV = (PFN_vkCmdSetCoarseSampleOrderNV)load(context, "vkCmdSetCoarseSampleOrderNV"); table->vkCmdSetViewportShadingRatePaletteNV = (PFN_vkCmdSetViewportShadingRatePaletteNV)load(context, "vkCmdSetViewportShadingRatePaletteNV"); #endif /* defined(VK_NV_shading_rate_image) */ +#if defined(VK_QCOM_tile_properties) + table->vkGetDynamicRenderingTilePropertiesQCOM = (PFN_vkGetDynamicRenderingTilePropertiesQCOM)load(context, "vkGetDynamicRenderingTilePropertiesQCOM"); + table->vkGetFramebufferTilePropertiesQCOM = (PFN_vkGetFramebufferTilePropertiesQCOM)load(context, "vkGetFramebufferTilePropertiesQCOM"); +#endif /* defined(VK_QCOM_tile_properties) */ +#if defined(VK_QNX_external_memory_screen_buffer) + table->vkGetScreenBufferPropertiesQNX = (PFN_vkGetScreenBufferPropertiesQNX)load(context, "vkGetScreenBufferPropertiesQNX"); +#endif /* defined(VK_QNX_external_memory_screen_buffer) */ #if defined(VK_VALVE_descriptor_set_host_mapping) table->vkGetDescriptorSetHostMappingVALVE = (PFN_vkGetDescriptorSetHostMappingVALVE)load(context, "vkGetDescriptorSetHostMappingVALVE"); table->vkGetDescriptorSetLayoutHostMappingInfoVALVE = (PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE)load(context, "vkGetDescriptorSetLayoutHostMappingInfoVALVE"); #endif /* defined(VK_VALVE_descriptor_set_host_mapping) */ +#if (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) + table->vkCmdBindVertexBuffers2EXT = (PFN_vkCmdBindVertexBuffers2EXT)load(context, "vkCmdBindVertexBuffers2EXT"); + table->vkCmdSetCullModeEXT = (PFN_vkCmdSetCullModeEXT)load(context, "vkCmdSetCullModeEXT"); + table->vkCmdSetDepthBoundsTestEnableEXT = (PFN_vkCmdSetDepthBoundsTestEnableEXT)load(context, "vkCmdSetDepthBoundsTestEnableEXT"); + table->vkCmdSetDepthCompareOpEXT = (PFN_vkCmdSetDepthCompareOpEXT)load(context, "vkCmdSetDepthCompareOpEXT"); + table->vkCmdSetDepthTestEnableEXT = (PFN_vkCmdSetDepthTestEnableEXT)load(context, "vkCmdSetDepthTestEnableEXT"); + table->vkCmdSetDepthWriteEnableEXT = (PFN_vkCmdSetDepthWriteEnableEXT)load(context, "vkCmdSetDepthWriteEnableEXT"); + table->vkCmdSetFrontFaceEXT = (PFN_vkCmdSetFrontFaceEXT)load(context, "vkCmdSetFrontFaceEXT"); + table->vkCmdSetPrimitiveTopologyEXT = (PFN_vkCmdSetPrimitiveTopologyEXT)load(context, "vkCmdSetPrimitiveTopologyEXT"); + table->vkCmdSetScissorWithCountEXT = (PFN_vkCmdSetScissorWithCountEXT)load(context, "vkCmdSetScissorWithCountEXT"); + table->vkCmdSetStencilOpEXT = (PFN_vkCmdSetStencilOpEXT)load(context, "vkCmdSetStencilOpEXT"); + table->vkCmdSetStencilTestEnableEXT = (PFN_vkCmdSetStencilTestEnableEXT)load(context, "vkCmdSetStencilTestEnableEXT"); + table->vkCmdSetViewportWithCountEXT = (PFN_vkCmdSetViewportWithCountEXT)load(context, "vkCmdSetViewportWithCountEXT"); +#endif /* (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) + table->vkCmdSetDepthBiasEnableEXT = (PFN_vkCmdSetDepthBiasEnableEXT)load(context, "vkCmdSetDepthBiasEnableEXT"); + table->vkCmdSetLogicOpEXT = (PFN_vkCmdSetLogicOpEXT)load(context, "vkCmdSetLogicOpEXT"); + table->vkCmdSetPatchControlPointsEXT = (PFN_vkCmdSetPatchControlPointsEXT)load(context, "vkCmdSetPatchControlPointsEXT"); + table->vkCmdSetPrimitiveRestartEnableEXT = (PFN_vkCmdSetPrimitiveRestartEnableEXT)load(context, "vkCmdSetPrimitiveRestartEnableEXT"); + table->vkCmdSetRasterizerDiscardEnableEXT = (PFN_vkCmdSetRasterizerDiscardEnableEXT)load(context, "vkCmdSetRasterizerDiscardEnableEXT"); +#endif /* (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) + table->vkCmdSetAlphaToCoverageEnableEXT = (PFN_vkCmdSetAlphaToCoverageEnableEXT)load(context, "vkCmdSetAlphaToCoverageEnableEXT"); + table->vkCmdSetAlphaToOneEnableEXT = (PFN_vkCmdSetAlphaToOneEnableEXT)load(context, "vkCmdSetAlphaToOneEnableEXT"); + table->vkCmdSetColorBlendAdvancedEXT = (PFN_vkCmdSetColorBlendAdvancedEXT)load(context, "vkCmdSetColorBlendAdvancedEXT"); + table->vkCmdSetColorBlendEnableEXT = (PFN_vkCmdSetColorBlendEnableEXT)load(context, "vkCmdSetColorBlendEnableEXT"); + table->vkCmdSetColorBlendEquationEXT = (PFN_vkCmdSetColorBlendEquationEXT)load(context, "vkCmdSetColorBlendEquationEXT"); + table->vkCmdSetColorWriteMaskEXT = (PFN_vkCmdSetColorWriteMaskEXT)load(context, "vkCmdSetColorWriteMaskEXT"); + table->vkCmdSetConservativeRasterizationModeEXT = (PFN_vkCmdSetConservativeRasterizationModeEXT)load(context, "vkCmdSetConservativeRasterizationModeEXT"); + table->vkCmdSetDepthClampEnableEXT = (PFN_vkCmdSetDepthClampEnableEXT)load(context, "vkCmdSetDepthClampEnableEXT"); + table->vkCmdSetDepthClipEnableEXT = (PFN_vkCmdSetDepthClipEnableEXT)load(context, "vkCmdSetDepthClipEnableEXT"); + table->vkCmdSetDepthClipNegativeOneToOneEXT = (PFN_vkCmdSetDepthClipNegativeOneToOneEXT)load(context, "vkCmdSetDepthClipNegativeOneToOneEXT"); + table->vkCmdSetExtraPrimitiveOverestimationSizeEXT = (PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT)load(context, "vkCmdSetExtraPrimitiveOverestimationSizeEXT"); + table->vkCmdSetLineRasterizationModeEXT = (PFN_vkCmdSetLineRasterizationModeEXT)load(context, "vkCmdSetLineRasterizationModeEXT"); + table->vkCmdSetLineStippleEnableEXT = (PFN_vkCmdSetLineStippleEnableEXT)load(context, "vkCmdSetLineStippleEnableEXT"); + table->vkCmdSetLogicOpEnableEXT = (PFN_vkCmdSetLogicOpEnableEXT)load(context, "vkCmdSetLogicOpEnableEXT"); + table->vkCmdSetPolygonModeEXT = (PFN_vkCmdSetPolygonModeEXT)load(context, "vkCmdSetPolygonModeEXT"); + table->vkCmdSetProvokingVertexModeEXT = (PFN_vkCmdSetProvokingVertexModeEXT)load(context, "vkCmdSetProvokingVertexModeEXT"); + table->vkCmdSetRasterizationSamplesEXT = (PFN_vkCmdSetRasterizationSamplesEXT)load(context, "vkCmdSetRasterizationSamplesEXT"); + table->vkCmdSetRasterizationStreamEXT = (PFN_vkCmdSetRasterizationStreamEXT)load(context, "vkCmdSetRasterizationStreamEXT"); + table->vkCmdSetSampleLocationsEnableEXT = (PFN_vkCmdSetSampleLocationsEnableEXT)load(context, "vkCmdSetSampleLocationsEnableEXT"); + table->vkCmdSetSampleMaskEXT = (PFN_vkCmdSetSampleMaskEXT)load(context, "vkCmdSetSampleMaskEXT"); + table->vkCmdSetTessellationDomainOriginEXT = (PFN_vkCmdSetTessellationDomainOriginEXT)load(context, "vkCmdSetTessellationDomainOriginEXT"); +#endif /* (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) + table->vkCmdSetViewportWScalingEnableNV = (PFN_vkCmdSetViewportWScalingEnableNV)load(context, "vkCmdSetViewportWScalingEnableNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) + table->vkCmdSetViewportSwizzleNV = (PFN_vkCmdSetViewportSwizzleNV)load(context, "vkCmdSetViewportSwizzleNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) + table->vkCmdSetCoverageToColorEnableNV = (PFN_vkCmdSetCoverageToColorEnableNV)load(context, "vkCmdSetCoverageToColorEnableNV"); + table->vkCmdSetCoverageToColorLocationNV = (PFN_vkCmdSetCoverageToColorLocationNV)load(context, "vkCmdSetCoverageToColorLocationNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) + table->vkCmdSetCoverageModulationModeNV = (PFN_vkCmdSetCoverageModulationModeNV)load(context, "vkCmdSetCoverageModulationModeNV"); + table->vkCmdSetCoverageModulationTableEnableNV = (PFN_vkCmdSetCoverageModulationTableEnableNV)load(context, "vkCmdSetCoverageModulationTableEnableNV"); + table->vkCmdSetCoverageModulationTableNV = (PFN_vkCmdSetCoverageModulationTableNV)load(context, "vkCmdSetCoverageModulationTableNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) + table->vkCmdSetShadingRateImageEnableNV = (PFN_vkCmdSetShadingRateImageEnableNV)load(context, "vkCmdSetShadingRateImageEnableNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) + table->vkCmdSetRepresentativeFragmentTestEnableNV = (PFN_vkCmdSetRepresentativeFragmentTestEnableNV)load(context, "vkCmdSetRepresentativeFragmentTestEnableNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) + table->vkCmdSetCoverageReductionModeNV = (PFN_vkCmdSetCoverageReductionModeNV)load(context, "vkCmdSetCoverageReductionModeNV"); +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) */ #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) table->vkGetDeviceGroupSurfacePresentModes2EXT = (PFN_vkGetDeviceGroupSurfacePresentModes2EXT)load(context, "vkGetDeviceGroupSurfacePresentModes2EXT"); #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ +#if (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) + table->vkGetImageSubresourceLayout2EXT = (PFN_vkGetImageSubresourceLayout2EXT)load(context, "vkGetImageSubresourceLayout2EXT"); +#endif /* (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) */ +#if (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) + table->vkCmdSetVertexInputEXT = (PFN_vkCmdSetVertexInputEXT)load(context, "vkCmdSetVertexInputEXT"); +#endif /* (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) */ #if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) table->vkCmdPushDescriptorSetWithTemplateKHR = (PFN_vkCmdPushDescriptorSetWithTemplateKHR)load(context, "vkCmdPushDescriptorSetWithTemplateKHR"); #endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ @@ -1840,6 +2195,15 @@ PFN_vkGetPrivateData vkGetPrivateData; PFN_vkQueueSubmit2 vkQueueSubmit2; PFN_vkSetPrivateData vkSetPrivateData; #endif /* defined(VK_VERSION_1_3) */ +#if defined(VK_AMDX_shader_enqueue) +PFN_vkCmdDispatchGraphAMDX vkCmdDispatchGraphAMDX; +PFN_vkCmdDispatchGraphIndirectAMDX vkCmdDispatchGraphIndirectAMDX; +PFN_vkCmdDispatchGraphIndirectCountAMDX vkCmdDispatchGraphIndirectCountAMDX; +PFN_vkCmdInitializeGraphScratchMemoryAMDX vkCmdInitializeGraphScratchMemoryAMDX; +PFN_vkCreateExecutionGraphPipelinesAMDX vkCreateExecutionGraphPipelinesAMDX; +PFN_vkGetExecutionGraphPipelineNodeIndexAMDX vkGetExecutionGraphPipelineNodeIndexAMDX; +PFN_vkGetExecutionGraphPipelineScratchSizeAMDX vkGetExecutionGraphPipelineScratchSizeAMDX; +#endif /* defined(VK_AMDX_shader_enqueue) */ #if defined(VK_AMD_buffer_marker) PFN_vkCmdWriteBufferMarkerAMD vkCmdWriteBufferMarkerAMD; #endif /* defined(VK_AMD_buffer_marker) */ @@ -1865,6 +2229,9 @@ PFN_vkGetDrmDisplayEXT vkGetDrmDisplayEXT; PFN_vkAcquireXlibDisplayEXT vkAcquireXlibDisplayEXT; PFN_vkGetRandROutputDisplayEXT vkGetRandROutputDisplayEXT; #endif /* defined(VK_EXT_acquire_xlib_display) */ +#if defined(VK_EXT_attachment_feedback_loop_dynamic_state) +PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT vkCmdSetAttachmentFeedbackLoopEnableEXT; +#endif /* defined(VK_EXT_attachment_feedback_loop_dynamic_state) */ #if defined(VK_EXT_buffer_device_address) PFN_vkGetBufferDeviceAddressEXT vkGetBufferDeviceAddressEXT; #endif /* defined(VK_EXT_buffer_device_address) */ @@ -1904,6 +2271,27 @@ PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT; PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT; PFN_vkSubmitDebugUtilsMessageEXT vkSubmitDebugUtilsMessageEXT; #endif /* defined(VK_EXT_debug_utils) */ +#if defined(VK_EXT_depth_bias_control) +PFN_vkCmdSetDepthBias2EXT vkCmdSetDepthBias2EXT; +#endif /* defined(VK_EXT_depth_bias_control) */ +#if defined(VK_EXT_descriptor_buffer) +PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT vkCmdBindDescriptorBufferEmbeddedSamplersEXT; +PFN_vkCmdBindDescriptorBuffersEXT vkCmdBindDescriptorBuffersEXT; +PFN_vkCmdSetDescriptorBufferOffsetsEXT vkCmdSetDescriptorBufferOffsetsEXT; +PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT vkGetBufferOpaqueCaptureDescriptorDataEXT; +PFN_vkGetDescriptorEXT vkGetDescriptorEXT; +PFN_vkGetDescriptorSetLayoutBindingOffsetEXT vkGetDescriptorSetLayoutBindingOffsetEXT; +PFN_vkGetDescriptorSetLayoutSizeEXT vkGetDescriptorSetLayoutSizeEXT; +PFN_vkGetImageOpaqueCaptureDescriptorDataEXT vkGetImageOpaqueCaptureDescriptorDataEXT; +PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT vkGetImageViewOpaqueCaptureDescriptorDataEXT; +PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT vkGetSamplerOpaqueCaptureDescriptorDataEXT; +#endif /* defined(VK_EXT_descriptor_buffer) */ +#if defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) +PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT; +#endif /* defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) */ +#if defined(VK_EXT_device_fault) +PFN_vkGetDeviceFaultInfoEXT vkGetDeviceFaultInfoEXT; +#endif /* defined(VK_EXT_device_fault) */ #if defined(VK_EXT_direct_mode_display) PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT; #endif /* defined(VK_EXT_direct_mode_display) */ @@ -1914,6 +2302,10 @@ PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT vkGetPhysicalDeviceDirectF #if defined(VK_EXT_discard_rectangles) PFN_vkCmdSetDiscardRectangleEXT vkCmdSetDiscardRectangleEXT; #endif /* defined(VK_EXT_discard_rectangles) */ +#if defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 +PFN_vkCmdSetDiscardRectangleEnableEXT vkCmdSetDiscardRectangleEnableEXT; +PFN_vkCmdSetDiscardRectangleModeEXT vkCmdSetDiscardRectangleModeEXT; +#endif /* defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 */ #if defined(VK_EXT_display_control) PFN_vkDisplayPowerControlEXT vkDisplayPowerControlEXT; PFN_vkGetSwapchainCounterEXT vkGetSwapchainCounterEXT; @@ -1923,27 +2315,6 @@ PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT; #if defined(VK_EXT_display_surface_counter) PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT vkGetPhysicalDeviceSurfaceCapabilities2EXT; #endif /* defined(VK_EXT_display_surface_counter) */ -#if defined(VK_EXT_extended_dynamic_state) -PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; -PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; -PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; -PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; -PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; -PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; -PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; -PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; -PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; -PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; -PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; -PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; -#endif /* defined(VK_EXT_extended_dynamic_state) */ -#if defined(VK_EXT_extended_dynamic_state2) -PFN_vkCmdSetDepthBiasEnableEXT vkCmdSetDepthBiasEnableEXT; -PFN_vkCmdSetLogicOpEXT vkCmdSetLogicOpEXT; -PFN_vkCmdSetPatchControlPointsEXT vkCmdSetPatchControlPointsEXT; -PFN_vkCmdSetPrimitiveRestartEnableEXT vkCmdSetPrimitiveRestartEnableEXT; -PFN_vkCmdSetRasterizerDiscardEnableEXT vkCmdSetRasterizerDiscardEnableEXT; -#endif /* defined(VK_EXT_extended_dynamic_state2) */ #if defined(VK_EXT_external_memory_host) PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; #endif /* defined(VK_EXT_external_memory_host) */ @@ -1958,18 +2329,29 @@ PFN_vkSetHdrMetadataEXT vkSetHdrMetadataEXT; #if defined(VK_EXT_headless_surface) PFN_vkCreateHeadlessSurfaceEXT vkCreateHeadlessSurfaceEXT; #endif /* defined(VK_EXT_headless_surface) */ +#if defined(VK_EXT_host_image_copy) +PFN_vkCopyImageToImageEXT vkCopyImageToImageEXT; +PFN_vkCopyImageToMemoryEXT vkCopyImageToMemoryEXT; +PFN_vkCopyMemoryToImageEXT vkCopyMemoryToImageEXT; +PFN_vkTransitionImageLayoutEXT vkTransitionImageLayoutEXT; +#endif /* defined(VK_EXT_host_image_copy) */ #if defined(VK_EXT_host_query_reset) PFN_vkResetQueryPoolEXT vkResetQueryPoolEXT; #endif /* defined(VK_EXT_host_query_reset) */ -#if defined(VK_EXT_image_compression_control) -PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; -#endif /* defined(VK_EXT_image_compression_control) */ #if defined(VK_EXT_image_drm_format_modifier) PFN_vkGetImageDrmFormatModifierPropertiesEXT vkGetImageDrmFormatModifierPropertiesEXT; #endif /* defined(VK_EXT_image_drm_format_modifier) */ #if defined(VK_EXT_line_rasterization) PFN_vkCmdSetLineStippleEXT vkCmdSetLineStippleEXT; #endif /* defined(VK_EXT_line_rasterization) */ +#if defined(VK_EXT_mesh_shader) +PFN_vkCmdDrawMeshTasksEXT vkCmdDrawMeshTasksEXT; +PFN_vkCmdDrawMeshTasksIndirectCountEXT vkCmdDrawMeshTasksIndirectCountEXT; +PFN_vkCmdDrawMeshTasksIndirectEXT vkCmdDrawMeshTasksIndirectEXT; +#endif /* defined(VK_EXT_mesh_shader) */ +#if defined(VK_EXT_metal_objects) +PFN_vkExportMetalObjectsEXT vkExportMetalObjectsEXT; +#endif /* defined(VK_EXT_metal_objects) */ #if defined(VK_EXT_metal_surface) PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; #endif /* defined(VK_EXT_metal_surface) */ @@ -1977,6 +2359,22 @@ PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; PFN_vkCmdDrawMultiEXT vkCmdDrawMultiEXT; PFN_vkCmdDrawMultiIndexedEXT vkCmdDrawMultiIndexedEXT; #endif /* defined(VK_EXT_multi_draw) */ +#if defined(VK_EXT_opacity_micromap) +PFN_vkBuildMicromapsEXT vkBuildMicromapsEXT; +PFN_vkCmdBuildMicromapsEXT vkCmdBuildMicromapsEXT; +PFN_vkCmdCopyMemoryToMicromapEXT vkCmdCopyMemoryToMicromapEXT; +PFN_vkCmdCopyMicromapEXT vkCmdCopyMicromapEXT; +PFN_vkCmdCopyMicromapToMemoryEXT vkCmdCopyMicromapToMemoryEXT; +PFN_vkCmdWriteMicromapsPropertiesEXT vkCmdWriteMicromapsPropertiesEXT; +PFN_vkCopyMemoryToMicromapEXT vkCopyMemoryToMicromapEXT; +PFN_vkCopyMicromapEXT vkCopyMicromapEXT; +PFN_vkCopyMicromapToMemoryEXT vkCopyMicromapToMemoryEXT; +PFN_vkCreateMicromapEXT vkCreateMicromapEXT; +PFN_vkDestroyMicromapEXT vkDestroyMicromapEXT; +PFN_vkGetDeviceMicromapCompatibilityEXT vkGetDeviceMicromapCompatibilityEXT; +PFN_vkGetMicromapBuildSizesEXT vkGetMicromapBuildSizesEXT; +PFN_vkWriteMicromapsPropertiesEXT vkWriteMicromapsPropertiesEXT; +#endif /* defined(VK_EXT_opacity_micromap) */ #if defined(VK_EXT_pageable_device_local_memory) PFN_vkSetDeviceMemoryPriorityEXT vkSetDeviceMemoryPriorityEXT; #endif /* defined(VK_EXT_pageable_device_local_memory) */ @@ -1993,6 +2391,19 @@ PFN_vkSetPrivateDataEXT vkSetPrivateDataEXT; PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT; PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT vkGetPhysicalDeviceMultisamplePropertiesEXT; #endif /* defined(VK_EXT_sample_locations) */ +#if defined(VK_EXT_shader_module_identifier) +PFN_vkGetShaderModuleCreateInfoIdentifierEXT vkGetShaderModuleCreateInfoIdentifierEXT; +PFN_vkGetShaderModuleIdentifierEXT vkGetShaderModuleIdentifierEXT; +#endif /* defined(VK_EXT_shader_module_identifier) */ +#if defined(VK_EXT_shader_object) +PFN_vkCmdBindShadersEXT vkCmdBindShadersEXT; +PFN_vkCreateShadersEXT vkCreateShadersEXT; +PFN_vkDestroyShaderEXT vkDestroyShaderEXT; +PFN_vkGetShaderBinaryDataEXT vkGetShaderBinaryDataEXT; +#endif /* defined(VK_EXT_shader_object) */ +#if defined(VK_EXT_swapchain_maintenance1) +PFN_vkReleaseSwapchainImagesEXT vkReleaseSwapchainImagesEXT; +#endif /* defined(VK_EXT_swapchain_maintenance1) */ #if defined(VK_EXT_tooling_info) PFN_vkGetPhysicalDeviceToolPropertiesEXT vkGetPhysicalDeviceToolPropertiesEXT; #endif /* defined(VK_EXT_tooling_info) */ @@ -2010,9 +2421,6 @@ PFN_vkDestroyValidationCacheEXT vkDestroyValidationCacheEXT; PFN_vkGetValidationCacheDataEXT vkGetValidationCacheDataEXT; PFN_vkMergeValidationCachesEXT vkMergeValidationCachesEXT; #endif /* defined(VK_EXT_validation_cache) */ -#if defined(VK_EXT_vertex_input_dynamic_state) -PFN_vkCmdSetVertexInputEXT vkCmdSetVertexInputEXT; -#endif /* defined(VK_EXT_vertex_input_dynamic_state) */ #if defined(VK_FUCHSIA_buffer_collection) PFN_vkCreateBufferCollectionFUCHSIA vkCreateBufferCollectionFUCHSIA; PFN_vkDestroyBufferCollectionFUCHSIA vkDestroyBufferCollectionFUCHSIA; @@ -2038,6 +2446,10 @@ PFN_vkCreateStreamDescriptorSurfaceGGP vkCreateStreamDescriptorSurfaceGGP; PFN_vkGetPastPresentationTimingGOOGLE vkGetPastPresentationTimingGOOGLE; PFN_vkGetRefreshCycleDurationGOOGLE vkGetRefreshCycleDurationGOOGLE; #endif /* defined(VK_GOOGLE_display_timing) */ +#if defined(VK_HUAWEI_cluster_culling_shader) +PFN_vkCmdDrawClusterHUAWEI vkCmdDrawClusterHUAWEI; +PFN_vkCmdDrawClusterIndirectHUAWEI vkCmdDrawClusterIndirectHUAWEI; +#endif /* defined(VK_HUAWEI_cluster_culling_shader) */ #if defined(VK_HUAWEI_invocation_mask) PFN_vkCmdBindInvocationMaskHUAWEI vkCmdBindInvocationMaskHUAWEI; #endif /* defined(VK_HUAWEI_invocation_mask) */ @@ -2086,6 +2498,9 @@ PFN_vkGetBufferDeviceAddressKHR vkGetBufferDeviceAddressKHR; PFN_vkGetBufferOpaqueCaptureAddressKHR vkGetBufferOpaqueCaptureAddressKHR; PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR vkGetDeviceMemoryOpaqueCaptureAddressKHR; #endif /* defined(VK_KHR_buffer_device_address) */ +#if defined(VK_KHR_cooperative_matrix) +PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR; +#endif /* defined(VK_KHR_cooperative_matrix) */ #if defined(VK_KHR_copy_commands2) PFN_vkCmdBlitImage2KHR vkCmdBlitImage2KHR; PFN_vkCmdCopyBuffer2KHR vkCmdCopyBuffer2KHR; @@ -2212,6 +2627,16 @@ PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequirementsKH PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirementsKHR; PFN_vkGetDeviceImageSparseMemoryRequirementsKHR vkGetDeviceImageSparseMemoryRequirementsKHR; #endif /* defined(VK_KHR_maintenance4) */ +#if defined(VK_KHR_maintenance5) +PFN_vkCmdBindIndexBuffer2KHR vkCmdBindIndexBuffer2KHR; +PFN_vkGetDeviceImageSubresourceLayoutKHR vkGetDeviceImageSubresourceLayoutKHR; +PFN_vkGetImageSubresourceLayout2KHR vkGetImageSubresourceLayout2KHR; +PFN_vkGetRenderingAreaGranularityKHR vkGetRenderingAreaGranularityKHR; +#endif /* defined(VK_KHR_maintenance5) */ +#if defined(VK_KHR_map_memory2) +PFN_vkMapMemory2KHR vkMapMemory2KHR; +PFN_vkUnmapMemory2KHR vkUnmapMemory2KHR; +#endif /* defined(VK_KHR_map_memory2) */ #if defined(VK_KHR_performance_query) PFN_vkAcquireProfilingLockKHR vkAcquireProfilingLockKHR; PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR; @@ -2286,6 +2711,8 @@ PFN_vkCmdDecodeVideoKHR vkCmdDecodeVideoKHR; #endif /* defined(VK_KHR_video_decode_queue) */ #if defined(VK_KHR_video_encode_queue) PFN_vkCmdEncodeVideoKHR vkCmdEncodeVideoKHR; +PFN_vkGetEncodedVideoSessionParametersKHR vkGetEncodedVideoSessionParametersKHR; +PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR; #endif /* defined(VK_KHR_video_encode_queue) */ #if defined(VK_KHR_video_queue) PFN_vkBindVideoSessionMemoryKHR vkBindVideoSessionMemoryKHR; @@ -2347,6 +2774,10 @@ PFN_vkCmdSetViewportWScalingNV vkCmdSetViewportWScalingNV; #if defined(VK_NV_cooperative_matrix) PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV vkGetPhysicalDeviceCooperativeMatrixPropertiesNV; #endif /* defined(VK_NV_cooperative_matrix) */ +#if defined(VK_NV_copy_memory_indirect) +PFN_vkCmdCopyMemoryIndirectNV vkCmdCopyMemoryIndirectNV; +PFN_vkCmdCopyMemoryToImageIndirectNV vkCmdCopyMemoryToImageIndirectNV; +#endif /* defined(VK_NV_copy_memory_indirect) */ #if defined(VK_NV_coverage_reduction_mode) PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV; #endif /* defined(VK_NV_coverage_reduction_mode) */ @@ -2362,6 +2793,11 @@ PFN_vkCreateIndirectCommandsLayoutNV vkCreateIndirectCommandsLayoutNV; PFN_vkDestroyIndirectCommandsLayoutNV vkDestroyIndirectCommandsLayoutNV; PFN_vkGetGeneratedCommandsMemoryRequirementsNV vkGetGeneratedCommandsMemoryRequirementsNV; #endif /* defined(VK_NV_device_generated_commands) */ +#if defined(VK_NV_device_generated_commands_compute) +PFN_vkCmdUpdatePipelineIndirectBufferNV vkCmdUpdatePipelineIndirectBufferNV; +PFN_vkGetPipelineIndirectDeviceAddressNV vkGetPipelineIndirectDeviceAddressNV; +PFN_vkGetPipelineIndirectMemoryRequirementsNV vkGetPipelineIndirectMemoryRequirementsNV; +#endif /* defined(VK_NV_device_generated_commands_compute) */ #if defined(VK_NV_external_memory_capabilities) PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV vkGetPhysicalDeviceExternalImageFormatPropertiesNV; #endif /* defined(VK_NV_external_memory_capabilities) */ @@ -2374,11 +2810,22 @@ PFN_vkGetMemoryWin32HandleNV vkGetMemoryWin32HandleNV; #if defined(VK_NV_fragment_shading_rate_enums) PFN_vkCmdSetFragmentShadingRateEnumNV vkCmdSetFragmentShadingRateEnumNV; #endif /* defined(VK_NV_fragment_shading_rate_enums) */ +#if defined(VK_NV_memory_decompression) +PFN_vkCmdDecompressMemoryIndirectCountNV vkCmdDecompressMemoryIndirectCountNV; +PFN_vkCmdDecompressMemoryNV vkCmdDecompressMemoryNV; +#endif /* defined(VK_NV_memory_decompression) */ #if defined(VK_NV_mesh_shader) PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; PFN_vkCmdDrawMeshTasksNV vkCmdDrawMeshTasksNV; #endif /* defined(VK_NV_mesh_shader) */ +#if defined(VK_NV_optical_flow) +PFN_vkBindOpticalFlowSessionImageNV vkBindOpticalFlowSessionImageNV; +PFN_vkCmdOpticalFlowExecuteNV vkCmdOpticalFlowExecuteNV; +PFN_vkCreateOpticalFlowSessionNV vkCreateOpticalFlowSessionNV; +PFN_vkDestroyOpticalFlowSessionNV vkDestroyOpticalFlowSessionNV; +PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV vkGetPhysicalDeviceOpticalFlowImageFormatsNV; +#endif /* defined(VK_NV_optical_flow) */ #if defined(VK_NV_ray_tracing) PFN_vkBindAccelerationStructureMemoryNV vkBindAccelerationStructureMemoryNV; PFN_vkCmdBuildAccelerationStructureNV vkCmdBuildAccelerationStructureNV; @@ -2393,6 +2840,9 @@ PFN_vkGetAccelerationStructureHandleNV vkGetAccelerationStructureHandleNV; PFN_vkGetAccelerationStructureMemoryRequirementsNV vkGetAccelerationStructureMemoryRequirementsNV; PFN_vkGetRayTracingShaderGroupHandlesNV vkGetRayTracingShaderGroupHandlesNV; #endif /* defined(VK_NV_ray_tracing) */ +#if defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 +PFN_vkCmdSetExclusiveScissorEnableNV vkCmdSetExclusiveScissorEnableNV; +#endif /* defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 */ #if defined(VK_NV_scissor_exclusive) PFN_vkCmdSetExclusiveScissorNV vkCmdSetExclusiveScissorNV; #endif /* defined(VK_NV_scissor_exclusive) */ @@ -2401,6 +2851,13 @@ PFN_vkCmdBindShadingRateImageNV vkCmdBindShadingRateImageNV; PFN_vkCmdSetCoarseSampleOrderNV vkCmdSetCoarseSampleOrderNV; PFN_vkCmdSetViewportShadingRatePaletteNV vkCmdSetViewportShadingRatePaletteNV; #endif /* defined(VK_NV_shading_rate_image) */ +#if defined(VK_QCOM_tile_properties) +PFN_vkGetDynamicRenderingTilePropertiesQCOM vkGetDynamicRenderingTilePropertiesQCOM; +PFN_vkGetFramebufferTilePropertiesQCOM vkGetFramebufferTilePropertiesQCOM; +#endif /* defined(VK_QCOM_tile_properties) */ +#if defined(VK_QNX_external_memory_screen_buffer) +PFN_vkGetScreenBufferPropertiesQNX vkGetScreenBufferPropertiesQNX; +#endif /* defined(VK_QNX_external_memory_screen_buffer) */ #if defined(VK_QNX_screen_surface) PFN_vkCreateScreenSurfaceQNX vkCreateScreenSurfaceQNX; PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX vkGetPhysicalDeviceScreenPresentationSupportQNX; @@ -2409,9 +2866,83 @@ PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX vkGetPhysicalDeviceScreenPre PFN_vkGetDescriptorSetHostMappingVALVE vkGetDescriptorSetHostMappingVALVE; PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE vkGetDescriptorSetLayoutHostMappingInfoVALVE; #endif /* defined(VK_VALVE_descriptor_set_host_mapping) */ +#if (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) +PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; +PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; +PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; +PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; +PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; +PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; +PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; +PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; +PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; +PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; +PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; +PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) +PFN_vkCmdSetDepthBiasEnableEXT vkCmdSetDepthBiasEnableEXT; +PFN_vkCmdSetLogicOpEXT vkCmdSetLogicOpEXT; +PFN_vkCmdSetPatchControlPointsEXT vkCmdSetPatchControlPointsEXT; +PFN_vkCmdSetPrimitiveRestartEnableEXT vkCmdSetPrimitiveRestartEnableEXT; +PFN_vkCmdSetRasterizerDiscardEnableEXT vkCmdSetRasterizerDiscardEnableEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) +PFN_vkCmdSetAlphaToCoverageEnableEXT vkCmdSetAlphaToCoverageEnableEXT; +PFN_vkCmdSetAlphaToOneEnableEXT vkCmdSetAlphaToOneEnableEXT; +PFN_vkCmdSetColorBlendAdvancedEXT vkCmdSetColorBlendAdvancedEXT; +PFN_vkCmdSetColorBlendEnableEXT vkCmdSetColorBlendEnableEXT; +PFN_vkCmdSetColorBlendEquationEXT vkCmdSetColorBlendEquationEXT; +PFN_vkCmdSetColorWriteMaskEXT vkCmdSetColorWriteMaskEXT; +PFN_vkCmdSetConservativeRasterizationModeEXT vkCmdSetConservativeRasterizationModeEXT; +PFN_vkCmdSetDepthClampEnableEXT vkCmdSetDepthClampEnableEXT; +PFN_vkCmdSetDepthClipEnableEXT vkCmdSetDepthClipEnableEXT; +PFN_vkCmdSetDepthClipNegativeOneToOneEXT vkCmdSetDepthClipNegativeOneToOneEXT; +PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT vkCmdSetExtraPrimitiveOverestimationSizeEXT; +PFN_vkCmdSetLineRasterizationModeEXT vkCmdSetLineRasterizationModeEXT; +PFN_vkCmdSetLineStippleEnableEXT vkCmdSetLineStippleEnableEXT; +PFN_vkCmdSetLogicOpEnableEXT vkCmdSetLogicOpEnableEXT; +PFN_vkCmdSetPolygonModeEXT vkCmdSetPolygonModeEXT; +PFN_vkCmdSetProvokingVertexModeEXT vkCmdSetProvokingVertexModeEXT; +PFN_vkCmdSetRasterizationSamplesEXT vkCmdSetRasterizationSamplesEXT; +PFN_vkCmdSetRasterizationStreamEXT vkCmdSetRasterizationStreamEXT; +PFN_vkCmdSetSampleLocationsEnableEXT vkCmdSetSampleLocationsEnableEXT; +PFN_vkCmdSetSampleMaskEXT vkCmdSetSampleMaskEXT; +PFN_vkCmdSetTessellationDomainOriginEXT vkCmdSetTessellationDomainOriginEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) +PFN_vkCmdSetViewportWScalingEnableNV vkCmdSetViewportWScalingEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) +PFN_vkCmdSetViewportSwizzleNV vkCmdSetViewportSwizzleNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) +PFN_vkCmdSetCoverageToColorEnableNV vkCmdSetCoverageToColorEnableNV; +PFN_vkCmdSetCoverageToColorLocationNV vkCmdSetCoverageToColorLocationNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) +PFN_vkCmdSetCoverageModulationModeNV vkCmdSetCoverageModulationModeNV; +PFN_vkCmdSetCoverageModulationTableEnableNV vkCmdSetCoverageModulationTableEnableNV; +PFN_vkCmdSetCoverageModulationTableNV vkCmdSetCoverageModulationTableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) +PFN_vkCmdSetShadingRateImageEnableNV vkCmdSetShadingRateImageEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) +PFN_vkCmdSetRepresentativeFragmentTestEnableNV vkCmdSetRepresentativeFragmentTestEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) +PFN_vkCmdSetCoverageReductionModeNV vkCmdSetCoverageReductionModeNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) */ #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) PFN_vkGetDeviceGroupSurfacePresentModes2EXT vkGetDeviceGroupSurfacePresentModes2EXT; #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ +#if (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) +PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; +#endif /* (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) */ +#if (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) +PFN_vkCmdSetVertexInputEXT vkCmdSetVertexInputEXT; +#endif /* (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) */ #if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) PFN_vkCmdPushDescriptorSetWithTemplateKHR vkCmdPushDescriptorSetWithTemplateKHR; #endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ diff --git a/Lumos/External/vulkan/volk/volk.h b/Lumos/External/vulkan/volk/volk.h index a367d835..c2786b7e 100644 --- a/Lumos/External/vulkan/volk/volk.h +++ b/Lumos/External/vulkan/volk/volk.h @@ -1,7 +1,7 @@ /** * volk * - * Copyright (C) 2018-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2018-2023, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) * Report bugs and download new versions at https://github.com/zeux/volk * * This library is distributed under the MIT License. See notice at the end of this file. @@ -15,7 +15,7 @@ #endif /* VOLK_GENERATE_VERSION_DEFINE */ -#define VOLK_HEADER_VERSION 216 +#define VOLK_HEADER_VERSION 265 /* VOLK_GENERATE_VERSION_DEFINE */ #ifndef VK_NO_PROTOTYPES @@ -23,8 +23,8 @@ #endif #ifndef VULKAN_H_ -# ifdef VOLK_VULKAN_H_PATH -# include VOLK_VULKAN_H_PATH +# ifdef VOLK_VULKAN_H_PATH +# include VOLK_VULKAN_H_PATH # elif defined(VK_USE_PLATFORM_WIN32_KHR) # include # include @@ -323,6 +323,15 @@ struct VolkDeviceTable PFN_vkQueueSubmit2 vkQueueSubmit2; PFN_vkSetPrivateData vkSetPrivateData; #endif /* defined(VK_VERSION_1_3) */ +#if defined(VK_AMDX_shader_enqueue) + PFN_vkCmdDispatchGraphAMDX vkCmdDispatchGraphAMDX; + PFN_vkCmdDispatchGraphIndirectAMDX vkCmdDispatchGraphIndirectAMDX; + PFN_vkCmdDispatchGraphIndirectCountAMDX vkCmdDispatchGraphIndirectCountAMDX; + PFN_vkCmdInitializeGraphScratchMemoryAMDX vkCmdInitializeGraphScratchMemoryAMDX; + PFN_vkCreateExecutionGraphPipelinesAMDX vkCreateExecutionGraphPipelinesAMDX; + PFN_vkGetExecutionGraphPipelineNodeIndexAMDX vkGetExecutionGraphPipelineNodeIndexAMDX; + PFN_vkGetExecutionGraphPipelineScratchSizeAMDX vkGetExecutionGraphPipelineScratchSizeAMDX; +#endif /* defined(VK_AMDX_shader_enqueue) */ #if defined(VK_AMD_buffer_marker) PFN_vkCmdWriteBufferMarkerAMD vkCmdWriteBufferMarkerAMD; #endif /* defined(VK_AMD_buffer_marker) */ @@ -340,6 +349,9 @@ struct VolkDeviceTable PFN_vkGetAndroidHardwareBufferPropertiesANDROID vkGetAndroidHardwareBufferPropertiesANDROID; PFN_vkGetMemoryAndroidHardwareBufferANDROID vkGetMemoryAndroidHardwareBufferANDROID; #endif /* defined(VK_ANDROID_external_memory_android_hardware_buffer) */ +#if defined(VK_EXT_attachment_feedback_loop_dynamic_state) + PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT vkCmdSetAttachmentFeedbackLoopEnableEXT; +#endif /* defined(VK_EXT_attachment_feedback_loop_dynamic_state) */ #if defined(VK_EXT_buffer_device_address) PFN_vkGetBufferDeviceAddressEXT vkGetBufferDeviceAddressEXT; #endif /* defined(VK_EXT_buffer_device_address) */ @@ -360,36 +372,40 @@ struct VolkDeviceTable PFN_vkDebugMarkerSetObjectNameEXT vkDebugMarkerSetObjectNameEXT; PFN_vkDebugMarkerSetObjectTagEXT vkDebugMarkerSetObjectTagEXT; #endif /* defined(VK_EXT_debug_marker) */ +#if defined(VK_EXT_depth_bias_control) + PFN_vkCmdSetDepthBias2EXT vkCmdSetDepthBias2EXT; +#endif /* defined(VK_EXT_depth_bias_control) */ +#if defined(VK_EXT_descriptor_buffer) + PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT vkCmdBindDescriptorBufferEmbeddedSamplersEXT; + PFN_vkCmdBindDescriptorBuffersEXT vkCmdBindDescriptorBuffersEXT; + PFN_vkCmdSetDescriptorBufferOffsetsEXT vkCmdSetDescriptorBufferOffsetsEXT; + PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT vkGetBufferOpaqueCaptureDescriptorDataEXT; + PFN_vkGetDescriptorEXT vkGetDescriptorEXT; + PFN_vkGetDescriptorSetLayoutBindingOffsetEXT vkGetDescriptorSetLayoutBindingOffsetEXT; + PFN_vkGetDescriptorSetLayoutSizeEXT vkGetDescriptorSetLayoutSizeEXT; + PFN_vkGetImageOpaqueCaptureDescriptorDataEXT vkGetImageOpaqueCaptureDescriptorDataEXT; + PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT vkGetImageViewOpaqueCaptureDescriptorDataEXT; + PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT vkGetSamplerOpaqueCaptureDescriptorDataEXT; +#endif /* defined(VK_EXT_descriptor_buffer) */ +#if defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) + PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT; +#endif /* defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) */ +#if defined(VK_EXT_device_fault) + PFN_vkGetDeviceFaultInfoEXT vkGetDeviceFaultInfoEXT; +#endif /* defined(VK_EXT_device_fault) */ #if defined(VK_EXT_discard_rectangles) PFN_vkCmdSetDiscardRectangleEXT vkCmdSetDiscardRectangleEXT; #endif /* defined(VK_EXT_discard_rectangles) */ +#if defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 + PFN_vkCmdSetDiscardRectangleEnableEXT vkCmdSetDiscardRectangleEnableEXT; + PFN_vkCmdSetDiscardRectangleModeEXT vkCmdSetDiscardRectangleModeEXT; +#endif /* defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 */ #if defined(VK_EXT_display_control) PFN_vkDisplayPowerControlEXT vkDisplayPowerControlEXT; PFN_vkGetSwapchainCounterEXT vkGetSwapchainCounterEXT; PFN_vkRegisterDeviceEventEXT vkRegisterDeviceEventEXT; PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT; #endif /* defined(VK_EXT_display_control) */ -#if defined(VK_EXT_extended_dynamic_state) - PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; - PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; - PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; - PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; - PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; - PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; - PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; - PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; - PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; - PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; - PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; - PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; -#endif /* defined(VK_EXT_extended_dynamic_state) */ -#if defined(VK_EXT_extended_dynamic_state2) - PFN_vkCmdSetDepthBiasEnableEXT vkCmdSetDepthBiasEnableEXT; - PFN_vkCmdSetLogicOpEXT vkCmdSetLogicOpEXT; - PFN_vkCmdSetPatchControlPointsEXT vkCmdSetPatchControlPointsEXT; - PFN_vkCmdSetPrimitiveRestartEnableEXT vkCmdSetPrimitiveRestartEnableEXT; - PFN_vkCmdSetRasterizerDiscardEnableEXT vkCmdSetRasterizerDiscardEnableEXT; -#endif /* defined(VK_EXT_extended_dynamic_state2) */ #if defined(VK_EXT_external_memory_host) PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; #endif /* defined(VK_EXT_external_memory_host) */ @@ -400,22 +416,49 @@ struct VolkDeviceTable #if defined(VK_EXT_hdr_metadata) PFN_vkSetHdrMetadataEXT vkSetHdrMetadataEXT; #endif /* defined(VK_EXT_hdr_metadata) */ +#if defined(VK_EXT_host_image_copy) + PFN_vkCopyImageToImageEXT vkCopyImageToImageEXT; + PFN_vkCopyImageToMemoryEXT vkCopyImageToMemoryEXT; + PFN_vkCopyMemoryToImageEXT vkCopyMemoryToImageEXT; + PFN_vkTransitionImageLayoutEXT vkTransitionImageLayoutEXT; +#endif /* defined(VK_EXT_host_image_copy) */ #if defined(VK_EXT_host_query_reset) PFN_vkResetQueryPoolEXT vkResetQueryPoolEXT; #endif /* defined(VK_EXT_host_query_reset) */ -#if defined(VK_EXT_image_compression_control) - PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; -#endif /* defined(VK_EXT_image_compression_control) */ #if defined(VK_EXT_image_drm_format_modifier) PFN_vkGetImageDrmFormatModifierPropertiesEXT vkGetImageDrmFormatModifierPropertiesEXT; #endif /* defined(VK_EXT_image_drm_format_modifier) */ #if defined(VK_EXT_line_rasterization) PFN_vkCmdSetLineStippleEXT vkCmdSetLineStippleEXT; #endif /* defined(VK_EXT_line_rasterization) */ +#if defined(VK_EXT_mesh_shader) + PFN_vkCmdDrawMeshTasksEXT vkCmdDrawMeshTasksEXT; + PFN_vkCmdDrawMeshTasksIndirectCountEXT vkCmdDrawMeshTasksIndirectCountEXT; + PFN_vkCmdDrawMeshTasksIndirectEXT vkCmdDrawMeshTasksIndirectEXT; +#endif /* defined(VK_EXT_mesh_shader) */ +#if defined(VK_EXT_metal_objects) + PFN_vkExportMetalObjectsEXT vkExportMetalObjectsEXT; +#endif /* defined(VK_EXT_metal_objects) */ #if defined(VK_EXT_multi_draw) PFN_vkCmdDrawMultiEXT vkCmdDrawMultiEXT; PFN_vkCmdDrawMultiIndexedEXT vkCmdDrawMultiIndexedEXT; #endif /* defined(VK_EXT_multi_draw) */ +#if defined(VK_EXT_opacity_micromap) + PFN_vkBuildMicromapsEXT vkBuildMicromapsEXT; + PFN_vkCmdBuildMicromapsEXT vkCmdBuildMicromapsEXT; + PFN_vkCmdCopyMemoryToMicromapEXT vkCmdCopyMemoryToMicromapEXT; + PFN_vkCmdCopyMicromapEXT vkCmdCopyMicromapEXT; + PFN_vkCmdCopyMicromapToMemoryEXT vkCmdCopyMicromapToMemoryEXT; + PFN_vkCmdWriteMicromapsPropertiesEXT vkCmdWriteMicromapsPropertiesEXT; + PFN_vkCopyMemoryToMicromapEXT vkCopyMemoryToMicromapEXT; + PFN_vkCopyMicromapEXT vkCopyMicromapEXT; + PFN_vkCopyMicromapToMemoryEXT vkCopyMicromapToMemoryEXT; + PFN_vkCreateMicromapEXT vkCreateMicromapEXT; + PFN_vkDestroyMicromapEXT vkDestroyMicromapEXT; + PFN_vkGetDeviceMicromapCompatibilityEXT vkGetDeviceMicromapCompatibilityEXT; + PFN_vkGetMicromapBuildSizesEXT vkGetMicromapBuildSizesEXT; + PFN_vkWriteMicromapsPropertiesEXT vkWriteMicromapsPropertiesEXT; +#endif /* defined(VK_EXT_opacity_micromap) */ #if defined(VK_EXT_pageable_device_local_memory) PFN_vkSetDeviceMemoryPriorityEXT vkSetDeviceMemoryPriorityEXT; #endif /* defined(VK_EXT_pageable_device_local_memory) */ @@ -431,6 +474,19 @@ struct VolkDeviceTable #if defined(VK_EXT_sample_locations) PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT; #endif /* defined(VK_EXT_sample_locations) */ +#if defined(VK_EXT_shader_module_identifier) + PFN_vkGetShaderModuleCreateInfoIdentifierEXT vkGetShaderModuleCreateInfoIdentifierEXT; + PFN_vkGetShaderModuleIdentifierEXT vkGetShaderModuleIdentifierEXT; +#endif /* defined(VK_EXT_shader_module_identifier) */ +#if defined(VK_EXT_shader_object) + PFN_vkCmdBindShadersEXT vkCmdBindShadersEXT; + PFN_vkCreateShadersEXT vkCreateShadersEXT; + PFN_vkDestroyShaderEXT vkDestroyShaderEXT; + PFN_vkGetShaderBinaryDataEXT vkGetShaderBinaryDataEXT; +#endif /* defined(VK_EXT_shader_object) */ +#if defined(VK_EXT_swapchain_maintenance1) + PFN_vkReleaseSwapchainImagesEXT vkReleaseSwapchainImagesEXT; +#endif /* defined(VK_EXT_swapchain_maintenance1) */ #if defined(VK_EXT_transform_feedback) PFN_vkCmdBeginQueryIndexedEXT vkCmdBeginQueryIndexedEXT; PFN_vkCmdBeginTransformFeedbackEXT vkCmdBeginTransformFeedbackEXT; @@ -445,9 +501,6 @@ struct VolkDeviceTable PFN_vkGetValidationCacheDataEXT vkGetValidationCacheDataEXT; PFN_vkMergeValidationCachesEXT vkMergeValidationCachesEXT; #endif /* defined(VK_EXT_validation_cache) */ -#if defined(VK_EXT_vertex_input_dynamic_state) - PFN_vkCmdSetVertexInputEXT vkCmdSetVertexInputEXT; -#endif /* defined(VK_EXT_vertex_input_dynamic_state) */ #if defined(VK_FUCHSIA_buffer_collection) PFN_vkCreateBufferCollectionFUCHSIA vkCreateBufferCollectionFUCHSIA; PFN_vkDestroyBufferCollectionFUCHSIA vkDestroyBufferCollectionFUCHSIA; @@ -467,6 +520,10 @@ struct VolkDeviceTable PFN_vkGetPastPresentationTimingGOOGLE vkGetPastPresentationTimingGOOGLE; PFN_vkGetRefreshCycleDurationGOOGLE vkGetRefreshCycleDurationGOOGLE; #endif /* defined(VK_GOOGLE_display_timing) */ +#if defined(VK_HUAWEI_cluster_culling_shader) + PFN_vkCmdDrawClusterHUAWEI vkCmdDrawClusterHUAWEI; + PFN_vkCmdDrawClusterIndirectHUAWEI vkCmdDrawClusterIndirectHUAWEI; +#endif /* defined(VK_HUAWEI_cluster_culling_shader) */ #if defined(VK_HUAWEI_invocation_mask) PFN_vkCmdBindInvocationMaskHUAWEI vkCmdBindInvocationMaskHUAWEI; #endif /* defined(VK_HUAWEI_invocation_mask) */ @@ -597,6 +654,16 @@ struct VolkDeviceTable PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirementsKHR; PFN_vkGetDeviceImageSparseMemoryRequirementsKHR vkGetDeviceImageSparseMemoryRequirementsKHR; #endif /* defined(VK_KHR_maintenance4) */ +#if defined(VK_KHR_maintenance5) + PFN_vkCmdBindIndexBuffer2KHR vkCmdBindIndexBuffer2KHR; + PFN_vkGetDeviceImageSubresourceLayoutKHR vkGetDeviceImageSubresourceLayoutKHR; + PFN_vkGetImageSubresourceLayout2KHR vkGetImageSubresourceLayout2KHR; + PFN_vkGetRenderingAreaGranularityKHR vkGetRenderingAreaGranularityKHR; +#endif /* defined(VK_KHR_maintenance5) */ +#if defined(VK_KHR_map_memory2) + PFN_vkMapMemory2KHR vkMapMemory2KHR; + PFN_vkUnmapMemory2KHR vkUnmapMemory2KHR; +#endif /* defined(VK_KHR_map_memory2) */ #if defined(VK_KHR_performance_query) PFN_vkAcquireProfilingLockKHR vkAcquireProfilingLockKHR; PFN_vkReleaseProfilingLockKHR vkReleaseProfilingLockKHR; @@ -662,6 +729,7 @@ struct VolkDeviceTable #endif /* defined(VK_KHR_video_decode_queue) */ #if defined(VK_KHR_video_encode_queue) PFN_vkCmdEncodeVideoKHR vkCmdEncodeVideoKHR; + PFN_vkGetEncodedVideoSessionParametersKHR vkGetEncodedVideoSessionParametersKHR; #endif /* defined(VK_KHR_video_encode_queue) */ #if defined(VK_KHR_video_queue) PFN_vkBindVideoSessionMemoryKHR vkBindVideoSessionMemoryKHR; @@ -689,6 +757,10 @@ struct VolkDeviceTable #if defined(VK_NV_clip_space_w_scaling) PFN_vkCmdSetViewportWScalingNV vkCmdSetViewportWScalingNV; #endif /* defined(VK_NV_clip_space_w_scaling) */ +#if defined(VK_NV_copy_memory_indirect) + PFN_vkCmdCopyMemoryIndirectNV vkCmdCopyMemoryIndirectNV; + PFN_vkCmdCopyMemoryToImageIndirectNV vkCmdCopyMemoryToImageIndirectNV; +#endif /* defined(VK_NV_copy_memory_indirect) */ #if defined(VK_NV_device_diagnostic_checkpoints) PFN_vkCmdSetCheckpointNV vkCmdSetCheckpointNV; PFN_vkGetQueueCheckpointDataNV vkGetQueueCheckpointDataNV; @@ -701,6 +773,11 @@ struct VolkDeviceTable PFN_vkDestroyIndirectCommandsLayoutNV vkDestroyIndirectCommandsLayoutNV; PFN_vkGetGeneratedCommandsMemoryRequirementsNV vkGetGeneratedCommandsMemoryRequirementsNV; #endif /* defined(VK_NV_device_generated_commands) */ +#if defined(VK_NV_device_generated_commands_compute) + PFN_vkCmdUpdatePipelineIndirectBufferNV vkCmdUpdatePipelineIndirectBufferNV; + PFN_vkGetPipelineIndirectDeviceAddressNV vkGetPipelineIndirectDeviceAddressNV; + PFN_vkGetPipelineIndirectMemoryRequirementsNV vkGetPipelineIndirectMemoryRequirementsNV; +#endif /* defined(VK_NV_device_generated_commands_compute) */ #if defined(VK_NV_external_memory_rdma) PFN_vkGetMemoryRemoteAddressNV vkGetMemoryRemoteAddressNV; #endif /* defined(VK_NV_external_memory_rdma) */ @@ -710,11 +787,21 @@ struct VolkDeviceTable #if defined(VK_NV_fragment_shading_rate_enums) PFN_vkCmdSetFragmentShadingRateEnumNV vkCmdSetFragmentShadingRateEnumNV; #endif /* defined(VK_NV_fragment_shading_rate_enums) */ +#if defined(VK_NV_memory_decompression) + PFN_vkCmdDecompressMemoryIndirectCountNV vkCmdDecompressMemoryIndirectCountNV; + PFN_vkCmdDecompressMemoryNV vkCmdDecompressMemoryNV; +#endif /* defined(VK_NV_memory_decompression) */ #if defined(VK_NV_mesh_shader) PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; PFN_vkCmdDrawMeshTasksNV vkCmdDrawMeshTasksNV; #endif /* defined(VK_NV_mesh_shader) */ +#if defined(VK_NV_optical_flow) + PFN_vkBindOpticalFlowSessionImageNV vkBindOpticalFlowSessionImageNV; + PFN_vkCmdOpticalFlowExecuteNV vkCmdOpticalFlowExecuteNV; + PFN_vkCreateOpticalFlowSessionNV vkCreateOpticalFlowSessionNV; + PFN_vkDestroyOpticalFlowSessionNV vkDestroyOpticalFlowSessionNV; +#endif /* defined(VK_NV_optical_flow) */ #if defined(VK_NV_ray_tracing) PFN_vkBindAccelerationStructureMemoryNV vkBindAccelerationStructureMemoryNV; PFN_vkCmdBuildAccelerationStructureNV vkCmdBuildAccelerationStructureNV; @@ -729,6 +816,9 @@ struct VolkDeviceTable PFN_vkGetAccelerationStructureMemoryRequirementsNV vkGetAccelerationStructureMemoryRequirementsNV; PFN_vkGetRayTracingShaderGroupHandlesNV vkGetRayTracingShaderGroupHandlesNV; #endif /* defined(VK_NV_ray_tracing) */ +#if defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 + PFN_vkCmdSetExclusiveScissorEnableNV vkCmdSetExclusiveScissorEnableNV; +#endif /* defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 */ #if defined(VK_NV_scissor_exclusive) PFN_vkCmdSetExclusiveScissorNV vkCmdSetExclusiveScissorNV; #endif /* defined(VK_NV_scissor_exclusive) */ @@ -737,13 +827,94 @@ struct VolkDeviceTable PFN_vkCmdSetCoarseSampleOrderNV vkCmdSetCoarseSampleOrderNV; PFN_vkCmdSetViewportShadingRatePaletteNV vkCmdSetViewportShadingRatePaletteNV; #endif /* defined(VK_NV_shading_rate_image) */ +#if defined(VK_QCOM_tile_properties) + PFN_vkGetDynamicRenderingTilePropertiesQCOM vkGetDynamicRenderingTilePropertiesQCOM; + PFN_vkGetFramebufferTilePropertiesQCOM vkGetFramebufferTilePropertiesQCOM; +#endif /* defined(VK_QCOM_tile_properties) */ +#if defined(VK_QNX_external_memory_screen_buffer) + PFN_vkGetScreenBufferPropertiesQNX vkGetScreenBufferPropertiesQNX; +#endif /* defined(VK_QNX_external_memory_screen_buffer) */ #if defined(VK_VALVE_descriptor_set_host_mapping) PFN_vkGetDescriptorSetHostMappingVALVE vkGetDescriptorSetHostMappingVALVE; PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE vkGetDescriptorSetLayoutHostMappingInfoVALVE; #endif /* defined(VK_VALVE_descriptor_set_host_mapping) */ +#if (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) + PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; + PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; + PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; + PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; + PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; + PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; + PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; + PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; + PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; + PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; + PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; + PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) + PFN_vkCmdSetDepthBiasEnableEXT vkCmdSetDepthBiasEnableEXT; + PFN_vkCmdSetLogicOpEXT vkCmdSetLogicOpEXT; + PFN_vkCmdSetPatchControlPointsEXT vkCmdSetPatchControlPointsEXT; + PFN_vkCmdSetPrimitiveRestartEnableEXT vkCmdSetPrimitiveRestartEnableEXT; + PFN_vkCmdSetRasterizerDiscardEnableEXT vkCmdSetRasterizerDiscardEnableEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) + PFN_vkCmdSetAlphaToCoverageEnableEXT vkCmdSetAlphaToCoverageEnableEXT; + PFN_vkCmdSetAlphaToOneEnableEXT vkCmdSetAlphaToOneEnableEXT; + PFN_vkCmdSetColorBlendAdvancedEXT vkCmdSetColorBlendAdvancedEXT; + PFN_vkCmdSetColorBlendEnableEXT vkCmdSetColorBlendEnableEXT; + PFN_vkCmdSetColorBlendEquationEXT vkCmdSetColorBlendEquationEXT; + PFN_vkCmdSetColorWriteMaskEXT vkCmdSetColorWriteMaskEXT; + PFN_vkCmdSetConservativeRasterizationModeEXT vkCmdSetConservativeRasterizationModeEXT; + PFN_vkCmdSetDepthClampEnableEXT vkCmdSetDepthClampEnableEXT; + PFN_vkCmdSetDepthClipEnableEXT vkCmdSetDepthClipEnableEXT; + PFN_vkCmdSetDepthClipNegativeOneToOneEXT vkCmdSetDepthClipNegativeOneToOneEXT; + PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT vkCmdSetExtraPrimitiveOverestimationSizeEXT; + PFN_vkCmdSetLineRasterizationModeEXT vkCmdSetLineRasterizationModeEXT; + PFN_vkCmdSetLineStippleEnableEXT vkCmdSetLineStippleEnableEXT; + PFN_vkCmdSetLogicOpEnableEXT vkCmdSetLogicOpEnableEXT; + PFN_vkCmdSetPolygonModeEXT vkCmdSetPolygonModeEXT; + PFN_vkCmdSetProvokingVertexModeEXT vkCmdSetProvokingVertexModeEXT; + PFN_vkCmdSetRasterizationSamplesEXT vkCmdSetRasterizationSamplesEXT; + PFN_vkCmdSetRasterizationStreamEXT vkCmdSetRasterizationStreamEXT; + PFN_vkCmdSetSampleLocationsEnableEXT vkCmdSetSampleLocationsEnableEXT; + PFN_vkCmdSetSampleMaskEXT vkCmdSetSampleMaskEXT; + PFN_vkCmdSetTessellationDomainOriginEXT vkCmdSetTessellationDomainOriginEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) + PFN_vkCmdSetViewportWScalingEnableNV vkCmdSetViewportWScalingEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) + PFN_vkCmdSetViewportSwizzleNV vkCmdSetViewportSwizzleNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) + PFN_vkCmdSetCoverageToColorEnableNV vkCmdSetCoverageToColorEnableNV; + PFN_vkCmdSetCoverageToColorLocationNV vkCmdSetCoverageToColorLocationNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) + PFN_vkCmdSetCoverageModulationModeNV vkCmdSetCoverageModulationModeNV; + PFN_vkCmdSetCoverageModulationTableEnableNV vkCmdSetCoverageModulationTableEnableNV; + PFN_vkCmdSetCoverageModulationTableNV vkCmdSetCoverageModulationTableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) + PFN_vkCmdSetShadingRateImageEnableNV vkCmdSetShadingRateImageEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) + PFN_vkCmdSetRepresentativeFragmentTestEnableNV vkCmdSetRepresentativeFragmentTestEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) + PFN_vkCmdSetCoverageReductionModeNV vkCmdSetCoverageReductionModeNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) */ #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) PFN_vkGetDeviceGroupSurfacePresentModes2EXT vkGetDeviceGroupSurfacePresentModes2EXT; #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ +#if (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) + PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; +#endif /* (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) */ +#if (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) + PFN_vkCmdSetVertexInputEXT vkCmdSetVertexInputEXT; +#endif /* (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) */ #if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) PFN_vkCmdPushDescriptorSetWithTemplateKHR vkCmdPushDescriptorSetWithTemplateKHR; #endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ @@ -981,6 +1152,15 @@ extern PFN_vkGetPrivateData vkGetPrivateData; extern PFN_vkQueueSubmit2 vkQueueSubmit2; extern PFN_vkSetPrivateData vkSetPrivateData; #endif /* defined(VK_VERSION_1_3) */ +#if defined(VK_AMDX_shader_enqueue) +extern PFN_vkCmdDispatchGraphAMDX vkCmdDispatchGraphAMDX; +extern PFN_vkCmdDispatchGraphIndirectAMDX vkCmdDispatchGraphIndirectAMDX; +extern PFN_vkCmdDispatchGraphIndirectCountAMDX vkCmdDispatchGraphIndirectCountAMDX; +extern PFN_vkCmdInitializeGraphScratchMemoryAMDX vkCmdInitializeGraphScratchMemoryAMDX; +extern PFN_vkCreateExecutionGraphPipelinesAMDX vkCreateExecutionGraphPipelinesAMDX; +extern PFN_vkGetExecutionGraphPipelineNodeIndexAMDX vkGetExecutionGraphPipelineNodeIndexAMDX; +extern PFN_vkGetExecutionGraphPipelineScratchSizeAMDX vkGetExecutionGraphPipelineScratchSizeAMDX; +#endif /* defined(VK_AMDX_shader_enqueue) */ #if defined(VK_AMD_buffer_marker) extern PFN_vkCmdWriteBufferMarkerAMD vkCmdWriteBufferMarkerAMD; #endif /* defined(VK_AMD_buffer_marker) */ @@ -1006,6 +1186,9 @@ extern PFN_vkGetDrmDisplayEXT vkGetDrmDisplayEXT; extern PFN_vkAcquireXlibDisplayEXT vkAcquireXlibDisplayEXT; extern PFN_vkGetRandROutputDisplayEXT vkGetRandROutputDisplayEXT; #endif /* defined(VK_EXT_acquire_xlib_display) */ +#if defined(VK_EXT_attachment_feedback_loop_dynamic_state) +extern PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT vkCmdSetAttachmentFeedbackLoopEnableEXT; +#endif /* defined(VK_EXT_attachment_feedback_loop_dynamic_state) */ #if defined(VK_EXT_buffer_device_address) extern PFN_vkGetBufferDeviceAddressEXT vkGetBufferDeviceAddressEXT; #endif /* defined(VK_EXT_buffer_device_address) */ @@ -1045,6 +1228,27 @@ extern PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT; extern PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT; extern PFN_vkSubmitDebugUtilsMessageEXT vkSubmitDebugUtilsMessageEXT; #endif /* defined(VK_EXT_debug_utils) */ +#if defined(VK_EXT_depth_bias_control) +extern PFN_vkCmdSetDepthBias2EXT vkCmdSetDepthBias2EXT; +#endif /* defined(VK_EXT_depth_bias_control) */ +#if defined(VK_EXT_descriptor_buffer) +extern PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT vkCmdBindDescriptorBufferEmbeddedSamplersEXT; +extern PFN_vkCmdBindDescriptorBuffersEXT vkCmdBindDescriptorBuffersEXT; +extern PFN_vkCmdSetDescriptorBufferOffsetsEXT vkCmdSetDescriptorBufferOffsetsEXT; +extern PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT vkGetBufferOpaqueCaptureDescriptorDataEXT; +extern PFN_vkGetDescriptorEXT vkGetDescriptorEXT; +extern PFN_vkGetDescriptorSetLayoutBindingOffsetEXT vkGetDescriptorSetLayoutBindingOffsetEXT; +extern PFN_vkGetDescriptorSetLayoutSizeEXT vkGetDescriptorSetLayoutSizeEXT; +extern PFN_vkGetImageOpaqueCaptureDescriptorDataEXT vkGetImageOpaqueCaptureDescriptorDataEXT; +extern PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT vkGetImageViewOpaqueCaptureDescriptorDataEXT; +extern PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT vkGetSamplerOpaqueCaptureDescriptorDataEXT; +#endif /* defined(VK_EXT_descriptor_buffer) */ +#if defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) +extern PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT; +#endif /* defined(VK_EXT_descriptor_buffer) && (defined(VK_KHR_acceleration_structure) || defined(VK_NV_ray_tracing)) */ +#if defined(VK_EXT_device_fault) +extern PFN_vkGetDeviceFaultInfoEXT vkGetDeviceFaultInfoEXT; +#endif /* defined(VK_EXT_device_fault) */ #if defined(VK_EXT_direct_mode_display) extern PFN_vkReleaseDisplayEXT vkReleaseDisplayEXT; #endif /* defined(VK_EXT_direct_mode_display) */ @@ -1055,6 +1259,10 @@ extern PFN_vkGetPhysicalDeviceDirectFBPresentationSupportEXT vkGetPhysicalDevice #if defined(VK_EXT_discard_rectangles) extern PFN_vkCmdSetDiscardRectangleEXT vkCmdSetDiscardRectangleEXT; #endif /* defined(VK_EXT_discard_rectangles) */ +#if defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 +extern PFN_vkCmdSetDiscardRectangleEnableEXT vkCmdSetDiscardRectangleEnableEXT; +extern PFN_vkCmdSetDiscardRectangleModeEXT vkCmdSetDiscardRectangleModeEXT; +#endif /* defined(VK_EXT_discard_rectangles) && VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION >= 2 */ #if defined(VK_EXT_display_control) extern PFN_vkDisplayPowerControlEXT vkDisplayPowerControlEXT; extern PFN_vkGetSwapchainCounterEXT vkGetSwapchainCounterEXT; @@ -1064,27 +1272,6 @@ extern PFN_vkRegisterDisplayEventEXT vkRegisterDisplayEventEXT; #if defined(VK_EXT_display_surface_counter) extern PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT vkGetPhysicalDeviceSurfaceCapabilities2EXT; #endif /* defined(VK_EXT_display_surface_counter) */ -#if defined(VK_EXT_extended_dynamic_state) -extern PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; -extern PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; -extern PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; -extern PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; -extern PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; -extern PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; -extern PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; -extern PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; -extern PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; -extern PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; -extern PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; -extern PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; -#endif /* defined(VK_EXT_extended_dynamic_state) */ -#if defined(VK_EXT_extended_dynamic_state2) -extern PFN_vkCmdSetDepthBiasEnableEXT vkCmdSetDepthBiasEnableEXT; -extern PFN_vkCmdSetLogicOpEXT vkCmdSetLogicOpEXT; -extern PFN_vkCmdSetPatchControlPointsEXT vkCmdSetPatchControlPointsEXT; -extern PFN_vkCmdSetPrimitiveRestartEnableEXT vkCmdSetPrimitiveRestartEnableEXT; -extern PFN_vkCmdSetRasterizerDiscardEnableEXT vkCmdSetRasterizerDiscardEnableEXT; -#endif /* defined(VK_EXT_extended_dynamic_state2) */ #if defined(VK_EXT_external_memory_host) extern PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; #endif /* defined(VK_EXT_external_memory_host) */ @@ -1099,18 +1286,29 @@ extern PFN_vkSetHdrMetadataEXT vkSetHdrMetadataEXT; #if defined(VK_EXT_headless_surface) extern PFN_vkCreateHeadlessSurfaceEXT vkCreateHeadlessSurfaceEXT; #endif /* defined(VK_EXT_headless_surface) */ +#if defined(VK_EXT_host_image_copy) +extern PFN_vkCopyImageToImageEXT vkCopyImageToImageEXT; +extern PFN_vkCopyImageToMemoryEXT vkCopyImageToMemoryEXT; +extern PFN_vkCopyMemoryToImageEXT vkCopyMemoryToImageEXT; +extern PFN_vkTransitionImageLayoutEXT vkTransitionImageLayoutEXT; +#endif /* defined(VK_EXT_host_image_copy) */ #if defined(VK_EXT_host_query_reset) extern PFN_vkResetQueryPoolEXT vkResetQueryPoolEXT; #endif /* defined(VK_EXT_host_query_reset) */ -#if defined(VK_EXT_image_compression_control) -extern PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; -#endif /* defined(VK_EXT_image_compression_control) */ #if defined(VK_EXT_image_drm_format_modifier) extern PFN_vkGetImageDrmFormatModifierPropertiesEXT vkGetImageDrmFormatModifierPropertiesEXT; #endif /* defined(VK_EXT_image_drm_format_modifier) */ #if defined(VK_EXT_line_rasterization) extern PFN_vkCmdSetLineStippleEXT vkCmdSetLineStippleEXT; #endif /* defined(VK_EXT_line_rasterization) */ +#if defined(VK_EXT_mesh_shader) +extern PFN_vkCmdDrawMeshTasksEXT vkCmdDrawMeshTasksEXT; +extern PFN_vkCmdDrawMeshTasksIndirectCountEXT vkCmdDrawMeshTasksIndirectCountEXT; +extern PFN_vkCmdDrawMeshTasksIndirectEXT vkCmdDrawMeshTasksIndirectEXT; +#endif /* defined(VK_EXT_mesh_shader) */ +#if defined(VK_EXT_metal_objects) +extern PFN_vkExportMetalObjectsEXT vkExportMetalObjectsEXT; +#endif /* defined(VK_EXT_metal_objects) */ #if defined(VK_EXT_metal_surface) extern PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; #endif /* defined(VK_EXT_metal_surface) */ @@ -1118,6 +1316,22 @@ extern PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; extern PFN_vkCmdDrawMultiEXT vkCmdDrawMultiEXT; extern PFN_vkCmdDrawMultiIndexedEXT vkCmdDrawMultiIndexedEXT; #endif /* defined(VK_EXT_multi_draw) */ +#if defined(VK_EXT_opacity_micromap) +extern PFN_vkBuildMicromapsEXT vkBuildMicromapsEXT; +extern PFN_vkCmdBuildMicromapsEXT vkCmdBuildMicromapsEXT; +extern PFN_vkCmdCopyMemoryToMicromapEXT vkCmdCopyMemoryToMicromapEXT; +extern PFN_vkCmdCopyMicromapEXT vkCmdCopyMicromapEXT; +extern PFN_vkCmdCopyMicromapToMemoryEXT vkCmdCopyMicromapToMemoryEXT; +extern PFN_vkCmdWriteMicromapsPropertiesEXT vkCmdWriteMicromapsPropertiesEXT; +extern PFN_vkCopyMemoryToMicromapEXT vkCopyMemoryToMicromapEXT; +extern PFN_vkCopyMicromapEXT vkCopyMicromapEXT; +extern PFN_vkCopyMicromapToMemoryEXT vkCopyMicromapToMemoryEXT; +extern PFN_vkCreateMicromapEXT vkCreateMicromapEXT; +extern PFN_vkDestroyMicromapEXT vkDestroyMicromapEXT; +extern PFN_vkGetDeviceMicromapCompatibilityEXT vkGetDeviceMicromapCompatibilityEXT; +extern PFN_vkGetMicromapBuildSizesEXT vkGetMicromapBuildSizesEXT; +extern PFN_vkWriteMicromapsPropertiesEXT vkWriteMicromapsPropertiesEXT; +#endif /* defined(VK_EXT_opacity_micromap) */ #if defined(VK_EXT_pageable_device_local_memory) extern PFN_vkSetDeviceMemoryPriorityEXT vkSetDeviceMemoryPriorityEXT; #endif /* defined(VK_EXT_pageable_device_local_memory) */ @@ -1134,6 +1348,19 @@ extern PFN_vkSetPrivateDataEXT vkSetPrivateDataEXT; extern PFN_vkCmdSetSampleLocationsEXT vkCmdSetSampleLocationsEXT; extern PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT vkGetPhysicalDeviceMultisamplePropertiesEXT; #endif /* defined(VK_EXT_sample_locations) */ +#if defined(VK_EXT_shader_module_identifier) +extern PFN_vkGetShaderModuleCreateInfoIdentifierEXT vkGetShaderModuleCreateInfoIdentifierEXT; +extern PFN_vkGetShaderModuleIdentifierEXT vkGetShaderModuleIdentifierEXT; +#endif /* defined(VK_EXT_shader_module_identifier) */ +#if defined(VK_EXT_shader_object) +extern PFN_vkCmdBindShadersEXT vkCmdBindShadersEXT; +extern PFN_vkCreateShadersEXT vkCreateShadersEXT; +extern PFN_vkDestroyShaderEXT vkDestroyShaderEXT; +extern PFN_vkGetShaderBinaryDataEXT vkGetShaderBinaryDataEXT; +#endif /* defined(VK_EXT_shader_object) */ +#if defined(VK_EXT_swapchain_maintenance1) +extern PFN_vkReleaseSwapchainImagesEXT vkReleaseSwapchainImagesEXT; +#endif /* defined(VK_EXT_swapchain_maintenance1) */ #if defined(VK_EXT_tooling_info) extern PFN_vkGetPhysicalDeviceToolPropertiesEXT vkGetPhysicalDeviceToolPropertiesEXT; #endif /* defined(VK_EXT_tooling_info) */ @@ -1151,9 +1378,6 @@ extern PFN_vkDestroyValidationCacheEXT vkDestroyValidationCacheEXT; extern PFN_vkGetValidationCacheDataEXT vkGetValidationCacheDataEXT; extern PFN_vkMergeValidationCachesEXT vkMergeValidationCachesEXT; #endif /* defined(VK_EXT_validation_cache) */ -#if defined(VK_EXT_vertex_input_dynamic_state) -extern PFN_vkCmdSetVertexInputEXT vkCmdSetVertexInputEXT; -#endif /* defined(VK_EXT_vertex_input_dynamic_state) */ #if defined(VK_FUCHSIA_buffer_collection) extern PFN_vkCreateBufferCollectionFUCHSIA vkCreateBufferCollectionFUCHSIA; extern PFN_vkDestroyBufferCollectionFUCHSIA vkDestroyBufferCollectionFUCHSIA; @@ -1179,6 +1403,10 @@ extern PFN_vkCreateStreamDescriptorSurfaceGGP vkCreateStreamDescriptorSurfaceGGP extern PFN_vkGetPastPresentationTimingGOOGLE vkGetPastPresentationTimingGOOGLE; extern PFN_vkGetRefreshCycleDurationGOOGLE vkGetRefreshCycleDurationGOOGLE; #endif /* defined(VK_GOOGLE_display_timing) */ +#if defined(VK_HUAWEI_cluster_culling_shader) +extern PFN_vkCmdDrawClusterHUAWEI vkCmdDrawClusterHUAWEI; +extern PFN_vkCmdDrawClusterIndirectHUAWEI vkCmdDrawClusterIndirectHUAWEI; +#endif /* defined(VK_HUAWEI_cluster_culling_shader) */ #if defined(VK_HUAWEI_invocation_mask) extern PFN_vkCmdBindInvocationMaskHUAWEI vkCmdBindInvocationMaskHUAWEI; #endif /* defined(VK_HUAWEI_invocation_mask) */ @@ -1227,6 +1455,9 @@ extern PFN_vkGetBufferDeviceAddressKHR vkGetBufferDeviceAddressKHR; extern PFN_vkGetBufferOpaqueCaptureAddressKHR vkGetBufferOpaqueCaptureAddressKHR; extern PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR vkGetDeviceMemoryOpaqueCaptureAddressKHR; #endif /* defined(VK_KHR_buffer_device_address) */ +#if defined(VK_KHR_cooperative_matrix) +extern PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR; +#endif /* defined(VK_KHR_cooperative_matrix) */ #if defined(VK_KHR_copy_commands2) extern PFN_vkCmdBlitImage2KHR vkCmdBlitImage2KHR; extern PFN_vkCmdCopyBuffer2KHR vkCmdCopyBuffer2KHR; @@ -1353,6 +1584,16 @@ extern PFN_vkGetDeviceBufferMemoryRequirementsKHR vkGetDeviceBufferMemoryRequire extern PFN_vkGetDeviceImageMemoryRequirementsKHR vkGetDeviceImageMemoryRequirementsKHR; extern PFN_vkGetDeviceImageSparseMemoryRequirementsKHR vkGetDeviceImageSparseMemoryRequirementsKHR; #endif /* defined(VK_KHR_maintenance4) */ +#if defined(VK_KHR_maintenance5) +extern PFN_vkCmdBindIndexBuffer2KHR vkCmdBindIndexBuffer2KHR; +extern PFN_vkGetDeviceImageSubresourceLayoutKHR vkGetDeviceImageSubresourceLayoutKHR; +extern PFN_vkGetImageSubresourceLayout2KHR vkGetImageSubresourceLayout2KHR; +extern PFN_vkGetRenderingAreaGranularityKHR vkGetRenderingAreaGranularityKHR; +#endif /* defined(VK_KHR_maintenance5) */ +#if defined(VK_KHR_map_memory2) +extern PFN_vkMapMemory2KHR vkMapMemory2KHR; +extern PFN_vkUnmapMemory2KHR vkUnmapMemory2KHR; +#endif /* defined(VK_KHR_map_memory2) */ #if defined(VK_KHR_performance_query) extern PFN_vkAcquireProfilingLockKHR vkAcquireProfilingLockKHR; extern PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR; @@ -1427,6 +1668,8 @@ extern PFN_vkCmdDecodeVideoKHR vkCmdDecodeVideoKHR; #endif /* defined(VK_KHR_video_decode_queue) */ #if defined(VK_KHR_video_encode_queue) extern PFN_vkCmdEncodeVideoKHR vkCmdEncodeVideoKHR; +extern PFN_vkGetEncodedVideoSessionParametersKHR vkGetEncodedVideoSessionParametersKHR; +extern PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR; #endif /* defined(VK_KHR_video_encode_queue) */ #if defined(VK_KHR_video_queue) extern PFN_vkBindVideoSessionMemoryKHR vkBindVideoSessionMemoryKHR; @@ -1488,6 +1731,10 @@ extern PFN_vkCmdSetViewportWScalingNV vkCmdSetViewportWScalingNV; #if defined(VK_NV_cooperative_matrix) extern PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV vkGetPhysicalDeviceCooperativeMatrixPropertiesNV; #endif /* defined(VK_NV_cooperative_matrix) */ +#if defined(VK_NV_copy_memory_indirect) +extern PFN_vkCmdCopyMemoryIndirectNV vkCmdCopyMemoryIndirectNV; +extern PFN_vkCmdCopyMemoryToImageIndirectNV vkCmdCopyMemoryToImageIndirectNV; +#endif /* defined(VK_NV_copy_memory_indirect) */ #if defined(VK_NV_coverage_reduction_mode) extern PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV; #endif /* defined(VK_NV_coverage_reduction_mode) */ @@ -1503,6 +1750,11 @@ extern PFN_vkCreateIndirectCommandsLayoutNV vkCreateIndirectCommandsLayoutNV; extern PFN_vkDestroyIndirectCommandsLayoutNV vkDestroyIndirectCommandsLayoutNV; extern PFN_vkGetGeneratedCommandsMemoryRequirementsNV vkGetGeneratedCommandsMemoryRequirementsNV; #endif /* defined(VK_NV_device_generated_commands) */ +#if defined(VK_NV_device_generated_commands_compute) +extern PFN_vkCmdUpdatePipelineIndirectBufferNV vkCmdUpdatePipelineIndirectBufferNV; +extern PFN_vkGetPipelineIndirectDeviceAddressNV vkGetPipelineIndirectDeviceAddressNV; +extern PFN_vkGetPipelineIndirectMemoryRequirementsNV vkGetPipelineIndirectMemoryRequirementsNV; +#endif /* defined(VK_NV_device_generated_commands_compute) */ #if defined(VK_NV_external_memory_capabilities) extern PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV vkGetPhysicalDeviceExternalImageFormatPropertiesNV; #endif /* defined(VK_NV_external_memory_capabilities) */ @@ -1515,11 +1767,22 @@ extern PFN_vkGetMemoryWin32HandleNV vkGetMemoryWin32HandleNV; #if defined(VK_NV_fragment_shading_rate_enums) extern PFN_vkCmdSetFragmentShadingRateEnumNV vkCmdSetFragmentShadingRateEnumNV; #endif /* defined(VK_NV_fragment_shading_rate_enums) */ +#if defined(VK_NV_memory_decompression) +extern PFN_vkCmdDecompressMemoryIndirectCountNV vkCmdDecompressMemoryIndirectCountNV; +extern PFN_vkCmdDecompressMemoryNV vkCmdDecompressMemoryNV; +#endif /* defined(VK_NV_memory_decompression) */ #if defined(VK_NV_mesh_shader) extern PFN_vkCmdDrawMeshTasksIndirectCountNV vkCmdDrawMeshTasksIndirectCountNV; extern PFN_vkCmdDrawMeshTasksIndirectNV vkCmdDrawMeshTasksIndirectNV; extern PFN_vkCmdDrawMeshTasksNV vkCmdDrawMeshTasksNV; #endif /* defined(VK_NV_mesh_shader) */ +#if defined(VK_NV_optical_flow) +extern PFN_vkBindOpticalFlowSessionImageNV vkBindOpticalFlowSessionImageNV; +extern PFN_vkCmdOpticalFlowExecuteNV vkCmdOpticalFlowExecuteNV; +extern PFN_vkCreateOpticalFlowSessionNV vkCreateOpticalFlowSessionNV; +extern PFN_vkDestroyOpticalFlowSessionNV vkDestroyOpticalFlowSessionNV; +extern PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV vkGetPhysicalDeviceOpticalFlowImageFormatsNV; +#endif /* defined(VK_NV_optical_flow) */ #if defined(VK_NV_ray_tracing) extern PFN_vkBindAccelerationStructureMemoryNV vkBindAccelerationStructureMemoryNV; extern PFN_vkCmdBuildAccelerationStructureNV vkCmdBuildAccelerationStructureNV; @@ -1534,6 +1797,9 @@ extern PFN_vkGetAccelerationStructureHandleNV vkGetAccelerationStructureHandleNV extern PFN_vkGetAccelerationStructureMemoryRequirementsNV vkGetAccelerationStructureMemoryRequirementsNV; extern PFN_vkGetRayTracingShaderGroupHandlesNV vkGetRayTracingShaderGroupHandlesNV; #endif /* defined(VK_NV_ray_tracing) */ +#if defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 +extern PFN_vkCmdSetExclusiveScissorEnableNV vkCmdSetExclusiveScissorEnableNV; +#endif /* defined(VK_NV_scissor_exclusive) && VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION >= 2 */ #if defined(VK_NV_scissor_exclusive) extern PFN_vkCmdSetExclusiveScissorNV vkCmdSetExclusiveScissorNV; #endif /* defined(VK_NV_scissor_exclusive) */ @@ -1542,6 +1808,13 @@ extern PFN_vkCmdBindShadingRateImageNV vkCmdBindShadingRateImageNV; extern PFN_vkCmdSetCoarseSampleOrderNV vkCmdSetCoarseSampleOrderNV; extern PFN_vkCmdSetViewportShadingRatePaletteNV vkCmdSetViewportShadingRatePaletteNV; #endif /* defined(VK_NV_shading_rate_image) */ +#if defined(VK_QCOM_tile_properties) +extern PFN_vkGetDynamicRenderingTilePropertiesQCOM vkGetDynamicRenderingTilePropertiesQCOM; +extern PFN_vkGetFramebufferTilePropertiesQCOM vkGetFramebufferTilePropertiesQCOM; +#endif /* defined(VK_QCOM_tile_properties) */ +#if defined(VK_QNX_external_memory_screen_buffer) +extern PFN_vkGetScreenBufferPropertiesQNX vkGetScreenBufferPropertiesQNX; +#endif /* defined(VK_QNX_external_memory_screen_buffer) */ #if defined(VK_QNX_screen_surface) extern PFN_vkCreateScreenSurfaceQNX vkCreateScreenSurfaceQNX; extern PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX vkGetPhysicalDeviceScreenPresentationSupportQNX; @@ -1550,9 +1823,83 @@ extern PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX vkGetPhysicalDeviceSc extern PFN_vkGetDescriptorSetHostMappingVALVE vkGetDescriptorSetHostMappingVALVE; extern PFN_vkGetDescriptorSetLayoutHostMappingInfoVALVE vkGetDescriptorSetLayoutHostMappingInfoVALVE; #endif /* defined(VK_VALVE_descriptor_set_host_mapping) */ +#if (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) +extern PFN_vkCmdBindVertexBuffers2EXT vkCmdBindVertexBuffers2EXT; +extern PFN_vkCmdSetCullModeEXT vkCmdSetCullModeEXT; +extern PFN_vkCmdSetDepthBoundsTestEnableEXT vkCmdSetDepthBoundsTestEnableEXT; +extern PFN_vkCmdSetDepthCompareOpEXT vkCmdSetDepthCompareOpEXT; +extern PFN_vkCmdSetDepthTestEnableEXT vkCmdSetDepthTestEnableEXT; +extern PFN_vkCmdSetDepthWriteEnableEXT vkCmdSetDepthWriteEnableEXT; +extern PFN_vkCmdSetFrontFaceEXT vkCmdSetFrontFaceEXT; +extern PFN_vkCmdSetPrimitiveTopologyEXT vkCmdSetPrimitiveTopologyEXT; +extern PFN_vkCmdSetScissorWithCountEXT vkCmdSetScissorWithCountEXT; +extern PFN_vkCmdSetStencilOpEXT vkCmdSetStencilOpEXT; +extern PFN_vkCmdSetStencilTestEnableEXT vkCmdSetStencilTestEnableEXT; +extern PFN_vkCmdSetViewportWithCountEXT vkCmdSetViewportWithCountEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) +extern PFN_vkCmdSetDepthBiasEnableEXT vkCmdSetDepthBiasEnableEXT; +extern PFN_vkCmdSetLogicOpEXT vkCmdSetLogicOpEXT; +extern PFN_vkCmdSetPatchControlPointsEXT vkCmdSetPatchControlPointsEXT; +extern PFN_vkCmdSetPrimitiveRestartEnableEXT vkCmdSetPrimitiveRestartEnableEXT; +extern PFN_vkCmdSetRasterizerDiscardEnableEXT vkCmdSetRasterizerDiscardEnableEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state2)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) +extern PFN_vkCmdSetAlphaToCoverageEnableEXT vkCmdSetAlphaToCoverageEnableEXT; +extern PFN_vkCmdSetAlphaToOneEnableEXT vkCmdSetAlphaToOneEnableEXT; +extern PFN_vkCmdSetColorBlendAdvancedEXT vkCmdSetColorBlendAdvancedEXT; +extern PFN_vkCmdSetColorBlendEnableEXT vkCmdSetColorBlendEnableEXT; +extern PFN_vkCmdSetColorBlendEquationEXT vkCmdSetColorBlendEquationEXT; +extern PFN_vkCmdSetColorWriteMaskEXT vkCmdSetColorWriteMaskEXT; +extern PFN_vkCmdSetConservativeRasterizationModeEXT vkCmdSetConservativeRasterizationModeEXT; +extern PFN_vkCmdSetDepthClampEnableEXT vkCmdSetDepthClampEnableEXT; +extern PFN_vkCmdSetDepthClipEnableEXT vkCmdSetDepthClipEnableEXT; +extern PFN_vkCmdSetDepthClipNegativeOneToOneEXT vkCmdSetDepthClipNegativeOneToOneEXT; +extern PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT vkCmdSetExtraPrimitiveOverestimationSizeEXT; +extern PFN_vkCmdSetLineRasterizationModeEXT vkCmdSetLineRasterizationModeEXT; +extern PFN_vkCmdSetLineStippleEnableEXT vkCmdSetLineStippleEnableEXT; +extern PFN_vkCmdSetLogicOpEnableEXT vkCmdSetLogicOpEnableEXT; +extern PFN_vkCmdSetPolygonModeEXT vkCmdSetPolygonModeEXT; +extern PFN_vkCmdSetProvokingVertexModeEXT vkCmdSetProvokingVertexModeEXT; +extern PFN_vkCmdSetRasterizationSamplesEXT vkCmdSetRasterizationSamplesEXT; +extern PFN_vkCmdSetRasterizationStreamEXT vkCmdSetRasterizationStreamEXT; +extern PFN_vkCmdSetSampleLocationsEnableEXT vkCmdSetSampleLocationsEnableEXT; +extern PFN_vkCmdSetSampleMaskEXT vkCmdSetSampleMaskEXT; +extern PFN_vkCmdSetTessellationDomainOriginEXT vkCmdSetTessellationDomainOriginEXT; +#endif /* (defined(VK_EXT_extended_dynamic_state3)) || (defined(VK_EXT_shader_object)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) +extern PFN_vkCmdSetViewportWScalingEnableNV vkCmdSetViewportWScalingEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_clip_space_w_scaling)) || (defined(VK_EXT_shader_object) && defined(VK_NV_clip_space_w_scaling)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) +extern PFN_vkCmdSetViewportSwizzleNV vkCmdSetViewportSwizzleNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_viewport_swizzle)) || (defined(VK_EXT_shader_object) && defined(VK_NV_viewport_swizzle)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) +extern PFN_vkCmdSetCoverageToColorEnableNV vkCmdSetCoverageToColorEnableNV; +extern PFN_vkCmdSetCoverageToColorLocationNV vkCmdSetCoverageToColorLocationNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_fragment_coverage_to_color)) || (defined(VK_EXT_shader_object) && defined(VK_NV_fragment_coverage_to_color)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) +extern PFN_vkCmdSetCoverageModulationModeNV vkCmdSetCoverageModulationModeNV; +extern PFN_vkCmdSetCoverageModulationTableEnableNV vkCmdSetCoverageModulationTableEnableNV; +extern PFN_vkCmdSetCoverageModulationTableNV vkCmdSetCoverageModulationTableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_framebuffer_mixed_samples)) || (defined(VK_EXT_shader_object) && defined(VK_NV_framebuffer_mixed_samples)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) +extern PFN_vkCmdSetShadingRateImageEnableNV vkCmdSetShadingRateImageEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_shading_rate_image)) || (defined(VK_EXT_shader_object) && defined(VK_NV_shading_rate_image)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) +extern PFN_vkCmdSetRepresentativeFragmentTestEnableNV vkCmdSetRepresentativeFragmentTestEnableNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_representative_fragment_test)) || (defined(VK_EXT_shader_object) && defined(VK_NV_representative_fragment_test)) */ +#if (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) +extern PFN_vkCmdSetCoverageReductionModeNV vkCmdSetCoverageReductionModeNV; +#endif /* (defined(VK_EXT_extended_dynamic_state3) && defined(VK_NV_coverage_reduction_mode)) || (defined(VK_EXT_shader_object) && defined(VK_NV_coverage_reduction_mode)) */ #if (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) extern PFN_vkGetDeviceGroupSurfacePresentModes2EXT vkGetDeviceGroupSurfacePresentModes2EXT; #endif /* (defined(VK_EXT_full_screen_exclusive) && defined(VK_KHR_device_group)) || (defined(VK_EXT_full_screen_exclusive) && defined(VK_VERSION_1_1)) */ +#if (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) +extern PFN_vkGetImageSubresourceLayout2EXT vkGetImageSubresourceLayout2EXT; +#endif /* (defined(VK_EXT_host_image_copy)) || (defined(VK_EXT_image_compression_control)) */ +#if (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) +extern PFN_vkCmdSetVertexInputEXT vkCmdSetVertexInputEXT; +#endif /* (defined(VK_EXT_shader_object)) || (defined(VK_EXT_vertex_input_dynamic_state)) */ #if (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) extern PFN_vkCmdPushDescriptorSetWithTemplateKHR vkCmdPushDescriptorSetWithTemplateKHR; #endif /* (defined(VK_KHR_descriptor_update_template) && defined(VK_KHR_push_descriptor)) || (defined(VK_KHR_push_descriptor) && defined(VK_VERSION_1_1)) || (defined(VK_KHR_push_descriptor) && defined(VK_KHR_descriptor_update_template)) */ @@ -1581,7 +1928,7 @@ extern PFN_vkAcquireNextImage2KHR vkAcquireNextImage2KHR; #endif /** - * Copyright (c) 2018-2019 Arseny Kapoulkine + * Copyright (c) 2018-2023 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/Lumos/Source/Lumos/Audio/AudioManager.cpp b/Lumos/Source/Lumos/Audio/AudioManager.cpp index 40050c85..efec4c77 100644 --- a/Lumos/Source/Lumos/Audio/AudioManager.cpp +++ b/Lumos/Source/Lumos/Audio/AudioManager.cpp @@ -7,16 +7,30 @@ #ifdef LUMOS_OPENAL #include "Platform/OpenAL/ALManager.h" #endif +#include "EmptyAudioManager.h" namespace Lumos { AudioManager* AudioManager::Create() { + AudioManager* AManager; + #ifdef LUMOS_OPENAL - return new Audio::ALManager(); + AManager = new Audio::ALManager(); #else - return nullptr; + AManager = new Audio::EmptyAudioManager(); #endif + + if(!AManager->OnInit()) + { + // If empty audio manager already then init wouldn't fail + delete AManager; + AManager = new Audio::EmptyAudioManager(); + } + + AManager->SetPaused(true); + + return AManager; } void AudioManager::SetPaused(bool paused) diff --git a/Lumos/Source/Lumos/Audio/AudioManager.h b/Lumos/Source/Lumos/Audio/AudioManager.h index ae6ceb1f..393b7ee2 100644 --- a/Lumos/Source/Lumos/Audio/AudioManager.h +++ b/Lumos/Source/Lumos/Audio/AudioManager.h @@ -31,7 +31,7 @@ namespace Lumos static AudioManager* Create(); virtual ~AudioManager() = default; - virtual void OnInit() override = 0; + virtual bool OnInit() override = 0; virtual void OnUpdate(const TimeStep& dt, Scene* scene) override = 0; virtual void UpdateListener(Scene* scene) {}; diff --git a/Lumos/Source/Lumos/Audio/EmptyAudioManager.h b/Lumos/Source/Lumos/Audio/EmptyAudioManager.h new file mode 100644 index 00000000..84a53950 --- /dev/null +++ b/Lumos/Source/Lumos/Audio/EmptyAudioManager.h @@ -0,0 +1,18 @@ +#include "Audio/AudioManager.h" + +namespace Lumos +{ + namespace Audio + { + class EmptyAudioManager : public AudioManager + { + public: + EmptyAudioManager(int numChannels = 8) { } + ~EmptyAudioManager() = default; + + bool OnInit() override { return true; }; + void OnUpdate(const TimeStep& dt, Scene* scene) override {}; + void OnImGui() override { } + }; + } +} \ No newline at end of file diff --git a/Lumos/Source/Lumos/Audio/OggLoader.cpp b/Lumos/Source/Lumos/Audio/OggLoader.cpp index edf1002d..6cb18aa1 100644 --- a/Lumos/Source/Lumos/Audio/OggLoader.cpp +++ b/Lumos/Source/Lumos/Audio/OggLoader.cpp @@ -1,6 +1,6 @@ #include "Precompiled.h" #include "OggLoader.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Sound.h" #define STB_VORBIS_HEADER_ONLY @@ -13,7 +13,7 @@ namespace Lumos AudioData data = AudioData(); std::string physicalPath; - if(!Lumos::VFS::Get().ResolvePhysicalPath(fileName, physicalPath)) + if(!Lumos::FileSystem::Get().ResolvePhysicalPath(fileName, physicalPath)) { LUMOS_LOG_INFO("Failed to load Ogg file : File Not Found"); } diff --git a/Lumos/Source/Lumos/Audio/Sound.cpp b/Lumos/Source/Lumos/Audio/Sound.cpp index 3e0b85e4..93ea67d1 100644 --- a/Lumos/Source/Lumos/Audio/Sound.cpp +++ b/Lumos/Source/Lumos/Audio/Sound.cpp @@ -1,6 +1,6 @@ #include "Precompiled.h" #include "Sound.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #ifdef LUMOS_OPENAL #include "Platform/OpenAL/ALSound.h" diff --git a/Lumos/Source/Lumos/Audio/SoundNode.h b/Lumos/Source/Lumos/Audio/SoundNode.h index 16c807ab..8dc9eac6 100644 --- a/Lumos/Source/Lumos/Audio/SoundNode.h +++ b/Lumos/Source/Lumos/Audio/SoundNode.h @@ -2,7 +2,7 @@ #include "Sound.h" #include "Core/StringUtilities.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include #include @@ -65,7 +65,7 @@ namespace Lumos void save(Archive& archive) const { std::string path; - VFS::Get().AbsoulePathToVFS(m_Sound ? m_Sound->GetFilePath() : "", path); + FileSystem::Get().AbsolutePathToFileSystem(m_Sound ? m_Sound->GetFilePath() : "", path); archive(cereal::make_nvp("Position", m_Position), cereal::make_nvp("Radius", m_Radius), cereal::make_nvp("Pitch", m_Pitch), cereal::make_nvp("Volume", m_Volume), cereal::make_nvp("Velocity", m_Velocity), cereal::make_nvp("Looping", m_IsLooping), cereal::make_nvp("Paused", m_Paused), cereal::make_nvp("ReferenceDistance", m_ReferenceDistance), cereal::make_nvp("Global", m_IsGlobal), cereal::make_nvp("TimeLeft", m_TimeLeft), cereal::make_nvp("Stationary", m_Stationary), cereal::make_nvp("SoundNodePath", path), cereal::make_nvp("RollOffFactor", m_RollOffFactor)); diff --git a/Lumos/Source/Lumos/Core/Application.cpp b/Lumos/Source/Lumos/Core/Application.cpp index 761c189a..1678233b 100644 --- a/Lumos/Source/Lumos/Core/Application.cpp +++ b/Lumos/Source/Lumos/Core/Application.cpp @@ -21,10 +21,14 @@ #include "Core/OS/Window.h" #include "Core/OS/OS.h" #include "Core/Profiler.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/JobSystem.h" +#include "Core/CoreSystem.h" #include "Core/StringUtilities.h" #include "Core/OS/FileSystem.h" +#include "Core/String.h" +#include "Core/DataStructures/Vector.h" +#include "Core/CommandLine.h" #include "Utilities/AssetManager.h" #include "Scripting/Lua/LuaManager.h" #include "ImGui/ImGuiManager.h" @@ -106,7 +110,7 @@ namespace Lumos m_SceneManager = CreateUniquePtr(); - MountVFSPaths(); + MountFileSystemPaths(); // Set Default values m_ProjectSettings.RenderAPI = 1; m_ProjectSettings.Width = 1200; @@ -125,8 +129,6 @@ namespace Lumos m_ProjectSettings.m_EngineAssetPath = StringUtilities::GetFileLocation(OS::Instance()->GetExecutablePath()) + "../../Lumos/Assets/"; #endif - VFS::Get().Mount("CoreShaders", m_ProjectSettings.m_EngineAssetPath + std::string("Shaders")); - if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets")) std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets"); @@ -151,7 +153,7 @@ namespace Lumos if(!FileSystem::FolderExists(m_ProjectSettings.m_ProjectRoot + "Assets/Materials")) std::filesystem::create_directory(m_ProjectSettings.m_ProjectRoot + "Assets/Materials"); - MountVFSPaths(); + MountFileSystemPaths(); m_SceneManager->EnqueueScene(new Scene("Empty Scene")); m_SceneManager->SwitchScene(0); @@ -169,31 +171,33 @@ namespace Lumos LuaManager::Get().OnNewProject(m_ProjectSettings.m_ProjectRoot); } - void Application::MountVFSPaths() + void Application::MountFileSystemPaths() { - VFS::Get().Mount("Meshes", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Meshes"), true); - VFS::Get().Mount("Textures", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Textures"), true); - VFS::Get().Mount("Sounds", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Sounds"), true); - VFS::Get().Mount("Scripts", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Scripts"), true); - VFS::Get().Mount("Scenes", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Scenes"), true); - VFS::Get().Mount("Assets", m_ProjectSettings.m_ProjectRoot + std::string("Assets"), true); - VFS::Get().Mount("Prefabs", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Prefabs"), true); - VFS::Get().Mount("Materials", m_ProjectSettings.m_ProjectRoot + std::string("Assets/Materials"), true); + FileSystem::Get().SetAssetRoot(PushStr8Copy(m_Arena, (m_ProjectSettings.m_ProjectRoot + std::string("Assets")).c_str())); } Scene* Application::GetCurrentScene() const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_SceneManager->GetCurrentScene(); } void Application::Init() { LUMOS_PROFILE_FUNCTION(); + m_FrameArena = ArenaAlloc(Megabytes(4)); + m_Arena = ArenaAlloc(Megabytes(4)); + + SetMaxImageDimensions(4096, 4096); + m_SceneManager = CreateUniquePtr(); Deserialise(); - m_FrameArena = ArenaAlloc(Megabytes(64)); + CommandLine* cmdline = Internal::CoreSystem::GetCmdLine(); + if(CommandLineOptBool(cmdline, Str8Lit("help"))) + { + LUMOS_LOG_INFO("Print this help.\n Option 1 : test"); + } Engine::Get(); LuaManager::Get().OnInit(); @@ -215,7 +219,7 @@ namespace Lumos if(m_ProjectSettings.DefaultIcon) { - windowDesc.IconPaths = { "//Textures/icon.png", "//Textures/icon32.png" }; + windowDesc.IconPaths = { "//Assets/Textures/icon.png", "//Assets/Textures/icon32.png" }; } // Initialise the Window @@ -239,7 +243,7 @@ namespace Lumos if(FileSystem::FolderExists(m_ProjectSettings.m_EngineAssetPath + "Shaders")) loadEmbeddedShaders = false; - Graphics::Renderer::Init(loadEmbeddedShaders); + Graphics::Renderer::Init(loadEmbeddedShaders, m_ProjectSettings.m_EngineAssetPath); if(m_ProjectSettings.Fullscreen) m_Window->Maximise(); @@ -271,27 +275,26 @@ namespace Lumos auto audioManager = AudioManager::Create(); if(audioManager) { - audioManager->OnInit(); - audioManager->SetPaused(true); m_SystemManager->RegisterSystem(audioManager); } }); System::JobSystem::Execute(context, [this](JobDispatchArgs args) { m_SystemManager->RegisterSystem(); - m_SystemManager->RegisterSystem(); }); + m_SystemManager->RegisterSystem(); + LUMOS_LOG_INFO("Initialised Physics Manager"); }); System::JobSystem::Execute(context, [this](JobDispatchArgs args) { m_SceneManager->LoadCurrentList(); }); - System::JobSystem::Wait(context); - m_ImGuiManager = CreateUniquePtr(false); m_ImGuiManager->OnInit(); LUMOS_LOG_INFO("Initialised ImGui Manager"); m_RenderPasses = CreateUniquePtr(screenWidth, screenHeight); + System::JobSystem::Wait(context); + m_CurrentState = AppState::Running; Graphics::Material::InitDefaultTexture(); @@ -349,6 +352,7 @@ namespace Lumos { LUMOS_PROFILE_FUNCTION(); ArenaClear(m_FrameArena); + ClearScratchArenas(); if(m_SceneManager->GetSwitchingScene()) { @@ -595,7 +599,7 @@ namespace Lumos void Application::AddDefaultScene() { - if(m_SceneManager->GetScenes().size() == 0) + if(m_SceneManager->GetScenes().Size() == 0) { m_SceneManager->EnqueueScene(new Scene("Empty Scene")); m_SceneManager->SwitchScene(0); @@ -696,7 +700,9 @@ namespace Lumos { auto filePath = m_ProjectSettings.m_ProjectRoot + m_ProjectSettings.m_ProjectName + std::string(".lmproj"); - MountVFSPaths(); + MountFileSystemPaths(); + + LUMOS_LOG_INFO("Loading Project : {0}", filePath); if(!FileSystem::FileExists(filePath)) { @@ -728,8 +734,6 @@ namespace Lumos #else m_ProjectSettings.m_EngineAssetPath = StringUtilities::GetFileLocation(OS::Instance()->GetExecutablePath()) + "../../Lumos/Assets/"; #endif - VFS::Get().Mount("CoreShaders", m_ProjectSettings.m_EngineAssetPath + std::string("Shaders")); - m_SceneManager->EnqueueScene(new Scene("Empty Scene")); m_SceneManager->SwitchScene(0); } @@ -788,8 +792,6 @@ namespace Lumos m_ProjectSettings.m_EngineAssetPath = StringUtilities::GetFileLocation(OS::Instance()->GetExecutablePath()) + "../../Lumos/Assets/"; #endif - VFS::Get().Mount("CoreShaders", m_ProjectSettings.m_EngineAssetPath + std::string("Shaders")); - m_SceneManager->EnqueueScene(new Scene("Empty Scene")); m_SceneManager->SwitchScene(0); diff --git a/Lumos/Source/Lumos/Core/Application.h b/Lumos/Source/Lumos/Core/Application.h index 3a4c7f62..caf4dd17 100644 --- a/Lumos/Source/Lumos/Core/Application.h +++ b/Lumos/Source/Lumos/Core/Application.h @@ -2,7 +2,7 @@ #include "Core/Reference.h" #include "Scene/SceneManager.h" #include "Scene/SystemManager.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include #include @@ -189,7 +189,7 @@ namespace Lumos for(auto& path : paths) { std::string newPath; - VFS::Get().AbsoulePathToVFS(path, newPath); + FileSystem::Get().AbsolutePathToFileSystem(path, newPath); newPaths.push_back(path); } archive(cereal::make_nvp("Scenes", newPaths)); @@ -260,11 +260,9 @@ namespace Lumos if(m_ProjectSettings.ProjectVersion > 6) archive(cereal::make_nvp("GPUIndex", m_ProjectSettings.DesiredGPUIndex)); - - VFS::Get().Mount("CoreShaders", m_ProjectSettings.m_EngineAssetPath + std::string("Shaders")); } - void MountVFSPaths(); + void MountFileSystemPaths(); struct ProjectSettings { @@ -345,6 +343,7 @@ namespace Lumos std::mutex m_MainThreadQueueMutex; Arena* m_FrameArena; + Arena* m_Arena; NONCOPYABLE(Application) }; diff --git a/Lumos/Source/Lumos/Core/CommandLine.cpp b/Lumos/Source/Lumos/Core/CommandLine.cpp index 7ad1272e..0b750d42 100644 --- a/Lumos/Source/Lumos/Core/CommandLine.cpp +++ b/Lumos/Source/Lumos/Core/CommandLine.cpp @@ -1,218 +1,213 @@ #include "Precompiled.h" #include "CommandLine.h" - -#include -#include +#include "Maths/MathsUtilities.h" namespace Lumos { -#if 0 - argument_t::argument_t() - : m_Enabled{false}, m_LongName{}, m_ArgValue{}, m_ShortName{0} {} - - argument_t::argument_t(std::string longName, char shortName, std::string argVal) - : m_Enabled{true}, m_LongName{std::move(longName)}, m_ArgValue{std::move(argVal)}, m_ShortName{shortName} {} - - void argument_t::AsCheck() const - { - if(!m_Enabled) - LUMOS_LOG_ERROR("Option {0} is not provided. Type --help or -h for help", m_LongName); - - if(m_ArgValue.empty()) - LUMOS_LOG_ERROR("Option {0} does not have an argument. Type --help or -h for help", m_LongName); - } - - std::string argument_t::AsString() const - { - AsCheck(); - return m_ArgValue; - } - - int argument_t::AsInteger() const - { - AsCheck(); - return stoi(m_ArgValue); - } - - float argument_t::AsFloat() const - { - AsCheck(); - return stof(m_ArgValue); - } -#endif - - CommandLine::CommandLine() - { - m_Description = "Lumos Command Line Parser"; - } - - CommandLine::CommandLine(std::string description) - : m_Description(std::move(description)) - { - } - - void CommandLine::AddArgument(const std::vector& flags, - const Value& value, const std::string& help) + uint64_t CommandLineHashFromString(String8 string) { - m_Arguments.emplace_back(Argument { flags, value, help }); + uint64_t result = 5381; + for(uint64_t i = 0; i < string.size; i += 1) + { + result = ((result << 5) + result) + string.str[i]; + } + return result; } - void CommandLine::PrintHelp(std::ostream& os) const + CommandLine CommandLineFromStringList(Arena* arena, String8List strings) { + ArenaTemp scratch = ScratchBegin(&arena, 1); - // Print the general description. - os << m_Description << std::endl; + CommandLine cmdln = { 0 }; + cmdln.slots_count = 64; + cmdln.slots = PushArray(arena, CommandLineOptSlot, cmdln.slots_count); - // Find the argument with the longest combined flag length (in order - // to align the help messages). - - uint32_t maxFlagLength = 0; - - for(auto const& argument : m_Arguments) + String8List separated_strings = { 0 }; + for(String8Node* n = strings.first; n != 0; n = n->next) { - uint32_t flagLength = 0; - for(const auto& flag : argument.m_Flags) + String8List strings_from_this_n = { 0 }; + uint64_t start_idx = 0; + bool quoted = 0; + bool seeking_non_ws = 0; + + for(uint64_t idx = 0; idx <= n->string.size; idx += 1) { - // Plus comma and space. - flagLength += static_cast(flag.size()) + 2; + if(seeking_non_ws && idx < n->string.size && !CharIsSpace(n->string.str[idx])) + { + seeking_non_ws = 0; + start_idx = idx; + } + if(!seeking_non_ws && (idx == n->string.size || n->string.str[idx] == ' ' || n->string.str[idx] == '"')) + { + String8 string = Substr8(n->string, Range1U64({ start_idx, idx })); + Str8ListPush(scratch.arena, &strings_from_this_n, string); + start_idx = idx + 1; + if(n->string.str[idx] == ' ') + { + seeking_non_ws = 1; + } + } + if(idx < n->string.size && n->string.str[idx] == '"') + { + quoted ^= 1; + } } - - maxFlagLength = std::max(maxFlagLength, flagLength); + Str8ListConcatInPlace(&separated_strings, &strings_from_this_n); } - // Now print each argument. - for(const auto& argument : m_Arguments) + CommandLineOptNode* active_opt_node = 0; + for(String8Node* n = separated_strings.first; n != 0; n = n->next) { - std::string flags; - for(auto const& flag : argument.m_Flags) + String8 piece = Str8SkipChopWhitespace(n->string); + bool double_dash = Str8Match(Prefix8(piece, 2), Str8Lit("--"), 0); + bool single_dash = Str8Match(Prefix8(piece, 1), Str8Lit("-"), 0); + bool value_for_opt = (active_opt_node != 0); + + if(value_for_opt == 0 && (double_dash || single_dash)) { - flags += flag + ", "; + uint64_t dash_prefix_size = !!single_dash + !!double_dash; + String8 opt_part = Str8Skip(piece, dash_prefix_size); + uint64_t colon_pos = FindSubstr8(opt_part, Str8Lit(":"), 0, 0); + uint64_t equal_pos = FindSubstr8(opt_part, Str8Lit("="), 0, 0); + uint64_t value_specifier_pos = Maths::Min(colon_pos, equal_pos); + String8 opt_name = Prefix8(opt_part, value_specifier_pos); + String8 first_part_of_opt_value = Str8Skip(opt_part, value_specifier_pos + 1); + uint64_t hash = CommandLineHashFromString(opt_name); + uint64_t slot_idx = hash % cmdln.slots_count; + CommandLineOptSlot* slot = &cmdln.slots[slot_idx]; + CommandLineOptNode* node = PushArray(arena, CommandLineOptNode, 1); + QueuePush(slot->first, slot->last, node); + node->name = opt_name; + if(first_part_of_opt_value.size != 0) + { + Str8ListPush(arena, &node->values, first_part_of_opt_value); + } + if(value_specifier_pos < opt_part.size && (first_part_of_opt_value.size == 0 || Str8Match(Suffix8(first_part_of_opt_value, 1), Str8Lit(","), 0))) + { + active_opt_node = node; + } + } + else if(value_for_opt) + { + String8 splits[] = { Str8Lit(",") }; + String8List value_parts = StrSplit8(arena, piece, ArrayCount(splits), splits); + Str8ListConcatInPlace(&active_opt_node->values, &value_parts); + if(!Str8Match(Suffix8(piece, 1), Str8Lit(","), 0)) + { + active_opt_node = 0; + } } - // Remove last comma and space and add padding according to the - // longest flags in order to align the help messages. - std::stringstream sstr; - sstr << std::left << std::setw(maxFlagLength) - << flags.substr(0, flags.size() - 2); - - // Print the help for each argument. This is a bit more involved - // since we do line wrapping for long descriptions. - size_t spacePos = 0; - size_t lineWidth = 0; - while(spacePos != std::string::npos) { - size_t nextspacePos = argument.m_Help.find_first_of(' ', spacePos + 1); - sstr << argument.m_Help.substr(spacePos, nextspacePos - spacePos); - lineWidth += nextspacePos - spacePos; - spacePos = nextspacePos; + Str8ListPush(arena, &cmdln.inputs, piece); + } + } - if(lineWidth > 60) + { + for(uint64_t slot_idx = 0; slot_idx < cmdln.slots_count; slot_idx += 1) + { + for(CommandLineOptNode* n = cmdln.slots[slot_idx].first; n != 0; n = n->next) { - os << sstr.str() << std::endl; - sstr = std::stringstream(); - sstr << std::left << std::setw(maxFlagLength - 1) << " "; - lineWidth = 0; + StringJoin join = { Str8Lit(""), Str8Lit(","), Str8Lit("") }; + n->value = Str8ListJoin(arena, n->values, &join); } } } + + ScratchEnd(scratch); + return cmdln; } - void CommandLine::Parse(int argc, char** argv) + String8List CommandLineOptStrings(CommandLine* cmdln, String8 name) { - m_Argc = argc; - m_Argv = argv; - - // Skip the first argument (name of the program). - int i = 1; - while(i < argc) + String8List result = { 0 }; { - // First we have to identify wether the value is separated by a space - // or a '='. - std::string flag(argv[i]); - std::string value; - bool valueIsSeparate = false; - - // If there is an '=' in the flag, the part after the '=' is actually - // the value. - size_t equalPos = flag.find('='); - if(equalPos != std::string::npos) + uint64_t hash = CommandLineHashFromString(name); + uint64_t slot_idx = hash % cmdln->slots_count; + CommandLineOptSlot* slot = &cmdln->slots[slot_idx]; + CommandLineOptNode* node = 0; + for(CommandLineOptNode* n = slot->first; n != 0; n = n->next) { - value = flag.substr(equalPos + 1); - flag = flag.substr(0, equalPos); + if(Str8Match(n->name, name, 0)) + { + node = n; + break; + } } - // Else the following argument is the value. - else if(i + 1 < argc) + if(node != 0) { - value = argv[i + 1]; - valueIsSeparate = true; + result = node->values; } + } + return result; + } - // Search for an argument with the provided flag. - bool foundArgument = false; - - for(auto const& argument : m_Arguments) + String8 CommandLineOptString(CommandLine* cmdln, String8 name) + { + String8 result = { 0 }; + { + uint64_t hash = CommandLineHashFromString(name); + uint64_t slot_idx = hash % cmdln->slots_count; + CommandLineOptSlot* slot = &cmdln->slots[slot_idx]; + CommandLineOptNode* node = 0; + for(CommandLineOptNode* n = slot->first; n != 0; n = n->next) { - if(std::find(argument.m_Flags.begin(), argument.m_Flags.end(), flag) - != std::end(argument.m_Flags)) + if(Str8Match(n->name, name, 0)) { - - foundArgument = true; - - // In the case of booleans, there must not be a value present. - // So if the value is neither 'true' nor 'false' it is considered - // to be the next argument. - if(std::holds_alternative(argument.m_Value)) - { - if(!value.empty() && value != "true" && value != "false") - { - valueIsSeparate = false; - } - *std::get(argument.m_Value) = (value != "false"); - } - // In all other cases there must be a value. - else if(value.empty()) - { - LUMOS_LOG_ERROR( - "Failed to parse command line arguments: " - "Missing value for argument \"" - + flag + "\"!"); - } - // For a std::string, we take the entire value. - else if(std::holds_alternative(argument.m_Value)) - { - *std::get(argument.m_Value) = value; - } - // In all other cases we use a std::stringstream to - // convert the value. - else - { - std::visit( - [&value](auto&& arg) - { - std::stringstream sstr(value); - sstr >> *arg; - }, - argument.m_Value); - } - + node = n; break; } } - - // Print a warning if there was an unknown argument. - if(!foundArgument) + if(node != 0) { - LUMOS_LOG_ERROR("Ignoring unknown command line argument {0}", flag); - - // Advance to the next flag. - i++; + result = node->value; + } + } + return result; + } - // If the value was separated, we have to advance our index once more. - if(foundArgument && valueIsSeparate) + bool CommandLineOptBool(CommandLine* cmdln, String8 name) + { + bool result = 0; + { + uint64_t hash = CommandLineHashFromString(name); + uint64_t slot_idx = hash % cmdln->slots_count; + CommandLineOptSlot* slot = &cmdln->slots[slot_idx]; + CommandLineOptNode* node = 0; + for(CommandLineOptNode* n = slot->first; n != 0; n = n->next) + { + if(Str8Match(n->name, name, 0)) { - i++; + node = n; + break; } } + if(node != 0) + { + result = (node->value.size == 0 || Str8Match(node->value, Str8Lit("true"), MatchFlag_CaseInsensitive) || Str8Match(node->value, Str8Lit("1"), MatchFlag_CaseInsensitive)); + } } + return result; } + + double CommandLineOptDouble(CommandLine* cmdln, String8 name) + { + double result = 0; + { + String8 string = CommandLineOptString(cmdln, name); + result = DoubleFromStr8(string); + } + return result; + } + + int64_t CommandLineOptInt64(CommandLine* cmdln, String8 name) + { + int64_t result = 0; + { + String8 string = CommandLineOptString(cmdln, name); + result = CStyleIntFromStr8(string); + } + return result; + } + } diff --git a/Lumos/Source/Lumos/Core/CommandLine.h b/Lumos/Source/Lumos/Core/CommandLine.h index 914fe134..ddee33a2 100644 --- a/Lumos/Source/Lumos/Core/CommandLine.h +++ b/Lumos/Source/Lumos/Core/CommandLine.h @@ -1,117 +1,34 @@ #pragma once - -#include -#include -#include -#include - -#include "Utilities/TSingleton.h" +#include "Core/String.h" namespace Lumos { - // examples: - // --string="Foo Bar" - // --string "Foo Bar" - // --help - // --help=false - // --help true - - enum class ArgumentRequirement + struct CommandLineOptNode { - NONE = 0, - REQUIRE = 1, - OPT = 2 + CommandLineOptNode* next; + String8 name; + String8List values; + String8 value; }; -#if 0 - struct option_t + + struct CommandLineOptSlot { - const char* description; - const char* longOption; - char shortOption; - ArgumentRequirement needsArgument; - - explicit operator option() const - { - return { longOption, (int)needsArgument, "", shortOption}; - } + CommandLineOptNode* first; + CommandLineOptNode* last; }; - - class argument_t - { - public: - argument_t(); - argument_t(std::string longName, char shortName, std::string argValue); - explicit operator bool() const { return m_Enabled; } - - std::string AsString() const; - int AsInteger() const; - float AsFloat() const; - - private: - bool m_Enabled; - std::string m_LongName; - std::string m_ArgValue; - char m_ShortName; - void AsCheck() const; - }; -#endif - class CommandLine : public ThreadSafeSingleton - { - friend class TSingleton; - - public: - // These are the possible variables the options may point to. Bool and - // std::string are handled in a special way, all other values are parsed - // with a std::stringstream. This std::variant can be easily extended if - // the stream operator>> is overloaded. If not, you have to add a special - // case to the parse() method. - typedef std::variant - Value; - - // The description is printed as part of the help message. - - CommandLine(); - explicit CommandLine(std::string description); - // Adds a possible option. A typical call would be like this: - // bool printHelp = false; - // cmd.addArgument({"--help", "-h"}, &printHelp, "Print this help message"); - // Then, after parse() has been called, printHelp will be true if the user - // provided the flag. - void AddArgument(const std::vector& flags, - const Value& value, const std::string& help); - - // Prints the description given to the constructor and the help - // for each option. - void PrintHelp(std::ostream& os = std::cout) const; - void Parse(int argc, char** argv); - -#if 0 - const std::map& GetArguments(std::vector& possibleOptions); -#endif - - private: - struct Argument - { - std::vector m_Flags; - Value m_Value; - std::string m_Help; - }; - - std::string m_Description; - std::vector m_Arguments; - - int m_Argc; - char** m_Argv; - -#if 0 - std::map m_Arguments_t; -#endif + struct CommandLine + { + uint64_t slots_count; + CommandLineOptSlot* slots; + String8List inputs; }; + uint64_t CommandLineHashFromString(String8 string); + CommandLine CommandLineFromStringList(Arena* arena, String8List strings); + String8List CommandLineOptStrings(CommandLine* cmdln, String8 name); + String8 CommandLineOptString(CommandLine* cmdln, String8 name); + bool CommandLineOptBool(CommandLine* cmdln, String8 name); + double CommandLineOptDouble(CommandLine* cmdln, String8 name); + int64_t CommandLineOptInt64(CommandLine* cmdln, String8 name); } diff --git a/Lumos/Source/Lumos/Core/Core.h b/Lumos/Source/Lumos/Core/Core.h index ea24ae74..1328d657 100644 --- a/Lumos/Source/Lumos/Core/Core.h +++ b/Lumos/Source/Lumos/Core/Core.h @@ -1,5 +1,11 @@ #pragma once +#ifdef LUMOS_PLATFORM_WINDOWS +#ifndef NOMINMAX +#define NOMINMAX // For windows.h +#endif +#endif + #ifndef LUMOS_PLATFORM_WINDOWS #include #endif @@ -80,7 +86,7 @@ #define LUMOS_BREAK() raise(SIGTRAP) #endif -#ifdef LUMOS_DEBUG +#ifndef LUMOS_PRODUCTION #define LUMOS_ENABLE_ASSERTS #endif @@ -90,6 +96,7 @@ #ifndef LUMOS_ENABLE_ASSERTS #define LUMOS_ASSERT(...) ((void)0) #else +#if LUMOS_ENABLE_LOG #ifdef LUMOS_PLATFORM_UNIX #define LUMOS_ASSERT(condition, ...) \ do { \ @@ -111,6 +118,11 @@ } \ } while(0) #endif +#else +#define LUMOS_ASSERT(condition, ...) \ + if(!(condition)) \ + LUMOS_BREAK(); +#endif #endif #define UNIMPLEMENTED \ @@ -174,6 +186,25 @@ #define OffsetOf(type, member_name) IntFromPtr(&MemberOf(type, member_name)) #define BaseFromMember(type, member_name, ptr) (type*)((uint8_t*)(ptr)-OffsetOf(type, member_name)) +#define MemoryCopy memcpy +#define MemoryMove memmove +#define MemorySet memset + +#define MemoryCopyStruct(dst, src) \ + do { \ + Assert(sizeof(*(dst)) == sizeof(*(src))); \ + MemoryCopy((dst), (src), sizeof(*(dst))); \ + } while(0) +#define MemoryCopyArray(dst, src) \ + do { \ + Assert(sizeof(dst) == sizeof(src)); \ + MemoryCopy((dst), (src), sizeof(src)); \ + } while(0) + +#define MemoryZero(ptr, size) MemorySet((ptr), 0, (size)) +#define MemoryZeroStruct(ptr) MemoryZero((ptr), sizeof(*(ptr))) +#define MemoryZeroArray(arr) MemoryZero((arr), sizeof(arr)) + #define LUMOS_UNUSED(x) (void)(x) #define LUMOS_STRINGIFY(x) #x @@ -184,3 +215,18 @@ #else #define LUMOS_DEPRECATED(msg) #endif + +#define CheckNull(p) ((p) == 0) +#define SetIsNull(p) ((p) = 0) + +#define QueuePush_NZ(f, l, n, next, zchk, zset) (zchk(f) ? (((f) = (l) = (n)), zset((n)->next)) : ((l)->next = (n), (l) = (n), zset((n)->next))) +#define QueuePushFront_NZ(f, l, n, next, zchk, zset) (zchk(f) ? (((f) = (l) = (n)), zset((n)->next)) : ((n)->next = (f)), ((f) = (n))) +#define QueuePop_NZ(f, l, next, zset) ((f) == (l) ? (zset(f), zset(l)) : ((f) = (f)->next)) +#define StackPush_N(f, n, next) ((n)->next = (f), (f) = (n)) +#define StackPop_NZ(f, next, zchk) (zchk(f) ? 0 : ((f) = (f)->next)) + +#define QueuePush(f, l, n) QueuePush_NZ(f, l, n, next, CheckNull, SetIsNull) +#define QueuePushFront(f, l, n) QueuePushFront_NZ(f, l, n, next, CheckNull, SetIsNull) +#define QueuePop(f, l) QueuePop_NZ(f, l, next, SetIsNull) +#define StackPush(f, n) StackPush_N(f, n, next) +#define StackPop(f) StackPop_NZ(f, next, CheckNull) diff --git a/Lumos/Source/Lumos/Core/CoreSystem.cpp b/Lumos/Source/Lumos/Core/CoreSystem.cpp index 51f87777..9857ce9d 100644 --- a/Lumos/Source/Lumos/Core/CoreSystem.cpp +++ b/Lumos/Source/Lumos/Core/CoreSystem.cpp @@ -1,6 +1,6 @@ #include "Precompiled.h" #include "CoreSystem.h" -#include "VFS.h" +#include "OS/FileSystem.h" #include "JobSystem.h" #include "Scripting/Lua/LuaManager.h" #include "Core/Version.h" @@ -12,45 +12,37 @@ namespace Lumos { namespace Internal { + static Arena* s_Arena; + static CommandLine s_CommandLine; + bool CoreSystem::Init(int argc, char** argv) { Debug::Log::OnInit(); - LUMOS_LOG_INFO("Lumos Engine - Version {0}.{1}.{2}", LumosVersion.major, LumosVersion.minor, LumosVersion.patch); - - auto& args = CommandLine::Get(); + InitScratchArenas(); + s_Arena = ArenaAlloc(Megabytes(2)); - // This variables can be set via the command line. - std::string oString = "Default Value"; - int32_t oInteger = -1; - uint32_t oUnsigned = 0; - double oDouble = 0.0; - float oFloat = 0.f; - bool oBool = false; - bool oPrintHelp = false; - - // First configure all possible command line options. - args.AddArgument({ "-s", "--string" }, &oString, "A string value"); - args.AddArgument({ "-i", "--integer" }, &oInteger, "A integer value"); - args.AddArgument({ "-u", "--unsigned" }, &oUnsigned, "A unsigned value"); - args.AddArgument({ "-d", "--double" }, &oDouble, "A float value"); - args.AddArgument({ "-f", "--float" }, &oFloat, "A double value"); - args.AddArgument({ "-b", "--bool" }, &oBool, "A bool value"); - args.AddArgument({ "-h", "--help" }, &oPrintHelp, - "Print this help. This help message is actually so long " - "that it requires a line break!"); + LUMOS_LOG_INFO("Lumos Engine - Version {0}.{1}.{2}", LumosVersion.major, LumosVersion.minor, LumosVersion.patch); - args.Parse(argc, argv); + String8List args_list = {}; + for(uint64_t argument_idx = 1; argument_idx < argc; argument_idx += 1) + { + Str8ListPush(s_Arena, &args_list, Str8C(argv[argument_idx])); + } + s_CommandLine = CommandLineFromStringList(s_Arena, args_list); - if(oPrintHelp) + if(CommandLineOptBool(&s_CommandLine, Str8Lit("help"))) { - args.PrintHelp(); - return false; + LUMOS_LOG_INFO("Print this help. This help message is actually so long " + "that it requires a line break!"); } + LUMOS_LOG_INFO(CommandLineOptDouble(&s_CommandLine, Str8Lit("TestDouble"))); + LUMOS_LOG_INFO(CommandLineOptInt64(&s_CommandLine, Str8Lit("TestInt"))); + System::JobSystem::OnInit(); LUMOS_LOG_INFO("Initialising System"); - VFS::Get(); + FileSystem::Get(); return true; } @@ -58,13 +50,21 @@ namespace Lumos void CoreSystem::Shutdown() { LUMOS_LOG_INFO("Shutting down System"); - VFS::Release(); + FileSystem::Release(); Lumos::Memory::LogMemoryInformation(); Debug::Log::OnRelease(); System::JobSystem::Release(); + ArenaClear(s_Arena); + ReleaseScratchArenas(); + MemoryManager::OnShutdown(); } + + CommandLine* CoreSystem::GetCmdLine() + { + return &s_CommandLine; + } } } diff --git a/Lumos/Source/Lumos/Core/CoreSystem.h b/Lumos/Source/Lumos/Core/CoreSystem.h index 1c493790..2231a157 100644 --- a/Lumos/Source/Lumos/Core/CoreSystem.h +++ b/Lumos/Source/Lumos/Core/CoreSystem.h @@ -4,14 +4,18 @@ namespace Lumos { + + struct CommandLine; + namespace Internal { // Low-level System operations - class LUMOS_EXPORT CoreSystem + namespace CoreSystem { - public: - static bool Init(int argc = 0, char** argv = nullptr); - static void Shutdown(); + bool Init(int argc = 0, char** argv = nullptr); + void Shutdown(); + + CommandLine* GetCmdLine(); }; } diff --git a/Lumos/Source/Lumos/Core/DataStructures/Vector.h b/Lumos/Source/Lumos/Core/DataStructures/Vector.h index edb12332..b27be2ee 100644 --- a/Lumos/Source/Lumos/Core/DataStructures/Vector.h +++ b/Lumos/Source/Lumos/Core/DataStructures/Vector.h @@ -1,4 +1,5 @@ #pragma once +#include "Core/OS/Memory.h" namespace Lumos { @@ -6,13 +7,21 @@ namespace Lumos class Vector { public: - Vector() = default; - Vector(const Vector& another_vector); // copy constructor - Vector(size_t size, T initial = T {}); // constructor based on capacity and a default value - Vector(std::initializer_list values); + Vector(Arena* arena = nullptr) + : m_Arena(arena) + { + } + + Vector(const Vector& another_vector); // copy constructor + Vector(size_t size, Arena* arena = nullptr, T initial = T {}); // constructor based on capacity and a default value + Vector(std::initializer_list values, Arena* arena = nullptr); Vector(Vector&& other) noexcept; - ~Vector() { delete[] m_Data; } + ~Vector() + { + if(!m_Arena) + delete[] m_Data; + } Vector& operator=(const Vector&); // copy assignment @@ -30,6 +39,8 @@ namespace Lumos void Pop(); void Clear(bool deleteData = false); + bool Empty() const { return m_CurrentIndex == 0; } + bool operator==(const Vector& other) const; bool operator!=(const Vector& other) const; @@ -57,6 +68,7 @@ namespace Lumos Iterator end() const { return Iterator(m_Data + m_CurrentIndex); } T& operator[](const size_t index); + const T& operator[](const size_t index) const; T* Data() { return m_Data; } void Reserve(const size_t size); @@ -65,18 +77,24 @@ namespace Lumos T* m_Data = nullptr; size_t m_Size = 0; size_t m_CurrentIndex = 0; + Arena* m_Arena = nullptr; }; template Vector::Vector(const Vector& other) { - delete[] m_Data; // Delete before copying everything from another vector + if(!m_Arena) + delete[] m_Data; // Delete before copying everything from another vector // Copy everything from another vector m_CurrentIndex = other.Size(); m_Size = other.Capacity(); - m_Data = new T[m_Size]; - for(size_t i = 0; i < m_Size; ++i) + if(m_Arena) + m_Data = PushArrayNoZero(m_Arena, T, m_Size); + else + m_Data = new T[m_Size]; + + for(size_t i = 0; i < m_CurrentIndex; ++i) m_Data[i] = other[i]; } @@ -89,25 +107,37 @@ namespace Lumos } template - Vector::Vector(std::initializer_list values) + Vector::Vector(std::initializer_list values, Arena* arena) + : m_Arena(arena) { - delete[] m_Data; // Delete before copying everything from another vector + if(!m_Arena) + delete[] m_Data; // Delete before copying everything from another vector // Copy everything from another vector m_CurrentIndex = values.size(); m_Size = values.size(); - m_Data = new T[m_Size]; - size_t index = 0; + + if(arena) + m_Data = PushArrayNoZero(m_Arena, T, m_Size); + else + m_Data = new T[m_Size]; + + size_t index = 0; for(auto& value : values) m_Data[index++] = value; } template - Vector::Vector(size_t size, T initial) + Vector::Vector(size_t size, Arena* arena, T initial) : m_Size(size) , m_CurrentIndex(size) - , m_Data { new T[size] {} } // allocate stack and store its pointer + , m_Arena(arena) { + if(m_Arena) + m_Data = PushArrayNoZero(m_Arena, T, m_Size); + else + m_Data = new T[size]; + for(size_t i = 0; i < size; ++i) m_Data[i] = initial; // initialize } @@ -116,12 +146,18 @@ namespace Lumos template Vector& Vector::operator=(const Vector& other) { - delete[] m_Data; // Delete before copying everything from another vector + if(!m_Arena) + delete[] m_Data; // Delete before copying everything from another vector // Copy everything from another vector m_CurrentIndex = other.Size(); m_Size = other.Capacity(); - m_Data = new T[m_Size]; + + if(m_Arena) + m_Data = PushArrayNoZero(m_Arena, T, m_Size); + else + m_Data = new T[m_Size]; + for(size_t i = 0; i < m_Size; ++i) m_Data[i] = other[i]; @@ -131,9 +167,15 @@ namespace Lumos template T& Vector::operator[](const size_t index) { - if(index >= m_CurrentIndex) - throw std::invalid_argument("Index must be less than vector's size"); + LUMOS_ASSERT(index < m_CurrentIndex, "Index must be less than vector's size"); + + return m_Data[index]; + } + template + const T& Vector::operator[](const size_t index) const + { + LUMOS_ASSERT(index < m_CurrentIndex, "Index must be less than vector's size"); return m_Data[index]; } @@ -228,7 +270,7 @@ namespace Lumos m_CurrentIndex--; } else - throw std::out_of_range("Nothing to pop"); + LUMOS_ASSERT(false, "Nothing to pop"); } template @@ -236,15 +278,13 @@ namespace Lumos { if(deleteData) { - delete[] m_Data; + if(!m_Arena) + delete[] m_Data; m_CurrentIndex = 0; m_Size = 0; } else { - for(auto& element : m_Data) - element = {}; - m_CurrentIndex = 0; } } @@ -256,13 +296,19 @@ namespace Lumos if(capacity > m_CurrentIndex) { // Reserves memory of size capacity for the vector_ - T* temp = new T[capacity]; + T* temp; + if(m_Arena) + temp = PushArrayNoZero(m_Arena, T, capacity); + else + temp = new T[capacity]; // Move previous elements to this memory for(size_t i = 0; i < m_Size; ++i) temp[i] = std::move(m_Data[i]); - delete[] m_Data; // Delete old vector + if(!m_Arena) + delete[] m_Data; // Delete old vector + m_Size = capacity; m_Data = temp; // Copy assignment } diff --git a/Lumos/Source/Lumos/Core/EntryPoint.h b/Lumos/Source/Lumos/Core/EntryPoint.h index bf40174b..d16afa9a 100644 --- a/Lumos/Source/Lumos/Core/EntryPoint.h +++ b/Lumos/Source/Lumos/Core/EntryPoint.h @@ -17,12 +17,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine { #ifndef LUMOS_PRODUCTION AllocConsole(); + AttachConsole(GetCurrentProcessId()); freopen("CONIN$", "r", stdin); freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stderr); #endif - if(!Lumos::Internal::CoreSystem::Init(0, nullptr)) + if(!Lumos::Internal::CoreSystem::Init(__argc, __argv)) return 0; auto windowsOS = new Lumos::WindowsOS(); diff --git a/Lumos/Source/Lumos/Core/LMLog.cpp b/Lumos/Source/Lumos/Core/LMLog.cpp index 576f891c..068fbf8e 100644 --- a/Lumos/Source/Lumos/Core/LMLog.cpp +++ b/Lumos/Source/Lumos/Core/LMLog.cpp @@ -6,11 +6,14 @@ namespace Lumos::Debug { +#if LUMOS_ENABLE_LOG std::shared_ptr Log::s_CoreLogger; std::vector sinks; +#endif void Log::OnInit() { +#if LUMOS_ENABLE_LOG sinks.emplace_back(std::make_shared()); // debug // sinks.emplace_back(std::make_shared()); // ImGuiConsole @@ -26,17 +29,22 @@ namespace Lumos::Debug // configure the loggers spdlog::set_pattern("%^[%T] %v%$"); s_CoreLogger->set_level(spdlog::level::trace); +#endif } +#if LUMOS_ENABLE_LOG void Log::AddSink(spdlog::sink_ptr& sink) { s_CoreLogger->sinks().push_back(sink); s_CoreLogger->set_pattern("%v%$"); } +#endif void Log::OnRelease() { +#if LUMOS_ENABLE_LOG s_CoreLogger.reset(); spdlog::shutdown(); +#endif } } diff --git a/Lumos/Source/Lumos/Core/LMLog.h b/Lumos/Source/Lumos/Core/LMLog.h index b309bcb9..6219d10c 100644 --- a/Lumos/Source/Lumos/Core/LMLog.h +++ b/Lumos/Source/Lumos/Core/LMLog.h @@ -1,6 +1,9 @@ #pragma once #include "Core.h" +#define LUMOS_ENABLE_LOG 1 + +#if LUMOS_ENABLE_LOG #ifdef LUMOS_PLATFORM_WINDOWS #ifndef NOMINMAX #define NOMINMAX // For windows.h @@ -17,6 +20,23 @@ #define LUMOS_LOG_ERROR(...) SPDLOG_LOGGER_CALL(::Lumos::Debug::Log::GetCoreLogger(), spdlog::level::level_enum::err, __VA_ARGS__) #define LUMOS_LOG_CRITICAL(...) SPDLOG_LOGGER_CALL(::Lumos::Debug::Log::GetCoreLogger(), spdlog::level::level_enum::critical, __VA_ARGS__) +#else +namespace spdlog +{ + namespace sinks + { + class sink; + } + class logger; +} +#define LUMOS_LOG_TRACE(...) ((void)0) +#define LUMOS_LOG_INFO(...) ((void)0) +#define LUMOS_LOG_WARN(...) ((void)0) +#define LUMOS_LOG_ERROR(...) ((void)0) +#define LUMOS_LOG_CRITICAL(...) ((void)0) + +#endif + namespace Lumos { namespace Debug @@ -27,12 +47,15 @@ namespace Lumos static void OnInit(); static void OnRelease(); +#if LUMOS_ENABLE_LOG inline static std::shared_ptr& GetCoreLogger() { return s_CoreLogger; } - - static void AddSink(spdlog::sink_ptr& sink); + static void AddSink(std::shared_ptr& sink); +#endif private: +#if LUMOS_ENABLE_LOG static std::shared_ptr s_CoreLogger; +#endif }; } } diff --git a/Lumos/Source/Lumos/Core/OS/Allocators/PoolAllocator.h b/Lumos/Source/Lumos/Core/OS/Allocators/PoolAllocator.h index 13e66817..5f5f4473 100644 --- a/Lumos/Source/Lumos/Core/OS/Allocators/PoolAllocator.h +++ b/Lumos/Source/Lumos/Core/OS/Allocators/PoolAllocator.h @@ -3,95 +3,95 @@ namespace Lumos { -// Pool Allocator -template -class PoolAllocator -{ + // Pool Allocator + template + class PoolAllocator + { public: - explicit PoolAllocator(Arena* arena = nullptr, size_t poolSize = Megabytes(50)) - : m_Arena(arena) - , m_PoolSize(poolSize) - , m_NextAvailable(nullptr) - { - if(!arena) - { - m_ArenaOwned = true; - m_Arena = ArenaAlloc(Megabytes(51)); - } - - assert(m_Arena); - assert(m_PoolSize >= sizeof(Node)); - - m_AlignSize = (sizeof(T) + alignof(T) - 1) & ~(alignof(T) - 1); - - // Calculate the number of elements that fit in a pool - m_ElementsPerPool = (m_PoolSize - sizeof(Node)) / m_AlignSize; - - AllocateNewPool(); - } - - ~PoolAllocator() - { - while(m_HeadPool) - { - Node* nextPool = m_HeadPool->next; - m_Arena->Position = reinterpret_cast(m_HeadPool); - m_HeadPool = nextPool; - } - - if(m_ArenaOwned) - ArenaRelease(m_Arena); - } - - T* Allocate() - { - if(!m_NextAvailable) - { - AllocateNewPool(); - } - - Node* node = m_NextAvailable; - m_NextAvailable = m_NextAvailable->next; - - return reinterpret_cast(node); - } - - void Deallocate(T* ptr) - { - Node* node = reinterpret_cast(ptr); - node->next = m_NextAvailable; - m_NextAvailable = node; - } - + explicit PoolAllocator(Arena* arena = nullptr, size_t poolSize = Megabytes(50)) + : m_Arena(arena) + , m_PoolSize(poolSize) + , m_NextAvailable(nullptr) + { + m_AlignSize = (sizeof(T) + alignof(T) - 1) & ~(alignof(T) - 1); + + if(!arena) + { + m_ArenaOwned = true; + m_Arena = ArenaAlloc(poolSize * 2); + } + + LUMOS_ASSERT(m_Arena, "Arena not allocated"); + LUMOS_ASSERT(m_PoolSize >= sizeof(Node), "Pool size too small for type"); + + // Calculate the number of elements that fit in a pool + m_ElementsPerPool = (m_PoolSize - sizeof(Node)) / m_AlignSize; + + AllocateNewPool(); + } + + ~PoolAllocator() + { + while(m_HeadPool) + { + Node* nextPool = m_HeadPool->next; + m_Arena->Position = reinterpret_cast(m_HeadPool); + m_HeadPool = nextPool; + } + + if(m_ArenaOwned) + ArenaRelease(m_Arena); + } + + T* Allocate() + { + if(!m_NextAvailable) + { + AllocateNewPool(); + } + + Node* node = m_NextAvailable; + m_NextAvailable = m_NextAvailable->next; + + return reinterpret_cast(node); + } + + void Deallocate(T* ptr) + { + Node* node = reinterpret_cast(ptr); + node->next = m_NextAvailable; + m_NextAvailable = node; + } + private: - struct Node - { - Node* next; - }; - - Arena* m_Arena; - size_t m_PoolSize; - size_t m_AlignSize; - size_t m_ElementsPerPool; - Node* m_HeadPool; - Node* m_NextAvailable; - bool m_ArenaOwned = false; - - void AllocateNewPool() - { - void* poolMemory = ArenaPush(m_Arena, m_PoolSize); - Node* pool = reinterpret_cast(poolMemory); - m_HeadPool = pool; - - // Create the linked list of available nodes in the pool - for(size_t i = 0; i < m_ElementsPerPool - 1; ++i) - { - pool->next = reinterpret_cast(reinterpret_cast(pool) + m_AlignSize); - pool = pool->next; - } - - pool->next = nullptr; - m_NextAvailable = m_HeadPool; - } -}; + struct Node + { + Node* next; + }; + + Arena* m_Arena; + size_t m_PoolSize; + size_t m_AlignSize; + size_t m_ElementsPerPool; + Node* m_HeadPool; + Node* m_NextAvailable; + bool m_ArenaOwned = false; + + void AllocateNewPool() + { + void* poolMemory = ArenaPush(m_Arena, m_PoolSize); + Node* pool = reinterpret_cast(poolMemory); + m_HeadPool = pool; + + // Create the linked list of available nodes in the pool + for(size_t i = 0; i < m_ElementsPerPool - 1; ++i) + { + pool->next = reinterpret_cast(reinterpret_cast(pool) + m_AlignSize); + pool = pool->next; + } + + pool->next = nullptr; + m_NextAvailable = m_HeadPool; + } + }; } diff --git a/Lumos/Source/Lumos/Core/OS/FileSystem.cpp b/Lumos/Source/Lumos/Core/OS/FileSystem.cpp index f07982cd..56fdd141 100644 --- a/Lumos/Source/Lumos/Core/OS/FileSystem.cpp +++ b/Lumos/Source/Lumos/Core/OS/FileSystem.cpp @@ -3,5 +3,136 @@ namespace Lumos { + bool FileSystem::IsRelativePath(const char* path) + { + if(!path || path[0] == '/' || path[0] == '\\') + { + return false; + } + if(strlen(path) >= 2 && isalpha(path[0]) && path[1] == ':') + { + return false; + } + + return true; + } + + bool FileSystem::IsAbsolutePath(const char* path) + { + if(!path) + { + return false; + } + + return !IsRelativePath(path); + } + + const char* FileSystem::GetFileOpenModeString(FileOpenFlags flag) + { + if(flag == FileOpenFlags::READ) + { + return "rb"; + } + else if(flag == FileOpenFlags::WRITE) + { + return "wb"; + } + else if(flag == FileOpenFlags::READ_WRITE) + { + return "rb+"; + } + else if(flag == FileOpenFlags::WRITE_READ) + { + return "wb+"; + } + else + { + LUMOS_LOG_WARN("Invalid open flag"); + return "rb"; + } + } + + bool FileSystem::ResolvePhysicalPath(const std::string& path, std::string& outPhysicalPath, bool folder) + { + LUMOS_PROFILE_FUNCTION(); + const std::string& updatedPath = path; + + if(!(path[0] == '/' && path[1] == '/')) + { + outPhysicalPath = path; + return folder ? FileSystem ::FolderExists(outPhysicalPath) : FileSystem::FileExists(outPhysicalPath); + } + + // Assume path starts with //Assets +#ifndef LUMOS_PRODUCTION + if(path.substr(2, 6) != "Assets") + { + // Previously paths saved in scenes could be like //Textures and then converted to .../Assets/Textures/... + outPhysicalPath = ToStdString(m_AssetRootPath) + path.substr(1, path.size()); + return folder ? FileSystem::FolderExists(outPhysicalPath) : FileSystem::FileExists(outPhysicalPath); + } + else +#endif + { + outPhysicalPath = ToStdString(m_AssetRootPath) + path.substr(8, path.size()); + return folder ? FileSystem::FolderExists(outPhysicalPath) : FileSystem::FileExists(outPhysicalPath); + } + + return false; + } + + uint8_t* FileSystem::ReadFileVFS(const std::string& path) + { + LUMOS_PROFILE_FUNCTION(); + std::string physicalPath; + return Get().ResolvePhysicalPath(path, physicalPath) ? FileSystem::ReadFile(physicalPath) : nullptr; + } + + std::string FileSystem::ReadTextFileVFS(const std::string& path) + { + LUMOS_PROFILE_FUNCTION(); + std::string physicalPath; + return Get().ResolvePhysicalPath(path, physicalPath) ? FileSystem::ReadTextFile(physicalPath) : ""; + } + + bool FileSystem::WriteFileVFS(const std::string& path, uint8_t* buffer, uint32_t size) + { + LUMOS_PROFILE_FUNCTION(); + std::string physicalPath; + return Get().ResolvePhysicalPath(path, physicalPath) ? FileSystem::WriteFile(physicalPath, buffer, size) : false; + } + + bool FileSystem::WriteTextFileVFS(const std::string& path, const std::string& text) + { + LUMOS_PROFILE_FUNCTION(); + std::string physicalPath; + return Get().ResolvePhysicalPath(path, physicalPath) ? FileSystem::WriteTextFile(physicalPath, text) : false; + } + + bool FileSystem::AbsolutePathToFileSystem(const std::string& path, std::string& outFileSystemPath, bool folder) + { + LUMOS_PROFILE_FUNCTION(); + std::string updatedPath = path; + std::replace(updatedPath.begin(), updatedPath.end(), '\\', '/'); + + if(updatedPath.find(ToStdString(m_AssetRootPath)) != std::string::npos) + { + std::string newPath = updatedPath; + std::string newPartPath = "//Assets"; + newPath.replace(0, m_AssetRootPath.size, newPartPath); + outFileSystemPath = newPath; + return true; + } + + outFileSystemPath = updatedPath; + return false; + } + + std::string FileSystem::AbsolutePathToFileSystem(const std::string& path, bool folder) + { + std::string outPath; + AbsolutePathToFileSystem(path, outPath, folder); + return outPath; + } } diff --git a/Lumos/Source/Lumos/Core/OS/FileSystem.h b/Lumos/Source/Lumos/Core/OS/FileSystem.h index 7f4a30ae..83b9f68a 100644 --- a/Lumos/Source/Lumos/Core/OS/FileSystem.h +++ b/Lumos/Source/Lumos/Core/OS/FileSystem.h @@ -1,4 +1,8 @@ #pragma once +#include "Core/DataStructures/Vector.h" +#include "Utilities/TSingleton.h" +#include +#include "Core/String.h" namespace Lumos { @@ -10,9 +14,28 @@ namespace Lumos WRITE_READ }; - class FileSystem + class FileSystem : public ThreadSafeSingleton { + friend class ThreadSafeSingleton; + + public: + bool ResolvePhysicalPath(const std::string& path, std::string& outPhysicalPath, bool folder = false); + bool AbsolutePathToFileSystem(const std::string& path, std::string& outFileSystemPath, bool folder = false); + std::string AbsolutePathToFileSystem(const std::string& path, bool folder = false); + + uint8_t* ReadFileVFS(const std::string& path); + std::string ReadTextFileVFS(const std::string& path); + + bool WriteFileVFS(const std::string& path, uint8_t* buffer, uint32_t size); + bool WriteTextFileVFS(const std::string& path, const std::string& text); + + void SetAssetRoot(String8 root) { m_AssetRootPath = root; }; + + private: + String8 m_AssetRootPath; + public: + // Static Helpers. Implemented in OS specific Files static bool FileExists(const std::string& path); static bool FolderExists(const std::string& path); static int64_t GetFileSize(const std::string& path); @@ -26,55 +49,9 @@ namespace Lumos static std::string GetWorkingDirectory(); - static bool IsRelativePath(const char* path) - { - if(!path || path[0] == '/' || path[0] == '\\') - { - return false; - } - - if(strlen(path) >= 2 && isalpha(path[0]) && path[1] == ':') - { - return false; - } - - return true; - } - - static bool IsAbsolutePath(const char* path) - { - if(!path) - { - return false; - } - - return !IsRelativePath(path); - } - - static const char* GetFileOpenModeString(FileOpenFlags flag) - { - if(flag == FileOpenFlags::READ) - { - return "rb"; - } - else if(flag == FileOpenFlags::WRITE) - { - return "wb"; - } - else if(flag == FileOpenFlags::READ_WRITE) - { - return "rb+"; - } - else if(flag == FileOpenFlags::WRITE_READ) - { - return "wb+"; - } - else - { - LUMOS_LOG_WARN("Invalid open flag"); - return "rb"; - } - } + static bool IsRelativePath(const char* path); + static bool IsAbsolutePath(const char* path); + static const char* GetFileOpenModeString(FileOpenFlags flag); }; } diff --git a/Lumos/Source/Lumos/Core/OS/Memory.cpp b/Lumos/Source/Lumos/Core/OS/Memory.cpp index 69f51b14..cea04f2e 100644 --- a/Lumos/Source/Lumos/Core/OS/Memory.cpp +++ b/Lumos/Source/Lumos/Core/OS/Memory.cpp @@ -6,7 +6,30 @@ namespace Lumos { - Allocator* const Memory::MemoryAllocator = new DefaultAllocator(); +#ifndef LUMOS_PRODUCTION + static Arena* s_Arenas[256]; // For Stats + static int s_CurrentArenaCount = 0; +#endif + + int GetArenaCount() + { +#ifndef LUMOS_PRODUCTION + return s_CurrentArenaCount; +#else + return 0; +#endif + } + + Arena* GetArena(int index) + { +#ifndef LUMOS_PRODUCTION + return s_Arenas[index]; +#else + return nullptr; +#endif + } + + Allocator* const Memory::MemoryAllocator = nullptr; // new DefaultAllocator(); void* Memory::AlignedAlloc(size_t size, size_t alignment) { @@ -32,14 +55,30 @@ namespace Lumos void* Memory::NewFunc(std::size_t size, const char* file, int line) { + void* memory; if(MemoryAllocator) - return MemoryAllocator->Malloc(size, file, line); + memory = MemoryAllocator->Malloc(size, file, line); else - return malloc(size); + memory = malloc(size); + + if(memory == nullptr) + { + throw std::bad_alloc(); + } + +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY + TracyAlloc(memory, size); +#endif + + return memory; } void Memory::DeleteFunc(void* p) { +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY + TracyFree(p); +#endif + if(MemoryAllocator) return MemoryAllocator->Free(p); else @@ -61,6 +100,15 @@ namespace Lumos arena->Align = alignof(std::max_align_t); arena->Size = size; arena->Ptr = arena; + +#ifndef LUMOS_PRODUCTION + if(s_CurrentArenaCount < 256) + s_Arenas[s_CurrentArenaCount++] = arena; +#endif +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY + TracyAlloc(arena, size); +#endif + return arena; } @@ -73,19 +121,27 @@ namespace Lumos { if(arena) { +#ifndef LUMOS_PRODUCTION + s_CurrentArenaCount--; +#endif free(arena); + +#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY + TracyFree(arena); +#endif } } void* ArenaPushNoZero(Arena* arena, uint64_t size) { - assert(arena != nullptr); + LUMOS_ASSERT(arena != nullptr); uint64_t alignedSize = (size + arena->Align - 1) & ~(arena->Align - 1); uint64_t newPos = arena->Position + alignedSize; if(newPos > arena->Size) { - return nullptr; // Not enough space in the arena + LUMOS_LOG_ERROR("Not enough space in the arena"); + return nullptr; } void* ptr = reinterpret_cast(reinterpret_cast(arena->Ptr) + arena->Position); @@ -95,8 +151,8 @@ namespace Lumos void* ArenaPushAligner(Arena* arena, uint64_t alignment) { - assert(arena != nullptr); - assert((alignment & (alignment - 1)) == 0); // Ensure alignment is a power of 2 + LUMOS_ASSERT(arena != nullptr); + LUMOS_ASSERT((alignment & (alignment - 1)) == 0); // Ensure alignment is a power of 2 uint64_t currentAddr = reinterpret_cast(arena->Ptr) + arena->Position; uint64_t alignedAddr = (currentAddr + alignment - 1) & ~(alignment - 1); @@ -125,90 +181,224 @@ namespace Lumos void ArenaPopTo(Arena* arena, uint64_t pos) { - assert(arena != nullptr); - assert(pos <= arena->Position); + LUMOS_ASSERT(arena != nullptr); + LUMOS_ASSERT(pos <= arena->Position); arena->Position = pos; } void ArenaSetAutoAlign(Arena* arena, uint64_t align) { - assert(arena != nullptr); + LUMOS_ASSERT(arena != nullptr); arena->Align = align; } void ArenaPop(Arena* arena, uint64_t size) { - assert(arena != nullptr); - assert(size <= arena->Position); + LUMOS_ASSERT(arena != nullptr); + LUMOS_ASSERT(size <= arena->Position); arena->Position -= size; } void ArenaClear(Arena* arena) { - assert(arena != nullptr); + LUMOS_ASSERT(arena != nullptr); arena->Position = sizeof(Arena); } uint64_t ArenaPos(Arena* arena) { - assert(arena != nullptr); + LUMOS_ASSERT(arena != nullptr); return arena->Position; } ArenaTemp ArenaTempBegin(Arena* arena) { - assert(arena != nullptr); + LUMOS_ASSERT(arena != nullptr); return { arena, arena->Position }; } void ArenaTempEnd(ArenaTemp temp) { - assert(temp.arena != nullptr); + LUMOS_ASSERT(temp.arena != nullptr); ArenaPopTo(temp.arena, temp.pos); } -} -#ifdef CUSTOM_MEMORY_ALLOCATOR + static Arena* s_ScratchArenas[2]; + void InitScratchArenas() + { + s_ScratchArenas[0] = ArenaAlloc(Megabytes(8)); + s_ScratchArenas[1] = ArenaAlloc(Megabytes(8)); + } -void* operator new(std::size_t size) -{ - void* result = Lumos::Memory::NewFunc(size, __FILE__, __LINE__); - if(result == nullptr) + void ReleaseScratchArenas() { - throw std::bad_alloc(); + ArenaRelease(s_ScratchArenas[0]); + ArenaRelease(s_ScratchArenas[1]); } -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY - TracyAlloc(result, size); -#endif - return result; -} -void* operator new[](std::size_t size) -{ - void* result = Lumos::Memory::NewFunc(size, __FILE__, __LINE__); - if(result == nullptr) + void ClearScratchArenas() { - throw std::bad_alloc(); + ArenaClear(s_ScratchArenas[0]); + ArenaClear(s_ScratchArenas[1]); + } + + ArenaTemp ScratchBegin(Arena** conflicts, uint64_t conflict_count) + { + ArenaTemp scratch = { 0 }; + for(uint32_t tctx_idx = 0; tctx_idx < 2; tctx_idx += 1) + { + bool is_conflicting = false; + for(Arena** conflict = conflicts; conflict < conflicts + conflict_count; conflict += 1) + { + if(*conflict == s_ScratchArenas[tctx_idx]) + { + is_conflicting = 1; + break; + } + } + if(is_conflicting == 0) + { + scratch.arena = s_ScratchArenas[tctx_idx]; + scratch.pos = scratch.arena->Position; + break; + } + } + return scratch; } -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY - TracyAlloc(result, size); -#endif - return result; } +#if defined(CUSTOM_MEMORY_ALLOCATOR) +#ifdef LUMOS_PLATFORM_WINDOWS -void operator delete(void* p) throw() +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new(size_t size) { -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY - TracyFree(p); -#endif - Lumos::Memory::DeleteFunc(p); + return Lumos::Memory::NewFunc(size, __FILE__, __LINE__); } -void operator delete[](void* p) throw() +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new[](size_t size) { -#if defined(LUMOS_PROFILE) && defined(TRACY_ENABLE) && LUMOS_TRACK_MEMORY - TracyFree(p); -#endif - Lumos::Memory::DeleteFunc(p); + return Lumos::Memory::NewFunc(size, __FILE__, __LINE__); +} + +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new(size_t size, const char* desc) +{ + return Lumos::Memory::NewFunc(size, desc, __LINE__); +} + +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new[](size_t size, const char* desc) +{ + return Lumos::Memory::NewFunc(size, desc, __LINE__); +} + +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new(size_t size, const char* file, int line) +{ + return Lumos::Memory::NewFunc(size, file, line); +} + +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new[](size_t size, const char* file, int line) +{ + return Lumos::Memory::NewFunc(size, file, line); +} + +void __CRTDECL operator delete(void* memory) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void __CRTDECL operator delete(void* memory, const char* desc) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void __CRTDECL operator delete(void* memory, const char* file, int line) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void __CRTDECL operator delete[](void* memory) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void __CRTDECL operator delete[](void* memory, const char* desc) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void __CRTDECL operator delete[](void* memory, const char* file, int line) +{ + Lumos::Memory::DeleteFunc(memory); +} +#else +void* operator new(size_t size) +{ + return Lumos::Memory::NewFunc(size, __FILE__, __LINE__); +} + +void* operator new[](size_t size) +{ + return Lumos::Memory::NewFunc(size, __FILE__, __LINE__); +} + +void* operator new(size_t size, const char* desc) +{ + return Lumos::Memory::NewFunc(size, desc, __LINE__); +} + +void* operator new[](size_t size, const char* desc) +{ + return Lumos::Memory::NewFunc(size, desc, __LINE__); +} + +void* operator new(size_t size, const char* file, int line) +{ + return Lumos::Memory::NewFunc(size, file, line); +} + +void* operator new[](size_t size, const char* file, int line) +{ + return Lumos::Memory::NewFunc(size, file, line); +} + +void operator delete(void* memory) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void operator delete(void* memory, const char* desc) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void operator delete(void* memory, const char* file, int line) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void operator delete[](void* memory) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void operator delete[](void* memory, const char* desc) +{ + Lumos::Memory::DeleteFunc(memory); +} + +void operator delete[](void* memory, const char* file, int line) +{ + Lumos::Memory::DeleteFunc(memory); } #endif +#endif \ No newline at end of file diff --git a/Lumos/Source/Lumos/Core/OS/Memory.h b/Lumos/Source/Lumos/Core/OS/Memory.h index b4459301..4482ab20 100644 --- a/Lumos/Source/Lumos/Core/OS/Memory.h +++ b/Lumos/Source/Lumos/Core/OS/Memory.h @@ -38,6 +38,9 @@ namespace Lumos uint64_t pos; }; + int GetArenaCount(); + Arena* GetArena(int index); + Arena* ArenaAlloc(uint64_t size); Arena* ArenaAllocDefault(); void ArenaRelease(Arena* arena); @@ -52,23 +55,69 @@ namespace Lumos ArenaTemp ArenaTempBegin(Arena* arena); void ArenaTempEnd(ArenaTemp temp); +#define PushArrayNoZero(arena, type, count) (type*)ArenaPushNoZero((arena), sizeof(type) * (count)) +#define PushArray(arena, type, count) (type*)ArenaPush((arena), sizeof(type) * (count)) + #define ArenaTempBlock(arena, name) \ ArenaTemp name = { 0 }; \ DeferLoop(name = ArenaTempBegin(arena), ArenaTempEnd(name)) + + ArenaTemp ScratchBegin(Arena** conflicts, uint64_t conflict_count); +#define ScratchEnd(temp) ArenaTempEnd(temp) + + void InitScratchArenas(); + void ReleaseScratchArenas(); + void ClearScratchArenas(); } #define CUSTOM_MEMORY_ALLOCATOR #if defined(CUSTOM_MEMORY_ALLOCATOR) && defined(LUMOS_ENGINE) -void* operator new(std::size_t size); -// void* operator new(std::size_t size, const char *file, int line); -// void* operator new[](std::size_t size, const char *file, int line); -// void* operator new (std::size_t size, const std::nothrow_t& nothrow_value) noexcept; -void* operator new[](std::size_t size); +#ifdef LUMOS_PLATFORM_WINDOWS +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new(size_t size); + +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new[](size_t size); + +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new(size_t size, const char* desc); -void operator delete(void* p) throw(); -void operator delete[](void* p) throw(); -// void operator delete(void* block, const char* file, int line); -// void operator delete[](void* block, const char* file, int line); +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new[](size_t size, const char* desc); + +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new(size_t size, const char* file, int line); + +_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(size) +_VCRT_ALLOCATOR +void* __CRTDECL operator new[](size_t size, const char* file, int line); + +void __CRTDECL operator delete(void* memory); +void __CRTDECL operator delete(void* memory, const char* desc); +void __CRTDECL operator delete(void* memory, const char* file, int line); +void __CRTDECL operator delete[](void* memory); +void __CRTDECL operator delete[](void* memory, const char* desc); +void __CRTDECL operator delete[](void* memory, const char* file, int line); +#else +void* operator new(size_t size); +void* operator new[](size_t size); +void* operator new(size_t size, const char* desc); +void* operator new[](size_t size, const char* desc); +void* operator new(size_t size, const char* file, int line); +void* operator new[](size_t size, const char* file, int line); + +void operator delete(void* memory); +void operator delete(void* memory, const char* desc); +void operator delete(void* memory, const char* file, int line); +void operator delete[](void* memory); +void operator delete[](void* memory, const char* desc); +void operator delete[](void* memory, const char* file, int line); +#endif #endif diff --git a/Lumos/Source/Lumos/Core/String.cpp b/Lumos/Source/Lumos/Core/String.cpp new file mode 100644 index 00000000..5094c8fc --- /dev/null +++ b/Lumos/Source/Lumos/Core/String.cpp @@ -0,0 +1,794 @@ +#include "Precompiled.h" +#include "String.h" +#include + +namespace Lumos +{ + bool CharIsAlpha(uint8_t c) + { + return CharIsAlphaUpper(c) || CharIsAlphaLower(c); + } + + bool CharIsAlphaUpper(uint8_t c) + { + return c >= 'A' && c <= 'Z'; + } + + bool CharIsAlphaLower(uint8_t c) + { + return c >= 'a' && c <= 'z'; + } + + bool CharIsDigit(uint8_t c) + { + return (c >= '0' && c <= '9'); + } + + bool CharIsSymbol(uint8_t c) + { + return (c == '~' || c == '!' || c == '$' || c == '%' || c == '^' || c == '&' || c == '*' || c == '-' || c == '=' || c == '+' || c == '<' || c == '.' || c == '>' || c == '/' || c == '?' || c == '|' || c == '\\' || c == '{' || c == '}' || c == '(' || c == ')' || c == '\\' || c == '[' || c == ']' || c == '#' || c == ',' || c == ';' || c == ':' || c == '@'); + } + + bool CharIsSpace(uint8_t c) + { + return c == ' ' || c == '\r' || c == '\t' || c == '\f' || c == '\v' || c == '\n'; + } + + uint8_t CharToUpper(uint8_t c) + { + return (c >= 'a' && c <= 'z') ? ('A' + (c - 'a')) : c; + } + + uint8_t CharToLower(uint8_t c) + { + return (c >= 'A' && c <= 'Z') ? ('a' + (c - 'A')) : c; + } + + uint8_t CharToForwardSlash(uint8_t c) + { + return (c == '\\' ? '/' : c); + } + + uint64_t CalculateCStringLength(char* cstr) + { + uint64_t length = 0; + for(; cstr[length]; length += 1) + ; + return length; + } + + String8 Str8(uint8_t* str, uint64_t size) + { + String8 string; + string.str = str; + string.size = size; + return string; + } + + String8 Str8Range(uint8_t* first, uint8_t* one_past_last) + { + String8 string; + string.str = first; + string.size = (uint64_t)(one_past_last - first); + return string; + } + + String16 Str16(uint16_t* str, uint64_t size) + { + String16 result; + result.str = str; + result.size = size; + return result; + } + + String16 Str16C(uint16_t* ptr) + { + uint16_t* p = ptr; + for(; *p; p += 1) + ; + String16 result = Str16(ptr, p - ptr); + return result; + } + + String32 Str32(uint32_t* str, uint64_t size) + { + String32 string = { 0 }; + string.str = str; + string.size = size; + return string; + } + + String8 + Substr8(String8 str, Range1U64 rng) + { + uint64_t min = rng.min; + uint64_t max = rng.max; + if(max > str.size) + { + max = str.size; + } + if(min > str.size) + { + min = str.size; + } + if(min > max) + { + uint64_t swap = min; + min = max; + max = swap; + } + str.size = max - min; + str.str += min; + return str; + } + + String8 Str8Skip(String8 str, uint64_t min) + { + return Substr8(str, Range1U64({ min, str.size })); + } + + String8 Str8Chop(String8 str, uint64_t nmax) + { + return Substr8(str, Range1U64({ 0, str.size - nmax })); + } + + String8 Prefix8(String8 str, uint64_t size) + { + return Substr8(str, Range1U64({ 0, size })); + } + + String8 Suffix8(String8 str, uint64_t size) + { + return Substr8(str, Range1U64({ str.size - size, str.size })); + } + + bool Str8Match(String8 a, String8 b, MatchFlags flags) + { + bool result = false; + if(a.size == b.size) + { + result = 1; + for(uint64_t i = 0; i < a.size; i += 1) + { + bool match = (a.str[i] == b.str[i]); + if(match == false) + { + result = false; + break; + } + } + } + return result; + } + + uint64_t FindSubstr8(String8 haystack, String8 needle, uint64_t start_pos, MatchFlags flags) + { + bool found = 0; + uint64_t found_idx = haystack.size; + for(uint64_t i = start_pos; i < haystack.size; i += 1) + { + if(i + needle.size <= haystack.size) + { + String8 substr = Substr8(haystack, Range1U64({ i, i + needle.size })); + if(Str8Match(substr, needle, flags)) + { + found_idx = i; + found = 1; + if(!(flags & MatchFlag_FindLast)) + { + break; + } + } + } + } + return found_idx; + } + + FuzzyMatchList FindFuzzy8(Arena* arena, String8 haystack, String8 needle, uint64_t start_pos, MatchFlags flags) + { + ArenaTemp scratch = ArenaTempBegin(arena); + FuzzyMatchList matches = { 0 }; + { + String8 splits[] = { + Str8Lit(" "), + Str8Lit("/"), + Str8Lit("\\"), + Str8Lit("\t"), + Str8Lit("\n"), + Str8Lit("*"), + Str8Lit("_"), + Str8Lit("-"), + }; + String8List needle_parts = StrSplit8(scratch.arena, needle, ArrayCount(splits), splits); + uint64_t start_search_haystack_pos = 0; + for(String8Node* n = needle_parts.first; n != 0; n = n->next) + { + bool found = 0; + for(uint64_t search_pos = start_search_haystack_pos; search_pos < haystack.size;) + { + uint64_t needle_part_pos = FindSubstr8(haystack, n->string, search_pos, flags); + search_pos = needle_part_pos + 1; + if(needle_part_pos < haystack.size) + { + FuzzyMatchNode* match_n = PushArray(arena, FuzzyMatchNode, 1); + match_n->match = Range1U64({ needle_part_pos, needle_part_pos + n->string.size }); + QueuePush(matches.first, matches.last, match_n); + matches.count += 1; + found = 1; + } + } + if(found == 0) + { + matches.missed_count += 1; + } + } + } + ArenaTempEnd(scratch); + return matches; + } + + String8 Str8SkipWhitespace(String8 str) + { + uint64_t first_non_ws = 0; + for(uint64_t idx = 0; idx < str.size; idx += 1) + { + first_non_ws = idx; + if(!CharIsSpace(str.str[idx])) + { + break; + } + else if(idx == str.size - 1) + { + first_non_ws = 1; + } + } + return Substr8(str, Range1U64({ first_non_ws, str.size })); + } + + String8 Str8ChopWhitespace(String8 str) + { + uint64_t first_ws_at_end = str.size; + for(uint64_t idx = str.size - 1; idx < str.size; idx -= 1) + { + if(!CharIsSpace(str.str[idx])) + { + break; + } + first_ws_at_end = idx; + } + return Substr8(str, Range1U64({ 0, first_ws_at_end })); + } + + String8 Str8SkipChopWhitespace(String8 str) + { + return Str8SkipWhitespace(Str8ChopWhitespace(str)); + } + + String8 Str8SkipChopNewlines(String8 str) + { + uint64_t first_non_ws = 0; + for(uint64_t idx = 0; idx < str.size; idx += 1) + { + first_non_ws = idx; + if(str.str[idx] != '\n' && str.str[idx] != '\r') + { + break; + } + } + + uint64_t first_ws_at_end = str.size; + for(uint64_t idx = str.size - 1; idx < str.size; idx -= 1) + { + if(str.str[idx] != '\n' && str.str[idx] != '\r') + { + break; + } + first_ws_at_end = idx; + } + + return Substr8(str, Range1U64({ first_non_ws, first_ws_at_end })); + } + + String8 Str8PathChopLastPeriod(String8 string) + { + uint64_t period_pos = FindSubstr8(string, Str8Lit("."), 0, MatchFlag_FindLast); + if(period_pos < string.size) + { + string.size = period_pos; + } + return string; + } + + String8 Str8PathSkipLastSlash(String8 string) + { + uint64_t slash_pos = FindSubstr8(string, Str8Lit("/"), 0, MatchFlag_SlashInsensitive | MatchFlag_FindLast); + if(slash_pos < string.size) + { + string.str += slash_pos + 1; + string.size -= slash_pos + 1; + } + return string; + } + + String8 Str8PathChopLastSlash(String8 string) + { + uint64_t slash_pos = FindSubstr8(string, Str8Lit("/"), 0, MatchFlag_SlashInsensitive | MatchFlag_FindLast); + if(slash_pos < string.size) + { + string.size = slash_pos; + } + return string; + } + + String8 Str8PathSkipLastPeriod(String8 string) + { + uint64_t period_pos = FindSubstr8(string, Str8Lit("."), 0, MatchFlag_FindLast); + if(period_pos < string.size) + { + string.str += period_pos + 1; + string.size -= period_pos + 1; + } + return string; + } + + String8 Str8PathChopPastLastSlash(String8 string) + { + uint64_t slash_pos = FindSubstr8(string, Str8Lit("/"), 0, MatchFlag_SlashInsensitive | MatchFlag_FindLast); + if(slash_pos < string.size) + { + string.size = slash_pos + 1; + } + return string; + } + + PathType PathTypeFromStr8(String8 path) + { + PathType kind = PathType_Relative; + if(path.size >= 1 && path.str[0] == '/') + { + kind = PathType_RootAbsolute; + } + if(path.size >= 2 && CharIsAlpha(path.str[0]) && path.str[1] == ':') + { + kind = PathType_DriveAbsolute; + } + return kind; + } + + String8List PathPartsFromStr8(Arena* arena, String8 path) + { + String8 splits[] = { Str8Lit("/"), Str8Lit("\\") }; + String8List strs = StrSplit8(arena, path, ArrayCount(splits), splits); + return strs; + } + + String8List AbsolutePathPartsFromSourcePartsType(Arena* arena, String8 source, String8List parts, PathType type) + { + if(type == PathType_Relative) + { + String8List concatted_parts = { 0 }; + String8List source_parts = PathPartsFromStr8(arena, source); + Str8ListConcatInPlace(&concatted_parts, &source_parts); + Str8ListConcatInPlace(&concatted_parts, &parts); + parts = concatted_parts; + } + + return parts; + } + + String8 PushStr8Copy(Arena* arena, const char* string) + { + return PushStr8Copy(arena, Str8C((char*)string)); + } + + String8 PushStr8Copy(Arena* arena, String8 string) + { + String8 res; + res.size = string.size; + res.str = PushArrayNoZero(arena, uint8_t, string.size + 1); + MemoryCopy(res.str, string.str, string.size); + res.str[string.size] = 0; + return res; + } + + String8 PushStr8FV(Arena* arena, const char* fmt, va_list args) + { + String8 result = { 0 }; + va_list args2; + va_copy(args2, args); + + uint64_t needed_bytes = vsnprintf(0, 0, fmt, args) + 1; // fmt::formatted_size(fmt, args2);// ts_stbsp_vsnprintf(0, 0, fmt, args)+1; + result.str = PushArrayNoZero(arena, uint8_t, needed_bytes); + result.size = needed_bytes - 1; + // fmt::format_to(result.str, fmt, args2); + + vsnprintf((char*)result.str, needed_bytes, fmt, args2); + + return result; + } + + // snprintf formatting + String8 PushStr8F(Arena* arena, const char* fmt, ...) + { + String8 result = { 0 }; + va_list args; + va_start(args, fmt); + result = PushStr8FV(arena, fmt, args); + va_end(args); + return result; + } + + String8 PushStr8FillByte(Arena* arena, uint64_t size, uint8_t byte) + { + String8 result = { 0 }; + result.str = PushArrayNoZero(arena, uint8_t, size); + MemorySet(result.str, byte, size); + result.size = size; + return result; + } + + void Str8ListPushNode(String8List* list, String8Node* n) + { + QueuePush(list->first, list->last, n); + list->node_count += 1; + list->total_size += n->string.size; + } + + void Str8ListPushNodeFront(String8List* list, String8Node* n) + { + QueuePushFront(list->first, list->last, n); + list->node_count += 1; + list->total_size += n->string.size; + } + + void Str8ListPush(Arena* arena, String8List* list, String8 str) + { + String8Node* n = PushArray(arena, String8Node, 1); + n->string = str; + Str8ListPushNode(list, n); + } + + void Str8ListPushF(Arena* arena, String8List* list, char* fmt, ...) + { + va_list args; + va_start(args, fmt); + String8 string = PushStr8FV(arena, fmt, args); + va_end(args); + Str8ListPush(arena, list, string); + } + + void Str8ListPushFront(Arena* arena, String8List* list, String8 str) + { + String8Node* n = PushArray(arena, String8Node, 1); + n->string = str; + Str8ListPushNodeFront(list, n); + } + + void Str8ListConcatInPlace(String8List* list, String8List* to_push) + { + if(to_push->first) + { + list->node_count += to_push->node_count; + list->total_size += to_push->total_size; + if(list->last == 0) + { + *list = *to_push; + } + else + { + list->last->next = to_push->first; + list->last = to_push->last; + } + } + MemoryZero(to_push, sizeof(*to_push)); + } + + String8List StrSplit8(Arena* arena, String8 string, uint64_t split_count, String8* splits) + { + String8List list = { 0 }; + + uint64_t split_start = 0; + for(uint64_t i = 0; i < string.size; i += 1) + { + bool was_split = 0; + for(uint64_t split_idx = 0; split_idx < split_count; split_idx += 1) + { + bool match = 0; + if(i + splits[split_idx].size <= string.size) + { + match = 1; + for(uint64_t split_i = 0; split_i < splits[split_idx].size && i + split_i < string.size; split_i += 1) + { + if(splits[split_idx].str[split_i] != string.str[i + split_i]) + { + match = 0; + break; + } + } + } + if(match) + { + String8 split_string = Str8(string.str + split_start, i - split_start); + Str8ListPush(arena, &list, split_string); + split_start = i + splits[split_idx].size; + i += splits[split_idx].size - 1; + was_split = 1; + break; + } + } + + if(was_split == 0 && i == string.size - 1) + { + String8 split_string = Str8(string.str + split_start, i + 1 - split_start); + Str8ListPush(arena, &list, split_string); + break; + } + } + + return list; + } + + String8 Str8ListJoin(Arena* arena, String8List list, StringJoin* optional_params) + { + StringJoin join = { 0 }; + if(optional_params != 0) + { + MemoryCopy(&join, optional_params, sizeof(join)); + } + + uint64_t sep_count = 0; + if(list.node_count > 1) + { + sep_count = list.node_count - 1; + } + String8 result = { 0 }; + result.size = (list.total_size + join.pre.size + sep_count * join.sep.size + join.post.size); + result.str = PushArrayNoZero(arena, uint8_t, result.size + 1); + + uint8_t* ptr = result.str; + MemoryCopy(ptr, join.pre.str, join.pre.size); + ptr += join.pre.size; + for(String8Node* node = list.first; node; node = node->next) + { + MemoryCopy(ptr, node->string.str, node->string.size); + ptr += node->string.size; + if(node != list.last) + { + MemoryCopy(ptr, join.sep.str, join.sep.size); + ptr += join.sep.size; + } + } + MemoryCopy(ptr, join.post.str, join.post.size); + ptr += join.post.size; + + result.str[result.size] = 0; + + return result; + } + + String8List DotResolvedPathPartsFromParts(Arena* arena, String8List parts) + { + ArenaTemp scratch = ArenaTempBegin(arena); + typedef struct NodeNode NodeNode; + struct NodeNode + { + NodeNode* next; + String8Node* node; + }; + NodeNode* part_stack_top = 0; + for(String8Node* n = parts.first; n != 0; n = n->next) + { + if(Str8Match(n->string, Str8Lit(".."), 0)) + { + StackPop(part_stack_top); + } + else if(Str8Match(n->string, Str8Lit("."), 0)) + { + } + else + { + NodeNode* nn = PushArray(scratch.arena, NodeNode, 1); + nn->node = n; + StackPush(part_stack_top, nn); + } + } + String8List result = { 0 }; + for(NodeNode* nn = part_stack_top; nn != 0; nn = nn->next) + { + Str8ListPushFront(arena, &result, nn->node->string); + } + ArenaTempEnd(scratch); + return result; + } + + String8 NormalizedPathFromStr8(Arena* arena, String8 source, String8 path) + { + ArenaTemp scratch = ArenaTempBegin(arena); + path = Str8SkipWhitespace(path); + bool trailing_slash = path.size > 0 && (path.str[path.size - 1] == '/' || path.str[path.size - 1] == '\\'); + PathType type = PathTypeFromStr8(path); + String8List path_parts = PathPartsFromStr8(scratch.arena, path); + String8List absolute_path_parts = AbsolutePathPartsFromSourcePartsType(scratch.arena, source, path_parts, type); + String8List absolute_resolved_path_parts = DotResolvedPathPartsFromParts(scratch.arena, absolute_path_parts); + StringJoin join = { 0 }; + join.sep = Str8Lit("/"); + if(trailing_slash) + { + join.post = Str8Lit("/"); + } + String8 absolute_resolved_path = Str8ListJoin(scratch.arena, absolute_resolved_path_parts, &join); + ArenaTempEnd(scratch); + return absolute_resolved_path; + } + + String8 GetFileName(String8 str, bool directory) + { + if(directory) + return Str8PathSkipLastSlash(str); + else + return Str8PathSkipLastSlash(Str8PathChopLastPeriod(str)); + } + + bool operator==(const String8& lhs, const String8& rhs) + { + return Str8Match(lhs, rhs, 0); + } + + uint64_t U64FromStr8(String8 string, uint32_t radix) + { + LUMOS_ASSERT(2 <= radix && radix <= 16); + uint8_t char_to_value[] = { + 0x00, + 0x01, + 0x02, + 0x03, + 0x04, + 0x05, + 0x06, + 0x07, + 0x08, + 0x09, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0x0A, + 0x0B, + 0x0C, + 0x0D, + 0x0E, + 0x0F, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + 0xFF, + }; + uint64_t value = 0; + for(uint64_t i = 0; i < string.size; i += 1) + { + value *= radix; + uint8_t c = string.str[i]; + value += char_to_value[(c - 0x30) & 0x1F]; + } + return value; + } + + int64_t CStyleIntFromStr8(String8 string) + { + uint64_t p = 0; + + // consume sign + double sign = +1; + if(p < string.size) + { + uint8_t c = string.str[p]; + if(c == '-') + { + sign = -1; + p += 1; + } + else if(c == '+') + { + p += 1; + } + } + + // radix from prefix + int64_t radix = 10; + if(p < string.size) + { + uint8_t c0 = string.str[p]; + if(c0 == '0') + { + p += 1; + radix = 8; + if(p < string.size) + { + uint8_t c1 = string.str[p]; + if(c1 == 'x') + { + p += 1; + radix = 16; + } + else if(c1 == 'b') + { + p += 1; + radix = 2; + } + } + } + } + + // consume integer "digits" + String8 digits_substr = Str8Skip(string, p); + uint64_t n = U64FromStr8(digits_substr, (uint32_t)radix); + + // combine result + int64_t result = (int64_t)sign * (int64_t)n; + return result; + } + + double DoubleFromStr8(String8 string) + { + char str[64]; + uint64_t str_size = string.size; + if(str_size > sizeof(str) - 1) + { + str_size = sizeof(str) - 1; + } + MemoryCopy(str, string.str, str_size); + str[str_size] = 0; + return atof(str); + } + + String8 CStyleHexStringFromU64(Arena* arena, uint64_t x, bool caps) + { + char int_value_to_char[] = "0123456789abcdef"; + uint8_t buffer[10]; + uint8_t* opl = buffer + 10; + uint8_t* ptr = opl; + if(x == 0) + { + ptr -= 1; + *ptr = '0'; + } + else + { + for(;;) + { + uint32_t val = x % 16; + x /= 16; + uint8_t c = (uint8_t)int_value_to_char[val]; + if(caps) + { + c = CharToUpper(c); + } + ptr -= 1; + *ptr = c; + if(x == 0) + { + break; + } + } + } + ptr -= 1; + *ptr = 'x'; + ptr -= 1; + *ptr = '0'; + + String8 result = { 0 }; + result.size = (uint64_t)(ptr - buffer); + result.str = PushArrayNoZero(arena, uint8_t, result.size); + MemoryCopy(result.str, buffer, result.size); + + return result; + } +} diff --git a/Lumos/Source/Lumos/Core/String.h b/Lumos/Source/Lumos/Core/String.h new file mode 100644 index 00000000..b02e1b62 --- /dev/null +++ b/Lumos/Source/Lumos/Core/String.h @@ -0,0 +1,180 @@ +#pragma once +#include "OS/Memory.h" + +namespace Lumos +{ + struct String8 + { + uint8_t* str; + uint64_t size; + + friend bool operator==(const String8& lhs, const String8& rhs); + }; + + struct String16 + { + uint16_t* str; + uint64_t size; + }; + + struct String32 + { + uint32_t* str; + uint64_t size; + }; + + struct String8Node + { + String8Node* next; + String8 string; + }; + + struct String8List + { + String8Node* first; + String8Node* last; + uint64_t node_count; + uint64_t total_size; + }; + + struct String8Array + { + uint64_t count; + String8* v; + }; + + struct StringJoin + { + String8 pre; + String8 sep; + String8 post; + }; + + typedef uint32_t MatchFlags; + enum + { + MatchFlag_CaseInsensitive = (1 << 0), + MatchFlag_RightSideSloppy = (1 << 1), + MatchFlag_SlashInsensitive = (1 << 2), + MatchFlag_FindLast = (1 << 3), + MatchFlag_KeepEmpties = (1 << 4), + }; + + enum IdentifierStyle + { + IdentifierStyle_UpperCamelCase, + IdentifierStyle_LowerCamelCase, + IdentifierStyle_UpperCase, + IdentifierStyle_LowerCase, + }; + + enum PathType + { + PathType_Relative, + PathType_DriveAbsolute, + PathType_RootAbsolute, + PathKType_Count + }; + + struct Range1U64 + { + uint64_t min; + uint64_t max; + }; + + struct FuzzyMatchNode + { + FuzzyMatchNode* next; + Range1U64 match; + }; + + struct FuzzyMatchList + { + FuzzyMatchNode* first; + FuzzyMatchNode* last; + uint64_t count; + uint64_t missed_count; + }; + + bool CharIsAlpha(uint8_t c); + bool CharIsAlphaUpper(uint8_t c); + bool CharIsAlphaLower(uint8_t c); + bool CharIsDigit(uint8_t c); + bool CharIsSymbol(uint8_t c); + bool CharIsSpace(uint8_t c); + uint8_t CharToUpper(uint8_t c); + uint8_t CharToLower(uint8_t c); + uint8_t CharToForwardSlash(uint8_t c); + + uint64_t CalculateCStringLength(char* cstr); + String8 Str8(uint8_t* str, uint64_t size); + + String8 Str8Range(uint8_t* first, uint8_t* one_past_last); + String16 Str16(uint16_t* str, uint64_t size); + String16 Str16C(uint16_t* ptr); + String32 Str32(uint32_t* str, uint64_t size); + + String8 PushStr8Copy(Arena* arena, const char* string); + String8 PushStr8Copy(Arena* arena, String8 string); + String8 PushStr8FV(Arena* arena, const char* fmt, va_list args); + String8 PushStr8F(Arena* arena, const char* fmt, ...); + String8 PushStr8FillByte(Arena* arena, uint64_t size, uint8_t byte); + + void Str8ListPushNode(String8List* list, String8Node* n); + void Str8ListPushNodeFront(String8List* list, String8Node* n); + void Str8ListPush(Arena* arena, String8List* list, String8 str); + void Str8ListPushF(Arena* arena, String8List* list, char* fmt, ...); + void Str8ListPushFront(Arena* arena, String8List* list, String8 str); + void Str8ListConcatInPlace(String8List* list, String8List* to_push); + String8List StrSplit8(Arena* arena, String8 string, uint64_t split_count, String8* splits); + String8 Str8ListJoin(Arena* arena, String8List list, StringJoin* optional_params); + + String8 Substr8(String8 str, Range1U64 rng); + String8 Str8Skip(String8 str, uint64_t min); + String8 Str8Chop(String8 str, uint64_t nmax); + String8 Prefix8(String8 str, uint64_t size); + String8 Suffix8(String8 str, uint64_t size); + + bool Str8Match(String8 a, String8 b, MatchFlags flags); + uint64_t FindSubstr8(String8 haystack, String8 needle, uint64_t start_pos, MatchFlags flags); + FuzzyMatchList FindFuzzy8(Arena* arena, String8 haystack, String8 needle, uint64_t start_pos, MatchFlags flags); + + String8 Str8SkipWhitespace(String8 str); + String8 Str8ChopWhitespace(String8 str); + String8 Str8SkipChopWhitespace(String8 str); + String8 Str8SkipChopNewlines(String8 str); + + String8 Str8PathChopLastPeriod(String8 str); + String8 Str8PathSkipLastSlash(String8 str); + String8 Str8PathChopLastSlash(String8 str); + String8 Str8PathSkipLastPeriod(String8 str); + String8 Str8PathChopPastLastSlash(String8 str); + + PathType PathTypeFromStr8(String8 path); + String8List PathPartsFromStr8(Arena* arena, String8 path); + String8List AbsolutePathPartsFromSourcePartsType(Arena* arena, String8 source, String8List parts, PathType type); + + String8List DotResolvedPathPartsFromParts(Arena* arena, String8List parts); + String8 NormalizedPathFromStr8(Arena* arena, String8 source, String8 path); + String8 GetFileName(String8 str, bool directory = false); + + uint64_t U64FromStr8(String8 str, uint32_t radix); + int64_t CStyleIntFromStr8(String8 str); + double DoubleFromStr8(String8 str); + String8 CStyleHexStringFromU64(Arena* arena, uint64_t x, bool caps); + + bool operator==(const String8& lhs, const String8& rhs); + + #define Str8Struct(ptr) Str8((uint8_t*)(ptr), sizeof(*(ptr))) + +#define Str8C(cstring) Str8((uint8_t*)(cstring), CalculateCStringLength(cstring)) +#define Str8Lit(s) Str8((uint8_t*)(s), sizeof(s) - 1) +#define Str8LitComp(s) \ + { \ + (uint8_t*)(s), sizeof(s) - 1 \ + } + +#define Str8VArg(s) (int)(s).size, (s).str +#define Str8ListFirst(list) ((list)->first != 0 ? (list)->first->string : Str8Lit("")) +#define ToStdString(s) std::string((const char*)s.str, s.size) +} diff --git a/Lumos/Source/Lumos/Core/UUID.cpp b/Lumos/Source/Lumos/Core/UUID.cpp index f3afc345..6b5bc20e 100644 --- a/Lumos/Source/Lumos/Core/UUID.cpp +++ b/Lumos/Source/Lumos/Core/UUID.cpp @@ -6,8 +6,7 @@ namespace Lumos { UUID::UUID() { - // Random uint64_t for now - m_UUID = Random64::Rand(0, std::numeric_limits::max()); + m_UUID = Random64::Rand(1, std::numeric_limits::max()); } UUID::UUID(uint64_t uuid) diff --git a/Lumos/Source/Lumos/Core/VFS.cpp b/Lumos/Source/Lumos/Core/VFS.cpp deleted file mode 100644 index 63666907..00000000 --- a/Lumos/Source/Lumos/Core/VFS.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "Precompiled.h" -#include "VFS.h" -#include "StringUtilities.h" -#include "OS/FileSystem.h" - -namespace Lumos -{ - void VFS::Mount(const std::string& virtualPath, const std::string& physicalPath, bool replace) - { - LUMOS_PROFILE_FUNCTION(); - - if(replace) - m_MountPoints[virtualPath].clear(); - - m_MountPoints[virtualPath].push_back(physicalPath); - } - - void VFS::Unmount(const std::string& path) - { - LUMOS_PROFILE_FUNCTION(); - m_MountPoints[path].clear(); - } - - bool VFS::ResolvePhysicalPath(const std::string& path, std::string& outPhysicalPath, bool folder) - { - LUMOS_PROFILE_FUNCTION(); - const std::string& updatedPath = path; - // std::replace(updatedPath.begin(), updatedPath.end(), '\\', '/'); - - if(!(path[0] == '/' && path[1] == '/')) - { - outPhysicalPath = path; - return folder ? FileSystem ::FolderExists(updatedPath) : FileSystem::FileExists(updatedPath); - } - - static std::string delimiter = "/"; - auto slash = updatedPath.find_first_of(delimiter.c_str(), 2); - std::string_view virtualDir = std::string_view(updatedPath); - virtualDir = virtualDir.substr(2, slash - 2); - - auto it = m_MountPoints.find(virtualDir); - if(it == m_MountPoints.end() || it->second.empty()) - { - outPhysicalPath = updatedPath; - return folder ? FileSystem::FolderExists(updatedPath) : FileSystem::FileExists(updatedPath); - } - - const std::string remainder = updatedPath.substr(virtualDir.size() + 2, updatedPath.size() - virtualDir.size()); - for(const std::string& physicalPath : it->second) - { - const std::string newPath = physicalPath + /* "/" +*/ remainder; - if(folder ? FileSystem::FolderExists(newPath) : FileSystem::FileExists(newPath)) - { - outPhysicalPath = newPath; - return true; - } - } - return false; - } - - uint8_t* VFS::ReadFile(const std::string& path) - { - LUMOS_PROFILE_FUNCTION(); - std::string physicalPath; - return ResolvePhysicalPath(path, physicalPath) ? FileSystem::ReadFile(physicalPath) : nullptr; - } - - std::string VFS::ReadTextFile(const std::string& path) - { - LUMOS_PROFILE_FUNCTION(); - std::string physicalPath; - return ResolvePhysicalPath(path, physicalPath) ? FileSystem::ReadTextFile(physicalPath) : ""; - } - - bool VFS::WriteFile(const std::string& path, uint8_t* buffer, uint32_t size) - { - LUMOS_PROFILE_FUNCTION(); - std::string physicalPath; - return ResolvePhysicalPath(path, physicalPath) ? FileSystem::WriteFile(physicalPath, buffer, size) : false; - } - - bool VFS::WriteTextFile(const std::string& path, const std::string& text) - { - LUMOS_PROFILE_FUNCTION(); - std::string physicalPath; - return ResolvePhysicalPath(path, physicalPath) ? FileSystem::WriteTextFile(physicalPath, text) : false; - } - - bool VFS::AbsoulePathToVFS(const std::string& path, std::string& outVFSPath, bool folder) - { - LUMOS_PROFILE_FUNCTION(); - std::string updatedPath = path; - std::replace(updatedPath.begin(), updatedPath.end(), '\\', '/'); - - for(auto const& [key, val] : m_MountPoints) - { - for(auto& vfsPath : val) - { - if(updatedPath.find(vfsPath) != std::string::npos) - { - std::string newPath = updatedPath; - std::string newPartPath = "//" + key; - newPath.replace(0, vfsPath.length(), newPartPath); - outVFSPath = newPath; - return true; - } - } - } - - outVFSPath = updatedPath; - return false; - } -} diff --git a/Lumos/Source/Lumos/Core/VFS.h b/Lumos/Source/Lumos/Core/VFS.h deleted file mode 100644 index 611cb7fb..00000000 --- a/Lumos/Source/Lumos/Core/VFS.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once -#include "Utilities/TSingleton.h" -#include - -namespace Lumos -{ - class LUMOS_EXPORT VFS : public ThreadSafeSingleton - { - friend class ThreadSafeSingleton; - - public: - void Mount(const std::string& virtualPath, const std::string& physicalPath, bool replace = false); - void Unmount(const std::string& path); - bool ResolvePhysicalPath(const std::string& path, std::string& outPhysicalPath, bool folder = false); - bool AbsoulePathToVFS(const std::string& path, std::string& outVFSPath, bool folder = false); - inline std::string AbsoulePathToVFS(const std::string& path, bool folder = false) - { - std::string returnString; - AbsoulePathToVFS(path, returnString, folder); - return returnString; - } - - uint8_t* ReadFile(const std::string& path); - std::string ReadTextFile(const std::string& path); - - bool WriteFile(const std::string& path, uint8_t* buffer, uint32_t size); - bool WriteTextFile(const std::string& path, const std::string& text); - - private: - std::map, std::less> m_MountPoints; - }; -} diff --git a/Lumos/Source/Lumos/Events/KeyEvent.cpp b/Lumos/Source/Lumos/Events/KeyEvent.cpp new file mode 100644 index 00000000..0d798b4c --- /dev/null +++ b/Lumos/Source/Lumos/Events/KeyEvent.cpp @@ -0,0 +1,28 @@ +#include "Precompiled.h" +#include "KeyEvent.h" +#include + +namespace Lumos +{ + std::string KeyPressedEvent::ToString() const + { + std::stringstream ss; + ss << "KeyPressedEvent: " << uint32_t(m_KeyCode) << " (" << m_RepeatCount << " repeats)"; + return ss.str(); + } + + std::string KeyReleasedEvent::ToString() const + { + std::stringstream ss; + ss << "KeyReleasedEvent: " << uint32_t(m_KeyCode); + return ss.str(); + } + + std::string KeyTypedEvent::ToString() const + { + std::stringstream ss; + ss << "KeyTypedEvent: " << uint32_t(m_KeyCode); + return ss.str(); + } + +} \ No newline at end of file diff --git a/Lumos/Source/Lumos/Events/KeyEvent.h b/Lumos/Source/Lumos/Events/KeyEvent.h index d2d6a2ee..4848dc2e 100644 --- a/Lumos/Source/Lumos/Events/KeyEvent.h +++ b/Lumos/Source/Lumos/Events/KeyEvent.h @@ -3,8 +3,6 @@ #include "Event.h" #include "Core/OS/KeyCodes.h" -#include - namespace Lumos { @@ -35,12 +33,7 @@ namespace Lumos inline int GetRepeatCount() const { return m_RepeatCount; } - std::string ToString() const override - { - std::stringstream ss; - ss << "KeyPressedEvent: " << uint32_t(m_KeyCode) << " (" << m_RepeatCount << " repeats)"; - return ss.str(); - } + std::string ToString() const override; EVENT_CLASS_TYPE(KeyPressed) private: @@ -55,12 +48,7 @@ namespace Lumos { } - std::string ToString() const override - { - std::stringstream ss; - ss << "KeyReleasedEvent: " << uint32_t(m_KeyCode); - return ss.str(); - } + std::string ToString() const override; EVENT_CLASS_TYPE(KeyReleased) }; @@ -74,12 +62,7 @@ namespace Lumos { } - std::string ToString() const override - { - std::stringstream ss; - ss << "KeyPressedEvent: " << uint32_t(m_KeyCode); - return ss.str(); - } + std::string ToString() const; EVENT_CLASS_TYPE(KeyTyped) diff --git a/Lumos/Source/Lumos/Graphics/Camera/Camera2D.cpp b/Lumos/Source/Lumos/Graphics/Camera/Camera2D.cpp index 19e0f740..84ad43ef 100644 --- a/Lumos/Source/Lumos/Graphics/Camera/Camera2D.cpp +++ b/Lumos/Source/Lumos/Graphics/Camera/Camera2D.cpp @@ -2,6 +2,7 @@ #include "Camera2D.h" #include "Core/OS/Input.h" #include "Maths/MathsUtilities.h" +#include "Maths/Transform.h" #include "Camera.h" #include diff --git a/Lumos/Source/Lumos/Graphics/Camera/CameraController.h b/Lumos/Source/Lumos/Graphics/Camera/CameraController.h index 33f0434b..56ae60ba 100644 --- a/Lumos/Source/Lumos/Graphics/Camera/CameraController.h +++ b/Lumos/Source/Lumos/Graphics/Camera/CameraController.h @@ -1,10 +1,15 @@ #pragma once #include "Maths/Maths.h" -#include "Maths/Transform.h" +#include +#include namespace Lumos { + namespace Maths + { + class Transform; + } class Camera; class LUMOS_EXPORT CameraController diff --git a/Lumos/Source/Lumos/Graphics/Camera/EditorCamera.cpp b/Lumos/Source/Lumos/Graphics/Camera/EditorCamera.cpp index f330665a..01098de3 100644 --- a/Lumos/Source/Lumos/Graphics/Camera/EditorCamera.cpp +++ b/Lumos/Source/Lumos/Graphics/Camera/EditorCamera.cpp @@ -6,6 +6,7 @@ #include "Core/OS/Input.h" #include "Core/OS/Window.h" #include "Maths/MathsUtilities.h" +#include "Maths/Transform.h" namespace Lumos { diff --git a/Lumos/Source/Lumos/Graphics/Camera/FPSCamera.cpp b/Lumos/Source/Lumos/Graphics/Camera/FPSCamera.cpp index 9f4f6e7c..b1634eae 100644 --- a/Lumos/Source/Lumos/Graphics/Camera/FPSCamera.cpp +++ b/Lumos/Source/Lumos/Graphics/Camera/FPSCamera.cpp @@ -5,6 +5,7 @@ #include "Core/OS/Window.h" #include "Camera.h" #include "Maths/MathsUtilities.h" +#include "Maths/Transform.h" namespace Lumos { diff --git a/Lumos/Source/Lumos/Graphics/Camera/ThirdPersonCamera.cpp b/Lumos/Source/Lumos/Graphics/Camera/ThirdPersonCamera.cpp index 340f5a2e..5c4b1fdd 100644 --- a/Lumos/Source/Lumos/Graphics/Camera/ThirdPersonCamera.cpp +++ b/Lumos/Source/Lumos/Graphics/Camera/ThirdPersonCamera.cpp @@ -5,6 +5,8 @@ #include "Core/Application.h" #include "Core/OS/Window.h" #include "Maths/MathsUtilities.h" +#include "Maths/Transform.h" + namespace Lumos { diff --git a/Lumos/Source/Lumos/Graphics/Environment.cpp b/Lumos/Source/Lumos/Graphics/Environment.cpp index 6de79b8e..7bf8958d 100644 --- a/Lumos/Source/Lumos/Graphics/Environment.cpp +++ b/Lumos/Source/Lumos/Graphics/Environment.cpp @@ -3,7 +3,7 @@ #include "Core/Application.h" #include "Renderers/RenderPasses.h" #include "RHI/Texture.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/StringUtilities.h" namespace Lumos @@ -82,7 +82,7 @@ namespace Lumos break; std::string newPath; - if(!VFS::Get().ResolvePhysicalPath(envFiles[i], newPath)) + if(!FileSystem::Get().ResolvePhysicalPath(envFiles[i], newPath)) { LUMOS_LOG_ERROR("Failed to load {0}", envFiles[i]); failed = true; @@ -106,7 +106,7 @@ namespace Lumos break; std::string newPath; - if(!VFS::Get().ResolvePhysicalPath(irrFiles[i], newPath)) + if(!FileSystem::Get().ResolvePhysicalPath(irrFiles[i], newPath)) { LUMOS_LOG_ERROR("Failed to load {0}", irrFiles[i]); failed = true; diff --git a/Lumos/Source/Lumos/Graphics/Font.cpp b/Lumos/Source/Lumos/Graphics/Font.cpp index 2da726ce..b1b5920a 100644 --- a/Lumos/Source/Lumos/Graphics/Font.cpp +++ b/Lumos/Source/Lumos/Graphics/Font.cpp @@ -4,7 +4,7 @@ #include "Core/OS/FileSystem.h" #include "Core/Buffer.h" #include "RHI/Texture.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/Application.h" #if __has_include() @@ -15,6 +15,7 @@ #include #include +#include #define FONT_DEBUG_LOG 0 #if FONT_DEBUG_LOG @@ -272,7 +273,7 @@ namespace Lumos if(m_FontDataSize == 0) { std::string outPath; - if(!VFS::Get().ResolvePhysicalPath(m_FilePath, outPath)) + if(!FileSystem::Get().ResolvePhysicalPath(m_FilePath, outPath)) return; FONT_LOG("Font: Loading Font {0}", m_FilePath); diff --git a/Lumos/Source/Lumos/Graphics/Material.cpp b/Lumos/Source/Lumos/Graphics/Material.cpp index ee8078ff..785125e3 100644 --- a/Lumos/Source/Lumos/Graphics/Material.cpp +++ b/Lumos/Source/Lumos/Graphics/Material.cpp @@ -7,7 +7,7 @@ #include "Graphics/RHI/UniformBuffer.h" #include "Graphics/RHI/GraphicsContext.h" #include "Core/OS/FileSystem.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/Application.h" #include "Scene/Scene.h" #include "Utilities/AssetManager.h" @@ -73,7 +73,7 @@ namespace Lumos::Graphics std::string physicalPath; - VFS::Get().ResolvePhysicalPath(path, physicalPath); + FileSystem::Get().ResolvePhysicalPath(path, physicalPath); return FileSystem::FileExists(physicalPath); } @@ -245,7 +245,7 @@ namespace Lumos::Graphics void Material::Bind() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_DescriptorSet == nullptr || GetTexturesUpdated()) { diff --git a/Lumos/Source/Lumos/Graphics/Material.h b/Lumos/Source/Lumos/Graphics/Material.h index f12ae1cc..9605d8d8 100644 --- a/Lumos/Source/Lumos/Graphics/Material.h +++ b/Lumos/Source/Lumos/Graphics/Material.h @@ -1,7 +1,7 @@ #pragma once #include "RHI/Texture.h" #include "RHI/Shader.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Scene/Serialisation.h" #include "Maths/MathsSerialisation.h" @@ -108,17 +108,17 @@ namespace Lumos void save(Archive& archive) const { std::string shaderPath = ""; - std::string albedoFilePath = m_PBRMaterialTextures.albedo ? VFS::Get().AbsoulePathToVFS(m_PBRMaterialTextures.albedo->GetFilepath()) : ""; - std::string normalFilePath = m_PBRMaterialTextures.normal ? VFS::Get().AbsoulePathToVFS(m_PBRMaterialTextures.normal->GetFilepath()) : ""; - std::string metallicFilePath = m_PBRMaterialTextures.metallic ? VFS::Get().AbsoulePathToVFS(m_PBRMaterialTextures.metallic->GetFilepath()) : ""; - std::string roughnessFilePath = m_PBRMaterialTextures.roughness ? VFS::Get().AbsoulePathToVFS(m_PBRMaterialTextures.roughness->GetFilepath()) : ""; - std::string emissiveFilePath = m_PBRMaterialTextures.emissive ? VFS::Get().AbsoulePathToVFS(m_PBRMaterialTextures.emissive->GetFilepath()) : ""; - std::string aoFilePath = m_PBRMaterialTextures.ao ? VFS::Get().AbsoulePathToVFS(m_PBRMaterialTextures.ao->GetFilepath()) : ""; + std::string albedoFilePath = m_PBRMaterialTextures.albedo ? FileSystem::Get().AbsolutePathToFileSystem(m_PBRMaterialTextures.albedo->GetFilepath()) : ""; + std::string normalFilePath = m_PBRMaterialTextures.normal ? FileSystem::Get().AbsolutePathToFileSystem(m_PBRMaterialTextures.normal->GetFilepath()) : ""; + std::string metallicFilePath = m_PBRMaterialTextures.metallic ? FileSystem::Get().AbsolutePathToFileSystem(m_PBRMaterialTextures.metallic->GetFilepath()) : ""; + std::string roughnessFilePath = m_PBRMaterialTextures.roughness ? FileSystem::Get().AbsolutePathToFileSystem(m_PBRMaterialTextures.roughness->GetFilepath()) : ""; + std::string emissiveFilePath = m_PBRMaterialTextures.emissive ? FileSystem::Get().AbsolutePathToFileSystem(m_PBRMaterialTextures.emissive->GetFilepath()) : ""; + std::string aoFilePath = m_PBRMaterialTextures.ao ? FileSystem::Get().AbsolutePathToFileSystem(m_PBRMaterialTextures.ao->GetFilepath()) : ""; if(m_Shader) { std::string path = m_Shader->GetFilePath() + m_Shader->GetName(); - VFS::Get().AbsoulePathToVFS(path, shaderPath); + FileSystem::Get().AbsolutePathToFileSystem(path, shaderPath); } archive(cereal::make_nvp("Albedo", albedoFilePath), diff --git a/Lumos/Source/Lumos/Graphics/Mesh.cpp b/Lumos/Source/Lumos/Graphics/Mesh.cpp index b5517364..7fbfd0c7 100644 --- a/Lumos/Source/Lumos/Graphics/Mesh.cpp +++ b/Lumos/Source/Lumos/Graphics/Mesh.cpp @@ -28,32 +28,37 @@ namespace Lumos { } - Mesh::Mesh(const std::vector& indices, const std::vector& vertices, float optimiseThreshold) + Mesh::Mesh(const std::vector& indices, const std::vector& vertices, bool optimise, float optimiseThreshold) { + // int lod = 2; + // float threshold = powf(0.7f, float(lod)); m_Indices = indices; m_Vertices = vertices; - // int lod = 2; - // float threshold = powf(0.7f, float(lod)); + if(optimise) + { + size_t indexCount = indices.size(); + size_t target_index_count = size_t(indices.size() * optimiseThreshold); - size_t indexCount = indices.size(); - size_t target_index_count = size_t(indices.size() * optimiseThreshold); + float target_error = 1e-3f; + float* resultError = nullptr; - float target_error = 1e-3f; - float* resultError = nullptr; + auto newIndexCount = meshopt_simplify(m_Indices.data(), m_Indices.data(), m_Indices.size(), (const float*)(&m_Vertices[0]), m_Vertices.size(), sizeof(Graphics::Vertex), target_index_count, target_error, resultError); - auto newIndexCount = meshopt_simplify(m_Indices.data(), m_Indices.data(), m_Indices.size(), (const float*)(&m_Vertices[0]), m_Vertices.size(), sizeof(Graphics::Vertex), target_index_count, target_error, resultError); + auto newVertexCount = meshopt_optimizeVertexFetch( // return vertices (not vertex attribute values) + (m_Vertices.data()), + (unsigned int*)(m_Indices.data()), + newIndexCount, // total new indices (not faces) + (m_Vertices.data()), + (size_t)m_Vertices.size(), // total vertices (not vertex attribute values) + sizeof(Graphics::Vertex) // vertex stride + ); - auto newVertexCount = meshopt_optimizeVertexFetch( // return vertices (not vertex attribute values) - (m_Vertices.data()), - (unsigned int*)(m_Indices.data()), - newIndexCount, // total new indices (not faces) - (m_Vertices.data()), - (size_t)m_Vertices.size(), // total vertices (not vertex attribute values) - sizeof(Graphics::Vertex) // vertex stride - ); + m_Vertices.resize(newVertexCount); + m_Indices.resize(newIndexCount); - // LUMOS_LOG_INFO("Mesh Optimizer - Before : {0} indices {1} vertices , After : {2} indices , {3} vertices", indexCount, m_Vertices.size(), newIndexCount, newVertexCount); + // LUMOS_LOG_INFO("Mesh Optimizer - Before : {0} indices {1} vertices , After : {2} indices , {3} vertices", indexCount, m_Vertices.size(), newIndexCount, newVertexCount); + } m_BoundingBox = CreateSharedPtr(); @@ -62,10 +67,20 @@ namespace Lumos m_BoundingBox->Merge(vertex.Position); } - m_IndexBuffer = SharedPtr(Graphics::IndexBuffer::Create(m_Indices.data(), (uint32_t)newIndexCount)); + m_IndexBuffer = SharedPtr(Graphics::IndexBuffer::Create(m_Indices.data(), (uint32_t)m_Indices.size())); m_VertexBuffer = SharedPtr(VertexBuffer::Create(BufferUsage::STATIC)); - m_VertexBuffer->SetData((uint32_t)(sizeof(Graphics::Vertex) * newVertexCount), m_Vertices.data()); + m_VertexBuffer->SetData((uint32_t)(sizeof(Graphics::Vertex) * m_Vertices.size()), m_Vertices.data()); + + const bool storeData = false; + if(!storeData) + { + m_Indices.clear(); + m_Indices.shrink_to_fit(); + + m_Vertices.clear(); + m_Vertices.shrink_to_fit(); + } } Mesh::~Mesh() @@ -122,6 +137,8 @@ namespace Lumos delete[] normals; } +#define CHECK_VEC3(vec3) Maths::IsInf(vec3.x) || Maths::IsInf(vec3.y) || Maths::IsInf(vec3.z) || Maths::IsNaN(vec3.x) || Maths::IsNaN(vec3.y) || Maths::IsNaN(vec3.z) + void Mesh::GenerateTangentsAndBitangents(Vertex* vertices, uint32_t vertexCount, uint32_t* indices, uint32_t numIndices) { for(uint32_t i = 0; i < vertexCount; i++) @@ -150,7 +167,11 @@ namespace Lumos glm::vec2 deltaUV1 = uv1 - uv0; glm::vec2 deltaUV2 = uv2 - uv0; - float f = 1.0f / (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y); + float den = (deltaUV1.x * deltaUV2.y - deltaUV2.x * deltaUV1.y); + if(den < Maths::M_EPSILON) + den = 1.0f; + + float f = 1.0f / den; glm::vec3 tangent = f * (deltaUV2.y * edge1 - deltaUV1.y * edge2); glm::vec3 bitangent = f * (-deltaUV2.x * edge1 + deltaUV1.x * edge2); @@ -168,12 +189,18 @@ namespace Lumos // Normalize the tangent and bitangent vectors for(uint32_t i = 0; i < vertexCount; i++) { - vertices[i].Tangent = glm::normalize(vertices[i].Tangent); - vertices[i].Bitangent = glm::normalize(vertices[i].Bitangent); - - LUMOS_ASSERT(!Maths::IsInf(vertices[i].Tangent.x) && !Maths::IsInf(vertices[i].Tangent.y) && !Maths::IsInf(vertices[i].Tangent.z)); - LUMOS_ASSERT(!Maths::IsInf(vertices[i].Bitangent.x) && !Maths::IsInf(vertices[i].Bitangent.y) && !Maths::IsInf(vertices[i].Bitangent.z)); - LUMOS_ASSERT(!Maths::IsInf(vertices[i].Normal.x) && !Maths::IsInf(vertices[i].Normal.y) && !Maths::IsInf(vertices[i].Normal.z)); + if(glm::length2(vertices[i].Tangent) > Maths::M_EPSILON) + vertices[i].Tangent = glm::normalize(vertices[i].Tangent); + else + vertices[i].Tangent = glm::vec3(0.0f); + + if(glm::length2(vertices[i].Tangent) > Maths::M_EPSILON) + vertices[i].Bitangent = glm::normalize(vertices[i].Bitangent); + else + vertices[i].Bitangent = glm::vec3(0.0f); + + LUMOS_ASSERT(!CHECK_VEC3(vertices[i].Tangent)); + LUMOS_ASSERT(!CHECK_VEC3(vertices[i].Bitangent)); } } diff --git a/Lumos/Source/Lumos/Graphics/Mesh.h b/Lumos/Source/Lumos/Graphics/Mesh.h index 89e3cd26..df74bf6a 100644 --- a/Lumos/Source/Lumos/Graphics/Mesh.h +++ b/Lumos/Source/Lumos/Graphics/Mesh.h @@ -75,7 +75,7 @@ namespace Lumos public: Mesh(); Mesh(const Mesh& mesh); - Mesh(const std::vector& indices, const std::vector& vertices, float optimiseThreshold = 0.95f); + Mesh(const std::vector& indices, const std::vector& vertices, bool optimise = false, float optimiseThreshold = 0.95f); virtual ~Mesh(); const SharedPtr& GetVertexBuffer() const { return m_VertexBuffer; } diff --git a/Lumos/Source/Lumos/Graphics/Model.cpp b/Lumos/Source/Lumos/Graphics/Model.cpp index fd978d4d..b88ff2d4 100644 --- a/Lumos/Source/Lumos/Graphics/Model.cpp +++ b/Lumos/Source/Lumos/Graphics/Model.cpp @@ -2,7 +2,15 @@ #include "Model.h" #include "Mesh.h" #include "Core/StringUtilities.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" + +#include +#include +#include +#include +#include +#include +#include namespace Lumos::Graphics { @@ -27,11 +35,15 @@ namespace Lumos::Graphics m_Meshes.push_back(SharedPtr(CreatePrimative(type))); } + Model::~Model() + { + } + void Model::LoadModel(const std::string& path) { LUMOS_PROFILE_FUNCTION(); std::string physicalPath; - if(!Lumos::VFS::Get().ResolvePhysicalPath(path, physicalPath)) + if(!Lumos::FileSystem::Get().ResolvePhysicalPath(path, physicalPath)) { LUMOS_LOG_INFO("Failed to load Model - {0}", path); return; diff --git a/Lumos/Source/Lumos/Graphics/Model.h b/Lumos/Source/Lumos/Graphics/Model.h index 77961a61..0f7d7c89 100644 --- a/Lumos/Source/Lumos/Graphics/Model.h +++ b/Lumos/Source/Lumos/Graphics/Model.h @@ -2,17 +2,18 @@ #include "MeshFactory.h" #include "Mesh.h" #include "Material.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/Asset.h" #include -#include -#include -#include -#include -#include -#include -#include +namespace ozz +{ + namespace animation + { + class Skeleton; + class Animation; + } +} namespace Lumos { @@ -26,7 +27,7 @@ namespace Lumos Model(const SharedPtr& mesh, PrimitiveType type); Model(PrimitiveType type); - ~Model() = default; + ~Model(); std::vector>& GetMeshesRef() { return m_Meshes; } const std::vector>& GetMeshes() const { return m_Meshes; } @@ -38,7 +39,7 @@ namespace Lumos if(m_Meshes.size() > 0) { std::string newPath; - VFS::Get().AbsoulePathToVFS(m_FilePath, newPath); + FileSystem::Get().AbsolutePathToFileSystem(m_FilePath, newPath); auto material = std::unique_ptr(m_Meshes.front()->GetMaterial().get()); archive(cereal::make_nvp("PrimitiveType", m_PrimitiveType), cereal::make_nvp("FilePath", newPath), cereal::make_nvp("Material", material)); diff --git a/Lumos/Source/Lumos/Graphics/ModelLoader/FBXLoader.cpp b/Lumos/Source/Lumos/Graphics/ModelLoader/FBXLoader.cpp index 17713023..82045c49 100644 --- a/Lumos/Source/Lumos/Graphics/ModelLoader/FBXLoader.cpp +++ b/Lumos/Source/Lumos/Graphics/ModelLoader/FBXLoader.cpp @@ -12,7 +12,7 @@ #include "Core/StringUtilities.h" #include "Utilities/AssetManager.h" -#include +#include // #define THREAD_MESH_LOADING //Can't use with opengl #ifdef THREAD_MESH_LOADING @@ -424,40 +424,40 @@ namespace Lumos::Graphics int i = args.jobIndex; #endif - const ofbx::Mesh* fbxMesh = (const ofbx::Mesh*)scene->getMesh(i); + const ofbx::Mesh* fbxMesh = (const ofbx::Mesh*)scene->getMesh(i); - meshes.push_back(fbxMesh); + meshes.push_back(fbxMesh); - const auto geometry = fbxMesh->getGeometry(); - const auto trianglesCount = geometry->getVertexCount() / 3; - - if(IsMeshInvalid(fbxMesh)) - continue; - - if (fbxMesh->getMaterialCount() < 2 || !geometry->getMaterials()) - { - m_Meshes.push_back(LoadMesh(fbxMesh, 0, trianglesCount - 1)); - } - else + const auto geometry = fbxMesh->getGeometry(); + const auto trianglesCount = geometry->getVertexCount() / 3; + + if(IsMeshInvalid(fbxMesh)) + continue; + + if(fbxMesh->getMaterialCount() < 2 || !geometry->getMaterials()) + { + m_Meshes.push_back(LoadMesh(fbxMesh, 0, trianglesCount - 1)); + } + else + { + // Create mesh for each material + + const auto materials = geometry->getMaterials(); + int32_t rangeStart = 0; + int32_t rangeStartMaterial = materials[rangeStart]; + for(int32_t triangleIndex = 1; triangleIndex < trianglesCount; triangleIndex++) { - // Create mesh for each material - - const auto materials = geometry->getMaterials(); - int32_t rangeStart = 0; - int32_t rangeStartMaterial = materials[rangeStart]; - for (int32_t triangleIndex = 1; triangleIndex < trianglesCount; triangleIndex++) + if(rangeStartMaterial != materials[triangleIndex]) { - if (rangeStartMaterial != materials[triangleIndex]) - { - m_Meshes.push_back(LoadMesh(fbxMesh, rangeStart, triangleIndex - 1)); - - // Start a new range - rangeStart = triangleIndex; - rangeStartMaterial = materials[triangleIndex]; - } + m_Meshes.push_back(LoadMesh(fbxMesh, rangeStart, triangleIndex - 1)); + + // Start a new range + rangeStart = triangleIndex; + rangeStartMaterial = materials[triangleIndex]; } - m_Meshes.push_back(LoadMesh(fbxMesh, rangeStart, trianglesCount - 1)); - } } + } + m_Meshes.push_back(LoadMesh(fbxMesh, rangeStart, trianglesCount - 1)); + } } #ifdef THREAD_MESH_LOADING ); System::JobSystem::Wait(ctx); diff --git a/Lumos/Source/Lumos/Graphics/ModelLoader/GLTFLoader.cpp b/Lumos/Source/Lumos/Graphics/ModelLoader/GLTFLoader.cpp index 73406443..12e3d24a 100644 --- a/Lumos/Source/Lumos/Graphics/ModelLoader/GLTFLoader.cpp +++ b/Lumos/Source/Lumos/Graphics/ModelLoader/GLTFLoader.cpp @@ -19,6 +19,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include #define TINYGLTF_IMPLEMENTATION #define TINYGLTF_USE_CPP14 @@ -28,6 +34,7 @@ #define TINYGLTF_NOEXCEPTION #endif #include +#include #include @@ -137,8 +144,49 @@ namespace Lumos::Graphics params = Graphics::TextureDesc(GetFilter(imageAndSampler.Sampler->minFilter), GetFilter(imageAndSampler.Sampler->magFilter), GetWrapMode(imageAndSampler.Sampler->wrapS)); else LUMOS_LOG_WARN("MISSING SAMPLER"); - Graphics::Texture2D* texture2D = Graphics::Texture2D::CreateFromSource(imageAndSampler.Image->width, imageAndSampler.Image->height, imageAndSampler.Image->image.data(), params); + + uint32_t texWidth = imageAndSampler.Image->width; + uint32_t texHeight = imageAndSampler.Image->height; + uint8_t* pixels = imageAndSampler.Image->image.data(); + + uint32_t maxWidth, maxHeight; + GetMaxImageDimensions(maxWidth, maxHeight); + bool freeData = false; + + if(maxWidth > 0 && maxHeight > 0 && (texWidth > maxWidth || texHeight > maxHeight)) + { + uint32_t texWidthOld = imageAndSampler.Image->width; + uint32_t texHeightOld = imageAndSampler.Image->height; + + float aspectRatio = static_cast(texWidth) / static_cast(texHeight); + if(texWidth > maxWidth) + { + texWidth = maxWidth; + texHeight = static_cast(maxWidth / aspectRatio); + } + if(texHeight > maxHeight) + { + texHeight = maxHeight; + texWidth = static_cast(maxHeight * aspectRatio); + } + + // Resize the image using stbir (a simple image resizing library) + int resizedChannels = 4; // RGBA format + stbi_uc* resizedPixels = (stbi_uc*)malloc(texWidth * texHeight * resizedChannels); + stbir_resize_uint8(pixels, texWidthOld, texHeightOld, 0, resizedPixels, texWidth, texHeight, 0, resizedChannels); + + // free(pixels); // Free the original image + pixels = resizedPixels; + freeData = true; + } + + Graphics::Texture2D* texture2D = Graphics::Texture2D::CreateFromSource(texWidth, texHeight, pixels, params); loadedTextures.push_back(SharedPtr(texture2D ? texture2D : nullptr)); + if(freeData) + free(pixels); + + imageAndSampler.Image->image.clear(); + imageAndSampler.Image->image.shrink_to_fit(); } } @@ -196,6 +244,8 @@ namespace Lumos::Graphics if(baseColourFactor != mat.values.end()) { properties.albedoColour = glm::vec4((float)baseColourFactor->second.ColorFactor()[0], (float)baseColourFactor->second.ColorFactor()[1], (float)baseColourFactor->second.ColorFactor()[2], 1.0f); + if(baseColourFactor->second.ColorFactor().size() > 3) + properties.albedoColour.w = baseColourFactor->second.ColorFactor()[3]; } // Extensions @@ -309,6 +359,7 @@ namespace Lumos::Graphics for(auto p = 0; p < positionCount; ++p) { vertices[p].Position = parentTransform.GetWorldMatrix() * Maths::ToVector4(positions[p]); + LUMOS_ASSERT(!glm::isinf(vertices[p].Position.x) && !glm::isinf(vertices[p].Position.y) && !glm::isinf(vertices[p].Position.z) && !glm::isnan(vertices[p].Position.x) && !glm::isnan(vertices[p].Position.y) && !glm::isnan(vertices[p].Position.z)); } } @@ -320,9 +371,10 @@ namespace Lumos::Graphics Maths::Vector3Simple* normals = reinterpret_cast(data.data()); for(auto p = 0; p < normalCount; ++p) { - //vertices[p].Normal = (parentTransform.GetWorldMatrix() * Maths::ToVector4(normals[p])); + // vertices[p].Normal = (parentTransform.GetWorldMatrix() * Maths::ToVector4(normals[p])); vertices[p].Normal = glm::transpose(glm::inverse(glm::mat3(parentTransform.GetWorldMatrix()))) * (glm::vec3(Maths::ToVector4(normals[p]))); vertices[p].Normal = glm::normalize(vertices[p].Normal); + LUMOS_ASSERT(!glm::isinf(vertices[p].Normal.x) && !glm::isinf(vertices[p].Normal.y) && !glm::isinf(vertices[p].Normal.z) && !glm::isnan(vertices[p].Normal.x) && !glm::isnan(vertices[p].Normal.y) && !glm::isnan(vertices[p].Normal.z)); } } @@ -359,7 +411,9 @@ namespace Lumos::Graphics Maths::Vector3Simple* uvs = reinterpret_cast(data.data()); for(auto p = 0; p < uvCount; ++p) { - vertices[p].Tangent = glm::normalize(parentTransform.GetWorldMatrix() * ToVector4(uvs[p])); + vertices[p].Tangent = glm::transpose(glm::inverse(glm::mat3(parentTransform.GetWorldMatrix()))) * (glm::vec3(Maths::ToVector4(uvs[p]))); + vertices[p].Tangent = glm::normalize(vertices[p].Tangent); + LUMOS_ASSERT(!glm::isinf(vertices[p].Tangent.x) && !glm::isinf(vertices[p].Tangent.y) && !glm::isinf(vertices[p].Tangent.z) && !glm::isnan(vertices[p].Tangent.x) && !glm::isnan(vertices[p].Tangent.y) && !glm::isnan(vertices[p].Tangent.z)); } } @@ -370,7 +424,9 @@ namespace Lumos::Graphics Maths::Vector3Simple* uvs = reinterpret_cast(data.data()); for(auto p = 0; p < uvCount; ++p) { - vertices[p].Bitangent = glm::normalize(parentTransform.GetWorldMatrix() * ToVector4(uvs[p])); + vertices[p].Bitangent = glm::transpose(glm::inverse(glm::mat3(parentTransform.GetWorldMatrix()))) * (glm::vec3(Maths::ToVector4(uvs[p]))); + vertices[p].Bitangent = glm::normalize(vertices[p].Bitangent); + LUMOS_ASSERT(!glm::isinf(vertices[p].Bitangent.x) && !glm::isinf(vertices[p].Bitangent.y) && !glm::isinf(vertices[p].Bitangent.z) && !glm::isnan(vertices[p].Bitangent.x) && !glm::isnan(vertices[p].Bitangent.y) && !glm::isnan(vertices[p].Bitangent.z)); } } } diff --git a/Lumos/Source/Lumos/Graphics/RHI/Definitions.h b/Lumos/Source/Lumos/Graphics/RHI/Definitions.h index 000305d4..2e977722 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Definitions.h +++ b/Lumos/Source/Lumos/Graphics/RHI/Definitions.h @@ -323,6 +323,30 @@ namespace Lumos std::vector m_Members; }; + enum class CubeFace + { + PositiveX = 0, + NegativeX, + PositiveY, + NegativeY, + PositiveZ, + NegativeZ + }; + + struct FramebufferDesc + { + uint32_t width = 0; + uint32_t height = 0; + uint32_t layer = 0; + uint32_t attachmentCount = 0; + uint32_t samples = 1; + int mipIndex = 0; + bool screenFBO = false; + Texture** attachments; + TextureType* attachmentTypes; + Graphics::RenderPass* renderPass; + }; + struct RenderPassDesc { Texture** attachments; @@ -332,6 +356,7 @@ namespace Lumos bool swapchainTarget = false; int cubeMapIndex = -1; int mipIndex = 0; + int samples = 1; std::string DebugName; }; @@ -341,7 +366,7 @@ namespace Lumos TextureFilter minFilter; TextureFilter magFilter; TextureWrap wrap; - uint16_t msaaLevel = 1; + uint16_t samples = 1; uint16_t flags = TextureFlags::Texture_CreateMips; bool srgb = false; bool generateMipMaps = true; @@ -353,7 +378,7 @@ namespace Lumos minFilter = TextureFilter::NEAREST; magFilter = TextureFilter::NEAREST; wrap = TextureWrap::REPEAT; - msaaLevel = 1; + samples = 1; } TextureDesc(RHIFormat format, TextureFilter minFilter, TextureFilter magFilter, TextureWrap wrap) diff --git a/Lumos/Source/Lumos/Graphics/RHI/Framebuffer.h b/Lumos/Source/Lumos/Graphics/RHI/Framebuffer.h index 1390479d..2693f5b3 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Framebuffer.h +++ b/Lumos/Source/Lumos/Graphics/RHI/Framebuffer.h @@ -6,30 +6,6 @@ namespace Lumos { namespace Graphics { - enum class CubeFace - { - PositiveX = 0, - NegativeX, - PositiveY, - NegativeY, - PositiveZ, - NegativeZ - }; - - struct FramebufferDesc - { - uint32_t width; - uint32_t height; - uint32_t layer = 0; - uint32_t attachmentCount; - uint32_t msaaLevel; - int mipIndex = 0; - bool screenFBO = false; - Texture** attachments; - TextureType* attachmentTypes; - Graphics::RenderPass* renderPass; - }; - class LUMOS_EXPORT Framebuffer { public: diff --git a/Lumos/Source/Lumos/Graphics/RHI/Pipeline.h b/Lumos/Source/Lumos/Graphics/RHI/Pipeline.h index 54408536..c481b050 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Pipeline.h +++ b/Lumos/Source/Lumos/Graphics/RHI/Pipeline.h @@ -32,8 +32,9 @@ namespace Lumos float depthBiasSlopeFactor = 0.0f; int cubeMapIndex = 0; int mipIndex = 0; + int samples = 1; - std::string DebugName; + const char* DebugName = nullptr; }; class LUMOS_EXPORT Pipeline diff --git a/Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp b/Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp index db65c378..9ac4f139 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp +++ b/Lumos/Source/Lumos/Graphics/RHI/Renderer.cpp @@ -4,6 +4,7 @@ #include "Graphics/Mesh.h" #include "Core/Application.h" #include "Utilities/AssetManager.h" +#include "Core/OS/Window.h" #include "CompiledSPV/Headers/Shadowvertspv.hpp" #include "CompiledSPV/Headers/Shadowfragspv.hpp" @@ -60,13 +61,13 @@ namespace Lumos Renderer* Renderer::s_Instance = nullptr; - void Renderer::Init(bool loadEmbeddedShaders) + void Renderer::Init(bool loadEmbeddedShaders, const std::string& engineShaderPath) { LUMOS_ASSERT(CreateFunc, "No Renderer Create Function"); LUMOS_PROFILE_FUNCTION(); s_Instance = CreateFunc(); s_Instance->InitInternal(); - s_Instance->LoadEngineShaders(loadEmbeddedShaders); + s_Instance->LoadEngineShaders(loadEmbeddedShaders, engineShaderPath); } void Renderer::Release() @@ -76,7 +77,7 @@ namespace Lumos s_Instance = nullptr; } - void Renderer::LoadEngineShaders(bool loadEmbeddedShaders) + void Renderer::LoadEngineShaders(bool loadEmbeddedShaders, const std::string& engineShaderPath) { auto shaderLibrary = Application::Get().GetShaderLibrary(); if(loadEmbeddedShaders) @@ -116,44 +117,50 @@ namespace Lumos else { LUMOS_LOG_INFO("Loading shaders - files"); - shaderLibrary->AddResource("Skybox", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Skybox.shader"))); - shaderLibrary->AddResource("ForwardPBR", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/ForwardPBR.shader"))); - shaderLibrary->AddResource("Shadow", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Shadow.shader"))); - shaderLibrary->AddResource("Batch2DPoint", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Batch2DPoint.shader"))); - shaderLibrary->AddResource("Batch2DLine", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Batch2DLine.shader"))); - shaderLibrary->AddResource("Batch2D", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Batch2D.shader"))); - shaderLibrary->AddResource("FinalPass", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/ScreenPass.shader"))); - shaderLibrary->AddResource("Grid", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Grid.shader"))); - shaderLibrary->AddResource("CreateEnvironmentMap", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/CreateEnvironmentMap.shader"))); - shaderLibrary->AddResource("EnvironmentIrradiance", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/EnvironmentIrradiance.shader"))); - shaderLibrary->AddResource("EnvironmentMipFilter", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/EnvironmentMipFilter.shader"))); - - shaderLibrary->AddResource("FXAA", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/FXAA.shader"))); + shaderLibrary->AddResource("Skybox", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Skybox.shader"))); + shaderLibrary->AddResource("ForwardPBR", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/ForwardPBR.shader"))); + shaderLibrary->AddResource("Shadow", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Shadow.shader"))); + shaderLibrary->AddResource("Batch2DPoint", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Batch2DPoint.shader"))); + shaderLibrary->AddResource("Batch2DLine", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Batch2DLine.shader"))); + shaderLibrary->AddResource("Batch2D", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Batch2D.shader"))); + shaderLibrary->AddResource("FinalPass", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/ScreenPass.shader"))); + shaderLibrary->AddResource("Grid", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Grid.shader"))); + shaderLibrary->AddResource("CreateEnvironmentMap", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/CreateEnvironmentMap.shader"))); + shaderLibrary->AddResource("EnvironmentIrradiance", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/EnvironmentIrradiance.shader"))); + shaderLibrary->AddResource("EnvironmentMipFilter", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/EnvironmentMipFilter.shader"))); + + shaderLibrary->AddResource("FXAA", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/FXAA.shader"))); if(Renderer::GetCapabilities().SupportCompute) - shaderLibrary->AddResource("FXAAComp", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/FXAACompute.shader"))); - - shaderLibrary->AddResource("Debanding", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Debanding.shader"))); - shaderLibrary->AddResource("FilmicGrain", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/FilmicGrain.shader"))); - // shaderLibrary->AddResource("Outline", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Outline.shader"))); - shaderLibrary->AddResource("ChromaticAberation", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/ChromaticAberation.shader"))); - shaderLibrary->AddResource("DepthPrePass", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/DepthPrePass.shader"))); - shaderLibrary->AddResource("ToneMapping", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/ToneMapping.shader"))); - shaderLibrary->AddResource("Bloom", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Bloom.shader"))); + shaderLibrary->AddResource("FXAAComp", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/FXAACompute.shader"))); + + shaderLibrary->AddResource("Debanding", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Debanding.shader"))); + shaderLibrary->AddResource("FilmicGrain", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/FilmicGrain.shader"))); + // shaderLibrary->AddResource("Outline", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Outline.shader"))); + shaderLibrary->AddResource("ChromaticAberation", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/ChromaticAberation.shader"))); + shaderLibrary->AddResource("DepthPrePass", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/DepthPrePass.shader"))); + shaderLibrary->AddResource("ToneMapping", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/ToneMapping.shader"))); + shaderLibrary->AddResource("Bloom", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Bloom.shader"))); if(Renderer::GetCapabilities().SupportCompute) - shaderLibrary->AddResource("BloomComp", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/BloomComp.shader"))); - shaderLibrary->AddResource("DepthOfField", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/DepthOfField.shader"))); - - shaderLibrary->AddResource("BRDFLUT", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/BRDFLUT.shader"))); - shaderLibrary->AddResource("Text", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Text.shader"))); - shaderLibrary->AddResource("SSAO", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/SSAO.shader"))); - shaderLibrary->AddResource("SSAOBlur", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/SSAOBlur.shader"))); - shaderLibrary->AddResource("Sharpen", SharedPtr(Graphics::Shader::CreateFromFile("//CoreShaders/Sharpen.shader"))); + shaderLibrary->AddResource("BloomComp", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/BloomComp.shader"))); + shaderLibrary->AddResource("DepthOfField", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/DepthOfField.shader"))); + + shaderLibrary->AddResource("BRDFLUT", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/BRDFLUT.shader"))); + shaderLibrary->AddResource("Text", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Text.shader"))); + shaderLibrary->AddResource("SSAO", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/SSAO.shader"))); + shaderLibrary->AddResource("SSAOBlur", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/SSAOBlur.shader"))); + shaderLibrary->AddResource("Sharpen", SharedPtr(Graphics::Shader::CreateFromFile(engineShaderPath + "Shaders/Sharpen.shader"))); } } - GraphicsContext* Renderer::GetGraphicsContext() { return Application::Get().GetWindow()->GetGraphicsContext(); } - SwapChain* Renderer::GetMainSwapChain() { return Application::Get().GetWindow()->GetSwapChain(); } + GraphicsContext* Renderer::GetGraphicsContext() + { + return Application::Get().GetWindow()->GetGraphicsContext(); + } + SwapChain* Renderer::GetMainSwapChain() + { + return Application::Get().GetWindow()->GetSwapChain(); + } void Renderer::DrawMesh(CommandBuffer* commandBuffer, Graphics::Pipeline* pipeline, Graphics::Mesh* mesh) { diff --git a/Lumos/Source/Lumos/Graphics/RHI/Renderer.h b/Lumos/Source/Lumos/Graphics/RHI/Renderer.h index 376e03d7..4ebe06c9 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Renderer.h +++ b/Lumos/Source/Lumos/Graphics/RHI/Renderer.h @@ -1,5 +1,4 @@ #pragma once -#include "Core/OS/Window.h" #include "Graphics/RHI/Definitions.h" #include @@ -10,6 +9,7 @@ namespace Lumos class Mesh; class Pipeline; class DescriptorSet; + class SwapChain; struct RenderAPICapabilities { @@ -31,9 +31,9 @@ namespace Lumos Renderer() = default; virtual ~Renderer() = default; - static void Init(bool loadEmbeddedShaders = true); + static void Init(bool loadEmbeddedShaders = true, const std::string& engineShaderPath = ""); static void Release(); - void LoadEngineShaders(bool loadEmbeddedShaders); + void LoadEngineShaders(bool loadEmbeddedShaders, const std::string& engineShaderPath); virtual void InitInternal() = 0; virtual void Begin() = 0; virtual void OnResize(uint32_t width, uint32_t height) = 0; diff --git a/Lumos/Source/Lumos/Graphics/RHI/Shader.cpp b/Lumos/Source/Lumos/Graphics/RHI/Shader.cpp index e7f1e409..93d76017 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/Shader.cpp +++ b/Lumos/Source/Lumos/Graphics/RHI/Shader.cpp @@ -2,7 +2,7 @@ #include "Shader.h" #include "Graphics/RHI/GraphicsContext.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include diff --git a/Lumos/Source/Lumos/Graphics/RHI/SwapChain.h b/Lumos/Source/Lumos/Graphics/RHI/SwapChain.h index 28e17a18..2e99d34c 100644 --- a/Lumos/Source/Lumos/Graphics/RHI/SwapChain.h +++ b/Lumos/Source/Lumos/Graphics/RHI/SwapChain.h @@ -1,5 +1,6 @@ #pragma once +#define MAX_FRAMES_FLIGHT 3 namespace Lumos { class Window; diff --git a/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.cpp b/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.cpp index 618281b0..2b7ae84a 100644 --- a/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.cpp +++ b/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.cpp @@ -14,6 +14,7 @@ #include "Graphics/Font.h" #include "Graphics/MSDFData.h" #include "Core/JobSystem.h" +#include "Core/OS/Window.h" #include "Maths/BoundingSphere.h" #include "Events/ApplicationEvent.h" @@ -977,11 +978,31 @@ namespace Lumos::Graphics { pipelineDesc.depthTarget = m_ForwardData.m_DepthTexture; } +#ifndef LUMOS_PRODUCTION + static const char* debugName0 = "Forward PBR Transparent DepthTested"; + static const char* debugName1 = "Forward PBR DepthTested"; + static const char* debugName2 = "Forward PBR Transparent"; + static const char* debugName3 = "Forward PBR"; - pipelineDesc.DebugName = fmt::format("Forward PBR {0} {1}", pipelineDesc.transparencyEnabled ? "Transparent" : "", pipelineDesc.depthTarget ? "DepthTested" : ""); + if(pipelineDesc.depthTarget && pipelineDesc.transparencyEnabled) + { + pipelineDesc.DebugName = debugName0; + } + else if(pipelineDesc.depthTarget) + { + pipelineDesc.DebugName = debugName1; + } + else if(pipelineDesc.transparencyEnabled) + { + pipelineDesc.DebugName = debugName2; + } + else + { + pipelineDesc.DebugName = debugName3; + } +#endif command.pipeline = Graphics::Pipeline::Get(pipelineDesc); - m_ForwardData.m_CommandQueue.push_back(command); } } @@ -1065,10 +1086,10 @@ namespace Lumos::Graphics LUMOS_PROFILE_FUNCTION(); LUMOS_PROFILE_GPU("Render Passes"); - auto& sceneRenderSettings = Application::Get().GetCurrentScene()->GetSettings().RenderSettings; + auto& sceneRenderSettings = Application::Get().GetCurrentScene()->GetSettings().RenderSettings; + sceneRenderSettings.SSAOEnabled = false; // Disabled while broken Renderer::GetRenderer()->ClearRenderTarget(m_MainTexture, Renderer::GetMainSwapChain()->GetCurrentCommandBuffer()); - sceneRenderSettings.SSAOEnabled = false; if(sceneRenderSettings.SSAOEnabled) Renderer::GetRenderer()->ClearRenderTarget(m_NormalTexture, Renderer::GetMainSwapChain()->GetCurrentCommandBuffer()); @@ -1300,7 +1321,7 @@ namespace Lumos::Graphics float cascadeRadius[SHADOWMAP_MAX]; float nearClip = m_Camera->GetNear(); - float farClip = m_Camera->GetFar(); + float farClip = m_ShadowData.m_MaxShadowDistance * 1.2f; // m_Camera->GetFar(); float clipRange = farClip - nearClip; float minZ = nearClip; @@ -1318,10 +1339,11 @@ namespace Lumos::Graphics cascadeSplits[i] = (d - nearClip) / clipRange; } - cascadeSplits[3] = 0.35f; - float lastSplitDist = 0.0f; + cascadeSplits[3] = 0.35f; + float lastSplitDist = 0.0f; + glm::mat4 CameraProj = glm::perspective(glm::radians(m_Camera->GetFOV()), m_Camera->GetAspectRatio(), nearClip, farClip); - const glm::mat4 invCam = glm::inverse(m_Camera->GetProjectionMatrix() * glm::inverse(m_CameraTransform->GetWorldMatrix())); + const glm::mat4 invCam = glm::inverse(CameraProj * glm::inverse(m_CameraTransform->GetWorldMatrix())); for(uint32_t i = 0; i < m_ShadowData.m_ShadowMapNum; i++) { @@ -2077,7 +2099,7 @@ namespace Lumos::Graphics { { pipelineDesc.mipIndex = i; - pipelineDesc.DebugName = fmt::format("Bloom-Downsample{0}", i); + pipelineDesc.DebugName = "Bloom-Downsample"; // fmt::format("Bloom-Downsample{0}", i); if(!m_SupportCompute) pipelineDesc.colourTargets[0] = m_BloomTexture1; bloomComputePushConstants.Params2.z = (float)m_BloomTexture1->GetWidth(i); @@ -2186,7 +2208,7 @@ namespace Lumos::Graphics bloomComputePushConstants.Params2.w = (float)m_BloomTexture2->GetHeight(mips - 2); pipelineDesc.mipIndex = mips - 2; - pipelineDesc.DebugName = fmt::format("Bloom-Upsample{0}", mips - 2); + pipelineDesc.DebugName = "Bloom-Upsample"; // fmt::format("Bloom-Upsample{0}", mips - 2); if(!m_SupportCompute) pipelineDesc.colourTargets[0] = m_BloomTexture2; @@ -2246,7 +2268,7 @@ namespace Lumos::Graphics bloomComputePushConstants.Params2.w = (float)m_BloomTexture2->GetHeight(mip); pipelineDesc.mipIndex = mip; - pipelineDesc.DebugName = fmt::format("Bloom-Upsample{0}", mip); + pipelineDesc.DebugName = "Bloom-Upsample"; // fmt::format("Bloom-Upsample{0}", mip); if(evenMip) { diff --git a/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.h b/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.h index 6265739a..64a5e202 100644 --- a/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.h +++ b/Lumos/Source/Lumos/Graphics/Renderers/RenderPasses.h @@ -9,6 +9,7 @@ namespace Lumos class Scene; class TimeStep; class WindowResizeEvent; + class Event; namespace Maths { diff --git a/Lumos/Source/Lumos/Graphics/Sprite.h b/Lumos/Source/Lumos/Graphics/Sprite.h index 9b1d2cfe..ef7dbb71 100644 --- a/Lumos/Source/Lumos/Graphics/Sprite.h +++ b/Lumos/Source/Lumos/Graphics/Sprite.h @@ -1,6 +1,6 @@ #pragma once #include "Renderable2D.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Scene/Serialisation.h" #include "Maths/MathsSerialisation.h" @@ -36,7 +36,7 @@ namespace Lumos std::string newPath = ""; if(m_Texture) { - VFS::Get().AbsoulePathToVFS(m_Texture->GetFilepath(), newPath); + FileSystem::Get().AbsolutePathToFileSystem(m_Texture->GetFilepath(), newPath); } archive(cereal::make_nvp("TexturePath", newPath), diff --git a/Lumos/Source/Lumos/ImGui/ImGuiManager.cpp b/Lumos/Source/Lumos/ImGui/ImGuiManager.cpp index 50333d68..3a238aa7 100644 --- a/Lumos/Source/Lumos/ImGui/ImGuiManager.cpp +++ b/Lumos/Source/Lumos/ImGui/ImGuiManager.cpp @@ -4,7 +4,7 @@ #include "Core/OS/Window.h" #include "Core/Application.h" #include "Graphics/RHI/IMGUIRenderer.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "ImGuiUtilities.h" #include "Maths/MathsUtilities.h" #include "IconsMaterialDesignIcons.h" @@ -305,10 +305,10 @@ namespace Lumos io.Fonts->AddFontFromMemoryCompressedTTF(RobotoBold_compressed_data, RobotoBold_compressed_size, m_FontSize + 2.0f, &icons_config, ranges); io.Fonts->AddFontFromMemoryCompressedTTF(RobotoRegular_compressed_data, RobotoRegular_compressed_size, m_FontSize * 0.8f, &icons_config, ranges); - AddIconFont(); + // AddIconFont(); - io.Fonts->AddFontDefault(); - AddIconFont(); + // io.Fonts->AddFontDefault(); + // AddIconFont(); io.Fonts->TexGlyphPadding = 1; for(int n = 0; n < io.Fonts->ConfigData.Size; n++) diff --git a/Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp b/Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp index 6c4af348..357cc663 100644 --- a/Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp +++ b/Lumos/Source/Lumos/ImGui/ImGuiUtilities.cpp @@ -13,6 +13,7 @@ #endif #include +#include namespace Lumos { @@ -248,12 +249,21 @@ namespace Lumos { ImGui::Text("%.2f", value); } - else + else if((int)flags & (int)PropertyFlag::DragValue) { - // std::string id = "##" + name; if(ImGui::DragFloat(GenerateID(), &value, delta, min, max)) updated = true; } + else if((int)flags & (int)PropertyFlag::SliderValue) + { + if(ImGui::SliderFloat(GenerateID(), &value, min, max)) + updated = true; + } + else + { + if(ImGui::InputFloat(GenerateID(), &value, delta)) + updated = true; + } ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -650,7 +660,7 @@ namespace Lumos auto drawList = ImGui::GetWindowDrawList(); ImVec2 pos = ImGui::GetCursorPos(); - ImVec2 size((radius)*2, (radius + style.FramePadding.y) * 2); + ImVec2 size((radius) * 2, (radius + style.FramePadding.y) * 2); const ImRect bb(pos, ImVec2(pos.x + size.x, pos.y + size.y)); ImGui::ItemSize(bb, style.FramePadding.y); diff --git a/Lumos/Source/Lumos/ImGui/ImGuiUtilities.h b/Lumos/Source/Lumos/ImGui/ImGuiUtilities.h index da5bb854..d6ed789a 100644 --- a/Lumos/Source/Lumos/ImGui/ImGuiUtilities.h +++ b/Lumos/Source/Lumos/ImGui/ImGuiUtilities.h @@ -4,6 +4,7 @@ #include #include #include +#include namespace Lumos { diff --git a/Lumos/Source/Lumos/Maths/Transform.cpp b/Lumos/Source/Lumos/Maths/Transform.cpp index f73cf76f..d703203b 100644 --- a/Lumos/Source/Lumos/Maths/Transform.cpp +++ b/Lumos/Source/Lumos/Maths/Transform.cpp @@ -44,7 +44,7 @@ namespace Lumos void Transform::UpdateMatrices() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); // m_LocalMatrix = // m_WorldMatrix = m_ParentMatrix * m_LocalMatrix; @@ -104,7 +104,7 @@ namespace Lumos { LUMOS_PROFILE_FUNCTION_LOW(); // if(m_Dirty) - UpdateMatrices(); + // UpdateMatrices(); return m_WorldMatrix; } @@ -121,7 +121,7 @@ namespace Lumos const glm::vec3 Transform::GetWorldPosition() { // if(m_Dirty) - UpdateMatrices(); + // UpdateMatrices(); return m_WorldMatrix[3]; } @@ -129,7 +129,7 @@ namespace Lumos const glm::quat Transform::GetWorldOrientation() { // if(m_Dirty) - UpdateMatrices(); + // UpdateMatrices(); return glm::toQuat(m_WorldMatrix); } diff --git a/Lumos/Source/Lumos/Physics/B2PhysicsEngine/B2PhysicsEngine.h b/Lumos/Source/Lumos/Physics/B2PhysicsEngine/B2PhysicsEngine.h index 5f08dc7e..4cf343ce 100644 --- a/Lumos/Source/Lumos/Physics/B2PhysicsEngine/B2PhysicsEngine.h +++ b/Lumos/Source/Lumos/Physics/B2PhysicsEngine/B2PhysicsEngine.h @@ -25,7 +25,7 @@ namespace Lumos void SetDefaults(); void OnUpdate(const TimeStep& timeStep, Scene* scene) override; - void OnInit() override {}; + bool OnInit() override { return true; }; void OnImGui() override; b2World* GetB2World() const diff --git a/Lumos/Source/Lumos/Physics/B2PhysicsEngine/RigidBody2D.cpp b/Lumos/Source/Lumos/Physics/B2PhysicsEngine/RigidBody2D.cpp index dbc1007a..30489f02 100644 --- a/Lumos/Source/Lumos/Physics/B2PhysicsEngine/RigidBody2D.cpp +++ b/Lumos/Source/Lumos/Physics/B2PhysicsEngine/RigidBody2D.cpp @@ -111,10 +111,10 @@ namespace Lumos } else if(params.shape == Shape::Custom) { - m_CustomShapePositions = params.custumShapePositions; + m_CustomShapePositions = params.customShapePositions; b2PolygonShape dynamicBox; - dynamicBox.Set((b2Vec2*)params.custumShapePositions.data(), int32(params.custumShapePositions.size())); + dynamicBox.Set((b2Vec2*)params.customShapePositions.data(), int32(params.customShapePositions.size())); if(params.isStatic) m_B2Body->CreateFixture(&dynamicBox, 0.0f); @@ -162,7 +162,7 @@ namespace Lumos params.shape = m_ShapeType; if(m_B2Body) params.position = glm::vec3(GetPosition(), 1.0f); - params.custumShapePositions = customPositions; + params.customShapePositions = customPositions; params.mass = m_Mass; params.scale = m_Scale; params.isStatic = m_Static; diff --git a/Lumos/Source/Lumos/Physics/B2PhysicsEngine/RigidBody2D.h b/Lumos/Source/Lumos/Physics/B2PhysicsEngine/RigidBody2D.h index f8ae8155..a061f971 100644 --- a/Lumos/Source/Lumos/Physics/B2PhysicsEngine/RigidBody2D.h +++ b/Lumos/Source/Lumos/Physics/B2PhysicsEngine/RigidBody2D.h @@ -33,7 +33,7 @@ namespace Lumos glm::vec3 scale; bool isStatic; Shape shape; - std::vector custumShapePositions; + std::vector customShapePositions; }; class LUMOS_EXPORT RigidBody2D @@ -95,7 +95,7 @@ namespace Lumos RigidBodyParameters params; float angle; glm::vec2 pos; - archive(cereal::make_nvp("Position", pos), cereal::make_nvp("Friction", m_Friction), cereal::make_nvp("Angle", angle), cereal::make_nvp("Static", m_Static), cereal::make_nvp("Mass", m_Mass), cereal::make_nvp("Scale", params.scale), cereal::make_nvp("Shape", m_ShapeType), cereal::make_nvp("CustomShapePos", params.custumShapePositions)); + archive(cereal::make_nvp("Position", pos), cereal::make_nvp("Friction", m_Friction), cereal::make_nvp("Angle", angle), cereal::make_nvp("Static", m_Static), cereal::make_nvp("Mass", m_Mass), cereal::make_nvp("Scale", params.scale), cereal::make_nvp("Shape", m_ShapeType), cereal::make_nvp("CustomShapePos", params.customShapePositions)); params.shape = m_ShapeType; params.position = glm::vec3(pos, 1.0f); Init(params); diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/Broadphase.h b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/Broadphase.h index 6155e44d..9c57fa8a 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/Broadphase.h +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/Broadphase.h @@ -14,8 +14,8 @@ namespace Lumos class LUMOS_EXPORT Broadphase { public: - virtual ~Broadphase() = default; - virtual void FindPotentialCollisionPairs(RigidBody3D** objects, uint32_t objectCount, std::vector& collisionPairs) = 0; - virtual void DebugDraw() = 0; + virtual ~Broadphase() = default; + virtual void FindPotentialCollisionPairs(RigidBody3D* rootObject, std::vector& collisionPairs) = 0; + virtual void DebugDraw() = 0; }; } diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.cpp index 4ff286fa..12dff65f 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.cpp @@ -14,63 +14,68 @@ namespace Lumos { } - void BruteForceBroadphase::FindPotentialCollisionPairs(RigidBody3D** objects, uint32_t objectCount, + void BruteForceBroadphase::FindPotentialCollisionPairs(RigidBody3D* rootObject, std::vector& collisionPairs) { LUMOS_PROFILE_FUNCTION(); - if(objectCount == 0) - return; - for(size_t i = 0; i < objectCount - 1; ++i) + RigidBody3D* current = rootObject; + while(current) { - for(size_t j = i + 1; j < objectCount; ++j) + if(current->GetCollisionShape()) { - RigidBody3D* obj1 = objects[i]; - RigidBody3D* obj2 = objects[j]; + RigidBody3D* current2 = rootObject; + { + while(current2) + { + if(current2->GetCollisionShape()) + { + RigidBody3D* obj1 = current; + RigidBody3D* obj2 = current2; - if(!obj1->GetCollisionShape() || !obj2->GetCollisionShape()) - continue; + // Skip pairs of two at objects at rest + if(obj1->GetIsAtRest() && obj2->GetIsAtRest()) + continue; - // Skip pairs of two at objects at rest - if(obj1->GetIsAtRest() && obj2->GetIsAtRest()) - continue; + // Skip pairs of two at static objects + if(obj1->GetIsStatic() && obj2->GetIsStatic()) + continue; - // Skip pairs of two at static objects - if(obj1->GetIsStatic() && obj2->GetIsStatic()) - continue; + // Skip pairs of one static and one at rest + if(obj1->GetIsAtRest() && obj2->GetIsStatic()) + continue; - // Skip pairs of one static and one at rest - if(obj1->GetIsAtRest() && obj2->GetIsStatic()) - continue; + if(obj1->GetIsStatic() && obj2->GetIsAtRest()) + continue; - if(obj1->GetIsStatic() && obj2->GetIsAtRest()) - continue; + CollisionPair pair; - CollisionPair pair; + if(obj1 < obj2) + { + pair.pObjectA = obj1; + pair.pObjectB = obj2; + } + else + { + pair.pObjectA = obj2; + pair.pObjectB = obj1; + } - if(obj1 < obj2) - { - pair.pObjectA = obj1; - pair.pObjectB = obj2; - } - else - { - pair.pObjectA = obj2; - pair.pObjectB = obj1; - } - - bool duplicate = false; - for(int i = 0; i < collisionPairs.size(); i++) - { - auto& pair2 = collisionPairs[i]; + bool duplicate = false; + for(int i = 0; i < collisionPairs.size(); i++) + { + auto& pair2 = collisionPairs[i]; - if(pair.pObjectA == pair2.pObjectA && pair.pObjectB == pair2.pObjectB) - { - duplicate = true; + if(pair.pObjectA == pair2.pObjectA && pair.pObjectB == pair2.pObjectB) + { + duplicate = true; + } + } + if(!duplicate) + collisionPairs.push_back(pair); + } } } - if(!duplicate) - collisionPairs.push_back(pair); } } } diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.h b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.h index 46f2b167..0052489b 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.h +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.h @@ -12,7 +12,7 @@ namespace Lumos explicit BruteForceBroadphase(const glm::vec3& axis = glm::vec3(0.0f)); virtual ~BruteForceBroadphase(); - void FindPotentialCollisionPairs(RigidBody3D** objects, uint32_t objectCount, std::vector& collisionPairs) override; + void FindPotentialCollisionPairs(RigidBody3D* rootObject, std::vector& collisionPairs) override; void DebugDraw() override; private: diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.cpp index 8cc64522..2e2febae 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.cpp @@ -7,10 +7,9 @@ namespace Lumos { - OctreeBroadphase::OctreeBroadphase(const size_t maxObjectsPerPartition, const size_t maxPartitionDepth, const SharedPtr& secondaryBroadphase) + OctreeBroadphase::OctreeBroadphase(const size_t maxObjectsPerPartition, const size_t maxPartitionDepth) : m_MaxObjectsPerPartition(maxObjectsPerPartition) , m_MaxPartitionDepth(maxPartitionDepth) - , m_SecondaryBroadphase(secondaryBroadphase) , m_Leaves() { m_NodePool[0].ChildCount = 0; @@ -22,7 +21,7 @@ namespace Lumos { } - void OctreeBroadphase::FindPotentialCollisionPairs(RigidBody3D** objects, uint32_t objectCount, + void OctreeBroadphase::FindPotentialCollisionPairs(RigidBody3D* rootObject, std::vector& collisionPairs) { LUMOS_PROFILE_FUNCTION(); @@ -35,17 +34,18 @@ namespace Lumos rootNode.Index = 0; rootNode.boundingBox = Maths::BoundingBox(); - for(uint32_t i = 0; i < objectCount; i++) + RigidBody3D* current = rootObject; + while(current) { - auto physicsObject = objects[i]; - - if(physicsObject && physicsObject->GetCollisionShape()) + if(current->GetCollisionShape()) { LUMOS_PROFILE_SCOPE_LOW("Merge Bounding box and add Physics Object"); - rootNode.boundingBox.Merge(physicsObject->GetWorldSpaceAABB()); - rootNode.PhysicsObjects[rootNode.PhysicsObjectCount] = physicsObject; + rootNode.boundingBox.Merge(current->GetWorldSpaceAABB()); + rootNode.PhysicsObjects[rootNode.PhysicsObjectCount] = current; rootNode.PhysicsObjectCount++; } + + current = current->m_Next; } m_CurrentPoolIndex++; @@ -54,10 +54,65 @@ namespace Lumos Divide(rootNode, 0); // Add collision pairs in leaf world divisions - for(uint32_t i = 0; i < m_LeafCount; i++) + for(uint32_t leafIndex = 0; leafIndex < m_LeafCount; leafIndex++) { - if(m_NodePool[m_Leaves[i]].PhysicsObjectCount > 1) - m_SecondaryBroadphase->FindPotentialCollisionPairs(m_NodePool[m_Leaves[i]].PhysicsObjects, m_NodePool[m_Leaves[i]].PhysicsObjectCount, collisionPairs); + uint32_t objectCount = m_NodePool[m_Leaves[leafIndex]].PhysicsObjectCount; + if(objectCount == 0) + continue; + + for(size_t i = 0; i < objectCount - 1; ++i) + { + RigidBody3D& obj1 = *m_NodePool[m_Leaves[leafIndex]].PhysicsObjects[i]; + + for(size_t j = i + 1; j < objectCount; ++j) + { + RigidBody3D& obj2 = *m_NodePool[m_Leaves[leafIndex]].PhysicsObjects[j]; + + if(!obj1.GetCollisionShape() || !obj2.GetCollisionShape()) + continue; + + // Skip pairs of two at objects at rest + if(obj1.GetIsAtRest() && obj2.GetIsAtRest()) + continue; + + // Skip pairs of two at static objects + if(obj1.GetIsStatic() && obj2.GetIsStatic()) + continue; + + // Skip pairs of one static and one at rest + if(obj1.GetIsAtRest() && obj2.GetIsStatic()) + continue; + + if(obj1.GetIsStatic() && obj2.GetIsAtRest()) + continue; + + CollisionPair pair; + + if(&obj1 < &obj2) + { + pair.pObjectA = &obj1; + pair.pObjectB = &obj2; + } + else + { + pair.pObjectA = &obj2; + pair.pObjectB = &obj1; + } + + bool duplicate = false; + for(int i = 0; i < collisionPairs.size(); i++) + { + auto& pair2 = collisionPairs[i]; + + if(pair.pObjectA == pair2.pObjectA && pair.pObjectB == pair2.pObjectB) + { + duplicate = true; + } + } + if(!duplicate) + collisionPairs.push_back(pair); + } + } } } diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.h b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.h index 7cde32b5..087b92d1 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.h +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.h @@ -17,7 +17,7 @@ namespace Lumos class LUMOS_EXPORT OctreeBroadphase : public Broadphase { public: - OctreeBroadphase(size_t maxObjectsPerPartition, size_t maxPartitionDepth, const SharedPtr& secondaryBroadphase); + OctreeBroadphase(size_t maxObjectsPerPartition, size_t maxPartitionDepth); virtual ~OctreeBroadphase(); struct OctreeNode @@ -42,7 +42,7 @@ namespace Lumos Maths::BoundingBox boundingBox; }; - void FindPotentialCollisionPairs(RigidBody3D** objects, uint32_t objectCount, std::vector& collisionPairs) override; + void FindPotentialCollisionPairs(RigidBody3D* rootObject, std::vector& collisionPairs) override; void DebugDraw() override; void Divide(OctreeNode& node, size_t iteration); void DebugDrawOctreeNode(const OctreeNode& node); @@ -54,7 +54,6 @@ namespace Lumos uint32_t m_CurrentPoolIndex = 0; uint32_t m_LeafCount = 0; - SharedPtr m_SecondaryBroadphase; // Broadphase stage used to determine collision pairs within subdivisions OctreeNode m_NodePool[MAX_PARTITION_DEPTH * MAX_PARTITION_DEPTH * MAX_PARTITION_DEPTH]; uint32_t m_Leaves[MAX_PARTITION_DEPTH * MAX_PARTITION_DEPTH * MAX_PARTITION_DEPTH] = { 0 }; }; diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/SortAndSweepBroadphase.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/SortAndSweepBroadphase.cpp deleted file mode 100644 index 15c7a270..00000000 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/SortAndSweepBroadphase.cpp +++ /dev/null @@ -1,84 +0,0 @@ - -#include "Precompiled.h" -#include "SortAndSweepBroadphase.h" - -namespace Lumos -{ - - SortAndSweepBroadphase::SortAndSweepBroadphase(const glm::vec3& axis) - : Broadphase() - , m_AxisIndex(0) - { - SetAxis(axis); - } - - SortAndSweepBroadphase::~SortAndSweepBroadphase() - { - } - - void SortAndSweepBroadphase::SetAxis(const glm::vec3& axis) - { - LUMOS_PROFILE_FUNCTION(); - // Determine axis - m_Axis = axis; - glm::normalize(m_Axis); - - if(abs(m_Axis.x) > 0.9f) - m_AxisIndex = 0; - else if(abs(m_Axis.y) > 0.9f) - m_AxisIndex = 1; - else if(abs(m_Axis.z) > 0.9f) - m_AxisIndex = 2; - } - - void SortAndSweepBroadphase::FindPotentialCollisionPairs(RigidBody3D** objects, uint32_t objectCount, - std::vector& collisionPairs) - { - LUMOS_PROFILE_FUNCTION(); - // Sort entities along axis - std::sort(objects, objects + objectCount, [this](RigidBody3D* a, RigidBody3D* b) -> bool - { return a->GetWorldSpaceAABB().Min()[this->m_AxisIndex] < b->GetWorldSpaceAABB().Min()[this->m_AxisIndex]; }); - - for(uint32_t i = 0; i < objectCount; i++) - { - auto& obj = *objects[i]; - - float thisBoxRight = obj.GetWorldSpaceAABB().Max()[m_AxisIndex]; - - for(uint32_t iit = i + 1; iit < objectCount; iit++) - { - auto& obj2 = *objects[iit]; - // Skip pairs of two at rest/static objects - if(obj.GetIsAtRest() && obj2.GetIsAtRest()) - continue; - - // Skip pairs of two at static objects - if(obj.GetIsStatic() && obj2.GetIsStatic()) - continue; - - // Skip pairs of one static and one at rest - if(obj.GetIsAtRest() && obj2.GetIsStatic()) - continue; - - if(obj.GetIsStatic() && obj2.GetIsAtRest()) - continue; - - float testBoxLeft = obj2.GetWorldSpaceAABB().Min()[m_AxisIndex]; - - // Test for overlap between the axis values of the bounding boxes - if(testBoxLeft < thisBoxRight) - { - CollisionPair cp; - cp.pObjectA = &obj; - cp.pObjectB = &obj2; - - collisionPairs.push_back(cp); - } - } - } - } - - void SortAndSweepBroadphase::DebugDraw() - { - } -} diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/SortAndSweepBroadphase.h b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/SortAndSweepBroadphase.h deleted file mode 100644 index 9dc5f48c..00000000 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Broadphase/SortAndSweepBroadphase.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "Broadphase.h" -#include - -namespace Lumos -{ - - class LUMOS_EXPORT SortAndSweepBroadphase : public Broadphase - { - public: - explicit SortAndSweepBroadphase(const glm::vec3& axis = glm::vec3(1.0f, 0.0f, 0.0f)); - virtual ~SortAndSweepBroadphase(); - - inline glm::vec3 Axis() const - { - return m_Axis; - } - - void SetAxis(const glm::vec3& axis); - - void FindPotentialCollisionPairs(RigidBody3D** objects, uint32_t objectCount, std::vector& collisionPairs) override; - void DebugDraw() override; - - protected: - glm::vec3 m_Axis; // Axis along which testing is performed - int m_AxisIndex; // Index of axis along which testing is performed - }; -} diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/CollisionShapes/SphereCollisionShape.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/CollisionShapes/SphereCollisionShape.cpp index 1f5570b2..8202927d 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/CollisionShapes/SphereCollisionShape.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/CollisionShapes/SphereCollisionShape.cpp @@ -32,10 +32,10 @@ namespace Lumos float i = 2.5f * invMass / (m_Radius * m_Radius); // SOLID // float i = 1.5f * invMass * m_Radius * m_Radius; //HOLLOW - glm::mat3 inertia; - inertia[0][0] = i; - inertia[1][1] = i; - inertia[2][2] = i; + glm::mat3 inertia = glm::mat3(1.0f); + inertia[0][0] = i; + inertia[1][1] = i; + inertia[2][2] = i; return inertia; } diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.cpp index 23e8a951..7cf1a4f2 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.cpp @@ -1,7 +1,6 @@ #include "Precompiled.h" #include "LumosPhysicsEngine.h" #include "Narrowphase/CollisionDetection.h" -#include "Broadphase/SortAndSweepBroadphase.h" #include "Broadphase/BruteForceBroadphase.h" #include "Broadphase/OctreeBroadphase.h" #include "RigidBody3D.h" @@ -35,11 +34,10 @@ namespace Lumos , m_RootBody(nullptr) { m_DebugName = "Lumos3DPhysicsEngine"; - m_RigidBodys.reserve(100); m_BroadphaseCollisionPairs.reserve(1000); - m_Manifolds.reserve(100); m_Allocator = new PoolAllocator(); + m_Arena = ArenaAlloc(Megabytes(8)); } void LumosPhysicsEngine::SetDefaults() @@ -54,99 +52,56 @@ namespace Lumos LumosPhysicsEngine::~LumosPhysicsEngine() { - m_RigidBodys.clear(); - m_Constraints.clear(); - m_Manifolds.clear(); - CollisionDetection::Release(); } void LumosPhysicsEngine::OnUpdate(const TimeStep& timeStep, Scene* scene) { LUMOS_PROFILE_FUNCTION(); - m_RigidBodys.clear(); - if(!m_IsPaused) { - auto& registry = scene->GetRegistry(); - //'auto group = registry.group(entt::get); - - { - LUMOS_PROFILE_SCOPE("Physics::Get Rigid Bodies"); - // for(auto entity : group) - // { - // const auto& phys = group.get(entity); - // auto& physicsObj = phys.GetRigidBody(); - // m_RigidBodys.push_back(physicsObj.get()); - // }; - - RigidBody3D* currentBody = m_RootBody; - while(currentBody) - { - m_RigidBodys.push_back(currentBody); - currentBody = currentBody->m_Next; - } - } - - if(m_RigidBodys.empty()) - { - return; - } - - m_Stats.RigidBodyCount = (uint32_t)m_RigidBodys.size(); + auto& registry = scene->GetRegistry(); + m_ConstraintCount = 0; + ArenaClear(m_Arena); { LUMOS_PROFILE_SCOPE("Physics::Get Spring Constraints"); - m_Constraints.clear(); - auto viewSpring = registry.view(); + auto viewAxis = registry.view(); + auto viewDis = registry.view(); + auto viewWeld = registry.view(); + + m_ConstraintCount = (uint32_t)viewSpring.size() + (uint32_t)viewAxis.size() + (uint32_t)viewDis.size() + (uint32_t)viewWeld.size(); + m_Constraints = PushArrayNoZero(m_Arena, Constraint*, m_ConstraintCount); + uint32_t constraintIndex = 0; for(auto entity : viewSpring) { - const auto& constraint = viewSpring.get(entity).GetConstraint(); - m_Constraints.push_back(constraint.get()); + m_Constraints[constraintIndex++] = viewSpring.get(entity).GetConstraint(); } - } - - { - LUMOS_PROFILE_SCOPE("Physics::Get Axis Constraints"); - - auto viewAxis = registry.view(); for(auto entity : viewAxis) { - const auto& [constraint, idComp] = viewAxis.get(entity); + auto constraint = viewAxis.get(entity); - if(constraint.GetEntityID() != idComp.ID) - constraint.SetEntity(idComp.ID); + if(constraint.GetEntityID() != Entity(entity, Application::Get().GetCurrentScene()).GetID()) + constraint.SetEntity(Entity(entity, Application::Get().GetCurrentScene()).GetID()); if(constraint.GetConstraint()) - m_Constraints.push_back(constraint.GetConstraint().get()); + m_Constraints[constraintIndex++] = constraint.GetConstraint().get(); } - } - - { - LUMOS_PROFILE_SCOPE("Physics::Get Distance Constraints"); - auto viewDis = registry.view(); for(auto entity : viewDis) { - const auto& constraint = viewDis.get(entity).GetConstraint(); - m_Constraints.push_back(constraint.get()); + m_Constraints[constraintIndex++] = viewDis.get(entity).GetConstraint(); } - } - - { - LUMOS_PROFILE_SCOPE("Physics::Get Weld Constraints"); - auto viewWeld = registry.view(); for(auto entity : viewWeld) { - const auto& constraint = viewWeld.get(entity).GetConstraint(); - m_Constraints.push_back(constraint.get()); + m_Constraints[constraintIndex++] = viewWeld.get(entity).GetConstraint(); } } - m_Stats.ConstraintCount = (uint32_t)m_Constraints.size(); + m_Stats.ConstraintCount = m_ConstraintCount; { LUMOS_PROFILE_SCOPE("Physics::UpdatePhysics"); @@ -165,13 +120,14 @@ namespace Lumos } } - m_Constraints.clear(); + m_ConstraintCount = 0; } } void LumosPhysicsEngine::UpdatePhysics() { - m_Manifolds.clear(); + m_ManifoldCount = 0; + m_Manifolds = PushArrayNoZero(m_Arena, Manifold, 100); // Check for collisions BroadPhaseCollisions(); @@ -200,7 +156,6 @@ namespace Lumos m_Stats.RigidBodyCount = 0; RigidBody3D* current = m_RootBody; - while(current) { if(current->m_AtRest) @@ -432,7 +387,7 @@ namespace Lumos LUMOS_PROFILE_FUNCTION(); m_BroadphaseCollisionPairs.clear(); if(m_BroadphaseDetection) - m_BroadphaseDetection->FindPotentialCollisionPairs(m_RigidBodys.data(), (uint32_t)m_RigidBodys.size(), m_BroadphaseCollisionPairs); + m_BroadphaseDetection->FindPotentialCollisionPairs(m_RootBody, m_BroadphaseCollisionPairs); #ifdef CHECK_COLLISION_PAIR_DUPLICATES @@ -489,7 +444,7 @@ namespace Lumos // Build full collision manifold that will also handle the collision // response between the two objects in the solver stage m_ManifoldLock.lock(); - Manifold& manifold = m_Manifolds.emplace_back(); + Manifold& manifold = m_Manifolds[m_ManifoldCount++]; manifold.Initiate(cp.pObjectA, cp.pObjectB); // Construct contact points that form the perimeter of the collision manifold @@ -502,7 +457,7 @@ namespace Lumos } else { - m_Manifolds.pop_back(); + m_ManifoldCount--; } m_ManifoldLock.unlock(); @@ -518,34 +473,31 @@ namespace Lumos { LUMOS_PROFILE_SCOPE("Solve Manifolds"); - - for(Manifold& m : m_Manifolds) - m.PreSolverStep(s_UpdateTimestep); + for(uint32_t index = 0; index < m_ManifoldCount; index++) + m_Manifolds[index].PreSolverStep(s_UpdateTimestep); } { LUMOS_PROFILE_SCOPE("Solve Constraints"); - - for(Constraint* c : m_Constraints) - c->PreSolverStep(s_UpdateTimestep); + for(uint32_t index = 0; index < m_ConstraintCount; index++) + m_Constraints[index]->PreSolverStep(s_UpdateTimestep); } - { LUMOS_PROFILE_SCOPE("Apply Impulses"); for(uint32_t i = 0; i < m_VelocityIterations; i++) { - for(Manifold& m : m_Manifolds) - m.ApplyImpulse(); + for(uint32_t index = 0; index < m_ManifoldCount; index++) + m_Manifolds[index].ApplyImpulse(); - for(Constraint* c : m_Constraints) - c->ApplyImpulse(); + for(uint32_t index = 0; index < m_ConstraintCount; index++) + m_Constraints[index]->ApplyImpulse(); } } } void LumosPhysicsEngine::ClearConstraints() { - m_Constraints.clear(); + m_ConstraintCount = 0; } std::string LumosPhysicsEngine::IntegrationTypeToString(IntegrationType type) @@ -587,14 +539,12 @@ namespace Lumos switch(type) { + case BroadphaseType::SORT_AND_SWEAP: case BroadphaseType::BRUTE_FORCE: m_BroadphaseDetection = Lumos::CreateSharedPtr(); break; - case BroadphaseType::SORT_AND_SWEAP: - m_BroadphaseDetection = Lumos::CreateSharedPtr(); - break; case BroadphaseType::OCTREE: - m_BroadphaseDetection = Lumos::CreateSharedPtr(5, 5, Lumos::CreateSharedPtr()); + m_BroadphaseDetection = Lumos::CreateSharedPtr(5, 5); break; default: m_BroadphaseDetection = Lumos::CreateSharedPtr(); @@ -692,40 +642,27 @@ namespace Lumos LUMOS_PROFILE_FUNCTION_LOW(); if(m_DebugDrawFlags & PhysicsDebugFlags::MANIFOLD) { - for(Manifold& m : m_Manifolds) - m.DebugDraw(); + for(uint32_t index = 0; index < m_ManifoldCount; index++) + m_Manifolds[index].DebugDraw(); } // Draw all constraints if(m_DebugDrawFlags & PhysicsDebugFlags::CONSTRAINT) { - for(Constraint* c : m_Constraints) - c->DebugDraw(); + for(uint32_t index = 0; index < m_ConstraintCount; index++) + m_Constraints[index]->DebugDraw(); } if(!m_IsPaused && m_BroadphaseDetection && (m_DebugDrawFlags & PhysicsDebugFlags::BROADPHASE)) m_BroadphaseDetection->DebugDraw(); - auto scene = Application::Get().GetCurrentScene(); - auto& registry = scene->GetRegistry(); - - auto group = registry.group(entt::get); - - if(group.empty()) - return; - - for(auto entity : group) + RigidBody3D* current = m_RootBody; + while(current) { - const auto& phys = group.get(entity); - - auto physicsObj = phys.GetRigidBody(); - - if(physicsObj) - { - physicsObj->DebugDraw(m_DebugDrawFlags); - if(physicsObj->GetCollisionShape() && (m_DebugDrawFlags & PhysicsDebugFlags::COLLISIONVOLUMES)) - physicsObj->GetCollisionShape()->DebugDraw(physicsObj); - } + current->DebugDraw(m_DebugDrawFlags); + if(current->GetCollisionShape() && (m_DebugDrawFlags & PhysicsDebugFlags::COLLISIONVOLUMES)) + current->GetCollisionShape()->DebugDraw(current); + current = current->m_Next; } } } diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.h b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.h index 72f2e5c5..aa28583b 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.h +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/LumosPhysicsEngine.h @@ -60,13 +60,7 @@ namespace Lumos void SetDefaults(); - // Add Constraints - void AddConstraint(Constraint* c) - { - m_Constraints.push_back(c); - } - - void OnInit() override {}; + bool OnInit() override { return true; }; // Update Physics Engine void OnUpdate(const TimeStep& timeStep, Scene* scene) override; @@ -87,7 +81,7 @@ namespace Lumos inline void SetBroadphase(const SharedPtr& bp) { m_BroadphaseDetection = bp; } int GetNumberCollisionPairs() const { return static_cast(m_BroadphaseCollisionPairs.size()); } - int GetNumberRigidBodys() const { return static_cast(m_RigidBodys.size()); } + int GetNumberRigidBodys() const { return static_cast(m_Stats.RigidBodyCount); } IntegrationType GetIntegrationType() const { return m_IntegrationType; } void SetIntegrationType(const IntegrationType& type) { m_IntegrationType = type; } void SetBroadphaseType(BroadphaseType type); @@ -143,13 +137,14 @@ namespace Lumos uint32_t m_PositionIterations = 1; uint32_t m_VelocityIterations = 50; - std::vector m_RigidBodys; std::vector m_BroadphaseCollisionPairs; - - std::vector m_Constraints; // Misc constraints between pairs of objects - std::vector m_Manifolds; // Contact constraints between pairs of objects + Constraint** m_Constraints; // Misc constraints between pairs of objects + Manifold* m_Manifolds; // Contact constraints between pairs of objects std::mutex m_ManifoldsMutex; + uint32_t m_ManifoldCount = 0; + uint32_t m_ConstraintCount = 0; + SharedPtr m_BroadphaseDetection; BroadphaseType m_BroadphaseType; IntegrationType m_IntegrationType; @@ -159,6 +154,7 @@ namespace Lumos RigidBody3D* m_RootBody; PoolAllocator* m_Allocator; + Arena* m_Arena; PhysicsStats3D m_Stats; diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/CollisionDetection.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/CollisionDetection.cpp index ce45c916..1c224100 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/CollisionDetection.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/CollisionDetection.cpp @@ -806,8 +806,9 @@ namespace Lumos glm::vec3 CollisionDetection::GetClosestPointOnEdges(const glm::vec3& target, const std::vector& edges) { LUMOS_PROFILE_FUNCTION_LOW(); - glm::vec3 closest_point, temp_closest_point; - float closest_distsq = FLT_MAX; + glm::vec3 closest_point = glm::vec3(0.0f); + glm::vec3 temp_closest_point = glm::vec3(0.0f); + float closest_distsq = FLT_MAX; for(const CollisionEdge& edge : edges) { diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/Manifold.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/Manifold.cpp index 6b69be9f..1dc5344e 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/Manifold.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/Narrowphase/Manifold.cpp @@ -41,7 +41,7 @@ namespace Lumos { LUMOS_PROFILE_FUNCTION_LOW(); - if(m_pNodeA->GetInverseMass() + m_pNodeB->GetInverseMass() == 0.0f) + if(m_pNodeA->GetInverseMass() + m_pNodeB->GetInverseMass() < Maths::M_EPSILON) return; glm::vec3& r1 = c.relPosA; diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.cpp b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.cpp index 14cb57bb..3a2be8af 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.cpp +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.cpp @@ -26,6 +26,7 @@ namespace Lumos , m_InvInertia(glm::mat3(1.0f)) , m_OnCollisionCallback(nullptr) , m_AngularFactor(1.0f) + , m_wsTransform(glm::mat4(1.0f)) { LUMOS_ASSERT(properties.Mass > 0.0f, "Mass <= 0"); m_InvMass = 1.0f / properties.Mass; @@ -44,6 +45,7 @@ namespace Lumos RigidBody3D::~RigidBody3D() { + m_UUID = 0; } const Maths::BoundingBox& RigidBody3D::GetWorldSpaceAABB() @@ -51,7 +53,7 @@ namespace Lumos LUMOS_PROFILE_FUNCTION_LOW(); if(m_wsAabbInvalidated) { - LUMOS_PROFILE_SCOPE("Calculate BoundingBox"); + LUMOS_PROFILE_SCOPE_LOW("Calculate BoundingBox"); m_wsAabb = m_localBoundingBox.Transformed(GetWorldSpaceTransform()); m_wsAabbInvalidated = false; } diff --git a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.h b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.h index 89835ce4..2dd9c733 100644 --- a/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.h +++ b/Lumos/Source/Lumos/Physics/LumosPhysicsEngine/RigidBody3D.h @@ -246,6 +246,12 @@ namespace Lumos UUID GetUUID() const { return m_UUID; } + // For iteration + RigidBody3D* m_Prev = nullptr; + RigidBody3D* m_Next = nullptr; + + bool Valid() const { return m_UUID != 0; } + protected: RigidBody3D(const RigidBody3DProperties& properties = RigidBody3DProperties()); @@ -282,8 +288,5 @@ namespace Lumos SharedPtr m_CollisionShape; PhysicsCollisionCallback m_OnCollisionCallback; std::vector m_onCollisionManifoldCallbacks; //!< Collision callbacks post manifold generation - - RigidBody3D* m_Prev = nullptr; - RigidBody3D* m_Next = nullptr; }; } diff --git a/Lumos/Source/Lumos/Platform/OpenAL/ALManager.cpp b/Lumos/Source/Lumos/Platform/OpenAL/ALManager.cpp index f137766a..baa07e3a 100644 --- a/Lumos/Source/Lumos/Platform/OpenAL/ALManager.cpp +++ b/Lumos/Source/Lumos/Platform/OpenAL/ALManager.cpp @@ -6,6 +6,8 @@ #include "Utilities/TimeStep.h" #include "Scene/Component/SoundComponent.h" #include "Scene/Scene.h" +#include "Maths/Transform.h" + #include namespace Lumos @@ -26,19 +28,23 @@ namespace Lumos alcCloseDevice(m_Device); } - void ALManager::OnInit() + bool ALManager::OnInit() { LUMOS_PROFILE_FUNCTION(); m_Device = alcOpenDevice(nullptr); m_Context = alcCreateContext(m_Device, nullptr); if(!m_Device) + { LUMOS_LOG_INFO("Failed to Initialise AudioManager! (No valid device!)"); + return false; + } alcMakeContextCurrent(m_Context); alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED); LUMOS_LOG_INFO("Initialised AudioManager - {0}", alcGetString(m_Device, ALC_DEVICE_SPECIFIER)); + return true; } void ALManager::OnUpdate(const TimeStep& dt, Scene* scene) diff --git a/Lumos/Source/Lumos/Platform/OpenAL/ALManager.h b/Lumos/Source/Lumos/Platform/OpenAL/ALManager.h index 61abc09d..9fc12cfa 100644 --- a/Lumos/Source/Lumos/Platform/OpenAL/ALManager.h +++ b/Lumos/Source/Lumos/Platform/OpenAL/ALManager.h @@ -19,7 +19,7 @@ namespace Lumos ALManager(int numChannels = 8); ~ALManager(); - void OnInit() override; + bool OnInit() override; void OnUpdate(const TimeStep& dt, Scene* scene) override; void UpdateListener(Scene* scene) override; void UpdateListener(Maths::Transform& listenerTransform); diff --git a/Lumos/Source/Lumos/Platform/OpenGL/GLRenderer.cpp b/Lumos/Source/Lumos/Platform/OpenGL/GLRenderer.cpp index 78c20ed4..443c0a9e 100644 --- a/Lumos/Source/Lumos/Platform/OpenGL/GLRenderer.cpp +++ b/Lumos/Source/Lumos/Platform/OpenGL/GLRenderer.cpp @@ -305,7 +305,7 @@ namespace Lumos frameBufferDesc.attachments = attachments; frameBufferDesc.mipIndex = 0; frameBufferDesc.layer = 0; - frameBufferDesc.msaaLevel = 1; + frameBufferDesc.samples = 1; auto framebuffer = Framebuffer::Get(frameBufferDesc); framebuffer.As()->Bind(); } diff --git a/Lumos/Source/Lumos/Platform/OpenGL/GLShader.cpp b/Lumos/Source/Lumos/Platform/OpenGL/GLShader.cpp index ee378209..10cfbb18 100644 --- a/Lumos/Source/Lumos/Platform/OpenGL/GLShader.cpp +++ b/Lumos/Source/Lumos/Platform/OpenGL/GLShader.cpp @@ -2,12 +2,14 @@ #include "GLShader.h" #include "Platform/OpenGL/GL.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/OS/FileSystem.h" #include "Core/StringUtilities.h" #include +#include + enum root_signature_spaces { PUSH_CONSTANT_REGISTER_SPACE = 0, @@ -78,7 +80,7 @@ namespace Lumos m_Name = StringUtilities::GetFileName(filePath); m_Path = StringUtilities::GetFileLocation(filePath); - m_Source = VFS::Get().ReadTextFile(filePath); + m_Source = FileSystem::Get().ReadTextFile(filePath); Init(); } @@ -443,8 +445,8 @@ namespace Lumos file.erase(j, rem.length()); file = StringUtilities::StringReplace(file, '\"'); LUMOS_LOG_WARN("Including file \'{0}\' into shader.", file); - VFS::Get().ReadTextFile(file); - ReadShaderFile(StringUtilities::GetLines(VFS::Get().ReadTextFile(file)), shaders); + FileSystem::Get().ReadTextFile(file); + ReadShaderFile(StringUtilities::GetLines(FileSystem::Get().ReadTextFile(file)), shaders); } } else if(StringUtilities::StartsWith(str, "#if")) @@ -970,7 +972,7 @@ namespace Lumos Shader* GLShader::CreateFuncGL(const std::string& filePath) { std::string physicalPath; - Lumos::VFS::Get().ResolvePhysicalPath(filePath, physicalPath); + Lumos::FileSystem::Get().ResolvePhysicalPath(filePath, physicalPath); GLShader* result = new GLShader(physicalPath); return result; } diff --git a/Lumos/Source/Lumos/Platform/OpenGL/GLShader.h b/Lumos/Source/Lumos/Platform/OpenGL/GLShader.h index d3207f2d..e5972629 100644 --- a/Lumos/Source/Lumos/Platform/OpenGL/GLShader.h +++ b/Lumos/Source/Lumos/Platform/OpenGL/GLShader.h @@ -4,10 +4,14 @@ #include "GLDebug.h" #include "GLUniformBuffer.h" #include "Graphics/RHI/BufferLayout.h" -#include #include #include +namespace spirv_cross +{ + class CompilerGLSL; +} + namespace Lumos { namespace Graphics diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKBuffer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKBuffer.cpp index 243761a3..f5eaa134 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKBuffer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKBuffer.cpp @@ -25,21 +25,33 @@ namespace Lumos LUMOS_PROFILE_FUNCTION(); if(m_Buffer) { - VKContext::DeletionQueue& deletionQueue = VKRenderer::GetCurrentDeletionQueue(); + if(m_DeleteWithoutQueue) + { +#ifdef USE_VMA_ALLOCATOR + vmaDestroyBuffer(VKDevice::Get().GetAllocator(), m_Buffer, m_Allocation); +#else + vkDestroyBuffer(VKDevice::Device(), m_Buffer, nullptr); + vkFreeMemory(VKDevice::Device(), m_Memory, nullptr); +#endif + } + else + { + VKContext::DeletionQueue& deletionQueue = VKRenderer::GetCurrentDeletionQueue(); - auto buffer = m_Buffer; + auto buffer = m_Buffer; #ifdef USE_VMA_ALLOCATOR - auto alloc = m_Allocation; - deletionQueue.PushFunction([buffer, alloc] - { vmaDestroyBuffer(VKDevice::Get().GetAllocator(), buffer, alloc); }); + auto alloc = m_Allocation; + deletionQueue.PushFunction([buffer, alloc] + { vmaDestroyBuffer(VKDevice::Get().GetAllocator(), buffer, alloc); }); #else - auto memory = m_Memory; - deletionQueue.PushFunction([buffer, memory] - { - vkDestroyBuffer(VKDevice::Device(), buffer, nullptr); - vkFreeMemory(VKDevice::Device(), memory, nullptr); }); + auto memory = m_Memory; + deletionQueue.PushFunction([buffer, memory] + { + vkDestroyBuffer(VKDevice::Device(), buffer, nullptr); + vkFreeMemory(VKDevice::Device(), memory, nullptr); }); #endif + } } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKBuffer.h b/Lumos/Source/Lumos/Platform/Vulkan/VKBuffer.h index 16806452..649b7999 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKBuffer.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKBuffer.h @@ -31,6 +31,7 @@ namespace Lumos void SetUsage(VkBufferUsageFlags flags) { m_UsageFlags = flags; } void SetMemoryProperyFlags(VkBufferUsageFlags flags) { m_MemoryProperyFlags = flags; } void Destroy(bool deletionQueue = false); + void SetDeleteWithoutQueue(bool value) { m_DeleteWithoutQueue = value; } protected: VkBuffer m_Buffer {}; @@ -40,7 +41,8 @@ namespace Lumos VkDeviceSize m_Alignment = 0; VkBufferUsageFlags m_UsageFlags; VkMemoryPropertyFlags m_MemoryProperyFlags; - void* m_Mapped = nullptr; + void* m_Mapped = nullptr; + bool m_DeleteWithoutQueue = false; #ifdef USE_VMA_ALLOCATOR VmaAllocation m_Allocation {}; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKContext.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKContext.cpp index d45cb13f..127f76e5 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKContext.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKContext.cpp @@ -268,14 +268,15 @@ namespace Lumos { LUMOS_PROFILE_FUNCTION(); #ifndef LUMOS_PLATFORM_IOS - if(volkInitialize() != VK_SUCCESS) + VkResult result = volkInitialize(); + if(result != VK_SUCCESS) { - LUMOS_LOG_CRITICAL("volkInitialize failed"); + LUMOS_ASSERT(false, "volkInitialize failed"); } if(volkGetInstanceVersion() == 0) { - LUMOS_LOG_CRITICAL("Could not find loader"); + LUMOS_ASSERT(false, "Could not find loader"); } #endif diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKDescriptorSet.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKDescriptorSet.cpp index 38172df5..7943fad1 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKDescriptorSet.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKDescriptorSet.cpp @@ -71,10 +71,11 @@ namespace Lumos if(!m_DescriptorSet[frame]) continue; - auto descriptorSet = m_DescriptorSet[frame]; - auto pool = VKRenderer::GetDescriptorPool(); - auto device = VKDevice::GetHandle(); - std::map> buffers = m_UniformBuffers[frame]; + auto descriptorSet = m_DescriptorSet[frame]; + auto pool = VKRenderer::GetDescriptorPool(); + auto device = VKDevice::GetHandle(); + std::map>& buffers = m_UniformBuffers[frame]; + buffers.clear(); VKContext::DeletionQueue& deletionQueue = VKRenderer::GetCurrentDeletionQueue(); deletionQueue.PushFunction([descriptorSet, pool, device] @@ -131,7 +132,7 @@ namespace Lumos void VKDescriptorSet::Update(CommandBuffer* cmdBuffer) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_Dynamic = false; int descriptorWritesCount = 0; uint32_t currentFrame = Renderer::GetMainSwapChain()->GetCurrentBufferIndex(); diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKDescriptorSet.h b/Lumos/Source/Lumos/Platform/Vulkan/VKDescriptorSet.h index ffb9b790..525f8810 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKDescriptorSet.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKDescriptorSet.h @@ -67,13 +67,13 @@ namespace Lumos bool HasUpdated[10]; }; - std::map m_DescriptorSet; DescriptorSetInfo m_Descriptors; - std::map>> m_UniformBuffers; - std::map m_UniformBuffersData; - bool m_DescriptorDirty[3]; - bool m_DescriptorUpdated[3]; + + std::map> m_UniformBuffers[MAX_FRAMES_FLIGHT]; + VkDescriptorSet m_DescriptorSet[MAX_FRAMES_FLIGHT]; + bool m_DescriptorDirty[MAX_FRAMES_FLIGHT]; + bool m_DescriptorUpdated[MAX_FRAMES_FLIGHT]; }; } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.cpp index 0d4edc86..6a0e80ae 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.cpp @@ -12,6 +12,74 @@ namespace Lumos { namespace Graphics { + std::string VKPhysicalDevice::PhysicalDeviceInfo::GetVendorName() + { + std::string name = "Unknown"; + + if(VendorID == 0x10DE || StringUtilities::StringContains(Name, "Nvidia")) + { + name = "Nvidia"; + } + else if(VendorID == 0x1002 || VendorID == 0x1022 || StringUtilities::StringContains(Name, "Amd")) + { + name = "AMD"; + } + else if(VendorID == 0x8086 || VendorID == 0x163C || VendorID == 0x8087 || StringUtilities::StringContains(Name, "Intel")) + { + name = "Intel"; + } + else if(VendorID == 0x13B5 || StringUtilities::StringContains(Name, "Arm,")) + { + name = "Arm"; + } + else if(VendorID == 0x5143 || StringUtilities::StringContains(Name, "Qualcomm")) + { + name = "Qualcomm"; + } + else if(VendorID == 0x106b || StringUtilities::StringContains(Name, "Apple")) + { + return "Apple"; + } + + return name; + } + + std::string VKPhysicalDevice::PhysicalDeviceInfo::DecodeDriverVersion(const uint32_t version) + { + char buffer[256]; + + if(Vendor == "Nvidia") + { + sprintf( + buffer, + "%d.%d.%d.%d", + (version >> 22) & 0x3ff, + (version >> 14) & 0x0ff, + (version >> 6) & 0x0ff, + (version) & 0x003f); + } +#if LUMOS_PLATFORM_WINDOWS + else if(Vendor == "Intel") + { + sprintf( + buffer, + "%d.%d", + (version >> 14), + (version) & 0x3fff); + } +#endif + else // Vulkan version conventions + { + sprintf( + buffer, + "%d.%d.%d", + (version >> 22), + (version >> 12) & 0x3ff, + version & 0xfff); + } + + return buffer; + } const char* PhysicalDeviceTypeToString(PhysicalDeviceType type) { @@ -403,6 +471,26 @@ namespace Lumos allocatorInfo.instance = VKContext::GetVKInstance(); allocatorInfo.vulkanApiVersion = VKContext::GetVKVersion(); +#if LUMOS_PROFILE + VmaDeviceMemoryCallbacks device_memory_callbacks = {}; + device_memory_callbacks.pfnAllocate = [](VmaAllocator, + uint32_t, + VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory, + VkDeviceSize size, + void*) + { + TracyAllocN(memory, size, "vulkan"); + }; + device_memory_callbacks.pfnFree = [](VmaAllocator, + uint32_t, + VkDeviceMemory VMA_NOT_NULL_NON_DISPATCHABLE memory, + VkDeviceSize size, + void* VMA_NULLABLE) + { + TracyFreeN(memory, "vulkan"); + }; + allocatorInfo.pDeviceMemoryCallbacks = &device_memory_callbacks; +#endif VmaVulkanFunctions fn; fn.vkAllocateMemory = (PFN_vkAllocateMemory)vkAllocateMemory; fn.vkBindBufferMemory = (PFN_vkBindBufferMemory)vkBindBufferMemory; @@ -436,6 +524,7 @@ namespace Lumos { LUMOS_LOG_CRITICAL("[VULKAN] Failed to create VMA allocator"); } + #endif m_CommandPool = CreateSharedPtr(m_PhysicalDevice->GetGraphicsQueueFamilyIndex(), VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT); diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h b/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h index c28a6889..658e8dfe 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKDevice.h @@ -32,74 +32,8 @@ namespace Lumos struct PhysicalDeviceInfo { - std::string GetVendorName() - { - std::string name = "Unknown"; - - if(VendorID == 0x10DE || StringUtilities::StringContains(Name, "Nvidia")) - { - name = "Nvidia"; - } - else if(VendorID == 0x1002 || VendorID == 0x1022 || StringUtilities::StringContains(Name, "Amd")) - { - name = "AMD"; - } - else if(VendorID == 0x8086 || VendorID == 0x163C || VendorID == 0x8087 || StringUtilities::StringContains(Name, "Intel")) - { - name = "Intel"; - } - else if(VendorID == 0x13B5 || StringUtilities::StringContains(Name, "Arm,")) - { - name = "Arm"; - } - else if(VendorID == 0x5143 || StringUtilities::StringContains(Name, "Qualcomm")) - { - name = "Qualcomm"; - } - else if(VendorID == 0x106b || StringUtilities::StringContains(Name, "Apple")) - { - return "Apple"; - } - - return name; - } - - std::string DecodeDriverVersion(const uint32_t version) - { - char buffer[256]; - - if(Vendor == "Nvidia") - { - sprintf( - buffer, - "%d.%d.%d.%d", - (version >> 22) & 0x3ff, - (version >> 14) & 0x0ff, - (version >> 6) & 0x0ff, - (version)&0x003f); - } -#if LUMOS_PLATFORM_WINDOWS - else if(Vendor == "Intel") - { - sprintf( - buffer, - "%d.%d", - (version >> 14), - (version)&0x3fff); - } -#endif - else // Vulkan version conventions - { - sprintf( - buffer, - "%d.%d.%d", - (version >> 22), - (version >> 12) & 0x3ff, - version & 0xfff); - } - - return buffer; - } + std::string GetVendorName(); + std::string DecodeDriverVersion(const uint32_t version); uint32_t Memory; uint32_t VendorID; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKFramebuffer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKFramebuffer.cpp index 9676a6b6..18d62c23 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKFramebuffer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKFramebuffer.cpp @@ -5,6 +5,7 @@ #include "VKInitialisers.h" #include "VKUtilities.h" #include "VKRenderer.h" +#include "VKTexture.h" namespace Lumos { @@ -13,16 +14,8 @@ namespace Lumos VKFramebuffer::VKFramebuffer(const FramebufferDesc& frameBufferInfo) : m_Framebuffer(nullptr) { - m_Width = frameBufferInfo.width; - m_Height = frameBufferInfo.height; - - // if(frameBufferInfo.mipIndex >= 0) - // { - // m_Width = m_Width >> frameBufferInfo.mipIndex; - // m_Height = m_Height >> frameBufferInfo.mipIndex; - // - // } - + m_Width = frameBufferInfo.width; + m_Height = frameBufferInfo.height; m_AttachmentCount = frameBufferInfo.attachmentCount; std::vector attachments; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp index dde4d6af..c3778733 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKIMGUIRenderer.cpp @@ -191,17 +191,8 @@ namespace Lumos init_info.MinImageCount = 2; init_info.ImageCount = (uint32_t)Renderer::GetMainSwapChain()->GetSwapChainBufferCount(); ImGui_ImplVulkan_Init(&init_info, wd->RenderPass); - // Upload Fonts - { - ImGuiIO& io = ImGui::GetIO(); - - unsigned char* pixels; - int width, height; - io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); - m_FontTexture = new VKTexture2D(width, height, pixels, TextureDesc(TextureFilter::NEAREST, TextureFilter::NEAREST)); - io.Fonts->TexID = (ImTextureID)m_FontTexture->GetHandle(); - } + RebuildFontTexture(); } void VKIMGUIRenderer::NewFrame() @@ -340,6 +331,9 @@ namespace Lumos { LUMOS_PROFILE_FUNCTION(); + if(m_FontTexture) + delete m_FontTexture; + // Upload Fonts { ImGuiIO& io = ImGui::GetIO(); diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKIndexBuffer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKIndexBuffer.cpp index 3e9c6043..3920e562 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKIndexBuffer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKIndexBuffer.cpp @@ -36,7 +36,7 @@ namespace Lumos void VKIndexBuffer::Bind(CommandBuffer* commandBuffer) const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); vkCmdBindIndexBuffer(static_cast(commandBuffer)->GetHandle(), m_Buffer, 0, VK_INDEX_TYPE_UINT32); } @@ -56,7 +56,7 @@ namespace Lumos void* VKIndexBuffer::GetPointerInternal() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(!m_MappedBuffer) { VKBuffer::Map(); @@ -68,7 +68,7 @@ namespace Lumos void VKIndexBuffer::ReleasePointer() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_MappedBuffer) { VKBuffer::Flush(m_Size); diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKPipeline.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKPipeline.cpp index 74d4f37a..1c95e074 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKPipeline.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKPipeline.cpp @@ -218,7 +218,7 @@ namespace Lumos ms.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; ms.pNext = NULL; ms.pSampleMask = NULL; - ms.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; + ms.rasterizationSamples = m_Description.samples > 1 ? (VkSampleCountFlagBits)m_Description.samples : VK_SAMPLE_COUNT_1_BIT; ms.sampleShadingEnable = VK_FALSE; ms.alphaToCoverageEnable = VK_FALSE; ms.alphaToOneEnable = VK_FALSE; @@ -251,7 +251,7 @@ namespace Lumos VK_CHECK_RESULT(vkCreateGraphicsPipelines(VKDevice::Get().GetDevice(), VKDevice::Get().GetPipelineCache(), 1, &graphicsPipelineCreateInfo, VK_NULL_HANDLE, &m_Pipeline)); } - if(!pipelineDesc.DebugName.empty()) + if(!pipelineDesc.DebugName) VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_PIPELINE, pipelineDesc.DebugName, m_Pipeline); return true; @@ -349,7 +349,10 @@ namespace Lumos renderPassDesc.clear = m_Description.clearTargets; renderPassDesc.cubeMapIndex = m_Description.cubeMapIndex; renderPassDesc.mipIndex = m_Description.mipIndex; - renderPassDesc.DebugName = m_Description.DebugName; + + if(m_Description.DebugName != NULL) + renderPassDesc.DebugName = m_Description.DebugName; + renderPassDesc.samples = m_Description.samples; m_RenderPass = Graphics::RenderPass::Get(renderPassDesc); @@ -359,6 +362,7 @@ namespace Lumos frameBufferDesc.attachmentCount = uint32_t(attachments.size()); frameBufferDesc.renderPass = m_RenderPass.get(); frameBufferDesc.attachmentTypes = attachmentTypes.data(); + frameBufferDesc.samples = m_Description.samples; if(m_Description.swapchainTarget) { diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.cpp index f1daebc2..d6a23714 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderPass.cpp @@ -168,7 +168,7 @@ namespace Lumos VK_CHECK_RESULT(vkCreateRenderPass(VKDevice::Get().GetDevice(), &renderPassCreateInfo, VK_NULL_HANDLE, &m_RenderPass)); if(!renderPassDesc.DebugName.empty()) - VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_RENDER_PASS, renderPassDesc.DebugName, m_RenderPass); + VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_RENDER_PASS, renderPassDesc.DebugName.c_str(), m_RenderPass); m_ClearValue = new VkClearValue[renderPassDesc.attachmentCount]; m_ClearCount = renderPassDesc.attachmentCount; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderer.cpp index d0f1668a..86d60875 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKRenderer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKRenderer.cpp @@ -7,8 +7,10 @@ #include "VKPipeline.h" #include "VKInitialisers.h" #include "VKCommandBuffer.h" +#include "VKSwapChain.h" #include "Core/Engine.h" #include "Core/Application.h" +#include "Core/OS/Window.h" #include "stb_image_write.h" @@ -40,22 +42,22 @@ namespace Lumos }; VkDescriptorPoolSize pool_sizes[] = { - { VK_DESCRIPTOR_TYPE_SAMPLER, 100000 }, - { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 100000 }, - { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 100000 }, - { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 100000 }, - { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 100000 }, - { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 100000 }, - { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 100000 }, - { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 100000 }, - { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 100000 }, - { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 100000 }, - { VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 100000 } + { VK_DESCRIPTOR_TYPE_SAMPLER, 10000 }, + { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 10000 }, + { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 10000 }, + { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 10000 }, + { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 10000 }, + { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 10000 }, + { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 10000 }, + { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 10000 }, + { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 10000 }, + { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 10000 }, + { VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 10000 } }; VkDescriptorPoolCreateInfo pool_info = {}; pool_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; pool_info.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT; - pool_info.maxSets = 100000 * 11; + pool_info.maxSets = 10000 * 11; pool_info.poolSizeCount = (uint32_t)11; pool_info.pPoolSizes = pool_sizes; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKShader.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKShader.cpp index 8b7a975b..fef8f133 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKShader.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKShader.cpp @@ -10,7 +10,7 @@ #include "Graphics/Material.h" #include "Utilities/CombineHash.h" #include "Core/OS/FileSystem.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/StringUtilities.h" #include @@ -388,11 +388,12 @@ namespace Lumos { m_Name = StringUtilities::GetFileName(filePath); m_FilePath = StringUtilities::GetFileLocation(filePath); - m_Source = VFS::Get().ReadTextFile(filePath); + m_Source = FileSystem::Get().ReadTextFile(filePath); if(m_Source.empty()) { m_Compiled = false; + LUMOS_LOG_ERROR("Failed to load shader {0}", filePath); return; } Init(); @@ -751,7 +752,9 @@ namespace Lumos m_ShaderStages[currentShaderStage].pNext = VK_NULL_HANDLE; VkResult result = vkCreateShaderModule(VKDevice::Get().GetDevice(), &shaderCreateInfo, nullptr, &m_ShaderStages[currentShaderStage].module); - VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_SHADER_MODULE, fmt::format("{}:{}", m_Name, ShaderStageToString(m_ShaderStages[currentShaderStage].stage)), m_ShaderStages[currentShaderStage].module); + + std::string debugName = m_Name + ShaderStageToString(m_ShaderStages[currentShaderStage].stage); + VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_SHADER_MODULE, debugName.c_str(), m_ShaderStages[currentShaderStage].module); if(result == VK_SUCCESS) { @@ -876,7 +879,7 @@ namespace Lumos Shader* VKShader::CreateFuncVulkan(const std::string& filepath) { std::string physicalPath; - Lumos::VFS::Get().ResolvePhysicalPath(filepath, physicalPath, false); + Lumos::FileSystem::Get().ResolvePhysicalPath(filepath, physicalPath, false); return new VKShader(physicalPath); } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp index 7520a592..52fa0896 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKSwapChain.cpp @@ -240,7 +240,7 @@ namespace Lumos m_Frames[i].MainCommandBuffer = CreateSharedPtr(); m_Frames[i].MainCommandBuffer->Init(true, m_Frames[i].CommandPool->GetHandle()); - VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_COMMAND_BUFFER, fmt::format("Commandbuffer (frame in flight: {})", i), m_Frames[i].MainCommandBuffer->GetHandle()); + VKUtilities::SetDebugUtilsObjectName(VKDevice::Get().GetDevice(), VK_OBJECT_TYPE_COMMAND_BUFFER, "Commandbuffer (frame in flight)", m_Frames[i].MainCommandBuffer->GetHandle()); } } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.cpp index efe576d8..0d8e04b0 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.cpp @@ -39,7 +39,7 @@ namespace Lumos return imageView; } - static VkSampler CreateTextureSampler(VkFilter magFilter = VK_FILTER_LINEAR, VkFilter minFilter = VK_FILTER_LINEAR, float minLod = 0.0f, float maxLod = 1.0f, bool anisotropyEnable = false, float maxAnisotropy = 1.0f, VkSamplerAddressMode modeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VkSamplerAddressMode modeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VkSamplerAddressMode modeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) + static VkSampler CreateTextureSampler(VkFilter magFilter = VK_FILTER_LINEAR, VkFilter minFilter = VK_FILTER_LINEAR, float minLod = 0.0f, float maxLod = 1.0f, bool anisotropyEnable = false, float maxAnisotropy = 1.0f, bool compareEnabled = false, VkSamplerAddressMode modeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VkSamplerAddressMode modeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VkSamplerAddressMode modeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE) { LUMOS_PROFILE_FUNCTION(); VkSampler sampler; @@ -54,10 +54,10 @@ namespace Lumos samplerInfo.maxAnisotropy = maxAnisotropy; samplerInfo.anisotropyEnable = anisotropyEnable; samplerInfo.unnormalizedCoordinates = VK_FALSE; - samplerInfo.compareEnable = VK_FALSE; + samplerInfo.compareEnable = VK_FALSE; // compareEnabled; samplerInfo.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE; samplerInfo.mipLodBias = 0.0f; - samplerInfo.compareOp = VK_COMPARE_OP_NEVER; + samplerInfo.compareOp = compareEnabled ? VK_COMPARE_OP_GREATER_OR_EQUAL : VK_COMPARE_OP_NEVER; samplerInfo.minLod = minLod; samplerInfo.maxLod = maxLod; @@ -103,9 +103,9 @@ namespace Lumos } #endif #ifdef USE_VMA_ALLOCATOR - static void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkFormat format, VkImageType imageType, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory, uint32_t arrayLayers, VkImageCreateFlags flags, VmaAllocation& allocation) + void Graphics::CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkFormat format, VkImageType imageType, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory, uint32_t arrayLayers, VkImageCreateFlags flags, VmaAllocation& allocation, uint32_t samples) #else - static void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkFormat format, VkImageType imageType, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory, uint32_t arrayLayers, VkImageCreateFlags flags) + void Graphics::CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkFormat format, VkImageType imageType, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory, uint32_t arrayLayers, VkImageCreateFlags flags, uint32_t samples) #endif { LUMOS_PROFILE_FUNCTION(); @@ -118,7 +118,7 @@ namespace Lumos imageInfo.tiling = tiling; imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; imageInfo.usage = usage; - imageInfo.samples = VK_SAMPLE_COUNT_1_BIT; + imageInfo.samples = samples > 1 ? (VkSampleCountFlagBits)samples : VK_SAMPLE_COUNT_1_BIT; imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; imageInfo.arrayLayers = arrayLayers; @@ -271,11 +271,6 @@ namespace Lumos #endif } - if(m_StagingBuffer) - delete m_StagingBuffer; - - m_StagingBuffer = nullptr; - m_ImageLayout = VK_IMAGE_LAYOUT_UNDEFINED; } @@ -458,6 +453,7 @@ namespace Lumos m_MipLevels = 1; VKBuffer* stagingBuffer = new VKBuffer(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, static_cast(imageSize), pixels); + stagingBuffer->SetDeleteWithoutQueue(true); if(m_Data == nullptr) delete[] pixels; @@ -566,14 +562,12 @@ namespace Lumos m_MipLevels = 1; - if(!m_StagingBuffer) - m_StagingBuffer = new VKBuffer(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, static_cast(imageSize), pixels); - else - m_StagingBuffer->SetData(static_cast(imageSize), pixels); - + VKBuffer* stagingBuffer = new VKBuffer(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, static_cast(imageSize), pixels); + stagingBuffer->SetDeleteWithoutQueue(true); TransitionImage(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); - VKUtilities::CopyBufferToImage(m_StagingBuffer->GetBuffer(), m_TextureImage, static_cast(m_Width), static_cast(m_Height)); + VKUtilities::CopyBufferToImage(stagingBuffer->GetBuffer(), m_TextureImage, static_cast(m_Width), static_cast(m_Height)); + delete stagingBuffer; TransitionImage(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL); } @@ -609,7 +603,7 @@ namespace Lumos Graphics::CreateImage(m_Width, m_Height, m_NumMips, m_VKFormat, VK_IMAGE_TYPE_2D, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, m_TextureImage, m_TextureImageMemory, m_NumLayers, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT); #endif - m_TextureSampler = Graphics::CreateTextureSampler(VK_FILTER_LINEAR, VK_FILTER_LINEAR, 0.0f, static_cast(m_NumMips), false, VKDevice::Get().GetPhysicalDevice()->GetProperties().limits.maxSamplerAnisotropy, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT); + m_TextureSampler = Graphics::CreateTextureSampler(VK_FILTER_LINEAR, VK_FILTER_LINEAR, 0.0f, static_cast(m_NumMips), false, VKDevice::Get().GetPhysicalDevice()->GetProperties().limits.maxSamplerAnisotropy, false, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT); m_TextureImageView = Graphics::CreateImageView(m_TextureImage, m_VKFormat, m_NumMips, VK_IMAGE_VIEW_TYPE_CUBE, VK_IMAGE_ASPECT_COLOR_BIT, m_NumLayers); if(m_Data) @@ -986,7 +980,7 @@ namespace Lumos VKUtilities::EndSingleTimeCommands(commandBuffer); - m_TextureSampler = Graphics::CreateTextureSampler(VK_FILTER_LINEAR, VK_FILTER_LINEAR, 0.0f, static_cast(m_NumMips), false, VKDevice::Get().GetPhysicalDevice()->GetProperties().limits.maxSamplerAnisotropy, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT); + m_TextureSampler = Graphics::CreateTextureSampler(VK_FILTER_LINEAR, VK_FILTER_LINEAR, 0.0f, static_cast(m_NumMips), false, VKDevice::Get().GetPhysicalDevice()->GetProperties().limits.maxSamplerAnisotropy, false, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_REPEAT); m_TextureImageView = Graphics::CreateImageView(m_TextureImage, m_VKFormat, m_NumMips, VK_IMAGE_VIEW_TYPE_CUBE, VK_IMAGE_ASPECT_COLOR_BIT, 6); m_UUID = Random64::Rand(0, std::numeric_limits::max()); @@ -1072,7 +1066,7 @@ namespace Lumos m_ImageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; - m_TextureSampler = Graphics::CreateTextureSampler(VK_FILTER_LINEAR, VK_FILTER_LINEAR, 0.0f, 1.0f, false, VKDevice::Get().GetPhysicalDevice()->GetProperties().limits.maxSamplerAnisotropy, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE); + m_TextureSampler = Graphics::CreateTextureSampler(VK_FILTER_LINEAR, VK_FILTER_LINEAR, 0.0f, 1.0f, false, VKDevice::Get().GetPhysicalDevice()->GetProperties().limits.maxSamplerAnisotropy, false, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE); m_Flags |= TextureFlags::Texture_DepthStencil; @@ -1211,7 +1205,7 @@ namespace Lumos VKUtilities::TransitionImageLayout(m_TextureImage, m_VKFormat, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, 1, m_Count); m_ImageLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; - m_TextureSampler = Graphics::CreateTextureSampler(); + m_TextureSampler = Graphics::CreateTextureSampler(VK_FILTER_LINEAR, VK_FILTER_LINEAR, 0.0f, 1, false, VKDevice::Get().GetPhysicalDevice()->GetProperties().limits.maxSamplerAnisotropy, false); m_UUID = Random64::Rand(0, std::numeric_limits::max()); diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.h b/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.h index 7b22eb5c..5b273c44 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKTexture.h @@ -14,6 +14,12 @@ namespace Lumos { namespace Graphics { +#ifdef USE_VMA_ALLOCATOR + void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkFormat format, VkImageType imageType, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory, uint32_t arrayLayers, VkImageCreateFlags flags, VmaAllocation& allocation, uint32_t samples = 1); +#else + void CreateImage(uint32_t width, uint32_t height, uint32_t mipLevels, VkFormat format, VkImageType imageType, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory, uint32_t arrayLayers, VkImageCreateFlags flags, uint32_t samples = 1); +#endif + class VKTexture2D : public Texture2D { public: @@ -166,8 +172,6 @@ namespace Lumos std::unordered_map m_MipImageViews; - VKBuffer* m_StagingBuffer = nullptr; - #ifdef USE_VMA_ALLOCATOR VmaAllocation m_Allocation {}; #endif diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.cpp index 525d18f1..5db15cc2 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.cpp @@ -8,6 +8,7 @@ #include "Graphics/RHI/DescriptorSet.h" #include "Graphics/RHI/Pipeline.h" #include "Core/Application.h" +#include "Core/OS/Window.h" #include "VKInitialisers.h" namespace Lumos @@ -858,12 +859,12 @@ namespace Lumos vkDeviceWaitIdle(VKDevice::GetHandle()); } - void VKUtilities::SetDebugUtilsObjectName(const VkDevice device, const VkObjectType objectType, const std::string& name, const void* handle) + void VKUtilities::SetDebugUtilsObjectName(const VkDevice device, const VkObjectType objectType, const char* name, const void* handle) { VkDebugUtilsObjectNameInfoEXT nameInfo; nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; nameInfo.objectType = objectType; - nameInfo.pObjectName = name.c_str(); + nameInfo.pObjectName = name; nameInfo.objectHandle = (uint64_t)handle; nameInfo.pNext = VK_NULL_HANDLE; diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.h b/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.h index 5b323b24..fd096d77 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.h +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKUtilities.h @@ -66,7 +66,7 @@ namespace Lumos VkPolygonMode PolygonModeToVk(Lumos::Graphics::PolygonMode mode); VkPrimitiveTopology DrawTypeToVk(Lumos::Graphics::DrawType type); - void SetDebugUtilsObjectName(const VkDevice device, const VkObjectType objectType, const std::string& name, const void* handle); + void SetDebugUtilsObjectName(const VkDevice device, const VkObjectType objectType, const char* name, const void* handle); } } } diff --git a/Lumos/Source/Lumos/Platform/Vulkan/VKVertexBuffer.cpp b/Lumos/Source/Lumos/Platform/Vulkan/VKVertexBuffer.cpp index b885fce5..d4962ede 100644 --- a/Lumos/Source/Lumos/Platform/Vulkan/VKVertexBuffer.cpp +++ b/Lumos/Source/Lumos/Platform/Vulkan/VKVertexBuffer.cpp @@ -19,7 +19,7 @@ namespace Lumos VKVertexBuffer::~VKVertexBuffer() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_MappedBuffer) { VKBuffer::Flush(m_Size); @@ -30,7 +30,7 @@ namespace Lumos void VKVertexBuffer::Resize(uint32_t size) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_Size != size) { @@ -41,7 +41,7 @@ namespace Lumos void VKVertexBuffer::SetData(uint32_t size, const void* data) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_Size < size) { m_Size = size; @@ -55,7 +55,7 @@ namespace Lumos void VKVertexBuffer::SetDataSub(uint32_t size, const void* data, uint32_t offset) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_Size = size; if(m_Size < size) @@ -71,7 +71,7 @@ namespace Lumos void* VKVertexBuffer::GetPointerInternal() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(!m_MappedBuffer) { VKBuffer::Map(); @@ -83,7 +83,7 @@ namespace Lumos void VKVertexBuffer::ReleasePointer() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(m_MappedBuffer) { VKBuffer::Flush(m_Size); @@ -94,7 +94,7 @@ namespace Lumos void VKVertexBuffer::Bind(CommandBuffer* commandBuffer, Pipeline* pipeline) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); VkDeviceSize offsets[1] = { 0 }; if(commandBuffer) vkCmdBindVertexBuffers(static_cast(commandBuffer)->GetHandle(), 0, 1, &m_Buffer, offsets); diff --git a/Lumos/Source/Lumos/Platform/Windows/WindowsOS.cpp b/Lumos/Source/Lumos/Platform/Windows/WindowsOS.cpp index 2078e92c..5805cdc9 100644 --- a/Lumos/Source/Lumos/Platform/Windows/WindowsOS.cpp +++ b/Lumos/Source/Lumos/Platform/Windows/WindowsOS.cpp @@ -105,7 +105,7 @@ namespace Lumos void WindowsOS::SetTitleBarColour(const glm::vec4& colour, bool dark) { - #if WINVER >= 0x0A00 +#if WINVER >= 0x0A00 auto& app = Lumos::Application::Get(); HWND hwnd = glfwGetWin32Window((GLFWwindow*)static_cast(app.GetWindow()->GetHandle())); diff --git a/Lumos/Source/Lumos/Scene/Component/Components.h b/Lumos/Source/Lumos/Scene/Component/Components.h index a895ab2c..d991ed8e 100644 --- a/Lumos/Source/Lumos/Scene/Component/Components.h +++ b/Lumos/Source/Lumos/Scene/Component/Components.h @@ -34,7 +34,7 @@ namespace Lumos void save(Archive& archive) const { std::string path; - VFS::Get().AbsoulePathToVFS(FontHandle ? FontHandle->GetFilePath() : "", path); + FileSystem::Get().AbsolutePathToFileSystem(FontHandle ? FontHandle->GetFilePath() : "", path); archive(cereal::make_nvp("TextString", TextString), cereal::make_nvp("Path", path), cereal::make_nvp("Colour", Colour), cereal::make_nvp("LineSpacing", LineSpacing), cereal::make_nvp("Kerning", Kerning), cereal::make_nvp("MaxWidth", MaxWidth), cereal::make_nvp("OutlineColour", OutlineColour), cereal::make_nvp("OutlineWidth", OutlineWidth)); diff --git a/Lumos/Source/Lumos/Scene/Component/ModelComponent.h b/Lumos/Source/Lumos/Scene/Component/ModelComponent.h index 74c2a6bb..bcb49062 100644 --- a/Lumos/Source/Lumos/Scene/Component/ModelComponent.h +++ b/Lumos/Source/Lumos/Scene/Component/ModelComponent.h @@ -1,7 +1,6 @@ #pragma once -#include "Precompiled.h" #include "Graphics/Model.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include namespace Lumos::Graphics @@ -41,7 +40,7 @@ namespace Lumos::Graphics std::string newPath; if(ModelRef->GetPrimitiveType() == PrimitiveType::File) - VFS::Get().AbsoulePathToVFS(ModelRef->GetFilePath(), newPath); + FileSystem::Get().AbsolutePathToFileSystem(ModelRef->GetFilePath(), newPath); else newPath = "Primitive"; diff --git a/Lumos/Source/Lumos/Scene/Component/RigidBody3DComponent.cpp b/Lumos/Source/Lumos/Scene/Component/RigidBody3DComponent.cpp index 3df0ee76..c80fd8d0 100644 --- a/Lumos/Source/Lumos/Scene/Component/RigidBody3DComponent.cpp +++ b/Lumos/Source/Lumos/Scene/Component/RigidBody3DComponent.cpp @@ -7,26 +7,50 @@ namespace Lumos { + RigidBody3DInstance::RigidBody3DInstance() + { + Body = Application::Get().GetSystem()->CreateBody({}); + } + + RigidBody3DInstance::RigidBody3DInstance(RigidBody3D* physics) + { + Body = physics; + } + + RigidBody3DInstance::RigidBody3DInstance(const RigidBody3DProperties& params) + { + Body = Application::Get().GetSystem()->CreateBody(params); + } + + RigidBody3DInstance::~RigidBody3DInstance() + { + if(Body) + Application::Get().GetSystem()->DestroyBody(Body); + } + RigidBody3DComponent::RigidBody3DComponent() - //: m_RigidBody(CreateSharedPtr()) { - m_RigidBody = Application::Get().GetSystem()->CreateBody({}); + m_RigidBody = CreateSharedPtr(); } RigidBody3DComponent::RigidBody3DComponent(RigidBody3D* physics) - : m_RigidBody(physics) { + m_RigidBody = CreateSharedPtr(physics); } RigidBody3DComponent::RigidBody3DComponent(const RigidBody3DProperties& properties) { - m_RigidBody = Application::Get().GetSystem()->CreateBody(properties); - + m_RigidBody = CreateSharedPtr(properties); } RigidBody3DComponent::RigidBody3DComponent(const RigidBody3DComponent& other) { - m_RigidBody = other.m_RigidBody; + m_RigidBody = other.m_RigidBody; + m_OwnRigidBody = other.m_OwnRigidBody; + } + + RigidBody3DComponent::~RigidBody3DComponent() + { } void RigidBody3DComponent::Init() @@ -43,23 +67,23 @@ namespace Lumos ImGui::Columns(2); ImGui::Separator(); - auto pos = m_RigidBody->GetPosition(); - auto torque = m_RigidBody->GetTorque(); - auto orientation = m_RigidBody->GetOrientation(); - auto angularVelocity = m_RigidBody->GetAngularVelocity(); - auto friction = m_RigidBody->GetFriction(); - auto isStatic = m_RigidBody->GetIsStatic(); - auto isRest = m_RigidBody->GetIsAtRest(); - auto mass = 1.0f / m_RigidBody->GetInverseMass(); - auto velocity = m_RigidBody->GetLinearVelocity(); - auto elasticity = m_RigidBody->GetElasticity(); + auto pos = m_RigidBody->Body->GetPosition(); + auto torque = m_RigidBody->Body->GetTorque(); + auto orientation = m_RigidBody->Body->GetOrientation(); + auto angularVelocity = m_RigidBody->Body->GetAngularVelocity(); + auto friction = m_RigidBody->Body->GetFriction(); + auto isStatic = m_RigidBody->Body->GetIsStatic(); + auto isRest = m_RigidBody->Body->GetIsAtRest(); + auto mass = 1.0f / m_RigidBody->Body->GetInverseMass(); + auto velocity = m_RigidBody->Body->GetLinearVelocity(); + auto elasticity = m_RigidBody->Body->GetElasticity(); ImGui::AlignTextToFramePadding(); ImGui::TextUnformatted("Position"); ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::DragFloat3("##Position", glm::value_ptr(pos))) - m_RigidBody->SetPosition(pos); + m_RigidBody->Body->SetPosition(pos); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -69,7 +93,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::DragFloat3("##Velocity", glm::value_ptr(velocity))) - m_RigidBody->SetLinearVelocity(velocity); + m_RigidBody->Body->SetLinearVelocity(velocity); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -79,7 +103,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::DragFloat3("##Torque", glm::value_ptr(torque))) - m_RigidBody->SetTorque(torque); + m_RigidBody->Body->SetTorque(torque); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -89,7 +113,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::DragFloat4("##Orientation", glm::value_ptr(orientation))) - m_RigidBody->SetOrientation(orientation); + m_RigidBody->Body->SetOrientation(orientation); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -99,7 +123,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::DragFloat3("##Angular Velocity", glm::value_ptr(angularVelocity))) - m_RigidBody->SetAngularVelocity(angularVelocity); + m_RigidBody->Body->SetAngularVelocity(angularVelocity); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -109,7 +133,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::DragFloat("##Friction", &friction)) - m_RigidBody->SetFriction(friction); + m_RigidBody->Body->SetFriction(friction); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -119,7 +143,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::DragFloat("##Mass", &mass)) - m_RigidBody->SetInverseMass(1.0f / mass); + m_RigidBody->Body->SetInverseMass(1.0f / mass); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -129,7 +153,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::DragFloat("##Elasticity", &elasticity)) - m_RigidBody->SetElasticity(elasticity); + m_RigidBody->Body->SetElasticity(elasticity); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -139,7 +163,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::Checkbox("##Static", &isStatic)) - m_RigidBody->SetIsStatic(isStatic); + m_RigidBody->Body->SetIsStatic(isStatic); ImGui::PopItemWidth(); ImGui::NextColumn(); @@ -149,7 +173,7 @@ namespace Lumos ImGui::NextColumn(); ImGui::PushItemWidth(-1); if(ImGui::Checkbox("##At Rest", &isRest)) - m_RigidBody->SetIsAtRest(isRest); + m_RigidBody->Body->SetIsAtRest(isRest); ImGui::PopItemWidth(); ImGui::NextColumn(); diff --git a/Lumos/Source/Lumos/Scene/Component/RigidBody3DComponent.h b/Lumos/Source/Lumos/Scene/Component/RigidBody3DComponent.h index d27dd2b0..6f88e6c0 100644 --- a/Lumos/Source/Lumos/Scene/Component/RigidBody3DComponent.h +++ b/Lumos/Source/Lumos/Scene/Component/RigidBody3DComponent.h @@ -13,6 +13,16 @@ namespace Lumos { + struct RigidBody3DInstance + { + RigidBody3DInstance(); + RigidBody3DInstance(RigidBody3D* physics); + RigidBody3DInstance(const RigidBody3DProperties& params); + + ~RigidBody3DInstance(); + RigidBody3D* Body; + }; + class AxisConstraintComponent { public: @@ -105,11 +115,28 @@ namespace Lumos public: RigidBody3DComponent(); RigidBody3DComponent(const RigidBody3DComponent& other); - RigidBody3DComponent(RigidBody3D* physics); RigidBody3DComponent(const RigidBody3DProperties& params); - ~RigidBody3DComponent() = default; + ~RigidBody3DComponent(); + + inline RigidBody3DComponent& operator=(RigidBody3DComponent& moving) + { + m_OwnRigidBody = moving.m_OwnRigidBody; + moving.m_OwnRigidBody = false; + m_RigidBody = moving.m_RigidBody; + + return *this; + } + + inline RigidBody3DComponent& operator=(RigidBody3DComponent&& rhs) noexcept + { + m_OwnRigidBody = rhs.m_OwnRigidBody; + rhs.m_OwnRigidBody = false; + m_RigidBody = rhs.m_RigidBody; + + return *this; + } void Init(); void Update(); @@ -117,24 +144,25 @@ namespace Lumos RigidBody3D* GetRigidBody() const { - return m_RigidBody; + return m_RigidBody->Body; } template void save(Archive& archive) const { - archive(*m_RigidBody); + archive(*(m_RigidBody->Body)); } template void load(Archive& archive) { // m_RigidBody = CreateSharedPtr(); - m_RigidBody = Application::Get().GetSystem()->CreateBody({}); - archive(*m_RigidBody); + m_RigidBody = CreateSharedPtr(); + archive(*(m_RigidBody->Body)); } private: - RigidBody3D* m_RigidBody; + SharedPtr m_RigidBody; + bool m_OwnRigidBody = false; }; } diff --git a/Lumos/Source/Lumos/Scene/Entity.h b/Lumos/Source/Lumos/Scene/Entity.h index 8cc54e96..58676e24 100644 --- a/Lumos/Source/Lumos/Scene/Entity.h +++ b/Lumos/Source/Lumos/Scene/Entity.h @@ -52,7 +52,7 @@ namespace Lumos template T& AddComponent(Args&&... args) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); #ifdef LUMOS_DEBUG if(HasComponent()) LUMOS_LOG_WARN("Attempting to add Component twice"); @@ -63,56 +63,56 @@ namespace Lumos template T& GetOrAddComponent(Args&&... args) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Scene->GetRegistry().get_or_emplace(m_EntityHandle, std::forward(args)...); } template void AddOrReplaceComponent(Args&&... args) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_Scene->GetRegistry().emplace_or_replace(m_EntityHandle, std::forward(args)...); } template T& GetComponent() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Scene->GetRegistry().get(m_EntityHandle); } template T* TryGetComponent() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Scene->GetRegistry().try_get(m_EntityHandle); } template bool HasComponent() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Scene->GetRegistry().all_of(m_EntityHandle); } template void RemoveComponent() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_Scene->GetRegistry().remove(m_EntityHandle); } template void TryRemoveComponent() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); if(HasComponent()) RemoveComponent(); } bool Active() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); bool active = true; if(HasComponent()) active = m_Scene->GetRegistry().get(m_EntityHandle).active; @@ -125,31 +125,31 @@ namespace Lumos void SetActive(bool isActive) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); GetOrAddComponent().active = isActive; } Maths::Transform& GetTransform() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Scene->GetRegistry().get(m_EntityHandle); } const Maths::Transform& GetTransform() const { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Scene->GetRegistry().get(m_EntityHandle); } uint64_t GetID() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Scene->GetRegistry().get(m_EntityHandle).ID; } const std::string& GetName() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); auto nameComponent = TryGetComponent(); if(nameComponent) @@ -163,7 +163,7 @@ namespace Lumos void SetParent(Entity entity) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); bool acceptable = false; auto hierarchyComponent = TryGetComponent(); if(hierarchyComponent != nullptr) @@ -189,7 +189,7 @@ namespace Lumos Entity GetParent() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); auto hierarchyComp = TryGetComponent(); if(hierarchyComp) return Entity(hierarchyComp->Parent(), m_Scene); @@ -199,7 +199,7 @@ namespace Lumos std::vector GetChildren() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); std::vector children; auto hierarchyComponent = TryGetComponent(); if(hierarchyComponent) @@ -219,7 +219,7 @@ namespace Lumos void ClearChildren() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); auto hierarchyComponent = TryGetComponent(); if(hierarchyComponent) { @@ -229,7 +229,7 @@ namespace Lumos bool IsParent(Entity potentialParent) { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); auto nodeHierarchyComponent = m_Scene->GetRegistry().try_get(m_EntityHandle); if(nodeHierarchyComponent) { @@ -283,13 +283,13 @@ namespace Lumos void Destroy() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); m_Scene->GetRegistry().destroy(m_EntityHandle); } bool Valid() { - LUMOS_PROFILE_FUNCTION(); + LUMOS_PROFILE_FUNCTION_LOW(); return m_Scene->GetRegistry().valid(m_EntityHandle) && m_Scene; } diff --git a/Lumos/Source/Lumos/Scene/ISystem.h b/Lumos/Source/Lumos/Scene/ISystem.h index 16acedc2..c2873924 100644 --- a/Lumos/Source/Lumos/Scene/ISystem.h +++ b/Lumos/Source/Lumos/Scene/ISystem.h @@ -11,7 +11,7 @@ namespace Lumos ISystem() = default; virtual ~ISystem() = default; - virtual void OnInit() = 0; + virtual bool OnInit() = 0; virtual void OnUpdate(const TimeStep& dt, Scene* scene) = 0; virtual void OnImGui() = 0; virtual void OnDebugDraw() = 0; diff --git a/Lumos/Source/Lumos/Scene/Scene.cpp b/Lumos/Source/Lumos/Scene/Scene.cpp index d3f8624e..8e60bfea 100644 --- a/Lumos/Source/Lumos/Scene/Scene.cpp +++ b/Lumos/Source/Lumos/Scene/Scene.cpp @@ -51,6 +51,8 @@ CEREAL_REGISTER_POLYMORPHIC_RELATION(Lumos::CollisionShape, Lumos::PyramidCollis CEREAL_REGISTER_POLYMORPHIC_RELATION(Lumos::CollisionShape, Lumos::HullCollisionShape); CEREAL_REGISTER_POLYMORPHIC_RELATION(Lumos::CollisionShape, Lumos::CapsuleCollisionShape); +#pragma warning(push, 0) +// Legacy version of entt snapshot loaded to load older scene versions saved before updating entt namespace entt { @@ -197,6 +199,7 @@ namespace entt basic_registry* reg; }; } +#pragma warning(pop) namespace Lumos { @@ -646,7 +649,7 @@ namespace Lumos Entity Scene::InstantiatePrefab(const std::string& path) { - std::string prefabData = VFS::Get().ReadTextFile(path); + std::string prefabData = FileSystem::Get().ReadTextFile(path); std::stringstream storage(prefabData); cereal::JSONInputArchive input(storage); @@ -662,7 +665,7 @@ namespace Lumos DeserializeEntityHierarchy(entity, input, version); std::string relativePath; - if(VFS::Get().AbsoulePathToVFS(path, relativePath)) + if(FileSystem::Get().AbsolutePathToFileSystem(path, relativePath)) entity.AddComponent(relativePath); else entity.AddComponent(path); @@ -720,7 +723,7 @@ namespace Lumos FileSystem::WriteTextFile(path, storage.str()); std::string relativePath; - if(VFS::Get().AbsoulePathToVFS(path, relativePath)) + if(FileSystem::Get().AbsolutePathToFileSystem(path, relativePath)) entity.AddComponent(relativePath); } } diff --git a/Lumos/Source/Lumos/Scene/SceneManager.cpp b/Lumos/Source/Lumos/Scene/SceneManager.cpp index 172b5d07..5a640cb4 100644 --- a/Lumos/Source/Lumos/Scene/SceneManager.cpp +++ b/Lumos/Source/Lumos/Scene/SceneManager.cpp @@ -7,7 +7,7 @@ #include "Scene.h" #include "Physics/LumosPhysicsEngine/LumosPhysicsEngine.h" #include "Core/OS/FileSystem.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/StringUtilities.h" namespace Lumos @@ -29,12 +29,12 @@ namespace Lumos m_CurrentScene->OnCleanupScene(); } - m_vpAllScenes.clear(); + m_vpAllScenes.Clear(); } void SceneManager::SwitchScene() { - SwitchScene((m_SceneIdx + 1) % m_vpAllScenes.size()); + SwitchScene((m_SceneIdx + 1) % m_vpAllScenes.Size()); } void SceneManager::SwitchScene(int idx) @@ -48,7 +48,7 @@ namespace Lumos bool found = false; m_SwitchingScenes = true; uint32_t idx = 0; - for(uint32_t i = 0; !found && i < m_vpAllScenes.size(); ++i) + for(uint32_t i = 0; !found && i < m_vpAllScenes.Size(); ++i) { if(m_vpAllScenes[i]->GetSceneName() == name) { @@ -75,13 +75,13 @@ namespace Lumos if(m_CurrentScene) return; - if(m_vpAllScenes.empty()) - m_vpAllScenes.push_back(CreateSharedPtr("NewScene")); + if(m_vpAllScenes.Empty()) + m_vpAllScenes.Emplace(CreateSharedPtr("NewScene")); m_QueuedSceneIndex = 0; } - if(m_QueuedSceneIndex < 0 || m_QueuedSceneIndex >= static_cast(m_vpAllScenes.size())) + if(m_QueuedSceneIndex < 0 || m_QueuedSceneIndex >= static_cast(m_vpAllScenes.Size())) { LUMOS_LOG_ERROR("[SceneManager] - Invalid Scene Index : {0}", m_QueuedSceneIndex); m_QueuedSceneIndex = 0; @@ -108,7 +108,7 @@ namespace Lumos app.GetSystem()->SetPaused(false); std::string physicalPath; - if(Lumos::VFS::Get().ResolvePhysicalPath("//Scenes/" + m_CurrentScene->GetSceneName() + ".lsn", physicalPath)) + if(Lumos::FileSystem::Get().ResolvePhysicalPath("//Assets/Scenes/" + m_CurrentScene->GetSceneName() + ".lsn", physicalPath)) { auto newPath = StringUtilities::RemoveName(physicalPath); m_CurrentScene->Deserialise(newPath, false); @@ -127,13 +127,13 @@ namespace Lumos m_SwitchingScenes = false; } - std::vector SceneManager::GetSceneNames() + Vector SceneManager::GetSceneNames() { - std::vector names; + Vector names; for(auto& scene : m_vpAllScenes) { - names.push_back(scene->GetSceneName()); + names.Emplace(scene->GetSceneName()); } return names; @@ -141,41 +141,62 @@ namespace Lumos int SceneManager::EnqueueSceneFromFile(const std::string& filePath) { - auto found = std::find(m_SceneFilePaths.begin(), m_SceneFilePaths.end(), filePath); - if(found != m_SceneFilePaths.end()) - return int(found - m_SceneFilePaths.begin()); + /* auto found = std::find(m_SceneFilePaths.begin(), m_SceneFilePaths.end(), filePath); + if(found != m_SceneFilePaths.end()) + return int(found - m_SceneFilePaths.begin());*/ - m_SceneFilePaths.push_back(filePath); + for(uint32_t i = 0; i < m_SceneFilePaths.Size(); ++i) + { + if(m_SceneFilePaths[i] == filePath) + { + return i; + } + } + + m_SceneFilePaths.Emplace(filePath); auto name = StringUtilities::RemoveFilePathExtension(StringUtilities::GetFileName(filePath)); auto scene = new Scene(name); EnqueueScene(scene); - return int(m_vpAllScenes.size()) - 1; + return int(m_vpAllScenes.Size()) - 1; } void SceneManager::EnqueueScene(Scene* scene) { - m_vpAllScenes.push_back(SharedPtr(scene)); + m_vpAllScenes.Emplace(SharedPtr(scene)); LUMOS_LOG_INFO("[SceneManager] - Enqueued scene : {0}", scene->GetSceneName().c_str()); } + bool SceneManager::ContainsScene(const std::string& filePath) + { + for(uint32_t i = 0; i < m_SceneFilePaths.Size(); ++i) + { + if(m_SceneFilePaths[i] == filePath) + { + return true; + } + } + + return false; + } + void SceneManager::LoadCurrentList() { for(auto& filePath : m_SceneFilePathsToLoad) { std::string newPath; - VFS::Get().AbsoulePathToVFS(filePath, newPath); + FileSystem::Get().AbsolutePathToFileSystem(filePath, newPath); EnqueueSceneFromFile(filePath); } - m_SceneFilePathsToLoad.clear(); + m_SceneFilePathsToLoad.Clear(); } - const std::vector& SceneManager::GetSceneFilePaths() + const Vector& SceneManager::GetSceneFilePaths() { - m_SceneFilePaths.clear(); + m_SceneFilePaths.Clear(); for(auto scene : m_vpAllScenes) - m_SceneFilePaths.push_back("//Scenes/" + scene->GetSceneName()); + m_SceneFilePaths.Emplace("//Assets/Scenes/" + scene->GetSceneName()); return m_SceneFilePaths; } } diff --git a/Lumos/Source/Lumos/Scene/SceneManager.h b/Lumos/Source/Lumos/Scene/SceneManager.h index f63b3aab..caa38e18 100644 --- a/Lumos/Source/Lumos/Scene/SceneManager.h +++ b/Lumos/Source/Lumos/Scene/SceneManager.h @@ -1,4 +1,5 @@ #pragma once +#include "Core/DataStructures/Vector.h" namespace Lumos { @@ -36,11 +37,11 @@ namespace Lumos // Get total number of enqueued scenes inline uint32_t SceneCount() const { - return static_cast(m_vpAllScenes.size()); + return static_cast(m_vpAllScenes.Size()); } - std::vector GetSceneNames(); - const std::vector>& GetScenes() const + Vector GetSceneNames(); + const Vector>& GetScenes() const { return m_vpAllScenes; } @@ -57,19 +58,21 @@ namespace Lumos int EnqueueSceneFromFile(const std::string& filePath); void EnqueueScene(Scene* scene); + bool ContainsScene(const std::string& filePath); + template void EnqueueScene(const std::string& name) { // T* scene = new T(name); - m_vpAllScenes.emplace_back(CreateSharedPtr(name)); + m_vpAllScenes.Emplace(CreateSharedPtr(name)); LUMOS_LOG_INFO("[SceneManager] - Enqueued scene : {0}", name.c_str()); } - const std::vector& GetSceneFilePaths(); + const Vector& GetSceneFilePaths(); void AddFileToLoadList(const std::string& filePath) { - m_SceneFilePathsToLoad.push_back(filePath); + m_SceneFilePathsToLoad.Emplace(filePath); } void LoadCurrentList(); @@ -77,9 +80,9 @@ namespace Lumos protected: uint32_t m_SceneIdx; Scene* m_CurrentScene; - std::vector> m_vpAllScenes; - std::vector m_SceneFilePaths; - std::vector m_SceneFilePathsToLoad; + Vector> m_vpAllScenes; + Vector m_SceneFilePaths; + Vector m_SceneFilePathsToLoad; private: bool m_SwitchingScenes = false; diff --git a/Lumos/Source/Lumos/Scene/SystemManager.h b/Lumos/Source/Lumos/Scene/SystemManager.h index 7c92cd0a..a1e1c7f4 100644 --- a/Lumos/Source/Lumos/Scene/SystemManager.h +++ b/Lumos/Source/Lumos/Scene/SystemManager.h @@ -1,6 +1,7 @@ #pragma once #include "Scene/ISystem.h" #include +#include namespace Lumos { diff --git a/Lumos/Source/Lumos/Scripting/Lua/LuaManager.cpp b/Lumos/Source/Lumos/Scripting/Lua/LuaManager.cpp index 51e9c220..0f9809a1 100644 --- a/Lumos/Source/Lumos/Scripting/Lua/LuaManager.cpp +++ b/Lumos/Source/Lumos/Scripting/Lua/LuaManager.cpp @@ -2,7 +2,7 @@ #include "LuaManager.h" #include "Maths/Transform.h" #include "Core/OS/Window.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Scene/Scene.h" #include "Core/Application.h" #include "Core/Engine.h" @@ -35,6 +35,14 @@ #include #include +#include +#include +#include +#include +#include +#include +#include + #if __has_include() #include #elif __has_include() @@ -222,7 +230,7 @@ namespace Lumos // auto& state = *m_State; // std::string ScriptsPath; - // VFS::Get().ResolvePhysicalPath("//Scripts", ScriptsPath); + // FileSystem::Get().ResolvePhysicalPath("//Assets/Scripts", ScriptsPath); // //// Setup the lua path to see luarocks packages // auto package_path = std::filesystem::path(ScriptsPath) / "lua" / "?.lua;"; @@ -263,7 +271,7 @@ namespace Lumos { auto& state = *m_State; std::string ScriptsPath; - VFS::Get().ResolvePhysicalPath("//Scripts", ScriptsPath); + FileSystem::Get().ResolvePhysicalPath("//Assets/Scripts", ScriptsPath); // Setup the lua path to see luarocks packages auto package_path = std::filesystem::path(ScriptsPath) / "lua" / "?.lua;"; @@ -619,7 +627,7 @@ namespace Lumos RigidBody3DComponent_type.set_function("GetRigidBody", &RigidBody3DComponent::GetRigidBody); REGISTER_COMPONENT_WITH_ECS(state, RigidBody3DComponent, static_cast(&Entity::AddComponent)); - //REGISTER_COMPONENT_WITH_ECS(state, RigidBody3DComponent, static_cast(&Entity::AddComponent(&Entity::AddComponent RigidBody2DComponent_type = state.new_usertype("RigidBody2DComponent", sol::constructors>()); RigidBody2DComponent_type.set_function("GetRigidBody", &RigidBody2DComponent::GetRigidBody); diff --git a/Lumos/Source/Lumos/Scripting/Lua/LuaScriptComponent.cpp b/Lumos/Source/Lumos/Scripting/Lua/LuaScriptComponent.cpp index e0b4a9a4..802fb3d2 100644 --- a/Lumos/Source/Lumos/Scripting/Lua/LuaScriptComponent.cpp +++ b/Lumos/Source/Lumos/Scripting/Lua/LuaScriptComponent.cpp @@ -47,14 +47,14 @@ namespace Lumos { m_FileName = fileName; std::string physicalPath; - if(!VFS::Get().ResolvePhysicalPath(fileName, physicalPath)) + if(!FileSystem::Get().ResolvePhysicalPath(fileName, physicalPath)) { LUMOS_LOG_ERROR("Failed to Load Lua script {0}", fileName); m_Env = nullptr; return; } - VFS::Get().AbsoulePathToVFS(m_FileName, m_FileName); + FileSystem::Get().AbsolutePathToFileSystem(m_FileName, m_FileName); m_Env = CreateSharedPtr(LuaManager::Get().GetState(), sol::create, LuaManager::Get().GetState().globals()); diff --git a/Lumos/Source/Lumos/Scripting/Lua/LuaScriptComponent.h b/Lumos/Source/Lumos/Scripting/Lua/LuaScriptComponent.h index 0038fc74..b379abfc 100644 --- a/Lumos/Source/Lumos/Scripting/Lua/LuaScriptComponent.h +++ b/Lumos/Source/Lumos/Scripting/Lua/LuaScriptComponent.h @@ -64,7 +64,7 @@ namespace Lumos void save(Archive& archive) const { std::string newPath; - VFS::Get().AbsoulePathToVFS(m_FileName, newPath); + FileSystem::Get().AbsolutePathToFileSystem(m_FileName, newPath); archive(cereal::make_nvp("FilePath", newPath)); } diff --git a/Lumos/Source/Lumos/Scripting/Lua/PhysicsLua.cpp b/Lumos/Source/Lumos/Scripting/Lua/PhysicsLua.cpp index d5ecc94c..44d5e4cd 100644 --- a/Lumos/Source/Lumos/Scripting/Lua/PhysicsLua.cpp +++ b/Lumos/Source/Lumos/Scripting/Lua/PhysicsLua.cpp @@ -333,16 +333,15 @@ namespace Lumos physicsObjectParameters_type["position"] = &RigidBodyParameters::position; physicsObjectParameters_type["scale"] = &RigidBodyParameters::scale; physicsObjectParameters_type["isStatic"] = &RigidBodyParameters::isStatic; - physicsObjectParameters_type["customShapePositions"] = &RigidBodyParameters::custumShapePositions; - - + physicsObjectParameters_type["customShapePositions"] = &RigidBodyParameters::customShapePositions; + sol::usertype physicsObjectParameters3D_type = state.new_usertype("RigidBodyParameters3D"); - physicsObjectParameters3D_type["mass"] = &RigidBody3DProperties::Mass; - //physicsObjectParameters3D_type["shape"] = &RigidBody3DProperties::Shape; - physicsObjectParameters3D_type["position"] = &RigidBody3DProperties::Position; - //physicsObjectParameters3D_type["scale"] = &RigidBody3DProperties::Scale; - physicsObjectParameters3D_type["isStatic"] = &RigidBody3DProperties::Static; - //physicsObjectParameters3D_type["customShapePositions"] = &RigidBody3DProperties::custumShapePositions; + physicsObjectParameters3D_type["mass"] = &RigidBody3DProperties::Mass; + // physicsObjectParameters3D_type["shape"] = &RigidBody3DProperties::Shape; + physicsObjectParameters3D_type["position"] = &RigidBody3DProperties::Position; + // physicsObjectParameters3D_type["scale"] = &RigidBody3DProperties::Scale; + physicsObjectParameters3D_type["isStatic"] = &RigidBody3DProperties::Static; + // physicsObjectParameters3D_type["customShapePositions"] = &RigidBody3DProperties::customShapePositions; sol::usertype physics3D_type = state.new_usertype("RigidBody3D"); //, sol::constructors()); //;const RigidBodyParameters&)>()); physics3D_type.set_function("SetForce", &RigidBody3D::SetForce); diff --git a/Lumos/Source/Lumos/Utilities/ExternalBuild.cpp b/Lumos/Source/Lumos/Utilities/ExternalBuild.cpp index 0f0f4199..eb04f7ab 100644 --- a/Lumos/Source/Lumos/Utilities/ExternalBuild.cpp +++ b/Lumos/Source/Lumos/Utilities/ExternalBuild.cpp @@ -38,6 +38,6 @@ #define STB_PERLIN_IMPLEMENTATION #include -#include -#include +#include +#include #pragma warning(pop) diff --git a/Lumos/Source/Lumos/Utilities/LoadImage.cpp b/Lumos/Source/Lumos/Utilities/LoadImage.cpp index 77e7d839..c0fb80d2 100644 --- a/Lumos/Source/Lumos/Utilities/LoadImage.cpp +++ b/Lumos/Source/Lumos/Utilities/LoadImage.cpp @@ -1,27 +1,33 @@ #include "Precompiled.h" #include "LoadImage.h" -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #ifdef FREEIMAGE #include #include #else #define STB_IMAGE_IMPLEMENTATION +#define STB_IMAGE_RESIZE_IMPLEMENTATION #ifdef LUMOS_PLATFORM_LINUX #define STBI_NO_SIMD #endif #include "stb_image.h" +#include "stb_image_resize.h" #endif namespace Lumos { + + static uint32_t s_MaxWidth = 0; + static uint32_t s_MaxHeight = 0; + uint8_t* LoadImageFromFile(const char* filename, uint32_t* width, uint32_t* height, uint32_t* bits, bool* isHDR, bool flipY, bool srgb) { LUMOS_PROFILE_FUNCTION(); std::string filePath = std::string(filename); std::string physicalPath; - if(!VFS::Get().ResolvePhysicalPath(filePath, physicalPath)) + if(!FileSystem::Get().ResolvePhysicalPath(filePath, physicalPath)) return nullptr; filename = physicalPath.c_str(); @@ -45,6 +51,39 @@ namespace Lumos *isHDR = false; } + // Resize the image if it exceeds the maximum width or height + if(s_MaxWidth > 0 && s_MaxHeight > 0 && (texWidth > s_MaxWidth || texHeight > s_MaxHeight)) + { + uint32_t texWidthOld = texWidth, texHeightOld = texHeight; + float aspectRatio = static_cast(texWidth) / static_cast(texHeight); + if(texWidth > s_MaxWidth) + { + texWidth = s_MaxWidth; + texHeight = static_cast(s_MaxWidth / aspectRatio); + } + if(texHeight > s_MaxHeight) + { + texHeight = s_MaxHeight; + texWidth = static_cast(s_MaxHeight * aspectRatio); + } + + // Resize the image using stbir + int resizedChannels = texChannels; + uint8_t* resizedPixels = (stbi_uc*)malloc(texWidth * texHeight * resizedChannels); + + if(isHDR) + { + stbir_resize_float((float*)pixels, texWidthOld, texHeightOld, 0, (float*)resizedPixels, texWidth, texHeight, 0, resizedChannels); + } + else + { + stbir_resize_uint8(pixels, texWidthOld, texHeightOld, 0, resizedPixels, texWidth, texHeight, 0, resizedChannels); + } + + free(pixels); // Free the original image + pixels = resizedPixels; + } + if(!pixels) { LUMOS_LOG_ERROR("Could not load image '{0}'!", filename); @@ -85,8 +124,8 @@ namespace Lumos if(bits) *bits = texChannels * sizeOfChannel; // texChannels; //32 bits for 4 bytes r g b a - const int32_t size = texWidth * texHeight * texChannels * sizeOfChannel / 8; - uint8_t* result = new uint8_t[size]; + const uint64_t size = uint64_t(texWidth) * uint64_t(texHeight) * uint64_t(texChannels) * uint64_t(sizeOfChannel / 8U); + uint8_t* result = new uint8_t[size]; memcpy(result, pixels, size); stbi_image_free(pixels); @@ -97,4 +136,16 @@ namespace Lumos { return LoadImageFromFile(filename.c_str(), width, height, bits, isHDR, srgb, flipY); } + + void SetMaxImageDimensions(uint32_t width, uint32_t height) + { + s_MaxWidth = width; + s_MaxHeight = height; + } + + void GetMaxImageDimensions(uint32_t& width, uint32_t& height) + { + width = s_MaxWidth; + height = s_MaxHeight; + } } diff --git a/Lumos/Source/Lumos/Utilities/LoadImage.h b/Lumos/Source/Lumos/Utilities/LoadImage.h index 824a98df..85e77066 100644 --- a/Lumos/Source/Lumos/Utilities/LoadImage.h +++ b/Lumos/Source/Lumos/Utilities/LoadImage.h @@ -4,4 +4,7 @@ namespace Lumos { LUMOS_EXPORT uint8_t* LoadImageFromFile(const char* filename, uint32_t* width = nullptr, uint32_t* height = nullptr, uint32_t* bits = nullptr, bool* isHDR = nullptr, bool flipY = false, bool srgb = true); LUMOS_EXPORT uint8_t* LoadImageFromFile(const std::string& filename, uint32_t* width = nullptr, uint32_t* height = nullptr, uint32_t* bits = nullptr, bool* isHDR = nullptr, bool flipY = false, bool srgb = true); + LUMOS_EXPORT void SetMaxImageDimensions(uint32_t width, uint32_t height); + + LUMOS_EXPORT void GetMaxImageDimensions(uint32_t& width, uint32_t& height); } diff --git a/Lumos/Source/LumosEngine.h b/Lumos/Source/LumosEngine.h index d942d9f9..c8e69b4f 100644 --- a/Lumos/Source/LumosEngine.h +++ b/Lumos/Source/LumosEngine.h @@ -20,7 +20,6 @@ #include "Physics/LumosPhysicsEngine/Broadphase/Broadphase.h" #include "Physics/LumosPhysicsEngine/Broadphase/OctreeBroadphase.h" #include "Physics/LumosPhysicsEngine/Broadphase/BruteForceBroadphase.h" -#include "Physics/LumosPhysicsEngine/Broadphase/SortAndSweepBroadphase.h" #include "Physics/B2PhysicsEngine/RigidBody2D.h" #include "Physics/LumosPhysicsEngine/RigidBody3D.h" @@ -59,7 +58,7 @@ #include "Audio/SoundNode.h" // System -#include "Core/VFS.h" +#include "Core/OS/FileSystem.h" #include "Core/OS/FileSystem.h" #include "Core/StringUtilities.h" #include "Core/CoreSystem.h" diff --git a/Lumos/premake5.lua b/Lumos/premake5.lua index 225e6f60..d5a37586 100644 --- a/Lumos/premake5.lua +++ b/Lumos/premake5.lua @@ -1,25 +1,3 @@ -IncludeDir = {} -IncludeDir["entt"] = "External/entt/src/" -IncludeDir["GLFW"] = "External/glfw/include/" -IncludeDir["Glad"] = "External/glad/include/" -IncludeDir["lua"] = "External/lua/src/" -IncludeDir["stb"] = "External/stb/" -IncludeDir["OpenAL"] = "External/OpenAL/include/" -IncludeDir["Box2D"] = "External/box2d/include/" -IncludeDir["external"] = "External/" -IncludeDir["vulkan"] = "External/vulkan/" -IncludeDir["Lumos"] = "Source" -IncludeDir["External"] = "External/" -IncludeDir["ImGui"] = "External/imgui/" -IncludeDir["freetype"] = "External/freetype/include" -IncludeDir["SpirvCross"] = "External/SPIRV-Cross" -IncludeDir["cereal"] = "External/cereal/include" -IncludeDir["spdlog"] = "External/spdlog/include" -IncludeDir["glm"] = "External/glm" -IncludeDir["msdf_atlas_gen"] = "External/msdf-atlas-gen/msdf-atlas-gen" -IncludeDir["msdfgen"] = "External/msdf-atlas-gen/msdfgen" -IncludeDir["ozz"] = "External/ozz-animation/include" - newoption { trigger = "time-trace", diff --git a/Runtime/Runtime.cpp b/Runtime/Runtime.cpp index c20c4bf5..bf9b50ce 100644 --- a/Runtime/Runtime.cpp +++ b/Runtime/Runtime.cpp @@ -1,5 +1,6 @@ #include #include +#include using namespace Lumos; diff --git a/Runtime/premake5.lua b/Runtime/premake5.lua index 5e24a656..74dd8e21 100644 --- a/Runtime/premake5.lua +++ b/Runtime/premake5.lua @@ -1,23 +1,3 @@ -IncludeDir = {} -IncludeDir["GLFW"] = "../Lumos/External/glfw/include/" -IncludeDir["Glad"] = "../Lumos/External/glad/include/" -IncludeDir["lua"] = "../Lumos/External/lua/src/" -IncludeDir["stb"] = "../Lumos/External/stb/" -IncludeDir["OpenAL"] = "../Lumos/External/OpenAL/include/" -IncludeDir["Box2D"] = "../Lumos/External/box2d/include/" -IncludeDir["vulkan"] = "../Lumos/External/vulkan/" -IncludeDir["Lumos"] = "../Lumos/Source" -IncludeDir["External"] = "../Lumos/External/" -IncludeDir["ImGui"] = "../Lumos/External/imgui/" -IncludeDir["freetype"] = "../Lumos/External/freetype/include" -IncludeDir["SpirvCross"] = "../Lumos/External/vulkan/SPIRV-Cross" -IncludeDir["cereal"] = "../Lumos/External/cereal/include" -IncludeDir["spdlog"] = "../Lumos/External/spdlog/include" -IncludeDir["glm"] = "../Lumos/External/glm" -IncludeDir["msdf_atlas_gen"] = "../Lumos/External/msdf-atlas-gen/msdf-atlas-gen" -IncludeDir["msdfgen"] = "../Lumos/External/msdf-atlas-gen/msdfgen" -IncludeDir["ozz"] = "../Lumos/External/ozz-animation/include" - project "Runtime" kind "WindowedApp" language "C++" @@ -317,7 +297,7 @@ end "-Wno-psabi" } - links { "X11", "pthread", "dl", "atomic", "stdc++fs", "openal", "glfw"} + links { "X11", "pthread", "dl", "atomic", "openal", "glfw"} linkoptions { "-L%{cfg.targetdir}", "-Wl,-rpath=\\$$ORIGIN"} diff --git a/Scripts/MacOS/BuildMacOS-Editor.sh b/Scripts/MacOS/BuildMacOS-Editor.sh index 5ccde330..da5264ab 100755 --- a/Scripts/MacOS/BuildMacOS-Editor.sh +++ b/Scripts/MacOS/BuildMacOS-Editor.sh @@ -1,3 +1,3 @@ PATH="/usr/local/bin:$PATH" -xcodebuild -project Editor/LumosEditor.xcodeproj -parallelizeTargets -jobs 4 -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -sdk macosx -arch x86_64 | xcpretty +xcodebuild -project Editor/LumosEditor.xcodeproj -parallelizeTargets -jobs 4 -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -sdk macosx -arch x86_64 echo "MacOs Editor Build Finished!" \ No newline at end of file diff --git a/Scripts/MacOS/BuildMacOS.sh b/Scripts/MacOS/BuildMacOS.sh index a766163f..229d6f21 100755 --- a/Scripts/MacOS/BuildMacOS.sh +++ b/Scripts/MacOS/BuildMacOS.sh @@ -1,3 +1,3 @@ PATH="/usr/local/bin:$PATH" -xcodebuild -project Runtime.xcodeproj -configuration Release -parallelizeTargets -jobs 4 -sdk macosx -arch x86_64 | xcpretty +xcodebuild -project Runtime.xcodeproj -configuration Release -parallelizeTargets -jobs 4 -sdk macosx -arch x86_64 echo "Build Finished!" \ No newline at end of file diff --git a/Scripts/premake-utilities/premake-common.lua b/Scripts/premake-utilities/premake-common.lua index 80c37279..356ef636 100644 --- a/Scripts/premake-utilities/premake-common.lua +++ b/Scripts/premake-utilities/premake-common.lua @@ -90,7 +90,7 @@ function SetRecommendedXcodeSettings() { ["MACOSX_DEPLOYMENT_TARGET"] = "10.15", --['ARCHS'] = 'x86_64', - --['ONLY_ACTIVE_ARCH'] = 'YES', + ['ONLY_ACTIVE_ARCH'] = 'YES', } filter {"system:ios"} diff --git a/premake-dependencies.lua b/premake-dependencies.lua new file mode 100644 index 00000000..8558f2b8 --- /dev/null +++ b/premake-dependencies.lua @@ -0,0 +1,26 @@ +VULKAN_SDK = os.getenv("VULKAN_SDK") + +IncludeDir = {} +IncludeDir["entt"] = "%{wks.location}/Lumos/External/entt/src/" +IncludeDir["GLFW"] = "%{wks.location}/Lumos/External/glfw/include/" +IncludeDir["Glad"] = "%{wks.location}/Lumos/External/glad/include/" +IncludeDir["lua"] = "%{wks.location}/Lumos/External/lua/src/" +IncludeDir["stb"] = "%{wks.location}/Lumos/External/stb/" +IncludeDir["OpenAL"] = "%{wks.location}/Lumos/External/OpenAL/include/" +IncludeDir["Box2D"] = "%{wks.location}/Lumos/External/box2d/include/" +IncludeDir["vulkan"] = "%{wks.location}/Lumos/External/vulkan/" +IncludeDir["Lumos"] = "%{wks.location}/Lumos/Source" +IncludeDir["External"] = "%{wks.location}/Lumos/External/" +IncludeDir["ImGui"] = "%{wks.location}/Lumos/External/imgui/" +IncludeDir["freetype"] = "%{wks.location}/Lumos/External/freetype/include" +IncludeDir["SpirvCross"] = "%{wks.location}/Lumos/External/vulkan/SPIRV-Cross" +IncludeDir["cereal"] = "%{wks.location}/Lumos/External/cereal/include" +IncludeDir["spdlog"] = "%{wks.location}/Lumos/External/spdlog/include" +IncludeDir["glm"] = "%{wks.location}/Lumos/External/glm" +IncludeDir["msdf_atlas_gen"] = "%{wks.location}/Lumos/External/msdf-atlas-gen/msdf-atlas-gen" +IncludeDir["msdfgen"] = "%{wks.location}/Lumos/External/msdf-atlas-gen/msdfgen" +IncludeDir["ozz"] = "%{wks.location}/Lumos/External/ozz-animation/include" +IncludeDir["VulkanSDK"] = "%{VULKAN_SDK}/Include" + +LibraryDir = {} +LibraryDir["VulkanSDK"] = "%{VULKAN_SDK}/Lib" \ No newline at end of file diff --git a/premake5.lua b/premake5.lua index e47fc7e4..4cea346c 100644 --- a/premake5.lua +++ b/premake5.lua @@ -4,6 +4,7 @@ require 'Scripts/premake-utilities/premake-triggers' require 'Scripts/premake-utilities/premake-settings' require 'Scripts/premake-utilities/android_studio' +include "premake-dependencies.lua" --require 'Scripts/premake-utilities/premake-vscode/vscode' root_dir = os.getcwd() @@ -67,7 +68,7 @@ workspace( settings.workspace_name ) require("Lumos/External/spdlog/premake5") SetRecommendedSettings() require("Lumos/External/ozz-animation/premake5") -SetRecommendedSettings() + SetRecommendedSettings() require("Lumos/External/ModelLoaders/meshoptimizer/premake5") SetRecommendedSettings() -- require("Lumos/External/msdf-atlas-gen/msdfgen/premake5") diff --git a/project.4coder b/project.4coder index 297a3f2b..869882b9 100644 --- a/project.4coder +++ b/project.4coder @@ -2,25 +2,26 @@ version(1); project_name = "Lumos"; open_recursively=true; patterns = { -"*.c", -"*.cpp", + "*.c", + "*.cpp", "*.h", "*.hpp", "*.m", -"*.mm", -"*.bat", -"*.sh", -"*.glsl", -"*.4coder", -"*.vert", + "*.mm", + "*.bat", + "*.sh", + "*.glsl", + "*.glslh", + "*.4coder", + "*.vert", "*.frag", "*.comp", "*.shader", -"*.lua", + "*.lua", }; blacklist_patterns = { -".*", -"Lumos/External/.*" + ".*", + "Lumos/External/.*" }; load_paths_base = { { "./Lumos/Source", .relative = true, .recursive = true, }, @@ -29,37 +30,37 @@ load_paths_base = { { "./Editor", .relative = true, .recursive = true, }, }; load_paths = { - { load_paths_base, .os = "win", }, - { load_paths_base, .os = "linux", }, - { load_paths_base, .os = "mac", }, + { load_paths_base, .os = "win", }, + { load_paths_base, .os = "linux", }, + { load_paths_base, .os = "mac", }, }; command_list = { - { .name = "build", - .out = "*compilation*", .footer_panel = true, .save_dirty_files = true,.cursor_at_end = true, - .cmd = { { "Scripts\Windows\BuildWindows.bat" , .os = "win" }, + { .name = "build", + .out = "*compilation*", .footer_panel = true, .save_dirty_files = true,.cursor_at_end = true, + .cmd = { { "Scripts\Windows\BuildWindows.bat" , .os = "win" }, { "./Scripts/Linux/BuildLinux.sh", .os = "linux" }, { "./Scripts/MacOS/BuildMacOS.sh", .os = "mac" }, }, }, - - { .name = "run", - .out = "*Run - Release*", .footer_panel = true, .save_dirty_files = false,.cursor_at_end = true, - .cmd = { { "bin\\Release-windows-x86_64\\Runtime.exe", .os = "win" }, + + { .name = "run", + .out = "*Run - Release*", .footer_panel = true, .save_dirty_files = false,.cursor_at_end = true, + .cmd = { { "bin\\Release-windows-x86_64\\Runtime.exe", .os = "win" }, { "./Scripts/Linux/RunLinux.sh" , .os = "linux" }, { "./Scripts/MacOS/RunMacOS.sh" , .os = "mac" }, }, }, - - { .name = "gen project", - .out = "*Generated Build Files*", .footer_panel = true, .save_dirty_files = false,.cursor_at_end = true, - .cmd = { { "Tools\premake5.exe vs2022", .os = "win" }, + + { .name = "gen project", + .out = "*Generated Build Files*", .footer_panel = true, .save_dirty_files = false,.cursor_at_end = true, + .cmd = { { "Tools\premake5.exe vs2022", .os = "win" }, { "Tools/linux/premake5 gmake2" , .os = "linux" }, { "Tools/premake5 xcode4" , .os = "mac" }, }, }, - { .name = "clean", - .out = "*Clean*", .footer_panel = true, .save_dirty_files = false,.cursor_at_end = true, - .cmd = { { "Tools\premake5.exe clean", .os = "win" }, + { .name = "clean", + .out = "*Clean*", .footer_panel = true, .save_dirty_files = false,.cursor_at_end = true, + .cmd = { { "Tools\premake5.exe clean", .os = "win" }, { "Tools/linux/premake5 clean" , .os = "linux" }, { "./Scripts/MacOS/CleanMacOS.sh" , .os = "mac" }, }, }, - { .name = "formatCode", - .out = "*Formatting Code*", .footer_panel = true, .save_dirty_files = false,.cursor_at_end = true, - .cmd = { { "", .os = "win" }, + { .name = "formatCode", + .out = "*Formatting Code*", .footer_panel = true, .save_dirty_files = false,.cursor_at_end = true, + .cmd = { { "", .os = "win" }, { "" , .os = "linux" }, { "cd Scripts ; ./ClangFormat.sh" , .os = "mac" }, }, }, { .name = "compileShaders",