blob: c834fa621caff3d977d97644b114d8db91ff18a5 (
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
49
50
51
52
53
54
55
56
57
58
|
using Ryujinx.Graphics.GAL;
using Silk.NET.Vulkan;
using System.Collections.Generic;
namespace Ryujinx.Graphics.Vulkan
{
class PipelineLayoutCache
{
private readonly PipelineLayoutCacheEntry[] _plce;
private readonly List<PipelineLayoutCacheEntry> _plceMinimal;
public PipelineLayoutCache()
{
_plce = new PipelineLayoutCacheEntry[1 << Constants.MaxShaderStages];
_plceMinimal = new List<PipelineLayoutCacheEntry>();
}
public PipelineLayoutCacheEntry Create(VulkanRenderer gd, Device device, ShaderSource[] shaders)
{
var plce = new PipelineLayoutCacheEntry(gd, device, shaders);
_plceMinimal.Add(plce);
return plce;
}
public PipelineLayoutCacheEntry GetOrCreate(VulkanRenderer gd, Device device, uint stages, bool usePd)
{
if (_plce[stages] == null)
{
_plce[stages] = new PipelineLayoutCacheEntry(gd, device, stages, usePd);
}
return _plce[stages];
}
protected virtual unsafe void Dispose(bool disposing)
{
if (disposing)
{
for (int i = 0; i < _plce.Length; i++)
{
_plce[i]?.Dispose();
}
foreach (var plce in _plceMinimal)
{
plce.Dispose();
}
_plceMinimal.Clear();
}
}
public void Dispose()
{
Dispose(true);
}
}
}
|