mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 10:35:03 +00:00
shader_recompiler: Fix handling unbound depth image.
This commit is contained in:
parent
802124309d
commit
5d6abfe3f4
@ -308,17 +308,17 @@ constexpr AmdGpu::Image ImageResource::GetSharp(const Info& info) const noexcept
|
|||||||
if (!is_r128) {
|
if (!is_r128) {
|
||||||
image = info.ReadUdSharp<AmdGpu::Image>(sharp_idx);
|
image = info.ReadUdSharp<AmdGpu::Image>(sharp_idx);
|
||||||
} else {
|
} else {
|
||||||
AmdGpu::Buffer buf = info.ReadUdSharp<AmdGpu::Buffer>(sharp_idx);
|
const auto buf = info.ReadUdSharp<AmdGpu::Buffer>(sharp_idx);
|
||||||
memcpy(&image, &buf, sizeof(buf));
|
memcpy(&image, &buf, sizeof(buf));
|
||||||
}
|
}
|
||||||
if (!image.Valid()) {
|
if (!image.Valid()) {
|
||||||
// Fall back to null image if unbound.
|
// Fall back to null image if unbound.
|
||||||
return AmdGpu::Image::Null();
|
image = is_depth ? AmdGpu::Image::NullDepth() : AmdGpu::Image::Null();
|
||||||
}
|
} else if (is_depth) {
|
||||||
const auto data_fmt = image.GetDataFmt();
|
const auto data_fmt = image.GetDataFmt();
|
||||||
if (is_depth && data_fmt != AmdGpu::DataFormat::Format16 &&
|
if (data_fmt != AmdGpu::DataFormat::Format16 && data_fmt != AmdGpu::DataFormat::Format32) {
|
||||||
data_fmt != AmdGpu::DataFormat::Format32) {
|
image = AmdGpu::Image::NullDepth();
|
||||||
return AmdGpu::Image::NullDepth();
|
}
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
@ -369,13 +369,14 @@ void PatchImageSharp(IR::Block& block, IR::Inst& inst, Info& info, Descriptors&
|
|||||||
auto image = info.ReadUdSharp<AmdGpu::Image>(tsharp);
|
auto image = info.ReadUdSharp<AmdGpu::Image>(tsharp);
|
||||||
if (!image.Valid()) {
|
if (!image.Valid()) {
|
||||||
LOG_ERROR(Render_Vulkan, "Shader compiled with unbound image!");
|
LOG_ERROR(Render_Vulkan, "Shader compiled with unbound image!");
|
||||||
image = AmdGpu::Image::Null();
|
image = inst_info.is_depth ? AmdGpu::Image::NullDepth() : AmdGpu::Image::Null();
|
||||||
}
|
} else if (inst_info.is_depth) {
|
||||||
const auto data_fmt = image.GetDataFmt();
|
const auto data_fmt = image.GetDataFmt();
|
||||||
if (inst_info.is_depth && data_fmt != AmdGpu::DataFormat::Format16 &&
|
if (data_fmt != AmdGpu::DataFormat::Format16 && data_fmt != AmdGpu::DataFormat::Format32) {
|
||||||
data_fmt != AmdGpu::DataFormat::Format32) {
|
LOG_ERROR(Render_Vulkan,
|
||||||
LOG_ERROR(Render_Vulkan, "Shader compiled using non-depth image with depth instruction!");
|
"Shader compiled using non-depth image with depth instruction!");
|
||||||
image = AmdGpu::Image::NullDepth();
|
image = AmdGpu::Image::NullDepth();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ASSERT(image.GetType() != AmdGpu::ImageType::Invalid);
|
ASSERT(image.GetType() != AmdGpu::ImageType::Invalid);
|
||||||
const bool is_written = inst.GetOpcode() == IR::Opcode::ImageWrite;
|
const bool is_written = inst.GetOpcode() == IR::Opcode::ImageWrite;
|
||||||
|
Loading…
Reference in New Issue
Block a user