The VulkanObject trait is now unsafe

This commit is contained in:
Pierre Krieger 2016-02-20 15:40:33 +01:00
parent d5f3409247
commit 1f4d950404
15 changed files with 27 additions and 27 deletions

View File

@ -388,7 +388,7 @@ unsafe impl<'a, T: ?Sized, M> CpuWriteAccessible<'a, T> for Buffer<T, M>
}
}
impl<T: ?Sized, M> VulkanObject for Buffer<T, M> {
unsafe impl<T: ?Sized, M> VulkanObject for Buffer<T, M> {
type Object = vk::Buffer;
#[inline]
@ -550,7 +550,7 @@ impl<'a, T: 'a, M: 'a> BufferSlice<'a, [T], M> {
}
}
impl<'a, T: ?Sized, M> VulkanObject for BufferSlice<'a, T, M> {
unsafe impl<'a, T: ?Sized, M> VulkanObject for BufferSlice<'a, T, M> {
type Object = vk::Buffer;
#[inline]

View File

@ -71,7 +71,7 @@ impl CommandBufferPool {
}
}
impl VulkanObject for CommandBufferPool {
unsafe impl VulkanObject for CommandBufferPool {
type Object = vk::CommandPool;
#[inline]

View File

@ -383,7 +383,7 @@ impl<S> DescriptorSet<S> where S: DescriptorSetDesc {
}
}
impl<S> VulkanObject for DescriptorSet<S> {
unsafe impl<S> VulkanObject for DescriptorSet<S> {
type Object = vk::DescriptorSet;
#[inline]
@ -447,7 +447,7 @@ impl<S> DescriptorSetLayout<S> where S: DescriptorSetDesc {
}
}
impl<S> VulkanObject for DescriptorSetLayout<S> {
unsafe impl<S> VulkanObject for DescriptorSetLayout<S> {
type Object = vk::DescriptorSetLayout;
#[inline]
@ -513,7 +513,7 @@ impl<P> PipelineLayout<P> where P: PipelineLayoutDesc {
}
}
impl<P> VulkanObject for PipelineLayout<P> {
unsafe impl<P> VulkanObject for PipelineLayout<P> {
type Object = vk::PipelineLayout;
#[inline]

View File

@ -204,7 +204,7 @@ impl fmt::Debug for Device {
}
}
impl VulkanObject for Device {
unsafe impl VulkanObject for Device {
type Object = vk::Device;
#[inline]
@ -305,7 +305,7 @@ impl Queue {
}
}
impl VulkanObject for Queue {
unsafe impl VulkanObject for Queue {
type Object = vk::Queue;
#[inline]

View File

@ -315,7 +315,7 @@ impl<L> RenderPass<L> where L: RenderPassLayout {
}
}
impl<L> VulkanObject for RenderPass<L> {
unsafe impl<L> VulkanObject for RenderPass<L> {
type Object = vk::RenderPass;
#[inline]
@ -443,7 +443,7 @@ impl<L> Framebuffer<L> {
}
}
impl<L> VulkanObject for Framebuffer<L> {
unsafe impl<L> VulkanObject for Framebuffer<L> {
type Object = vk::Framebuffer;
#[inline]

View File

@ -382,7 +382,7 @@ impl<Ty, F, M> Image<Ty, F, M>
}
}
impl<Ty, F, M> VulkanObject for Image<Ty, F, M>
unsafe impl<Ty, F, M> VulkanObject for Image<Ty, F, M>
where Ty: ImageTypeMarker
{
type Object = vk::Image;

View File

@ -248,7 +248,7 @@ impl fmt::Debug for Instance {
}
}
impl VulkanObject for Instance {
unsafe impl VulkanObject for Instance {
type Object = vk::Instance;
#[inline]
@ -552,7 +552,7 @@ impl PhysicalDevice {
}
}
impl VulkanObject for PhysicalDevice {
unsafe impl VulkanObject for PhysicalDevice {
type Object = vk::PhysicalDevice;
#[inline]

View File

@ -98,7 +98,7 @@ lazy_static! {
}
/// Gives access to the internal identifier of an object.
pub trait VulkanObject {
pub unsafe trait VulkanObject {
/// The type of the object.
type Object;
@ -108,15 +108,15 @@ pub trait VulkanObject {
// TODO: remove eventually
// https://github.com/rust-lang/rust/issues/29328
pub trait VulkanObjectU64 { fn internal_object(&self) -> u64; }
impl<T> VulkanObjectU64 for T where T: VulkanObject<Object = u64> {
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 trait VulkanObjectUsize { fn internal_object(&self) -> usize; }
impl<T> VulkanObjectUsize for T where T: VulkanObject<Object = usize> {
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) }
}

View File

@ -105,7 +105,7 @@ impl DeviceMemory {
}
}
impl VulkanObject for DeviceMemory {
unsafe impl VulkanObject for DeviceMemory {
type Object = vk::DeviceMemory;
#[inline]

View File

@ -105,7 +105,7 @@ impl PipelineCache {
}
}
impl VulkanObject for PipelineCache {
unsafe impl VulkanObject for PipelineCache {
type Object = vk::PipelineCache;
#[inline]

View File

@ -315,7 +315,7 @@ impl<MultiVertex, Layout> GraphicsPipeline<MultiVertex, Layout> {
impl<MultiVertex, Layout> GenericPipeline for GraphicsPipeline<MultiVertex, Layout> {
}
impl<MultiVertex, Layout> VulkanObject for GraphicsPipeline<MultiVertex, Layout> {
unsafe impl<MultiVertex, Layout> VulkanObject for GraphicsPipeline<MultiVertex, Layout> {
type Object = vk::Pipeline;
#[inline]

View File

@ -93,7 +93,7 @@ impl ShaderModule {
}
}
impl VulkanObject for ShaderModule {
unsafe impl VulkanObject for ShaderModule {
type Object = vk::ShaderModule;
#[inline]

View File

@ -212,7 +212,7 @@ impl Display {
}
}
impl VulkanObject for Display {
unsafe impl VulkanObject for Display {
type Object = vk::DisplayKHR;
#[inline]

View File

@ -236,7 +236,7 @@ impl Surface {
}
}
impl VulkanObject for Surface {
unsafe impl VulkanObject for Surface {
type Object = vk::SurfaceKHR;
#[inline]

View File

@ -187,7 +187,7 @@ impl Fence {
}
}
impl VulkanObject for Fence {
unsafe impl VulkanObject for Fence {
type Object = vk::Fence;
#[inline]
@ -242,7 +242,7 @@ impl Semaphore {
}
}
impl VulkanObject for Semaphore {
unsafe impl VulkanObject for Semaphore {
type Object = vk::Semaphore;
#[inline]
@ -336,7 +336,7 @@ impl Event {
}
}
impl VulkanObject for Event {
unsafe impl VulkanObject for Event {
type Object = vk::Event;
#[inline]