rsx_reader/lib.rs
1//! Readers for PlayStation 3 RSX graphics data: shader program containers (`CgBinaryProgram`, vertex and fragment), the
2//! fragment program microcode inside them, and the `CellGcmTexture` texture descriptor. All data is big endian.
3//!
4//! The container reader keeps microcode encoded; it does not infer shader behaviour from parameter names. Everything a
5//! reader cannot read is an error naming the byte offset (see [`cgbinary::Error`], [`fragment::Error`]). Layout sources and scope are in the
6//! crate's README.
7//!
8//! ```
9//! use rsx_reader::gcm::CellGcmTexture;
10//!
11//! // A 24-byte descriptor: format 0xA5 (linear), 1 mip, 2D, a 256x128 image, identity remap.
12//! let mut bytes = [0u8; 24];
13//! bytes[0] = 0xa5;
14//! bytes[1] = 1;
15//! bytes[2] = 2;
16//! bytes[4..8].copy_from_slice(&0xaae4u32.to_be_bytes());
17//! bytes[8..10].copy_from_slice(&256u16.to_be_bytes());
18//! bytes[10..12].copy_from_slice(&128u16.to_be_bytes());
19//! bytes[12..14].copy_from_slice(&1u16.to_be_bytes());
20//!
21//! let texture = CellGcmTexture::parse(&bytes).expect("exactly 24 bytes");
22//! assert_eq!((texture.width, texture.height), (256, 128));
23//! assert!(texture.linear());
24//! ```
25#![deny(
26 clippy::arithmetic_side_effects,
27 clippy::indexing_slicing,
28 clippy::cast_possible_truncation
29)]
30#![deny(missing_docs)]
31#![deny(clippy::disallowed_methods, clippy::disallowed_types)]
32
33pub mod cgbinary;
34pub mod fragment;
35pub mod gcm;
36pub mod vertex;