doc: doc preset
This commit is contained in:
parent
8fa38c564c
commit
5d668a2233
|
@ -9,7 +9,7 @@ use std::str::FromStr;
|
|||
pub struct ShaderPassConfig {
|
||||
/// The index of the shader pass relative to its parent preset.
|
||||
pub id: i32,
|
||||
/// The path to the shader pass source file.
|
||||
/// The fully qualified path to the shader pass source file.
|
||||
pub name: PathBuf,
|
||||
/// The alias of the shader pass if available.
|
||||
pub alias: Option<String>,
|
||||
|
@ -23,23 +23,31 @@ pub struct ShaderPassConfig {
|
|||
pub srgb_framebuffer: bool,
|
||||
/// Whether or not this shader pass expects an float framebuffer output.
|
||||
pub float_framebuffer: bool,
|
||||
/// Whether or not to generate mipm
|
||||
/// Whether or not to generate mipmaps for the input texture before passing to the shader.
|
||||
pub mipmap_input: bool,
|
||||
/// Specifies the scaling of the output framebuffer for this shader pass.
|
||||
pub scaling: Scale2D,
|
||||
}
|
||||
|
||||
#[repr(i32)]
|
||||
#[derive(Default, Copy, Clone, Debug)]
|
||||
/// The scaling type for the shader pass.
|
||||
pub enum ScaleType {
|
||||
#[default]
|
||||
/// Scale by the size of the input quad.
|
||||
Input = 0,
|
||||
/// Scale the framebuffer in absolute units.
|
||||
Absolute,
|
||||
/// Scale by the size of the viewport.
|
||||
Viewport,
|
||||
}
|
||||
|
||||
/// The scaling factor for framebuffer scaling.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum ScaleFactor {
|
||||
/// Scale by a fractional float factor.
|
||||
Float(f32),
|
||||
/// Scale by an absolute factor.
|
||||
Absolute(i32),
|
||||
}
|
||||
|
||||
|
@ -93,34 +101,54 @@ impl FromStr for ScaleType {
|
|||
}
|
||||
}
|
||||
|
||||
/// Framebuffer scaling parameters.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Scaling {
|
||||
/// The method to scale the framebuffer with.
|
||||
pub scale_type: ScaleType,
|
||||
/// The factor to scale by.
|
||||
pub factor: ScaleFactor,
|
||||
}
|
||||
|
||||
/// 2D quad scaling parameters.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Scale2D {
|
||||
/// Whether or not this combination of scaling factors is valid.
|
||||
pub valid: bool,
|
||||
/// Scaling parameters for the X axis.
|
||||
pub x: Scaling,
|
||||
/// Scaling parameters for the Y axis.
|
||||
pub y: Scaling,
|
||||
}
|
||||
|
||||
/// Configuration options for a lookup texture used in the shader.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TextureConfig {
|
||||
/// The name of the texture.
|
||||
pub name: String,
|
||||
/// The fully qualified path to the texture.
|
||||
pub path: PathBuf,
|
||||
/// The wrap (addressing) mode to use when sampling the texture.
|
||||
pub wrap_mode: WrapMode,
|
||||
/// The filter mode to use when sampling the texture.
|
||||
pub filter_mode: FilterMode,
|
||||
/// Whether or not to generate mipmaps for this texture.
|
||||
pub mipmap: bool,
|
||||
}
|
||||
|
||||
/// Configuration options for a shader parameter.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ParameterConfig {
|
||||
/// The name of the parameter.
|
||||
pub name: String,
|
||||
/// The value it is set to in the preset.
|
||||
pub value: f32,
|
||||
}
|
||||
|
||||
/// A shader preset including all specified parameters, textures, and paths to specified shaders.
|
||||
///
|
||||
/// A shader preset can be used to create a filter chain runtime instance, or reflected to get
|
||||
/// parameter metadata.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ShaderPreset {
|
||||
/// Used in legacy GLSL shader semantics. If < 0, no feedback pass is used.
|
||||
|
|
|
@ -164,27 +164,32 @@ impl OwnedFramebuffer {
|
|||
self.init(image.size, ImageFormat::from(format))?;
|
||||
}
|
||||
|
||||
// unsafe {
|
||||
// self.context.CopySubresourceRegion(
|
||||
// &self.texture,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// 0,
|
||||
// &resource,
|
||||
// 0,
|
||||
// Some(&D3D11_BOX {
|
||||
// left: 0,
|
||||
// top: 0,
|
||||
// front: 0,
|
||||
// right: self.size.width,
|
||||
// bottom: self.size.height,
|
||||
// back: 1,
|
||||
// }),
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// todo: improve mipmap generation?
|
||||
// will need a staging texture + full so might not be worth it.
|
||||
|
||||
#[cfg(feature = "testing_full_gpu_copy")]
|
||||
unsafe {
|
||||
self.context.CopySubresourceRegion(
|
||||
&self.texture,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&resource,
|
||||
0,
|
||||
Some(&D3D11_BOX {
|
||||
left: 0,
|
||||
top: 0,
|
||||
front: 0,
|
||||
right: self.size.width,
|
||||
bottom: self.size.height,
|
||||
back: 1,
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
self.texture = resource;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue