Jump to content
Hans♫

Slow rendering with SKIA on Windows

Recommended Posts

@Hans♫ Is this an image or a path? (we have to understand if the arrow is being drawn or resized) Can you share the source of this icon?

Share this post


Link to post

Its a path. Our code looks like this (simplified):

fStroke := TStrokeBrush.Create(TBrushKind.Solid, claSilver);
fStroke.Thickness := 1.5;
fPath := TPathData.Create;
fPath.AddEllipse(RectF(-12, -12, 12, 12));
...
Canvas.DrawPath(fPath, 1, fStroke);

 

Share this post


Link to post

@Hans♫ Do you have a blank project simulating this? I drew directly in the form's OnPaint using your example on a blank project and got the same result for all renders, except for the FMX GPU without Skia which seems to be bugged.

scale 1x:

image.png.2ef097951212dd35ffd3baa2b0d15341.png

 

scale 2.25x:

image.thumb.png.0901ac1a06fd988d13176b9046618e4a.png

Share this post


Link to post
On 5/12/2024 at 9:06 PM, vfbb said:

Do you have a blank project simulating this?

Yes, I can reproduce this in a blank project. You did not see it because you used gray in gray. When using white on black, then you can see it:

<No Skia | Skia + Vulkan >

No_Skia.png.ec46c487bc28c085c8a72bdcc1e5cb39.pngSkia_Vulkan.png.c71c9d70a5b13de51c00e715b8b5e9f9.png

 

Enlarged:

<No Skia | Skia + Vulkan >

No_Skia_Large.png.08cd2616f2b08fb8f7e180b51085dc05.pngSkia_Vulkan_Large.png.e0ee36708c82536f3ba3175b7d47c79e.png

 

This is produced with an empty app with only this code:

  GlobalUseSkia := true;
  GlobalUseSkiaRasterWhenAvailable := false;
  GlobalUseVulkan := true;
...
procedure TForm1.PaintBox1Paint(Sender: TObject; Canvas: TCanvas);
var
  lStroke: TStrokeBrush;
  lPath: TPathData;
begin
  lStroke := TStrokeBrush.Create(TBrushKind.Solid, claWhite);
  lStroke.Thickness := 1.5;
  lPath := TPathData.Create;
  lPath.AddEllipse(RectF(-12, -12, 12, 12));
  lPath.Translate(50,50);

  Canvas.Fill.Color := claBlack;
  Canvas.FillRect(RectF(0,0,100,100), 0, 0, [], 1);
  Canvas.DrawPath(lPath, 1, lStroke);

  lStroke.Free;
  lPath.Free;
end;

 

Share this post


Link to post
4 hours ago, Hans♫ said:

Skia_Vulkan_Large.png.e0ee36708c82536f3ba3175b7d47c79e.png

Wow... 2 bit color depth.

This looks like a really bad attempt at supersampling. Or someone got the order of gamma correction mixed up so instead of sRGB->Linear->sRGB they are doing Linear->sRGB->Linear. But that wouldn't explain the 2 bits.

Share this post


Link to post

@Hans♫ I used the same code you provided and got satisfactory results. Look:

 

<No Skia> | <Skia + Vulkan>

image.png.0af6d738170e591510e3a25f63e57ad0.png

(Scale 100%)

 

It is difficult to deduce what is happening if the same code is producing different results. That's why I think it would be interesting if we could test it on more machines. The project I used is attached: 

testVulkan.7z

  • Like 1

Share this post


Link to post
Posted (edited)

This is mine, same project of @vfbb    but with 2 graphics surface from the same PC (always with vulkan enable):

image.png.18d5956a3e2bb1ef2d26a340a1c3d8ca.png

 

   Intel               Nvidia

 

Intel: Intel(R) Iris(R) Xe Graphics

Nvidia: NVIDIA GeForce RTX 3070 Ti Laptop GPU

 

P.S.: Vulkan version 1.3.277

Edited by DelphiUdIT
  • Like 1

Share this post


Link to post
Posted (edited)

NVIDIA RTX 3000 graphics card
In both cases, GlobalUseSkiaRasterWhenAvailable=False and GlobalUseVulkan=True.
In my opinion, it looks better when GlobalUseSkia = False;

406359781_TestSkia.png.5b47e4766b1f42a1a7370dbfa0431613.png

Edited by Rafal.B
  • Like 1

Share this post


Link to post

S = GlobalUseSkia
V = GlobalUseVulcan

GlobalUseSkiaRasterWhenAvailable = False

 

image.thumb.png.8c5419273722a91317851d0526e3651c.png

 


HW: Lenovo P16


Name    NVIDIA RTX A4500 Laptop GPU
PNP Device ID    PCI\VEN_10DE&DEV_24BA&SUBSYS_22DB17AA&REV_A1\4&35D2CA85&0&0008
Adapter Type    NVIDIA RTX A4500 Laptop GPU, NVIDIA compatible
Adapter Description    NVIDIA RTX A4500 Laptop GPU

Name    Intel(R) UHD Graphics
PNP Device ID    PCI\VEN_8086&DEV_4688&SUBSYS_22FB17AA&REV_0C\3&11583659&0&10
Adapter Type    Intel(R) UHD Graphics Family, Intel Corporation compatible
Adapter Description    Intel(R) UHD Graphics
 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×