Skip to content

Commit 596f4cd

Browse files
authored
Fix amdgpu & other issues (#2000)
1 parent c254470 commit 596f4cd

File tree

7 files changed

+27
-24
lines changed

7 files changed

+27
-24
lines changed

src/core/devtools/widget/reg_popup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void RegPopup::DrawColorBuffer(const AmdGpu::Liverpool::ColorBuffer& buffer) {
6666
"GetColorSliceSize()", buffer.GetColorSliceSize(),
6767
"GetTilingMode()", buffer.GetTilingMode(),
6868
"IsTiled()", buffer.IsTiled(),
69-
"NumFormat()", buffer.NumFormat()
69+
"NumFormat()", buffer.GetNumberFmt()
7070
);
7171

7272
// clang-format on

src/video_core/amdgpu/liverpool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,11 +889,11 @@ struct Liverpool {
889889
return !info.linear_general;
890890
}
891891

892-
[[nodiscard]] DataFormat DataFormat() const {
892+
[[nodiscard]] DataFormat GetDataFmt() const {
893893
return RemapDataFormat(info.format);
894894
}
895895

896-
[[nodiscard]] NumberFormat NumFormat() const {
896+
[[nodiscard]] NumberFormat GetNumberFmt() const {
897897
// There is a small difference between T# and CB number types, account for it.
898898
return RemapNumberFormat(info.number_type == NumberFormat::SnormNz
899899
? NumberFormat::Srgb

src/video_core/amdgpu/resource.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,23 @@ inline NumberFormat RemapNumberFormat(const NumberFormat format) {
7979

8080
inline CompMapping RemapComponents(const DataFormat format, const CompMapping components) {
8181
switch (format) {
82-
case DataFormat::Format11_11_10:
83-
return {
84-
.r = components.b,
85-
.g = components.g,
86-
.b = components.r,
87-
.a = components.a,
88-
};
82+
case DataFormat::Format11_11_10: {
83+
CompMapping result;
84+
result.r = components.b;
85+
result.g = components.g;
86+
result.b = components.r;
87+
result.a = components.a;
88+
return result;
89+
}
8990
case DataFormat::Format10_10_10_2:
90-
case DataFormat::Format5_5_5_1:
91-
return {
92-
.r = components.a,
93-
.g = components.b,
94-
.b = components.g,
95-
.a = components.r,
96-
};
91+
case DataFormat::Format5_5_5_1: {
92+
CompMapping result;
93+
result.r = components.a;
94+
result.g = components.b;
95+
result.b = components.g;
96+
result.a = components.r;
97+
return result;
98+
}
9799
default:
98100
return components;
99101
}

src/video_core/renderer_vulkan/liverpool_to_vk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,8 +770,8 @@ vk::Format DepthFormat(DepthBuffer::ZFormat z_format, DepthBuffer::StencilFormat
770770

771771
vk::ClearValue ColorBufferClearValue(const AmdGpu::Liverpool::ColorBuffer& color_buffer) {
772772
const auto comp_swizzle = color_buffer.Swizzle();
773-
const auto format = color_buffer.DataFormat();
774-
const auto number_type = color_buffer.NumFormat();
773+
const auto format = color_buffer.GetDataFmt();
774+
const auto number_type = color_buffer.GetNumberFmt();
775775

776776
const auto& c0 = color_buffer.clear_word0;
777777
const auto& c1 = color_buffer.clear_word1;

src/video_core/renderer_vulkan/vk_pipeline_cache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ bool PipelineCache::RefreshGraphicsKey() {
328328
}
329329

330330
key.color_formats[remapped_cb] =
331-
LiverpoolToVK::SurfaceFormat(col_buf.DataFormat(), col_buf.NumFormat());
332-
key.color_num_formats[remapped_cb] = col_buf.NumFormat();
331+
LiverpoolToVK::SurfaceFormat(col_buf.GetDataFmt(), col_buf.GetNumberFmt());
332+
key.color_num_formats[remapped_cb] = col_buf.GetNumberFmt();
333333
key.color_swizzles[remapped_cb] = col_buf.Swizzle();
334334
}
335335

src/video_core/texture_cache/image_info.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ ImageInfo::ImageInfo(const AmdGpu::Liverpool::ColorBuffer& buffer,
265265
const AmdGpu::Liverpool::CbDbExtent& hint /*= {}*/) noexcept {
266266
props.is_tiled = buffer.IsTiled();
267267
tiling_mode = buffer.GetTilingMode();
268-
pixel_format = LiverpoolToVK::SurfaceFormat(buffer.DataFormat(), buffer.NumFormat());
268+
pixel_format = LiverpoolToVK::SurfaceFormat(buffer.GetDataFmt(), buffer.GetNumberFmt());
269269
num_samples = buffer.NumSamples();
270-
num_bits = NumBits(buffer.DataFormat());
270+
num_bits = NumBits(buffer.GetDataFmt());
271271
type = vk::ImageType::e2D;
272272
size.width = hint.Valid() ? hint.width : buffer.Pitch();
273273
size.height = hint.Valid() ? hint.height : buffer.Height();

src/video_core/texture_cache/image_view.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::ColorBuffer& col_buffer) n
7676
range.base.layer = col_buffer.view.slice_start;
7777
range.extent.layers = col_buffer.NumSlices() - range.base.layer;
7878
type = range.extent.layers > 1 ? vk::ImageViewType::e2DArray : vk::ImageViewType::e2D;
79-
format = Vulkan::LiverpoolToVK::SurfaceFormat(col_buffer.DataFormat(), col_buffer.NumFormat());
79+
format =
80+
Vulkan::LiverpoolToVK::SurfaceFormat(col_buffer.GetDataFmt(), col_buffer.GetNumberFmt());
8081
}
8182

8283
ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::DepthBuffer& depth_buffer,

0 commit comments

Comments
 (0)