2019-03-04 17:55:32 -05:00
|
|
|
// pathfinder/gpu/src/lib.rs
|
|
|
|
//
|
|
|
|
// Copyright © 2019 The Pathfinder Project Developers.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
//! Minimal abstractions over GPU device capabilities.
|
|
|
|
|
2019-03-08 19:52:47 -05:00
|
|
|
use crate::resources::ResourceLoader;
|
2019-12-20 14:48:29 -05:00
|
|
|
use half::f16;
|
2019-03-08 19:52:47 -05:00
|
|
|
use image::ImageFormat;
|
2020-01-31 03:16:34 -05:00
|
|
|
use pathfinder_color::ColorF;
|
2019-06-21 13:06:19 -04:00
|
|
|
use pathfinder_geometry::rect::RectI;
|
2019-07-11 17:35:06 -04:00
|
|
|
use pathfinder_geometry::transform3d::Transform4F;
|
2019-06-21 13:06:19 -04:00
|
|
|
use pathfinder_geometry::vector::Vector2I;
|
2019-06-25 17:43:13 -04:00
|
|
|
use pathfinder_simd::default::{F32x2, F32x4};
|
2019-12-20 14:48:29 -05:00
|
|
|
use std::os::raw::c_void;
|
2019-03-04 17:55:32 -05:00
|
|
|
use std::time::Duration;
|
|
|
|
|
2019-03-08 19:52:47 -05:00
|
|
|
pub mod resources;
|
|
|
|
|
2019-06-05 17:35:46 -04:00
|
|
|
pub trait Device: Sized {
|
2019-03-04 17:55:32 -05:00
|
|
|
type Buffer;
|
|
|
|
type Framebuffer;
|
|
|
|
type Program;
|
|
|
|
type Shader;
|
|
|
|
type Texture;
|
2020-01-07 16:03:15 -05:00
|
|
|
type TextureDataReceiver;
|
2019-03-04 17:55:32 -05:00
|
|
|
type TimerQuery;
|
|
|
|
type Uniform;
|
|
|
|
type VertexArray;
|
|
|
|
type VertexAttr;
|
|
|
|
|
2019-06-03 15:39:29 -04:00
|
|
|
fn create_texture(&self, format: TextureFormat, size: Vector2I) -> Self::Texture;
|
2019-12-19 11:58:02 -05:00
|
|
|
fn create_texture_from_data(&self, format: TextureFormat, size: Vector2I, data: TextureDataRef)
|
|
|
|
-> Self::Texture;
|
2019-06-05 17:35:46 -04:00
|
|
|
fn create_shader(&self, resources: &dyn ResourceLoader, name: &str, kind: ShaderKind)
|
|
|
|
-> Self::Shader;
|
2019-06-05 20:20:12 -04:00
|
|
|
fn create_shader_from_source(&self, name: &str, source: &[u8], kind: ShaderKind)
|
|
|
|
-> Self::Shader;
|
2019-03-04 17:55:32 -05:00
|
|
|
fn create_vertex_array(&self) -> Self::VertexArray;
|
2019-04-29 19:57:56 -04:00
|
|
|
fn create_program_from_shaders(
|
|
|
|
&self,
|
2019-05-26 16:02:52 -04:00
|
|
|
resources: &dyn ResourceLoader,
|
2019-04-29 19:57:56 -04:00
|
|
|
name: &str,
|
|
|
|
vertex_shader: Self::Shader,
|
|
|
|
fragment_shader: Self::Shader,
|
|
|
|
) -> Self::Program;
|
2019-06-12 13:46:00 -04:00
|
|
|
fn get_vertex_attr(&self, program: &Self::Program, name: &str) -> Option<Self::VertexAttr>;
|
2019-03-04 17:55:32 -05:00
|
|
|
fn get_uniform(&self, program: &Self::Program, name: &str) -> Self::Uniform;
|
2019-06-05 17:35:46 -04:00
|
|
|
fn bind_buffer(&self,
|
|
|
|
vertex_array: &Self::VertexArray,
|
|
|
|
buffer: &Self::Buffer,
|
|
|
|
target: BufferTarget);
|
|
|
|
fn configure_vertex_attr(&self,
|
|
|
|
vertex_array: &Self::VertexArray,
|
|
|
|
attr: &Self::VertexAttr,
|
|
|
|
descriptor: &VertexAttrDescriptor);
|
2019-03-04 17:55:32 -05:00
|
|
|
fn create_framebuffer(&self, texture: Self::Texture) -> Self::Framebuffer;
|
|
|
|
fn create_buffer(&self) -> Self::Buffer;
|
2019-04-29 19:57:56 -04:00
|
|
|
fn allocate_buffer<T>(
|
|
|
|
&self,
|
|
|
|
buffer: &Self::Buffer,
|
|
|
|
data: BufferData<T>,
|
|
|
|
target: BufferTarget,
|
|
|
|
mode: BufferUploadMode,
|
|
|
|
);
|
2019-03-04 17:55:32 -05:00
|
|
|
fn framebuffer_texture<'f>(&self, framebuffer: &'f Self::Framebuffer) -> &'f Self::Texture;
|
2019-06-03 15:39:29 -04:00
|
|
|
fn texture_size(&self, texture: &Self::Texture) -> Vector2I;
|
2019-12-20 14:48:29 -05:00
|
|
|
fn upload_to_texture(&self, texture: &Self::Texture, rect: RectI, data: TextureDataRef);
|
2020-01-07 16:03:15 -05:00
|
|
|
fn read_pixels(&self, target: &RenderTarget<Self>, viewport: RectI)
|
|
|
|
-> Self::TextureDataReceiver;
|
2019-06-05 17:35:46 -04:00
|
|
|
fn begin_commands(&self);
|
|
|
|
fn end_commands(&self);
|
|
|
|
fn draw_arrays(&self, index_count: u32, render_state: &RenderState<Self>);
|
|
|
|
fn draw_elements(&self, index_count: u32, render_state: &RenderState<Self>);
|
2019-05-29 19:04:33 -04:00
|
|
|
fn draw_elements_instanced(&self,
|
|
|
|
index_count: u32,
|
|
|
|
instance_count: u32,
|
2019-06-05 17:35:46 -04:00
|
|
|
render_state: &RenderState<Self>);
|
2019-03-04 17:55:32 -05:00
|
|
|
fn create_timer_query(&self) -> Self::TimerQuery;
|
|
|
|
fn begin_timer_query(&self, query: &Self::TimerQuery);
|
|
|
|
fn end_timer_query(&self, query: &Self::TimerQuery);
|
2020-01-07 16:03:15 -05:00
|
|
|
fn try_recv_timer_query(&self, query: &Self::TimerQuery) -> Option<Duration>;
|
|
|
|
fn recv_timer_query(&self, query: &Self::TimerQuery) -> Duration;
|
|
|
|
fn try_recv_texture_data(&self, receiver: &Self::TextureDataReceiver) -> Option<TextureData>;
|
|
|
|
fn recv_texture_data(&self, receiver: &Self::TextureDataReceiver) -> TextureData;
|
2019-03-04 17:55:32 -05:00
|
|
|
|
2019-04-29 19:57:56 -04:00
|
|
|
fn create_texture_from_png(&self, resources: &dyn ResourceLoader, name: &str) -> Self::Texture {
|
2019-03-08 19:52:47 -05:00
|
|
|
let data = resources.slurp(&format!("textures/{}.png", name)).unwrap();
|
2019-04-29 19:57:56 -04:00
|
|
|
let image = image::load_from_memory_with_format(&data, ImageFormat::PNG)
|
|
|
|
.unwrap()
|
|
|
|
.to_luma();
|
2019-06-03 15:39:29 -04:00
|
|
|
let size = Vector2I::new(image.width() as i32, image.height() as i32);
|
2019-12-19 11:58:02 -05:00
|
|
|
self.create_texture_from_data(TextureFormat::R8, size, TextureDataRef::U8(&image))
|
2019-03-04 17:55:32 -05:00
|
|
|
}
|
|
|
|
|
2019-04-29 19:57:56 -04:00
|
|
|
fn create_program_from_shader_names(
|
|
|
|
&self,
|
|
|
|
resources: &dyn ResourceLoader,
|
|
|
|
program_name: &str,
|
|
|
|
vertex_shader_name: &str,
|
|
|
|
fragment_shader_name: &str,
|
|
|
|
) -> Self::Program {
|
2019-03-22 17:28:18 -04:00
|
|
|
let vertex_shader = self.create_shader(resources, vertex_shader_name, ShaderKind::Vertex);
|
2019-04-29 19:57:56 -04:00
|
|
|
let fragment_shader =
|
|
|
|
self.create_shader(resources, fragment_shader_name, ShaderKind::Fragment);
|
2019-05-26 16:02:52 -04:00
|
|
|
self.create_program_from_shaders(resources, program_name, vertex_shader, fragment_shader)
|
2019-03-22 17:28:18 -04:00
|
|
|
}
|
|
|
|
|
2019-03-08 19:52:47 -05:00
|
|
|
fn create_program(&self, resources: &dyn ResourceLoader, name: &str) -> Self::Program {
|
2019-03-22 17:28:18 -04:00
|
|
|
self.create_program_from_shader_names(resources, name, name, name)
|
2019-03-04 17:55:32 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-05 17:35:46 -04:00
|
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
2019-03-04 17:55:32 -05:00
|
|
|
pub enum TextureFormat {
|
2019-03-22 17:28:18 -04:00
|
|
|
R8,
|
2019-03-04 17:55:32 -05:00
|
|
|
R16F,
|
|
|
|
RGBA8,
|
2019-12-20 14:48:29 -05:00
|
|
|
RGBA16F,
|
2019-12-14 16:57:55 -05:00
|
|
|
RGBA32F,
|
2019-03-04 17:55:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub enum VertexAttrType {
|
|
|
|
F32,
|
|
|
|
I16,
|
2019-04-15 16:21:24 -04:00
|
|
|
I8,
|
2019-03-04 17:55:32 -05:00
|
|
|
U16,
|
|
|
|
U8,
|
|
|
|
}
|
|
|
|
|
2019-04-15 16:21:24 -04:00
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub enum BufferData<'a, T> {
|
|
|
|
Uninitialized(usize),
|
|
|
|
Memory(&'a [T]),
|
|
|
|
}
|
|
|
|
|
2019-03-04 17:55:32 -05:00
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub enum BufferTarget {
|
|
|
|
Vertex,
|
|
|
|
Index,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub enum BufferUploadMode {
|
|
|
|
Static,
|
|
|
|
Dynamic,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
|
|
pub enum ShaderKind {
|
|
|
|
Vertex,
|
|
|
|
Fragment,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
pub enum UniformData {
|
2019-11-16 00:17:50 -05:00
|
|
|
Float(f32),
|
2019-03-25 19:13:56 -04:00
|
|
|
Int(i32),
|
2019-11-10 13:28:20 -05:00
|
|
|
Mat2(F32x4),
|
2019-03-05 16:57:28 -05:00
|
|
|
Mat4([F32x4; 4]),
|
2019-06-25 17:43:13 -04:00
|
|
|
Vec2(F32x2),
|
2019-03-04 17:55:32 -05:00
|
|
|
Vec4(F32x4),
|
|
|
|
TextureUnit(u32),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
pub enum Primitive {
|
|
|
|
Triangles,
|
|
|
|
Lines,
|
|
|
|
}
|
|
|
|
|
2019-06-05 17:35:46 -04:00
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct RenderState<'a, D> where D: Device {
|
|
|
|
pub target: &'a RenderTarget<'a, D>,
|
|
|
|
pub program: &'a D::Program,
|
|
|
|
pub vertex_array: &'a D::VertexArray,
|
|
|
|
pub primitive: Primitive,
|
|
|
|
pub uniforms: &'a [(&'a D::Uniform, UniformData)],
|
|
|
|
pub textures: &'a [&'a D::Texture],
|
|
|
|
pub viewport: RectI,
|
|
|
|
pub options: RenderOptions,
|
2019-04-22 16:50:38 -04:00
|
|
|
}
|
|
|
|
|
2019-03-05 16:22:11 -05:00
|
|
|
#[derive(Clone, Debug)]
|
2019-06-05 17:35:46 -04:00
|
|
|
pub struct RenderOptions {
|
2019-12-19 11:58:02 -05:00
|
|
|
pub blend: Option<BlendState>,
|
2019-03-04 17:55:32 -05:00
|
|
|
pub depth: Option<DepthState>,
|
|
|
|
pub stencil: Option<StencilState>,
|
2019-06-05 17:35:46 -04:00
|
|
|
pub clear_ops: ClearOps,
|
2019-03-04 17:55:32 -05:00
|
|
|
pub color_mask: bool,
|
|
|
|
}
|
|
|
|
|
2019-06-05 17:35:46 -04:00
|
|
|
#[derive(Clone, Copy, Debug, Default)]
|
|
|
|
pub struct ClearOps {
|
|
|
|
pub color: Option<ColorF>,
|
|
|
|
pub depth: Option<f32>,
|
|
|
|
pub stencil: Option<u8>,
|
|
|
|
}
|
|
|
|
|
2019-03-04 17:55:32 -05:00
|
|
|
#[derive(Clone, Copy, Debug)]
|
2019-06-05 17:35:46 -04:00
|
|
|
pub enum RenderTarget<'a, D> where D: Device {
|
|
|
|
Default,
|
|
|
|
Framebuffer(&'a D::Framebuffer),
|
|
|
|
}
|
|
|
|
|
2019-12-19 11:58:02 -05:00
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Default)]
|
|
|
|
pub struct BlendState {
|
|
|
|
pub func: BlendFunc,
|
|
|
|
pub op: BlendOp,
|
|
|
|
}
|
|
|
|
|
2019-06-05 17:35:46 -04:00
|
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
2019-12-19 11:58:02 -05:00
|
|
|
pub enum BlendFunc {
|
2019-03-04 17:55:32 -05:00
|
|
|
RGBOneAlphaOne,
|
2019-03-05 16:22:11 -05:00
|
|
|
RGBOneAlphaOneMinusSrcAlpha,
|
|
|
|
RGBSrcAlphaAlphaOneMinusSrcAlpha,
|
2019-03-04 17:55:32 -05:00
|
|
|
}
|
|
|
|
|
2019-12-19 11:58:02 -05:00
|
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
|
|
pub enum BlendOp {
|
|
|
|
Add,
|
|
|
|
Subtract,
|
|
|
|
}
|
|
|
|
|
2019-03-04 17:55:32 -05:00
|
|
|
#[derive(Clone, Copy, Default, Debug)]
|
|
|
|
pub struct DepthState {
|
|
|
|
pub func: DepthFunc,
|
|
|
|
pub write: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub enum DepthFunc {
|
|
|
|
Less,
|
|
|
|
Always,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub struct StencilState {
|
|
|
|
pub func: StencilFunc,
|
|
|
|
pub reference: u32,
|
|
|
|
pub mask: u32,
|
2019-03-05 16:22:11 -05:00
|
|
|
pub write: bool,
|
2019-03-04 17:55:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub enum StencilFunc {
|
|
|
|
Always,
|
|
|
|
Equal,
|
|
|
|
}
|
|
|
|
|
2019-06-05 17:35:46 -04:00
|
|
|
impl Default for RenderOptions {
|
2019-03-05 16:22:11 -05:00
|
|
|
#[inline]
|
2019-06-05 17:35:46 -04:00
|
|
|
fn default() -> RenderOptions {
|
|
|
|
RenderOptions {
|
2019-12-19 11:58:02 -05:00
|
|
|
blend: None,
|
2019-04-29 19:57:56 -04:00
|
|
|
depth: None,
|
|
|
|
stencil: None,
|
2019-06-05 17:35:46 -04:00
|
|
|
clear_ops: ClearOps::default(),
|
2019-04-29 19:57:56 -04:00
|
|
|
color_mask: true,
|
|
|
|
}
|
2019-03-05 16:22:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-19 11:58:02 -05:00
|
|
|
impl Default for BlendFunc {
|
|
|
|
#[inline]
|
|
|
|
fn default() -> BlendFunc {
|
|
|
|
BlendFunc::RGBOneAlphaOneMinusSrcAlpha
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for BlendOp {
|
2019-03-04 17:55:32 -05:00
|
|
|
#[inline]
|
2019-12-19 11:58:02 -05:00
|
|
|
fn default() -> BlendOp {
|
|
|
|
BlendOp::Add
|
2019-03-04 17:55:32 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for StencilState {
|
|
|
|
#[inline]
|
|
|
|
fn default() -> StencilState {
|
2019-04-29 19:57:56 -04:00
|
|
|
StencilState {
|
|
|
|
func: StencilFunc::default(),
|
|
|
|
reference: 0,
|
|
|
|
mask: !0,
|
|
|
|
write: false,
|
|
|
|
}
|
2019-03-04 17:55:32 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for DepthFunc {
|
|
|
|
#[inline]
|
|
|
|
fn default() -> DepthFunc {
|
|
|
|
DepthFunc::Less
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for StencilFunc {
|
|
|
|
#[inline]
|
|
|
|
fn default() -> StencilFunc {
|
|
|
|
StencilFunc::Always
|
|
|
|
}
|
|
|
|
}
|
2019-03-19 00:40:10 -04:00
|
|
|
|
2019-06-05 17:35:46 -04:00
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
pub enum TextureData {
|
|
|
|
U8(Vec<u8>),
|
|
|
|
U16(Vec<u16>),
|
2019-12-20 14:48:29 -05:00
|
|
|
F16(Vec<f16>),
|
2019-12-14 16:57:55 -05:00
|
|
|
F32(Vec<f32>),
|
2019-06-05 17:35:46 -04:00
|
|
|
}
|
|
|
|
|
2019-12-19 11:58:02 -05:00
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub enum TextureDataRef<'a> {
|
|
|
|
U8(&'a [u8]),
|
2019-12-20 14:48:29 -05:00
|
|
|
F16(&'a [f16]),
|
2019-12-19 11:58:02 -05:00
|
|
|
F32(&'a [f32]),
|
|
|
|
}
|
|
|
|
|
2019-04-22 16:50:38 -04:00
|
|
|
impl UniformData {
|
|
|
|
#[inline]
|
2019-07-11 17:35:06 -04:00
|
|
|
pub fn from_transform_3d(transform: &Transform4F) -> UniformData {
|
2019-04-22 16:50:38 -04:00
|
|
|
UniformData::Mat4([transform.c0, transform.c1, transform.c2, transform.c3])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-14 17:28:21 -04:00
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub struct VertexAttrDescriptor {
|
|
|
|
pub size: usize,
|
|
|
|
pub class: VertexAttrClass,
|
|
|
|
pub attr_type: VertexAttrType,
|
|
|
|
pub stride: usize,
|
|
|
|
pub offset: usize,
|
|
|
|
pub divisor: u32,
|
2019-06-05 17:35:46 -04:00
|
|
|
pub buffer_index: u32,
|
2019-05-14 17:28:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
|
|
pub enum VertexAttrClass {
|
|
|
|
Float,
|
|
|
|
FloatNorm,
|
|
|
|
Int,
|
|
|
|
}
|
2019-06-05 17:35:46 -04:00
|
|
|
|
|
|
|
impl TextureFormat {
|
|
|
|
#[inline]
|
|
|
|
pub fn channels(self) -> usize {
|
|
|
|
match self {
|
|
|
|
TextureFormat::R8 | TextureFormat::R16F => 1,
|
2019-12-20 14:48:29 -05:00
|
|
|
TextureFormat::RGBA8 | TextureFormat::RGBA16F | TextureFormat::RGBA32F => 4,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn bytes_per_pixel(self) -> usize {
|
|
|
|
match self {
|
|
|
|
TextureFormat::R8 => 1,
|
|
|
|
TextureFormat::R16F => 2,
|
|
|
|
TextureFormat::RGBA8 => 4,
|
|
|
|
TextureFormat::RGBA16F => 8,
|
|
|
|
TextureFormat::RGBA32F => 16,
|
2019-06-05 17:35:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl ClearOps {
|
|
|
|
#[inline]
|
|
|
|
pub fn has_ops(&self) -> bool {
|
|
|
|
self.color.is_some() || self.depth.is_some() || self.stencil.is_some()
|
|
|
|
}
|
|
|
|
}
|
2019-12-20 14:48:29 -05:00
|
|
|
|
|
|
|
impl<'a> TextureDataRef<'a> {
|
|
|
|
#[doc(hidden)]
|
|
|
|
pub fn check_and_extract_data_ptr(self, minimum_size: Vector2I, format: TextureFormat)
|
|
|
|
-> *const c_void {
|
|
|
|
let channels = match (format, self) {
|
|
|
|
(TextureFormat::R8, TextureDataRef::U8(_)) => 1,
|
|
|
|
(TextureFormat::RGBA8, TextureDataRef::U8(_)) => 4,
|
|
|
|
(TextureFormat::RGBA16F, TextureDataRef::F16(_)) => 4,
|
|
|
|
(TextureFormat::RGBA32F, TextureDataRef::F32(_)) => 4,
|
|
|
|
_ => panic!("Unimplemented texture format!"),
|
|
|
|
};
|
|
|
|
|
|
|
|
let area = minimum_size.x() as usize * minimum_size.y() as usize;
|
|
|
|
|
|
|
|
match self {
|
|
|
|
TextureDataRef::U8(data) => {
|
|
|
|
assert!(data.len() >= area * channels);
|
|
|
|
data.as_ptr() as *const c_void
|
|
|
|
}
|
|
|
|
TextureDataRef::F16(data) => {
|
|
|
|
assert!(data.len() >= area * channels);
|
|
|
|
data.as_ptr() as *const c_void
|
|
|
|
}
|
|
|
|
TextureDataRef::F32(data) => {
|
|
|
|
assert!(data.len() >= area * channels);
|
|
|
|
data.as_ptr() as *const c_void
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|