pub trait RenderTest {
// Required methods
fn new(path: &Path) -> Result<Self>
where Self: Sized;
fn image_size(&self) -> Size<u32>;
fn render_with_preset_and_params(
&mut self,
preset: ShaderPreset,
frame_count: usize,
output_size: Option<Size<u32>>,
param_setter: Option<&dyn Fn(&RuntimeParameters)>,
frame_options: Option<CommonFrameOptions>,
) -> Result<RgbaImage>;
// Provided methods
fn render(
&mut self,
path: &Path,
flags: ShaderFeatures,
frame_count: usize,
output_size: Option<Size<u32>>,
) -> Result<RgbaImage> { ... }
fn render_with_preset(
&mut self,
preset: ShaderPreset,
frame_count: usize,
output_size: Option<Size<u32>>,
) -> Result<RgbaImage> { ... }
}Expand description
Test harness to set up a device, render a triangle, and apply a shader
Required Methods§
Sourcefn new(path: &Path) -> Result<Self>where
Self: Sized,
fn new(path: &Path) -> Result<Self>where
Self: Sized,
Create a new instance of the test harness.
Sourcefn image_size(&self) -> Size<u32>
fn image_size(&self) -> Size<u32>
Get the size of the image loaded.
Sourcefn render_with_preset_and_params(
&mut self,
preset: ShaderPreset,
frame_count: usize,
output_size: Option<Size<u32>>,
param_setter: Option<&dyn Fn(&RuntimeParameters)>,
frame_options: Option<CommonFrameOptions>,
) -> Result<RgbaImage>
fn render_with_preset_and_params( &mut self, preset: ShaderPreset, frame_count: usize, output_size: Option<Size<u32>>, param_setter: Option<&dyn Fn(&RuntimeParameters)>, frame_options: Option<CommonFrameOptions>, ) -> Result<RgbaImage>
Render a shader onto an image buffer, applying the provided shader.
The test should render in linear colour space for proper comparison against backends.
For testing purposes, it is often that a single image will be reused with multiple shader presets, so the actual image that a shader will be applied to will often be part of the test harness object.
Provided Methods§
Sourcefn render(
&mut self,
path: &Path,
flags: ShaderFeatures,
frame_count: usize,
output_size: Option<Size<u32>>,
) -> Result<RgbaImage>
fn render( &mut self, path: &Path, flags: ShaderFeatures, frame_count: usize, output_size: Option<Size<u32>>, ) -> Result<RgbaImage>
Render a shader onto an image buffer, applying the provided shader.
The test should render in linear colour space for proper comparison against backends.
For testing purposes, it is often that a single image will be reused with multiple shader presets, so the actual image that a shader will be applied to will often be part of the test harness object.
Sourcefn render_with_preset(
&mut self,
preset: ShaderPreset,
frame_count: usize,
output_size: Option<Size<u32>>,
) -> Result<RgbaImage>
fn render_with_preset( &mut self, preset: ShaderPreset, frame_count: usize, output_size: Option<Size<u32>>, ) -> Result<RgbaImage>
Render a shader onto an image buffer, applying the provided shader.
The test should render in linear colour space for proper comparison against backends.
For testing purposes, it is often that a single image will be reused with multiple shader presets, so the actual image that a shader will be applied to will often be part of the test harness object.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".