三原色のスペクトルの転送用の複製を共有にする

・三原色のスペクトルの転送用メモリをエフェクト間で共有して、使用メモリを削減-M
このコミットが含まれているのは:
routersys committed 2026-10-09 22:09:28 +09:00
1 親 57ed743687
コミット bdefc58917
1ファイル変更
+13 -5
+13 -5
ファイルの表示
@@ -36,17 +36,23 @@ internal readonly record struct GpuTileJob(
public GpuTileLayout Layout => new(Plan.GroupCount, SampleCount, KernelArea);
}
internal sealed class SpectrumStaging
{
public Float2[] Values = [];
}
internal sealed class GpuTileConvolver : IDisposable
{
public const int MaximumSamples = 16;
public const int SampleTilesPerWord = 32;
public const int WordsPerSampleEntry = 2;
static readonly ScratchPool<SpectrumStaging> Staging = new(Environment.ProcessorCount);
readonly GraphicsDevice device;
readonly ReadWriteBuffer<Float4> spare;
ReadOnlyBuffer<Int2> samples;
Int2[] sampleStaging = [];
Float2[] chromaticStaging = [];
ReadWriteBuffer<Float4>? tiles;
ReadOnlyBuffer<Float2>? twiddles;
ReadOnlyBuffer<Float2>? spectrum;
@@ -98,11 +104,13 @@ internal sealed class GpuTileConvolver : IDisposable
var length = ChromaticKernelSpectrum.ChannelCount * kernelSpectrum.HalfColumns * kernelSpectrum.Size;
EnsureSpectrumBuffers(kernelSpectrum.Size, length, true);
if (chromaticStaging.Length < length)
chromaticStaging = new Float2[length];
kernelSpectrum.CopyHalfSpectra(chromaticStaging);
using var lease = Staging.Rent();
var staging = lease.Value;
if (staging.Values.Length < length)
staging.Values = new Float2[length];
kernelSpectrum.CopyHalfSpectra(staging.Values);
twiddles!.CopyFrom(kernelSpectrum.Twiddles);
spectrum!.CopyFrom(chromaticStaging.AsSpan(0, length));
spectrum!.CopyFrom(staging.Values.AsSpan(0, length));
spectrumRadius = kernelSpectrum.Radius;
}