Skip to main content

from_f16_slice_native

Function from_f16_slice_native 

Source
pub fn from_f16_slice_native(
    context: &GpuContext,
    data: &[f16],
) -> GpuResult<GpuBuffer<u8>>
Expand description

Upload a half::f16 slice to the GPU as raw bytes (u8 buffer).

This is the native path — each f16 occupies exactly 2 bytes on the GPU. To use this buffer in a WGSL shader, the shader source must begin with enable f16; and the adapter must expose wgpu::Features::SHADER_F16.

§Errors

Returns an error if buffer creation fails.