use concinnity_core::render::depth::{DEPTH_CLEAR, DEPTH_INCLUSIVE_COMPARE};
use windows::Win32::Graphics::Direct3D12::*;
use windows::Win32::Graphics::Dxgi::Common::DXGI_FORMAT_D32_FLOAT;
use crate::directx::pso::CompareOp;
pub(in crate::directx) fn optimized_clear() -> D3D12_CLEAR_VALUE {
D3D12_CLEAR_VALUE {
Format: DXGI_FORMAT_D32_FLOAT,
Anonymous: D3D12_CLEAR_VALUE_0 {
DepthStencil: D3D12_DEPTH_STENCIL_VALUE {
Depth: DEPTH_CLEAR,
Stencil: 0,
},
},
}
}
pub(in crate::directx) fn shadow_sample_compare() -> D3D12_COMPARISON_FUNC {
CompareOp::depth(DEPTH_INCLUSIVE_COMPARE).raw()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_shadow_sampler_passes_at_or_nearer_the_light() {
assert_eq!(shadow_sample_compare(), D3D12_COMPARISON_FUNC_GREATER_EQUAL);
}
}