Skip to content

Commit

Permalink
Fix amdgpu & other issues
Browse files Browse the repository at this point in the history
  • Loading branch information
liberodark committed Jan 1, 2025
1 parent 65cd3be commit 90d2e58
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/video_core/amdgpu/liverpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ struct Liverpool {
return !info.linear_general;
}

[[nodiscard]] DataFormat DataFormat() const {
[[nodiscard]] DataFormat GetDataFmt() const {
return RemapDataFormat(info.format);
}

Expand Down
28 changes: 16 additions & 12 deletions src/video_core/amdgpu/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,24 @@ inline NumberFormat RemapNumberFormat(const NumberFormat format) {
inline CompMapping RemapComponents(const DataFormat format, const CompMapping components) {
switch (format) {
case DataFormat::Format11_11_10:
return {
.r = components.b,
.g = components.g,
.b = components.r,
.a = components.a,
};
{
CompMapping result;
result.r = components.b;
result.g = components.g;
result.b = components.r;
result.a = components.a;
return result;
}
case DataFormat::Format10_10_10_2:
case DataFormat::Format5_5_5_1:
return {
.r = components.a,
.g = components.b,
.b = components.g,
.a = components.r,
};
{
CompMapping result;
result.r = components.a;
result.g = components.b;
result.b = components.g;
result.a = components.r;
return result;
}
default:
return components;
}
Expand Down
2 changes: 1 addition & 1 deletion src/video_core/renderer_vulkan/liverpool_to_vk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ vk::Format DepthFormat(DepthBuffer::ZFormat z_format, DepthBuffer::StencilFormat

vk::ClearValue ColorBufferClearValue(const AmdGpu::Liverpool::ColorBuffer& color_buffer) {
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& c0 = color_buffer.clear_word0;
Expand Down
2 changes: 1 addition & 1 deletion src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ bool PipelineCache::RefreshGraphicsKey() {
}

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_swizzles[remapped_cb] = col_buf.Swizzle();
}
Expand Down
4 changes: 2 additions & 2 deletions src/video_core/texture_cache/image_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ ImageInfo::ImageInfo(const AmdGpu::Liverpool::ColorBuffer& buffer,
const AmdGpu::Liverpool::CbDbExtent& hint /*= {}*/) noexcept {
props.is_tiled = buffer.IsTiled();
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_bits = NumBits(buffer.DataFormat());
num_bits = NumBits(buffer.GetDataFmt());
type = vk::ImageType::e2D;
size.width = hint.Valid() ? hint.width : buffer.Pitch();
size.height = hint.Valid() ? hint.height : buffer.Height();
Expand Down
2 changes: 1 addition & 1 deletion src/video_core/texture_cache/image_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::ColorBuffer& col_buffer) n
range.base.layer = col_buffer.view.slice_start;
range.extent.layers = col_buffer.NumSlices() - range.base.layer;
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,
Expand Down

0 comments on commit 90d2e58

Please sign in to comment.