Sprite rendering on dx12 seems broken since bevy 0.20.0
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 57/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
Research direction
Start by reproducing the provided TextureAtlas example on DirectX 12 with Bevy 0.20.0 or 0.20.1, then compare it with Vulkan and Bevy 0.19.1. Trace sprite atlas rendering through the relevant rendering code and tests, focusing on differences that could explain missing sprites or incorrect placement on DirectX 12. Done means the provided example renders all digits in their expected positions on DirectX 12.
Written by the indexing model from the issue text.
Description
Bevy version and features
- bevy 0.20.0, with default features
Relevant system information
`AdapterInfo { name: "NVIDIA GeForce RTX 5060 Ti", vendor: 4318, device: 11524, device_type: DiscreteGpu, device_pci_bus_id: "0000:01:00.0", driver: "32.0.16.2114", driver_info: "", backend: Dx12, subgroup_min_size: 32, subgroup_max_size: 32, transient_saves_memory: Some(false), limit_bucket: None }`
What you did
- Prepare a sprite sheet that contains digit from 0 to 9, and create sprites for each digit using
TextureAtlas. - Run program with specify
$env:WGPU_BACKEND="vulkan"or$env:WGPU_BACKEND="dx12".
What went wrong
In bevy 0.19.1:
Sprites rendered correctly (like Figure 1) on both vulkan and dx12.
In bevy 0.20.0 (and 0.20.1):
On vulkan, all digit are rendered correctly (like Figure 1).
On dx12, some digit are not rendered, and some digit are rendered on unexpected place (like Figure 2).
Code to reproduce this problem:
use bevy::{prelude::*, window::WindowResolution};
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
resolution: WindowResolution::new(300, 200),
..default()
}),
..default()
}))
.add_systems(Startup, startup)
.run();
}
fn startup(
asset_server: Res<AssetServer>,
mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>,
mut commands: Commands,
) {
let mut layout = TextureAtlasLayout::new_empty(UVec2::new(140, 14));
let indexes = (0..10)
.map(|o| layout.add_texture(URect::new(14 * o, 0, 14 * (o + 1), 14)))
.collect::<Vec<_>>();
let image = asset_server.load::<Image>("test.png");
let layout = texture_atlas_layouts.add(layout);
commands.spawn(Camera2d);
for (offset, index) in indexes.into_iter().enumerate() {
commands.spawn((
Sprite {
image: image.clone(),
texture_atlas: Some(TextureAtlas {
layout: layout.clone(),
index: index,
}),
..default()
},
Transform {
translation: Vec3::new(14.0 * offset as f32, 0.0, 0.0),
..default()
},
));
}
}
Additional information
Figure 1:
Figure 2:
Sprite sheet:
- Dominant language
- Rust
- Stars
- 49.8k
- Forks
- 5.1k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 136
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bevyengine/bevy
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
bevyengine/bevy#26642 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
bevyengine/bevy#26641 ·
Maintainers usually reply within 2 days
-
A-Animation AI-Assisted C-Bug D-Trivial S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bevyengine/bevy#26637 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bevyengine/bevy#26635 ·
Maintainers usually reply within 2 days
-
Feathers checkbox outline should have flex_shrink: 0Possibly taken @Tatsuya0330 claimed this today. OpenC-Bug S-Needs-Triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
bevyengine/bevy#26630 ·
Maintainers usually reply within 2 days
Similar issues
-
go good first issue test
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
bug triaged tui ux wontfix
Difficulty 2/5 Half a day Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day