Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heap-less descriptor sets in Metal #2183

Merged
merged 5 commits into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/backend/auxil/range_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ where
pub fn new(range: Range<T>) -> Self {
RangeAllocator {
initial_range: range.clone(),
free_ranges: vec![range.clone()],
free_ranges: vec![range],
}
}

pub fn allocate_range(&mut self, length: T) -> Option<Range<T>> {
assert_ne!(length + length, length);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this assertion? Seems it's just checking for zero?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but T doesn't have a Zero bound :)

let mut best_fit: Option<(usize, Range<T>)> = None;
for (index, range) in self.free_ranges.iter().cloned().enumerate() {
let range_length = range.end - range.start;
Expand Down
5 changes: 4 additions & 1 deletion src/backend/dx11/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,10 @@ impl hal::DescriptorPool<Backend> for DescriptorPool {
Ok(DescriptorSet::new())
}

fn free_sets(&mut self, descriptor_sets: &[DescriptorSet]) {
fn free_sets<I>(&mut self, _descriptor_sets: I)
where
I: IntoIterator<Item = DescriptorSet>
{
unimplemented!()
}

Expand Down
5 changes: 4 additions & 1 deletion src/backend/dx12/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,10 @@ impl HalDescriptorPool<Backend> for DescriptorPool {
})
}

fn free_sets(&mut self, descriptor_sets: &[DescriptorSet]) {
fn free_sets<I>(&mut self, descriptor_sets: I)
where
I: IntoIterator<Item = DescriptorSet>
{
for descriptor_set in descriptor_sets {
for binding_info in &descriptor_set.binding_infos {
if let Some(ref view_range) = binding_info.view_range {
Expand Down
5 changes: 4 additions & 1 deletion src/backend/empty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,10 @@ impl command::RawCommandBuffer<Backend> for RawCommandBuffer {
#[derive(Debug)]
pub struct DescriptorPool;
impl pso::DescriptorPool<Backend> for DescriptorPool {
fn free_sets(&mut self, _descriptor_sets: &[()]) {
fn free_sets<I>(&mut self, _descriptor_sets: I)
where
I: IntoIterator<Item = ()>
{
unimplemented!()
}

Expand Down
5 changes: 4 additions & 1 deletion src/backend/gl/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ impl pso::DescriptorPool<Backend> for DescriptorPool {
})).collect()
}

fn free_sets(&mut self, _descriptor_sets: &[DescriptorSet]) {
fn free_sets<I>(&mut self, _descriptor_sets: I)
where
I: IntoIterator<Item = DescriptorSet>
{
// Poof! Does nothing, because OpenGL doesn't have a meaningful concept of a `DescriptorSet`.
}

Expand Down
Loading