Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,10 @@ fn each_neutral_verb_answers_of_a_gta5_install_what_gta5s_own_verb_answers() {
let (printed, _, ok) = world(&config, &["find", &game, "TOWN", "--neutral"]);
assert!(ok, "{printed}");
let lines: Vec<&str> = printed.lines().collect();
assert_eq!(lines[0], "`TOWN`: 1 map(s)");
assert_eq!(lines[0], "Find `TOWN`");
assert_eq!(lines[1], " Map: 1");
assert!(
lines[1].starts_with(" map m_town 0x") && lines[1].ends_with(" places 2"),
lines[2].contains("map") && lines[2].contains("m_town") && lines[2].contains("0x"),
"{printed}"
);

Expand Down
2 changes: 1 addition & 1 deletion docs/direction/GTA_VI_Platforms_Plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Read at `6b1dda52`. Each is a fact of one build written as a fact of the game.
**Shaders.**

- The Xbox package's reader is `crates/io/or-io/src/gta5/shaders/xdat.rs`, under GTA V's folder. The native front end's decoder and control-flow graph take plain words (`crates/tools/or-shader-front/src/rdna/decode.rs`, `crates/tools/or-shader-front/src/rdna/cfg.rs`), but its lowering takes a program record filled from offsets of that package, and `crates/tools/or-shader-front/src/rdna_bind/mod.rs` reads the package's binding list at fixed offsets.
- The renderer hands a translated program what the console hands it: image descriptors in `src/render/gta6_meshlets.rs` and the ray tracer's node layout in `crates/runtime/or-renderer/src/game_shaders/trace/arena.rs`. Whether another platform's programs read the same is not measured.
- The renderer hands a translated program what the console hands it: image descriptors in `src/render/gta6_meshlets/mod.rs` and the ray tracer's node layout in `crates/runtime/or-renderer/src/game_shaders/trace/arena.rs`. Whether another platform's programs read the same is not measured.

**Tests.** The install-gated suites take one build from `OPENRAGE_GTA6_BUILD`, each reading the variable itself, list every `.rpf` under it, and several assert figures measured on the Xbox build. The pack suite alone goes through `or_test_support::game_roots`, which already takes a list of folders.

Expand Down
2 changes: 1 addition & 1 deletion docs/direction/Unified_World_Plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ Read [Shader_Definition_Database.md](../features/Shader_Definition_Database.md)

### The programs of GTA VI over a world (R71h)

Read [what a build's programs come to](../features/GTA_VI_Builds.md#what-a-builds-programs-come-to), [what the graphics library cannot run](#what-the-graphics-library-cannot-run), `crates/runtime/or-renderer/src/game_shaders/geometry/meshlets.rs`, `src/render/gta6_meshlets.rs` and `src/state/gta6/drawable/gta6_shaders/mod.rs`.
Read [what a build's programs come to](../features/GTA_VI_Builds.md#what-a-builds-programs-come-to), [what the graphics library cannot run](#what-the-graphics-library-cannot-run), `crates/runtime/or-renderer/src/game_shaders/geometry/meshlets.rs`, `src/render/gta6_meshlets/mod.rs` and `src/state/gta6/drawable/gta6_shaders/mod.rs`.

- **Builds.** GTA VI's profile: its targets and steps; its surface pass over the host's pages as storage buffers; a transform for each instance, which nothing feeds today; the bindings only the game fills, named; the buffer fitting Metal needs, applied where the app builds a pass; and an encoder its fallback surfaces write its targets with, where today such a surface is drawn after the resolve. Then its lighting: by its own programs if the bindings the game fills can be named, and by named passes if not, which the measure makes the likelier.
- **Deletes.** A family of the fallback's shader once every supported backend draws every material that used it; the renderer's mapping of a material onto a family with the last of them.
Expand Down
9 changes: 9 additions & 0 deletions src/i18n/languages/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -19509,3 +19509,12 @@ msgstr "Erklärte Grenzen des Wassers: Es liegt ruhig, da das Spiel seine Höhe

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "Dem Wasser nicht gespeist: der Schaum und die Nässe, die die Simulation des Spiels legt, der Wind auf seinen Wellen und die Sonnenstrahlen durch den Nebel"

msgid "Named place"
msgstr "Benannter Ort"

msgid "Placed object"
msgstr "Platziertes Objekt"

msgid "What was typed reads as no place and no hash"
msgstr "Die Eingabe entspricht weder einem Ort noch einem Hash"
9 changes: 9 additions & 0 deletions src/i18n/languages/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -19509,3 +19509,12 @@ msgstr "Límites declarados del agua: está en calma, porque el juego mueve su a

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "No alimentado al agua: la espuma y lo mojado que deja la simulación del juego, el viento sobre sus ondas y los rayos del sol a través de la niebla"

msgid "Named place"
msgstr "Lugar con nombre"

msgid "Placed object"
msgstr "Objeto colocado"

msgid "What was typed reads as no place and no hash"
msgstr "Lo escrito no corresponde a ningún lugar ni hash"
9 changes: 9 additions & 0 deletions src/i18n/languages/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -19509,3 +19509,12 @@ msgstr "Limites déclarées de l'eau : elle est calme, car le jeu anime sa haute

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "Non alimenté pour l'eau : l'écume et le mouillé que pose la simulation du jeu, le vent sur ses rides et les rayons du soleil dans le brouillard"

msgid "Named place"
msgstr "Lieu nommé"

msgid "Placed object"
msgstr "Objet placé"

msgid "What was typed reads as no place and no hash"
msgstr "Ce qui a été saisi ne correspond à aucun lieu ni hachage"
9 changes: 9 additions & 0 deletions src/i18n/languages/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -19509,3 +19509,12 @@ msgstr "Limiti dichiarati dell'acqua: è calma, perché il gioco muove la sua al

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "Non alimentato all'acqua: la schiuma e il bagnato che la simulazione del gioco stende, il vento sulle sue increspature e i raggi del sole attraverso la nebbia"

msgid "Named place"
msgstr "Luogo con nome"

msgid "Placed object"
msgstr "Oggetto posizionato"

msgid "What was typed reads as no place and no hash"
msgstr "Ciò che è stato digitato non corrisponde a nessun luogo né hash"
9 changes: 9 additions & 0 deletions src/i18n/languages/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -19509,3 +19509,12 @@ msgstr "水について明示された制限:ゲームは水の高さとさざ

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "水に与えられていないもの:ゲームのシミュレーションが置く泡と濡れ、さざ波への風、霧を通る太陽の光線"

msgid "Named place"
msgstr "名前付き場所"

msgid "Placed object"
msgstr "配置されたオブジェクト"

msgid "What was typed reads as no place and no hash"
msgstr "入力された内容は場所としてもハッシュとしても解釈できません"
9 changes: 9 additions & 0 deletions src/i18n/languages/ko.po
Original file line number Diff line number Diff line change
Expand Up @@ -19509,3 +19509,12 @@ msgstr "물의 명시된 한계: 게임이 물의 높이와 잔물결을 셰이

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "물에 주어지지 않는 것: 게임의 시뮬레이션이 까는 거품과 젖음, 잔물결에 부는 바람, 안개를 지나는 햇살"

msgid "Named place"
msgstr "이름이 지정된 장소"

msgid "Placed object"
msgstr "배치된 오브젝트"

msgid "What was typed reads as no place and no hash"
msgstr "입력한 내용은 장소나 해시로 해석할 수 없습니다"
9 changes: 9 additions & 0 deletions src/i18n/languages/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -19509,3 +19509,12 @@ msgstr "Limites declarados da água: ela fica calma, pois o jogo move sua altura

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "Não alimentado à água: a espuma e o molhado que a simulação do jogo deposita, o vento sobre suas ondulações e os raios do sol através da névoa"

msgid "Named place"
msgstr "Local nomeado"

msgid "Placed object"
msgstr "Objeto posicionado"

msgid "What was typed reads as no place and no hash"
msgstr "O que foi digitado não corresponde a nenhum local nem hash"
9 changes: 9 additions & 0 deletions src/i18n/languages/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -19695,3 +19695,12 @@ msgstr "Заявленные ограничения воды: она споко

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "Не подаётся воде: пена и мокрота, которые кладёт симуляция игры, ветер на её ряби и лучи солнца сквозь туман"

msgid "Named place"
msgstr "Именованное место"

msgid "Placed object"
msgstr "Размещённый объект"

msgid "What was typed reads as no place and no hash"
msgstr "Введённый текст не распознаётся ни как место, ни как хеш"
9 changes: 9 additions & 0 deletions src/i18n/languages/zh.po
Original file line number Diff line number Diff line change
Expand Up @@ -19509,3 +19509,12 @@ msgstr "水的已声明限制:水面平静,因为游戏在着色器之外移

msgid "Not fed to the water: the foam and the wet the game's simulation lays, the wind on its ripples, and the rays of the sun through the fog"
msgstr "未提供给水的内容:游戏模拟铺下的泡沫与潮湿、吹在波纹上的风,以及穿过雾的阳光"

msgid "Named place"
msgstr "命名地点"

msgid "Placed object"
msgstr "已放置对象"

msgid "What was typed reads as no place and no hash"
msgstr "输入的内容既不是地点也不是哈希值"
2 changes: 1 addition & 1 deletion src/render/gta6_hair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ fn collect_color_overrides(
) -> HashMap<u32, u32> {
let mut map = HashMap::new();
let mut ingest = |vals: &[u32]| {
for pair in vals.chunks_exact(2) {
for pair in vals.as_chunks::<2>().0 {
if pair[0] != 0 && pair[1] != 0 {
map.insert(pair[0], pair[1]);
}
Expand Down
File renamed without changes.
160 changes: 4 additions & 156 deletions src/render/gta6_meshlets.rs → src/render/gta6_meshlets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ use or_io::hash::string_hash_str;
use or_renderer::game_shaders::mesh::Image;
use or_renderer::game_shaders::meshlets::{Feed, FrameFeed, MeshletSurface, ROW, VERTICES};

mod packing;

use packing::{merge_feeds, pose_surface, stand};

use super::gta6_layers::Material;
use crate::state::gta6_resource::{drawable_of, effect_name};
use crate::state::gta6_shaders::layer_index::{self as gta6_layer_index, Index};
Expand Down Expand Up @@ -814,161 +818,6 @@ fn game_textures(
}
}

/// Have `surface`, drawn by `pass`, stand where `placement` puts it, a row-major 3x4 matrix: its
/// object's matrix and each bone's at rest are that one. A surface in place is left as it is.
fn stand(pass: &Gta6ShadingPass, surface: &mut MeshletSurface, placement: [f32; 12]) {
if placement == super::gta6_instances::IN_PLACE[0] {
return;
}
let mut rows = [0f32; 16];
rows[..12].copy_from_slice(&placement);
rows[15] = 1.0;
let whole = glam::Mat4::from_cols_array(&rows)
.transpose()
.to_cols_array();
let bytes = |floats: &[f32]| -> Vec<u8> {
let each: Vec<u8> = floats.iter().flat_map(|f| f.to_le_bytes()).collect();
each.repeat(MATRICES)
};
// A stage that reads the object's matrix is placed by it alone: its bones stay at rest under it.
let feeds = || pass.mesh.feeds.iter().chain(&pass.pixel.feeds);
// A stage that places its instances by their records is placed by those alone.
if feeds().any(|fed| fed.feed == Filled::InstanceRecords) {
return;
}
let by_object = feeds().any(|fed| fed.feed == Filled::Placement);
for fed in feeds() {
let stood = match fed.feed {
Filled::Placement => bytes(&whole),
Filled::Bones if !by_object => bytes(&placement),
_ => continue,
};
let stood = Feed::Bytes(headed(fed.header, &stood));
surface.feeds.insert((fed.group, fed.binding), stood);
}
}

/// The typed `u32` bone-index remap table a skinned ped mesh stage indexes by vertex bone index
/// when its draw-word remap offset is zero (`cb4_[7].y != 0xFFFF_FFFF`). Leaving it empty causes
/// bounds-checked storage loads to return 0 and collapse every vertex onto bone 0.
const BONE_REMAP: u32 = 0x0D29_BC56;

/// Apply `pose`'s per-palette bone skinning matrices to every `Filled::Bones` binding of `surface`,
/// and bind an identity remap table (`0..matrices`) to `BONE_REMAP` so vertex bone indices reach
/// their palette slots directly.
fn pose_surface(
pass: &Gta6ShadingPass,
surface: &mut MeshletSurface,
drawable: &Drawable,
model: &Model,
pose: &super::gta6_ped_pose::PedPose,
) {
let feeds = || pass.mesh.feeds.iter().chain(&pass.pixel.feeds);
if !feeds().any(|fed| fed.feed == Filled::Bones) {
return;
}
let matrices = match &model.palette {
Ok(or_io::gta6::headerless::Palette::Hashes(hashes)) => MATRICES.max(hashes.len()),
_ => MATRICES,
};
let bone_bytes = pose.palette_bytes(drawable, model, matrices);
let remap_words: Vec<u32> = (0..matrices as u32).collect();
let remap_bytes = bytes_of(&remap_words);
for fed in feeds() {
match fed.feed {
Filled::Bones => {
let filled = Feed::Bytes(headed(fed.header, &bone_bytes));
surface.feeds.insert((fed.group, fed.binding), filled);
}
Filled::Zero(Some(BONE_REMAP)) => {
let filled = Feed::Bytes(headed(fed.header, &remap_bytes));
surface.feeds.insert((fed.group, fed.binding), filled);
}
_ => {}
}
}
}

/// Pack the part feeds of each stage buffer merged to fit a device budget into one buffer at
/// `merged.at`, matching `or_shader_front::rdna_bind::budget::within`.
fn merge_feeds(merged: &[or_cli::Gta6MergedBuffer], feeds: &mut BTreeMap<(u32, u32), Feed>) {
for group in merged {
let mut parts: Vec<Option<Feed>> = group
.parts
.iter()
.map(|part| feeds.remove(&part.was))
.collect();
let combined = match group.listed {
None => {
let total = group
.parts
.iter()
.map(|p| (p.offset + p.bytes) as usize)
.max()
.unwrap_or(0);
let mut whole = vec![0u8; total];
let mut view_proj: Option<Option<usize>> = None;
for (part, feed) in group.parts.iter().zip(parts.drain(..)) {
let raw = match feed {
Some(Feed::Bytes(bytes)) => bytes,
Some(Feed::View {
bytes,
view_proj: at,
}) => {
let shifted = at.map(|offset| part.offset as usize + offset);
view_proj = Some(view_proj.flatten().or(shifted));
bytes
}
_ => continue,
};
let start = part.offset as usize;
let copy = raw.len().min(part.bytes as usize);
whole[start..start + copy].copy_from_slice(&raw[..copy]);
}
match view_proj {
Some(view_proj) => Feed::View {
bytes: whole,
view_proj,
},
None => Feed::Bytes(whole),
}
}
Some(element) => {
let stride = (element as usize).max(4);
let mut chunks: Vec<Vec<u8>> = Vec::with_capacity(parts.len());
for feed in parts.drain(..) {
let mut raw = match feed {
Some(Feed::Bytes(bytes) | Feed::View { bytes, .. }) => bytes,
_ => Vec::new(),
};
let padded = raw.len().max(stride).next_multiple_of(stride);
raw.resize(padded, 0);
chunks.push(raw);
}
let header_elems = chunks.len() + 1;
let total_bytes: usize =
header_elems * stride + chunks.iter().map(Vec::len).sum::<usize>();
let mut whole = vec![0u8; total_bytes];
let mut next = header_elems as u32;
for (slot, chunk) in chunks.iter().enumerate() {
let at = slot * stride;
whole[at..at + 4].copy_from_slice(&next.to_le_bytes());
next += (chunk.len() / stride) as u32;
}
let end_at = chunks.len() * stride;
whole[end_at..end_at + 4].copy_from_slice(&next.to_le_bytes());
let mut cursor = header_elems * stride;
for chunk in chunks {
whole[cursor..cursor + chunk.len()].copy_from_slice(&chunk);
cursor += chunk.len();
}
Feed::Bytes(whole)
}
};
feeds.insert(group.at, combined);
}
}

/// The geometries of `models` the view draws of `drawable` as surfaces of their own passes, with
/// `why` the first that is none is not, and the effects they draw with. `None` where a geometry
/// names a shader the drawable does not list.
Expand Down Expand Up @@ -1132,7 +981,6 @@ pub(crate) fn meshlets_of(
Some((out, effects))
}

#[path = "gta6_forward.rs"]
mod forward;

#[cfg(test)]
Expand Down
Loading
Loading