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:
parent
23299a555f
commit
365f37a3ae
5 changed files with 27 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ impl Transform {
|
|||
fn transform_style(&self, style: triangle::Style) -> triangle::Style {
|
||||
match style {
|
||||
triangle::Style::Solid(color) => triangle::Style::Solid(color),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
triangle::Style::Gradient(gradient) => {
|
||||
triangle::Style::Gradient(self.transform_gradient(gradient))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue