mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
Rename expectation to LayoutChange
This commit is contained in:
1 parent
53749ce604
commit
bfefe690e8
3 files changed
+15
-15
No files matched your search
@@ -13,7 +13,7 @@ struct BindGroupPair {
|
||||
group_id: Stored<BindGroupId>,
|
||||
}
|
||||
|
||||
pub enum Expectation {
|
||||
pub enum LayoutChange {
|
||||
Unchanged,
|
||||
Match(BindGroupId),
|
||||
Mismatch,
|
||||
@@ -77,7 +77,7 @@ impl BindGroupEntry {
|
||||
pub fn expect_layout(
|
||||
&mut self,
|
||||
bind_group_layout_id: BindGroupLayoutId,
|
||||
) -> Expectation {
|
||||
) -> LayoutChange {
|
||||
let some = Some(bind_group_layout_id);
|
||||
if self.expected_layout_id != some {
|
||||
self.expected_layout_id = some;
|
||||
@@ -85,11 +85,11 @@ impl BindGroupEntry {
|
||||
Some(BindGroupPair {
|
||||
layout_id,
|
||||
ref group_id,
|
||||
}) if layout_id == bind_group_layout_id => Expectation::Match(group_id.value),
|
||||
Some(_) | None => Expectation::Mismatch,
|
||||
}) if layout_id == bind_group_layout_id => LayoutChange::Match(group_id.value),
|
||||
Some(_) | None => LayoutChange::Mismatch,
|
||||
}
|
||||
} else {
|
||||
Expectation::Unchanged
|
||||
LayoutChange::Unchanged
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,13 +120,13 @@ pub struct Binder {
|
||||
}
|
||||
|
||||
impl Binder {
|
||||
pub(crate) fn cut_expectations(&mut self, length: usize) {
|
||||
pub(crate) fn reset_expectations(&mut self, length: usize) {
|
||||
for entry in self.entries[length ..].iter_mut() {
|
||||
entry.expected_layout_id = None;
|
||||
}
|
||||
}
|
||||
|
||||
/// Attemt to set the value of the specified bind group index.
|
||||
/// Attempt to set the value of the specified bind group index.
|
||||
/// Returns Some() when the new bind group is ready to be actually bound
|
||||
/// (i.e. compatible with current expectations). Also returns an iterator
|
||||
/// of bind group IDs to be bound with it: those are compatible bind groups
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::command::bind::{Binder, Expectation};
|
||||
use crate::command::bind::{Binder, LayoutChange};
|
||||
use crate::hub::HUB;
|
||||
use crate::track::{Stitch, TrackerSet};
|
||||
use crate::{
|
||||
@@ -108,10 +108,10 @@ pub extern "C" fn wgpu_compute_pass_set_pipeline(
|
||||
|
||||
let pipeline_layout_guard = HUB.pipeline_layouts.read();
|
||||
let pipeline_layout = &pipeline_layout_guard[pipeline.layout_id];
|
||||
let bing_group_guard = HUB.bind_groups.read();
|
||||
let bind_group_guard = HUB.bind_groups.read();
|
||||
|
||||
pass.binder.pipeline_layout_id = Some(pipeline.layout_id.clone());
|
||||
pass.binder.cut_expectations(pipeline_layout.bind_group_layout_ids.len());
|
||||
pass.binder.reset_expectations(pipeline_layout.bind_group_layout_ids.len());
|
||||
|
||||
for (index, (entry, &bgl_id)) in pass
|
||||
.binder
|
||||
@@ -120,8 +120,8 @@ pub extern "C" fn wgpu_compute_pass_set_pipeline(
|
||||
.zip(&pipeline_layout.bind_group_layout_ids)
|
||||
.enumerate()
|
||||
{
|
||||
if let Expectation::Match(bg_id) = entry.expect_layout(bgl_id) {
|
||||
let desc_set = &bing_group_guard[bg_id].raw;
|
||||
if let LayoutChange::Match(bg_id) = entry.expect_layout(bgl_id) {
|
||||
let desc_set = &bind_group_guard[bg_id].raw;
|
||||
unsafe {
|
||||
pass.raw.bind_compute_descriptor_sets(
|
||||
&pipeline_layout.raw,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::conv;
|
||||
use crate::command::bind::{Binder, Expectation};
|
||||
use crate::command::bind::{Binder, LayoutChange};
|
||||
use crate::device::RenderPassContext;
|
||||
use crate::hub::HUB;
|
||||
use crate::pipeline::PipelineFlags;
|
||||
@@ -266,7 +266,7 @@ pub extern "C" fn wgpu_render_pass_set_pipeline(
|
||||
let bind_group_guard = HUB.bind_groups.read();
|
||||
|
||||
pass.binder.pipeline_layout_id = Some(pipeline.layout_id.clone());
|
||||
pass.binder.cut_expectations(pipeline_layout.bind_group_layout_ids.len());
|
||||
pass.binder.reset_expectations(pipeline_layout.bind_group_layout_ids.len());
|
||||
|
||||
for (index, (entry, &bgl_id)) in pass
|
||||
.binder
|
||||
@@ -275,7 +275,7 @@ pub extern "C" fn wgpu_render_pass_set_pipeline(
|
||||
.zip(&pipeline_layout.bind_group_layout_ids)
|
||||
.enumerate()
|
||||
{
|
||||
if let Expectation::Match(bg_id) = entry.expect_layout(bgl_id) {
|
||||
if let LayoutChange::Match(bg_id) = entry.expect_layout(bgl_id) {
|
||||
let desc_set = &bind_group_guard[bg_id].raw;
|
||||
unsafe {
|
||||
pass.raw.bind_graphics_descriptor_sets(
|
||||
|
||||
Reference in new issue
Block a user