@@ -129,22 +129,27 @@ export const calcXYZ = (U, B) => {
129
129
return B ;
130
130
}
131
131
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
+
132
146
//
133
147
export class CanvasOutput {
134
148
constructor ( device , width , height ) {
135
- const canvas = new OffscreenCanvas ( width , height ) ;
149
+ const canvas = debugCanvas ( width , height ) ; // new OffscreenCanvas(width, height);
136
150
const context = canvas . getContext ( "webgpu" , {
137
151
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"
148
153
} ) ;
149
154
150
155
//
@@ -160,7 +165,7 @@ export class CanvasOutput {
160
165
device,
161
166
format : presentationFormat ,
162
167
alphaMode : "premultiplied" ,
163
- colorSpace : drawColorSpace
168
+ colorSpace : "srgb"
164
169
} ) ;
165
170
166
171
//
0 commit comments