mod private
{
use crate::*;
#[ derive( Default, Clone ) ]
pub struct TextureBindingLayout
{
multisampled : Option< bool >,
sample_type : Option< GpuTextureSampleType >,
view_dimension : Option< GpuTextureViewDimension >
}
impl TextureBindingLayout {
pub fn new() -> Self
{
Self::default()
}
pub fn multisampled( mut self ) -> Self
{
self.multisampled = Some( true );
self
}
pub fn sample_type( mut self, s_type : GpuTextureSampleType ) -> Self
{
self.sample_type = Some( s_type );
self
}
pub fn sample_float( mut self ) -> Self
{
self.sample_type = Some( GpuTextureSampleType::Float );
self
}
pub fn sample_unfilterable_float( mut self ) -> Self
{
self.sample_type = Some( GpuTextureSampleType::UnfilterableFloat );
self
}
pub fn sample_depth( mut self ) -> Self
{
self.sample_type = Some( GpuTextureSampleType::Depth );
self
}
pub fn sample_sint( mut self ) -> Self
{
self.sample_type = Some( GpuTextureSampleType::Sint );
self
}
pub fn sample_uint( mut self ) -> Self
{
self.sample_type = Some( GpuTextureSampleType::Uint );
self
}
pub fn view_dimension( mut self, dimension : GpuTextureViewDimension ) -> Self
{
self.view_dimension = Some( dimension );
self
}
pub fn view_1d( mut self ) -> Self
{
self.view_dimension = Some( GpuTextureViewDimension::N1d );
self
}
pub fn view_2d( mut self ) -> Self
{
self.view_dimension = Some( GpuTextureViewDimension::N2d );
self
}
pub fn view_2d_array( mut self ) -> Self
{
self.view_dimension = Some( GpuTextureViewDimension::N2dArray );
self
}
pub fn view_cube( mut self ) -> Self
{
self.view_dimension = Some( GpuTextureViewDimension::Cube );
self
}
pub fn view_cube_array( mut self ) -> Self
{
self.view_dimension = Some( GpuTextureViewDimension::CubeArray );
self
}
pub fn view_3d( mut self ) -> Self
{
self.view_dimension = Some( GpuTextureViewDimension::N3d );
self
}
}
impl From< TextureBindingLayout > for web_sys::GpuTextureBindingLayout
{
fn from( value: TextureBindingLayout ) -> Self
{
let layout = web_sys::GpuTextureBindingLayout::new();
if let Some( v ) = value.multisampled { layout.set_multisampled( v ); }
if let Some( v ) = value.sample_type { layout.set_sample_type( v ); }
if let Some( v ) = value.view_dimension { layout.set_view_dimension( v ); }
layout
}
}
}
crate::mod_interface!
{
orphan use
{
TextureBindingLayout
};
}