Skip to content

The animation engine for agents: blazingly fast math and 3D videos with Manim's Python API, on a Rust GPU core.

Python

Draw with Direct3D 12 on Windows

Sina Atalayc217a81d0e62
diff --git a/docs/content/changelog.md b/docs/content/changelog.md
index 814d2fab..e817e875 100644
--- a/docs/content/changelog.md
+++ b/docs/content/changelog.md
@@ -51,6 +51,7 @@ The notable changes to ManimGX, release by release. The format follows
- Make the folder a video or a storyboard is written in when it is missing (`render -o new/out.mp4`, `inspect -o new/sheet.png` and `Scene.render`), instead of failing with "No such file or directory" ([#34](https://github.com/academa-labs/manimgx/issues/34)).
- Raise a ValueError, naming where it is, for a nested, unclosed or stray bracket in a `say` script, which was spoken and captioned ([#39](https://github.com/academa-labs/manimgx/issues/39)).
- Time and caption speech in the pieces Unicode lets a line break between, so a `say` span in Chinese, Japanese or Thai, written without spaces, is timed by its own characters or words, where the whole sentence was one word ([#40](https://github.com/academa-labs/manimgx/issues/40)). Captions are the text as it is written, at most 42 columns wide (a Chinese or Japanese character takes two); a line never starts with a closing mark such as `,` or `」`, and ends where a sentence does, a quoted one too. A speech's words are found in its text by themselves, so a trimmed speech, or a voice that cuts its words its own way, no longer fails or mistimes a span; and an empty span after the last word starts where that word ends.
+- Draw with Direct3D 12 on Windows, as the docs said, not with a GPU's Vulkan driver, which the engine took first: Intel's crashed rendering ([#50](https://github.com/academa-labs/manimgx/issues/50)). Browsers draw WebGPU with Direct3D 12 on Windows too, and CI's Windows runners test it.
- Show an image drawn smaller than its pixels as their mean: each pixel of the video shows the mean of the picture's pixels it covers, however the image is squashed and whatever its `resampling_algorithm`, where it showed the picture at one point, so thin lines broke up and small text was unreadable ([#36](https://github.com/academa-labs/manimgx/issues/36)). An image at its size or larger is drawn as before.
- Keep resources needed by queued video frames until their transparency retries finish, fixing render failures during cache cleanup ([#16](https://github.com/academa-labs/manimgx/issues/16)).
- Draw a storyboard picture without dropping the frame the film holds back, fixing `manimgx render` failures ("unknown shape") under memory pressure.
diff --git a/rust/engine/src/render.rs b/rust/engine/src/render.rs
index 763a7c58..32d1e67a 100644
--- a/rust/engine/src/render.rs
+++ b/rust/engine/src/render.rs
@@ -1091,12 +1091,17 @@ async fn adapter(instance: &wgpu::Instance) -> Result<wgpu::Adapter, String> {
}
impl Gpu {
- /// The system's GPU, WebGPU's (Metal, Vulkan, DX12, the browser's): its device, and what draws on it.
+ /// The system's GPU, through the system's own API (Metal on macOS, Direct3D 12 on Windows, Vulkan on Linux, the
+ /// browser's WebGPU): its device, and what draws on it.
pub(crate) async fn new() -> Result<Self, String> {
// the system's adapter; where none will do, the lavapipe a Linux wheel bundles
let descriptor = wgpu::InstanceDescriptor { backends: wgpu::Backends::PRIMARY, ..wgpu::InstanceDescriptor::new_without_display_handle() };
+ // On Windows, Direct3D 12 alone, as browsers draw WebGPU there: offered Vulkan too, wgpu
+ // takes a GPU's Vulkan driver first, which is not the one Windows and its apps are tested
+ // with (an Intel GPU's crashed), nor the one CI draws with: WARP is Direct3D 12's.
#[cfg(windows)]
let descriptor = wgpu::InstanceDescriptor {
+ backends: wgpu::Backends::DX12,
backend_options: wgpu::BackendOptions { dx12: wgpu::Dx12BackendOptions { shader_compiler: dxc::compiler()?, ..Default::default() }, ..descriptor.backend_options },
..descriptor
};