Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Custom Mesa for Building #4977

Merged
merged 6 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -329,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 }}
Expand Down Expand Up @@ -385,7 +387,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/
Expand All @@ -394,7 +396,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: |
Expand All @@ -406,10 +408,32 @@ 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 xpf 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"
echo "LIBGL_DRIVERS_PATH=$PWD/mesa/lib/x86_64-linux-gnu/dri" >> "$GITHUB_ENV"

- name: disable debug
shell: bash
Expand Down
5 changes: 4 additions & 1 deletion wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3230,7 +3230,10 @@ impl<A: HalApi> Device<A> {
.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))
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/gles/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ impl crate::Adapter<super::Api> for super::Adapter {
| Tf::Depth32FloatStencil8
| Tf::Depth24Plus
| Tf::Depth24PlusStencil8 => depth,
Tf::NV12 => unreachable!(),
Tf::NV12 => empty,
Tf::Rgb9e5Ufloat => filterable,
Tf::Bc1RgbaUnorm
| Tf::Bc1RgbaUnormSrgb
Expand Down
12 changes: 11 additions & 1 deletion wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,17 @@ impl crate::Adapter<super::Api> 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),
Expand Down
6 changes: 5 additions & 1 deletion wgpu-info/src/texture.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading