Keep startup reporting independent of renderer headers (by Codex)
This commit is contained in:
1 parent
856d38cc0c
commit
500354cc39
9 files changed
+24
-12
No files matched your search
+1
-1
@@ -31,7 +31,7 @@
|
||||
#include "launch/file_dialog.hpp"
|
||||
#include "launch/game_data.hpp"
|
||||
#include "launch/launcher.hpp"
|
||||
#include "launch/rml_video.hpp"
|
||||
#include "launch/startup_error.hpp"
|
||||
#include "content/package.hpp"
|
||||
#include "version.hpp"
|
||||
#include "app/live_matchday_events.hpp"
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "editor/ui.hpp"
|
||||
#include "editor/version.hpp"
|
||||
#include "launch/rml_video.hpp"
|
||||
#include "launch/startup_error.hpp"
|
||||
#include <SDL.h>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
|
||||
@@ -162,13 +162,14 @@ void Video::present() {
|
||||
#endif
|
||||
}
|
||||
std::vector<uint8_t> Video::capture(int &width, int &height) {
|
||||
drawable_size(width, height);
|
||||
std::vector<uint8_t> pixels(size_t(width) * size_t(height) * 4);
|
||||
#ifdef _WIN32
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> buffer, staging;
|
||||
check(swapchain_->GetBuffer(0, IID_PPV_ARGS(&buffer)), "Screenshot buffer");
|
||||
D3D11_TEXTURE2D_DESC desc{};
|
||||
buffer->GetDesc(&desc);
|
||||
width = static_cast<int>(desc.Width);
|
||||
height = static_cast<int>(desc.Height);
|
||||
std::vector<uint8_t> pixels(size_t(width) * size_t(height) * 4);
|
||||
desc.Usage = D3D11_USAGE_STAGING;
|
||||
desc.BindFlags = 0;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
@@ -183,6 +184,8 @@ std::vector<uint8_t> Video::capture(int &width, int &height) {
|
||||
size_t(width) * 4);
|
||||
context_->Unmap(staging.Get(), 0);
|
||||
#else
|
||||
drawable_size(width, height);
|
||||
std::vector<uint8_t> pixels(size_t(width) * size_t(height) * 4);
|
||||
using ReadPixels = void (*)(int, int, int, int, unsigned, unsigned, void *);
|
||||
auto read = reinterpret_cast<ReadPixels>(SDL_GL_GetProcAddress("glReadPixels"));
|
||||
if (!read)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
#include "launch/startup_error.hpp"
|
||||
#include <SDL.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -67,8 +68,4 @@ class Renderer : public RenderInterface_GL3 {
|
||||
explicit Renderer(Video &) {}
|
||||
};
|
||||
#endif
|
||||
// Also used before SDL initialization, so an unavailable graphics driver cannot
|
||||
// prevent reporting the actual startup error. No preferences or tokens are logged.
|
||||
void report_start_error(const char *product, const std::string &message, bool dialog = true) noexcept;
|
||||
void attach_parent_console() noexcept;
|
||||
} // namespace bmh::rml
|
||||
@@ -26,7 +26,8 @@ add_library(bmh_rmlui STATIC
|
||||
if(WIN32)
|
||||
target_sources(bmh_rmlui PRIVATE ${rmlui_SOURCE_DIR}/Backends/RmlUi_Renderer_DX11.cpp)
|
||||
target_link_libraries(bmh_rmlui PUBLIC d3d11 dxgi d3dcompiler)
|
||||
target_compile_definitions(bmh_rmlui PUBLIC NUM_MSAA_SAMPLES=1 NOMINMAX)
|
||||
# Upstream resolves its multisampled UI layer into the swapchain every frame.
|
||||
target_compile_definitions(bmh_rmlui PUBLIC NUM_MSAA_SAMPLES=2 NOMINMAX)
|
||||
else()
|
||||
target_sources(bmh_rmlui PRIVATE ${rmlui_SOURCE_DIR}/Backends/RmlUi_Renderer_GL3.cpp)
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace bmh::rml {
|
||||
// Safe before video initialization, including when no graphics driver is available.
|
||||
// No preferences or authentication tokens are logged.
|
||||
void report_start_error(const char *product, const std::string &message, bool dialog = true) noexcept;
|
||||
void attach_parent_console() noexcept;
|
||||
} // namespace bmh::rml
|
||||
Reference in new issue
Block a user