Skip to content

Commit 2bf06f2

Browse files
Merge pull request #437 from FlyAndNotDown/master
2 parents 1278aac + b0a41eb commit 2bf06f2

96 files changed

Lines changed: 1800 additions & 507 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/build.yml‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,34 @@ jobs:
8686
python ThirdParty/ConanRecipes/build_recipes.py --export-only
8787
8888
- name: Configure CMake
89-
run: cmake -B ${{github.workspace}}/build -G=Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
89+
run: cmake -B ${{github.workspace}}/build -G=Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCI=ON
9090

9191
- name: Build
9292
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j ${{env.MAKE_THREAD_NUM}}
9393

94+
# Elevated Windows processes ignore VK_DRIVER_FILES, so register SwiftShader in the loader's trusted driver list.
95+
- name: Register SwiftShader Vulkan Driver
96+
if: runner.os == 'Windows'
97+
shell: pwsh
98+
run: |
99+
$manifest = (Resolve-Path "${{github.workspace}}/build/Dist/Explosion/Binaries/vk_swiftshader_icd.json").Path
100+
$driverRegistry = 'HKLM:\SOFTWARE\Khronos\Vulkan\Drivers'
101+
New-Item -Path $driverRegistry -Force | Out-Null
102+
New-ItemProperty -Path $driverRegistry -Name $manifest -PropertyType DWord -Value 0 -Force | Out-Null
103+
94104
- name: Test
95105
working-directory: ${{github.workspace}}/build
96106
run: ctest -C ${{env.BUILD_TYPE}} --extra-verbose
97107

108+
- name: Upload Rendering Test Artifacts
109+
if: failure()
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: rendering-test-${{runner.os}}-${{runner.arch}}
113+
path: ${{github.workspace}}/build/Test/Generated/RenderingSample
114+
if-no-files-found: warn
115+
retention-days: 14
116+
98117
- name: Install
99118
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install -j ${{env.MAKE_THREAD_NUM}}
100119

‎CMake/Target.cmake‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include(CMakePackageConfigHelpers)
33

44
option(BUILD_TEST "Build unit tests" ON)
55
option(BUILD_BENCHMARK "Build benchmarks" ON)
6+
option(CI "Build for continuous integration" OFF)
67

