mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-26 12:26:18 +00:00
shader_recompiler: Fix handling unbound depth image. (#3143)
* shader_recompiler: Fix handling unbound depth image. * shader_recompiler: Consolidate unbound image handling.
This commit is contained in:
parent
d9dac05db2
commit
669b19c2f3
2 changed files with 20 additions and 27 deletions
|
@ -308,17 +308,19 @@ constexpr AmdGpu::Image ImageResource::GetSharp(const Info& info) const noexcept
|
|||
if (!is_r128) {
|
||||
image = info.ReadUdSharp<AmdGpu::Image>(sharp_idx);
|
||||
} else {
|
||||
AmdGpu::Buffer buf = info.ReadUdSharp<AmdGpu::Buffer>(sharp_idx);
|
||||
const auto buf = info.ReadUdSharp<AmdGpu::Buffer>(sharp_idx);
|
||||
memcpy(&image, &buf, sizeof(buf));
|
||||
}
|
||||
if (!image.Valid()) {
|
||||
// Fall back to null image if unbound.
|
||||
return AmdGpu::Image::Null();
|
||||
}
|
||||
const auto data_fmt = image.GetDataFmt();
|
||||
if (is_depth && data_fmt != AmdGpu::DataFormat::Format16 &&
|
||||
data_fmt != AmdGpu::DataFormat::Format32) {
|
||||
return AmdGpu::Image::NullDepth();
|
||||
LOG_DEBUG(Render_Vulkan, "Encountered unbound image!");
|
||||
image = is_depth ? AmdGpu::Image::NullDepth() : AmdGpu::Image::Null();
|
||||
} else if (is_depth) {
|
||||
const auto data_fmt = image.GetDataFmt();
|
||||
if (data_fmt != AmdGpu::DataFormat::Format16 && data_fmt != AmdGpu::DataFormat::Format32) {
|
||||
LOG_DEBUG(Render_Vulkan, "Encountered non-depth image used with depth instruction!");
|
||||
image = AmdGpu::Image::NullDepth();
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue