Skip to content

feat(flame_3d): Add experimental web support using webgpu backend#3930

Open
wolfenrain wants to merge 7 commits into
mainfrom
feat(flame_3d)--Add-experimental-`web`-support-using-`webgpu`-backend
Open

feat(flame_3d): Add experimental web support using webgpu backend#3930
wolfenrain wants to merge 7 commits into
mainfrom
feat(flame_3d)--Add-experimental-`web`-support-using-`webgpu`-backend

Conversation

@wolfenrain
Copy link
Copy Markdown
Contributor

Description

Adding experimental web support using webgpu, it serves as a showcase for the backend API working as intended and as a way to bring web into the mix.

image

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

vec3 positions[MAX_LIGHTS];
vec4 colors[MAX_LIGHTS];
float intensities[MAX_LIGHTS];
vec4 intensities[MAX_LIGHTS];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@luanpotter I know this looks odd but because of how it works on impeller with striding and the fact that webgpu does not allow float arrays this is actually the exact same code :P

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.

cries in the corner

we also can't have list of structs, so it is already ugly anyway :/

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.

maybe just leave a comment justifying so no one "cleans it up" later?

Comment on lines +20 to +23
magFilter: 'nearest',
minFilter: 'nearest',
addressModeU: 'clamp-to-edge',
addressModeV: 'clamp-to-edge',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@luanpotter this matches what happens on the FlutterGPU side, long term however we should make this configurable and then pass a SampleOptions to the _renderPass.bindTexture on the FlutterGPU backend as well:

Image

Preferably per texture.

tilesets # plural of tileset
truecolor # truecolor rendering
tweening # the process of tween
uncapturederror # dumb webgpu javascript name
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.

lol

I wonder if we should have a specific dict for language keywords, like we have one for dart
since these are not broadly standard gamedev terms

@@ -0,0 +1,37 @@
{
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.

similar to shaderbundle, we should have some CI to check this (bc no one will)
for now we could mark on git attributes as generated?

some tea instead because you have to do some reading first!
**STOP**, we know you are hyped up and want to start coding some funky 3D stuff
but we first have to set your expectations and clarify some things. So turn down
your music, put away the coffee and make some tea instead because you have to do
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.

coffee is perfect for reading or anything btw :P (jk)

import '_build_wgslbundle.dart' as wgslbundle;

void main(List<String> arguments) async {
final withWebGpu = arguments.contains('--with-web-gpu');
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.

does it make sense to generalize as --platforms? or is the shaderbundle needed for both and webgpu just needs an additional file?

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.

3 participants