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

Move set_index_buffer FFI functions back into wgpu. #2661

Merged
merged 1 commit into from
May 15, 2022
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
13 changes: 12 additions & 1 deletion wgpu-core/src/command/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ pub mod bundle_ffi {
use super::{RenderBundleEncoder, RenderCommand};
use crate::{id, RawString};
use std::{convert::TryInto, slice};
use wgt::{BufferAddress, BufferSize, DynamicOffset};
use wgt::{BufferAddress, BufferSize, DynamicOffset, IndexFormat};

/// # Safety
///
Expand Down Expand Up @@ -1283,6 +1283,17 @@ pub mod bundle_ffi {
});
}

#[no_mangle]
pub extern "C" fn wgpu_render_bundle_set_index_buffer(
encoder: &mut RenderBundleEncoder,
buffer: id::BufferId,
index_format: IndexFormat,
offset: BufferAddress,
size: Option<BufferSize>,
) {
encoder.set_index_buffer(buffer, index_format, offset, size);
}

/// # Safety
///
/// This function is unsafe as there is no guarantee that the given pointer is
Expand Down
13 changes: 12 additions & 1 deletion wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,7 @@ pub mod render_ffi {
};
use crate::{id, RawString};
use std::{convert::TryInto, ffi, num::NonZeroU32, slice};
use wgt::{BufferAddress, BufferSize, Color, DynamicOffset};
use wgt::{BufferAddress, BufferSize, Color, DynamicOffset, IndexFormat};

/// # Safety
///
Expand Down Expand Up @@ -2068,6 +2068,17 @@ pub mod render_ffi {
});
}

#[no_mangle]
pub extern "C" fn wgpu_render_pass_set_index_buffer(
pass: &mut RenderPass,
buffer: id::BufferId,
index_format: IndexFormat,
offset: BufferAddress,
size: Option<BufferSize>,
) {
pass.set_index_buffer(buffer, index_format, offset, size);
}

#[no_mangle]
pub extern "C" fn wgpu_render_pass_set_blend_constant(pass: &mut RenderPass, color: &Color) {
pass.base
Expand Down