mono / SkiaSharp

SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
MIT License
4.14k stars 522 forks source link

Compile Skia with Direct3D on Windows platform #2823

Open Kation opened 1 month ago

Kation commented 1 month ago

Description of Change

Compile Skia with Direct3D on Windows platform

Bugs Fixed

https://github.com/mono/SkiaSharp/issues/2817

API Changes

None.

Behavioral Changes

None.

Required skia PR

https://github.com/mono/skia/pull/121

PR Checklist

Kation commented 1 month ago

Usage https://github.com/Wodsoft/upf/blob/master/src/UniversalPresentationFramework.Platforms.Win32/Win32RendererD3D12Context.cs

Gillibald commented 1 month ago

These should be exposed by SkiaSharp: https://github.com/Wodsoft/upf/blob/master/src/UniversalPresentationFramework.Platforms.Win32/Win32RendererD3D12Context.cs#L291

Kation commented 1 month ago

@Gillibald How to update SkiaApi.generated.cs or it should be update manually?

mattleibow commented 1 month ago

I think I may have broken the merge with my merge of the Metal PR. Sorry. But, this PR is shaping up very well!

mattleibow commented 1 month ago

@Gillibald How to update SkiaApi.generated.cs or it should be update manually?

I think you found the generator in the utils directory. You should be able to just run this one on a Windows machine with VS installed: https://github.com/mono/SkiaSharp/blob/main/utils/generate.ps1

Kation commented 1 month ago

@mattleibow Yeah, I found it.

Many documents are out of date or missing. I spent a lot of date to look up how to modify codes.

Pipelines failed with Unable to find package Vortice.Direct3D12 and old feature tests. How to fix it?

mattleibow commented 1 month ago

ah, we have a mirror of all packages for reasons to prevent supply chain attacks. Let me mirror those packs.

Kation commented 1 month ago

increase 1,773,537 bytes compare to 3.0.0-preview2.1

Kation commented 1 month ago

@mattleibow Why android and macos test run failed?

mattleibow commented 1 month ago

@mattleibow Why android and macos test run failed?

I think there is a problem with the magic step that is supposed to use the correct build of skia. Just commit the submodule in this PR. Then the checkout of SkiaSharp will also pull the correct skia.

mattleibow commented 1 month ago

For the tests, I think this will work - still installing tooling as I have a new laptop: https://github.com/mono/SkiaSharp/commit/6cf79eac14f5028619a9e855e33b483651c08f3c

Hopefully it just works, I copied the context setup from the skia test files... seems simple enough, no idea.

Kation commented 1 month ago

For the tests, I think this will work - still installing tooling as I have a new laptop: 6cf79ea

Hopefully it just works, I copied the context setup from the skia test files... seems simple enough, no idea.

It's fail randomly I think. Sometime android failed and sometime macos failed or android and macos both failed.

mattleibow commented 1 month ago

ah, yeah sorry. Those are a bit flakey right now. Sometimes the Android emulator does not boot, or the macOS test runner crashes.

Kation commented 1 month ago

Maybe you can click Rerun failed jobs button to try for more times.

mattleibow commented 3 weeks ago

@Kation are you able to write some tests?

Kation commented 1 week ago

@mattleibow Busy these days. I'm copying Vulkan test to Direct3D.