Add # Safery docs to wgpu-core

This commit is contained in:
yanchith committed 2020-01-17 16:15:05 +01:00
1 parent d24d7157cf
commit ab205b042c
3 files changed
+24 -1

No files matched your search

+6
View File
@@ -225,6 +225,12 @@ pub mod compute_ffi {
};
use std::{convert::TryInto, slice};
/// # Safety
///
/// This function is unsafe as there is no guarantee that the given pointer is
/// valid for `offset_length` elements.
// TODO: There might be other safety issues, such as using the unsafe
// `RawPass::encode` and `RawPass::encode_slice`.
#[no_mangle]
pub unsafe extern "C" fn wgpu_compute_pass_set_bind_group(
pass: &mut RawPass,
+6 -1
View File
@@ -197,7 +197,7 @@ pub struct CommandBufferDescriptor {
}
#[no_mangle]
pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
pub extern "C" fn wgpu_command_encoder_begin_compute_pass(
encoder_id: id::CommandEncoderId,
_desc: Option<&ComputePassDescriptor>,
) -> *mut RawPass {
@@ -220,6 +220,11 @@ pub struct RawRenderPass {
targets: RawRenderTargets,
}
/// # Safety
///
/// This function is unsafe as there is no guarantee that the given pointer
/// (`RenderPassDescriptor::color_attachments`) is valid for
/// `RenderPassDescriptor::color_attachments_length` elements.
#[no_mangle]
pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
encoder_id: id::CommandEncoderId,
+12
View File
@@ -1127,6 +1127,12 @@ pub mod render_ffi {
};
use std::{convert::TryInto, slice};
/// # Safety
///
/// This function is unsafe as there is no guarantee that the given pointer is
/// valid for `offset_length` elements.
// TODO: There might be other safety issues, such as using the unsafe
// `RawPass::encode` and `RawPass::encode_slice`.
#[no_mangle]
pub unsafe extern "C" fn wgpu_render_pass_set_bind_group(
pass: &mut RawRenderPass,
@@ -1166,6 +1172,12 @@ pub mod render_ffi {
});
}
/// # Safety
///
/// This function is unsafe as there is no guarantee that the given pointers
/// (`buffer_ids` and `offsets`) are valid for `length` elements.
// TODO: There might be other safety issues, such as using the unsafe
// `RawPass::encode` and `RawPass::encode_slice`.
#[no_mangle]
pub unsafe extern "C" fn wgpu_render_pass_set_vertex_buffers(
pass: &mut RawRenderPass,