Render: save wood images with physical grain controls (#1599)
* Render: save wood images with physical grain controls * Render: prepare plain glass before marking the GPU host ready
This commit is contained in:
@@ -37,6 +37,11 @@ pub struct TextureView<'a> {
|
||||
height: usize,
|
||||
}
|
||||
impl<'a> TextureView<'a> {
|
||||
/// Borrow the admitted linear RGBA storage without a copy or another scan.
|
||||
pub fn rgba(&self) -> &'a [f32] {
|
||||
self.rgba
|
||||
}
|
||||
|
||||
pub fn new(rgba: &'a [f32], dimensions: [u32; 2]) -> Result<Self, SamplingError> {
|
||||
let [width, height] = dimensions;
|
||||
if width == 0 || height == 0 || width > MAX_TEXTURE_EDGE || height > MAX_TEXTURE_EDGE {
|
||||
@@ -54,6 +59,18 @@ impl<'a> TextureView<'a> {
|
||||
Ok(Self { rgba, width, height })
|
||||
}
|
||||
|
||||
/// Shape-only borrow of immutable storage validated incrementally by its builder.
|
||||
#[cfg(feature = "raytrace-cpu")]
|
||||
pub(crate) fn from_admitted(rgba: &'a [f32], dimensions: [u32; 2]) -> Result<Self, SamplingError> {
|
||||
let [width, height] = dimensions;
|
||||
if width == 0 || height == 0 || width > MAX_TEXTURE_EDGE || height > MAX_TEXTURE_EDGE {
|
||||
return Err(SamplingError::Dimensions);
|
||||
}
|
||||
if rgba.len() != width as usize * height as usize * 4 {
|
||||
return Err(SamplingError::Length);
|
||||
}
|
||||
Ok(Self { rgba, width: width as usize, height: height as usize })
|
||||
}
|
||||
/// Bilinear level-zero RGB for an explicitly opaque consumer. Alpha is validated
|
||||
/// but deliberately ignored (even zero-alpha RGB participates). This is NOT
|
||||
/// transparent compositing or premultiplied-alpha filtering.
|
||||
|
||||
Reference in New Issue
Block a user