1
0
Fork 0
forked from wry/wry

Merge pull request #832 from mahkoh/jorth/vulkan-fixes-2

Various vulkan fixes
This commit is contained in:
mahkoh 2026-03-23 19:21:18 +01:00 committed by GitHub
commit 2dbf6aa483
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 6 deletions

View file

@ -100,10 +100,12 @@ impl VulkanAllocation {
}
fn incoherent_range(&self, mask: u64) -> MappedMemoryRange<'static> {
let lo = self.offset & !mask;
let hi = (self.offset + self.size + mask) & !mask;
MappedMemoryRange::default()
.memory(self.memory)
.offset(self.offset & !mask)
.size((self.size + mask) & !mask)
.offset(lo)
.size(hi - lo)
}
fn device(&self) -> &VulkanDevice {

View file

@ -2304,6 +2304,9 @@ where
}
let x2 = x2.min(fb.width as i32);
let y2 = y2.min(fb.height as i32);
if x1 == x2 || y1 == y2 {
return None;
}
Some([x1, y1, x2, y2])
}

View file

@ -258,7 +258,10 @@ impl VulkanShmImage {
TransferType::Upload => AccessFlags2::SHADER_SAMPLED_READ,
TransferType::Download => AccessFlags2::COLOR_ATTACHMENT_WRITE,
})
.dst_stage_mask(PipelineStageFlags2::FRAGMENT_SHADER);
.dst_stage_mask(match tt {
TransferType::Upload => PipelineStageFlags2::FRAGMENT_SHADER,
TransferType::Download => PipelineStageFlags2::COLOR_ATTACHMENT_OUTPUT,
});
}
let final_buffer_barrier = memory_barrier(true);
let final_dep_info = DependencyInfoKHR::default()

View file

@ -54,9 +54,12 @@ pub struct VulkanShmImageAsyncData {
impl VulkanShmImageAsyncData {
fn complete(&self, result: Result<(), VulkanError>) {
self.busy.set(false);
if let Some(staging) = self.staging.take() {
staging.busy.set(false);
let staging = self.staging.take();
if result.is_ok() {
self.busy.set(false);
if let Some(staging) = staging {
staging.busy.set(false);
}
}
self.buffer.take();
self.client_mem.take();
@ -676,6 +679,7 @@ fn complete_async_host_copy(
store(data);
if let Err(e) = res {
data.complete(Err(VulkanError::AsyncCopyToStaging(e)));
return;
}
data.data_copied.set(true);
match tt {