78
set(GENERATED_DIR ${CMAKE_BINARY_DIR}/Generated)
89
set(GENERATED_API_HEADER_DIR ${GENERATED_DIR}/Api)
@@ -452,6 +453,27 @@ function(exp_get_runtime_output_dir)
452453
endif ()
453454
endfunction()
454455
456+
function(exp_set_runtime_rpath)
457+
set(options "")
458+
set(singleValueArgs NAME)
459+
set(multiValueArgs "")
460+
cmake_parse_arguments(arg "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})
461+
462+
if (APPLE)
463+
set(runtime_origin "@executable_path")
464+
elseif (UNIX)
465+
set(runtime_origin "$ORIGIN")
466+
else ()
467+
return()
468+
endif ()
469+
470+
set_target_properties(
471+
${arg_NAME} PROPERTIES
472+
BUILD_RPATH "${runtime_origin}"
473+
INSTALL_RPATH "${runtime_origin}"
474+
)
475+
endfunction()
476+
455477
function(exp_add_executable)
456478
set(options NOT_INSTALL)
457479
set(singleValueArgs NAME FOLDER)
@@ -491,13 +513,7 @@ function(exp_add_executable)
491513
${arg_NAME} PROPERTIES
492514
RUNTIME_OUTPUT_DIRECTORY ${runtime_output_dir}
493515
)
494-
if (APPLE)
495-
set_target_properties(
496-
${arg_NAME} PROPERTIES
497-
BUILD_RPATH "@executable_path"
498-
INSTALL_RPATH "@executable_path"
499-
)
500-
endif ()
516+
exp_set_runtime_rpath(NAME ${arg_NAME})
501517
502518
target_include_directories(
503519
${arg_NAME}
@@ -618,6 +634,8 @@ function(exp_add_library)
618634
)
619635
620636
if ("${arg_TYPE}" STREQUAL "SHARED")
637+
exp_set_runtime_rpath(NAME ${arg_NAME})
638+
621639
exp_get_runtime_output_dir(OUTPUT dist_dir)
622640
add_custom_command(
623641
TARGET ${arg_NAME} POST_BUILD

‎Editor/Include/Editor/EditorApplication.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace Editor {
2121
EditorApplicationMode mode;
2222
std::string rhiType;
2323
bool gpuDebug;
24+
bool softwareGpu;
2425
std::string projectRoot;
2526
};
2627

‎Editor/Include/Editor/Frame/ProjectHubFrame.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ namespace Editor {
4040
ProjectHubFrame();
4141
~ProjectHubFrame();
4242

43-
void Render(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug);
43+
void Render(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu);
4444

4545
private:
46-
void RenderActionBar(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug);
47-
void RenderRecentProjects(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug);
48-
void RenderCreateProjectPopup(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug);
46+
void RenderActionBar(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu);
47+
void RenderRecentProjects(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu);
48+
void RenderCreateProjectPopup(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu);
4949
CreateProjectResult CreateProject();
50-
void OpenProject(EditorWindow& inWindow, const std::string& inProjectPath, const std::string& inRhiType, bool inGpuDebug);
50+
void OpenProject(EditorWindow& inWindow, const std::string& inProjectPath, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu);
5151
void SaveRecentProjects() const;
5252
void TouchRecentProject(const std::string& inProjectPath);
5353

‎Editor/Src/EditorApplication.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ namespace Editor {
329329

330330
void EditorApplication::RenderProjectHubFrame()
331331
{
332-
projectHubFrame->Render(*window, desc.rhiType, desc.gpuDebug);
332+
projectHubFrame->Render(*window, desc.rhiType, desc.gpuDebug, desc.softwareGpu);
333333
ImGui::Render();
334334
Runtime::EngineHolder::Get().Tick(ImGui::GetIO().DeltaTime);
335335
window->RenderUiOnly(*ImGui::GetDrawData());

‎Editor/Src/EditorWindow.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,9 @@ namespace Editor {
459459
0,
460460
RHI::TextureSubResourceInfo(),
461461
Common::UVec3Consts::zero,
462-
Common::UVec3(static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1)));
462+
Common::UVec3(static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1),
463+
copyFootprint.rowPitch,
464+
copyFootprint.slicePitch));
463465
copyRecorder->ResourceBarrier(RHI::Barrier::Transition(imguiFontTexture.Get(), RHI::TextureState::copyDst, RHI::TextureState::shaderReadOnly));
464466
copyRecorder->EndPass();
465467
}

‎Editor/Src/Frame/EditorFrame.cpp‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ namespace Editor::Internal {
3333
: qualifiedName.substr(namespaceSeparator + 2);
3434
}
3535

