Render Pass Streamlining #1

Merged
cosmonaut merged 1 commits from render_pass_streamline into main 2022-02-25 05:33:47 +00:00
1 changed files with 946 additions and 980 deletions

View File

@ -463,33 +463,6 @@ namespace RefreshCS
public uint fragmentSamplerBindingCount; public uint fragmentSamplerBindingCount;
} }
[StructLayout(LayoutKind.Sequential)]
public struct ColorTargetDescription
{
public TextureFormat format;
public SampleCount multisampleCount;
public LoadOp loadOp;
public StoreOp storeOp;
}
[StructLayout(LayoutKind.Sequential)]
public struct DepthStencilTargetDescription
{
public TextureFormat format;
public LoadOp loadOp;
public StoreOp storeOp;
public LoadOp stencilLoadOp;
public StoreOp stencilStoreOp;
}
[StructLayout(LayoutKind.Sequential)]
public struct RenderPassCreateInfo
{
public IntPtr colorTargetDescriptions; /* Refresh_ColorTargetDescription */
public uint colorTargetCount;
public IntPtr depthStencilTargetDescription;
}
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct ShaderModuleCreateInfo public struct ShaderModuleCreateInfo
{ {
@ -580,6 +553,22 @@ namespace RefreshCS
public ComputePipelineLayoutCreateInfo pipelineLayoutCreateInfo; public ComputePipelineLayoutCreateInfo pipelineLayoutCreateInfo;
} }
[StructLayout(LayoutKind.Sequential)]
public struct ColorAttachmentDescription
{
public TextureFormat format;
public SampleCount sampleCount;
}
[StructLayout(LayoutKind.Sequential)]
public struct GraphicsPipelineAttachmentInfo
{
public IntPtr colorAttachmentDescriptions; /* Max size 4 */
public uint colorAttachmentCount;
public byte hasDepthStencilAttachment;
public TextureFormat depthStencilFormat;
}
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct GraphicsPipelineCreateInfo public struct GraphicsPipelineCreateInfo
{ {
@ -593,18 +582,25 @@ namespace RefreshCS
public DepthStencilState depthStencilState; public DepthStencilState depthStencilState;
public ColorBlendState colorBlendState; public ColorBlendState colorBlendState;
public GraphicsPipelineLayoutCreateInfo pipelineLayoutCreateInfo; public GraphicsPipelineLayoutCreateInfo pipelineLayoutCreateInfo;
public IntPtr renderPass; public GraphicsPipelineAttachmentInfo attachmentInfo;
} }
[StructLayout(LayoutKind.Sequential)] public struct ColorAttachmentInfo
public struct FramebufferCreateInfo {
public IntPtr renderTarget;
public Vec4 clearColor;
public LoadOp loadOp;
public StoreOp storeOp;
}
public struct DepthStencilAttachmentInfo
{ {
public IntPtr renderPass;
public IntPtr pColorTargets;
public uint colorTargetCount;
public IntPtr depthStencilTarget; public IntPtr depthStencilTarget;
public uint width; public DepthStencilValue depthStencilValue;
public uint height; public LoadOp loadOp;
public StoreOp storeOp;
public LoadOp stencilLoadOp;
public StoreOp stencilStoreOp;
} }
/* Logging */ /* Logging */
@ -688,12 +684,6 @@ namespace RefreshCS
/* Creates */ /* Creates */
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Refresh_CreateRenderPass(
IntPtr device,
in RenderPassCreateInfo renderPassCreateInfo
);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Refresh_CreateComputePipeline( public static extern IntPtr Refresh_CreateComputePipeline(
IntPtr device, IntPtr device,
@ -712,12 +702,6 @@ namespace RefreshCS
in SamplerStateCreateInfo samplerStateCreateInfo in SamplerStateCreateInfo samplerStateCreateInfo
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Refresh_CreateFramebuffer(
IntPtr device,
in FramebufferCreateInfo framebufferCreateInfo
);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr Refresh_CreateShaderModule( public static extern IntPtr Refresh_CreateShaderModule(
IntPtr device, IntPtr device,
@ -859,13 +843,6 @@ namespace RefreshCS
IntPtr renderTarget IntPtr renderTarget
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_QueueDestroyFramebuffer(
IntPtr device,
IntPtr commandBuffer,
IntPtr framebuffer
);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_QueueDestroyShaderModule( public static extern void Refresh_QueueDestroyShaderModule(
IntPtr device, IntPtr device,
@ -873,13 +850,6 @@ namespace RefreshCS
IntPtr shaderModule IntPtr shaderModule
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_QueueDestroyRenderPass(
IntPtr device,
IntPtr commandBuffer,
IntPtr renderPass
);
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_QueueDestroyComputePipeline( public static extern void Refresh_QueueDestroyComputePipeline(
IntPtr device, IntPtr device,
@ -900,24 +870,20 @@ namespace RefreshCS
public static extern void Refresh_BeginRenderPass( public static extern void Refresh_BeginRenderPass(
IntPtr device, IntPtr device,
IntPtr commandBuffer, IntPtr commandBuffer,
IntPtr renderPass,
IntPtr framebuffer,
in Rect renderArea, in Rect renderArea,
IntPtr pColorClearValues, IntPtr colorAttachmentInfos,
uint colorClearCount, uint colorAttachmentCount,
in DepthStencilValue depthStencilClearValue IntPtr depthStencilAttachmentInfo /* can be NULL */
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Refresh_BeginRenderPass( public static unsafe extern void Refresh_BeginRenderPass(
IntPtr device, IntPtr device,
IntPtr commandBuffer, IntPtr commandBuffer,
IntPtr renderPass,
IntPtr framebuffer,
in Rect renderArea, in Rect renderArea,
IntPtr pColorClearValues, ColorAttachmentInfo* colorAttachmentInfos,
uint colorClearCount, uint colorAttachmentCount,
IntPtr depthStencilClearValue /* NULL */ DepthStencilAttachmentInfo* depthStencilAttachmentInfo /* can be NULL */
); );
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)] [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]