Seal editor Win32 platform boundary
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "Rendering/D3D12/D3D12EditorWindowRenderRuntime.h"
|
||||
|
||||
#include "Platform/Win32/Windowing/Win32EditorWindowRenderRuntimeSurface.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
@@ -11,9 +13,9 @@ namespace {
|
||||
|
||||
using Rendering::Host::EditorWindowRenderRuntimeFrameContext;
|
||||
using Rendering::Host::EditorWindowRenderRuntimeInitializeResult;
|
||||
using Rendering::Host::EditorWindowRenderRuntimeInitializeParams;
|
||||
using Rendering::Host::EditorWindowRenderRuntimePresentResult;
|
||||
using Rendering::Host::EditorWindowRenderRuntimeResizeResult;
|
||||
using Rendering::Host::EditorWindowRenderRuntimeSurface;
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -51,17 +53,22 @@ Rendering::Host::ViewportRenderHost& D3D12EditorWindowRenderRuntime::GetViewport
|
||||
}
|
||||
|
||||
EditorWindowRenderRuntimeInitializeResult D3D12EditorWindowRenderRuntime::Initialize(
|
||||
const EditorWindowRenderRuntimeSurface& surface) {
|
||||
const EditorWindowRenderRuntimeInitializeParams& params) {
|
||||
EditorWindowRenderRuntimeInitializeResult result = {};
|
||||
|
||||
HWND hwnd = static_cast<HWND>(surface.nativeWindowHandle);
|
||||
const auto* surface = params.surface != nullptr
|
||||
? dynamic_cast<
|
||||
const ::XCEngine::UI::Editor::App::Win32EditorWindowRenderRuntimeSurface*>(
|
||||
params.surface.get())
|
||||
: nullptr;
|
||||
HWND hwnd = surface != nullptr ? surface->GetHwnd() : nullptr;
|
||||
if (hwnd == nullptr) {
|
||||
result.errorMessage = "window initialize skipped: hwnd is null";
|
||||
return result;
|
||||
}
|
||||
|
||||
const int clientWidth = (std::max)(static_cast<int>(surface.widthPixels), 1);
|
||||
const int clientHeight = (std::max)(static_cast<int>(surface.heightPixels), 1);
|
||||
const int clientWidth = (std::max)(static_cast<int>(params.widthPixels), 1);
|
||||
const int clientHeight = (std::max)(static_cast<int>(params.heightPixels), 1);
|
||||
if (!m_windowRenderer.Initialize(hwnd, clientWidth, clientHeight)) {
|
||||
result.errorMessage = "d3d12 window renderer initialization failed";
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user