mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
shader_recompiler: Fix unbound image fallback.
This commit is contained in:
parent
a540ca12cf
commit
0574d1274e
@ -621,7 +621,6 @@ void PatchImageInstruction(IR::Block& block, IR::Inst& inst, Info& info, Descrip
|
|||||||
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();
|
|
||||||
}
|
}
|
||||||
ASSERT(image.GetType() != AmdGpu::ImageType::Invalid);
|
ASSERT(image.GetType() != AmdGpu::ImageType::Invalid);
|
||||||
const bool is_storage = IsImageStorageInstruction(inst);
|
const bool is_storage = IsImageStorageInstruction(inst);
|
||||||
|
@ -176,18 +176,6 @@ struct Image {
|
|||||||
u64 lod_hw_cnt_en : 1;
|
u64 lod_hw_cnt_en : 1;
|
||||||
u64 : 43;
|
u64 : 43;
|
||||||
|
|
||||||
static constexpr Image Null() {
|
|
||||||
Image image{};
|
|
||||||
image.data_format = u64(DataFormat::Format8_8_8_8);
|
|
||||||
image.dst_sel_x = 4;
|
|
||||||
image.dst_sel_y = 5;
|
|
||||||
image.dst_sel_z = 6;
|
|
||||||
image.dst_sel_w = 7;
|
|
||||||
image.tiling_index = u64(TilingMode::Texture_MicroTiled);
|
|
||||||
image.type = u64(ImageType::Color2D);
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Valid() const {
|
bool Valid() const {
|
||||||
return (type & 0x8u) != 0;
|
return (type & 0x8u) != 0;
|
||||||
}
|
}
|
||||||
@ -269,18 +257,21 @@ struct Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImageType GetType() const noexcept {
|
ImageType GetType() const noexcept {
|
||||||
return static_cast<ImageType>(type);
|
return Valid() ? static_cast<ImageType>(type) : ImageType::Color2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataFormat GetDataFmt() const noexcept {
|
DataFormat GetDataFmt() const noexcept {
|
||||||
return static_cast<DataFormat>(data_format);
|
return Valid() ? static_cast<DataFormat>(data_format) : DataFormat::Format8_8_8_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberFormat GetNumberFmt() const noexcept {
|
NumberFormat GetNumberFmt() const noexcept {
|
||||||
return static_cast<NumberFormat>(num_format);
|
return Valid() ? static_cast<NumberFormat>(num_format) : NumberFormat::Unorm;
|
||||||
}
|
}
|
||||||
|
|
||||||
TilingMode GetTilingMode() const {
|
TilingMode GetTilingMode() const {
|
||||||
|
if (!Valid()) {
|
||||||
|
return TilingMode::Texture_MicroTiled;
|
||||||
|
}
|
||||||
if (tiling_index >= 0 && tiling_index <= 7) {
|
if (tiling_index >= 0 && tiling_index <= 7) {
|
||||||
return tiling_index == 5 ? TilingMode::Texture_MicroTiled
|
return tiling_index == 5 ? TilingMode::Texture_MicroTiled
|
||||||
: TilingMode::Depth_MacroTiled;
|
: TilingMode::Depth_MacroTiled;
|
||||||
|
Loading…
Reference in New Issue
Block a user