vulkan-rs
所属分类:GPU/显卡
开发工具:Rust
文件大小:165KB
下载次数:0
上传日期:2021-08-16 12:16:43
上 传 者:
sh-1993
说明: rust编程语言的Vulkan绑定。
(Vulkan bindings for the rust programming language.)
文件列表:
.travis.yml (396, 2021-08-16)
Cargo.toml (7131, 2021-08-16)
LICENSE (1304, 2021-08-16)
Vulkan-Docs (0, 2021-08-16)
build.rs (4893, 2021-08-16)
examples (0, 2021-08-16)
examples\create_instance.rs (1616, 2021-08-16)
examples\cube.rs (19792, 2021-08-16)
extract_docs.py (2331, 2021-08-16)
generate.py (2234, 2021-08-16)
generator (0, 2021-08-16)
generator\__init__.py (206, 2021-08-16)
generator\registry.py (39534, 2021-08-16)
generator\rust.py (56720, 2021-08-16)
generator\specconvert.py (1689, 2021-08-16)
generator\specextract.py (6248, 2021-08-16)
generator\utils.py (7063, 2021-08-16)
rustfmt.toml (1133, 2021-08-16)
src (0, 2021-08-16)
src\dispatch_commands.rs (149247, 2021-08-16)
src\dispatch_table.rs (58526, 2021-08-16)
src\dl.rs (2747, 2021-08-16)
src\enums.rs (120964, 2021-08-16)
src\lib.rs (5074, 2021-08-16)
src\loader.rs (9209, 2021-08-16)
src\platform.rs (2133, 2021-08-16)
src\prelude.rs (61730, 2021-08-16)
src\protos.rs (40306, 2021-08-16)
src\types.rs (617137, 2021-08-16)
src\types_impl.rs (7286, 2021-08-16)
src\utils.rs (9815, 2021-08-16)
# `vulkan_rs`
Vulkan bindings for the rust programming language.
[![Version](https://img.shields.io/crates/v/vulkan_rs.svg)](https://crates.io/crates/vulkan_rs)
[![Docs](https://docs.rs/vulkan_rs/badge.svg)](https://docs.rs/vulkan_rs)
[![Build Status](https://travis-ci.org/HellButcher/vulkan-rs.svg?branch=master)](https://travis-ci.org/HellButcher/vulkan-rs)
[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](LICENSE)
## Discontinued
This crate is no longer under development: I recommend using [`ash`](https://crates.io/crates/ash) instead.
## Basic usage
```toml
[dependencies]
vulkan_rs = "0.4"
```
```rust
extern crate vulkan_rs;
use vulkan_rs::prelude::*;
fn main() {
let app_name = CString::new("Application name").unwrap();
let app_info = VkApplicationInfo::new()
.set_application_name(Some(&app_name))
.set_application_version(vk_make_version(1, 0, 0))
.set_engine_name(Some(&app_name))
.set_engine_version(vk_make_version(1, 0, 0))
.set_api_version(VK_API_VERSION_1_0);
let create_info = VkInstanceCreateInfo::new()
.set_application_info(Some(&app_info));
let instance = vkCreateInstance(&create_info, None).unwrap();
let phys_devices = vkEnumeratePhysicalDevices(instance).unwrap();
println!("There are {} physical devices", phys_devices.len());
// [...]
vkDestroyInstance(instance, None);
}
```
## Stability Notice
I'm a little bit experimenting with the API generator.
I might introduce non-backward compatible changes, for making the API more safe and sound.
Some topics, that might come in the future ([x] = already done):
- safe commands:
- [x] pass length- and array-pointer pairs as `slice`
- [x] use references (and no pointers) where possible
- [x] usage of `Option` for optional parameters (especialy for references and handles)
- [x] returning of "output-parameters" (`Result` when command returns `VkResult`)
- [x] enumerating: returning `Vec` or `Result,VkResult>` (e.g. vkEnumeratePhysicalDevices)
- [ ] simplify passing of `&str` (`&[&str]` not required?)
- safe enums:
- [x] usage of `enum` for enums and not `u32`
- [x] usage of `crate bitflags` for bitmasks
- [x] own `VkError` enum (VkResult items, but without `VK_SUCCESS`), `VkResult = Result<(),VkError>`
- safe structs:
- [x] hide length- and array-pointer pairs
- provide safe setter with `slice` parameter
- [x] hide `VkStructureType` and provide default
- [x] use references (and no pointers) where possible (hide pointers)
- [x] usage of `Option` for optional fields
- [ ] simplify passing of `&str` and `&[&str]`
- setting string-arrays (`const char* const*`) not possible at the moment
- [ ] setting of `const void* pNext` chain
- :warning: Keep the structs binary compatible (same length, same padding)
- safe handles:
- [x] non-zero handles (use `Optional` for zeroable handles)
- [ ] Owned and Borrowed handles
- `vkCreate*` commands return Owned handles
- `vkDestroy*` commands consume Owned handles
- everything else uses Borrowed handles
- [ ] implement `Drop` (either panic or call `vkDestroy*`)
- [ ] lifetimes: child-handle shouldn't outlive it's parent-handle
近期下载者:
相关文件:
收藏者: