1
0

optimize dx11 engine

This commit is contained in:
2026-01-05 16:51:58 +08:00
parent 7110becf66
commit 52916db08f
10 changed files with 152 additions and 117 deletions

View File

@@ -1,5 +1,4 @@
#include "dll_loader.hpp"
#include <basalt_char.hpp>
#include <stdexcept>
#include <filesystem>
@@ -9,16 +8,18 @@
#include <unistd.h>
#endif
using ::Basalt::Shared::Char::BSStringView;
namespace Basalt::Presenter {
static std::filesystem::path get_executable() {
#if defined(BASALT_OS_WINDOWS)
wchar_t buffer[MAX_PATH];
DWORD hr = GetModuleFileNameW(NULL, buffer, MAX_PATH);
if (hr == 0) {
throw std::runtime_error("Failed to get executable path");
} else {
if (hr > 0 && hr < MAX_PATH) {
return std::filesystem::path(buffer);
} else {
throw std::runtime_error("Failed to get executable path");
}
#else
char buffer[PATH_MAX];
@@ -32,7 +33,7 @@ namespace Basalt::Presenter {
#endif
}
DllLoader::DllLoader(DllKind kind, const std::basic_string_view<BSCHAR> filename) {
DllLoader::DllLoader(DllKind kind, const BSStringView& filename) {
// Build DLL full path
auto dll_path = get_executable().parent_path();
dll_path /= BSTEXT("plugin");