Skip to content

Avoid unnecessary console warning #30992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Spiri0
Copy link
Contributor

@Spiri0 Spiri0 commented Apr 24, 2025

This PR is only intended to disable the console warning when no attributes are used.

With SBOs + structs / structArrays + drawIndirect / drawIndexedIndirect, there are no longer any attributes. You can precisely control which vertices the vertex shader should be executed for, instead of simply looping through all attribute entries like the classic approach.
Attribute-based geometry is fine, but it's no longer the only way and for highend not the best. The modern approach works without attributes, so missing a position, normal, or uv attribute isn't an error. And I admit that over time, when I'm developing, it bothers me to get a warning in the console that draws attention to something that isn't an error.

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.33
78.33
336.33
78.33
+0 B
+0 B
WebGPU 547.45
151.77
547.37
151.75
-78 B
-20 B
WebGPU Nodes 546.8
151.61
546.72
151.59
-78 B
-20 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.78
112.28
465.78
112.28
+0 B
+0 B
WebGPU 622.3
168.35
622.22
168.34
-78 B
-16 B
WebGPU Nodes 577.17
157.62
577.1
157.59
-78 B
-32 B

@Mugen87
Copy link
Collaborator

Mugen87 commented Apr 29, 2025

Do you mind sharing a small code example that shows how you use attribute() without a data on geometry level?

@Spiri0
Copy link
Contributor Author

Spiri0 commented Apr 29, 2025

Do you mind sharing a small code example that shows how you use attribute() without a data on geometry level?

I made this example some time ago.

https://codepen.io/Spiri0/pen/zxxvqYb?editors=0010

In this example, I set the data in the storage buffers on the CPU side, but that's not necessary. You can do it on the GPU too.
In this example in the vertex shader, you can see that the data for the geometry all comes from the storage buffers. There is no ˋˋˋposition: vec3ˋˋˋ and attribute() node in the shader parameters as is usually the case, only storages.
With drawIndirect, I could also display only parts of it, running vertex shaders only for the vertices I want.

P.S. I've modified the example slightly. The position values and world matices ​​never exist on the CPU. Try using resolution = 100 or 500. It works almost instantly.

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.

2 participants