Skip to content

Use texelFetch/textureLoad for WebGL2/WGSL#17811

Closed
noname0310 wants to merge 6 commits into
BabylonJS:masterfrom
noname0310:texture-storage-refactor
Closed

Use texelFetch/textureLoad for WebGL2/WGSL#17811
noname0310 wants to merge 6 commits into
BabylonJS:masterfrom
noname0310:texture-storage-refactor

Conversation

@noname0310

Copy link
Copy Markdown
Contributor

This PR replaces texture2D and texture with texelFetch and textureLoad.

This allows us to reduce the number of uniform variables by one when using Bone and VAT in WebGL2 and WebGPU,
while also simplifying the code.

If you feel this optimization is too aggressive or unnecessary, please share your thoughts.

@sebavan sebavan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice !!! I would be in favor of keeping the uniforms in both cases to prevent the extra cpu usage of the checks and such everyframe.

The conditionnal part in the shader coud be #ifdef WEBGL1 ? so that soon-ish we could get rid of it alltogether :-)

Love the focus on perf here

Comment thread packages/dev/core/src/BakedVertexAnimation/bakedVertexAnimationManager.ts Outdated
Comment thread packages/dev/core/src/Lights/Shadows/shadowGenerator.ts
Comment thread packages/dev/core/src/Materials/materialHelper.functions.ts Outdated
@sebavan sebavan requested review from Popov72 and deltakosh February 3, 2026 16:16
Comment thread packages/dev/core/src/ShadersWGSL/ShadersInclude/bonesDeclaration.fx Outdated
@noname0310

noname0310 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

I have reflected all the requested changes. 😀

@noname0310

Copy link
Copy Markdown
Contributor Author

@sebavan I want to see if it passes CI testing, can I run the pipeline...?

@deltakosh deltakosh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@deltakosh

Copy link
Copy Markdown
Contributor

/azurepipelines run

@deltakosh deltakosh enabled auto-merge (squash) February 4, 2026 16:22
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

Snapshot stored with reference name:
refs/pull/17811/merge

Test environment:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/17811/merge/index.html

To test a playground add it to the URL, for example:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/17811/merge/index.html#WGZLGJ#4600

Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves):

https://playground.babylonjs.com/?snapshot=refs/pull/17811/merge
https://sandbox.babylonjs.com/?snapshot=refs/pull/17811/merge
https://gui.babylonjs.com/?snapshot=refs/pull/17811/merge
https://nme.babylonjs.com/?snapshot=refs/pull/17811/merge

To test the snapshot in the playground with a playground ID add it after the snapshot query string:

https://playground.babylonjs.com/?snapshot=refs/pull/17811/merge#BCU1XR#0

If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools.

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

auto-merge was automatically disabled February 4, 2026 18:28

Head branch was pushed to by a user without write access

@sebavan

sebavan commented Feb 4, 2026

Copy link
Copy Markdown
Member

/azurepipelines run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@sebavan sebavan enabled auto-merge (squash) February 4, 2026 18:51
@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

auto-merge was automatically disabled February 5, 2026 01:55

Head branch was pushed to by a user without write access

@noname0310

Copy link
Copy Markdown
Contributor Author

@sebavan run CI again please 😭

@sebavan

sebavan commented Feb 5, 2026 via email

Copy link
Copy Markdown
Member

@azure-pipelines

Copy link
Copy Markdown
Command 'run

Best' is not supported by Azure Pipelines.



Supported commands

  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@sebavan

sebavan commented Feb 5, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@bjsplat

bjsplat commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

@bjsplat

bjsplat commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator

@sebavan

sebavan commented Feb 5, 2026

Copy link
Copy Markdown
Member

@noname0310 consider it merged, I am fixing the native part on the side

@sebavan sebavan closed this Feb 5, 2026
sebavan added a commit that referenced this pull request Feb 5, 2026
supercedes #17811 to merge
it

Thanks a ton @noname0310

---------

Co-authored-by: noname0310 <hjnam2014@gmail.com>
@sebavan

sebavan commented Feb 5, 2026

Copy link
Copy Markdown
Member

@noname0310 it has been merged, only the thin instances to go :-) and I ll merge the doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants