Skip to content

Commit

Permalink
move GL vendor magic numbers to "auxil::db" (#3035)
Browse files Browse the repository at this point in the history
  • Loading branch information
i509VCB authored Sep 19, 2022
1 parent 95408cd commit 6f2c393
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
12 changes: 12 additions & 0 deletions wgpu-hal/src/auxil/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ pub(super) mod dxgi;
pub(super) mod renderdoc;

pub mod db {
pub mod amd {
pub const VENDOR: u32 = 0x1002;
}
pub mod arm {
pub const VENDOR: u32 = 0x13B5;
}
pub mod broadcom {
pub const VENDOR: u32 = 0x14E4;
}
pub mod imgtec {
pub const VENDOR: u32 = 0x1010;
}
pub mod intel {
pub const VENDOR: u32 = 0x8086;
pub const DEVICE_KABY_LAKE_MASK: u32 = 0x5900;
Expand Down
18 changes: 10 additions & 8 deletions wgpu-hal/src/gles/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use glow::HasContext;
use std::sync::Arc;
use wgt::AstcChannel;

use crate::auxil::db;

// https://webgl2fundamentals.org/webgl/lessons/webgl-data-textures.html

const GL_UNMASKED_VENDOR_WEBGL: u32 = 0x9245;
Expand Down Expand Up @@ -145,26 +147,26 @@ impl super::Adapter {

// source: Sascha Willems at Vulkan
let vendor_id = if vendor.contains("amd") {
0x1002
db::amd::VENDOR
} else if vendor.contains("imgtec") {
0x1010
db::imgtec::VENDOR
} else if vendor.contains("nvidia") {
0x10DE
db::nvidia::VENDOR
} else if vendor.contains("arm") {
0x13B5
db::arm::VENDOR
} else if vendor.contains("qualcomm") {
0x5143
db::qualcomm::VENDOR
} else if vendor.contains("intel") {
0x8086
db::intel::VENDOR
} else if vendor.contains("broadcom") {
0x14e4
db::broadcom::VENDOR
} else {
0
};

wgt::AdapterInfo {
name: renderer_orig,
vendor: vendor_id,
vendor: vendor_id as usize,
device: 0,
device_type: inferred_device_type,
backend: wgt::Backend::Gl,
Expand Down

0 comments on commit 6f2c393

Please sign in to comment.