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

Remove more internal uses of IDs #3 #5883

Merged
merged 47 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
bc6020f
use `.error_ident()` for `api_log!`s in `render_pass_end_impl`
teoxoy Jun 25, 2024
e0d2bef
inline `pipeline.as_info().id()`
teoxoy Jun 25, 2024
9931790
simplify `IndexState`
teoxoy Jun 25, 2024
6cffe1d
extract render bundle command processing into their own functions
teoxoy Jun 21, 2024
ac90e26
add more fields to `State` and cleanup fn params
teoxoy Jun 21, 2024
2da8218
move comment that was preventing fmt from running
teoxoy Jun 21, 2024
67d77df
remove `multi_draw_indirect2`
teoxoy Jun 21, 2024
5bbf63f
put all state in `State`
teoxoy Jun 25, 2024
3309a07
remove `CommandBuffer.limits`
teoxoy Jun 25, 2024
f8656d3
extract `set_bind_group` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
45fce5b
extract `set_pipeline` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
90ef6b9
extract `set_push_constant` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
a8993cf
extract `dispatch` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
a349fc8
extract `dispatch_indirect` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
06b3d44
extract `push_debug_group` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
9ad79f8
extract `pop_debug_group` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
4a932fc
extract `insert_debug_marker` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
2564330
extract `write_timestamp` from `compute_pass_end_impl`
teoxoy Jun 25, 2024
51c4ad3
move same device check and tracker insertion inside `validate_and_beg…
teoxoy Jun 25, 2024
3b52c1d
move the raw encoder in `State`
teoxoy Jun 25, 2024
f6b362f
put all state in `State`
teoxoy Jun 25, 2024
7e140e1
extract `set_bind_group` from `render_pass_end_impl`
teoxoy Jun 25, 2024
84a44ae
extract `set_pipeline` from `render_pass_end_impl`
teoxoy Jun 25, 2024
3fb6bd4
extract `set_index_buffer` from `render_pass_end_impl`
teoxoy Jun 25, 2024
c120a0f
extract `set_vertex_buffer` from `render_pass_end_impl`
teoxoy Jun 25, 2024
99276f5
extract `set_blend_constant` from `render_pass_end_impl`
teoxoy Jun 25, 2024
51512ae
extract `set_stencil_reference` from `render_pass_end_impl`
teoxoy Jun 25, 2024
c0e93fd
extract `set_viewport` from `render_pass_end_impl`
teoxoy Jun 25, 2024
3e05cec
extract `set_push_constant` from `render_pass_end_impl`
teoxoy Jun 25, 2024
3420c45
extract `set_scissor` from `render_pass_end_impl`
teoxoy Jun 25, 2024
8081125
extract `draw` from `render_pass_end_impl`
teoxoy Jun 25, 2024
66790fe
extract `draw_indexed` from `render_pass_end_impl`
teoxoy Jun 25, 2024
97918b5
extract `multi_draw_indirect` from `render_pass_end_impl`
teoxoy Jun 25, 2024
7de1447
extract `multi_draw_indirect_count` from `render_pass_end_impl`
teoxoy Jun 25, 2024
6bd3fc1
extract `push_debug_group` from `render_pass_end_impl`
teoxoy Jun 25, 2024
8ebb72f
extract `pop_debug_group` from `render_pass_end_impl`
teoxoy Jun 25, 2024
df45624
extract `insert_debug_marker` from `render_pass_end_impl`
teoxoy Jun 25, 2024
e28d934
extract `write_timestamp` from `render_pass_end_impl`
teoxoy Jun 25, 2024
bcfb22b
resolve occlusion query set prior to `render_pass_end_impl`
teoxoy Jun 26, 2024
2f7a248
extract `execute_bundle` from `render_pass_end_impl`
teoxoy Jun 26, 2024
875a16f
move `pipeline` ident to `DispatchError::IncompatibleBindGroup`
teoxoy Jun 26, 2024
9f1cba1
move `pipeline` ident to appropriate errors
teoxoy Jun 26, 2024
65eb552
remove buffer id from set index/vertex buffer scopes
teoxoy Jun 26, 2024
8232b8b
remove compute pipeline id from set compute pipeline scope
teoxoy Jun 26, 2024
9dba43e
remove render pipeline id from set render pipeline scope
teoxoy Jun 26, 2024
2c3b82b
use `.validate_dynamic_bindings()` in render bundle's `set_bind_group`
teoxoy Jun 26, 2024
5c80956
remove bind group id from set bind group scope
teoxoy Jun 26, 2024
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
18 changes: 12 additions & 6 deletions wgpu-core/src/binding_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
init_tracker::{BufferInitTrackerAction, TextureInitTrackerAction},
resource::{
DestroyedResourceError, MissingBufferUsageError, MissingTextureUsageError, ParentDevice,
Resource, ResourceInfo, ResourceType,
Resource, ResourceErrorIdent, ResourceInfo, ResourceType,
},
resource_log,
snatch::{SnatchGuard, Snatchable},
Expand Down Expand Up @@ -771,19 +771,21 @@ pub enum BindingResource<'a> {
#[non_exhaustive]
pub enum BindError {
#[error(
"Bind group {group} expects {expected} dynamic offset{s0}. However {actual} dynamic offset{s1} were provided.",
"{bind_group} {group} expects {expected} dynamic offset{s0}. However {actual} dynamic offset{s1} were provided.",
s0 = if *.expected >= 2 { "s" } else { "" },
s1 = if *.actual >= 2 { "s" } else { "" },
)]
MismatchedDynamicOffsetCount {
bind_group: ResourceErrorIdent,
group: u32,
actual: usize,
expected: usize,
},
#[error(
"Dynamic binding index {idx} (targeting bind group {group}, binding {binding}) with value {offset}, does not respect device's requested `{limit_name}` limit: {alignment}"
"Dynamic binding index {idx} (targeting {bind_group} {group}, binding {binding}) with value {offset}, does not respect device's requested `{limit_name}` limit: {alignment}"
)]
UnalignedDynamicBinding {
bind_group: ResourceErrorIdent,
idx: usize,
group: u32,
binding: u32,
Expand All @@ -792,10 +794,11 @@ pub enum BindError {
limit_name: &'static str,
},
#[error(
"Dynamic binding offset index {idx} with offset {offset} would overrun the buffer bound to bind group {group} -> binding {binding}. \
"Dynamic binding offset index {idx} with offset {offset} would overrun the buffer bound to {bind_group} {group} -> binding {binding}. \
Buffer size is {buffer_size} bytes, the binding binds bytes {binding_range:?}, meaning the maximum the binding can be offset is {maximum_dynamic_offset} bytes",
)]
DynamicBindingOutOfBounds {
bind_group: ResourceErrorIdent,
idx: usize,
group: u32,
binding: u32,
Expand Down Expand Up @@ -892,10 +895,10 @@ impl<A: HalApi> BindGroup<A> {
&self,
bind_group_index: u32,
offsets: &[wgt::DynamicOffset],
limits: &wgt::Limits,
) -> Result<(), BindError> {
if self.dynamic_binding_info.len() != offsets.len() {
return Err(BindError::MismatchedDynamicOffsetCount {
bind_group: self.error_ident(),
group: bind_group_index,
expected: self.dynamic_binding_info.len(),
actual: offsets.len(),
Expand All @@ -908,9 +911,11 @@ impl<A: HalApi> BindGroup<A> {
.zip(offsets.iter())
.enumerate()
{
let (alignment, limit_name) = buffer_binding_type_alignment(limits, info.binding_type);
let (alignment, limit_name) =
buffer_binding_type_alignment(&self.device.limits, info.binding_type);
if offset as wgt::BufferAddress % alignment as u64 != 0 {
return Err(BindError::UnalignedDynamicBinding {
bind_group: self.error_ident(),
group: bind_group_index,
binding: info.binding_idx,
idx,
Expand All @@ -922,6 +927,7 @@ impl<A: HalApi> BindGroup<A> {

if offset as wgt::BufferAddress > info.maximum_dynamic_offset {
return Err(BindError::DynamicBindingOutOfBounds {
bind_group: self.error_ident(),
group: bind_group_index,
binding: info.binding_idx,
idx,
Expand Down
Loading
Loading