mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-15 11:25:13 +00:00
amdgpu: Handle 8-bit float format case for stencil. (#2092)
This commit is contained in:
parent
725814ce01
commit
4563b6379d
|
@ -899,7 +899,8 @@ struct Liverpool {
|
||||||
// There is a small difference between T# and CB number types, account for it.
|
// There is a small difference between T# and CB number types, account for it.
|
||||||
return RemapNumberFormat(info.number_type == NumberFormat::SnormNz
|
return RemapNumberFormat(info.number_type == NumberFormat::SnormNz
|
||||||
? NumberFormat::Srgb
|
? NumberFormat::Srgb
|
||||||
: info.number_type.Value());
|
: info.number_type.Value(),
|
||||||
|
info.format);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] NumberConversion GetNumberConversion() const {
|
[[nodiscard]] NumberConversion GetNumberConversion() const {
|
||||||
|
|
|
@ -54,7 +54,7 @@ struct Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberFormat GetNumberFmt() const noexcept {
|
NumberFormat GetNumberFmt() const noexcept {
|
||||||
return RemapNumberFormat(NumberFormat(num_format));
|
return RemapNumberFormat(NumberFormat(num_format), DataFormat(data_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
DataFormat GetDataFmt() const noexcept {
|
DataFormat GetDataFmt() const noexcept {
|
||||||
|
@ -264,7 +264,7 @@ struct Image {
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberFormat GetNumberFmt() const noexcept {
|
NumberFormat GetNumberFmt() const noexcept {
|
||||||
return RemapNumberFormat(NumberFormat(num_format));
|
return RemapNumberFormat(NumberFormat(num_format), DataFormat(data_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberConversion GetNumberConversion() const noexcept {
|
NumberConversion GetNumberConversion() const noexcept {
|
||||||
|
|
|
@ -252,7 +252,7 @@ inline DataFormat RemapDataFormat(const DataFormat format) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline NumberFormat RemapNumberFormat(const NumberFormat format) {
|
inline NumberFormat RemapNumberFormat(const NumberFormat format, const DataFormat data_format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case NumberFormat::Uscaled:
|
case NumberFormat::Uscaled:
|
||||||
return NumberFormat::Uint;
|
return NumberFormat::Uint;
|
||||||
|
@ -260,6 +260,14 @@ inline NumberFormat RemapNumberFormat(const NumberFormat format) {
|
||||||
return NumberFormat::Sint;
|
return NumberFormat::Sint;
|
||||||
case NumberFormat::Ubnorm:
|
case NumberFormat::Ubnorm:
|
||||||
return NumberFormat::Unorm;
|
return NumberFormat::Unorm;
|
||||||
|
case NumberFormat::Float:
|
||||||
|
if (data_format == DataFormat::Format8) {
|
||||||
|
// Games may ask for 8-bit float when they want to access the stencil component
|
||||||
|
// of a depth-stencil image. Change to unsigned int to match the stencil format.
|
||||||
|
// This is also the closest approximation to pass the bits through unconverted.
|
||||||
|
return NumberFormat::Uint;
|
||||||
|
}
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue