[Vulkan] Log down strings when an invalid usage flag is specified.
This commit is contained in:
parent
b5d647d540
commit
d98344f99b
|
@ -271,10 +271,13 @@ TextureCache::Texture* TextureCache::AllocateTexture(
|
|||
if ((props.optimalTilingFeatures & required_flags) != required_flags) {
|
||||
// Texture needs conversion on upload to a native format.
|
||||
XELOGE(
|
||||
"Texture Cache: Invalid usage flag specified on format %s (vk %d) "
|
||||
"(0x%.8X != 0x%.8X)",
|
||||
texture_info.format_info()->name, format,
|
||||
(props.optimalTilingFeatures & required_flags), required_flags);
|
||||
"Texture Cache: Invalid usage flag specified on format %s (%s)\n\t"
|
||||
"(requested: %s)",
|
||||
texture_info.format_info()->name, ui::vulkan::to_string(format),
|
||||
ui::vulkan::to_flags_string(
|
||||
static_cast<VkFormatFeatureFlagBits>(required_flags &
|
||||
~props.optimalTilingFeatures))
|
||||
.c_str());
|
||||
assert_always();
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,8 @@ bool VulkanSwapChain::Initialize(VkSurfaceKHR surface) {
|
|||
XELOGVK(" presentMode = %s", to_string(create_info.presentMode));
|
||||
XELOGVK(" clipped = %s", create_info.clipped ? "true" : "false");
|
||||
XELOGVK(" imageColorSpace = %s", to_string(create_info.imageColorSpace));
|
||||
auto image_usage_flags_str = to_flags_string(create_info.imageUsage);
|
||||
auto image_usage_flags_str = to_flags_string(
|
||||
static_cast<VkImageUsageFlagBits>(create_info.imageUsage));
|
||||
XELOGVK(" imageUsageFlags = %s", image_usage_flags_str.c_str());
|
||||
XELOGVK(" imageSharingMode = %s", to_string(create_info.imageSharingMode));
|
||||
XELOGVK(" queueFamilyCount = %u", create_info.queueFamilyIndexCount);
|
||||
|
|
|
@ -296,7 +296,7 @@ const char* to_string(VkResult result) {
|
|||
}
|
||||
}
|
||||
|
||||
std::string to_flags_string(VkImageUsageFlags flags) {
|
||||
std::string to_flags_string(VkImageUsageFlagBits flags) {
|
||||
std::string result;
|
||||
#define OR_FLAG(f) \
|
||||
if (flags & f) { \
|
||||
|
@ -317,6 +317,36 @@ std::string to_flags_string(VkImageUsageFlags flags) {
|
|||
return result;
|
||||
}
|
||||
|
||||
std::string to_flags_string(VkFormatFeatureFlagBits flags) {
|
||||
std::string result;
|
||||
#define OR_FLAG(f) \
|
||||
if (flags & f) { \
|
||||
if (!result.empty()) { \
|
||||
result += " | "; \
|
||||
} \
|
||||
result += #f; \
|
||||
}
|
||||
OR_FLAG(VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_BLIT_SRC_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_BLIT_DST_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR);
|
||||
OR_FLAG(VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT);
|
||||
#undef OR_FLAG
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string to_flags_string(VkSurfaceTransformFlagBitsKHR flags) {
|
||||
std::string result;
|
||||
#define OR_FLAG(f) \
|
||||
|
|
|
@ -65,7 +65,8 @@ const char* to_string(VkPhysicalDeviceType type);
|
|||
const char* to_string(VkSharingMode sharing_mode);
|
||||
const char* to_string(VkResult result);
|
||||
|
||||
std::string to_flags_string(VkImageUsageFlags flags);
|
||||
std::string to_flags_string(VkImageUsageFlagBits flags);
|
||||
std::string to_flags_string(VkFormatFeatureFlagBits flags);
|
||||
std::string to_flags_string(VkSurfaceTransformFlagBitsKHR flags);
|
||||
|
||||
const char* to_string(VkColorSpaceKHR color_space);
|
||||
|
|
Loading…
Reference in New Issue