Shadow and trace programs translate, lint clean, ray-tracing write-up

- 59 of the 64 trace programs and the irradiance-cache shading program
  translate; 51 programs leave the approximate wave64 forms.
- The workspace passes the lint with warnings as errors in both feature sets;
  a few style lints are let through in Cargo.toml for this fork.
- README status updated (relay and in-place memory results);
  docs/fork-ray-tracing.md describes what the title does and what is built.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
fxcelessandClaude Fable 5.2 committed 2026-11-24 13:48:06 -05:00
1 parent 6fa814fba5
commit af8f4c68bf
21 files changed
+2350 -62

No files matched your search

+2 -2
View File
@@ -146,12 +146,12 @@ pub(crate) fn frame_drew(frame: u64, drawn: u64) {
pub(crate) fn wanted(n: u64) -> bool {
// Before the world, with `VICTORY_CAPTURE_WORLD`: every 16th frame too
// (small pictures of menus, loading screens and title cards).
let before_world = world_on() && n % 16 == 0 && WORLD.load(std::sync::atomic::Ordering::Relaxed) == u64::MAX;
let before_world = world_on() && n.is_multiple_of(16) && WORLD.load(std::sync::atomic::Ordering::Relaxed) == u64::MAX;
// In the world: every 8th frame's picture, a timeline of the opening
// cutscene (its shots do not fall on the same frame numbers from run to
// run, so single frames cannot be compared between runs).
let first = WORLD.load(std::sync::atomic::Ordering::Relaxed);
let in_world = world_on() && first != u64::MAX && n > first && (n - first) % 8 == 0;
let in_world = world_on() && first != u64::MAX && n > first && (n - first).is_multiple_of(8);
folder().is_some() && (n.is_power_of_two() || listed(n) || before_world || in_world)
}
+2 -2
View File
@@ -1534,13 +1534,13 @@ fn buffer_view_ok(format: DXGI_FORMAT, first: u64, count: u32, stride: u32, raw:
let f = format.0 as u32;
let element = if raw {
// raw: R32 typeless, counted in dwords, starting on 16 bytes
if format != DXGI_FORMAT_R32_TYPELESS || stride != 0 || first % 4 != 0 {
if format != DXGI_FORMAT_R32_TYPELESS || stride != 0 || !first.is_multiple_of(4) {
return false;
}
4
} else if stride > 0 {
// structured: no format, a stride the host takes
if format != DXGI_FORMAT_UNKNOWN || stride > 2048 || stride % 4 != 0 {
if format != DXGI_FORMAT_UNKNOWN || stride > 2048 || !stride.is_multiple_of(4) {
return false;
}
u64::from(stride)
+1 -1
View File
@@ -377,7 +377,7 @@ extern "system" fn unknown_pipeline<const SLOT: usize>(
let mut bytes = [0u8; 128];
(at != 0 && crate::host::read_into(at as *const u8, &mut bytes)).then(|| {
bytes
.chunks_exact(8)
.as_chunks::<8>().0.iter()
.map(|c| c.iter().rev().fold(0u64, |v, &b| v << 8 | u64::from(b)))
.collect()
})
+1 -1
View File
@@ -929,7 +929,7 @@ extern "system" fn copy_texture_region(
static COUNT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
let n = COUNT.fetch_add(1, std::sync::atomic::Ordering::Relaxed) + 1;
let made = read_back(list, dst, x, y, z, src, source_box);
if n <= 16 || n % 4096 == 0 || made.is_err() {
if n <= 16 || n.is_multiple_of(4096) || made.is_err() {
static REFUSED: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
if made.is_err() && REFUSED.fetch_add(1, std::sync::atomic::Ordering::Relaxed) >= 16 {
return;
+1
View File
@@ -83,6 +83,7 @@ static KEPT: [std::sync::atomic::AtomicU64; 4] = [const { std::sync::atomic::Ato
/// the library's file (kept whole while the library lives) and what its
/// last save wrote.
#[cfg(windows)]
#[cfg_attr(not(feature = "diagnostics"), allow(dead_code))]
pub(crate) fn kept() -> [u64; 7] {
use std::sync::atomic::Ordering::Relaxed;
[
+1
View File
@@ -306,6 +306,7 @@ pub(crate) struct HostPipeline {
pub(crate) name: String,
/// Its depth, stencil, cull and blend state in short, for the frame
/// listing (empty for compute).
#[cfg_attr(not(feature = "diagnostics"), allow(dead_code))]
pub(crate) state: String,
}
+2 -2
View File
@@ -853,7 +853,7 @@ const NOT_WATCHED: u8 = 2;
fn first_difference(a: &[u8], b: &[u8]) -> Option<usize> {
let whole = a.len().min(b.len()) / 8 * 8;
let from = a[..whole]
.chunks_exact(8)
.as_chunks::<8>().0.iter()
.zip(b[..whole].chunks_exact(8))
.position(|(x, y)| x != y)
.map_or(whole, |word| word * 8);
@@ -867,7 +867,7 @@ fn last_difference(a: &[u8], b: &[u8]) -> Option<usize> {
return Some(whole + i);
}
let word = a[..whole]
.chunks_exact(8)
.as_chunks::<8>().0.iter()
.zip(b[..whole].chunks_exact(8))
.rposition(|(x, y)| x != y)?
* 8;
+1 -1
View File
@@ -653,7 +653,7 @@ impl Staging {
const HASH_EVERY: u64 = 8;
let unwritten = last.asked != 0 && written.iter().all(|&(_, w)| w <= last.asked);
last.asked = now;
let turn = crate::frame::current().wrapping_add((start >> 16) as u64) % HASH_EVERY == 0;
let turn = crate::frame::current().wrapping_add((start >> 16) as u64).is_multiple_of(HASH_EVERY);
if unwritten && !turn {
return 0;
}