remove params from BeginRenderPass and PushUniforms
parent
970517c3c2
commit
99a7064e2e
|
@ -29,40 +29,164 @@ namespace MoonWorks.Graphics
|
||||||
currentSampleCount = SampleCount.One;
|
currentSampleCount = SampleCount.One;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: we can probably use the NativeMemory functions to not have to generate arrays here
|
/// <summary>
|
||||||
|
/// Begins a render pass.
|
||||||
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
||||||
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="colorAttachmentInfo">The color attachment to use in the render pass.</param>
|
||||||
|
public unsafe void BeginRenderPass(
|
||||||
|
ColorAttachmentInfo colorAttachmentInfo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
AssertTextureNotNull(colorAttachmentInfo);
|
||||||
|
AssertColorTarget(colorAttachmentInfo);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1];
|
||||||
|
refreshColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh();
|
||||||
|
|
||||||
|
Refresh.Refresh_BeginRenderPass(
|
||||||
|
Device.Handle,
|
||||||
|
Handle,
|
||||||
|
(IntPtr) refreshColorAttachmentInfos,
|
||||||
|
1,
|
||||||
|
IntPtr.Zero
|
||||||
|
);
|
||||||
|
|
||||||
|
renderPassActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Begins a render pass.
|
/// Begins a render pass.
|
||||||
/// All render state, resource binding, and draw commands must be made within a render pass.
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
||||||
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="colorAttachmentInfos">The color attachments to use in the render pass.</param>
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
||||||
public unsafe void BeginRenderPass(
|
public unsafe void BeginRenderPass(
|
||||||
params ColorAttachmentInfo[] colorAttachmentInfos
|
ColorAttachmentInfo colorAttachmentInfoOne,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoTwo
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
AssertValidColorAttachments(colorAttachmentInfos, true);
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
||||||
|
AssertColorTarget(colorAttachmentInfoOne);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
||||||
|
AssertColorTarget(colorAttachmentInfoTwo);
|
||||||
|
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoTwo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var refreshColorAttachmentInfos = new Refresh.ColorAttachmentInfo[colorAttachmentInfos.Length];
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2];
|
||||||
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
||||||
|
|
||||||
for (var i = 0; i < colorAttachmentInfos.Length; i += 1)
|
|
||||||
{
|
|
||||||
refreshColorAttachmentInfos[i] = colorAttachmentInfos[i].ToRefresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
fixed (Refresh.ColorAttachmentInfo* pColorAttachmentInfos = refreshColorAttachmentInfos)
|
|
||||||
{
|
|
||||||
Refresh.Refresh_BeginRenderPass(
|
Refresh.Refresh_BeginRenderPass(
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
(IntPtr) pColorAttachmentInfos,
|
(IntPtr) refreshColorAttachmentInfos,
|
||||||
(uint) colorAttachmentInfos.Length,
|
2,
|
||||||
IntPtr.Zero
|
IntPtr.Zero
|
||||||
);
|
);
|
||||||
|
|
||||||
|
renderPassActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Begins a render pass.
|
||||||
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
||||||
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoThree">The third color attachment to use in the render pass.</param>
|
||||||
|
public unsafe void BeginRenderPass(
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoOne,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoTwo,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoThree
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
||||||
|
AssertColorTarget(colorAttachmentInfoOne);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
||||||
|
AssertColorTarget(colorAttachmentInfoTwo);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoThree);
|
||||||
|
AssertColorTarget(colorAttachmentInfoThree);
|
||||||
|
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoTwo);
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoThree);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3];
|
||||||
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
|
||||||
|
|
||||||
|
Refresh.Refresh_BeginRenderPass(
|
||||||
|
Device.Handle,
|
||||||
|
Handle,
|
||||||
|
(IntPtr) refreshColorAttachmentInfos,
|
||||||
|
3,
|
||||||
|
IntPtr.Zero
|
||||||
|
);
|
||||||
|
|
||||||
|
renderPassActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Begins a render pass.
|
||||||
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
||||||
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoThree">The third color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoFour">The four color attachment to use in the render pass.</param>
|
||||||
|
public unsafe void BeginRenderPass(
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoOne,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoTwo,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoThree,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoFour
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
||||||
|
AssertColorTarget(colorAttachmentInfoOne);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
||||||
|
AssertColorTarget(colorAttachmentInfoTwo);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoThree);
|
||||||
|
AssertColorTarget(colorAttachmentInfoThree);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoFour);
|
||||||
|
AssertColorTarget(colorAttachmentInfoFour);
|
||||||
|
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoTwo);
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoThree);
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoFour);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4];
|
||||||
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh();
|
||||||
|
|
||||||
|
Refresh.Refresh_BeginRenderPass(
|
||||||
|
Device.Handle,
|
||||||
|
Handle,
|
||||||
|
(IntPtr) refreshColorAttachmentInfos,
|
||||||
|
4,
|
||||||
|
IntPtr.Zero
|
||||||
|
);
|
||||||
|
|
||||||
renderPassActive = true;
|
renderPassActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,37 +196,209 @@ namespace MoonWorks.Graphics
|
||||||
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
||||||
/// <param name="colorAttachmentInfos">The color attachments to use in the render pass.</param>
|
|
||||||
public unsafe void BeginRenderPass(
|
public unsafe void BeginRenderPass(
|
||||||
DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
DepthStencilAttachmentInfo depthStencilAttachmentInfo
|
||||||
params ColorAttachmentInfo[] colorAttachmentInfos
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
||||||
AssertValidColorAttachments(colorAttachmentInfos, false);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var refreshColorAttachmentInfos = new Refresh.ColorAttachmentInfo[colorAttachmentInfos.Length];
|
|
||||||
|
|
||||||
for (var i = 0; i < colorAttachmentInfos.Length; i += 1)
|
|
||||||
{
|
|
||||||
refreshColorAttachmentInfos[i] = colorAttachmentInfos[i].ToRefresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
||||||
|
|
||||||
fixed (Refresh.ColorAttachmentInfo* pColorAttachmentInfos = refreshColorAttachmentInfos)
|
|
||||||
{
|
|
||||||
Refresh.Refresh_BeginRenderPass(
|
Refresh.Refresh_BeginRenderPass(
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
pColorAttachmentInfos,
|
(Refresh.ColorAttachmentInfo*) IntPtr.Zero,
|
||||||
(uint) colorAttachmentInfos.Length,
|
0,
|
||||||
&refreshDepthStencilAttachmentInfo
|
&refreshDepthStencilAttachmentInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
|
renderPassActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Begins a render pass.
|
||||||
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
||||||
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfo">The color attachment to use in the render pass.</param>
|
||||||
|
public unsafe void BeginRenderPass(
|
||||||
|
DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfo);
|
||||||
|
AssertColorTarget(colorAttachmentInfo);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[1];
|
||||||
|
refreshColorAttachmentInfos[0] = colorAttachmentInfo.ToRefresh();
|
||||||
|
|
||||||
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
||||||
|
|
||||||
|
Refresh.Refresh_BeginRenderPass(
|
||||||
|
Device.Handle,
|
||||||
|
Handle,
|
||||||
|
refreshColorAttachmentInfos,
|
||||||
|
1,
|
||||||
|
&refreshDepthStencilAttachmentInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
renderPassActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Begins a render pass.
|
||||||
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
||||||
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
||||||
|
public unsafe void BeginRenderPass(
|
||||||
|
DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoOne,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoTwo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
||||||
|
AssertColorTarget(colorAttachmentInfoOne);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
||||||
|
AssertColorTarget(colorAttachmentInfoTwo);
|
||||||
|
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoTwo);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[2];
|
||||||
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
||||||
|
|
||||||
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
||||||
|
|
||||||
|
Refresh.Refresh_BeginRenderPass(
|
||||||
|
Device.Handle,
|
||||||
|
Handle,
|
||||||
|
refreshColorAttachmentInfos,
|
||||||
|
2,
|
||||||
|
&refreshDepthStencilAttachmentInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
renderPassActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Begins a render pass.
|
||||||
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
||||||
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoThree">The third color attachment to use in the render pass.</param>
|
||||||
|
public unsafe void BeginRenderPass(
|
||||||
|
DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoOne,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoTwo,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoThree
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
||||||
|
AssertColorTarget(colorAttachmentInfoOne);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
||||||
|
AssertColorTarget(colorAttachmentInfoTwo);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoThree);
|
||||||
|
AssertColorTarget(colorAttachmentInfoThree);
|
||||||
|
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoTwo);
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoTwo);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[3];
|
||||||
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
|
||||||
|
|
||||||
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
||||||
|
|
||||||
|
Refresh.Refresh_BeginRenderPass(
|
||||||
|
Device.Handle,
|
||||||
|
Handle,
|
||||||
|
refreshColorAttachmentInfos,
|
||||||
|
3,
|
||||||
|
&refreshDepthStencilAttachmentInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
renderPassActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Begins a render pass.
|
||||||
|
/// All render state, resource binding, and draw commands must be made within a render pass.
|
||||||
|
/// It is an error to call this after calling BeginRenderPass but before calling EndRenderPass.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="depthStencilAttachmentInfo">The depth stencil attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoOne">The first color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoTwo">The second color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoThree">The third color attachment to use in the render pass.</param>
|
||||||
|
/// <param name="colorAttachmentInfoFour">The four color attachment to use in the render pass.</param>
|
||||||
|
public unsafe void BeginRenderPass(
|
||||||
|
DepthStencilAttachmentInfo depthStencilAttachmentInfo,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoOne,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoTwo,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoThree,
|
||||||
|
ColorAttachmentInfo colorAttachmentInfoFour
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
AssertValidDepthAttachment(depthStencilAttachmentInfo);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoOne);
|
||||||
|
AssertColorTarget(colorAttachmentInfoOne);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoTwo);
|
||||||
|
AssertColorTarget(colorAttachmentInfoTwo);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoThree);
|
||||||
|
AssertColorTarget(colorAttachmentInfoThree);
|
||||||
|
|
||||||
|
AssertTextureNotNull(colorAttachmentInfoFour);
|
||||||
|
AssertColorTarget(colorAttachmentInfoFour);
|
||||||
|
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoTwo);
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoThree);
|
||||||
|
AssertSameSampleCount(colorAttachmentInfoOne, colorAttachmentInfoFour);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
var refreshColorAttachmentInfos = stackalloc Refresh.ColorAttachmentInfo[4];
|
||||||
|
refreshColorAttachmentInfos[0] = colorAttachmentInfoOne.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[1] = colorAttachmentInfoTwo.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[2] = colorAttachmentInfoThree.ToRefresh();
|
||||||
|
refreshColorAttachmentInfos[3] = colorAttachmentInfoFour.ToRefresh();
|
||||||
|
|
||||||
|
var refreshDepthStencilAttachmentInfo = depthStencilAttachmentInfo.ToRefresh();
|
||||||
|
|
||||||
|
Refresh.Refresh_BeginRenderPass(
|
||||||
|
Device.Handle,
|
||||||
|
Handle,
|
||||||
|
refreshColorAttachmentInfos,
|
||||||
|
4,
|
||||||
|
&refreshDepthStencilAttachmentInfo
|
||||||
|
);
|
||||||
|
|
||||||
renderPassActive = true;
|
renderPassActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,7 +774,7 @@ namespace MoonWorks.Graphics
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A starting offset value to be used with draw calls.</returns>
|
/// <returns>A starting offset value to be used with draw calls.</returns>
|
||||||
public unsafe uint PushVertexShaderUniforms<T>(
|
public unsafe uint PushVertexShaderUniforms<T>(
|
||||||
params T[] uniforms
|
T uniforms
|
||||||
) where T : unmanaged
|
) where T : unmanaged
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -490,23 +786,20 @@ namespace MoonWorks.Graphics
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fixed (T* ptr = &uniforms[0])
|
|
||||||
{
|
|
||||||
return Refresh.Refresh_PushVertexShaderUniforms(
|
return Refresh.Refresh_PushVertexShaderUniforms(
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
(IntPtr) ptr,
|
(IntPtr) (&uniforms),
|
||||||
(uint) (uniforms.Length * sizeof(T))
|
(uint) sizeof(T)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pushes fragment shader uniforms to the device.
|
/// Pushes fragment shader uniforms to the device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A starting offset to be used with draw calls.</returns>
|
/// <returns>A starting offset to be used with draw calls.</returns>
|
||||||
public unsafe uint PushFragmentShaderUniforms<T>(
|
public unsafe uint PushFragmentShaderUniforms<T>(
|
||||||
params T[] uniforms
|
T uniforms
|
||||||
) where T : unmanaged
|
) where T : unmanaged
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -518,23 +811,20 @@ namespace MoonWorks.Graphics
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fixed (T* ptr = &uniforms[0])
|
|
||||||
{
|
|
||||||
return Refresh.Refresh_PushFragmentShaderUniforms(
|
return Refresh.Refresh_PushFragmentShaderUniforms(
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
(IntPtr) ptr,
|
(IntPtr) (&uniforms),
|
||||||
(uint) (uniforms.Length * sizeof(T))
|
(uint) sizeof(T)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pushes compute shader uniforms to the device.
|
/// Pushes compute shader uniforms to the device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A starting offset to be used with dispatch calls.</returns>
|
/// <returns>A starting offset to be used with dispatch calls.</returns>
|
||||||
public unsafe uint PushComputeShaderUniforms<T>(
|
public unsafe uint PushComputeShaderUniforms<T>(
|
||||||
params T[] uniforms
|
T uniforms
|
||||||
) where T : unmanaged
|
) where T : unmanaged
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -546,15 +836,13 @@ namespace MoonWorks.Graphics
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fixed (T* ptr = &uniforms[0])
|
|
||||||
{
|
|
||||||
return Refresh.Refresh_PushComputeShaderUniforms(
|
return Refresh.Refresh_PushComputeShaderUniforms(
|
||||||
Device.Handle,
|
Device.Handle,
|
||||||
Handle,
|
Handle,
|
||||||
(IntPtr) ptr,
|
(IntPtr) (&uniforms),
|
||||||
(uint) (uniforms.Length * sizeof(T))
|
(uint) sizeof(T)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1019,39 +1307,29 @@ namespace MoonWorks.Graphics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AssertValidColorAttachments(ColorAttachmentInfo[] colorAttachmentInfos, bool atLeastOneRequired)
|
private void AssertTextureNotNull(ColorAttachmentInfo colorAttachmentInfo)
|
||||||
{
|
{
|
||||||
if (atLeastOneRequired && colorAttachmentInfos.Length == 0)
|
if (colorAttachmentInfo.Texture == null || colorAttachmentInfo.Texture.Handle == IntPtr.Zero)
|
||||||
{
|
|
||||||
throw new System.ArgumentException("Render pass must contain at least one attachment!");
|
|
||||||
}
|
|
||||||
|
|
||||||
currentSampleCount = (colorAttachmentInfos.Length > 0) ? colorAttachmentInfos[0].SampleCount : SampleCount.One;
|
|
||||||
|
|
||||||
if (colorAttachmentInfos.Length > 4)
|
|
||||||
{
|
|
||||||
throw new System.ArgumentException("Render pass cannot have more than 4 color attachments!");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < colorAttachmentInfos.Length; i += 1)
|
|
||||||
{
|
|
||||||
if (colorAttachmentInfos[i].Texture == null ||
|
|
||||||
colorAttachmentInfos[i].Texture.Handle == IntPtr.Zero)
|
|
||||||
{
|
{
|
||||||
throw new System.ArgumentException("Render pass color attachment Texture cannot be null!");
|
throw new System.ArgumentException("Render pass color attachment Texture cannot be null!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((colorAttachmentInfos[i].Texture.UsageFlags & TextureUsageFlags.ColorTarget) == 0)
|
private void AssertColorTarget(ColorAttachmentInfo colorAttachmentInfo)
|
||||||
|
{
|
||||||
|
if ((colorAttachmentInfo.Texture.UsageFlags & TextureUsageFlags.ColorTarget) == 0)
|
||||||
{
|
{
|
||||||
throw new System.ArgumentException("Render pass color attachment UsageFlags must include TextureUsageFlags.ColorTarget!");
|
throw new System.ArgumentException("Render pass color attachment UsageFlags must include TextureUsageFlags.ColorTarget!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (colorAttachmentInfos[i].SampleCount != currentSampleCount)
|
private void AssertSameSampleCount(ColorAttachmentInfo a, ColorAttachmentInfo b)
|
||||||
|
{
|
||||||
|
if (a.SampleCount != b.SampleCount)
|
||||||
{
|
{
|
||||||
throw new System.ArgumentException("All color attachments in a render pass must have the same SampleCount!");
|
throw new System.ArgumentException("All color attachments in a render pass must have the same SampleCount!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void AssertValidDepthAttachment(DepthStencilAttachmentInfo depthStencilAttachmentInfo)
|
private void AssertValidDepthAttachment(DepthStencilAttachmentInfo depthStencilAttachmentInfo)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue