add explicit resource dependencies to graphics resource objects

main
cosmonaut 2021-01-27 14:02:46 -08:00
parent 186b025b4d
commit 5524e501f3
3 changed files with 30 additions and 0 deletions

View File

@ -7,6 +7,8 @@ namespace MoonWorks.Graphics
{
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyComputePipeline;
public ShaderStageState ComputeShaderState { get; }
public unsafe ComputePipeline(
GraphicsDevice device,
ShaderStageState computeShaderState,
@ -34,6 +36,8 @@ namespace MoonWorks.Graphics
device.Handle,
computePipelineCreateInfo
);
ComputeShaderState = computeShaderState;
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using RefreshCS;
namespace MoonWorks.Graphics
@ -7,6 +8,13 @@ namespace MoonWorks.Graphics
{
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyFramebuffer;
public RenderTarget DepthStencilTarget { get; }
private RenderTarget[] colorTargets { get; }
public IEnumerable<RenderTarget> ColorTargets => colorTargets;
public RenderPass RenderPass { get; }
public unsafe Framebuffer(
GraphicsDevice device,
uint width,
@ -46,6 +54,16 @@ namespace MoonWorks.Graphics
Handle = Refresh.Refresh_CreateFramebuffer(device.Handle, framebufferCreateInfo);
}
DepthStencilTarget = depthStencilTarget;
this.colorTargets = new RenderTarget[colorTargets.Length];
for (var i = 0; i < colorTargets.Length; i++)
{
this.colorTargets[i] = colorTargets[i];
}
RenderPass = renderPass;
}
}
}

View File

@ -8,6 +8,10 @@ namespace MoonWorks.Graphics
{
protected override Action<IntPtr, IntPtr> QueueDestroyFunction => Refresh.Refresh_QueueDestroyGraphicsPipeline;
public ShaderStageState VertexShaderState { get; }
public ShaderStageState FragmentShaderState { get; }
public RenderPass RenderPass { get; }
public unsafe GraphicsPipeline(
GraphicsDevice device,
ColorBlendState colorBlendState,
@ -99,6 +103,10 @@ namespace MoonWorks.Graphics
vertexBindingsHandle.Free();
viewportHandle.Free();
scissorHandle.Free();
VertexShaderState = vertexShaderState;
FragmentShaderState = fragmentShaderState;
RenderPass = renderPass;
}
}
}