Пример #1
0
        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));;
        }
Пример #2
0
 public static extern WGPUProc wgpuGetProcAddress(WGPUDevice device, string procName);
Пример #3
0
 public static extern WGPUTextureFormat getSwapChainFormat(WGPUDevice device);
Пример #4
0
 public static extern WGPUSwapChain createSwapChain(WGPUDevice device, WGPUTextureUsage usage, uint width, uint height, WGPUPresentMode presentMode);
Пример #5
0
 public static WGPUTextureFormat GetSwapChainFormat(WGPUDevice _)
 {
     return(WGPUTextureFormat.WGPUTextureFormat_BGRA8Unorm);
 }