mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-25 16:25:31 +00:00
Rename FormatMarker to FormatDesc
This commit is contained in:
parent
ddcb8cf402
commit
6a0bc14061
@ -11,8 +11,8 @@ use descriptor_set::PipelineLayoutDesc;
|
||||
use descriptor_set::DescriptorSetsCollection;
|
||||
use device::Queue;
|
||||
use format::ClearValue;
|
||||
use format::FloatOrCompressedFormatMarker;
|
||||
use format::FloatFormatMarker;
|
||||
use format::FloatOrCompressedFormatDesc;
|
||||
use format::FloatFormatDesc;
|
||||
use format::StrongStorage;
|
||||
use framebuffer::Framebuffer;
|
||||
use framebuffer::RenderPass;
|
||||
@ -284,13 +284,13 @@ impl InnerCommandBufferBuilder {
|
||||
///
|
||||
pub unsafe fn clear_color_image<'a, Ty, F, M>(self, image: &Arc<Image<Ty, F, M>>,
|
||||
color: F::ClearValue) -> InnerCommandBufferBuilder
|
||||
where Ty: ImageTypeMarker, F: FloatFormatMarker
|
||||
where Ty: ImageTypeMarker, F: FloatFormatDesc
|
||||
{
|
||||
let color = match color.into() {
|
||||
ClearValue::Float(data) => vk::ClearColorValue::float32(data),
|
||||
ClearValue::Int(data) => vk::ClearColorValue::int32(data),
|
||||
ClearValue::Uint(data) => vk::ClearColorValue::uint32(data),
|
||||
_ => unreachable!() // FloatOrCompressedFormatMarker has been improperly implemented
|
||||
_ => unreachable!() // FloatOrCompressedFormatDesc has been improperly implemented
|
||||
};
|
||||
|
||||
let range = vk::ImageSubresourceRange {
|
||||
@ -321,7 +321,7 @@ impl InnerCommandBufferBuilder {
|
||||
///
|
||||
pub unsafe fn copy_buffer_to_color_image<S, Ty, F, Im>(self, source: S, image: &Arc<Image<Ty, F, Im>>)
|
||||
-> InnerCommandBufferBuilder
|
||||
where S: Into<BufferSlice<[F::Pixel]>>, F: StrongStorage + FloatOrCompressedFormatMarker,
|
||||
where S: Into<BufferSlice<[F::Pixel]>>, F: StrongStorage + FloatOrCompressedFormatDesc,
|
||||
Ty: ImageTypeMarker
|
||||
{
|
||||
let source = source.into();
|
||||
|
@ -8,8 +8,8 @@ use command_buffer::inner::InnerCommandBuffer;
|
||||
use descriptor_set::PipelineLayoutDesc;
|
||||
use descriptor_set::DescriptorSetsCollection;
|
||||
use device::Queue;
|
||||
use format::FloatOrCompressedFormatMarker;
|
||||
use format::FloatFormatMarker;
|
||||
use format::FloatOrCompressedFormatDesc;
|
||||
use format::FloatFormatDesc;
|
||||
use format::StrongStorage;
|
||||
use framebuffer::Framebuffer;
|
||||
use framebuffer::RenderPass;
|
||||
@ -114,7 +114,7 @@ impl PrimaryCommandBufferBuilder {
|
||||
|
||||
pub fn copy_buffer_to_color_image<S, Ty, F, Im>(self, source: S, destination: &Arc<Image<Ty, F, Im>>)
|
||||
-> PrimaryCommandBufferBuilder
|
||||
where S: Into<BufferSlice<[F::Pixel]>>, F: StrongStorage + FloatOrCompressedFormatMarker,
|
||||
where S: Into<BufferSlice<[F::Pixel]>>, F: StrongStorage + FloatOrCompressedFormatDesc,
|
||||
Ty: ImageTypeMarker
|
||||
{
|
||||
unsafe {
|
||||
@ -128,7 +128,7 @@ impl PrimaryCommandBufferBuilder {
|
||||
/// Note that compressed formats are not supported.
|
||||
pub fn clear_color_image<'a, Ty, F, M>(self, image: &Arc<Image<Ty, F, M>>,
|
||||
color: F::ClearValue) -> PrimaryCommandBufferBuilder
|
||||
where Ty: ImageTypeMarker, F: FloatFormatMarker
|
||||
where Ty: ImageTypeMarker, F: FloatFormatDesc
|
||||
{
|
||||
unsafe {
|
||||
PrimaryCommandBufferBuilder {
|
||||
|
@ -5,7 +5,7 @@
|
||||
//! This module contains three things:
|
||||
//!
|
||||
//! - The `Format` enumeration, which contains all the available formats.
|
||||
//! - The `FormatMarker` trait.
|
||||
//! - The `FormatDesc` trait.
|
||||
//! - One struct for each format.
|
||||
//!
|
||||
//! # Formats
|
||||
@ -166,7 +166,7 @@ macro_rules! formats {
|
||||
);
|
||||
|
||||
(__inner_impl__ $name:ident float=$num:expr) => {
|
||||
unsafe impl FormatMarker for $name {
|
||||
unsafe impl FormatDesc for $name {
|
||||
type ClearValue = [f32; $num];
|
||||
|
||||
#[inline]
|
||||
@ -174,12 +174,12 @@ macro_rules! formats {
|
||||
Format::$name
|
||||
}
|
||||
}
|
||||
unsafe impl FloatFormatMarker for $name {}
|
||||
unsafe impl FloatOrCompressedFormatMarker for $name {}
|
||||
unsafe impl FloatFormatDesc for $name {}
|
||||
unsafe impl FloatOrCompressedFormatDesc for $name {}
|
||||
};
|
||||
|
||||
(__inner_impl__ $name:ident uint=$num:expr) => {
|
||||
unsafe impl FormatMarker for $name {
|
||||
unsafe impl FormatDesc for $name {
|
||||
type ClearValue = [u32; $num];
|
||||
|
||||
#[inline]
|
||||
@ -188,11 +188,11 @@ macro_rules! formats {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl UintFormatMarker for $name {}
|
||||
unsafe impl UintFormatDesc for $name {}
|
||||
};
|
||||
|
||||
(__inner_impl__ $name:ident sint=$num:expr) => {
|
||||
unsafe impl FormatMarker for $name {
|
||||
unsafe impl FormatDesc for $name {
|
||||
type ClearValue = [i32; $num];
|
||||
|
||||
#[inline]
|
||||
@ -201,11 +201,11 @@ macro_rules! formats {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl SintFormatMarker for $name {}
|
||||
unsafe impl SintFormatDesc for $name {}
|
||||
};
|
||||
|
||||
(__inner_impl__ $name:ident depth) => {
|
||||
unsafe impl FormatMarker for $name {
|
||||
unsafe impl FormatDesc for $name {
|
||||
type ClearValue = f32;
|
||||
|
||||
#[inline]
|
||||
@ -214,11 +214,11 @@ macro_rules! formats {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl DepthFormatMarker for $name {}
|
||||
unsafe impl DepthFormatDesc for $name {}
|
||||
};
|
||||
|
||||
(__inner_impl__ $name:ident stencil) => {
|
||||
unsafe impl FormatMarker for $name {
|
||||
unsafe impl FormatDesc for $name {
|
||||
type ClearValue = u32; // FIXME: shouldn't stencil be i32?
|
||||
|
||||
#[inline]
|
||||
@ -227,11 +227,11 @@ macro_rules! formats {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl StencilFormatMarker for $name {}
|
||||
unsafe impl StencilFormatDesc for $name {}
|
||||
};
|
||||
|
||||
(__inner_impl__ $name:ident depthstencil) => {
|
||||
unsafe impl FormatMarker for $name {
|
||||
unsafe impl FormatDesc for $name {
|
||||
type ClearValue = (f32, u32); // FIXME: shouldn't stencil be i32?
|
||||
|
||||
#[inline]
|
||||
@ -240,11 +240,11 @@ macro_rules! formats {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl DepthStencilFormatMarker for $name {}
|
||||
unsafe impl DepthStencilFormatDesc for $name {}
|
||||
};
|
||||
|
||||
(__inner_impl__ $name:ident compressed) => {
|
||||
unsafe impl FormatMarker for $name {
|
||||
unsafe impl FormatDesc for $name {
|
||||
type ClearValue = [f32; 4];
|
||||
|
||||
#[inline]
|
||||
@ -253,8 +253,8 @@ macro_rules! formats {
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl CompressedFormatMarker for $name {}
|
||||
unsafe impl FloatOrCompressedFormatMarker for $name {}
|
||||
unsafe impl CompressedFormatDesc for $name {}
|
||||
unsafe impl FloatOrCompressedFormatDesc for $name {}
|
||||
};
|
||||
|
||||
(__inner_ty__ $name:ident float=$num:tt) => { FormatTy::Float };
|
||||
@ -462,22 +462,22 @@ formats! {
|
||||
ASTC_12x12SrgbBlock => FORMAT_ASTC_12x12_SRGB_BLOCK [compressed] {},
|
||||
}
|
||||
|
||||
pub unsafe trait FormatMarker {
|
||||
pub unsafe trait FormatDesc {
|
||||
type ClearValue: Into<ClearValue>;
|
||||
|
||||
fn format(&self) -> Format;
|
||||
}
|
||||
|
||||
pub unsafe trait FloatFormatMarker: FormatMarker {}
|
||||
pub unsafe trait UintFormatMarker: FormatMarker {}
|
||||
pub unsafe trait SintFormatMarker: FormatMarker {}
|
||||
pub unsafe trait DepthFormatMarker: FormatMarker {}
|
||||
pub unsafe trait StencilFormatMarker: FormatMarker {}
|
||||
pub unsafe trait DepthStencilFormatMarker: FormatMarker {}
|
||||
pub unsafe trait CompressedFormatMarker: FormatMarker {}
|
||||
pub unsafe trait FloatOrCompressedFormatMarker: FormatMarker {}
|
||||
pub unsafe trait FloatFormatDesc: FormatDesc {}
|
||||
pub unsafe trait UintFormatDesc: FormatDesc {}
|
||||
pub unsafe trait SintFormatDesc: FormatDesc {}
|
||||
pub unsafe trait DepthFormatDesc: FormatDesc {}
|
||||
pub unsafe trait StencilFormatDesc: FormatDesc {}
|
||||
pub unsafe trait DepthStencilFormatDesc: FormatDesc {}
|
||||
pub unsafe trait CompressedFormatDesc: FormatDesc {}
|
||||
pub unsafe trait FloatOrCompressedFormatDesc: FormatDesc {}
|
||||
|
||||
pub unsafe trait StrongStorage: FormatMarker {
|
||||
pub unsafe trait StrongStorage: FormatDesc {
|
||||
type Pixel: Copy;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ use std::sync::Arc;
|
||||
use device::Device;
|
||||
use format::ClearValue;
|
||||
use format::Format;
|
||||
use format::FormatMarker;
|
||||
use format::FormatDesc;
|
||||
use image::AbstractImageView;
|
||||
use image::Layout as ImageLayout;
|
||||
|
||||
@ -289,7 +289,7 @@ macro_rules! single_pass_renderpass {
|
||||
|
||||
struct Layout;
|
||||
unsafe impl $crate::framebuffer::RenderPassLayout for Layout {
|
||||
type ClearValues = ($(<$crate::format::$format as $crate::format::FormatMarker>::ClearValue,)*);
|
||||
type ClearValues = ($(<$crate::format::$format as $crate::format::FormatDesc>::ClearValue,)*);
|
||||
type ClearValuesIter = std::vec::IntoIter<$crate::format::ClearValue>;
|
||||
type AttachmentsDescIter = std::vec::IntoIter<$crate::framebuffer::AttachmentDescription>;
|
||||
type PassesIter = std::option::IntoIter<$crate::framebuffer::PassDescription>;
|
||||
@ -313,7 +313,7 @@ macro_rules! single_pass_renderpass {
|
||||
vec![
|
||||
$(
|
||||
$crate::framebuffer::AttachmentDescription {
|
||||
format: $crate::format::FormatMarker::format(&$crate::format::$format), // FIXME: only works with markers
|
||||
format: $crate::format::FormatDesc::format(&$crate::format::$format), // FIXME: only works with markers
|
||||
samples: 1, // FIXME:
|
||||
load: $crate::framebuffer::LoadOp::$load,
|
||||
store: $crate::framebuffer::StoreOp::$store,
|
||||
|
@ -22,7 +22,7 @@ use std::vec::IntoIter as VecIntoIter;
|
||||
use command_buffer::CommandBufferPool;
|
||||
use device::Device;
|
||||
use device::Queue;
|
||||
use format::FormatMarker;
|
||||
use format::FormatDesc;
|
||||
use memory::ChunkProperties;
|
||||
use memory::ChunkRange;
|
||||
use memory::MemorySource;
|
||||
@ -96,7 +96,7 @@ pub unsafe trait AbstractImageView: Resource + ::VulkanObjectU64 {
|
||||
// IMPORTANT: we transmute some Arc<AbstractTypedImageView> into Arc<AbstractImageView>, so
|
||||
// the signature of AbstractTypedImageView should never require another trait
|
||||
pub unsafe trait AbstractTypedImageView<Ty, F>: AbstractImageView
|
||||
where Ty: ImageTypeMarker, F: FormatMarker
|
||||
where Ty: ImageTypeMarker, F: FormatDesc
|
||||
{
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ pub struct Image<Ty, F, M> where Ty: ImageTypeMarker {
|
||||
}
|
||||
|
||||
impl<Ty, F, M> Image<Ty, F, M>
|
||||
where M: MemorySourceChunk, Ty: ImageTypeMarker, F: FormatMarker
|
||||
where M: MemorySourceChunk, Ty: ImageTypeMarker, F: FormatDesc
|
||||
{
|
||||
/// Creates a new image and allocates memory for it.
|
||||
///
|
||||
@ -474,7 +474,7 @@ pub struct ImagePrototype<Ty, F, M> where Ty: ImageTypeMarker {
|
||||
}
|
||||
|
||||
impl<Ty, F, M> ImagePrototype<Ty, F, M>
|
||||
where M: MemorySourceChunk, Ty: ImageTypeMarker, F: FormatMarker
|
||||
where M: MemorySourceChunk, Ty: ImageTypeMarker, F: FormatDesc
|
||||
{
|
||||
/// Returns the dimensions of this image.
|
||||
#[inline]
|
||||
@ -679,7 +679,7 @@ impl<Ty, F, M> ImageView<Ty, F, M> where Ty: ImageTypeMarker {
|
||||
/// Note that you must create the view with identity swizzling if you want to use this view
|
||||
/// as a framebuffer attachment.
|
||||
pub fn new(image: &Arc<Image<Ty, F, M>>) -> Result<Arc<ImageView<Ty, F, M>>, OomError>
|
||||
where F: FormatMarker
|
||||
where F: FormatDesc
|
||||
{
|
||||
let vk = image.device.pointers();
|
||||
|
||||
@ -820,7 +820,7 @@ unsafe impl<Ty, F, M> AbstractImageView for ImageView<Ty, F, M>
|
||||
}
|
||||
|
||||
unsafe impl<Ty, F, M> AbstractTypedImageView<Ty, F> for ImageView<Ty, F, M>
|
||||
where Ty: ImageTypeMarker, F: FormatMarker, M: MemorySourceChunk
|
||||
where Ty: ImageTypeMarker, F: FormatDesc, M: MemorySourceChunk
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ use std::ptr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use format::Format;
|
||||
use format::FormatMarker;
|
||||
use format::FormatDesc;
|
||||
use image::Usage as ImageUsage;
|
||||
use instance::Instance;
|
||||
use instance::PhysicalDevice;
|
||||
|
@ -7,7 +7,7 @@ use std::sync::Mutex;
|
||||
|
||||
use device::Device;
|
||||
use device::Queue;
|
||||
use format::FormatMarker;
|
||||
use format::FormatDesc;
|
||||
use image::Image;
|
||||
use image::ImagePrototype;
|
||||
use image::Type2d;
|
||||
@ -66,7 +66,7 @@ impl Swapchain {
|
||||
dimensions: [u32; 2], layers: u32, usage: &ImageUsage, sharing: S,
|
||||
transform: SurfaceTransform, alpha: CompositeAlpha, mode: PresentMode,
|
||||
clipped: bool) -> Result<(Arc<Swapchain>, Vec<ImagePrototype<Type2d, F, SwapchainAllocatedChunk>>), OomError>
|
||||
where F: FormatMarker + Clone, S: Into<SharingMode>
|
||||
where F: FormatDesc + Clone, S: Into<SharingMode>
|
||||
{
|
||||
Swapchain::new_inner(device, surface, num_images, format, dimensions, layers, usage,
|
||||
sharing, transform, alpha, mode, clipped)
|
||||
@ -79,7 +79,7 @@ impl Swapchain {
|
||||
dimensions: [u32; 2], layers: u32, usage: &ImageUsage, sharing: S,
|
||||
transform: SurfaceTransform, alpha: CompositeAlpha, mode: PresentMode,
|
||||
clipped: bool) -> Result<(Arc<Swapchain>, Vec<ImagePrototype<Type2d, F, SwapchainAllocatedChunk>>), OomError>
|
||||
where F: FormatMarker + Clone, S: Into<SharingMode>
|
||||
where F: FormatDesc + Clone, S: Into<SharingMode>
|
||||
{
|
||||
// FIXME: check that the parameters are supported
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user