36+
static bool IsComponentVisibleInDetails(const Mirror::Class& inClass)
37+
{
38+
return !inClass.HasMeta(Runtime::MetaPresets::editorHide);
39+
}
40+
3641
static std::string EntityDisplayName(const Runtime::ECRegistry& inRegistry, Runtime::Entity inEntity)
3742
{
3843
const auto* name = inRegistry.Find<Runtime::Name>(inEntity);
@@ -69,7 +74,9 @@ namespace Editor {
6974
.log = true
7075
}
7176
{
72-
std::erase_if(componentClasses, [](Runtime::CompClass clazz) -> bool { return !clazz->HasMeta("comp"); });
77+
std::erase_if(componentClasses, [](Runtime::CompClass clazz) -> bool {
78+
return !clazz->HasMeta("comp") || !Internal::IsComponentVisibleInDetails(*clazz);
79+
});
7380
std::ranges::sort(componentClasses, [](Runtime::CompClass lhs, Runtime::CompClass rhs) -> bool {
7481
return lhs->GetName() < rhs->GetName();
7582
});
@@ -253,6 +260,9 @@ namespace Editor {
253260

254261
Runtime::CompClass componentToRemove = nullptr;
255262
inRegistry.CompEach(selectedEntity, [&](Runtime::CompClass compClass) -> void {
263+
if (!Internal::IsComponentVisibleInDetails(*compClass)) {
264+
return;
265+
}
256266
ImGui::PushID(compClass->GetName().c_str());
257267
const std::string componentName = Internal::ComponentDisplayName(*compClass);
258268
const std::string componentLabel = Widgets::Label(Icons::Tabler::boxMultiple, componentName);
@@ -277,6 +287,9 @@ namespace Editor {
277287
ImGui::PopID();
278288
});
279289
inRegistry.TagEach(selectedEntity, [&](Runtime::TagClass tagClass) -> void {
290+
if (!Internal::IsComponentVisibleInDetails(*tagClass)) {
291+
return;
292+
}
280293
ImGui::PushID(tagClass->GetName().c_str());
281294
const std::string tagName = Internal::ComponentDisplayName(*tagClass);
282295
const std::string tagLabel = Widgets::Label(Icons::Tabler::box, tagName);

‎Editor/Src/Frame/ProjectHubFrame.cpp‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,14 @@ namespace Editor::ProjectHub::Internal {
8989
return result;
9090
}
9191

92-
static std::string LaunchCommand(const std::string& inExecutable, const std::string& inProjectPath, const std::string& inRhiType, bool inGpuDebug)
92+
static std::string LaunchCommand(const std::string& inExecutable, const std::string& inProjectPath, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu)
9393
{
9494
const std::string gpuDebugArg = inGpuDebug ? " -gpuDebug" : "";
95+
const std::string softwareGpuArg = inSoftwareGpu ? " -softwareGpu" : "";
9596
#if PLATFORM_WINDOWS
96-
return std::format("start \"\" \"{}\" -project \"{}\" -rhi {}{}", inExecutable, inProjectPath, inRhiType, gpuDebugArg);
97+
return std::format("start \"\" \"{}\" -project \"{}\" -rhi {}{}{}", inExecutable, inProjectPath, inRhiType, gpuDebugArg, softwareGpuArg);
9798
#else
98-
return std::format("\"{}\" -project \"{}\" -rhi {}{} &", inExecutable, inProjectPath, inRhiType, gpuDebugArg);
99+
return std::format("\"{}\" -project \"{}\" -rhi {}{}{} &", inExecutable, inProjectPath, inRhiType, gpuDebugArg, softwareGpuArg);
99100
#endif
100101
}
101102
}
@@ -126,7 +127,7 @@ namespace Editor {
126127
SaveRecentProjects();
127128
}
128129

129-
void ProjectHubFrame::Render(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug)
130+
void ProjectHubFrame::Render(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu)
130131
{
131132
const ImGuiViewport* viewport = ImGui::GetMainViewport();
132133
ImGui::SetNextWindowPos(viewport->WorkPos);
@@ -143,21 +144,21 @@ namespace Editor {
143144
| ImGuiWindowFlags_NoBringToFrontOnFocus);
144145
ImGui::PopStyleVar(2);
145146

146-
RenderActionBar(inWindow, inRhiType, inGpuDebug);
147+
RenderActionBar(inWindow, inRhiType, inGpuDebug, inSoftwareGpu);
147148
ImGui::Dummy(ImVec2(0.0f, 22.0f));
148-
RenderRecentProjects(inWindow, inRhiType, inGpuDebug);
149-
RenderCreateProjectPopup(inWindow, inRhiType, inGpuDebug);
149+
RenderRecentProjects(inWindow, inRhiType, inGpuDebug, inSoftwareGpu);
150+
RenderCreateProjectPopup(inWindow, inRhiType, inGpuDebug, inSoftwareGpu);
150151
ImGui::End();
151152
}
152153

153-
void ProjectHubFrame::RenderActionBar(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug)
154+
void ProjectHubFrame::RenderActionBar(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu)
154155
{
155156
const float spacing = ImGui::GetStyle().ItemSpacing.x;
156157
const float buttonWidth = (ImGui::GetContentRegionAvail().x - spacing) * 0.5f;
157158
const std::string openLabel = Widgets::Label(Icons::Tabler::folderOpen, "Open");
158159
if (Widgets::PrimaryButton(openLabel.c_str(), ImVec2(buttonWidth, ProjectHub::Internal::actionButtonHeight))) {
159160
if (const auto selectedDirectory = PlatformUtils::SelectDirectory("Open Explosion Project")) {
160-
OpenProject(inWindow, *selectedDirectory, inRhiType, inGpuDebug);
161+
OpenProject(inWindow, *selectedDirectory, inRhiType, inGpuDebug, inSoftwareGpu);
161162
}
162163
}
163164

@@ -169,7 +170,7 @@ namespace Editor {
169170
}
170171
}
171172

172-
void ProjectHubFrame::RenderRecentProjects(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug)
173+
void ProjectHubFrame::RenderRecentProjects(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu)
173174
{
174175
const std::string recentProjectsLabel = Widgets::Label(Icons::Tabler::folder, "Recent projects");
175176
ImGui::TextUnformatted(recentProjectsLabel.c_str());
@@ -209,11 +210,11 @@ namespace Editor {
209210
ImGui::EndChild();
210211

211212
if (!projectToOpen.empty()) {
212-
OpenProject(inWindow, projectToOpen, inRhiType, inGpuDebug);
213+
OpenProject(inWindow, projectToOpen, inRhiType, inGpuDebug, inSoftwareGpu);
213214
}
214215
}
215216

216-
void ProjectHubFrame::RenderCreateProjectPopup(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug)
217+
void ProjectHubFrame::RenderCreateProjectPopup(EditorWindow& inWindow, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu)
217218
{
218219
const ImGuiViewport* viewport = ImGui::GetMainViewport();
219220
ImGui::SetNextWindowPos(viewport->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
@@ -288,7 +289,7 @@ namespace Editor {
288289
if (result.success) {
289290
statusMessage.clear();
290291
ImGui::CloseCurrentPopup();
291-
OpenProject(inWindow, result.projectPath, inRhiType, inGpuDebug);
292+
OpenProject(inWindow, result.projectPath, inRhiType, inGpuDebug, inSoftwareGpu);
292293
} else {
293294
statusMessage = result.error;
294295
}
@@ -327,7 +328,7 @@ namespace Editor {
327328
return { .success = true, .error = {}, .projectPath = projectDir.String() };
328329
}
329330

330-
void ProjectHubFrame::OpenProject(EditorWindow& inWindow, const std::string& inProjectPath, const std::string& inRhiType, bool inGpuDebug)
331+
void ProjectHubFrame::OpenProject(EditorWindow& inWindow, const std::string& inProjectPath, const std::string& inRhiType, bool inGpuDebug, bool inSoftwareGpu)
331332
{
332333
const Common::Path projectDir(inProjectPath);
333334
if (!projectDir.Exists() || !projectDir.IsDirectory()) {
@@ -338,7 +339,7 @@ namespace Editor {
338339
TouchRecentProject(inProjectPath);
339340
SaveRecentProjects();
340341

341-
const std::string command = ProjectHub::Internal::LaunchCommand(Core::Paths::ExecutablePath().String(), inProjectPath, inRhiType, inGpuDebug);
342+
const std::string command = ProjectHub::Internal::LaunchCommand(Core::Paths::ExecutablePath().String(), inProjectPath, inRhiType, inGpuDebug, inSoftwareGpu);
342343
std::ignore = std::system(command.c_str());
343344
inWindow.RequestClose();
344345
}

‎Editor/Src/Main.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ static Core::CmdlineArgValue<bool> caGpuDebug(
1919
"gpuDebug", "-gpuDebug", false,
2020
"enable GPU validation layers");
2121

22+
static Core::CmdlineArgValue<bool> caSoftwareGpu(
23+
"softwareGpu", "-softwareGpu", false,
24+
"prefer a software GPU, falling back to hardware when unavailable");
25+
2226
static Editor::EditorApplicationMode GetAppMode()
2327
{
2428
return caProjectRoot.GetValue().empty()
@@ -35,6 +39,7 @@ static void InitializeEngine()
3539
params.gameRoot = caProjectRoot.GetValue();
3640
params.rhiType = caRhiType.GetValue();
3741
params.gpuDebug = caGpuDebug.GetValue();
42+
params.useSoftwareGpu = caSoftwareGpu.GetValue();
3843
Runtime::EngineHolder::Load("Editor", params);
3944
}
4045

@@ -47,6 +52,7 @@ int main(int argc, char* argv[])
4752
.mode = GetAppMode(),
4853
.rhiType = caRhiType.GetValue(),
4954
.gpuDebug = caGpuDebug.GetValue(),
55+
.softwareGpu = caSoftwareGpu.GetValue(),
5056
.projectRoot = caProjectRoot.GetValue()
5157
};
5258
int result = 0;

‎Engine/Source/Common/Include/Common/Concurrent.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ namespace Common {
6363

6464
private:
6565
bool stop;
66-
bool flush;
6766
std::mutex mutex;
6867
std::condition_variable taskCondition;
69-
std::condition_variable flushCondition;
7068
NamedThread thread;
7169
std::queue<std::function<void()>> tasks;
7270
};

0 commit comments

Comments
 (0)