Skip to content

Conversation

@Popov72
Copy link
Contributor

@Popov72 Popov72 commented Dec 5, 2025

No description provided.

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 5, 2025

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
Copy link
Collaborator

bjsplat commented Dec 5, 2025


private _invProjection: Matrix;

protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if it is too late to change this protected API, but Promise<unknown> would be safer from a typing standpoint (assuming there is no reason unknown would be a problem in this context).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if it would be a problem to make this change, but it would involve modifying many files (EffectWrapper + all post-processes), so that's something for another PR for sure.

}

// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax
public override initAsync(): Promise<any> {
Copy link
Member

Choose a reason for hiding this comment

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

Same comment if this can be Promise<unknown>


if (this._engine.isWebGPU) {
// eslint-disable-next-line github/no-then
void import("../ShadersWGSL/lightingVolume.compute").then(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this mean if there is an error it will not be possible to see and handle that error from an API standpoint? It will just show up in the console as an unhandled error, right? Would it make more sense to have an async factory function, or is it necessary to be able to synchronously construct a LightingVolume and have async work in the background?

private readonly _initAsyncPromises: Promise<void>[] = [];
private _currentProcessedTask: FrameGraphTask | null = null;
private _whenReadyAsyncCancel: Nullable<() => void> = null;
private _importPromise: Promise<any>;
Copy link
Member

Choose a reason for hiding this comment

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

One more time, Promise<uknown> would be safer here :)


if (this._engine.isWebGPU) {
// eslint-disable-next-line github/no-then
void import("../ShadersWGSL/lightingVolume.compute").then(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this WebGPU only? If so, then is there any reason to do a dynamic import?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's only WebGPU, but I don't want to add this import to the WebGPUEngine file, so that this file isn't loaded if you're not using the LightingVolume class. Is there another way to do this than the one I used?

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 5, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 5, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 5, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Dec 5, 2025

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants