aboutsummaryrefslogtreecommitdiff
path: root/stockton-skeleton/src/buffers
diff options
context:
space:
mode:
Diffstat (limited to 'stockton-skeleton/src/buffers')
-rw-r--r--stockton-skeleton/src/buffers/image.rs16
-rw-r--r--stockton-skeleton/src/buffers/staged.rs4
-rw-r--r--stockton-skeleton/src/buffers/staging.rs4
3 files changed, 8 insertions, 16 deletions
diff --git a/stockton-skeleton/src/buffers/image.rs b/stockton-skeleton/src/buffers/image.rs
index 4278585..820561f 100644
--- a/stockton-skeleton/src/buffers/image.rs
+++ b/stockton-skeleton/src/buffers/image.rs
@@ -73,7 +73,7 @@ impl<P: MemoryPool> BoundImageView<P> {
.write()
.map_err(|_| LockPoisoned::MemoryPool)?;
- let mut device = context.device().write().map_err(|_| LockPoisoned::Device)?;
+ let mut device = context.lock_device()?;
let row_alignment_mask = context
.physical_device_properties()
.limits
@@ -149,11 +149,7 @@ impl<P: MemoryPool> BoundImageView<P> {
/// Destroy all vulkan objects. Must be called before dropping.
pub fn deactivate_with_context(self, context: &mut RenderingContext) {
- let mut device = context
- .device()
- .write()
- .map_err(|_| LockPoisoned::Device)
- .unwrap();
+ let mut device = context.lock_device().unwrap();
let mut pool = context
.existing_memory_pool::<P>()
.unwrap()
@@ -227,7 +223,7 @@ impl<P: MemoryPool> SampledImage<P> {
.write()
.map_err(|_| LockPoisoned::MemoryPool)?;
- let mut device = context.device().write().map_err(|_| LockPoisoned::Device)?;
+ let mut device = context.lock_device()?;
let row_alignment_mask = context
.physical_device_properties()
.limits
@@ -267,11 +263,7 @@ impl<P: MemoryPool> SampledImage<P> {
/// Destroy all vulkan objects. Must be called before dropping.
pub fn deactivate_with_context(self, context: &mut RenderingContext) {
- let mut device = context
- .device()
- .write()
- .map_err(|_| LockPoisoned::Device)
- .unwrap();
+ let mut device = context.lock_device().unwrap();
let mut pool = context
.existing_memory_pool::<P>()
.unwrap()
diff --git a/stockton-skeleton/src/buffers/staged.rs b/stockton-skeleton/src/buffers/staged.rs
index ec42102..2ece045 100644
--- a/stockton-skeleton/src/buffers/staged.rs
+++ b/stockton-skeleton/src/buffers/staged.rs
@@ -56,7 +56,7 @@ where
context.ensure_memory_pool::<SP>()?;
// Lock the device and memory pools
- let mut device = context.device().write().map_err(|_| LockPoisoned::Device)?;
+ let mut device = context.lock_device()?;
let mut mempool = context
.existing_memory_pool::<P>()
.unwrap()
@@ -111,7 +111,7 @@ where
/// Destroy all Vulkan objects. Should be called before dropping.
pub fn deactivate(mut self, context: &mut RenderingContext) {
unsafe {
- let device = &mut *context.device().write().unwrap();
+ let device = &mut *context.lock_device().unwrap();
self.staged_memory.unmap(device).unwrap();
diff --git a/stockton-skeleton/src/buffers/staging.rs b/stockton-skeleton/src/buffers/staging.rs
index 44d0c2d..35cac00 100644
--- a/stockton-skeleton/src/buffers/staging.rs
+++ b/stockton-skeleton/src/buffers/staging.rs
@@ -27,7 +27,7 @@ where
pub fn from_context(context: &mut RenderingContext, size: u64) -> Result<Self> {
context.ensure_memory_pool::<P>()?;
- let mut device = context.device().write().map_err(|_| LockPoisoned::Device)?;
+ let mut device = context.lock_device()?;
let mut mempool = context
.existing_memory_pool()
.unwrap()
@@ -70,7 +70,7 @@ where
}
pub fn deactivate_context(self, context: &mut RenderingContext) {
- let mut device = context.device().write().unwrap();
+ let mut device = context.lock_device().unwrap();
let mut mempool = context.existing_memory_pool().unwrap().write().unwrap();
self.deactivate_device_pool(&mut device, &mut mempool)