diff --git a/src/Graphics/CommandBuffer.cs b/src/Graphics/CommandBuffer.cs
index 2218e34d..e5cf272e 100644
--- a/src/Graphics/CommandBuffer.cs
+++ b/src/Graphics/CommandBuffer.cs
@@ -1408,10 +1408,10 @@ namespace MoonWorks.Graphics
/// Pushes vertex shader uniforms to the device.
///
/// A starting offset value to be used with draw calls.
- public unsafe uint PushVertexShaderUniforms(
- in T uniforms
- ) where T : unmanaged
- {
+ public unsafe uint PushVertexShaderUniforms(
+ void* uniformsPtr,
+ uint size
+ ) {
#if DEBUG
AssertGraphicsPipelineBound();
@@ -1421,17 +1421,53 @@ namespace MoonWorks.Graphics
}
#endif
+ return Refresh.Refresh_PushVertexShaderUniforms(
+ Device.Handle,
+ Handle,
+ (IntPtr) uniformsPtr,
+ size
+ );
+ }
+
+ ///
+ /// Pushes vertex shader uniforms to the device.
+ ///
+ /// A starting offset value to be used with draw calls.
+ public unsafe uint PushVertexShaderUniforms(
+ in T uniforms
+ ) where T : unmanaged
+ {
fixed (T* uniformsPtr = &uniforms)
{
- return Refresh.Refresh_PushVertexShaderUniforms(
- Device.Handle,
- Handle,
- (IntPtr) uniformsPtr,
- (uint) Marshal.SizeOf()
- );
+ return PushVertexShaderUniforms(uniformsPtr, (uint) Marshal.SizeOf());
}
}
+ ///
+ /// Pushes fragment shader uniforms to the device.
+ ///
+ /// A starting offset to be used with draw calls.
+ public unsafe uint PushFragmentShaderUniforms(
+ void* uniformsPtr,
+ uint size
+ ) {
+#if DEBUG
+ AssertGraphicsPipelineBound();
+
+ if (currentGraphicsPipeline.FragmentShaderInfo.UniformBufferSize == 0)
+ {
+ throw new InvalidOperationException("The current fragment shader does not take a uniform buffer!");
+ }
+#endif
+
+ return Refresh.Refresh_PushFragmentShaderUniforms(
+ Device.Handle,
+ Handle,
+ (IntPtr) uniformsPtr,
+ size
+ );
+ }
+
///
/// Pushes fragment shader uniforms to the device.
///
@@ -1440,25 +1476,37 @@ namespace MoonWorks.Graphics
in T uniforms
) where T : unmanaged
{
-#if DEBUG
- AssertGraphicsPipelineBound();
-
- if (currentGraphicsPipeline.FragmentShaderInfo.UniformBufferSize == 0)
- {
- throw new InvalidOperationException("The current fragment shader does not take a uniform buffer!");
- }
-#endif
fixed (T* uniformsPtr = &uniforms)
{
- return Refresh.Refresh_PushFragmentShaderUniforms(
- Device.Handle,
- Handle,
- (IntPtr) uniformsPtr,
- (uint) Marshal.SizeOf()
- );
+ return PushFragmentShaderUniforms(uniformsPtr, (uint) Marshal.SizeOf());
}
}
+ ///
+ /// Pushes compute shader uniforms to the device.
+ ///
+ /// A starting offset to be used with dispatch calls.
+ public unsafe uint PushComputeShaderUniforms(
+ void* uniformsPtr,
+ uint size
+ ) {
+#if DEBUG
+ AssertComputePipelineBound();
+
+ if (currentComputePipeline.ComputeShaderInfo.UniformBufferSize == 0)
+ {
+ throw new System.InvalidOperationException("The current compute shader does not take a uniform buffer!");
+ }
+#endif
+
+ return Refresh.Refresh_PushComputeShaderUniforms(
+ Device.Handle,
+ Handle,
+ (IntPtr) uniformsPtr,
+ size
+ );
+ }
+
///
/// Pushes compute shader uniforms to the device.
///
@@ -1467,23 +1515,9 @@ namespace MoonWorks.Graphics
in T uniforms
) where T : unmanaged
{
-#if DEBUG
- AssertComputePipelineBound();
-
- if (currentComputePipeline.ComputeShaderInfo.UniformBufferSize == 0)
- {
- throw new System.InvalidOperationException("The current compute shader does not take a uniform buffer!");
- }
-#endif
-
fixed (T* uniformsPtr = &uniforms)
{
- return Refresh.Refresh_PushComputeShaderUniforms(
- Device.Handle,
- Handle,
- (IntPtr) uniformsPtr,
- (uint) Marshal.SizeOf()
- );
+ return PushComputeShaderUniforms(uniformsPtr, (uint) Marshal.SizeOf());
}
}