1
0
Fork 0
forked from wry/wry

Merge pull request #686 from mahkoh/jorth/vulkan-tex-in-order

vulkan: don't swap order of texture operations
This commit is contained in:
mahkoh 2025-12-15 13:19:20 +01:00 committed by GitHub
commit 9448fcde19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -201,6 +201,7 @@ enum VulkanOp {
struct VulkanTexOp { struct VulkanTexOp {
tex: Rc<VulkanImage>, tex: Rc<VulkanImage>,
index: usize,
range: Range<usize>, range: Range<usize>,
buffer_resv: Option<Rc<dyn BufferResv>>, buffer_resv: Option<Rc<dyn BufferResv>>,
acquire_sync: Option<AcquireSync>, acquire_sync: Option<AcquireSync>,
@ -719,13 +720,13 @@ impl VulkanRenderer {
#[derive(Eq, PartialEq, PartialOrd, Ord)] #[derive(Eq, PartialEq, PartialOrd, Ord)]
enum Key { enum Key {
Fill { color: [u32; 4] }, Fill { color: [u32; 4] },
Tex, Tex(usize),
} }
match o { match o {
VulkanOp::Fill(f) => Key::Fill { VulkanOp::Fill(f) => Key::Fill {
color: f.color.map(|c| c.to_bits()), color: f.color.map(|c| c.to_bits()),
}, },
VulkanOp::Tex(_) => Key::Tex, VulkanOp::Tex(t) => Key::Tex(t.index),
} }
}); });
let mops = &mut memory.ops[pass]; let mops = &mut memory.ops[pass];
@ -765,7 +766,7 @@ impl VulkanRenderer {
} }
} }
}; };
for op in opts { for (index, op) in opts.into_iter().enumerate() {
match op { match op {
GfxApiOpt::Sync => { GfxApiOpt::Sync => {
sync(memory); sync(memory);
@ -874,6 +875,7 @@ impl VulkanRenderer {
); );
ops.push(VulkanOp::Tex(VulkanTexOp { ops.push(VulkanOp::Tex(VulkanTexOp {
tex: tex.clone(), tex: tex.clone(),
index,
range: lo..hi, range: lo..hi,
buffer_resv: ct.buffer_resv.clone(), buffer_resv: ct.buffer_resv.clone(),
acquire_sync: Some(ct.acquire_sync.clone()), acquire_sync: Some(ct.acquire_sync.clone()),