mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +01:00
[dxvk] Write correct depth-stencil attachment layout to state cache
Fixes a dumb issue where we'd compress layouts with high enum values to a single byte and incorrectly interpret the result as PREINITIALIZED.
This commit is contained in:
parent
9361f19da6
commit
03dc59ef39
@ -542,7 +542,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
entry.format.sampleCount = VkSampleCountFlagBits(sampleCount);
|
entry.format.sampleCount = VkSampleCountFlagBits(sampleCount);
|
||||||
entry.format.depth.format = VkFormat(imageFormat);
|
entry.format.depth.format = VkFormat(imageFormat);
|
||||||
entry.format.depth.layout = VkImageLayout(imageLayout);
|
entry.format.depth.layout = unpackImageLayout(imageLayout);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||||
if (!data.read(imageFormat)
|
if (!data.read(imageFormat)
|
||||||
@ -550,7 +550,7 @@ namespace dxvk {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
entry.format.color[i].format = VkFormat(imageFormat);
|
entry.format.color[i].format = VkFormat(imageFormat);
|
||||||
entry.format.color[i].layout = VkImageLayout(imageLayout);
|
entry.format.color[i].layout = unpackImageLayout(imageLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read common pipeline state
|
// Read common pipeline state
|
||||||
@ -638,11 +638,11 @@ namespace dxvk {
|
|||||||
// Pack render pass format
|
// Pack render pass format
|
||||||
data.write(uint8_t(entry.format.sampleCount));
|
data.write(uint8_t(entry.format.sampleCount));
|
||||||
data.write(uint8_t(entry.format.depth.format));
|
data.write(uint8_t(entry.format.depth.format));
|
||||||
data.write(uint8_t(entry.format.depth.layout));
|
data.write(packImageLayout(entry.format.depth.layout));
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||||
data.write(uint8_t(entry.format.color[i].format));
|
data.write(uint8_t(entry.format.color[i].format));
|
||||||
data.write(uint8_t(entry.format.color[i].layout));
|
data.write(packImageLayout(entry.format.color[i].layout));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out common pipeline state
|
// Write out common pipeline state
|
||||||
@ -965,4 +965,24 @@ namespace dxvk {
|
|||||||
return env::getEnvVar("DXVK_STATE_CACHE_PATH");
|
return env::getEnvVar("DXVK_STATE_CACHE_PATH");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t DxvkStateCache::packImageLayout(
|
||||||
|
VkImageLayout layout) {
|
||||||
|
switch (layout) {
|
||||||
|
case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL: return 0x80;
|
||||||
|
case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL: return 0x81;
|
||||||
|
default: return uint8_t(layout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VkImageLayout DxvkStateCache::unpackImageLayout(
|
||||||
|
uint8_t layout) {
|
||||||
|
switch (layout) {
|
||||||
|
case 0x80: return VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
|
case 0x81: return VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL;
|
||||||
|
default: return VkImageLayout(layout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
std::string getCacheDir() const;
|
std::string getCacheDir() const;
|
||||||
|
|
||||||
|
static uint8_t packImageLayout(
|
||||||
|
VkImageLayout layout);
|
||||||
|
|
||||||
|
static VkImageLayout unpackImageLayout(
|
||||||
|
uint8_t layout);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user