Skip to content

Commit 7654a08

Browse files
authored
vulkan: Report only missing format feature flags. (#1420)
1 parent 8e08756 commit 7654a08

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/video_core/renderer_vulkan/vk_instance.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,23 @@ Instance::Instance(Frontend::WindowSDL& window, s32 physical_device_index,
160160

161161
// Check and log format support details.
162162
for (const auto& format : LiverpoolToVK::SurfaceFormats()) {
163-
if (!IsFormatSupported(GetSupportedFormat(format.vk_format, format.flags), format.flags)) {
163+
if (!IsFormatSupported(format.vk_format, format.flags)) {
164164
LOG_WARNING(Render_Vulkan,
165165
"Surface format data_format={}, number_format={} is not fully supported "
166-
"(vk_format={}, requested flags={})",
166+
"(vk_format={}, missing features={})",
167167
static_cast<u32>(format.data_format),
168168
static_cast<u32>(format.number_format), vk::to_string(format.vk_format),
169-
vk::to_string(format.flags));
169+
vk::to_string(format.flags & ~GetFormatFeatureFlags(format.vk_format)));
170170
}
171171
}
172172
for (const auto& format : LiverpoolToVK::DepthFormats()) {
173-
if (!IsFormatSupported(GetSupportedFormat(format.vk_format, format.flags), format.flags)) {
173+
if (!IsFormatSupported(format.vk_format, format.flags)) {
174174
LOG_WARNING(Render_Vulkan,
175175
"Depth format z_format={}, stencil_format={} is not fully supported "
176-
"(vk_format={}, requested flags={})",
176+
"(vk_format={}, missing features={})",
177177
static_cast<u32>(format.z_format), static_cast<u32>(format.stencil_format),
178-
vk::to_string(format.vk_format), vk::to_string(format.flags));
178+
vk::to_string(format.vk_format),
179+
vk::to_string(format.flags & ~GetFormatFeatureFlags(format.vk_format)));
179180
}
180181
}
181182
}
@@ -546,18 +547,21 @@ void Instance::CollectToolingInfo() {
546547
}
547548
}
548549

549-
bool Instance::IsFormatSupported(const vk::Format format,
550-
const vk::FormatFeatureFlags2 flags) const {
551-
if (format == vk::Format::eUndefined) [[unlikely]] {
552-
return true;
553-
}
554-
550+
vk::FormatFeatureFlags2 Instance::GetFormatFeatureFlags(vk::Format format) const {
555551
const auto it = format_properties.find(format);
556552
if (it == format_properties.end()) {
557553
UNIMPLEMENTED_MSG("Properties of format {} have not been queried.", vk::to_string(format));
558554
}
559555

560-
return ((it->second.optimalTilingFeatures | it->second.bufferFeatures) & flags) == flags;
556+
return it->second.optimalTilingFeatures | it->second.bufferFeatures;
557+
}
558+
559+
bool Instance::IsFormatSupported(const vk::Format format,
560+
const vk::FormatFeatureFlags2 flags) const {
561+
if (format == vk::Format::eUndefined) [[unlikely]] {
562+
return true;
563+
}
564+
return (GetFormatFeatureFlags(format) & flags) == flags;
561565
}
562566

563567
static vk::Format GetAlternativeFormat(const vk::Format format) {

src/video_core/renderer_vulkan/vk_instance.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ class Instance {
275275
void CollectDeviceParameters();
276276
void CollectToolingInfo();
277277

278+
/// Gets the supported feature flags for a format.
279+
[[nodiscard]] vk::FormatFeatureFlags2 GetFormatFeatureFlags(vk::Format format) const;
280+
278281
/// Determines if a format is supported for a set of feature flags.
279282
[[nodiscard]] bool IsFormatSupported(vk::Format format, vk::FormatFeatureFlags2 flags) const;
280283

0 commit comments

Comments
 (0)