mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Validate image layouts in render pass formats read from cache
This will discard invalid cache entries generated by DXVK 1.4.3.
This commit is contained in:
parent
03dc59ef39
commit
8c34f4ff8a
@ -553,6 +553,9 @@ namespace dxvk {
|
||||
entry.format.color[i].layout = unpackImageLayout(imageLayout);
|
||||
}
|
||||
|
||||
if (!validateRenderPassFormat(entry.format))
|
||||
return false;
|
||||
|
||||
// Read common pipeline state
|
||||
if (!data.read(entry.gpState.bsBindingMask)
|
||||
|| !data.read(entry.gpState.ia)
|
||||
@ -985,4 +988,27 @@ namespace dxvk {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DxvkStateCache::validateRenderPassFormat(
|
||||
const DxvkRenderPassFormat& format) {
|
||||
bool valid = true;
|
||||
|
||||
if (format.depth.format) {
|
||||
valid &= format.depth.layout == VK_IMAGE_LAYOUT_GENERAL
|
||||
|| format.depth.layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
|
||||
|| format.depth.layout == VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL
|
||||
|| format.depth.layout == VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL
|
||||
|| format.depth.layout == VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets && valid; i++) {
|
||||
if (format.color[i].format) {
|
||||
valid &= format.color[i].layout == VK_IMAGE_LAYOUT_GENERAL
|
||||
|| format.color[i].layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -186,6 +186,9 @@ namespace dxvk {
|
||||
static VkImageLayout unpackImageLayout(
|
||||
uint8_t layout);
|
||||
|
||||
static bool validateRenderPassFormat(
|
||||
const DxvkRenderPassFormat& format);
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user