[Vulkan] Refactoring and fixes for VulkanProvider and related areas

Enable portability subset physical device enumeration.

Don't use Vulkan 1.1+ logical devices on Vulkan 1.0 instances due to the
VkApplicationInfo::apiVersion specification.

Make sure all extension dependencies are enabled when creating a device.

Prefer exposing feature support over extension support via the device
interface to avoid causing confusion with regard to promoted extensions
(especially those that required some features as extensions, but had those
features made optional when they were promoted).

Allow creating presentation-only devices, not demanding any optional
features beyond the basic Vulkan 1.0, for use cases such as internal tools
or CPU rendering.

Require the independentBlend feature for GPU emulation as working around is
complicated, while support is almost ubiquitous.

Move the graphics system initialization fatal error message to xenia_main
after attempting to initialize all implementations, for automatic fallback
to other implementations in the future.

Log Vulkan driver info.

Improve Vulkan debug message logging, enabled by default.

Refactor code, with simplified logic for enabling extensions and layers.
This commit is contained in:
Triang3l
2025-08-12 23:21:59 +03:00
parent a06be03f1b
commit b5432ab83f
70 changed files with 3238 additions and 2757 deletions

View File

@@ -467,7 +467,7 @@ void ShutdownLogging() {
memory::AlignedFree(logger);
}
bool logging::internal::ShouldLog(LogLevel log_level) {
bool logging::ShouldLog(LogLevel log_level) {
return logger_ != nullptr &&
static_cast<int32_t>(log_level) <= cvars::log_level;
}
@@ -487,7 +487,7 @@ void logging::internal::AppendLogLine(LogLevel log_level,
void logging::AppendLogLine(LogLevel log_level, const char prefix_char,
const std::string_view str) {
if (!internal::ShouldLog(log_level) || !str.size()) {
if (!ShouldLog(log_level) || !str.size()) {
return;
}
logger_->AppendLine(xe::threading::current_thread_id(), prefix_char,

View File

@@ -70,9 +70,16 @@ void InitializeLogging(const std::string_view app_name);
void ShutdownLogging();
namespace logging {
namespace internal {
constexpr char kPrefixCharError = '!';
constexpr char kPrefixCharWarning = 'w';
constexpr char kPrefixCharInfo = 'i';
constexpr char kPrefixCharDebug = 'd';
bool ShouldLog(LogLevel log_level);
namespace internal {
std::pair<char*, size_t> GetThreadBuffer();
void AppendLogLine(LogLevel log_level, const char prefix_char, size_t written);
@@ -83,7 +90,7 @@ void AppendLogLine(LogLevel log_level, const char prefix_char, size_t written);
template <typename... Args>
void AppendLogLineFormat(LogLevel log_level, const char prefix_char,
const char* format, const Args&... args) {
if (!internal::ShouldLog(log_level)) {
if (!ShouldLog(log_level)) {
return;
}
auto target = internal::GetThreadBuffer();
@@ -106,22 +113,26 @@ void FatalError(const std::string_view str);
template <typename... Args>
void XELOGE(const char* format, const Args&... args) {
xe::logging::AppendLogLineFormat(xe::LogLevel::Error, '!', format, args...);
xe::logging::AppendLogLineFormat(
xe::LogLevel::Error, xe::logging::kPrefixCharError, format, args...);
}
template <typename... Args>
void XELOGW(const char* format, const Args&... args) {
xe::logging::AppendLogLineFormat(xe::LogLevel::Warning, 'w', format, args...);
xe::logging::AppendLogLineFormat(
xe::LogLevel::Warning, xe::logging::kPrefixCharWarning, format, args...);
}
template <typename... Args>
void XELOGI(const char* format, const Args&... args) {
xe::logging::AppendLogLineFormat(xe::LogLevel::Info, 'i', format, args...);
xe::logging::AppendLogLineFormat(
xe::LogLevel::Info, xe::logging::kPrefixCharInfo, format, args...);
}
template <typename... Args>
void XELOGD(const char* format, const Args&... args) {
xe::logging::AppendLogLineFormat(xe::LogLevel::Debug, 'd', format, args...);
xe::logging::AppendLogLineFormat(
xe::LogLevel::Debug, xe::logging::kPrefixCharDebug, format, args...);
}
template <typename... Args>