Skip to content

Commit a302c8d

Browse files
authored
Docs surface creation no longer unsafe (#5265)
* doc: as of #4597 surface creation is no longer unsafe * doc: extend documentation of the include_wgsl macro
1 parent df386da commit a302c8d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

wgpu/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static_assertions::assert_impl_all!(SurfaceConfiguration: Send, Sync);
358358
/// Handle to a presentable surface.
359359
///
360360
/// A `Surface` represents a platform-specific surface (e.g. a window) onto which rendered images may
361-
/// be presented. A `Surface` may be created with the unsafe function [`Instance::create_surface`].
361+
/// be presented. A `Surface` may be created with the function [`Instance::create_surface`].
362362
///
363363
/// This type is unique to the Rust API of `wgpu`. In the WebGPU specification,
364364
/// [`GPUCanvasContext`](https://gpuweb.github.io/gpuweb/#canvas-context)

wgpu/src/macros.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ macro_rules! include_spirv_raw {
7878
};
7979
}
8080

81-
/// Macro to load a WGSL module statically.
81+
/// Load WGSL source code from a file at compile time.
82+
///
83+
/// The loaded path is relative to the path of the file containing the macro call, in the same way
84+
/// as [`include_str!`] operates.
85+
///
86+
/// ```ignore
87+
/// fn main() {
88+
/// let module: ShaderModuleDescriptor = include_wgsl!("shader.wgsl");
89+
/// }
90+
/// ```
8291
#[macro_export]
8392
macro_rules! include_wgsl {
8493
($($token:tt)*) => {

0 commit comments

Comments
 (0)