public static WGPUSwapChain CreateSwapChain(WGPUDevice device) { WGPUSurfaceDescriptorFromCanvasHTMLSelector canvDesc = new WGPUSurfaceDescriptorFromCanvasHTMLSelector { chain = new WGPUChainedStruct { sType = WGPUSType.WGPUSType_SurfaceDescriptorFromCanvasHTMLSelector, }, selector = canvas_str }; WGPUSurfaceDescriptor surfDesc = new WGPUSurfaceDescriptor { nextInChain = (WGPUChainedStruct *)&canvDesc }; WGPUSurface surface = WebGPUNative.wgpuInstanceCreateSurface(IntPtr.Zero, &surfDesc); WGPUSwapChainDescriptor swapDesc = new WGPUSwapChainDescriptor { usage = WGPUTextureUsage.WGPUTextureUsage_OutputAttachment, format = WGPUTextureFormat.WGPUTextureFormat_BGRA8Unorm, width = 800, height = 450, presentMode = WGPUPresentMode.WGPUPresentMode_Fifo }; return(WebGPUNative.wgpuDeviceCreateSwapChain(device, surface, &swapDesc));; }