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

Renaming CommandEncoder::clearBuffer to CommandEncoder::fillBuffer #2174

Merged
merged 3 commits into from
Nov 15, 2021
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
4 changes: 2 additions & 2 deletions player/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ impl GlobalPlay for wgc::hub::Global<IdentityPassThroughFactory> {
trace::Command::CopyTextureToTexture { src, dst, size } => self
.command_encoder_copy_texture_to_texture::<A>(encoder, &src, &dst, &size)
.unwrap(),
trace::Command::ClearBuffer { dst, offset, size } => self
.command_encoder_clear_buffer::<A>(encoder, dst, offset, size)
trace::Command::FillBuffer { dst, offset, size } => self
.command_encoder_fill_buffer::<A>(encoder, dst, offset, size)
.unwrap(),
trace::Command::ClearTexture {
dst,
Expand Down
12 changes: 4 additions & 8 deletions wgpu-core/src/command/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ whereas subesource range specified start {subresource_base_array_layer} and coun
}

impl<G: GlobalIdentityHandlerFactory> Global<G> {
pub fn command_encoder_clear_buffer<A: HalApi>(
pub fn command_encoder_fill_buffer<A: HalApi>(
&self,
command_encoder_id: CommandEncoderId,
dst: BufferId,
offset: BufferAddress,
size: Option<BufferSize>,
) -> Result<(), ClearError> {
profiling::scope!("CommandEncoder::clear_buffer");
profiling::scope!("CommandEncoder::fill_buffer");

let hub = A::hub(self);
let mut token = Token::root();
Expand All @@ -87,11 +87,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {

#[cfg(feature = "trace")]
if let Some(ref mut list) = cmd_buf.commands {
list.push(TraceCommand::ClearBuffer { dst, offset, size });
}

if !cmd_buf.support_clear_buffer_texture {
kvark marked this conversation as resolved.
Show resolved Hide resolved
return Err(ClearError::MissingClearCommandsFeature);
list.push(TraceCommand::FillBuffer { dst, offset, size });
}

let (dst_buffer, dst_pending) = cmd_buf
Expand Down Expand Up @@ -130,7 +126,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
None => dst_buffer.size,
};
if offset == end {
log::trace!("Ignoring clear_buffer of size 0");
log::trace!("Ignoring fill_buffer of size 0");
return Ok(());
}

Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/device/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub enum Command {
dst: crate::command::ImageCopyTexture,
size: wgt::Extent3d,
},
ClearBuffer {
FillBuffer {
dst: id::BufferId,
offset: wgt::BufferAddress,
size: Option<wgt::BufferSize>,
Expand Down
6 changes: 3 additions & 3 deletions wgpu/src/backend/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2008,20 +2008,20 @@ impl crate::Context for Context {
}
}

fn command_encoder_clear_buffer(
fn command_encoder_fill_buffer(
&self,
encoder: &Self::CommandEncoderId,
buffer: &crate::Buffer,
offset: wgt::BufferAddress,
size: Option<wgt::BufferSize>,
) {
let global = &self.0;
if let Err(cause) = wgc::gfx_select!(encoder.id => global.command_encoder_clear_buffer(
if let Err(cause) = wgc::gfx_select!(encoder.id => global.command_encoder_fill_buffer(
encoder.id,
buffer.id.id,
offset, size
)) {
self.handle_error_nolabel(&encoder.error_sink, cause, "CommandEncoder::clear_buffer");
self.handle_error_nolabel(&encoder.error_sink, cause, "CommandEncoder::fill_buffer");
}
}

Expand Down
2 changes: 1 addition & 1 deletion wgpu/src/backend/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,7 @@ impl crate::Context for Context {
) {
}

fn command_encoder_clear_buffer(
fn command_encoder_fill_buffer(
&self,
_encoder: &Self::CommandEncoderId,
_buffer: &crate::Buffer,
Expand Down
7 changes: 3 additions & 4 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ trait Context: Debug + Send + Sized + Sync {
texture: &Texture,
subresource_range: &ImageSubresourceRange,
);
fn command_encoder_clear_buffer(
fn command_encoder_fill_buffer(
&self,
encoder: &Self::CommandEncoderId,
buffer: &Buffer,
Expand Down Expand Up @@ -2357,16 +2357,15 @@ impl CommandEncoder {
///
/// # Panics
///
/// - `CLEAR_COMMANDS` extension not enabled
/// - Buffer does not have `COPY_DST` usage.
/// - Range it out of bounds
pub fn clear_buffer(
pub fn fill_buffer(
&mut self,
buffer: &Buffer,
offset: BufferAddress,
size: Option<BufferSize>,
) {
Context::command_encoder_clear_buffer(
Context::command_encoder_fill_buffer(
&*self.context,
self.id.as_ref().unwrap(),
buffer,
Expand Down