forked from MoonsideGames/MoonWorks
uniforms are now pushed via command buffer
parent
0c588b96f4
commit
7d7437721c
|
@ -1 +1 @@
|
|||
Subproject commit 1befeda8f51e9104de127e1480985771d4a4b380
|
||||
Subproject commit 34bf0b69aedfdb50ce4d161173a955998746dad8
|
|
@ -371,6 +371,63 @@ namespace MoonWorks.Graphics
|
|||
BindFragmentSamplers(textureSamplerBindings, textureSamplerBindings.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pushes vertex shader uniforms to the device.
|
||||
/// </summary>
|
||||
/// <returns>A starting offset value to be used with draw calls.</returns>
|
||||
public unsafe uint PushVertexShaderUniforms<T>(
|
||||
params T[] uniforms
|
||||
) where T : unmanaged
|
||||
{
|
||||
fixed (T* ptr = &uniforms[0])
|
||||
{
|
||||
return Refresh.Refresh_PushVertexShaderUniforms(
|
||||
Device.Handle,
|
||||
Handle,
|
||||
(IntPtr) ptr,
|
||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pushes fragment shader uniforms to the device.
|
||||
/// </summary>
|
||||
/// <returns>A starting offset to be used with draw calls.</returns>
|
||||
public unsafe uint PushFragmentShaderUniforms<T>(
|
||||
params T[] uniforms
|
||||
) where T : unmanaged
|
||||
{
|
||||
fixed (T* ptr = &uniforms[0])
|
||||
{
|
||||
return Refresh.Refresh_PushFragmentShaderUniforms(
|
||||
Device.Handle,
|
||||
Handle,
|
||||
(IntPtr) ptr,
|
||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pushes compute shader uniforms to the device.
|
||||
/// </summary>
|
||||
/// <returns>A starting offset to be used with dispatch calls.</returns>
|
||||
public unsafe uint PushComputeShaderUniforms<T>(
|
||||
params T[] uniforms
|
||||
) where T : unmanaged
|
||||
{
|
||||
fixed (T* ptr = &uniforms[0])
|
||||
{
|
||||
return Refresh.Refresh_PushComputeShaderUniforms(
|
||||
Device.Handle,
|
||||
Handle,
|
||||
(IntPtr) ptr,
|
||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the render targets on the current framebuffer to a single color or depth/stencil value.
|
||||
/// NOTE: It is recommended that you clear when beginning render passes unless you have a good reason to clear mid-pass.
|
||||
|
|
|
@ -40,20 +40,5 @@ namespace MoonWorks.Graphics
|
|||
|
||||
ComputeShaderState = computeShaderState;
|
||||
}
|
||||
|
||||
public unsafe uint PushComputeShaderUniforms<T>(
|
||||
params T[] uniforms
|
||||
) where T : unmanaged
|
||||
{
|
||||
fixed (T* ptr = &uniforms[0])
|
||||
{
|
||||
return Refresh.Refresh_PushComputeShaderUniforms(
|
||||
Device.Handle,
|
||||
Handle,
|
||||
(IntPtr) ptr,
|
||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,35 +128,5 @@ namespace MoonWorks.Graphics
|
|||
FragmentShaderState = fragmentShaderState;
|
||||
RenderPass = renderPass;
|
||||
}
|
||||
|
||||
public unsafe uint PushVertexShaderUniforms<T>(
|
||||
params T[] uniforms
|
||||
) where T : unmanaged
|
||||
{
|
||||
fixed (T* ptr = &uniforms[0])
|
||||
{
|
||||
return Refresh.Refresh_PushVertexShaderUniforms(
|
||||
Device.Handle,
|
||||
Handle,
|
||||
(IntPtr) ptr,
|
||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe uint PushFragmentShaderUniforms<T>(
|
||||
params T[] uniforms
|
||||
) where T : unmanaged
|
||||
{
|
||||
fixed (T* ptr = &uniforms[0])
|
||||
{
|
||||
return Refresh.Refresh_PushFragmentShaderUniforms(
|
||||
Device.Handle,
|
||||
Handle,
|
||||
(IntPtr) ptr,
|
||||
(uint) (uniforms.Length * Marshal.SizeOf<T>())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue