Prechádzať zdrojové kódy

WebGPURenderer: handle instanced geometries in WebGL backend (#26731)

* handle instanced geometries
handle interleaved buffers and deduplicate
add clear() for frame buffer

* remove redundant code

* adjust support message

* support InstancedMesh and updateAttribute()

* remove version inc

* Squashed commit of the following:

commit 181e04eea8b569dc09048f9dc644310ed6b745a6
Author: Mr.doob <[email protected]>
Date:   Fri Sep 29 00:10:20 2023 +0900

    r157

commit cabaf2146cb905e9b2270f88a926042cf4d57a96
Author: Mr.doob <[email protected]>
Date:   Fri Sep 29 00:08:47 2023 +0900

    Updated builds.

commit 1c85c953f49d154997e43d73b3ce3847d723d0a5
Author: Mr.doob <[email protected]>
Date:   Thu Sep 28 23:41:31 2023 +0900

    Improved USDZLoader example.

commit d6c8dd0b50a2994c05f94687ed0dfa44ae61ee4c
Author: Mr.doob <[email protected]>
Date:   Thu Sep 28 22:53:05 2023 +0900

    Improved compute texture examples.

commit f8863302d7200f02b50dbd3d0014ede46f134e37
Author: GitHubDragonFly <[email protected]>
Date:   Thu Sep 28 03:23:34 2023 -0400

    USDZ Loader - texture scale + offset + rotation (#26861)

commit cb644716ad5481738884a55c290c3075a3a7be70
Author: Levi Pesin <[email protected]>
Date:   Thu Sep 28 04:55:58 2023 +0930

    Nodes: Fix `addLightNode` in case of anonymizing classes (#26858)

    * Fix `addLightNode` in case of anonymizing classes

    * Address comment

    * Update AmbientLightNode.js

    * Update DirectionalLightNode.js

    * Update HemisphereLightNode.js

    * Update IESSpotLightNode.js

    * Update PointLightNode.js

    * Update SpotLightNode.js

    * Fix

commit 688b7499dba1f5a440cb405583124b40ff00c57b
Author: sunag <[email protected]>
Date:   Wed Sep 27 13:42:29 2023 -0300

    WebGLNodeBuilder: Fix Multi-Material (#26841)

commit bf7a89e3c7faef0bfd2a607deee5a8a245f35058
Author: mrdoob <[email protected]>
Date:   Wed Sep 27 20:33:38 2023 +0900

    Fixed DeepScan issue.

commit 285c9b68cc69b73833aed0e8771839ef1d6e1f3a
Author: YX <[email protected]>
Date:   Wed Sep 27 16:32:50 2023 +0800

    Update SpriteMaterial.html (#26855)

    Fixed incorrect Chinese translation.

commit 5c004571e91dbe20013bdd547cb9b14e363bf245
Author: 郭斌勇 <[email protected]>
Date:   Wed Sep 27 16:26:37 2023 +0800

    CurvePath: Use correct line type in `closePath()`. (#26850)

    * fix #26849

    * Update CurvePath.js

    ---------

    Co-authored-by: Michael Herzog <[email protected]>

commit 083be57d18474b38d610b4f5ea4b591b7846169b
Author: Shuhei Aoyama <[email protected]>
Date:   Wed Sep 27 15:53:03 2023 +0900

    GLTFLoader: Fix to handle reject on afterRoot (#26852)

commit 2d1695ed65e39c293223a7651f78f24de265feb7
Author: Levi Pesin <[email protected]>
Date:   Wed Sep 27 04:57:29 2023 +0930

    Nodes: Fix `addNodeClass` and `addNodeMaterial` in case of renaming classes (#26846)

commit 6a5d6de348e8b3a252e8bd585853558be97371f2
Author: sunag <[email protected]>
Date:   Tue Sep 26 16:13:03 2023 -0300

    StorageTexture: Adds support for other formats. (#26842)

    * TimeNode: Define `frameId` as integer

    * Renderer: Set `info` as public

    * StorageTexture: Adds support for other formats.

    * Update example to `temporal blur`

    * fix device in getFormat()

commit 9fe5ed2d71467efe9de0d5ca2a76e1b90e60147b
Author: sunag <[email protected]>
Date:   Tue Sep 26 16:10:10 2023 -0300

    TSL: Fix include one function under another. (#26844)

    * TSL: Fix include one function under another.

    * Add include example

commit ca5c7cb037060c240d9a9e10f6bd41eb87224268
Author: sunag <[email protected]>
Date:   Tue Sep 26 16:09:42 2023 -0300

    Examples: Rename some WebGPU Compute examples (#26845)

    * webgpu_compute -> webgpu_compute_points

    * webgpu_audio_processing -> webgpu_compute_audio

commit 379038f6d42a8f5a3b85abea10b32e2c7613b143
Author: sunag <[email protected]>
Date:   Tue Sep 26 01:27:04 2023 -0300

    WebGPURenderer: Fix .flipY example

commit 2ccc5bc90fbddbd50ed840a834977c58c44b944e
Author: sunag <[email protected]>
Date:   Mon Sep 25 23:54:10 2023 -0300

    Nodes: Rename `construct()` to `setup()` (#26840)

    * Nodes: Rename `construct()` to `setup()`

    * deprecated alert

commit e2f59117296b54357719731742c4b118d135732e
Author: sunag <[email protected]>
Date:   Mon Sep 25 23:45:33 2023 -0300

    WebGPURenderer: GPU FlipY (#26818)

    * GPU FlipY

    * use tempTexture.destroy()

    * fix name

    * Rename to `WebGPUTexturePassUtils` and `_getPassUtils()`

commit 0f65abbd6ae765d6c1108ada32b907831e025c2c
Author: sunag <[email protected]>
Date:   Mon Sep 25 22:51:02 2023 -0300

    TextureNode: Rename `.getTextureMatrix()` -> `.getTransformedUV()` (#26839)

commit 8d241a699eb801bbdd4d2d6561c83fd49a1ea70f
Author: Marco Fugaro <[email protected]>
Date:   Tue Sep 26 02:51:33 2023 +0200

    Examples: Remove import maps polyfill (#26836)

commit 1a67ba7b84ac2b3bf7dd24a1695d43fbd134d824
Author: sunag <[email protected]>
Date:   Mon Sep 25 18:25:00 2023 -0300

    RenderNodes: Fix `context.material` reference. (#26838)

commit 15e4656ca9f3a98eb1dbf483ae7dc4c267793762
Author: Sachin S <[email protected]>
Date:   Mon Sep 25 04:39:03 2023 -0400

    DragControls: Add `recursive` property.  (#26747)

    * add recursive property to DragControls

    * Update DragControls.js

    Clean up.

    ---------

    Co-authored-by: Michael Herzog <[email protected]>

commit 43d68fcd951df0977f94ad5613aeebb20547c79d
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon Sep 25 10:38:50 2023 +0200

    Update github/codeql-action digest to 6a28655 (#26833)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 10e88230b62e656763b2d746938c76082d599e9b
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon Sep 25 10:38:42 2023 +0200

    Update actions/checkout digest to 8ade135 (#26832)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit e857553f2a8002f0e9cf6076d3bdc39dd525dbbc
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon Sep 25 00:14:05 2023 +0000

    Update devDependencies (non-major) (#26834)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 53c642e6905a1e53b0dd1c37ce14ec46f8b8fdc2
Author: Michael Herzog <[email protected]>
Date:   Sun Sep 24 11:28:27 2023 +0200

    Docs: Clean up. (#26831)

commit 53ee3779eea24050c1b17a8413f50fc96580c754
Author: Guilherme Avila <[email protected]>
Date:   Sun Sep 24 06:22:08 2023 -0300

    EXRExporter: implements support for DataTexture export (#26810)

    * EXRExporter: DataTexture support

    Signed-off-by: Guilherme Avila <[email protected]>

    * EXRExporter: update API & docs

    Signed-off-by: Guilherme Avila <[email protected]>

    * Examples: add misc_exporter_exr

    Signed-off-by: Guilherme Avila <[email protected]>

    * fix MIME-type

    Signed-off-by: Guilherme Avila <[email protected]>

    * update DataTexture usage example

    Signed-off-by: Guilherme Avila <[email protected]>

    * update screenshot

    Signed-off-by: Guilherme Avila <[email protected]>

    ---------

    Signed-off-by: Guilherme Avila <[email protected]>

commit c3a746ac60cfa5401aea85fdfb814e46c146f65e
Author: Isaac Mason <[email protected]>
Date:   Sun Sep 24 18:30:05 2023 +1000

    docs: add recast-navigation-js to libraries and plugins page (#26828)

commit 89e698f56604741244a2f7746edc0d876cec83ed
Author: Mugen87 <[email protected]>
Date:   Sat Sep 23 19:39:04 2023 +0200

    Updated builds.

commit 27f0400ec248c91ae83b81a6220fd02ed5e6bcb9
Author: 林炳权 <[email protected]>
Date:   Sun Sep 24 01:32:21 2023 +0800

    RenderTarget: Clean up. (#26775)

    * RenderTarget: Clean up.

    * use `Object.assign()`

    * remove duplicate code

commit 72d0d3c3abdf521788180f6b17a026c9d8e84c02
Author: Joe Pea <[email protected]>
Date:   Sat Sep 23 10:29:01 2023 -0700

    Update Libraries-and-Plugins.html (#26819)

    * Update Libraries-and-Plugins.html

    Add Lume, add a few descriptions, and separate open source wrappers/frameworks from closed source wrappers/frameworks.

    * Update Libraries-and-Plugins.html

    * Update Libraries-and-Plugins.html

commit 9d2d7ebc7891729e1ec90f0004237b4fe803c722
Author: sunag <[email protected]>
Date:   Sat Sep 23 01:16:29 2023 -0300

    TSL: Introduce ShaderCallNode & `tslFn` improvements (#26824)

    * Add ShaderCallNode

    * cleanup

    * Use tslFn as default

commit 45505ed0ac655eefa2007b0932e48649fbefb48f
Author: sunag <[email protected]>
Date:   Fri Sep 22 16:58:55 2023 -0300

    TSL: SetNode (#26785)

    * Add SetNode

    * Use viewProj.setZ()

    * cleanup

commit aa7bec9ab94845baf108e3f29faac47ac6bd7a12
Author: aardgoose <[email protected]>
Date:   Fri Sep 22 20:47:46 2023 +0100

    Nodes: consume labels() when used, to prevent duplicate uniform names. (#26822)

    Co-authored-by: aardgoose <[email protected]>

commit 5bab962c5b76d3af530845d308bf5ec98a1a0cbf
Author: aardgoose <[email protected]>
Date:   Fri Sep 22 17:38:55 2023 +0100

    WebGPURenderer: Support textureCompare() operations in WebGL backend (#26823)

    Co-authored-by: aardgoose <[email protected]>

commit ac901f1bbc0fabf89d0a6692b75fa5182c820c48
Author: Mugen87 <[email protected]>
Date:   Fri Sep 22 12:31:27 2023 +0200

    Updated builds.

commit 2ac424c3eaaa014424bed5bc78b56980935af811
Author: aardgoose <[email protected]>
Date:   Fri Sep 22 05:40:45 2023 +0100

    WebGPURenderer: Support multiple render targets (#26808)

    * less var access (#26817)

    actually use the framebuffer we have cached

    update examples

    update screenshots

    MRT

    allow example to run

    fix WGSL code

    address comments

    update screenshot

    * remove unused var

    * cleanup

    ---------

    Co-authored-by: ycw <[email protected]>
    Co-authored-by: aardgoose <[email protected]>
    Co-authored-by: sunag <[email protected]>

commit 309e5f6f64c7af9087e0fb6f7cbf83a9fd2a4fef
Author: ycw <[email protected]>
Date:   Thu Sep 21 20:35:27 2023 +0800

    less var access (#26817)

commit c1bf227cf504b700c0b3e24e740bb76dec1cc276
Author: ycw <[email protected]>
Date:   Thu Sep 21 16:14:29 2023 +0800

    AnimationUtils: Remove `arraySlice()`. (#26756)

    * use default

    * exclusive

    * rm arraySlice

    * rm test, rm docs

commit ef417f0dec53be8a7671ee0885f989379d4ab07d
Author: aardgoose <[email protected]>
Date:   Wed Sep 20 17:33:28 2023 +0100

    WebGPURenderer: Basic render to texture support for WebGL backend (#26801)

    * Support texture backed render targets

    * actually use the framebuffer we have cached

    * update examples

    * update screenshots

    ---------

    Co-authored-by: aardgoose <[email protected]>

commit bc69abbf141620610007ae789c1751e9a52ea565
Author: Mugen87 <[email protected]>
Date:   Wed Sep 20 15:56:06 2023 +0200

    Updated builds.

commit 7bf83b8b1716666958f5dd24dc49ad73111c5839
Author: Michael Herzog <[email protected]>
Date:   Wed Sep 20 15:55:19 2023 +0200

    Shaders: Remove struct GeometricContext to improve Adreno GPU support. (#26805)

commit 32cf0d18778ba1ba01e1d4441c822a3661ecac7f
Author: ycw <[email protected]>
Date:   Wed Sep 20 17:22:22 2023 +0800

    cleanup (#26803)

commit 85f9f2807751226c45b04186166ac23103d354ea
Author: sunag <[email protected]>
Date:   Tue Sep 19 18:25:56 2023 -0300

    WebGPURenderer: CCW FrontFace as default (#26807)

commit cf340b9936c773a239ef5186ac112bf2459db22c
Author: sunag <[email protected]>
Date:   Tue Sep 19 18:25:25 2023 -0300

    TSL: Fix `.negate()` (#26804)

    * Fix dFdy().negate()

    * Fix .negate()

commit 1e673dbaa2cf21370dcfc36e72a3414d65235190
Author: sunag <[email protected]>
Date:   Mon Sep 18 16:39:52 2023 -0300

    Updated screenshot of the `webgpu_lights_ies_spotlight` (#26800)

commit 75b9699196f46153bd371de52380d0829dd67beb
Author: Tim Weißenfels <[email protected]>
Date:   Mon Sep 18 20:01:06 2023 +0200

    Update documentation of Object3D#userData (#26799)

    * Update userData description in Object3D.html

    Updated the documentation to make clear what the default value is (otherwise one could assume it might be null or undefined).

    * Update Texture.html

    * Update Material.html

    * Update BufferGeometry.html

commit 0b0a7d75ad84f22a06fc7f35931190cb461cdec1
Author: StrandedKitty <[email protected]>
Date:   Mon Sep 18 19:45:10 2023 +0200

    Use cameraPosition uniform instead of world origin (#26766)

commit 217e20e4bc9134e96ec309d609e57683b8132807
Author: Mugen87 <[email protected]>
Date:   Mon Sep 18 19:43:42 2023 +0200

    Updated builds.

commit 1454e7afc0870fc165ac26456063a683b1e4227a
Author: ycw <[email protected]>
Date:   Tue Sep 19 01:42:56 2023 +0800

    ObjectLoader: Refector (de)serialization of Fog and FogExp2 (#26793)

    * marshal fog/fogexp2 .name

    * use object literal

commit 1a7b805118fd98087fe04d50d871cde7c395a2c2
Author: ycw <[email protected]>
Date:   Tue Sep 19 01:41:38 2023 +0800

    re order (#26780)

commit f4488d8b2318acd9bf8a9b644a28a2ca051d65b1
Author: Michael Herzog <[email protected]>
Date:   Mon Sep 18 19:41:00 2023 +0200

    LightProbeGenerator: Add support for half float render targets. (#26773)

commit e74c65530124b9f799764c6266658c363a7fc870
Author: aardgoose <[email protected]>
Date:   Mon Sep 18 18:21:40 2023 +0100

    WebGPURenderer: Texture fixes for WebGL backend (#26797)

    * misc texture fixes

    handle VideoTexture.
    handle depth textures in GLSL shaders (depth in x component in returned
    vec4())
    map WGSL textureDimensions to GLSL textureSize()

    Examples fixed

    lights / ies /spotlights
    video / panorama
    material / video (partial)

    * remove surplus entry

    ---------

    Co-authored-by: aardgoose <[email protected]>

commit 18febaf04258cdd506c76d84497c1d5a9f053ccb
Author: sunag <[email protected]>
Date:   Mon Sep 18 07:13:40 2023 -0300

    WebGPURenderer, CubeCamera: Add `.activeMipmapLevel` (#26770)

    * CubeCamera: Add .activeMipmapLevel

    * Use CubeCamera

    * WebGPURenderer:  Add .activeMipmapLevel for set .setRenderTarget()

commit 16eaae53b325a5ad583103403262ab631b6f9189
Author: ycw <[email protected]>
Date:   Mon Sep 18 16:27:01 2023 +0800

    cleanup (#26791)

commit 633d804475cb7658f5f78ae98785a180b8b9877e
Author: Michael Herzog <[email protected]>
Date:   Mon Sep 18 10:22:45 2023 +0200

    Editor: Fix `CapsuleGeometry` parameter. (#26794)

commit fffeb0c3b1555952afac85475aea1b98bc7ece87
Author: ycw <[email protected]>
Date:   Mon Sep 18 15:32:50 2023 +0800

    fmt code block (#26792)

commit b6150e4d3508f905380e985f39595d761223671b
Author: WestLangley <[email protected]>
Date:   Mon Sep 18 01:56:38 2023 -0400

    Simplify equation (#26787)

commit 93c3589d05f50b78bdae1a02e464e67ce0e85fd2
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Sun Sep 17 22:02:02 2023 +0000

    Update devDependencies (non-major) (#26783)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 4ed78c73cb9f258caaa451cfc0003c861da7861e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Sun Sep 17 20:10:40 2023 +0200

    Update github/codeql-action digest to 04daf01 (#26782)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 2c8cfdfc334f5758ee1facd2d95b75e33cd77b18
Author: sunag <[email protected]>
Date:   Sun Sep 17 00:10:52 2023 -0300

    WebGPURenderer: StorageTexture (#26769)

    * Add StorageTexture

    * add `webgpu_compute_texture_pingpong` example

commit 80ba01ccf5600b0ff5aebe08d31249efbd46b35c
Author: aardgoose <[email protected]>
Date:   Sun Sep 17 03:19:42 2023 +0100

    negate dpdy only (#26776)

    Co-authored-by: aardgoose <[email protected]>

commit 99d705fe8750ecb5deacddd0810cab59f80db0d4
Author: 林炳权 <[email protected]>
Date:   Sun Sep 17 00:52:53 2023 +0800

    Sprite: Clean up. (#26774)

commit c6cfa6a6c1529f4441c7c66cfe453451356e831f
Author: Michael Herzog <[email protected]>
Date:   Sat Sep 16 10:46:13 2023 +0200

    CubeCamera: Add comment to clarify mipmap generation. (#26772)

commit 51462bf669fcc174f3ed04b59ebf82236c082265
Author: Mugen87 <[email protected]>
Date:   Sat Sep 16 09:59:49 2023 +0200

    Updated builds.

commit b17a561c93b9ca9ef35aac6667ccda3f2c110720
Author: Michael Herzog <[email protected]>
Date:   Sat Sep 16 09:58:24 2023 +0200

    WebGLTextures: Increase default precision for depth buffers with WebGL 2. (#26764)

    * WebGLTextures: Increase default precision for depth buffers with WebGL 2.

    * Examples: Update screenshots.

    * Examples: Update screenshots.

    * Add webgl2_multisampled_renderbuffers to exception list.

commit 8193d58b3e8c8c0833c3c69ecfbb651e657043d5
Author: Mugen87 <[email protected]>
Date:   Sat Sep 16 09:54:34 2023 +0200

    Updated builds.

commit 5238faec76282369e71020aa1f46f25b44da897c
Author: Michael Herzog <[email protected]>
Date:   Sat Sep 16 09:53:35 2023 +0200

    WebGLRenderer: Introduce USE_LIGHT_PROBES define. (#26768)

    * WebGLRenderer: Introduce USE_LIGHT_PROBES define.

    * Examples: Make use of USE_LIGHT_PROBES.

    * Add light probe define to vertex shader

    ---------

    Co-authored-by: WestLangley <[email protected]>

commit fbc28ae0c5d51ed9788076de1015b2aa0cb4d712
Author: 林炳权 <[email protected]>
Date:   Fri Sep 15 16:22:16 2023 +0800

    src: Clean up. (#26763)

commit 18ae441f1cf275971bcdcef25be03f6f67965690
Author: Casey Primozic <[email protected]>
Date:   Fri Sep 15 00:55:35 2023 -0700

    Docs: Add some missing options to `MeshPhysicalMaterial` demo. (#26753)

    * Add some missing options to `MeshPhysicalMaterial` demo

     * Add GUI options for some missing properties including sheen, ior, iridescence, and others to the material browser embedded on the docs pages for materials

    * Use real default `sheenColor in material browser

    * Re-disable dirlights in `MeshPhysicalMaterial` material browser

    * Update docs to correct the default `sheenColor`

     * Docs stated it was 0xfffff, but it's actually 0x000000
     * Fixes https://github.com/mrdoob/three.js/issues/26757

    * Add back deleted comment

commit 30164c92f2facdd3a79c005ec2fa48fd99ba7c71
Author: ycw <[email protected]>
Date:   Fri Sep 15 09:58:20 2023 +0800

    Camera: Simplify `getWorldDirection()`. (#26743)

    * refactor getWorldDirection

    * revert object3d

* update screenshot

---------

Co-authored-by: aardgoose <[email protected]>
aardgoose 1 rok pred
rodič
commit
eb54b90234

+ 69 - 12
examples/jsm/renderers/webgl/WebGLBackend.js

@@ -214,9 +214,24 @@ class WebGLBackend extends Backend {
 
 	}
 
-	clear( /*renderContext, color, depth, stencil*/ ) {
+	clear( renderContext, color, depth, stencil ) {
 
-		console.warn( 'Abstract class.' );
+		const { gl } = this;
+
+		//
+
+		let clear = 0;
+
+		if ( color ) clear |= gl.COLOR_BUFFER_BIT;
+		if ( depth ) clear |= gl.DEPTH_BUFFER_BIT;
+		if ( stencil ) clear |= gl.STENCIL_BUFFER_BIT;
+
+		const clearColor = renderContext.clearColorValue;
+
+		if ( clear === 0 ) return;
+
+		gl.clearColor( clearColor.x, clearColor.y, clearColor.z, clearColor.a );
+		gl.clear( clear );
 
 	}
 
@@ -316,21 +331,30 @@ class WebGLBackend extends Backend {
 
 		let mode;
 		if ( object.isPoints ) mode = gl.POINTS;
-		else if ( object.isLine ) mode = gl.LINES;
+		else if ( object.isLine ) mode = gl.LINE_STRIP;
 		else if ( object.isLineLoop ) mode = gl.LINE_LOOP;
 		else if ( object.isLineSegments ) mode = gl.LINES;
 		else mode = gl.TRIANGLES;
 
 		//
 
+		const instanceCount = this.getInstanceCount( renderObject );
 
 		if ( index !== null ) {
 
 			const indexData = this.get( index );
-
 			const indexCount = ( drawRange.count !== Infinity ) ? drawRange.count : index.count;
 
-			gl.drawElements( mode, index.count, indexData.type, firstVertex );
+			if ( instanceCount > 1 ) {
+
+				gl.drawElementsInstanced( mode, index.count, indexData.type, firstVertex, instanceCount );
+
+			} else {
+
+				gl.drawElements( mode, index.count, indexData.type, firstVertex );
+
+			}
+
 
 			info.update( object, indexCount, 1 );
 
@@ -339,8 +363,16 @@ class WebGLBackend extends Backend {
 			const positionAttribute = geometry.attributes.position;
 			const vertexCount = ( drawRange.count !== Infinity ) ? drawRange.count : positionAttribute.count;
 
+			if ( instanceCount > 1 ) {
+
+				gl.drawArraysInstanced( mode, 0, vertexCount, instanceCount );
+
+			} else {
+
+				gl.drawArrays( mode, 0, vertexCount );
+
+			}
 
-			gl.drawArrays( mode, 0, vertexCount );
 			//gl.drawArrays( mode, vertexCount, gl.UNSIGNED_SHORT, firstVertex );
 
 			info.update( object, vertexCount, 1 );
@@ -613,7 +645,7 @@ class WebGLBackend extends Backend {
 		const vaoGPU = gl.createVertexArray();
 
 		const index = renderObject.getIndex();
-		const vertexBuffers = renderObject.getVertexBuffers();
+		const attributes = renderObject.getAttributes();
 
 		gl.bindVertexArray( vaoGPU );
 
@@ -625,14 +657,39 @@ class WebGLBackend extends Backend {
 
 		}
 
-		for ( let i = 0; i < vertexBuffers.length; i ++ ) {
+		for ( let i = 0; i < attributes.length; i ++ ) {
 
-			const attribute = vertexBuffers[ i ];
+			const attribute = attributes[ i ];
 			const attributeData = this.get( attribute );
 
 			gl.bindBuffer( gl.ARRAY_BUFFER, attributeData.bufferGPU );
 			gl.enableVertexAttribArray( i );
-			gl.vertexAttribPointer( i, attribute.itemSize, attributeData.type, false, 0, 0 );
+
+			let stride, offset;
+
+			if ( attribute.isInterleavedBufferAttribute === true ) {
+
+				stride = attribute.data.stride * attributeData.bytesPerElement;
+				offset = attribute.offset * attributeData.bytesPerElement;
+
+			} else {
+
+				stride = 0;
+				offset = 0;
+
+			}
+
+			gl.vertexAttribPointer( i, attribute.itemSize, attributeData.type, false, stride, offset );
+
+			if ( attribute.isInstancedBufferAttribute && ! attribute.isInterleavedBufferAttribute ) {
+
+				gl.vertexAttribDivisor( i, attribute.meshPerAttribute );
+
+			} else if ( attribute.isInterleavedBufferAttribute && attribute.data.isInstancedInterleavedBuffer ) {
+
+				gl.vertexAttribDivisor( i, attribute.data.meshPerAttribute );
+
+			}
 
 		}
 
@@ -739,9 +796,9 @@ class WebGLBackend extends Backend {
 
 	}
 
-	updateAttribute( /*attribute*/ ) {
+	updateAttribute( attribute ) {
 
-		console.warn( 'Abstract class.' );
+		this.attributeUtils.updateAttribute( attribute );
 
 	}
 

+ 12 - 1
examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js

@@ -14,6 +14,10 @@ const precisionLib = {
 	high: 'highp'
 };
 
+const supports = {
+	instance: true
+};
+
 class GLSLNodeBuilder extends NodeBuilder {
 
 	constructor( object, renderer, scene = null ) {
@@ -176,7 +180,7 @@ class GLSLNodeBuilder extends NodeBuilder {
 
 		if ( shaderStage === 'vertex' ) {
 
-			const attributes = this.attributes;
+			const attributes = this.getAttributesArray();
 
 			let location = 0;
 
@@ -285,6 +289,13 @@ class GLSLNodeBuilder extends NodeBuilder {
 
 	}
 
+	isAvailable( name ) {
+
+		return supports[ name ] === true;
+
+	}
+
+
 	isFlipY() {
 
 		return true;

+ 36 - 6
examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js

@@ -14,11 +14,24 @@ class WebGLAttributeUtils {
 		const array = attribute.array;
 		const usage = attribute.usage || gl.STATIC_DRAW;
 
-		const bufferGPU = gl.createBuffer();
+		const bufferAttribute = attribute.isInterleavedBufferAttribute ? attribute.data : attribute;
+		const bufferData = backend.get( bufferAttribute );
 
-		gl.bindBuffer( bufferType, bufferGPU );
-		gl.bufferData( bufferType, array, usage );
-		gl.bindBuffer( bufferType, null );
+		let bufferGPU = bufferData.bufferGPU;
+
+		if ( bufferGPU === undefined ) {
+
+			bufferGPU = gl.createBuffer();
+
+			gl.bindBuffer( bufferType, bufferGPU );
+			gl.bufferData( bufferType, array, usage );
+			gl.bindBuffer( bufferType, null );
+
+			bufferData.bufferGPU = bufferGPU;
+			bufferData.bufferType = bufferType;
+			bufferData.version = bufferAttribute.version;
+
+		}
 
 		//attribute.onUploadCallback();
 
@@ -73,12 +86,29 @@ class WebGLAttributeUtils {
 		backend.set( attribute, {
 			bufferGPU,
 			type,
-			bytesPerElement: array.BYTES_PER_ELEMENT,
-			version: attribute.version
+			bytesPerElement: array.BYTES_PER_ELEMENT
 		} );
 
 	}
 
+	updateAttribute( attribute ) {
+
+		const backend = this.backend;
+		const { gl } = backend;
+
+		const array = attribute.array;
+		const bufferAttribute = attribute.isInterleavedBufferAttribute ? attribute.data : attribute;
+		const bufferData = backend.get( bufferAttribute );
+		const bufferType = bufferData.bufferType;
+
+		gl.bindBuffer( bufferType, bufferData.bufferGPU );
+		gl.bufferSubData( bufferType, 0, array );
+		gl.bindBuffer( bufferType, null );
+
+		bufferData.version = bufferAttribute.version;
+
+	}
+
 }
 
 export default WebGLAttributeUtils;

BIN
examples/screenshots/webgpu_lines_fat.jpg


+ 4 - 2
examples/webgpu_lines_fat.html

@@ -28,6 +28,8 @@
 			import * as THREE from 'three';
 
 			import WebGPU from 'three/addons/capabilities/WebGPU.js';
+			import WebGL from 'three/addons/capabilities/WebGL.js';
+
 			import WebGPURenderer from 'three/addons/renderers/webgpu/WebGPURenderer.js';
 
 			import Stats from 'three/addons/libs/stats.module.js';
@@ -54,11 +56,11 @@
 
 			function init() {
 
-				if ( WebGPU.isAvailable() === false ) {
+				if ( WebGPU.isAvailable() === false && WebGL.isWebGL2Available() === false ) {
 
 					document.body.appendChild( WebGPU.getErrorMessage() );
 
-					throw new Error( 'No WebGPU support' );
+					throw new Error( 'No WebGPU or WebGL2 support' );
 
 				}
 

+ 0 - 1
test/e2e/puppeteer.js

@@ -117,7 +117,6 @@ const exceptionList = [
 	'webgpu_compute_texture_pingpong',
 	'webgpu_cubemap_dynamic',
 	'webgpu_instance_mesh',
-	'webgpu_lines_fat',
 	'webgpu_loader_gltf',
 	'webgpu_loader_gltf_compressed',
 	'webgpu_loader_gltf_iridescence',