mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-29 10:14:29 +00:00
Add some documentation, plus minor changes
This commit is contained in:
parent
081c01c3bf
commit
062a0fc581
@ -107,21 +107,6 @@ pub unsafe trait SynchronizedVulkanObject {
|
||||
fn internal_object_guard(&self) -> MutexGuard<Self::Object>;
|
||||
}
|
||||
|
||||
// TODO: remove eventually
|
||||
// https://github.com/rust-lang/rust/issues/29328
|
||||
pub unsafe trait VulkanObjectU64 { fn internal_object(&self) -> u64; }
|
||||
unsafe impl<T> VulkanObjectU64 for T where T: VulkanObject<Object = u64> {
|
||||
#[inline]
|
||||
fn internal_object(&self) -> u64 { VulkanObject::internal_object(self) }
|
||||
}
|
||||
// TODO: remove eventually
|
||||
// https://github.com/rust-lang/rust/issues/29328
|
||||
pub unsafe trait VulkanObjectUsize { fn internal_object(&self) -> usize; }
|
||||
unsafe impl<T> VulkanObjectUsize for T where T: VulkanObject<Object = usize> {
|
||||
#[inline]
|
||||
fn internal_object(&self) -> usize { VulkanObject::internal_object(self) }
|
||||
}
|
||||
|
||||
/// Gives access to the Vulkan function pointers stored in this object.
|
||||
trait VulkanPointers {
|
||||
/// The struct that provides access to the function pointers.
|
||||
|
@ -93,9 +93,13 @@ pub struct DepthBias {
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[repr(u32)]
|
||||
pub enum CullMode {
|
||||
/// No culling.
|
||||
None = vk::CULL_MODE_NONE,
|
||||
/// The faces facing the front of the screen (ie. facing the user) will be removed.
|
||||
Front = vk::CULL_MODE_FRONT_BIT,
|
||||
/// The faces facing the back of the screen will be removed.
|
||||
Back = vk::CULL_MODE_BACK_BIT,
|
||||
/// All faces will be removed.
|
||||
FrontAndBack = vk::CULL_MODE_FRONT_AND_BACK,
|
||||
}
|
||||
|
||||
|
@ -448,6 +448,7 @@ impl<'a, S, I, O, L> GeometryShaderEntryPoint<'a, S, I, O, L> {
|
||||
|
||||
/// Declares which type of primitives are expected by the geometry shader.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
#[doc(hidden)]
|
||||
pub enum GeometryShaderExecutionMode {
|
||||
Points,
|
||||
Lines,
|
||||
|
@ -75,10 +75,13 @@ use format::Format;
|
||||
use pipeline::shader::ShaderInterfaceDef;
|
||||
use vk;
|
||||
|
||||
/// How the vertex source should be unrolled.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[repr(u32)]
|
||||
pub enum InputRate {
|
||||
/// Each element of the source corresponds to a vertex.
|
||||
Vertex = vk::VERTEX_INPUT_RATE_VERTEX,
|
||||
/// Each element of the source corresponds to an instance.
|
||||
Instance = vk::VERTEX_INPUT_RATE_INSTANCE,
|
||||
}
|
||||
|
||||
@ -110,6 +113,7 @@ pub struct VertexMemberInfo {
|
||||
}
|
||||
|
||||
/// Type of a member of a vertex struct.
|
||||
#[allow(missing_docs)]
|
||||
pub enum VertexMemberTy {
|
||||
I8,
|
||||
U8,
|
||||
|
@ -12,6 +12,9 @@
|
||||
//! As far as the author knows, no existing device supports these features. Therefore the code here
|
||||
//! is mostly a draft and needs rework in both the API and the implementation.
|
||||
|
||||
#![allow(dead_code)] // TODO: this module isn't finished
|
||||
#![allow(unused_variables)] // TODO: this module isn't finished
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::ptr;
|
||||
use std::sync::Arc;
|
||||
|
@ -463,7 +463,10 @@ pub enum SurfaceCreationError {
|
||||
OomError(OomError),
|
||||
|
||||
/// The extension required for this function was not enabled.
|
||||
MissingExtension { name: &'static str },
|
||||
MissingExtension {
|
||||
/// Name of the missing extension.
|
||||
name: &'static str
|
||||
},
|
||||
}
|
||||
|
||||
impl error::Error for SurfaceCreationError {
|
||||
@ -658,15 +661,22 @@ impl Iterator for SupportedPresentModesIter {
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum SurfaceTransform {
|
||||
/// Don't transform the image.
|
||||
Identity = vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
|
||||
/// Rotate 90 degrees.
|
||||
Rotate90 = vk::SURFACE_TRANSFORM_ROTATE_90_BIT_KHR,
|
||||
/// Rotate 180 degrees.
|
||||
Rotate180 = vk::SURFACE_TRANSFORM_ROTATE_180_BIT_KHR,
|
||||
/// Rotate 270 degrees.
|
||||
Rotate270 = vk::SURFACE_TRANSFORM_ROTATE_270_BIT_KHR,
|
||||
/// Mirror the image horizontally.
|
||||
HorizontalMirror = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR,
|
||||
/// Mirror the image horizontally and rotate 90 degrees.
|
||||
HorizontalMirrorRotate90 = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR,
|
||||
/// Mirror the image horizontally and rotate 180 degrees.
|
||||
HorizontalMirrorRotate180 = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR,
|
||||
/// Mirror the image horizontally and rotate 270 degrees.
|
||||
HorizontalMirrorRotate270 = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR,
|
||||
|
||||
/// Let the operating system or driver implementation choose.
|
||||
Inherit = vk::SURFACE_TRANSFORM_INHERIT_BIT_KHR,
|
||||
}
|
||||
@ -778,7 +788,7 @@ impl Default for SurfaceTransform {
|
||||
}
|
||||
}
|
||||
|
||||
// How the alpha values of the pixels of the window are treated.
|
||||
/// How the alpha values of the pixels of the window are treated.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[repr(u32)]
|
||||
pub enum CompositeAlpha {
|
||||
@ -799,7 +809,10 @@ pub enum CompositeAlpha {
|
||||
}
|
||||
|
||||
/// List of supported composite alpha modes.
|
||||
///
|
||||
/// See the docs of `CompositeAlpha`.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
#[allow(missing_docs)]
|
||||
pub struct SupportedCompositeAlpha {
|
||||
pub opaque: bool,
|
||||
pub pre_multiplied: bool,
|
||||
@ -864,8 +877,10 @@ impl Iterator for SupportedCompositeAlphaIter {
|
||||
}
|
||||
}
|
||||
|
||||
/// How the presentation engine should interpret the data.
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum ColorSpace {
|
||||
/// Interpret it as sRGB.
|
||||
SrgbNonLinear,
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ impl Swapchain {
|
||||
|
||||
let swapchain = unsafe {
|
||||
let (sh_mode, sh_count, sh_indices) = match sharing {
|
||||
SharingMode::Exclusive(id) => (vk::SHARING_MODE_EXCLUSIVE, 0, ptr::null()),
|
||||
SharingMode::Exclusive(_) => (vk::SHARING_MODE_EXCLUSIVE, 0, ptr::null()),
|
||||
SharingMode::Concurrent(ref ids) => (vk::SHARING_MODE_CONCURRENT, ids.len() as u32,
|
||||
ids.as_ptr()),
|
||||
};
|
||||
@ -334,6 +334,7 @@ impl Swapchain {
|
||||
}*/
|
||||
// TODO: the design of this functions depends on https://github.com/KhronosGroup/Vulkan-Docs/issues/155
|
||||
#[inline]
|
||||
#[doc(hidden)]
|
||||
pub fn image_semaphore(&self, id: u32, semaphore: Arc<Semaphore>) -> Option<Arc<Semaphore>> {
|
||||
let mut semaphores = self.images_semaphores.lock().unwrap();
|
||||
mem::replace(&mut semaphores[id as usize], Some(semaphore))
|
||||
|
@ -92,6 +92,7 @@ pub enum Sharing<I> where I: Iterator<Item = u32> {
|
||||
macro_rules! pipeline_stages {
|
||||
($($elem:ident => $val:expr,)+) => (
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[allow(missing_docs)]
|
||||
pub struct PipelineStages {
|
||||
$(
|
||||
pub $elem: bool,
|
||||
@ -99,6 +100,7 @@ macro_rules! pipeline_stages {
|
||||
}
|
||||
|
||||
impl PipelineStages {
|
||||
/// Builds an `PipelineStages` struct with none of the stages set.
|
||||
pub fn none() -> PipelineStages {
|
||||
PipelineStages {
|
||||
$(
|
||||
@ -145,6 +147,7 @@ pipeline_stages!{
|
||||
macro_rules! access_flags {
|
||||
($($elem:ident => $val:expr,)+) => (
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[allow(missing_docs)]
|
||||
pub struct AccessFlagBits {
|
||||
$(
|
||||
pub $elem: bool,
|
||||
@ -152,6 +155,7 @@ macro_rules! access_flags {
|
||||
}
|
||||
|
||||
impl AccessFlagBits {
|
||||
/// Builds an `AccessFlagBits` struct with all bits set.
|
||||
pub fn all() -> AccessFlagBits {
|
||||
AccessFlagBits {
|
||||
$(
|
||||
@ -160,6 +164,7 @@ macro_rules! access_flags {
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds an `AccessFlagBits` struct with none of the bits set.
|
||||
pub fn none() -> AccessFlagBits {
|
||||
AccessFlagBits {
|
||||
$(
|
||||
|
Loading…
Reference in New Issue
Block a user