@@ -51,12 +51,6 @@ public unsafe WebGPUDeviceContext(Configuration configuration)
5151 this . queueHandle = ( nint ) queue ;
5252 this . runtimeLease = lease ;
5353 this . Configuration = configuration ;
54- this . Configuration . SetDrawingBackend ( this . Backend ) ;
55-
56- if ( ! this . Backend . IsSupported )
57- {
58- throw new InvalidOperationException ( "WebGPU unsupported." ) ;
59- }
6054 }
6155 catch
6256 {
@@ -101,7 +95,6 @@ public WebGPUDeviceContext(Configuration configuration, nint deviceHandle, nint
10195 this . queueHandle = queueHandle ;
10296 this . Backend = new WebGPUDrawingBackend ( ) ;
10397 this . Configuration = configuration ;
104- this . Configuration . SetDrawingBackend ( this . Backend ) ;
10598 }
10699
107100 /// <summary>
@@ -261,7 +254,7 @@ public DrawingCanvas<TPixel> CreateCanvas(
261254 WebGPUTextureFormatId format ,
262255 int width ,
263256 int height )
264- => new ( this . Configuration , this . CreateFrame ( textureHandle , textureViewHandle , format , width , height ) , new DrawingOptions ( ) ) ;
257+ => new ( this . Configuration , this . Backend , this . CreateFrame ( textureHandle , textureViewHandle , format , width , height ) , new DrawingOptions ( ) ) ;
265258
266259 /// <summary>
267260 /// Creates a drawing canvas over an externally-owned WebGPU texture.
@@ -280,7 +273,7 @@ public DrawingCanvas<TPixel> CreateCanvas(
280273 int width ,
281274 int height ,
282275 DrawingOptions options )
283- => new ( this . Configuration , this . CreateFrame ( textureHandle , textureViewHandle , format , width , height ) , options ) ;
276+ => new ( this . Configuration , this . Backend , this . CreateFrame ( textureHandle , textureViewHandle , format , width , height ) , options ) ;
284277
285278 /// <summary>
286279 /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and a caller-provided CPU region.
@@ -299,7 +292,7 @@ public DrawingCanvas<TPixel> CreateHybridCanvas(
299292 int width ,
300293 int height ,
301294 Buffer2DRegion < TPixel > cpuRegion )
302- => new ( this . Configuration , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , width , height , cpuRegion ) , new DrawingOptions ( ) ) ;
295+ => new ( this . Configuration , this . Backend , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , width , height , cpuRegion ) , new DrawingOptions ( ) ) ;
303296
304297 /// <summary>
305298 /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and a caller-provided CPU region.
@@ -320,7 +313,7 @@ public DrawingCanvas<TPixel> CreateHybridCanvas(
320313 int height ,
321314 Buffer2DRegion < TPixel > cpuRegion ,
322315 DrawingOptions options )
323- => new ( this . Configuration , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , width , height , cpuRegion ) , options ) ;
316+ => new ( this . Configuration , this . Backend , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , width , height , cpuRegion ) , options ) ;
324317
325318 /// <summary>
326319 /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and the root frame of a CPU image.
@@ -335,7 +328,7 @@ public DrawingCanvas<TPixel> CreateHybridCanvas(
335328 nint textureViewHandle ,
336329 WebGPUTextureFormatId format ,
337330 Image < TPixel > image )
338- => new ( this . Configuration , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , image ) , new DrawingOptions ( ) ) ;
331+ => new ( this . Configuration , this . Backend , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , image ) , new DrawingOptions ( ) ) ;
339332
340333 /// <summary>
341334 /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and a CPU image frame.
@@ -350,7 +343,7 @@ public DrawingCanvas<TPixel> CreateHybridCanvas(
350343 nint textureViewHandle ,
351344 WebGPUTextureFormatId format ,
352345 ImageFrame < TPixel > imageFrame )
353- => new ( this . Configuration , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , imageFrame ) , new DrawingOptions ( ) ) ;
346+ => new ( this . Configuration , this . Backend , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , imageFrame ) , new DrawingOptions ( ) ) ;
354347
355348 /// <summary>
356349 /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and the root frame of a CPU image.
@@ -367,7 +360,7 @@ public DrawingCanvas<TPixel> CreateHybridCanvas(
367360 WebGPUTextureFormatId format ,
368361 Image < TPixel > image ,
369362 DrawingOptions options )
370- => new ( this . Configuration , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , image ) , options ) ;
363+ => new ( this . Configuration , this . Backend , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , image ) , options ) ;
371364
372365 /// <summary>
373366 /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and a CPU image frame.
@@ -384,7 +377,7 @@ public DrawingCanvas<TPixel> CreateHybridCanvas(
384377 WebGPUTextureFormatId format ,
385378 ImageFrame < TPixel > imageFrame ,
386379 DrawingOptions options )
387- => new ( this . Configuration , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , imageFrame ) , options ) ;
380+ => new ( this . Configuration , this . Backend , this . CreateHybridFrame ( textureHandle , textureViewHandle , format , imageFrame ) , options ) ;
388381
389382 /// <summary>
390383 /// Disposes the drawing backend owned by this context.
0 commit comments