2021-01-20 03:33:27 +00:00
|
|
|
|
using RefreshCS;
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace MoonWorks.Graphics
|
|
|
|
|
{
|
|
|
|
|
public class ShaderModule : GraphicsResource
|
|
|
|
|
{
|
|
|
|
|
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyShaderModule;
|
|
|
|
|
|
|
|
|
|
public unsafe ShaderModule(GraphicsDevice device, FileInfo fileInfo) : base(device)
|
|
|
|
|
{
|
2021-01-20 21:32:48 +00:00
|
|
|
|
fixed (uint* ptr = Bytecode.ReadBytecodeAsUInt32(fileInfo))
|
2021-01-20 03:33:27 +00:00
|
|
|
|
{
|
|
|
|
|
Refresh.ShaderModuleCreateInfo shaderModuleCreateInfo;
|
|
|
|
|
shaderModuleCreateInfo.codeSize = (UIntPtr) fileInfo.Length;
|
|
|
|
|
shaderModuleCreateInfo.byteCode = (IntPtr) ptr;
|
|
|
|
|
|
2021-01-22 01:27:25 +00:00
|
|
|
|
Handle = Refresh.Refresh_CreateShaderModule(device.Handle, shaderModuleCreateInfo);
|
2021-01-20 03:33:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|