Trait RenderTest

Source
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§

Source

fn new(path: &Path) -> Result<Self>
where Self: Sized,

Create a new instance of the test harness.

Source

fn image_size(&self) -> Size<u32>

Get the size of the image loaded.

Source

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§

Source

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.

Source

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.

Implementors§