180: gfx update and support for acquire fences r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot] 2019-03-24 02:32:03 +00:00
commit 62be45469e
3 changed files with 12 additions and 13 deletions

12
Cargo.lock generated
View file

@ -310,7 +310,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "gfx-backend-dx11" name = "gfx-backend-dx11"
version = "0.1.1" version = "0.1.1"
source = "git+https://github.com/gfx-rs/gfx#3afab46c73a5cf711cd398deda8acb9a009a5b2a" source = "git+https://github.com/gfx-rs/gfx#c8e7aeb2ec8cb39bd95292a5a95d7fffb46ece89"
dependencies = [ dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -328,7 +328,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-dx12" name = "gfx-backend-dx12"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#3afab46c73a5cf711cd398deda8acb9a009a5b2a" source = "git+https://github.com/gfx-rs/gfx#c8e7aeb2ec8cb39bd95292a5a95d7fffb46ece89"
dependencies = [ dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"d3d12 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "d3d12 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -345,7 +345,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-metal" name = "gfx-backend-metal"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#3afab46c73a5cf711cd398deda8acb9a009a5b2a" source = "git+https://github.com/gfx-rs/gfx#c8e7aeb2ec8cb39bd95292a5a95d7fffb46ece89"
dependencies = [ dependencies = [
"arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -369,7 +369,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-backend-vulkan" name = "gfx-backend-vulkan"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#3afab46c73a5cf711cd398deda8acb9a009a5b2a" source = "git+https://github.com/gfx-rs/gfx#c8e7aeb2ec8cb39bd95292a5a95d7fffb46ece89"
dependencies = [ dependencies = [
"ash 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "ash 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -386,7 +386,7 @@ dependencies = [
[[package]] [[package]]
name = "gfx-hal" name = "gfx-hal"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#3afab46c73a5cf711cd398deda8acb9a009a5b2a" source = "git+https://github.com/gfx-rs/gfx#c8e7aeb2ec8cb39bd95292a5a95d7fffb46ece89"
dependencies = [ dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -865,7 +865,7 @@ dependencies = [
[[package]] [[package]]
name = "range-alloc" name = "range-alloc"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#3afab46c73a5cf711cd398deda8acb9a009a5b2a" source = "git+https://github.com/gfx-rs/gfx#c8e7aeb2ec8cb39bd95292a5a95d7fffb46ece89"
[[package]] [[package]]
name = "rdrand" name = "rdrand"

View file

@ -7,6 +7,7 @@ use super::*;
pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits { pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits {
let viewport_size = limits.max_viewport_dimensions[0].max(limits.max_viewport_dimensions[1]);
VkPhysicalDeviceLimits { VkPhysicalDeviceLimits {
maxImageDimension1D: limits.max_image_1d_size, maxImageDimension1D: limits.max_image_1d_size,
maxImageDimension2D: limits.max_image_2d_size, maxImageDimension2D: limits.max_image_2d_size,
@ -19,6 +20,9 @@ pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits {
maxPushConstantsSize: limits.max_push_constants_size as _, maxPushConstantsSize: limits.max_push_constants_size as _,
maxViewports: limits.max_viewports as _, maxViewports: limits.max_viewports as _,
maxViewportDimensions: limits.max_viewport_dimensions, maxViewportDimensions: limits.max_viewport_dimensions,
// Warning: spec violation
// "The x/y rectangle of the viewport must lie entirely within the current attachment size."
viewportBoundsRange: [0.0, viewport_size as f32],
maxVertexInputAttributes: limits.max_vertex_input_attributes as _, maxVertexInputAttributes: limits.max_vertex_input_attributes as _,
maxVertexInputBindings: limits.max_vertex_input_bindings as _, maxVertexInputBindings: limits.max_vertex_input_bindings as _,
maxVertexInputAttributeOffset: limits.max_vertex_input_attribute_offset as _, maxVertexInputAttributeOffset: limits.max_vertex_input_attribute_offset as _,

View file

@ -1,7 +1,7 @@
use hal::{command as com, memory, pass, pso, queue}; use hal::{command as com, memory, pass, pso, queue};
use hal::{ use hal::{
DescriptorPool, Device, Features, Instance, PhysicalDevice, QueueFamily, DescriptorPool, Device, Features, Instance, PhysicalDevice, QueueFamily,
Surface, Swapchain as HalSwapchain, FrameSync, Surface, Swapchain as _,
}; };
use hal::buffer::IndexBufferView; use hal::buffer::IndexBufferView;
use hal::command::RawCommandBuffer; use hal::command::RawCommandBuffer;
@ -4577,18 +4577,13 @@ pub extern "C" fn gfxAcquireNextImageKHR(
fence: VkFence, fence: VkFence,
pImageIndex: *mut u32, pImageIndex: *mut u32,
) -> VkResult { ) -> VkResult {
let sync = match semaphore.as_ref() {
Some(sem) => FrameSync::Semaphore(sem),
None => FrameSync::Fence(&*fence),
};
let raw = match swapchain.raw { let raw = match swapchain.raw {
Some(ref mut raw) => raw, Some(ref mut raw) => raw,
None => return VkResult::VK_ERROR_OUT_OF_DATE_KHR, None => return VkResult::VK_ERROR_OUT_OF_DATE_KHR,
}; };
match unsafe { match unsafe {
raw.acquire_image(timeout, sync) raw.acquire_image(timeout, semaphore.as_ref(), fence.as_ref())
} { } {
Ok(frame) => { Ok(frame) => {
unsafe { *pImageIndex = frame; } unsafe { *pImageIndex = frame; }