Skip to content

Commit 580bbd6

Browse files
committed
WIP: runtime: Improve documentation of IRDescriptorTable constructors
1 parent 32255bd commit 580bbd6

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

runtime/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ pub struct BufferView<'a> {
3737
impl ffi::IRDescriptorTableEntry {
3838
/// Encode a buffer descriptor.
3939
///
40+
/// When creating the `metadata` argument via [`Self::metadata()`], note that this does not
41+
/// encode [`BufferView::buffer_size`], which must be added to the `gpu_address` argument manually.
42+
///
4043
/// This function is a port of the `IRDescriptorTableSetBuffer` function in the `metal_irconverter_runtime.h` header.
4144
/// See <https://developer.apple.com/metal/shader-converter/> for more info.
4245
// TODO: This function seems to have no reason to exist, in favour of `buffer_view()` the
@@ -56,6 +59,8 @@ impl ffi::IRDescriptorTableEntry {
5659

5760
/// Encode a buffer view descriptor.
5861
///
62+
/// Use this function to encode a buffer that may also include a reference as a texture from a shader.
63+
///
5964
/// This function is a port of the `IRDescriptorTableSetBufferView` function in the `metal_irconverter_runtime.h` header.
6065
/// See <https://developer.apple.com/metal/shader-converter/> for more info.
6166
#[doc(alias = "IRDescriptorTableSetBufferView")]
@@ -112,6 +117,10 @@ impl ffi::IRDescriptorTableEntry {
112117

113118
/// Get the metadata value for a buffer view.
114119
///
120+
/// Be warned that this does **not** encode [`BufferView::buffer_offset`]. If you
121+
/// are manually passing this metadata down into [`Self::buffer()`] (rather than using
122+
/// [`Self::buffer_view()`]), the offset must be added to the `gpu_address` argument.
123+
///
115124
/// This function is a port of the `IRDescriptorTableGetBufferMetadata` function in the `metal_irconverter_runtime.h` header.
116125
/// See <https://developer.apple.com/metal/shader-converter/> for more info.
117126
#[doc(alias = "IRDescriptorTableGetBufferMetadata")]

0 commit comments

Comments
 (0)