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>(
|
pub fn drain_transitions<'a, 'b: 'a>(
|
||||||
&'b mut self,
|
&'b mut self,
|
||||||
snatch_guard: &'a SnatchGuard<'a>,
|
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 buffer_barriers = self.temp.drain(..).map(|pending| {
|
||||||
let buf = unsafe { self.metadata.get_resource_unchecked(pending.id as _) };
|
let buf = unsafe { self.metadata.get_resource_unchecked(pending.id as _) };
|
||||||
pending.into_hal(buf, snatch_guard)
|
pending.into_hal(buf, snatch_guard)
|
||||||
@ -557,7 +557,7 @@ impl<A: HalApi> DeviceBufferTracker<A> {
|
|||||||
&'a mut self,
|
&'a mut self,
|
||||||
tracker: &'a BufferTracker<A>,
|
tracker: &'a BufferTracker<A>,
|
||||||
snatch_guard: &'b SnatchGuard<'b>,
|
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() {
|
for index in tracker.metadata.owned_indices() {
|
||||||
self.tracker_assert_in_bounds(index);
|
self.tracker_assert_in_bounds(index);
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ impl PendingTransition<hal::BufferUses> {
|
|||||||
self,
|
self,
|
||||||
buf: &'a resource::Buffer<A>,
|
buf: &'a resource::Buffer<A>,
|
||||||
snatch_guard: &'a SnatchGuard<'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");
|
let buffer = buf.raw(snatch_guard).expect("Buffer is destroyed");
|
||||||
hal::BufferBarrier {
|
hal::BufferBarrier {
|
||||||
buffer,
|
buffer,
|
||||||
|
@ -310,7 +310,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
|||||||
|
|
||||||
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||||
where
|
where
|
||||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Api>>,
|
T: Iterator<Item = crate::BufferBarrier<'a, super::Buffer>>,
|
||||||
{
|
{
|
||||||
self.temp.barriers.clear();
|
self.temp.barriers.clear();
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ impl crate::CommandEncoder for Encoder {
|
|||||||
|
|
||||||
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||||
where
|
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)
|
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||||
where
|
where
|
||||||
T: Iterator<Item = crate::BufferBarrier<'a, super::Api>>,
|
T: Iterator<Item = crate::BufferBarrier<'a, super::Buffer>>,
|
||||||
{
|
{
|
||||||
if !self
|
if !self
|
||||||
.private_caps
|
.private_caps
|
||||||
|
@ -1103,7 +1103,7 @@ pub trait CommandEncoder: WasmNotSendSync + fmt::Debug {
|
|||||||
|
|
||||||
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||||
where
|
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)
|
unsafe fn transition_textures<'a, T>(&mut self, barriers: T)
|
||||||
where
|
where
|
||||||
@ -1975,8 +1975,8 @@ pub struct Rect<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct BufferBarrier<'a, A: Api> {
|
pub struct BufferBarrier<'a, B: DynBuffer + ?Sized> {
|
||||||
pub buffer: &'a A::Buffer,
|
pub buffer: &'a B,
|
||||||
pub usage: Range<BufferUses>,
|
pub usage: Range<BufferUses>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
|
|||||||
|
|
||||||
unsafe fn transition_buffers<'a, T>(&mut self, _barriers: T)
|
unsafe fn transition_buffers<'a, T>(&mut self, _barriers: T)
|
||||||
where
|
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)
|
unsafe fn transition_buffers<'a, T>(&mut self, barriers: T)
|
||||||
where
|
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
|
//Note: this is done so that we never end up with empty stage flags
|
||||||
let mut src_stages = vk::PipelineStageFlags::TOP_OF_PIPE;
|
let mut src_stages = vk::PipelineStageFlags::TOP_OF_PIPE;
|
||||||
|
Loading…
Reference in New Issue
Block a user