pub unsafe extern "C" fn render__create_texture(
name_ptr: *const u8,
name_len: u32,
description_ptr: *const TextureDescription,
data_ptr: *const u8,
data_len: u32,
__ark_ffi_output: *mut TextureHandle,
) -> ErrorCodeExpand description
Create a texture, returning a handle to it.
For valid texture creation, the description’s width, height, depth, and TextureFormat
need to match up against the length of the data so that width * height * format.bytes_per_pixel() == data.len().
§Errors
Returns an crate::ErrorCode::InvalidArguments if data’s length doesn’t match
up against the description’s dimensions and format or if description dimensions has
values equal to 0.
§Examples
Basic usage:
use ark_api_ffi::render_v0::{TextureDescription, TextureFormat, TextureType};
// Create a simple 1x1 opaque red texture. More sophisticated data can be
// acquired through the use of, for example, the `image` crate.
let data = [255, 0, 0, 255];
let description = TextureDescription {
width: 1,
height: 1,
depth: 1,
format: TextureFormat::R8G8B8A8_SRGB,
mipmaps: 1,
array_len: 1,
texture_type: TextureType::D2,
};
let texture = create_texture("my amazing texture", &description, &data)?;