forked from aly/qstbak
muffin v7.5.5
This commit is contained in:
parent
a8f2c1df37
commit
6266f9e6b7
110 changed files with 14907 additions and 6073 deletions
29
Auspex/Auspex.Rendering.Direct3D/HlslShaderData.cs
Normal file
29
Auspex/Auspex.Rendering.Direct3D/HlslShaderData.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using TerraFX.Interop.DirectX;
|
||||
|
||||
namespace Auspex.Rendering.Direct3D;
|
||||
|
||||
internal abstract class HlslShaderData<TElement> : IDisposable where TElement : unmanaged
|
||||
{
|
||||
private protected readonly GpuBuffer<TElement> _buffer;
|
||||
|
||||
protected HlslShaderData(string name, FrameRenderContext ctx, int maxCount, bool dynamic)
|
||||
{
|
||||
_buffer = new GpuBuffer<TElement>(name, ctx, maxCount, 1u, dynamic);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_buffer.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private protected unsafe void DrawVertices(FrameRenderContext ctx, int first, int count)
|
||||
{
|
||||
ID3D11Buffer* buffer = _buffer.Buffer;
|
||||
uint elementSize = (uint)_buffer.ElementSize;
|
||||
uint num = 0u;
|
||||
ctx.Context->IASetVertexBuffers(0u, 1u, &buffer, &elementSize, &num);
|
||||
ctx.Context->Draw((uint)count, (uint)first);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue