uniforms are now pushed via command buffer

main
cosmonaut 2022-01-12 13:01:32 -08:00
parent 0c588b96f4
commit 7d7437721c
4 changed files with 58 additions and 46 deletions

@ -1 +1 @@
Subproject commit 1befeda8f51e9104de127e1480985771d4a4b380 Subproject commit 34bf0b69aedfdb50ce4d161173a955998746dad8

View File

@ -371,6 +371,63 @@ namespace MoonWorks.Graphics
BindFragmentSamplers(textureSamplerBindings, textureSamplerBindings.Length); 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> /// <summary>
/// Clears the render targets on the current framebuffer to a single color or depth/stencil value. /// 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. /// NOTE: It is recommended that you clear when beginning render passes unless you have a good reason to clear mid-pass.

View File

@ -40,20 +40,5 @@ namespace MoonWorks.Graphics
ComputeShaderState = computeShaderState; 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>())
);
}
}
} }
} }

View File

@ -128,35 +128,5 @@ namespace MoonWorks.Graphics
FragmentShaderState = fragmentShaderState; FragmentShaderState = fragmentShaderState;
RenderPass = renderPass; 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>())
);
}
}
} }
} }