From 097f8b2c7dee0707eafd49eeffb566ce0c962b7e Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Wed, 9 Oct 2024 11:44:10 -0500 Subject: [PATCH] nil: Add D3D sample layouts Part-of: --- src/nouveau/nil/image.rs | 18 ++++++++++++------ src/nouveau/nil/tic.rs | 12 ++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/nouveau/nil/image.rs b/src/nouveau/nil/image.rs index a6decd8b78c..afd259364d7 100644 --- a/src/nouveau/nil/image.rs +++ b/src/nouveau/nil/image.rs @@ -29,13 +29,15 @@ pub enum ImageDim { #[derive(Clone, Debug, Copy, PartialEq, Default)] #[repr(u8)] pub enum SampleLayout { - _1x1 = 0, - _2x1 = 1, - _2x2 = 2, - _4x2 = 3, - _4x4 = 4, + _1x1, + _2x1, + _2x1D3d, + _2x2, + _4x2, + _4x2D3d, + _4x4, #[default] - Invalid = 5, + Invalid, } impl SampleLayout { @@ -59,8 +61,10 @@ impl SampleLayout { match self { SampleLayout::_1x1 => 1, SampleLayout::_2x1 => 2, + SampleLayout::_2x1D3d => 2, SampleLayout::_2x2 => 4, SampleLayout::_4x2 => 8, + SampleLayout::_4x2D3d => 8, SampleLayout::_4x4 => 16, SampleLayout::Invalid => panic!("Invalid sample layout"), } @@ -75,8 +79,10 @@ impl SampleLayout { match self { SampleLayout::_1x1 => Extent4D::new(1, 1, 1, 1), SampleLayout::_2x1 => Extent4D::new(2, 1, 1, 1), + SampleLayout::_2x1D3d => Extent4D::new(2, 1, 1, 1), SampleLayout::_2x2 => Extent4D::new(2, 2, 1, 1), SampleLayout::_4x2 => Extent4D::new(4, 2, 1, 1), + SampleLayout::_4x2D3d => Extent4D::new(4, 2, 1, 1), SampleLayout::_4x4 => Extent4D::new(4, 4, 1, 1), SampleLayout::Invalid => panic!("Invalid sample layout"), } diff --git a/src/nouveau/nil/tic.rs b/src/nouveau/nil/tic.rs index c594f51edb8..d1eddbe016e 100644 --- a/src/nouveau/nil/tic.rs +++ b/src/nouveau/nil/tic.rs @@ -165,8 +165,14 @@ fn nil_rs_to_nv9097_multi_sample_count(sample_layout: SampleLayout) -> u32 { match sample_layout { SampleLayout::_1x1 => cl9097::TEXHEADV2_MULTI_SAMPLE_COUNT_MODE_1X1, SampleLayout::_2x1 => cl9097::TEXHEADV2_MULTI_SAMPLE_COUNT_MODE_2X1, + SampleLayout::_2x1D3d => { + cl9097::TEXHEADV2_MULTI_SAMPLE_COUNT_MODE_2X1_D3D + } SampleLayout::_2x2 => cl9097::TEXHEADV2_MULTI_SAMPLE_COUNT_MODE_2X2, SampleLayout::_4x2 => cl9097::TEXHEADV2_MULTI_SAMPLE_COUNT_MODE_4X2, + SampleLayout::_4x2D3d => { + cl9097::TEXHEADV2_MULTI_SAMPLE_COUNT_MODE_4X2_D3D + } SampleLayout::_4x4 => cl9097::TEXHEADV2_MULTI_SAMPLE_COUNT_MODE_4X4, SampleLayout::Invalid => panic!("Invalid sample layout"), } @@ -176,8 +182,14 @@ fn nil_rs_to_nvb097_multi_sample_count(sample_layout: SampleLayout) -> u32 { match sample_layout { SampleLayout::_1x1 => clb097::TEXHEAD_BL_MULTI_SAMPLE_COUNT_MODE_1X1, SampleLayout::_2x1 => clb097::TEXHEAD_BL_MULTI_SAMPLE_COUNT_MODE_2X1, + SampleLayout::_2x1D3d => { + clb097::TEXHEAD_BL_MULTI_SAMPLE_COUNT_MODE_2X1_D3D + } SampleLayout::_2x2 => clb097::TEXHEAD_BL_MULTI_SAMPLE_COUNT_MODE_2X2, SampleLayout::_4x2 => clb097::TEXHEAD_BL_MULTI_SAMPLE_COUNT_MODE_4X2, + SampleLayout::_4x2D3d => { + clb097::TEXHEAD_BL_MULTI_SAMPLE_COUNT_MODE_4X2_D3D + } SampleLayout::_4x4 => clb097::TEXHEAD_BL_MULTI_SAMPLE_COUNT_MODE_4X4, SampleLayout::Invalid => panic!("Invalid sample layout"), }