Skip to content

Commit

Permalink
Fix offscreen texture format (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Oct 1, 2024
1 parent 12ef672 commit 9d89d43
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/webgpu/src/Offscreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ export class GPUOffscreenCanvas implements OffscreenCanvas {
class GPUOffscreenCanvasContext implements GPUCanvasContext {
__brand = "GPUCanvasContext" as const;

private textureFormat: GPUTextureFormat = "bgra8unorm";
private textureFormat: GPUTextureFormat;
private texture: GPUTexture | null = null;
private device: GPUDevice | null = null;

constructor(public readonly canvas: OffscreenCanvas) {}
constructor(public readonly canvas: OffscreenCanvas) {
this.textureFormat = navigator.gpu.getPreferredCanvasFormat();
}

getDevice() {
if (!this.device) {
Expand Down

0 comments on commit 9d89d43

Please sign in to comment.