using System;
using System.Collections.Generic;
using ComputeSharp.Descriptors;
namespace ComputeSharp.Tests.Internals.Helpers;
///
/// A debug data loader for generic shaders.
///
internal struct DebugDispatchDataLoader : IConstantBufferLoader, IGraphicsResourceLoader
{
///
/// The constant buffer, if set.
///
private byte[]? constantBuffer;
///
/// The list of loaded resources.
///
private readonly List<(IGraphicsResource Resource, uint Index)> graphicsResources = new();
///
/// Creates a new instance.
///
public DebugDispatchDataLoader()
{
}
///
/// Gets the constant buffer.
///
public byte[]? ConstantBuffer => this.constantBuffer;
///
/// Gets the loaded resources.
///
public IReadOnlyList<(IGraphicsResource Resource, uint Index)> GraphicsResources => this.graphicsResources;
///
void IConstantBufferLoader.LoadConstantBuffer(ReadOnlySpan data)
{
this.constantBuffer = data.ToArray();
}
///
readonly void IGraphicsResourceLoader.LoadGraphicsResource(IGraphicsResource resource, uint index)
{
this.graphicsResources.Add((resource, index));
}
}