[BUG] `libSkiaSharp.dll` Requires `d3d12.dll` in `3.119.0`, Causing Crashes on Win7
Description
Since 3.119.0-preview.1.2, SkiaSharp supports D3D12 rendering, but not all Windows has D3D12. I update to 3.119 then got a crash on Windows7.
SkiaSharp even doesn't depend on OpenGL, it can use CPU to render by default, but added a D3D12 dependency, is this a good idea?
Code
using SkiaSharp;
namespace SkiaSharpCrashTest
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Before");
// Force to load libSkiaSharp.dll
var fontMgr = SKFontManager.Default;
Console.WriteLine("After");
}
}
}
Expected Behavior
No response
Actual Behavior
No response
Version of SkiaSharp
3.119.0-preview.1.2
Last Known Good Version of SkiaSharp
3.118.0-preview.2.3
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
No response
Devices
No response
Relevant Screenshots
No response
Relevant Log Output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Yes, this problem will cause the version to crash under win7, which was also encountered.
Windows 7 is out of support, so IMHO it's reasonable for SkiaSharp not to support it either. Maybe you can use the Microsoft.Direct3D.D3D12On7 NuGet as a workaround? Though that hasn't been updated in years either.
This has nothing to do with Win7 systems. Just like OpenGL, D3D12 should be treated as a dynamic dependency of Skia, not a direct dependency. Without manually turning it on, Skia uses CPU rendering by default, D3D12 is mostly idle, and a direct dependency adds bulk and introduces compatibility issues.
There are also many computers that only have D3D11, like Win8, or have glitches in D3D12. It shouldn't cause numerous compatibility issues because of a less common dependency. That's not a good software engineering design solution.
Thanks for this issue. I will see what I can do for this.
This has nothing to do with Win7 systems.
You can hopefully forgive my confusion given the title of the issue and its description 😆
But yeah, from the perspective that it could/should be an optional/dynamic dependency, I agree.
Thanks for this issue. I will see what I can do for this.
Maybe we can make a direct12 package standalone?
was there any progress with this
@mattleibow Can we keep all D3D12 API and do not compile skia with D3D12 precondition? Then compile skia with D3D12 precondition and make a native dependency nuget package.