Refresh API updates

refresh2
cosmonaut 2024-06-06 10:51:46 -07:00
parent 6d95203816
commit baa4df5e18
3 changed files with 7 additions and 76 deletions

@ -1 +1 @@
Subproject commit a0cdff3054c646a532e5850c0ab89d4611069237 Subproject commit 5d09b036cbd0a1402857776d8f39be87234b450a

View File

@ -358,84 +358,15 @@ namespace MoonWorks.Graphics
/// <summary> /// <summary>
/// Waits for the given fence to become signaled. /// Waits for the given fence to become signaled.
/// </summary> /// </summary>
public unsafe void WaitForFences(Fence fence) public unsafe void WaitForFence(Fence fence)
{ {
var fenceHandle = fence.Handle; var fenceHandle = fence.Handle;
Refresh.Refresh_WaitForFences( Refresh.Refresh_WaitForFences(
Handle, Handle,
1, 1,
1, &fenceHandle,
&fenceHandle 1
);
}
/// <summary>
/// Wait for one or more fences to become signaled.
/// </summary>
/// <param name="waitAll">If true, will wait for all given fences to be signaled.</param>
public unsafe void WaitForFences(
Fence fenceOne,
Fence fenceTwo,
bool waitAll
) {
var handlePtr = stackalloc nint[2];
handlePtr[0] = fenceOne.Handle;
handlePtr[1] = fenceTwo.Handle;
Refresh.Refresh_WaitForFences(
Handle,
Conversions.BoolToInt(waitAll),
2,
handlePtr
);
}
/// <summary>
/// Wait for one or more fences to become signaled.
/// </summary>
/// <param name="waitAll">If true, will wait for all given fences to be signaled.</param>
public unsafe void WaitForFences(
Fence fenceOne,
Fence fenceTwo,
Fence fenceThree,
bool waitAll
) {
var handlePtr = stackalloc nint[3];
handlePtr[0] = fenceOne.Handle;
handlePtr[1] = fenceTwo.Handle;
handlePtr[2] = fenceThree.Handle;
Refresh.Refresh_WaitForFences(
Handle,
Conversions.BoolToInt(waitAll),
3,
handlePtr
);
}
/// <summary>
/// Wait for one or more fences to become signaled.
/// </summary>
/// <param name="waitAll">If true, will wait for all given fences to be signaled.</param>
public unsafe void WaitForFences(
Fence fenceOne,
Fence fenceTwo,
Fence fenceThree,
Fence fenceFour,
bool waitAll
) {
var handlePtr = stackalloc nint[4];
handlePtr[0] = fenceOne.Handle;
handlePtr[1] = fenceTwo.Handle;
handlePtr[2] = fenceThree.Handle;
handlePtr[3] = fenceFour.Handle;
Refresh.Refresh_WaitForFences(
Handle,
Conversions.BoolToInt(waitAll),
4,
handlePtr
); );
} }
@ -455,8 +386,8 @@ namespace MoonWorks.Graphics
Refresh.Refresh_WaitForFences( Refresh.Refresh_WaitForFences(
Handle, Handle,
Conversions.BoolToInt(waitAll), Conversions.BoolToInt(waitAll),
4, handlePtr,
handlePtr (uint) fences.Length
); );
} }

View File

@ -250,7 +250,7 @@ namespace MoonWorks.Graphics
var commandBuffer = Device.AcquireCommandBuffer(); var commandBuffer = Device.AcquireCommandBuffer();
RecordUploadCommands(commandBuffer); RecordUploadCommands(commandBuffer);
var fence = Device.SubmitAndAcquireFence(commandBuffer); var fence = Device.SubmitAndAcquireFence(commandBuffer);
Device.WaitForFences(fence); Device.WaitForFence(fence);
Device.ReleaseFence(fence); Device.ReleaseFence(fence);
} }