Skip to content
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

Fix WebGPU for mobile support. #12973

Merged
merged 3 commits into from
Sep 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/dev/core/src/Engines/webgpuEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ export class WebGPUEngine extends Engine {
(this.hasOriginBottomLeft as any) = false;

options.deviceDescriptor = options.deviceDescriptor || {};
options.swapChainFormat = options.swapChainFormat || WebGPUConstants.TextureFormat.BGRA8Unorm;
options.antialiasing = options.antialiasing === undefined ? true : options.antialiasing;
options.stencil = options.stencil ?? true;
options.enableGPUDebugMarkers = options.enableGPUDebugMarkers ?? false;
Expand All @@ -538,6 +537,8 @@ export class WebGPUEngine extends Engine {
return;
}

options.swapChainFormat = options.swapChainFormat || navigator.gpu.getPreferredCanvasFormat();

this._isWebGPU = true;
this._shaderPlatformName = "WEBGPU";

Expand Down Expand Up @@ -853,6 +854,10 @@ export class WebGPUEngine extends Engine {

// Set default values as WebGL with depth and stencil attachment for the broadest Compat.
private _initializeMainAttachments(): void {
if (!this._bufferManager) {
return;
}

this._mainTextureExtends = {
width: this.getRenderWidth(),
height: this.getRenderHeight(),
Expand Down