video_core: Keep the definition of DimensionControl consistent with nvidia open doc

This commit is contained in:
Feng Chen 2023-03-15 21:17:44 +08:00
parent 11ffbee5ae
commit ff2089fdf5
2 changed files with 22 additions and 19 deletions

View file

@ -856,8 +856,8 @@ public:
struct ZetaSize {
enum class DimensionControl : u32 {
DepthDefinesArray = 0,
ArraySizeOne = 1,
DefineArraySize = 0,
ArraySizeIsOne = 1,
};
u32 width;
@ -1104,8 +1104,8 @@ public:
struct TileMode {
enum class DimensionControl : u32 {
DepthDefinesArray = 0,
DepthDefinesDepth = 1,
DefineArraySize = 0,
DefineDepthSize = 1,
};
union {
BitField<0, 4, u32> block_width;

View file

@ -14,6 +14,7 @@
namespace VideoCommon {
using Tegra::Engines::Fermi2D;
using Tegra::Engines::Maxwell3D;
using Tegra::Texture::TextureType;
using Tegra::Texture::TICEntry;
@ -114,13 +115,13 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept {
}
}
ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig& ct,
ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct,
Tegra::Texture::MsaaMode msaa_mode) noexcept {
format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(ct.format);
rescaleable = false;
if (ct.tile_mode.is_pitch_linear) {
ASSERT(ct.tile_mode.dim_control ==
Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesArray);
Maxwell3D::Regs::TileMode::DimensionControl::DefineArraySize);
type = ImageType::Linear;
pitch = ct.width;
size = Extent3D{
@ -140,8 +141,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig&
.height = ct.tile_mode.block_height,
.depth = ct.tile_mode.block_depth,
};
if (ct.tile_mode.dim_control ==
Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesDepth) {
if (ct.tile_mode.dim_control == Maxwell3D::Regs::TileMode::DimensionControl::DefineDepthSize) {
type = ImageType::e3D;
size.depth = ct.depth;
} else {
@ -153,8 +153,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig&
}
}
ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::Zeta& zt,
const Tegra::Engines::Maxwell3D::Regs::ZetaSize& zt_size,
ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::ZetaSize& zt_size,
Tegra::Texture::MsaaMode msaa_mode) noexcept {
format = VideoCore::Surface::PixelFormatFromDepthFormat(zt.format);
size.width = zt_size.width;
@ -171,30 +170,34 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::Zeta& zt,
};
if (zt.tile_mode.is_pitch_linear) {
ASSERT(zt.tile_mode.dim_control ==
Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesArray);
Maxwell3D::Regs::TileMode::DimensionControl::DefineArraySize);
type = ImageType::Linear;
pitch = size.width * BytesPerBlock(format);
} else if (zt.tile_mode.dim_control ==
Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesDepth) {
ASSERT(zt.tile_mode.is_pitch_linear == 0);
ASSERT(zt_size.dim_control == Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeOne);
Maxwell3D::Regs::TileMode::DimensionControl::DefineDepthSize) {
ASSERT(zt_size.dim_control == Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeIsOne);
type = ImageType::e3D;
size.depth = zt_size.depth;
} else {
ASSERT(zt_size.dim_control ==
Maxwell3D::Regs::ZetaSize::DimensionControl::DepthDefinesArray);
rescaleable = block.depth == 0;
downscaleable = size.height > 512;
type = ImageType::e2D;
resources.layers = zt_size.depth;
switch (zt_size.dim_control) {
case Maxwell3D::Regs::ZetaSize::DimensionControl::DefineArraySize:
resources.layers = zt_size.depth;
break;
case Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeIsOne:
resources.layers = 1;
break;
}
}
}
ImageInfo::ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept {
ImageInfo::ImageInfo(const Fermi2D::Surface& config) noexcept {
UNIMPLEMENTED_IF_MSG(config.layer != 0, "Surface layer is not zero");
format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(config.format);
rescaleable = false;
if (config.linear == Tegra::Engines::Fermi2D::MemoryLayout::Pitch) {
if (config.linear == Fermi2D::MemoryLayout::Pitch) {
type = ImageType::Linear;
size = Extent3D{
.width = config.pitch / VideoCore::Surface::BytesPerBlock(format),