mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-11-17 19:44:36 +01:00
fixed single channel formats (#4435)
This commit is contained in:
1 parent
cc5d35dc08
commit
7ea310f825
1 file changed
+18
@@ -288,6 +288,24 @@ constexpr CompMapping RemapSwizzle(const DataFormat format, const CompMapping sw
|
||||
result.a = swizzle.a;
|
||||
return result;
|
||||
}
|
||||
case DataFormat::Format8:
|
||||
case DataFormat::Format16:
|
||||
case DataFormat::Format32: {
|
||||
// PS4 single-channel formats expose the texel as either R or A depending on dst_sel,
|
||||
// but Vulkan single-channel formats expose it only via R. Redirect any selector
|
||||
// that points at Alpha to Red so the texel is read correctly.
|
||||
CompMapping result = swizzle;
|
||||
const auto remap_alpha_to_red = [](CompSwizzle& c) {
|
||||
if (c == CompSwizzle::Alpha) {
|
||||
c = CompSwizzle::Red;
|
||||
}
|
||||
};
|
||||
remap_alpha_to_red(result.r);
|
||||
remap_alpha_to_red(result.g);
|
||||
remap_alpha_to_red(result.b);
|
||||
remap_alpha_to_red(result.a);
|
||||
return result;
|
||||
}
|
||||
default:
|
||||
return swizzle;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user