Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
031bab2
Repair zero-byte DDS files on TTPF resume
EdenBendheim Nov 23, 2026
d90e4b2
world_build: restore write mode before unlink on replace failure in _…
trigger337 Nov 24, 2026
b5dd9ac
dds_png: restore write mode before unlink on replace failure in main …
trigger337 Nov 24, 2026
2cb6ed8
world_names: restore write mode before unlink on replace failure and …
trigger337 Nov 24, 2026
ac42150
gpu-test-results: 4 GB Pascal card on Windows (GPU-PASCAL4GB-WIN)
robot00f Nov 24, 2026
ef46cae
gpu-test-results: spot reruns for the known-failure and wave64 rows (…
robot00f Nov 24, 2026
4210685
gpu-test-results: fallback runs for the barycentric and f16 rows (GPU…
robot00f Nov 24, 2026
cffe269
gpu-test-results: run the 29 wave64 VS/PS/GS fixtures the suite leave…
robot00f Nov 24, 2026
881cf30
docs/d3d12_vulkan.md: the GTX 1050 Ti host-transfer measurement names…
qhukz13 Nov 24, 2026
8dd9eb7
world_drawable_verify: treat another case of one archive as the same …
Dashhhhhhhh Nov 25, 2026
a9413ce
sampler_source_census: fix V#/pointer/SMEM/v_mov dataflow and harden …
IlyassRS3 Nov 25, 2026
0294aed
buffer_format_fuzz: validate --budget
xel1uz Nov 25, 2026
1ded3b4
f16misc_diff: reject a zero or negative --max-ops and --programs
xel1uz Nov 25, 2026
362b854
feature_scan: write --out atomically and keep the old report on failure
xel1uz Nov 25, 2026
f85de7d
gen_gdk_runtime_classes: write --out atomically
xel1uz Nov 25, 2026
4c2666a
docs: D3D-56 descriptor lookup numbers on RTX 3070 (Ampere, ReBAR off)
ramon-victor Nov 23, 2026
b3bca19
docs(testing): note V100 cube-store failure
j-weiner Nov 25, 2026
2bdc69c
bvh_slot_check: restore write mode before unlink on replace failure a…
trigger337 Nov 24, 2026
065df3d
runtime: guard align_up_saturating against zero alignment and add uni…
abnalstlll-byte Nov 25, 2026
401d04b
docs: device slot 62 takes five parameters and slot 76 has no call si…
robot00f Nov 24, 2026
16a9550
tools/dstorage: fit missing BPTC history slots across multi-level sib…
zmasi Nov 26, 2026
801f8e7
Merge origin/main into fix/dstorage-multilevel-bcpack-fit
zmasi Nov 27, 2026
e81f230
Merge remote-tracking branch 'origin/main' into fix/dstorage-multilev…
zmasi Nov 28, 2026
4bc50fb
tests: drive build_dstorage_history.build in multilevel mip fit tests
zmasi Nov 28, 2026
03bee37
Merge remote-tracking branch 'origin/main' into fix/dstorage-multilev…
zmasi Nov 28, 2026
b550567
tests: eliminate wrap-around and strengthen precedence/decode checks …
zmasi Nov 28, 2026
656cfa1
d3d12: mesh programs translate as compute on a host without mesh shad…
qhukz13 Nov 28, 2026
dc5818b
d3d12: mesh pipelines draw through compute and a triangle list withou…
qhukz13 Nov 28, 2026
9f189d6
docs: refresh GPU testing and Vulkan links
DanielMarcos1 Nov 26, 2026
3c1f549
docs/testing: record the two ps_* KosmicKrisp NaN cases
EvgHaze Nov 29, 2026
770f5e0
Merge remote-tracking branch 'origin/main' into work/dstorage-multile…
zmasi Nov 29, 2026
ab4102e
fix(dstorage): preserve signed BC6H SF16 targets and average full mul…
zmasi Nov 29, 2026
a79340f
windows-boot: summarize device loss API and queue checkpoints
sodove Nov 25, 2026
bc0c72f
d3d12: mesh fallback review fixes: no mesh signature for it, the sink…
qhukz13 Nov 29, 2026
528e086
runtime: LEONIDA_SKIP_ASSERTS steps over guest asserts without a trac…
slipperysquid Nov 24, 2026
24d89be
make_game: a run without the LEONIDA board still writes <work>/logs/<…
Diegobecker07 Nov 24, 2026
1b33fa2
d3d12: drew()'s doc comment back on drew(), not on drew_mesh_as_compute
qhukz13 Nov 29, 2026
48ca87f
make_game: the plain stage logs show a command's output as decoded te…
Diegobecker07 Nov 29, 2026
e1e78f3
SHADER-VCC-BASE-GPU-VERIFIED: the vcc base row is GPU-checked on RDNA…
fiestorra Nov 25, 2026
3e0f307
manifest_verifier: restore write mode before unlink on replace failur…
trigger337 Nov 24, 2026
6d5a3ba
windows-boot: test_crash_monitor reads its text files as UTF-8 (text-…
Bloh09 Nov 29, 2026
f569782
windows-boot: test_crash_monitor tolerates code-page module names in …
Bloh09 Nov 29, 2026
1b6b223
d3d12: MeshOut::new is crate-private, as SigElement it takes
qhukz13 Nov 29, 2026
4755667
Merge pull request #2616 from Bloh09/fix/ci-crash-monitor-encoding
MoonEyes Nov 29, 2026
c7ad7ef
Merge pull request #451 from EdenBendheim/ubiq/ttpf-zero-byte-dds-resume
DadaCap Nov 29, 2026
e6901a5
Merge pull request #1007 from robot00f/docs/d3d12-device-slot-arity
DadaCap Nov 29, 2026
1ffdf26
Merge pull request #1076 from robot00f/docs/gpu-pascal4gb
DadaCap Nov 29, 2026
cc56820
Merge pull request #1378 from Diegobecker07/make-game-plain-log
DadaCap Nov 29, 2026
aacc89a
Merge pull request #1395 from Diegobecker07/old-9961-skip-asserts
DadaCap Nov 29, 2026
dd82005
Merge pull request #1396 from qhukz13/cont/docs-1050ti-driver
DadaCap Nov 29, 2026
65b9afc
Merge pull request #1453 from Dashhhhhhhh/fix/world-drawable-verify-c…
DadaCap Nov 29, 2026
924b294
d3d12: the mesh fallback's recording in one place, tested in one list…
qhukz13 Nov 29, 2026
fcf7b7d
Merge pull request #1619 from xel1uz/fix/f16misc-arg-guards
DadaCap Nov 29, 2026
ac5da9d
Merge pull request #1623 from xel1uz/fix/buffer-arg-guards
DadaCap Nov 29, 2026
157038f
Merge pull request #1648 from xel1uz/fix/feature-scan-atomic-out
DadaCap Nov 29, 2026
5248a47
Merge pull request #1668 from xel1uz/fix/gen-gdk-runtime-classes-atom…
DadaCap Nov 29, 2026
761578d
Merge pull request #1766 from sodove/fix/windows-boot-fault-context
DadaCap Nov 29, 2026
c4e3ae5
Merge pull request #1802 from Ch1mpleo/carry/old-9801
DadaCap Nov 29, 2026
0c6f42d
Merge pull request #1872 from fiestorra/carry/shader-vcc-base-gpu
DadaCap Nov 29, 2026
e217665
Merge pull request #1969 from j-weiner/docs/v100-cube-store-status
DadaCap Nov 29, 2026
ef31dc9
Merge pull request #2027 from abnalstlll-byte/feat/rt-xs-alloc-size-g…
DadaCap Nov 29, 2026
541f574
Merge pull request #2409 from DanielMarcos1/docs/refresh-gpu-vulkan-l…
DadaCap Nov 29, 2026
878b024
Merge pull request #2602 from EvgHaze/docs/kosmickrisp-nan-rows
DadaCap Nov 29, 2026
8b27343
Merge pull request #816 from trigger337/fix/world-build-stage-cleanup
MoonEyes Nov 29, 2026
4ccd9cb
Merge pull request #832 from trigger337/fix/dds-png-stage-cleanup
MoonEyes Nov 29, 2026
3e4b15c
Merge pull request #834 from trigger337/fix/world-names-stage-cleanup
MoonEyes Nov 29, 2026
4d531de
Merge pull request #855 from trigger337/fix/bvh-slot-check-stage-cleanup
MoonEyes Nov 29, 2026
0cea8ab
Merge pull request #899 from trigger337/fix/manifest-verifier-stage-c…
MoonEyes Nov 29, 2026
377c45a
Merge pull request #1530 from IlyassRS3/fix/sampler-source-census-dat…
MoonEyes Nov 29, 2026
7c330c7
Merge pull request #2236 from zmasi/fix/dstorage-multilevel-bcpack-fit
MoonEyes Nov 29, 2026
58c3333
Merge main into d3d12-mesh-compute
qhukz13 Nov 29, 2026
eab9c1e
d3d12: the test programs in emit::test_programs, built on every platform
qhukz13 Nov 29, 2026
74ac98c
d3d12: the mesh fallback's shaders take main's sample-mask fields
qhukz13 Nov 29, 2026
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ translator's contract, [docs/linux.md](docs/linux.md) the Linux steps.
| Piece | Where it stands |
|---|---|
| Shaders: carve, unpack the native RDNA2 code, disassemble | all 26,503 |
| Shaders: RDNA2 → SPIR-V | **26,503 / 26,503 translated** (2,236 vertex, 12,101 pixel, 2,689 compute, 9,282 mesh, 195 geometry) and 26,503 / 26,503 passing `spirv-val`. 23,841 are wave64: exact on 64-wide subgroups (AMD); on 32-wide subgroups (NVIDIA, Intel) compute and mesh shaders are exact with wave64 emulation, cross-half wave operations in vertex, pixel and geometry shaders still approximate. The hand-written GPU tests ran on more than 30 GPU and driver combinations ([#166](https://github.com/ItsNotRexed/Leonida/issues/166)) |
| Shaders: RDNA2 → SPIR-V | **26,503 / 26,503 translated** (2,236 vertex, 12,101 pixel, 2,689 compute, 9,282 mesh, 195 geometry) and 26,503 / 26,503 passing `spirv-val`. 23,841 are wave64: exact on 64-wide subgroups (AMD); on 32-wide subgroups (NVIDIA, Intel) compute and mesh shaders are exact with wave64 emulation, cross-half wave operations in vertex, pixel and geometry shaders still approximate. The hand-written GPU tests ran on more than 30 GPU and driver combinations ([GPU test reports](gpu-test-results/)) |
| Models | exported as OBJ with names, UVs and material references: 382,781 recovered in a ten-archive scan, 343,327 of them from `levels.rpf` ([notes](docs/models.md)) |
| Textures | texture dictionaries and world texture pools exported as DDS; BCPack decoded for BC1-BC7 where the history it needs is known ([notes](docs/textures.md)) |
| Audio | AWC banks exported whole: Opus losslessly as Ogg Opus, PCM as WAV, XMA2 through ffmpeg; 1,589 music and radio records measured ([notes](docs/audio.md), [config](docs/audio_config.md)) |
Expand Down
2 changes: 2 additions & 0 deletions d3d12/crates/leonida-gpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ blake3.workspace = true

[dev-dependencies]
tempfile.workspace = true
# The host checks' device and shaders (`emit::host`) for the mesh fallback's test.
leonida-shader = { workspace = true, features = ["host"] }

[features]
# Debugging switches (frame capture, the host debug layer, per-draw data).
Expand Down
239 changes: 226 additions & 13 deletions d3d12/crates/leonida-gpu/src/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,31 @@ fn is_depth_companion(stencil: &View, depth: &View) -> bool {
&& s[7] == d[7]
}

/// The host topology a title's draws with `topology` go out with: the
/// console's rectangles, fans, loops and quads as triangle lists.
fn host_topology(topology: u32) -> u32 {
match topology {
RECTANGLES | TRIANGLE_FAN | LINE_LOOP | QUADS | QUAD_STRIP => 4,
t => t,
}
}

/// The device-local buffer mesh programs run as compute write to
/// ([`leonida_shader::emit::MESH_OUT_BYTES`], made once; it starts and ends
/// each use in the common state).
fn mesh_buffer() -> Option<ID3D12Resource> {
static BUFFER: std::sync::Mutex<Option<ID3D12Resource>> = std::sync::Mutex::new(None);
let mut held = BUFFER.lock().unwrap_or_else(|e| e.into_inner());
if let Some(b) = held.as_ref() {
return Some(b.clone());
}
let size = u64::from(leonida_shader::emit::MESH_OUT_BYTES);
let b = crate::host::host()?.uav_buffer(size)?;
tracing::info!(mib = size >> 20, "mesh buffer (mesh programs run as compute)");
*held = Some(b.clone());
Some(b)
}

/// Shader interface metadata shared by every pipeline variant and draw.
pub(crate) struct TablePlan {
groups: Vec<TableGroup>,
Expand Down Expand Up @@ -1033,6 +1058,10 @@ pub(crate) struct State {
heaps: [usize; 2],
graphics: Vec<Root>,
compute: Vec<Root>,
/// While a mesh program runs as compute (`D3D12-MESH-COMPUTE-FALLBACK`):
/// its root arguments are the title's graphics ones, bound on the
/// compute side.
title_side_graphics: bool,
vertex: [VertexView; 32],
index: IndexView,
/// Bound render target and depth resources, for their host states.
Expand Down Expand Up @@ -2186,14 +2215,10 @@ impl State {
pub(crate) fn set_topology(&mut self, list: &HostList, topology: u32) {
self.topology = topology;
self.topology_set = true;
let host = match topology {
RECTANGLES => 4,
TRIANGLE_FAN | LINE_LOOP | QUADS | QUAD_STRIP => {
once!(topology, "console topology drawn as a triangle list");
4
}
t => t,
};
if matches!(topology, TRIANGLE_FAN | LINE_LOOP | QUADS | QUAD_STRIP) {
once!(topology, "console topology drawn as a triangle list");
}
let host = host_topology(topology);
// SAFETY: an open list.
unsafe {
list.list
Expand Down Expand Up @@ -2976,6 +3001,10 @@ impl State {
}
for (views, srv) in [(&stage.root_cbvs, false), (&stage.root_srvs, true)] {
for (at, &(slot, param)) in views.iter().enumerate() {
if srv && slot == leonida_shader::emit::SLOT_MESH_IN {
// Ours: the mesh buffer, bound by `mesh_as_compute`.
continue;
}
if srv && slot == leonida_shader::emit::SLOT_MEMORY {
// Ours: the directory of title memory by address.
if let Some(m) = &memory {
Expand Down Expand Up @@ -3045,6 +3074,10 @@ impl State {
}
}
for &(slot, param) in &stage.root_uavs {
if slot == leonida_shader::emit::SLOT_MESH_OUT {
// Ours: the mesh buffer, bound by `mesh_as_compute`.
continue;
}
if slot == leonida_shader::emit::SLOT_FAULTS {
// Ours: where shaders note the pages they found empty.
if let Some(m) = &memory {
Expand Down Expand Up @@ -4960,6 +4993,129 @@ impl State {
)
}

/// `D3D12-MESH-COMPUTE-FALLBACK`: `x` groups of a mesh pipeline on a host
/// without mesh shaders. The mesh program runs as compute with the
/// title's graphics root arguments, writing each group's outputs to the
/// mesh buffer; the pipeline then draws them as a triangle list of
/// `x * max_primitives * 3` vertices through its pass-through vertex
/// shader. The buffer starts and ends each use in the common state, so
/// every list finds it there.
fn mesh_as_compute(&mut self, list: &HostList, x: u32, p: &crate::pipeline::host::HostPipeline, mode: u8) -> bool {
let Some(mc) = p.mesh_compute.as_deref() else {
return false;
};
// Groups past the buffer's slots (`MeshOut::groups_cap`) draw nothing.
if x > mc.layout.groups_cap() {
once!(x, cap = mc.layout.groups_cap(), "a mesh dispatch of more groups than the mesh buffer holds: the rest draw nothing");
}
let n = x.min(65_535);
if n == 0 {
return true;
}
let Some(buffer) = mesh_buffer() else {
once!("no mesh buffer: the mesh draw is dropped");
return false;
};
self.title_side_graphics = true;
let bound = self.bind(list, &mc.cs, true);
self.title_side_graphics = false;
if !bound {
return false;
}
let run = self.mesh_run(list, &buffer, mc);
// SAFETY: an open list, a live buffer and the compute pipeline bound.
let drawn = unsafe {
run.direct(n, || {
// The compute pipeline took the list's pipeline slot.
self.host_pipeline = 0;
let drawn = self.prepare_for(list, false, true);
if drawn {
self.mesh_scissor(list, true, mode);
}
drawn
})
};
if drawn {
self.mesh_scissor(list, false, mode);
}
list.keep(&buffer);
drawn
}

/// The recorder of a mesh run on `list` ([`crate::mesh_fallback`]): it
/// sets the title's topology again after its triangle list, for the
/// title's next draw.
fn mesh_run<'a>(
&self,
list: &'a HostList,
buffer: &'a ID3D12Resource,
mc: &crate::pipeline::host::MeshCompute,
) -> crate::mesh_fallback::MeshRun<'a> {
crate::mesh_fallback::MeshRun {
list: &list.list,
buffer,
out_param: mc.out_param,
in_param: mc.in_param,
max_primitives: mc.layout.max_primitives,
groups_cap: mc.layout.groups_cap(),
restore: self
.topology_set
.then(|| windows::Win32::Graphics::Direct3D::D3D_PRIMITIVE_TOPOLOGY(host_topology(self.topology) as i32)),
}
}

/// [`Self::mesh_as_compute`] for one indirect record: the record's
/// `(x, y, z)` is a dispatch's arguments as it stands (`stride` apart),
/// so the compute pipeline runs it as recorded; its groups raise the
/// buffer header's instance count, and the draw reads the header's
/// arguments (`3 * max_primitives` vertices, one instance a group).
fn mesh_indirect_as_compute(
&mut self,
list: &HostList,
p: &crate::pipeline::host::HostPipeline,
(arguments, at, stride): (&ID3D12Resource, u64, u32),
count: Option<(&ID3D12Resource, u64)>,
mode: u8,
) -> bool {
let Some(mc) = p.mesh_compute.as_deref() else {
return false;
};
let (Some(dispatch), Some(draw)) = (host_signature(2, stride), host_signature(0, 16)) else {
return false;
};
let Some(buffer) = mesh_buffer() else {
once!("no mesh buffer: the mesh draw is dropped");
return false;
};
self.title_side_graphics = true;
let bound = self.bind(list, &mc.cs, true);
self.title_side_graphics = false;
if !bound {
return false;
}
let run = self.mesh_run(list, &buffer, mc);
// SAFETY: an open list, live buffers and the compute pipeline bound.
let drawn = unsafe {
run.indirect(&dispatch, &draw, (arguments, at), count, || {
self.host_pipeline = 0;
let drawn = self.prepare_for(list, false, true);
if drawn {
self.mesh_scissor(list, true, mode);
}
drawn
})
};
let Some(drawn) = drawn else {
once!("a list without WriteBufferImmediate: the mesh draw is dropped");
return false;
};
if drawn {
self.mesh_scissor(list, false, mode);
}
list.keep(&buffer);
drawn
}

/// A mesh draw under `LEONIDA_MESH_TEST=scissor` rasterises one pixel:
/// the scissors before it (`on`), the title's after it. `mode`: [`mesh_test`] as it was
/// for the draw (taken once, so that the title's scissors come back whatever a switch by
Expand Down Expand Up @@ -4989,6 +5145,20 @@ impl State {
crate::drops::begin();
crate::drops::note(Why::SkipList);
}
// Without mesh shaders: the program as compute, its output drawn.
let fallback = crate::pipeline::host_pipeline_for(self.pipeline as This, &self.target_formats)
.filter(|p| p.mesh_compute.is_some());
if let Some(p) = fallback {
let ran = !held && self.mesh_as_compute(list, x, p, mode);
if ran {
self.drew_mesh_as_compute(p);
DRAWN.fetch_add(1, Ordering::Relaxed);
} else {
DROPPED.fetch_add(1, Ordering::Relaxed);
crate::drops::count_noted(Kind::Draw, Why::Other);
}
return;
}
let ran = !held
&& self.prepare_for(list, false, true)
&& match list.list.cast::<ID3D12GraphicsCommandList6>() {
Expand Down Expand Up @@ -5091,7 +5261,7 @@ impl State {
}

fn roots_ref(&self, compute: bool) -> &Vec<Root> {
if compute {
if compute && !self.title_side_graphics {
&self.compute
} else {
&self.graphics
Expand Down Expand Up @@ -5841,6 +6011,16 @@ impl State {
}
}

/// [`Self::drew`] for a mesh pipeline run as compute and a draw: the
/// mesh program's own stores (to title buffers; its outputs to the mesh
/// buffer are not counted) as well as the draw's.
fn drew_mesh_as_compute(&mut self, p: &HostPipeline) {
self.drew(Some(p));
if let Some(mc) = p.mesh_compute.as_deref() {
self.drew(Some(&mc.cs));
}
}

/// A draw with the pipeline `p` was recorded (as [`State::buffers_written`]
/// if its shaders can store to buffers).
fn drew(&mut self, p: Option<&HostPipeline>) {
Expand Down Expand Up @@ -6117,6 +6297,19 @@ impl State {
));
return false;
}
// `D3D12-MESH-COMPUTE-FALLBACK`: the pipeline is a compute and a
// graphics one, not a mesh pipeline, so the title's indirect mesh
// dispatch cannot run as recorded (the host loses the device when it
// is: 2026-11-28, GTX 1050 Ti).
// So it runs as compute and a draw (`mesh_indirect_as_compute`), one
// record at a time.
// shortcut: several records a call (each would fill the same slots)
// are left out.
if kind == MESH && p.mesh_compute.is_some() && max != 1 {
once!(max, "an indirect mesh dispatch of several records without mesh shaders is left out");
why("an indirect mesh dispatch of several records without mesh shaders");
return false;
}
// A program run several console groups to a host group takes the console's grid from
// root constants the records carry (`crate::indirect::bound_packed`).
if kind == DISPATCH && pack_broken(p) {
Expand All @@ -6140,16 +6333,20 @@ impl State {
},
None => None,
};
let Some(signature) = matches!(kind, DRAW | INDEXED | DISPATCH | MESH)
// A mesh program run as compute needs no host signature of its own
// (`mesh_indirect_as_compute` makes its own of a dispatch and a
// draw), and a host without mesh shaders may refuse a mesh one.
let as_compute = kind == MESH && p.mesh_compute.is_some();
let signature = (matches!(kind, DRAW | INDEXED | DISPATCH | MESH) && !as_compute)
.then(|| match pack {
Some(pack) => pack_signature(&p.root, pack),
None => host_signature(kind, stride),
})
.flatten()
else {
.flatten();
if signature.is_none() && !as_compute {
why("no host signature");
return false;
};
}
let mode = if kind == MESH { mesh_test() } else { 0 };
if kind == MESH && (mode == 1 || !mesh_kept(self.pipeline)) {
crate::drops::note(Why::SkipList);
Expand Down Expand Up @@ -6257,6 +6454,22 @@ impl State {
(bounded, 0)
}
};
if as_compute {
let counted = counter.as_ref().map(|(s, at)| (&s.buffer, s.offset(*at)));
let ran = self.mesh_indirect_as_compute(list, p, (&bounded, at, stride), counted, mode);
if ran {
self.drew_mesh_as_compute(p);
DRAWN.fetch_add(1, Ordering::Relaxed);
} else {
crate::drops::note(Why::BindFailed);
why("the mesh program as compute did not run");
}
return ran;
}
// (Made above for every kind but a mesh program run as compute.)
let Some(signature) = signature else {
return false;
};
let ran = match kind {
DRAW | INDEXED => self.prepare(list, kind == INDEXED),
MESH => self.prepare_for(list, false, true),
Expand Down
18 changes: 18 additions & 0 deletions d3d12/crates/leonida-gpu/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,24 @@ fn create() -> windows::core::Result<Host> {
let amd = crate::indirect::amd(&device);
leonida_shader::emit::set_host_rdna(amd && o1.WaveLaneCountMin == 32 && o1.WaveLaneCountMax == 64);
}
// `D3D12-MESH-COMPUTE-FALLBACK`: without mesh shaders at shader model 6.6 (Pascal and older) the
// translator writes mesh programs as compute, drawn through a vertex shader of ours
// (`pipeline::host::MeshCompute`). `LEONIDA_MESH_COMPUTE=1` takes that path on any card.
let mut o7 = D3D12_FEATURE_DATA_D3D12_OPTIONS7::default();
let mut model = D3D12_FEATURE_DATA_SHADER_MODEL {
HighestShaderModel: D3D_SHADER_MODEL_6_6,
};
let mesh = device
.CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS7, (&raw mut o7).cast(), size_of_val(&o7) as u32)
.is_ok()
&& device
.CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, (&raw mut model).cast(), size_of_val(&model) as u32)
.is_ok()
&& o7.MeshShaderTier != D3D12_MESH_SHADER_TIER_NOT_SUPPORTED
&& model.HighestShaderModel.0 >= D3D_SHADER_MODEL_6_6.0;
let forced = std::env::var_os("LEONIDA_MESH_COMPUTE").is_some_and(|v| v == "1");
leonida_shader::emit::set_host_mesh_shaders(mesh && !forced);
tracing::info!(mesh, forced, "mesh programs run as compute: {}", !mesh || forced);
let messages = debug
.then(|| device.cast::<ID3D12InfoQueue>().ok())
.flatten();
Expand Down
2 changes: 2 additions & 0 deletions d3d12/crates/leonida-gpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ pub mod descriptor;
pub mod device;
#[cfg(windows)]
mod draw;
#[cfg(windows)]
mod mesh_fallback;
#[cfg(any(windows, test))]
mod drops;
#[cfg(windows)]
Expand Down
Loading
Loading