1
1
use wgpu:: { Adapter , Backends , Device , Features , Instance , Limits , Queue } ;
2
2
3
- use crate :: report:: AdapterReport ;
3
+ use crate :: { report:: AdapterReport , TestParameters } ;
4
4
5
5
/// Initialize the logger for the test runner.
6
6
pub fn init_logger ( ) {
@@ -12,7 +12,7 @@ pub fn init_logger() {
12
12
}
13
13
14
14
/// Initialize a wgpu instance with the options from the environment.
15
- pub fn initialize_instance ( backends : wgpu:: Backends , force_fxc : bool ) -> Instance {
15
+ pub fn initialize_instance ( backends : wgpu:: Backends , params : & TestParameters ) -> Instance {
16
16
// We ignore `WGPU_BACKEND` for now, merely using test filtering to only run a single backend's tests.
17
17
//
18
18
// We can potentially work support back into the test runner in the future, but as the adapters are matched up
@@ -30,14 +30,19 @@ pub fn initialize_instance(backends: wgpu::Backends, force_fxc: bool) -> Instanc
30
30
} ;
31
31
// Some tests need to be able to force demote to FXC, to specifically test workarounds for FXC
32
32
// behavior.
33
- let dx12_shader_compiler = if force_fxc {
33
+ let dx12_shader_compiler = if params . force_fxc {
34
34
wgpu:: Dx12Compiler :: Fxc
35
35
} else {
36
36
wgpu:: Dx12Compiler :: from_env ( ) . unwrap_or ( wgpu:: Dx12Compiler :: StaticDxc )
37
37
} ;
38
+ // The defaults for debugging, overridden by the environment, overridden by the test parameters.
39
+ let flags = wgpu:: InstanceFlags :: debugging ( )
40
+ . with_env ( )
41
+ . union ( params. required_instance_flags ) ;
42
+
38
43
Instance :: new ( & wgpu:: InstanceDescriptor {
39
44
backends,
40
- flags : wgpu :: InstanceFlags :: debugging ( ) . with_env ( ) ,
45
+ flags,
41
46
backend_options : wgpu:: BackendOptions {
42
47
dx12 : wgpu:: Dx12BackendOptions {
43
48
shader_compiler : dx12_shader_compiler,
@@ -65,13 +70,13 @@ pub fn initialize_instance(backends: wgpu::Backends, force_fxc: bool) -> Instanc
65
70
/// Initialize a wgpu adapter, using the given adapter report to match the adapter.
66
71
pub async fn initialize_adapter (
67
72
adapter_report : Option < & AdapterReport > ,
68
- force_fxc : bool ,
73
+ params : & TestParameters ,
69
74
) -> ( Instance , Adapter , Option < SurfaceGuard > ) {
70
75
let backends = adapter_report
71
76
. map ( |report| Backends :: from ( report. info . backend ) )
72
77
. unwrap_or_default ( ) ;
73
78
74
- let instance = initialize_instance ( backends, force_fxc ) ;
79
+ let instance = initialize_instance ( backends, params ) ;
75
80
#[ allow( unused_variables) ]
76
81
let surface: Option < wgpu:: Surface > ;
77
82
let surface_guard: Option < SurfaceGuard > ;
0 commit comments