mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-20 18:34:58 +00:00
Fix amdgpu & other issues (#2000)
This commit is contained in:
parent
c25447097e
commit
596f4cdf0e
7 changed files with 27 additions and 24 deletions
|
@ -66,7 +66,7 @@ void RegPopup::DrawColorBuffer(const AmdGpu::Liverpool::ColorBuffer& buffer) {
|
||||||
"GetColorSliceSize()", buffer.GetColorSliceSize(),
|
"GetColorSliceSize()", buffer.GetColorSliceSize(),
|
||||||
"GetTilingMode()", buffer.GetTilingMode(),
|
"GetTilingMode()", buffer.GetTilingMode(),
|
||||||
"IsTiled()", buffer.IsTiled(),
|
"IsTiled()", buffer.IsTiled(),
|
||||||
"NumFormat()", buffer.NumFormat()
|
"NumFormat()", buffer.GetNumberFmt()
|
||||||
);
|
);
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
|
@ -889,11 +889,11 @@ struct Liverpool {
|
||||||
return !info.linear_general;
|
return !info.linear_general;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] DataFormat DataFormat() const {
|
[[nodiscard]] DataFormat GetDataFmt() const {
|
||||||
return RemapDataFormat(info.format);
|
return RemapDataFormat(info.format);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] NumberFormat NumFormat() const {
|
[[nodiscard]] NumberFormat GetNumberFmt() const {
|
||||||
// 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
|
||||||
|
|
|
@ -79,21 +79,23 @@ inline NumberFormat RemapNumberFormat(const NumberFormat format) {
|
||||||
|
|
||||||
inline CompMapping RemapComponents(const DataFormat format, const CompMapping components) {
|
inline CompMapping RemapComponents(const DataFormat format, const CompMapping components) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case DataFormat::Format11_11_10:
|
case DataFormat::Format11_11_10: {
|
||||||
return {
|
CompMapping result;
|
||||||
.r = components.b,
|
result.r = components.b;
|
||||||
.g = components.g,
|
result.g = components.g;
|
||||||
.b = components.r,
|
result.b = components.r;
|
||||||
.a = components.a,
|
result.a = components.a;
|
||||||
};
|
return result;
|
||||||
|
}
|
||||||
case DataFormat::Format10_10_10_2:
|
case DataFormat::Format10_10_10_2:
|
||||||
case DataFormat::Format5_5_5_1:
|
case DataFormat::Format5_5_5_1: {
|
||||||
return {
|
CompMapping result;
|
||||||
.r = components.a,
|
result.r = components.a;
|
||||||
.g = components.b,
|
result.g = components.b;
|
||||||
.b = components.g,
|
result.b = components.g;
|
||||||
.a = components.r,
|
result.a = components.r;
|
||||||
};
|
return result;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return components;
|
return components;
|
||||||
}
|
}
|
||||||
|
|
|
@ -770,8 +770,8 @@ vk::Format DepthFormat(DepthBuffer::ZFormat z_format, DepthBuffer::StencilFormat
|
||||||
|
|
||||||
vk::ClearValue ColorBufferClearValue(const AmdGpu::Liverpool::ColorBuffer& color_buffer) {
|
vk::ClearValue ColorBufferClearValue(const AmdGpu::Liverpool::ColorBuffer& color_buffer) {
|
||||||
const auto comp_swizzle = color_buffer.Swizzle();
|
const auto comp_swizzle = color_buffer.Swizzle();
|
||||||
const auto format = color_buffer.DataFormat();
|
const auto format = color_buffer.GetDataFmt();
|
||||||
const auto number_type = color_buffer.NumFormat();
|
const auto number_type = color_buffer.GetNumberFmt();
|
||||||
|
|
||||||
const auto& c0 = color_buffer.clear_word0;
|
const auto& c0 = color_buffer.clear_word0;
|
||||||
const auto& c1 = color_buffer.clear_word1;
|
const auto& c1 = color_buffer.clear_word1;
|
||||||
|
|
|
@ -328,8 +328,8 @@ bool PipelineCache::RefreshGraphicsKey() {
|
||||||
}
|
}
|
||||||
|
|
||||||
key.color_formats[remapped_cb] =
|
key.color_formats[remapped_cb] =
|
||||||
LiverpoolToVK::SurfaceFormat(col_buf.DataFormat(), col_buf.NumFormat());
|
LiverpoolToVK::SurfaceFormat(col_buf.GetDataFmt(), col_buf.GetNumberFmt());
|
||||||
key.color_num_formats[remapped_cb] = col_buf.NumFormat();
|
key.color_num_formats[remapped_cb] = col_buf.GetNumberFmt();
|
||||||
key.color_swizzles[remapped_cb] = col_buf.Swizzle();
|
key.color_swizzles[remapped_cb] = col_buf.Swizzle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,9 +265,9 @@ ImageInfo::ImageInfo(const AmdGpu::Liverpool::ColorBuffer& buffer,
|
||||||
const AmdGpu::Liverpool::CbDbExtent& hint /*= {}*/) noexcept {
|
const AmdGpu::Liverpool::CbDbExtent& hint /*= {}*/) noexcept {
|
||||||
props.is_tiled = buffer.IsTiled();
|
props.is_tiled = buffer.IsTiled();
|
||||||
tiling_mode = buffer.GetTilingMode();
|
tiling_mode = buffer.GetTilingMode();
|
||||||
pixel_format = LiverpoolToVK::SurfaceFormat(buffer.DataFormat(), buffer.NumFormat());
|
pixel_format = LiverpoolToVK::SurfaceFormat(buffer.GetDataFmt(), buffer.GetNumberFmt());
|
||||||
num_samples = buffer.NumSamples();
|
num_samples = buffer.NumSamples();
|
||||||
num_bits = NumBits(buffer.DataFormat());
|
num_bits = NumBits(buffer.GetDataFmt());
|
||||||
type = vk::ImageType::e2D;
|
type = vk::ImageType::e2D;
|
||||||
size.width = hint.Valid() ? hint.width : buffer.Pitch();
|
size.width = hint.Valid() ? hint.width : buffer.Pitch();
|
||||||
size.height = hint.Valid() ? hint.height : buffer.Height();
|
size.height = hint.Valid() ? hint.height : buffer.Height();
|
||||||
|
|
|
@ -76,7 +76,8 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::ColorBuffer& col_buffer) n
|
||||||
range.base.layer = col_buffer.view.slice_start;
|
range.base.layer = col_buffer.view.slice_start;
|
||||||
range.extent.layers = col_buffer.NumSlices() - range.base.layer;
|
range.extent.layers = col_buffer.NumSlices() - range.base.layer;
|
||||||
type = range.extent.layers > 1 ? vk::ImageViewType::e2DArray : vk::ImageViewType::e2D;
|
type = range.extent.layers > 1 ? vk::ImageViewType::e2DArray : vk::ImageViewType::e2D;
|
||||||
format = Vulkan::LiverpoolToVK::SurfaceFormat(col_buffer.DataFormat(), col_buffer.NumFormat());
|
format =
|
||||||
|
Vulkan::LiverpoolToVK::SurfaceFormat(col_buffer.GetDataFmt(), col_buffer.GetNumberFmt());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::DepthBuffer& depth_buffer,
|
ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::DepthBuffer& depth_buffer,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue