|
195 | 195 | <a href="#194" id="194">194</a> |
196 | 196 | <a href="#195" id="195">195</a> |
197 | 197 | <a href="#196" id="196">196</a> |
198 | | -<a href="#197" id="197">197</a></pre></div><pre class="rust"><code><span class="kw">use </span>wgpu::{Adapter, Backends, Device, Features, Instance, Limits, Queue}; |
| 198 | +<a href="#197" id="197">197</a> |
| 199 | +<a href="#198" id="198">198</a> |
| 200 | +<a href="#199" id="199">199</a> |
| 201 | +<a href="#200" id="200">200</a> |
| 202 | +<a href="#201" id="201">201</a> |
| 203 | +<a href="#202" id="202">202</a></pre></div><pre class="rust"><code><span class="kw">use </span>wgpu::{Adapter, Backends, Device, Features, Instance, Limits, Queue}; |
199 | 204 |
|
200 | | -<span class="kw">use </span><span class="kw">crate</span>::report::AdapterReport; |
| 205 | +<span class="kw">use crate</span>::{report::AdapterReport, TestParameters}; |
201 | 206 |
|
202 | 207 | <span class="doccomment">/// Initialize the logger for the test runner. |
203 | 208 | </span><span class="kw">pub fn </span>init_logger() { |
|
209 | 214 | } |
210 | 215 |
|
211 | 216 | <span class="doccomment">/// Initialize a wgpu instance with the options from the environment. |
212 | | -</span><span class="kw">pub fn </span>initialize_instance(backends: wgpu::Backends, force_fxc: bool) -> Instance { |
| 217 | +</span><span class="kw">pub fn </span>initialize_instance(backends: wgpu::Backends, params: <span class="kw-2">&</span>TestParameters) -> Instance { |
213 | 218 | <span class="comment">// We ignore `WGPU_BACKEND` for now, merely using test filtering to only run a single backend's tests. |
214 | 219 | // |
215 | 220 | // We can potentially work support back into the test runner in the future, but as the adapters are matched up |
|
227 | 232 | }; |
228 | 233 | <span class="comment">// Some tests need to be able to force demote to FXC, to specifically test workarounds for FXC |
229 | 234 | // behavior. |
230 | | - </span><span class="kw">let </span>dx12_shader_compiler = <span class="kw">if </span>force_fxc { |
| 235 | + </span><span class="kw">let </span>dx12_shader_compiler = <span class="kw">if </span>params.force_fxc { |
231 | 236 | wgpu::Dx12Compiler::Fxc |
232 | 237 | } <span class="kw">else </span>{ |
233 | 238 | wgpu::Dx12Compiler::from_env().unwrap_or(wgpu::Dx12Compiler::StaticDxc) |
234 | 239 | }; |
| 240 | + <span class="comment">// The defaults for debugging, overridden by the environment, overridden by the test parameters. |
| 241 | + </span><span class="kw">let </span>flags = wgpu::InstanceFlags::debugging() |
| 242 | + .with_env() |
| 243 | + .union(params.required_instance_flags); |
| 244 | + |
235 | 245 | Instance::new(<span class="kw-2">&</span>wgpu::InstanceDescriptor { |
236 | 246 | backends, |
237 | | - flags: wgpu::InstanceFlags::debugging().with_env(), |
| 247 | + flags, |
238 | 248 | backend_options: wgpu::BackendOptions { |
239 | 249 | dx12: wgpu::Dx12BackendOptions { |
240 | 250 | shader_compiler: dx12_shader_compiler, |
|
262 | 272 | <span class="doccomment">/// Initialize a wgpu adapter, using the given adapter report to match the adapter. |
263 | 273 | </span><span class="kw">pub async fn </span>initialize_adapter( |
264 | 274 | adapter_report: <span class="prelude-ty">Option</span><<span class="kw-2">&</span>AdapterReport>, |
265 | | - force_fxc: bool, |
| 275 | + params: <span class="kw-2">&</span>TestParameters, |
266 | 276 | ) -> (Instance, Adapter, <span class="prelude-ty">Option</span><SurfaceGuard>) { |
267 | 277 | <span class="kw">let </span>backends = adapter_report |
268 | 278 | .map(|report| Backends::from(report.info.backend)) |
269 | 279 | .unwrap_or_default(); |
270 | 280 |
|
271 | | - <span class="kw">let </span>instance = initialize_instance(backends, force_fxc); |
| 281 | + <span class="kw">let </span>instance = initialize_instance(backends, params); |
272 | 282 | <span class="attr">#[allow(unused_variables)] |
273 | 283 | </span><span class="kw">let </span>surface: <span class="prelude-ty">Option</span><wgpu::Surface>; |
274 | 284 | <span class="kw">let </span>surface_guard: <span class="prelude-ty">Option</span><SurfaceGuard>; |
|
0 commit comments