Implement all trait methods of Resource

This commit is contained in:
Pierre Krieger 2016-02-18 15:12:55 +01:00
parent 7175a0b5b5
commit d15f34a580
2 changed files with 32 additions and 1 deletions

View File

@ -209,6 +209,16 @@ impl<T, M> Buffer<[T], M> {
}
unsafe impl<T: ?Sized, M> Resource for Buffer<T, M> where M: MemorySourceChunk {
#[inline]
fn requires_fence(&self) -> bool {
self.inner.memory.requires_fence()
}
#[inline]
fn requires_semaphore(&self) -> bool {
self.inner.memory.requires_semaphore()
}
#[inline]
fn sharing_mode(&self) -> &SharingMode {
&self.inner.sharing

View File

@ -358,9 +358,30 @@ impl<Ty, F, M> Image<Ty, F, M>
}
}
impl<Ty, F, M> VulkanObject for Image<Ty, F, M>
where Ty: ImageTypeMarker
{
type Object = vk::Image;
#[inline]
fn internal_object(&self) -> vk::Image {
self.image
}
}
unsafe impl<Ty, F, M> Resource for Image<Ty, F, M>
where Ty: ImageTypeMarker, M: MemorySourceChunk
{
#[inline]
fn requires_fence(&self) -> bool {
self.memory.requires_fence()
}
#[inline]
fn requires_semaphore(&self) -> bool {
self.memory.requires_semaphore()
}
#[inline]
fn sharing_mode(&self) -> &SharingMode {
&self.sharing
@ -372,7 +393,7 @@ unsafe impl<Ty, F, M> Resource for Image<Ty, F, M>
-> (Option<Arc<Semaphore>>, Option<Arc<Semaphore>>)
{
let out = self.memory.gpu_access(write, 0, self.memory.size(), queue, fence, semaphore);
// FIXME: if the image is still in its initial transition phase, we need to return a second semaphore
// FIXME: if the image is in its initial transition phase, we need to return a second semaphore
(out, None)
}
}