Skip to content

Commit

Permalink
WebGPURenderer: Rename .getRawShaderAsync() to .getShaderAsync() (#1158)
Browse files Browse the repository at this point in the history
* Update three.js

* Add src

* Update patch and delete src

* Update declarations

* Add examples

* stats-gl no longer used

* Update

* Update patch and delete examples
  • Loading branch information
Methuselah96 authored Aug 21, 2024
1 parent 3c5879b commit 44f1c43
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 42 deletions.
15 changes: 3 additions & 12 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14156,14 +14156,14 @@ index bd84aba0..f9d188c3 100644
}

diff --git a/examples-testing/examples/webgpu_mesh_batch.ts b/examples-testing/examples/webgpu_mesh_batch.ts
index 1d8b2375..1b733151 100644
index a619f430..46473e46 100644
--- a/examples-testing/examples/webgpu_mesh_batch.ts
+++ b/examples-testing/examples/webgpu_mesh_batch.ts
@@ -1,17 +1,17 @@
-import * as THREE from 'three';
+import * as THREE from 'three/webgpu';

import Stats from 'stats-gl';
import Stats from 'three/addons/libs/stats.module.js';

import { GUI } from 'three/addons/libs/lil-gui.module.min.js';

Expand Down Expand Up @@ -14211,16 +14211,7 @@ index 1d8b2375..1b733151 100644

if (mesh.dispose) {
mesh.dispose();
@@ -137,7 +137,7 @@ function init(forceWebGL = false) {
document.body.removeChild(renderer.domElement);
}

- document.getElementById('backend').innerText = 'Active Backend: ' + (forceWebGL ? 'WebGL' : 'WebGPU');
+ document.getElementById('backend')!.innerText = 'Active Backend: ' + (forceWebGL ? 'WebGL' : 'WebGPU');
// camera

const aspect = window.innerWidth / window.innerHeight;
@@ -256,18 +256,26 @@ function init(forceWebGL = false) {
@@ -250,18 +250,26 @@ function init(forceWebGL = false) {

//

Expand Down
2 changes: 2 additions & 0 deletions examples-testing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ const exceptionList = [
'webgpu_texturegrad',
'webgpu_textures_2d-array',
'webgpu_tsl_compute_attractors_particles',
'webgpu_tsl_earth',
'webgpu_tsl_editor',
'webgpu_tsl_galaxy',
'webgpu_tsl_halftone',
'webgpu_tsl_interoperability',
'webgpu_tsl_procedural_terrain',
'webgpu_tsl_raging_sea',
'webgpu_tsl_transpiler',
'webgpu_volume_cloud',
Expand Down
3 changes: 0 additions & 3 deletions examples-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
"@types/three": "file:../types/three",
"prettier": "^3.3.3",
"typescript": "latest"
},
"devDependencies": {
"stats-gl": "2.2.8"
}
}
22 changes: 0 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4920,7 +4920,7 @@ index 0ec34b04..573cae2b 100644

this.vertexProgram = vertexProgram;
diff --git a/src-testing/src/renderers/common/Renderer.ts b/src-testing/src/renderers/common/Renderer.ts
index 5beb82a6..0a9ee71b 100644
index be803038..d09b36df 100644
--- a/src-testing/src/renderers/common/Renderer.ts
+++ b/src-testing/src/renderers/common/Renderer.ts
@@ -15,7 +15,7 @@ import ClippingContext from './ClippingContext.js';
Expand Down Expand Up @@ -5106,7 +5106,7 @@ index 5beb82a6..0a9ee71b 100644
+ glFragmentShader: WebGLShader,
+ ) => void)
+ | null;
+ getRawShaderAsync: (
+ getShaderAsync: (
+ scene: Scene,
+ camera: Camera,
+ object: Object3D,
Expand All @@ -5120,7 +5120,7 @@ index 5beb82a6..0a9ee71b 100644

//
@@ -156,12 +325,12 @@ class Renderer {
getRawShaderAsync: async (scene, camera, object) => {
getShaderAsync: async (scene, camera, object) => {
await this.compileAsync(scene, camera);

- const renderList = this._renderLists.get(scene, camera);
Expand Down
2 changes: 1 addition & 1 deletion types/three/src/renderers/common/Renderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ declare class Renderer {
glFragmentShader: WebGLShader,
) => void)
| null;
getRawShaderAsync: (scene: Scene, camera: Camera, object: Object3D) => Promise<{
getShaderAsync: (scene: Scene, camera: Camera, object: Object3D) => Promise<{
fragmentShader: string | null;
vertexShader: string | null;
}>;
Expand Down

0 comments on commit 44f1c43

Please sign in to comment.