package com.github.hydos.ginger.engine.vulkan.misc;

import static org.lwjgl.system.MemoryStack.stackGet;

import java.nio.LongBuffer;

/** Wraps the needed sync objects for an in flight frame
 * This frame's sync objects must be deleted manually */
public class Frame
{
	private final long imageAvailableSemaphore;
	private final long renderFinishedSemaphore;
	private final long fence;

	public Frame(long imageAvailableSemaphore, long renderFinishedSemaphore, long fence)
	{
		this.imageAvailableSemaphore = imageAvailableSemaphore;
		this.renderFinishedSemaphore = renderFinishedSemaphore;
		this.fence = fence;
	}

	public long imageAvailableSemaphore()
	{ return imageAvailableSemaphore; }

	public LongBuffer pImageAvailableSemaphore()
	{ return stackGet().longs(imageAvailableSemaphore); }

	public long renderFinishedSemaphore()
	{ return renderFinishedSemaphore; }

	public LongBuffer pRenderFinishedSemaphore()
	{ return stackGet().longs(renderFinishedSemaphore); }

	public long fence()
	{ return fence; }

	public LongBuffer pFence()
	{ return stackGet().longs(fence); }
}
