Campari/src/ShaderModule.cs

24 lines
773 B
C#
Raw Normal View History

2021-01-14 09:26:54 +00:00
using RefreshCS;
using System;
using System.IO;
namespace Campari
{
public class ShaderModule : GraphicsResource
{
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyShaderModule;
2021-01-16 02:13:53 +00:00
public unsafe ShaderModule(GraphicsDevice device, FileInfo fileInfo) : base(device)
2021-01-14 09:26:54 +00:00
{
fixed (uint* ptr = Bytecode.ReadBytecode(fileInfo))
{
Refresh.ShaderModuleCreateInfo shaderModuleCreateInfo;
shaderModuleCreateInfo.codeSize = (UIntPtr) fileInfo.Length;
shaderModuleCreateInfo.byteCode = (IntPtr) ptr;
Handle = Refresh.Refresh_CreateShaderModule(device.Handle, ref shaderModuleCreateInfo);
}
}
}
}