Skip to content

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

Open
wolfenrain wants to merge 6 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 6 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

import 'dart:typed_data';

@JS('navigator.gpu')
external GPU? get webGPU;
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.

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.

Missed you too buddy <3

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

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.

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