Prechádzať zdrojové kódy

E2E: Replace SwiftShader with software Dawn (Lavapipe) (#33346)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mrdoob 2 mesiacov pred
rodič
commit
117c815d97
77 zmenil súbory, kde vykonal 59 pridanie a 47 odobranie
  1. 5 1
      .github/workflows/ci.yml
  2. BIN
      examples/screenshots/misc_exporter_gltf.jpg
  3. BIN
      examples/screenshots/webaudio_orientation.jpg
  4. BIN
      examples/screenshots/webaudio_visualizer.jpg
  5. BIN
      examples/screenshots/webgl_animation_skinning_morph.jpg
  6. BIN
      examples/screenshots/webgl_buffergeometry_custom_attributes_particles.jpg
  7. BIN
      examples/screenshots/webgl_buffergeometry_instancing_billboards.jpg
  8. BIN
      examples/screenshots/webgl_buffergeometry_points.jpg
  9. BIN
      examples/screenshots/webgl_buffergeometry_points_interleaved.jpg
  10. BIN
      examples/screenshots/webgl_camera_logarithmicdepthbuffer.jpg
  11. BIN
      examples/screenshots/webgl_custom_attributes_points.jpg
  12. BIN
      examples/screenshots/webgl_geometry_colors.jpg
  13. BIN
      examples/screenshots/webgl_gpgpu_protoplanet.jpg
  14. BIN
      examples/screenshots/webgl_helpers.jpg
  15. BIN
      examples/screenshots/webgl_instancing_morph.jpg
  16. BIN
      examples/screenshots/webgl_interactive_points.jpg
  17. BIN
      examples/screenshots/webgl_lights_spotlights.jpg
  18. BIN
      examples/screenshots/webgl_lines_dashed.jpg
  19. BIN
      examples/screenshots/webgl_loader_3dm.jpg
  20. BIN
      examples/screenshots/webgl_loader_amf.jpg
  21. BIN
      examples/screenshots/webgl_loader_gcode.jpg
  22. BIN
      examples/screenshots/webgl_loader_gltf_dispersion.jpg
  23. BIN
      examples/screenshots/webgl_loader_gltf_transmission.jpg
  24. BIN
      examples/screenshots/webgl_loader_ifc.jpg
  25. BIN
      examples/screenshots/webgl_loader_kmz.jpg
  26. BIN
      examples/screenshots/webgl_loader_pcd.jpg
  27. BIN
      examples/screenshots/webgl_loader_texture_ktx.jpg
  28. BIN
      examples/screenshots/webgl_materials_alphahash.jpg
  29. BIN
      examples/screenshots/webgl_materials_cubemap_render_to_mipmaps.jpg
  30. BIN
      examples/screenshots/webgl_materials_texture_anisotropy.jpg
  31. BIN
      examples/screenshots/webgl_materials_texture_filters.jpg
  32. BIN
      examples/screenshots/webgl_materials_wireframe.jpg
  33. BIN
      examples/screenshots/webgl_multiple_views.jpg
  34. BIN
      examples/screenshots/webgl_multisampled_renderbuffers.jpg
  35. BIN
      examples/screenshots/webgl_points_dynamic.jpg
  36. BIN
      examples/screenshots/webgl_postprocessing_pixel.jpg
  37. BIN
      examples/screenshots/webgl_postprocessing_procedural.jpg
  38. BIN
      examples/screenshots/webgl_reversed_depth_buffer.jpg
  39. BIN
      examples/screenshots/webgl_volume_instancing.jpg
  40. BIN
      examples/screenshots/webgpu_camera.jpg
  41. BIN
      examples/screenshots/webgpu_camera_logarithmicdepthbuffer.jpg
  42. BIN
      examples/screenshots/webgpu_compute_audio.jpg
  43. BIN
      examples/screenshots/webgpu_compute_birds.jpg
  44. BIN
      examples/screenshots/webgpu_compute_particles.jpg
  45. BIN
      examples/screenshots/webgpu_compute_reduce.jpg
  46. BIN
      examples/screenshots/webgpu_compute_sort_bitonic.jpg
  47. BIN
      examples/screenshots/webgpu_compute_texture_3d.jpg
  48. BIN
      examples/screenshots/webgpu_compute_texture_pingpong.jpg
  49. BIN
      examples/screenshots/webgpu_compute_water.jpg
  50. BIN
      examples/screenshots/webgpu_hdr.jpg
  51. BIN
      examples/screenshots/webgpu_lights_custom.jpg
  52. BIN
      examples/screenshots/webgpu_lights_pointlights.jpg
  53. BIN
      examples/screenshots/webgpu_lights_tiled.jpg
  54. BIN
      examples/screenshots/webgpu_lines_fat_raycasting.jpg
  55. BIN
      examples/screenshots/webgpu_materials.jpg
  56. BIN
      examples/screenshots/webgpu_mesh_batch.jpg
  57. BIN
      examples/screenshots/webgpu_multiple_canvas.jpg
  58. BIN
      examples/screenshots/webgpu_multisampled_renderbuffers.jpg
  59. BIN
      examples/screenshots/webgpu_particles.jpg
  60. BIN
      examples/screenshots/webgpu_postprocessing_afterimage.jpg
  61. BIN
      examples/screenshots/webgpu_reflection_blurred.jpg
  62. BIN
      examples/screenshots/webgpu_reversed_depth_buffer.jpg
  63. BIN
      examples/screenshots/webgpu_storage_buffer.jpg
  64. BIN
      examples/screenshots/webgpu_struct_drawindirect.jpg
  65. BIN
      examples/screenshots/webgpu_tsl_compute_attractors_particles.jpg
  66. BIN
      examples/screenshots/webgpu_tsl_editor.jpg
  67. BIN
      examples/screenshots/webgpu_tsl_interoperability.jpg
  68. BIN
      examples/screenshots/webgpu_upscaling_fsr1.jpg
  69. BIN
      examples/screenshots/webgpu_upscaling_taau.jpg
  70. BIN
      examples/screenshots/webgpu_xr_cubes.jpg
  71. BIN
      examples/screenshots/webgpu_xr_native_layers.jpg
  72. BIN
      examples/screenshots/webxr_vr_teleport.jpg
  73. BIN
      examples/screenshots/webxr_xr_cubes.jpg
  74. BIN
      examples/screenshots/webxr_xr_dragging.jpg
  75. BIN
      examples/screenshots/webxr_xr_dragging_custom_depth.jpg
  76. 1 1
      package.json
  77. 53 45
      test/e2e/puppeteer.js

+ 5 - 1
.github/workflows/ci.yml

@@ -56,13 +56,17 @@ jobs:
         with:
           node-version: 24
           cache: 'npm'
+      - name: Install Vulkan drivers and xvfb
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y mesa-vulkan-drivers xvfb
       - name: Install dependencies
         run: npm ci
       - name: Build
         run: npm run build-module
 
       - name: === E2E testing ===
-        run: npm run test-e2e
+        run: xvfb-run -a npm run test-e2e
       - name: Upload output screenshots
         uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
         if: always()

BIN
examples/screenshots/misc_exporter_gltf.jpg


BIN
examples/screenshots/webaudio_orientation.jpg


BIN
examples/screenshots/webaudio_visualizer.jpg


BIN
examples/screenshots/webgl_animation_skinning_morph.jpg


BIN
examples/screenshots/webgl_buffergeometry_custom_attributes_particles.jpg


BIN
examples/screenshots/webgl_buffergeometry_instancing_billboards.jpg


BIN
examples/screenshots/webgl_buffergeometry_points.jpg


BIN
examples/screenshots/webgl_buffergeometry_points_interleaved.jpg


BIN
examples/screenshots/webgl_camera_logarithmicdepthbuffer.jpg


BIN
examples/screenshots/webgl_custom_attributes_points.jpg


BIN
examples/screenshots/webgl_geometry_colors.jpg


BIN
examples/screenshots/webgl_gpgpu_protoplanet.jpg


BIN
examples/screenshots/webgl_helpers.jpg


BIN
examples/screenshots/webgl_instancing_morph.jpg


BIN
examples/screenshots/webgl_interactive_points.jpg


BIN
examples/screenshots/webgl_lights_spotlights.jpg


BIN
examples/screenshots/webgl_lines_dashed.jpg


BIN
examples/screenshots/webgl_loader_3dm.jpg


BIN
examples/screenshots/webgl_loader_amf.jpg


BIN
examples/screenshots/webgl_loader_gcode.jpg


BIN
examples/screenshots/webgl_loader_gltf_dispersion.jpg


BIN
examples/screenshots/webgl_loader_gltf_transmission.jpg


BIN
examples/screenshots/webgl_loader_ifc.jpg


BIN
examples/screenshots/webgl_loader_kmz.jpg


BIN
examples/screenshots/webgl_loader_pcd.jpg


BIN
examples/screenshots/webgl_loader_texture_ktx.jpg


BIN
examples/screenshots/webgl_materials_alphahash.jpg


BIN
examples/screenshots/webgl_materials_cubemap_render_to_mipmaps.jpg


BIN
examples/screenshots/webgl_materials_texture_anisotropy.jpg


BIN
examples/screenshots/webgl_materials_texture_filters.jpg


BIN
examples/screenshots/webgl_materials_wireframe.jpg


BIN
examples/screenshots/webgl_multiple_views.jpg


BIN
examples/screenshots/webgl_multisampled_renderbuffers.jpg


BIN
examples/screenshots/webgl_points_dynamic.jpg


BIN
examples/screenshots/webgl_postprocessing_pixel.jpg


BIN
examples/screenshots/webgl_postprocessing_procedural.jpg


BIN
examples/screenshots/webgl_reversed_depth_buffer.jpg


BIN
examples/screenshots/webgl_volume_instancing.jpg


BIN
examples/screenshots/webgpu_camera.jpg


BIN
examples/screenshots/webgpu_camera_logarithmicdepthbuffer.jpg


BIN
examples/screenshots/webgpu_compute_audio.jpg


BIN
examples/screenshots/webgpu_compute_birds.jpg


BIN
examples/screenshots/webgpu_compute_particles.jpg


BIN
examples/screenshots/webgpu_compute_reduce.jpg


BIN
examples/screenshots/webgpu_compute_sort_bitonic.jpg


BIN
examples/screenshots/webgpu_compute_texture_3d.jpg


BIN
examples/screenshots/webgpu_compute_texture_pingpong.jpg


BIN
examples/screenshots/webgpu_compute_water.jpg


BIN
examples/screenshots/webgpu_hdr.jpg


BIN
examples/screenshots/webgpu_lights_custom.jpg


BIN
examples/screenshots/webgpu_lights_pointlights.jpg


BIN
examples/screenshots/webgpu_lights_tiled.jpg


BIN
examples/screenshots/webgpu_lines_fat_raycasting.jpg


BIN
examples/screenshots/webgpu_materials.jpg


BIN
examples/screenshots/webgpu_mesh_batch.jpg


BIN
examples/screenshots/webgpu_multiple_canvas.jpg


BIN
examples/screenshots/webgpu_multisampled_renderbuffers.jpg


BIN
examples/screenshots/webgpu_particles.jpg


BIN
examples/screenshots/webgpu_postprocessing_afterimage.jpg


BIN
examples/screenshots/webgpu_reflection_blurred.jpg


BIN
examples/screenshots/webgpu_reversed_depth_buffer.jpg


BIN
examples/screenshots/webgpu_storage_buffer.jpg


BIN
examples/screenshots/webgpu_struct_drawindirect.jpg


BIN
examples/screenshots/webgpu_tsl_compute_attractors_particles.jpg


BIN
examples/screenshots/webgpu_tsl_editor.jpg


BIN
examples/screenshots/webgpu_tsl_interoperability.jpg


BIN
examples/screenshots/webgpu_upscaling_fsr1.jpg


BIN
examples/screenshots/webgpu_upscaling_taau.jpg


BIN
examples/screenshots/webgpu_xr_cubes.jpg


BIN
examples/screenshots/webgpu_xr_native_layers.jpg


BIN
examples/screenshots/webxr_vr_teleport.jpg


BIN
examples/screenshots/webxr_xr_cubes.jpg


BIN
examples/screenshots/webxr_xr_dragging.jpg


BIN
examples/screenshots/webxr_xr_dragging_custom_depth.jpg


+ 1 - 1
package.json

@@ -104,7 +104,7 @@
     "jsdoc": "^4.0.5",
     "magic-string": "^0.30.0",
     "pngjs": "^7.0.0",
-    "puppeteer": "^24.25.0",
+    "puppeteer": "^24.40.0",
     "qunit": "^2.19.4",
     "rollup": "^4.6.0",
     "turndown": "^7.2.2"

+ 53 - 45
test/e2e/puppeteer.js

@@ -20,6 +20,7 @@ const exceptionList = [
 	// Needs investigation
 	'physics_rapier_instancing',
 	'physics_jolt_instancing',
+	'webaudio_visualizer',
 	'webgl_shadowmap',
 	'webgl_postprocessing_dof2',
 	'webgl_postprocessing_glitch',
@@ -56,35 +57,7 @@ const exceptionList = [
 
 	// Webcam
 	'webgl_materials_video_webcam',
-	'webgl_morphtargets_webcam',
-
-	// WebGL device lost
-	'webgpu_materialx_noise',
-	'webgpu_portal',
-	'webgpu_shadowmap',
-
-	// WebGPU needed
-	'webgpu_compile_async',
-	'webgpu_compute_audio',
-	'webgpu_compute_birds',
-	'webgpu_compute_cloth',
-	'webgpu_compute_particles_fluid',
-	'webgpu_compute_reduce',
-	'webgpu_compute_sort_bitonic',
-	'webgpu_compute_texture',
-	'webgpu_compute_texture_3d',
-	'webgpu_compute_texture_pingpong',
-	'webgpu_compute_water',
-	'webgpu_hdr',
-	'webgpu_lights_tiled',
-	'webgpu_materials',
-	'webgpu_multiple_canvas',
-	'webgpu_particles',
-	'webgpu_struct_drawindirect',
-	'webgpu_tsl_editor',
-	'webgpu_tsl_interoperability',
-	'webgpu_tsl_vfx_linkedparticles',
-	'webgpu_tsl_wood'
+	'webgl_morphtargets_webcam'
 
 ];
 
@@ -99,7 +72,6 @@ const parseTime = 1; // 1 second per megabyte
 
 const networkTimeout = 5; // 5 minutes, set to 0 to disable
 const renderTimeout = 5; // 5 seconds, set to 0 to disable
-const numAttempts = 2; // perform 2 attempts before failing
 const numCIJobs = 5; // GitHub Actions run the script in 5 threads
 
 const width = 400;
@@ -216,25 +188,32 @@ async function main() {
 
 	const flags = [
 		'--hide-scrollbars',
-		'--use-angle=swiftshader',
-		'--enable-unsafe-swiftshader',
+		'--enable-unsafe-webgpu',
+		'--enable-features=Vulkan',
+		'--disable-vulkan-surface',
+		'--ignore-gpu-blocklist',
+		'--disable-gpu-driver-bug-workarounds',
 		'--no-sandbox'
 	];
 
 	const viewport = { width: width * viewScale, height: height * viewScale };
 
-	browser = await puppeteer.launch( {
-		headless: process.env.VISIBLE ? false : 'new',
+	const launchOptions = {
+		headless: ( 'CI' in process.env || process.env.VISIBLE ) ? false : 'new',
+		env: { ...process.env, VK_DRIVER_FILES: '/usr/share/vulkan/icd.d/lvp_icd.x86_64.json' },
 		args: flags,
 		defaultViewport: viewport,
 		handleSIGINT: false,
 		protocolTimeout: 0,
 		userDataDir: './.puppeteer_profile'
-	} );
+	};
 
 	/* Prepare injections */
 
-	const buildInjection = ( code ) => code.replace( /Math\.random\(\) \* 0xffffffff/g, 'Math._random() * 0xffffffff' );
+	const buildInjection = ( code ) => code
+		.replace( /Math\.random\(\) \* 0xffffffff/g, 'Math._random() * 0xffffffff' )
+		// Disables WebGPU timestamp queries to prevent Inspector/Profiler from crashing in E2E software mode
+		.replace( /this\.trackTimestamp\s*=\s*\(\s*parameters\.trackTimestamp\s*===\s*true\s*\);/g, "Object.defineProperty(this, 'trackTimestamp', { get: () => false, set: () => {} });" );
 
 	const cleanPage = await fs.readFile( 'test/e2e/clean-page.js', 'utf8' );
 	const injection = await fs.readFile( 'test/e2e/deterministic-injection.js', 'utf8' );
@@ -249,8 +228,33 @@ async function main() {
 
 	const errorMessagesCache = [];
 
-	const page = await browser.newPage();
-	await preparePage( page, injection, builds, errorMessagesCache );
+	const launchPage = async () => {
+
+		browser = await puppeteer.launch( launchOptions );
+		const page = await browser.newPage();
+		await preparePage( page, injection, builds, errorMessagesCache );
+		return page;
+
+	};
+
+	const ctx = {
+		page: await launchPage(),
+		async restart() {
+
+			// SIGKILL the whole Chrome process tree; browser.close() can hang after a wedged GPU process
+			const proc = browser.process();
+			if ( proc ) {
+
+				proc.kill( 'SIGKILL' );
+				await new Promise( resolve => proc.once( 'exit', resolve ) );
+
+			}
+
+			errorMessagesCache.length = 0;
+			ctx.page = await launchPage();
+
+		}
+	};
 
 	/* Loop for each file */
 
@@ -258,7 +262,7 @@ async function main() {
 
 	for ( const file of files ) {
 
-		await makeAttempt( page, failedScreenshots, cleanPage, isMakeScreenshot, file );
+		await checkFile( ctx, failedScreenshots, cleanPage, isMakeScreenshot, file );
 
 	}
 
@@ -330,6 +334,7 @@ async function preparePage( page, injection, builds, errorMessages ) {
 
 		text = text.trim();
 		if ( text === '' ) return;
+		if ( text.includes( 'Timestamp tracking is disabled' ) ) return;
 
 		text = file + ': ' + text.replace( /\[\.WebGL-(.+?)\] /g, '' );
 
@@ -403,7 +408,9 @@ async function preparePage( page, injection, builds, errorMessages ) {
 
 }
 
-async function makeAttempt( page, failedScreenshots, cleanPage, isMakeScreenshot, file, attemptID = 0 ) {
+async function checkFile( ctx, failedScreenshots, cleanPage, isMakeScreenshot, file ) {
+
+	const page = ctx.page;
 
 	try {
 
@@ -552,15 +559,16 @@ async function makeAttempt( page, failedScreenshots, cleanPage, isMakeScreenshot
 
 	} catch ( e ) {
 
-		if ( attemptID === numAttempts - 1 ) {
+		if ( String( e ).includes( 'WebGPU Device Lost' ) ) {
 
-			console.red( e );
-			failedScreenshots.push( file );
+			console.yellow( `${ e }` );
+			console.yellow( 'Restarting browser due to WebGPU Device Lost...' );
+			await ctx.restart();
 
 		} else {
 
-			console.yellow( `${ e }, another attempt...` );
-			await makeAttempt( page, failedScreenshots, cleanPage, isMakeScreenshot, file, attemptID + 1 );
+			console.red( e );
+			failedScreenshots.push( file );
 
 		}
 

粤ICP备19079148号