Skip to content
This repository was archived by the owner on Dec 24, 2023. It is now read-only.

Commit 2f66ad2

Browse files
author
unit-404
committed
still not working on firefox
1 parent 3e678d4 commit 2f66ad2

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

coder/jng/jng-wgpu.mjs

+17-12
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,27 @@ export const calcXYZ = (U, B) => {
129129
return B;
130130
}
131131

132+
//
133+
const debugCanvas = (width, height) => {
134+
const canvas = document.createElement('canvas');
135+
canvas.width = width;
136+
canvas.height = height;
137+
document.body.appendChild(canvas);
138+
canvas.convertToBlob = ({type, quality})=>{
139+
return new Promise((r) => {
140+
canvas.toBlob(r, type, quality);
141+
});
142+
}
143+
return canvas;
144+
};
145+
132146
//
133147
export class CanvasOutput {
134148
constructor(device, width, height) {
135-
const canvas = new OffscreenCanvas(width, height);
149+
const canvas = debugCanvas(width, height); //new OffscreenCanvas(width, height);
136150
const context = canvas.getContext("webgpu", {
137151
preserveDrawingBuffer: true,
138-
precision: "highp",
139-
powerPreference: "high-performance",
140-
desynchronized: true,
141-
willReadFrequently: true,
142-
colorSpace: drawColorSpace,
143-
144-
// try to use fp16 draw buffer
145-
pixelFormat: "float16",
146-
dataType: "float16",
147-
colorType: "float16"
152+
colorSpace: "srgb"
148153
});
149154

150155
//
@@ -160,7 +165,7 @@ export class CanvasOutput {
160165
device,
161166
format: presentationFormat,
162167
alphaMode: "premultiplied",
163-
colorSpace: drawColorSpace
168+
colorSpace: "srgb"
164169
});
165170

166171
//

0 commit comments

Comments
 (0)