mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-02 15:32:52 +00:00
shader_recompiler: Use null image when shader is compiled with unbound sharp
This commit is contained in:
parent
b7e0df34a7
commit
cf7f79d9eb
@ -471,14 +471,11 @@ void PatchImageInstruction(IR::Block& block, IR::Inst& inst, Info& info, Descrip
|
|||||||
|
|
||||||
// Read image sharp.
|
// Read image sharp.
|
||||||
const auto tsharp = TrackSharp(tsharp_handle);
|
const auto tsharp = TrackSharp(tsharp_handle);
|
||||||
const auto image = info.ReadUd<AmdGpu::Image>(tsharp.sgpr_base, tsharp.dword_offset);
|
|
||||||
const auto inst_info = inst.Flags<IR::TextureInstInfo>();
|
const auto inst_info = inst.Flags<IR::TextureInstInfo>();
|
||||||
|
auto image = info.ReadUd<AmdGpu::Image>(tsharp.sgpr_base, tsharp.dword_offset);
|
||||||
if (!image.Valid()) {
|
if (!image.Valid()) {
|
||||||
LOG_ERROR(Render_Vulkan, "Shader compiled with unbound image!");
|
LOG_ERROR(Render_Vulkan, "Shader compiled with unbound image!");
|
||||||
IR::IREmitter ir{block, IR::Block::InstructionList::s_iterator_to(inst)};
|
image = AmdGpu::Image::Null();
|
||||||
inst.ReplaceUsesWith(
|
|
||||||
ir.CompositeConstruct(ir.Imm32(0.f), ir.Imm32(0.f), ir.Imm32(0.f), ir.Imm32(0.f)));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
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,6 +176,18 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,14 @@ struct BufferSpecialization {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct TextureBufferSpecialization {
|
struct TextureBufferSpecialization {
|
||||||
bool is_integer;
|
bool is_integer = false;
|
||||||
|
|
||||||
auto operator<=>(const TextureBufferSpecialization&) const = default;
|
auto operator<=>(const TextureBufferSpecialization&) const = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImageSpecialization {
|
struct ImageSpecialization {
|
||||||
AmdGpu::ImageType type;
|
AmdGpu::ImageType type = AmdGpu::ImageType::Color2D;
|
||||||
bool is_integer;
|
bool is_integer = false;
|
||||||
|
|
||||||
auto operator<=>(const ImageSpecialization&) const = default;
|
auto operator<=>(const ImageSpecialization&) const = default;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user