hot-fix: downgrade Nx1 2D render targets to 1D

This commit is contained in:
psucien 2024-11-25 20:52:09 +01:00
parent f26df42b18
commit 363fbe7a83
5 changed files with 10 additions and 4 deletions

View file

@ -268,10 +268,10 @@ ImageInfo::ImageInfo(const AmdGpu::Liverpool::ColorBuffer& buffer,
pixel_format = LiverpoolToVK::SurfaceFormat(buffer.info.format, buffer.NumFormat());
num_samples = 1 << buffer.attrib.num_fragments_log2;
num_bits = NumBits(buffer.info.format);
type = vk::ImageType::e2D;
size.width = hint.Valid() ? hint.width : buffer.Pitch();
size.height = hint.Valid() ? hint.height : buffer.Height();
size.depth = 1;
type = size.height == 1 ? vk::ImageType::e1D : vk::ImageType::e2D;
pitch = buffer.Pitch();
resources.layers = buffer.NumSlices();
meta_info.cmask_addr = buffer.info.fast_clear ? buffer.CmaskAddress() : 0;

View file

@ -137,7 +137,7 @@ ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::ColorBuffer& col_buffer) n
ImageViewInfo::ImageViewInfo(const AmdGpu::Liverpool::DepthBuffer& depth_buffer,
AmdGpu::Liverpool::DepthView view,
AmdGpu::Liverpool::DepthControl ctl) {
AmdGpu::Liverpool::DepthControl ctl) noexcept {
format = Vulkan::LiverpoolToVK::DepthFormat(depth_buffer.z_info.format,
depth_buffer.stencil_info.format);
is_storage = ctl.depth_write_enable;

View file

@ -21,7 +21,7 @@ struct ImageViewInfo {
ImageViewInfo(const AmdGpu::Image& image, const Shader::ImageResource& desc) noexcept;
ImageViewInfo(const AmdGpu::Liverpool::ColorBuffer& col_buffer) noexcept;
ImageViewInfo(const AmdGpu::Liverpool::DepthBuffer& depth_buffer,
AmdGpu::Liverpool::DepthView view, AmdGpu::Liverpool::DepthControl ctl);
AmdGpu::Liverpool::DepthView view, AmdGpu::Liverpool::DepthControl ctl) noexcept;
vk::ImageViewType type = vk::ImageViewType::e2D;
vk::Format format = vk::Format::eR8G8B8A8Unorm;

View file

@ -71,7 +71,12 @@ public:
struct RenderTargetDesc : public BaseDesc {
RenderTargetDesc(const AmdGpu::Liverpool::ColorBuffer& buffer,
const AmdGpu::Liverpool::CbDbExtent& hint = {})
: BaseDesc{BindingType::RenderTarget, ImageInfo{buffer, hint}, ImageViewInfo{buffer}} {}
: BaseDesc{BindingType::RenderTarget, ImageInfo{buffer, hint}, ImageViewInfo{buffer}} {
if (info.size.height == 1) {
view_info.type = vk::ImageViewType::e1D;
ASSERT(info.resources.levels == 1);
}
}
};
struct DepthTargetDesc : public BaseDesc {

View file

@ -187,6 +187,7 @@ vk::Format DemoteImageFormatForDetiling(vk::Format format) {
case vk::Format::eR32Uint:
case vk::Format::eR16G16Sfloat:
case vk::Format::eR16G16Unorm:
case vk::Format::eR16G16Snorm:
case vk::Format::eB10G11R11UfloatPack32:
return vk::Format::eR32Uint;
case vk::Format::eBc1RgbaSrgbBlock: