mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
BufferBarrier no longer depend on hal api struct, but directly on buffer type
This commit is contained in:
parent
cda9d9af65
commit
a4d9d38d03
@ -284,7 +284,7 @@ impl<A: HalApi> BufferTracker<A> {
|
||||
pub fn drain_transitions<'a, 'b: 'a>(
|
||||
&'b mut self,
|
||||
snatch_guard: &'a SnatchGuard<'a>,
|
||||
) -> impl Iterator<Item = BufferBarrier<'a, A>> {
|
||||
) -> impl Iterator<Item = BufferBarrier<'a, A::Buffer>> {
|
||||
let buffer_barriers = self.temp.drain(..).map(|pending| {
|
||||
let buf = unsafe { self.metadata.get_resource_unchecked(pending.id as _) };
|
||||
pending.into_hal(buf, snatch_guard)
|
||||
@ -557,7 +557,7 @@ impl<A: HalApi> DeviceBufferTracker<A> {
|
||||
&'a mut self,
|
||||
tracker: &'a BufferTracker<A>,
|
||||
snatch_guard: &'b SnatchGuard<'b>,
|
||||
) -> impl Iterator<Item = BufferBarrier<'a, A>> {
|
||||
) -> impl Iterator<Item = BufferBarrier<'a, A::Buffer>> {
|
||||
for index in tracker.metadata.owned_indices() {
|
||||
self.tracker_assert_in_bounds(index);
|
||||
|
||||
|
@ -261,7 +261,7 @@ impl PendingTransition<hal::BufferUses> {
|
||||
self,
|
||||
buf: &'a resource::Buffer<A>,
|
||||
snatch_guard: &'a SnatchGuard<'a>,
|
||||
) -> hal::BufferBarrier<'a, A> {
|
||||
) -> hal::BufferBarrier<'a, A::Buffer> {
|
||||
let buffer = buf.raw(snatch_guard).expect("Buffer is destroyed");
|
||||
hal::BufferBarrier {
|
||||
buffer,
|
||||
|
@ -310,7 +310,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
||||
|
||||
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||
where
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Api>>,
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Buffer>>,
|
||||
{
|
||||
self.temp.barriers.clear();
|
||||
|
||||
|
@ -301,7 +301,7 @@ impl crate::CommandEncoder for Encoder {
|
||||
|
||||
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||
where
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, Api>>,
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, Resource>>,
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
||||
|
||||
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||
where
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Api>>,
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Buffer>>,
|
||||
{
|
||||
if !self
|
||||
.private_caps
|
||||
|
@ -1103,7 +1103,7 @@ pub trait CommandEncoder: WasmNotSendSync + fmt::Debug {
|
||||
|
||||
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||
where
|
||||
T: Iterator<Item = BufferBarrier<'a, Self::A>>;
|
||||
T: Iterator<Item = BufferBarrier<'a, <Self::A as Api>::Buffer>>;
|
||||
|
||||
unsafe fn transition_textures<'a, T>(&mut self, barriers: T)
|
||||
where
|
||||
@ -1975,8 +1975,8 @@ pub struct Rect<T> {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct BufferBarrier<'a, A: Api> {
|
||||
pub buffer: &'a A::Buffer,
|
||||
pub struct BufferBarrier<'a, B: DynBuffer + ?Sized> {
|
||||
pub buffer: &'a B,
|
||||
pub usage: Range<BufferUses>,
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
||||
|
||||
unsafe fn transition_buffers<'a, T>(&mut self, _barriers: T)
|
||||
where
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Api>>,
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Buffer>>,
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
||||
|
||||
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||
where
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Api>>,
|
||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Buffer>>,
|
||||
{
|
||||
//Note: this is done so that we never end up with empty stage flags
|
||||
let mut src_stages = vk::PipelineStageFlags::TOP_OF_PIPE;
|
||||
|
Loading…
Reference in New Issue
Block a user