mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-30 18:27:00 +01:00
Merge feat/craft-gpu-device into feat/gpu-wgpu-device-from-craft-gpu-device
This commit is contained in:
commit
175f53dbd8
1 file changed
+15
@@ -236,6 +236,10 @@ fn finish(
|
||||
mut notices: Vec<Notice>,
|
||||
) -> Opened {
|
||||
let caps = Capabilities::of_device(&device);
|
||||
// wgpu's fallback adapter can be a software one that the listing did not show.
|
||||
if candidate.is_software() {
|
||||
notices.retain(|n| *n != Notice::NoSoftwareAdapter);
|
||||
}
|
||||
if candidate.is_software() && !asked_for(preference, &candidate) {
|
||||
notices.push(Notice::SoftwareOnly);
|
||||
}
|
||||
@@ -318,6 +322,17 @@ mod tests {
|
||||
assert_eq!(pollster::block_on(open_async(&none, None, &Preference::Auto, &Request::default())).unwrap_err(), OpenError::NoAdapter);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_software_device_drops_the_no_software_notice() {
|
||||
let instance = noop(None);
|
||||
let opened = open(&instance, None, &Preference::Software, &Request::default()).unwrap();
|
||||
assert!(opened.candidate.is_software());
|
||||
// as when the listing showed no software adapter and wgpu's fallback adapter opened
|
||||
let notices = vec![Notice::NoSoftwareAdapter];
|
||||
let again = finish(opened.adapter, opened.device, opened.queue, opened.candidate, &Preference::Software, notices);
|
||||
assert!(again.notices.is_empty(), "{:?}", again.notices);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_optional_experimental_feature_does_not_stop_the_device_opening() {
|
||||
let instance = noop(Some(Features::EXPERIMENTAL_RAY_QUERY | Features::TEXTURE_FORMAT_NV12));
|
||||
|
||||
Reference in new issue
Block a user