Move swapchain acquire timeout to user code

This commit is contained in:
Pierre Krieger 2016-02-19 11:19:37 +01:00
parent b5c2d3d5f8
commit 3735fd0062
2 changed files with 3 additions and 3 deletions

View File

@ -229,7 +229,7 @@ fn main() {
loop {
// Before we can draw on the output, we have to *acquire* an image from the swapchain.
// This operation returns the index of the image that we are allowed to draw upon..
let image_num = swapchain.acquire_next_image().unwrap();
let image_num = swapchain.acquire_next_image(1000000).unwrap();
// Our queue is wrapped around a `Mutex`, so we have to lock it.
let mut queue = queue.lock().unwrap();

View File

@ -154,7 +154,7 @@ impl Swapchain {
///
/// If you try to draw on an image without acquiring it first, the execution will block. (TODO
/// behavior may change).
pub fn acquire_next_image(&self) -> Result<usize, AcquireError> {
pub fn acquire_next_image(&self, timeout_ns: u64) -> Result<usize, AcquireError> {
let vk = self.device.pointers();
unsafe {
@ -162,7 +162,7 @@ impl Swapchain {
let mut out = mem::uninitialized();
let r = try!(check_errors(vk.AcquireNextImageKHR(self.device.internal_object(),
self.swapchain, 1000000,
self.swapchain, timeout_ns,
semaphore.internal_object(), 0, // TODO: timeout
&mut out)));