mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-23 20:05:01 +00:00
shader_recompiler: Add workaround for drivers with unexpected unorm rounding behavior. (#2310)
This commit is contained in:
parent
b6ad512e34
commit
b879dd59c6
3 changed files with 17 additions and 1 deletions
|
@ -17,7 +17,11 @@ u32 SwizzleMrtComponent(const FragmentRuntimeInfo::PsColorBuffer& color_buffer,
|
|||
|
||||
void Translator::ExportMrtValue(IR::Attribute attribute, u32 comp, const IR::F32& value,
|
||||
const FragmentRuntimeInfo::PsColorBuffer& color_buffer) {
|
||||
const auto converted = ApplyWriteNumberConversion(ir, value, color_buffer.num_conversion);
|
||||
auto converted = ApplyWriteNumberConversion(ir, value, color_buffer.num_conversion);
|
||||
if (color_buffer.needs_unorm_fixup) {
|
||||
// FIXME: Fix-up for GPUs where float-to-unorm rounding is off from expected.
|
||||
converted = ir.FPSub(converted, ir.Imm32(1.f / 127500.f));
|
||||
}
|
||||
ir.SetAttribute(attribute, converted, comp);
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,7 @@ struct FragmentRuntimeInfo {
|
|||
AmdGpu::NumberConversion num_conversion;
|
||||
AmdGpu::CompMapping swizzle;
|
||||
AmdGpu::Liverpool::ShaderExportFormat export_format;
|
||||
bool needs_unorm_fixup;
|
||||
|
||||
auto operator<=>(const PsColorBuffer&) const noexcept = default;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue