Debian Codegraph @

testing/web-platform/mozilla/tests/webgpu/common/runtime/helper/utils_worker.js

raw
1 /**
2 * AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
3 **/import { globalTestConfig } from '../../framework/test_config.js';import { Logger } from '../../internal/logging/logger.js';
4 import { setDefaultRequestAdapterOptions } from '../../util/navigator_gpu.js';
5
6
7
8
9
10
11
12
13
14 /**
15 * Set config environment for workers with ctsOptions and return a Logger.
16 */
17 export function setupWorkerEnvironment(ctsOptions) {
18 const { powerPreference, compatibility } = ctsOptions;
19 globalTestConfig.enableDebugLogs = ctsOptions.debug;
20 globalTestConfig.unrollConstEvalLoops = ctsOptions.unrollConstEvalLoops;
21 globalTestConfig.compatibility = compatibility;
22 globalTestConfig.enforceDefaultLimits = ctsOptions.enforceDefaultLimits;
23 globalTestConfig.blockAllFeatures = ctsOptions.blockAllFeatures;
24 globalTestConfig.logToWebSocket = ctsOptions.logToWebSocket;
25
26 const log = new Logger();
27
28 if (powerPreference || compatibility) {
29 setDefaultRequestAdapterOptions({
30 ...(powerPreference && { powerPreference }),
31 ...(compatibility && { featureLevel: 'compatibility' })
32 });
33 }
34
35 return log;
36 }