blob: 8833ede5c0ed3b5efded6c7f57fa7564b46580c0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
using System;
using Avalonia;
using Ryujinx.Ava.Ui.Vulkan.Surfaces;
using Silk.NET.Vulkan;
namespace Ryujinx.Ava.Ui.Vulkan
{
internal class VulkanSurfaceRenderingSession : IDisposable
{
private readonly VulkanDevice _device;
private readonly VulkanSurfaceRenderTarget _renderTarget;
private VulkanCommandBufferPool.VulkanCommandBuffer _commandBuffer;
public VulkanSurfaceRenderingSession(VulkanDisplay display, VulkanDevice device,
VulkanSurfaceRenderTarget renderTarget, float scaling)
{
Display = display;
_device = device;
_renderTarget = renderTarget;
Scaling = scaling;
Begin();
}
public VulkanDisplay Display { get; }
public PixelSize Size => _renderTarget.Size;
public Vk Api => _device.Api;
public float Scaling { get; }
private void Begin()
{
if (!Display.EnsureSwapchainAvailable())
{
_renderTarget.Invalidate();
}
}
public void Dispose()
{
_commandBuffer = Display.StartPresentation(_renderTarget);
Display.BlitImageToCurrentImage(_renderTarget, _commandBuffer.InternalHandle);
Display.EndPresentation(_commandBuffer);
}
}
}
|