Added conditional configurations for WASM target for gradients & storage buffers, since storage buffers are not supported on wgpu WASM target at the moment.

This commit is contained in:
bungoboingo 2022-11-10 14:43:38 -08:00
parent 23299a555f
commit 365f37a3ae
5 changed files with 27 additions and 3 deletions

View file

@ -1,5 +1,7 @@
//! Draw geometry using meshes of triangles.
use crate::{Color, Gradient};
use crate::Color;
#[cfg(not(target_arch = "wasm32"))]
use crate::Gradient;
use bytemuck::{Pod, Zeroable};
@ -27,6 +29,7 @@ pub struct Vertex2D {
pub enum Style {
/// Fill a primitive with a solid color.
Solid(Color),
#[cfg(not(target_arch = "wasm32"))]
/// Fill a primitive with an interpolated color.
Gradient(Gradient),
}
@ -37,6 +40,7 @@ impl From<Color> for Style {
}
}
#[cfg(not(target_arch = "wasm32"))]
impl From<Gradient> for Style {
fn from(gradient: Gradient) -> Self {
Self::Gradient(gradient)