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));; }
public static extern WGPUProc wgpuGetProcAddress(WGPUDevice device, string procName);
public static extern WGPUTextureFormat getSwapChainFormat(WGPUDevice device);
public static extern WGPUSwapChain createSwapChain(WGPUDevice device, WGPUTextureUsage usage, uint width, uint height, WGPUPresentMode presentMode);
public static WGPUTextureFormat GetSwapChainFormat(WGPUDevice _) { return(WGPUTextureFormat.WGPUTextureFormat_BGRA8Unorm); }