Files
xenia-rs/crates/xenia-gpu/src/shaders/mod.rs
MechaCat02 79eb52c378 xenia-gpu: end-to-end Xenos pipeline (PM4, ucode, EDRAM, resolve)
First real GPU implementation. Ring/PM4 frontend (ring_view,
ring_drain, pm4) drains the command processor; gpu_system owns the
threaded backend (DrainFence RPC + parker/fence helpers from M1) and
the MMIO-mapped register block (mmio_region).

Xenos shader frontend: ucode/{alu,control_flow,fetch,mod}.rs decode
the Xbox 360 microcode, translator.rs lowers it onto the WGSL
xenos_interp interpreter shader (shaders/xenos_interp.wgsl).
shader_metrics.rs counts decode/translate work.

Render state: draw_state, primitive, render_target_cache,
texture_cache, tiled_address (Xenos's swizzled tiled-memory layout),
xenos_constants (register field constants), edram (the 10 MiB EDRAM
model with MSAA), and resolve.rs (TILE_FLUSH copy-out — clear-resolve
plus bitwise-equivalent 32 bpp + 64 bpp paths landed). handle.rs
owns the typed GPU-resource handles the kernel hands out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 16:29:38 +02:00

37 lines
1.3 KiB
Rust

//! Embedded WGSL shader sources used by the host pipeline.
/// Xenos uber-shader scaffold (P3). See the comment at the top of
/// [`XENOS_INTERP_WGSL`] for scope/limits and the plan's P3b target state.
pub const XENOS_INTERP_WGSL: &str = include_str!("xenos_interp.wgsl");
#[cfg(test)]
mod tests {
use super::*;
/// Parsing through naga validates the shader against WGSL spec + wgpu's
/// type system. We don't need a full pipeline to catch typos and layout
/// mistakes — this test is fast and catches regressions at `cargo test`
/// time.
#[test]
fn xenos_interp_wgsl_parses() {
let module = naga::front::wgsl::parse_str(XENOS_INTERP_WGSL)
.expect("xenos_interp.wgsl must parse cleanly");
// Sanity: we declared two entry points.
assert!(!module.entry_points.is_empty());
assert!(
module
.entry_points
.iter()
.any(|e| e.name == "vs_main" && e.stage == naga::ShaderStage::Vertex),
"missing vs_main entry"
);
assert!(
module
.entry_points
.iter()
.any(|e| e.name == "fs_main" && e.stage == naga::ShaderStage::Fragment),
"missing fs_main entry"
);
}
}