66: Handle tracker, warnings, limits, compute pipelines, copies, and more... r=msiglreith a=kvark



Co-authored-by: Dzmitry Malyshau <kvark@mozilla.com>
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot] 2018-04-27 15:46:10 +00:00
commit 9798729440
10 changed files with 516 additions and 282 deletions

View file

@ -52,3 +52,4 @@ script:
- if [[ $TRAVIS_RUST_VERSION == "nightly" && $TRAVIS_BRANCH == "staging" ]]; then exit; fi
- export PATH=$PATH:$HOME/deps/bin
- make
- if [[ $TRAVIS_RUST_VERSION == "nightly" ]]; then make debug release; fi

17
Cargo.lock generated
View file

@ -215,14 +215,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "gfx-backend-dx12"
version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#1083ce9ab7f320a746668c06e79964f2514b745c"
source = "git+https://github.com/gfx-rs/gfx#0fe18fa91300a63267e6e19cb3b0f77ca734ea2d"
dependencies = [
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"derivative 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx-hal 0.1.0 (git+https://github.com/gfx-rs/gfx)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spirv_cross 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"spirv_cross 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winit 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -231,7 +231,7 @@ dependencies = [
[[package]]
name = "gfx-backend-metal"
version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#1083ce9ab7f320a746668c06e79964f2514b745c"
source = "git+https://github.com/gfx-rs/gfx#0fe18fa91300a63267e6e19cb3b0f77ca734ea2d"
dependencies = [
"block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"cocoa 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -243,14 +243,15 @@ dependencies = [
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"metal-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"objc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"spirv_cross 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spirv_cross 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winit 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gfx-backend-vulkan"
version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#1083ce9ab7f320a746668c06e79964f2514b745c"
source = "git+https://github.com/gfx-rs/gfx#0fe18fa91300a63267e6e19cb3b0f77ca734ea2d"
dependencies = [
"ash 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -268,7 +269,7 @@ dependencies = [
[[package]]
name = "gfx-hal"
version = "0.1.0"
source = "git+https://github.com/gfx-rs/gfx#1083ce9ab7f320a746668c06e79964f2514b745c"
source = "git+https://github.com/gfx-rs/gfx#0fe18fa91300a63267e6e19cb3b0f77ca734ea2d"
dependencies = [
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -566,7 +567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "spirv_cross"
version = "0.7.4"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -901,7 +902,7 @@ dependencies = [
"checksum rustc-demangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11fb43a206a04116ffd7cfcf9bcb941f8eb6cc7ff667272246b0a1c74259a3cb"
"checksum shared_library 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8254bf098ce4d8d7cc7cc6de438c5488adc5297e5b7ffef88816c0a91bd289c1"
"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"
"checksum spirv_cross 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e0a28a50f7633f82624147f7c9524fe31002fb7e24e897272eb244c61ef74178"
"checksum spirv_cross 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "794a3850a6d16be4a4ea1536ff0f416697a95598e1fe7d926537ac78dc10750c"
"checksum syn 0.10.8 (registry+https://github.com/rust-lang/crates.io-index)" = "58fd09df59565db3399efbba34ba8a2fec1307511ebd245d0061ff9d42691673"
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"

View file

@ -1,5 +1,6 @@
VULKAN_DIR=modules/vulkan-docs/src
CTS_DIR=../VK-GL-CTS
CHERRY_DIR=../cherry
BINDING=target/vulkan.rs
NATIVE_DIR=target/native
TARGET=$(NATIVE_DIR)/test
@ -39,11 +40,20 @@ endif
FULL_LIBRARY_PATH=$(CURDIR)/target/debug
LIBRARY=target/debug/libportability.$(LIB_EXTENSION)
LIBRARY_FAST=target/release/libportability.$(LIB_EXTENSION)
.PHONY: all binding run cts
.PHONY: all rebuild debug release binding run cts cts-pick cts-debug clean cherry
all: $(TARGET)
rebuild:
cargo build --manifest-path libportability/Cargo.toml --features $(BACKEND)
debug:
cargo build --manifest-path libportability/Cargo.toml --features "$(BACKEND) debug"
release: $(LIBRARY_FAST)
binding: $(BINDING)
$(BINDING): $(VULKAN_DIR)/vulkan/*.h
@ -54,6 +64,10 @@ $(LIBRARY): libportability*/src/*.rs libportability*/Cargo.toml Cargo.lock
cargo build --manifest-path libportability-icd/Cargo.toml --features $(BACKEND)
mkdir -p target/native
$(LIBRARY_FAST): libportability*/src/*.rs libportability*/Cargo.toml Cargo.lock
cargo build --release --manifest-path libportability/Cargo.toml --features $(BACKEND)
cargo build --release --manifest-path libportability-icd/Cargo.toml --features $(BACKEND)
$(NATIVE_DIR)/%.o: native/%.cpp $(DEPS) Makefile
$(CC) -c -o $@ $< $(CFLAGS)
@ -81,3 +95,7 @@ cts-debug: $(TARGET)
clean:
rm -f $(OBJECTS) $(TARGET) $(BINDING)
cargo clean
cherry:
cd $(CHERRY_DIR)
LD_LIBRARY_PATH=$(FULL_LIBRARY_PATH) go run server.go

View file

@ -10,11 +10,15 @@ This is a prototype library implementing [Vulkan Portability Initiative](https:/
| -------- | ---- | ---- | --- | -- | - | ---- | - | - | - | - |
| *Vulkan* | 7759 | 2155 | 131 | 34 | 0 | 5439 | 0 | 0 | 0 | 0 |
| *DX12* | 3576 | 1258 | 70 | 0 | 0 | 2248 | 0 | 0 | 0 | 0 |
| *Metal* | 3538 | 1215 | 109 | 0 | 0 | 2214 | 0 | 0 | 0 | 0 |
| *Metal* | 7687 | 2072 | 112 | 39 | 0 | 5464 | 0 | 0 | 0 | 0 |
Vulkan is currently stopping on "dEQP-VK.api.command_buffers.render_pass_continue" (secondary render passes). DX12 and Metal - on the lack of `VkBufferView` implementations.
Current blockers:
- *Vulkan*: "api.command_buffers.render_pass_continue" (secondary render passes).
- *DX12*: lack of `VkBufferView` implementation.
- *Metal*: "api.buffer_view.access.suballocation.buffer_view_memory_test_complete" (missing R32Uint support).
Please visit [our wiki](https://github.com/gfx-rs/portability/wiki/Vulkan-CTS-status) for CTS hookup instructions. Once everything is set, you can generate the new results by calling `make cts` on Unix systems.
Please visit [our wiki](https://github.com/gfx-rs/portability/wiki/Vulkan-CTS-status) for CTS hookup instructions. Once everything is set, you can generate the new results by calling `make cts` on Unix systems. When investigating a particular failure, it's handy to do `make cts-debug name=<test_name>`, which runs a single test under system debugger (gdb/lldb).
## Check out
```

View file

@ -13,7 +13,7 @@ name = "portability_gfx"
[features]
default = []
dispatch = []
#default = ["env_logger"] # uncomment for debugging
nightly = []
[dependencies]
lazy_static = "1.0"

View file

@ -1,10 +1,30 @@
use hal::{buffer, command, error, format, image, memory, pass, pso, query, window};
use hal::{IndexType, PatchSize, Primitive};
use hal::{IndexType, Limits, PatchSize, Primitive};
use std::mem;
use super::*;
pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits {
VkPhysicalDeviceLimits {
maxImageDimension1D: limits.max_texture_size as _,
maxImageDimension2D: limits.max_texture_size as _,
maxImageDimension3D: limits.max_texture_size as _,
maxImageDimensionCube: limits.max_texture_size as _,
maxTessellationPatchSize: limits.max_patch_size as _,
maxViewports: limits.max_viewports as _,
maxComputeWorkGroupCount: limits.max_compute_group_count,
maxComputeWorkGroupSize: limits.max_compute_group_size,
optimalBufferCopyOffsetAlignment: limits.min_buffer_copy_offset_alignment,
optimalBufferCopyRowPitchAlignment: limits.min_buffer_copy_pitch_alignment,
minTexelBufferOffsetAlignment: limits.min_texel_buffer_offset_alignment,
minUniformBufferOffsetAlignment: limits.min_uniform_buffer_offset_alignment,
minStorageBufferOffsetAlignment: limits.min_storage_buffer_offset_alignment,
.. unsafe { mem::zeroed() } //TODO
}
}
pub fn format_from_hal(format: format::Format) -> VkFormat {
// HAL formats have the same numeric representation as Vulkan formats
unsafe { mem::transmute(format) }
@ -555,11 +575,11 @@ pub fn map_compare_op(op: VkCompareOp) -> pso::Comparison {
}
}
pub fn map_logic_op(op: VkLogicOp) -> pso::LogicOp {
pub fn map_logic_op(_op: VkLogicOp) -> pso::LogicOp {
unimplemented!()
}
pub fn map_stencil_op(op: VkStencilOp) -> pso::StencilOp {
pub fn map_stencil_op(_op: VkStencilOp) -> pso::StencilOp {
unimplemented!()
}
@ -647,7 +667,7 @@ pub fn map_wrap_mode(mode: VkSamplerAddressMode) -> image::WrapMode {
VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT => image::WrapMode::Mirror,
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE => image::WrapMode::Clamp,
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER => image::WrapMode::Border,
other => {
_ => {
warn!("Non-covered sampler address mode: {:?}", mode);
image::WrapMode::Clamp
}

View file

@ -1,13 +1,38 @@
use VK_NULL_HANDLE;
use std::{borrow, cmp, fmt, ops};
#[cfg(feature = "nightly")]
use std::collections::HashMap;
#[cfg(feature = "nightly")]
use std::sync::{Arc, Mutex};
#[cfg(feature = "nightly")]
lazy_static! {
static ref REGISTRY: Arc<Mutex<HashMap<usize, &'static str>>> = Arc::new(Mutex::new(HashMap::new()));
}
#[repr(C)]
pub struct Handle<T>(*mut T);
impl<T> Handle<T> {
#[cfg(feature = "nightly")]
impl Handle<()> {
pub fn report_leaks() {
println!("Leaked handles:");
let mut map = REGISTRY.lock().unwrap();
for (_, type_id) in map.drain() {
println!("\t{:?}", type_id);
}
}
}
impl<T: 'static> Handle<T> {
pub fn new(value: T) -> Self {
let ptr = Box::into_raw(Box::new(value));
#[cfg(feature = "nightly")]
{
use std::intrinsics::type_name;
let name = unsafe { type_name::<T>() };
REGISTRY.lock().unwrap().insert(ptr as _, name);
}
Handle(ptr)
}
@ -19,6 +44,10 @@ impl<T> Handle<T> {
if self.0 == VK_NULL_HANDLE as *mut T {
None
} else {
#[cfg(feature = "nightly")]
{
REGISTRY.lock().unwrap().remove(&(self.0 as _)).unwrap();
}
Some(*unsafe { Box::from_raw(self.0) })
}
}

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(improper_ctypes)] //TEMP: buggy Rustc FFI analysis
#![cfg_attr(feature = "nightly", feature(core_intrinsics))]
extern crate gfx_hal as hal;
#[cfg(feature = "gfx-backend-dx12")]
@ -54,6 +55,7 @@ pub type VkFence = Handle<<B as hal::Backend>::Fence>;
pub type VkRenderPass = Handle<<B as hal::Backend>::RenderPass>;
pub type VkFramebuffer = Handle<<B as hal::Backend>::Framebuffer>;
pub type VkPipeline = Handle<Pipeline<B>>;
pub type VkPipelineCache = Handle<()>;
pub type QueueFamilyIndex = u32;
@ -558,12 +560,6 @@ pub struct VkQueryPool_T {
_unused: [u8; 0],
}
pub type VkQueryPool = *mut VkQueryPool_T;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct VkPipelineCache_T {
_unused: [u8; 0],
}
pub type VkPipelineCache = *mut VkPipelineCache_T;
pub const VkPipelineCacheHeaderVersion_VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE:
VkPipelineCacheHeaderVersion =

View file

@ -13,6 +13,7 @@ crate-type = ["cdylib"]
[features]
default = []
debug = ["portability-gfx/env_logger", "portability-gfx/nightly"]
dx12 = ["portability-gfx/gfx-backend-dx12"]
metal = ["portability-gfx/gfx-backend-metal"]
vulkan = ["portability-gfx/gfx-backend-vulkan"]