[dxvk] Re-add render target format validation

This was lost during the state cache and render target state rework.
This commit is contained in:
Philip Rebohle 2022-07-09 13:44:52 +02:00
parent 021aff1fc0
commit c6168179bd
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 25 additions and 0 deletions

View File

@ -997,6 +997,31 @@ namespace dxvk {
return false;
}
// Validate render target format support
VkFormat depthFormat = state.rt.getDepthStencilFormat();
if (depthFormat) {
VkFormatProperties formatInfo = m_device->adapter()->formatProperties(depthFormat);
if (!(formatInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) {
Logger::err(str::format(depthFormat, " not supported as depth-stencil attachment"));
return false;
}
}
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
VkFormat colorFormat = state.rt.getColorFormat(i);
if (colorFormat) {
VkFormatProperties formatInfo = m_device->adapter()->formatProperties(colorFormat);
if (!(formatInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) {
Logger::err(str::format(depthFormat, " not supported as color attachment"));
return false;
}
}
}
return true;
}