From 2eeb956d8de09f5890f734e1ebee3219abd759ae Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 3 Jan 2024 19:07:01 -0500 Subject: [PATCH 1/6] Use custom mesa --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c604b4cc3..2ee2c1dd12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,9 @@ on: merge_group: env: + MESA_VERSION: "23.3.1" + CI_BINARY_BUILD: "build18" + CARGO_INCREMENTAL: false CARGO_TERM_COLOR: always WGPU_DX12_COMPILER: dxc @@ -385,7 +388,7 @@ jobs: run: | set -e - curl.exe -L https://github.com/pal1000/mesa-dist-win/releases/download/23.2.1/mesa3d-23.2.1-release-msvc.7z -o mesa.7z + curl.exe -L --retry 5 https://github.com/pal1000/mesa-dist-win/releases/download/$MESA_VERSION/mesa3d-$MESA_VERSION-release-msvc.7z -o mesa.7z 7z.exe e mesa.7z -omesa x64/{opengl32.dll,libgallium_wgl.dll,libglapi.dll,vulkan_lvp.dll,lvp_icd.x86_64.json} cp -v mesa/* target/llvm-cov-target/debug/ @@ -394,7 +397,7 @@ jobs: echo "VK_DRIVER_FILES=$PWD/mesa/lvp_icd.x86_64.json" >> "$GITHUB_ENV" echo "GALLIUM_DRIVER=llvmpipe" >> "$GITHUB_ENV" - - name: (linux) install llvmpipe, lavapipe, vulkan sdk + - name: (linux) install vulkan sdk if: matrix.os == 'ubuntu-22.04' shell: bash run: | @@ -406,10 +409,31 @@ jobs: wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list https://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list - # sudo add-apt-repository ppa:oibaf/graphics-drivers - sudo apt-get update - sudo apt install -y libegl-mesa0 libgl1-mesa-dri libxcb-xfixes0-dev vulkan-sdk mesa-vulkan-drivers + sudo apt install -y vulkan-sdk + + - name: (linux) install mesa + if: matrix.os == 'ubuntu-22.04' + shell: bash + run: | + set -e + + curl -L --retry 5 https://github.com/gfx-rs/ci-build/releases/download/$CI_BINARY_BUILD/mesa-$MESA_VERSION-linux-x86_64.tar.xz -o mesa.tar.xz + mkdir mesa + tar xf mesa.tar.xz -C mesa + + cat <<- EOF > icd.json + { + "ICD": { + "api_version": "1.1.255", + "library_path": "$PWD/mesa/lib/x86_64-linux-gnu/libvulkan_lvp.so" + }, + "file_format_version": "1.0.0" + } + EOF + + echo "VK_DRIVER_FILES=$PWD/icd.json" >> "$GITHUB_ENV" + echo "LD_LIBRARY_PATH=$PWD/mesa/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" - name: disable debug shell: bash From c4d1ffdcd00c544157818b5e9e668b021a5580f2 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 3 Jan 2024 19:08:49 -0500 Subject: [PATCH 2/6] Re-add linux --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ee2c1dd12..6e6759bfca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -332,9 +332,8 @@ jobs: os: [self-hosted, macOS] # Linux - # https://github.com/gfx-rs/wgpu/issues/4961 - # - name: Linux x86_64 - # os: ubuntu-22.04 + - name: Linux x86_64 + os: ubuntu-22.04 name: Test ${{ matrix.name }} runs-on: ${{ matrix.os }} From bfffe2111feec801715a334064f816a20bd88158 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 3 Jan 2024 19:19:27 -0500 Subject: [PATCH 3/6] Fix permissions --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e6759bfca..40e35e69a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -419,7 +419,7 @@ jobs: curl -L --retry 5 https://github.com/gfx-rs/ci-build/releases/download/$CI_BINARY_BUILD/mesa-$MESA_VERSION-linux-x86_64.tar.xz -o mesa.tar.xz mkdir mesa - tar xf mesa.tar.xz -C mesa + tar xpf mesa.tar.xz -C mesa cat <<- EOF > icd.json { From 1cadc8f4acc280af0c505e4513f812b985c4c817 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 3 Jan 2024 19:38:50 -0500 Subject: [PATCH 4/6] Fix DRI path --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40e35e69a1..0096f28773 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -433,6 +433,7 @@ jobs: echo "VK_DRIVER_FILES=$PWD/icd.json" >> "$GITHUB_ENV" echo "LD_LIBRARY_PATH=$PWD/mesa/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" + echo "LIBGL_DRIVERS_PATH=$PWD/mesa/lib/x86_64-linux-gnu/dri" >> "$GITHUB_ENV" - name: disable debug shell: bash From 028e51cf324a00d7302af6418b433ec1a7242ca6 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 3 Jan 2024 22:15:40 -0500 Subject: [PATCH 5/6] Fix NV12 enumeration --- wgpu-core/src/device/resource.rs | 5 ++++- wgpu-hal/src/vulkan/adapter.rs | 12 +++++++++++- wgpu-info/src/texture.rs | 6 +++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 3e18777eac..b6bd80d1e5 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -3230,7 +3230,10 @@ impl Device { .contains(wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES); // If we're running downlevel, we need to manually ask the backend what // we can use as we can't trust WebGPU. - let downlevel = !self.downlevel.is_webgpu_compliant(); + let downlevel = !self + .downlevel + .flags + .contains(wgt::DownlevelFlags::WEBGPU_TEXTURE_FORMAT_SUPPORT); if using_device_features || downlevel { Ok(self.get_texture_format_features(adapter, format)) diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 737615215d..477d166c70 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1711,7 +1711,17 @@ impl crate::Adapter for super::Adapter { .framebuffer_stencil_sample_counts .min(limits.sampled_image_stencil_sample_counts) } else { - match format.sample_type(None, None).unwrap() { + let first_aspect = format_aspect + .iter() + .next() + .expect("All texture should at least one aspect") + .map(); + + // We should never get depth or stencil out of this, due to the above. + assert_ne!(first_aspect, wgt::TextureAspect::DepthOnly); + assert_ne!(first_aspect, wgt::TextureAspect::StencilOnly); + + match format.sample_type(Some(first_aspect), None).unwrap() { wgt::TextureSampleType::Float { .. } => limits .framebuffer_color_sample_counts .min(limits.sampled_image_color_sample_counts), diff --git a/wgpu-info/src/texture.rs b/wgpu-info/src/texture.rs index aecd3071bd..b6f79c0482 100644 --- a/wgpu-info/src/texture.rs +++ b/wgpu-info/src/texture.rs @@ -1,6 +1,6 @@ // Lets keep these on one line #[rustfmt::skip] -pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 115] = [ +pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 119] = [ wgpu::TextureFormat::R8Unorm, wgpu::TextureFormat::R8Snorm, wgpu::TextureFormat::R8Uint, @@ -50,6 +50,10 @@ pub const TEXTURE_FORMAT_LIST: [wgpu::TextureFormat; 115] = [ wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureFormat::Rgb9e5Ufloat, + wgpu::TextureFormat::Rgb10a2Uint, + wgpu::TextureFormat::Rgb10a2Unorm, + wgpu::TextureFormat::Rg11b10Float, + wgpu::TextureFormat::NV12, wgpu::TextureFormat::Bc1RgbaUnorm, wgpu::TextureFormat::Bc1RgbaUnormSrgb, wgpu::TextureFormat::Bc2RgbaUnorm, From 5c44b88349929e849b524ffdd148401d17dd1144 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 3 Jan 2024 22:25:42 -0500 Subject: [PATCH 6/6] Fix unreachable --- wgpu-hal/src/gles/adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 4dc442441a..785ed49e31 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -1072,7 +1072,7 @@ impl crate::Adapter for super::Adapter { | Tf::Depth32FloatStencil8 | Tf::Depth24Plus | Tf::Depth24PlusStencil8 => depth, - Tf::NV12 => unreachable!(), + Tf::NV12 => empty, Tf::Rgb9e5Ufloat => filterable, Tf::Bc1RgbaUnorm | Tf::Bc1RgbaUnormSrgb