bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.27k stars 3.58k forks source link

Text Glitching [Rendering Issue] #8894

Open hiibolt opened 1 year ago

hiibolt commented 1 year ago

Bevy version

Crates: bevy = "0.10.1" json = "0.12.4" regex = "1.8.4"

[Optional] Relevant system information

SystemInfo { os: "Windows 11 Home", kernel: "22621", cpu: "13th Gen Intel(R) Core(TM) i5-13600KF", core_count: "14", memory: "63.9 GiB" } AdapterInfo { name: "AMD Radeon RX 6700 XT", vendor: 4098, device: 29663, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "23.5.2 (AMD proprietary shader compiler)", backend: Vulkan }

Windows 11 Home (22H2) [22621.1848] Up-to-date Windows Up-to-date AMD drivers

Steps to reproduce

Link to commit with issue

What went wrong

Text is 'glitching' on my Windows machine, as shown in the following screenshot: image

This issue is NOT reproducible on my NixOS machine, but is reproducible on both of my Windows 11 machines (possibly of note: both are using AMD cards). It's not an issue with my text files, I tested some basic ones. The pattern of glitching is the exact same each startup, regardless of window position or size. Changing the position or scale of the text will result in the pattern changing, so I suspect this is a rendering issue.

The text object is generated per The Book's example:

    commands.spawn((
        GUIScrollText {
            id: String::from("text_ui")
        },
        TextBundle::from_section(
            "Nayu_todo",
            TextStyle {
                font: asset_server.load("fonts/ALLER.ttf"),
                font_size: 100.0,
                color: Color::WHITE,
            },
        ).with_text_alignment(TextAlignment::Left)
            .with_style(Style {
                position_type: PositionType::Absolute,
                position: UiRect {
                    bottom: Val::Px(215.0),
                    left: Val::Px(335.0),
                    ..default()
                },
                ..default()
            })
    ));

It's brought in via a startup system with the following setup:

pub struct ChatController;
impl Plugin for ChatController {
    fn build(&self, app: &mut App){
        app.add_startup_system(import_gui_sprites)
            .add_startup_system(spawn_chatbox);
    }
}
fn import_gui_sprites( mut game_state: ResMut<VisualNovelState>, asset_server: Res<AssetServer> ){

And finally, the plugin is dropped into the main app:

fn main() {
    App::new()
        .add_plugins(DefaultPlugins.set(WindowPlugin {
            primary_window: Some(Window {
                title: String::from("Ettethread - Requiem"),
                resolution: (1280., 800.).into(),
                present_mode: PresentMode::AutoVsync,
                // Tells wasm to resize the window according to the available canvas
                fit_canvas_to_parent: true,
                // Tells wasm not to override default event handling, like F5, Ctrl+R etc.
                prevent_default_event_handling: false,
                ..default()
            }),
            ..default()
        })) 
        .init_resource::<VisualNovelState>()
        .add_startup_system(setup)
        .add_plugin(Compiler)
        .add_plugin(BackgroundController)
        .add_plugin(CharacterController)
        .add_plugin(ChatController)
        .run();
}
nicoburns commented 1 year ago

This looks similar to https://github.com/bevyengine/bevy/issues/7944

hiibolt commented 1 year ago

I agree, I'm running Vulkan. How do I use DX12 to verify that's the cause?

ickshonpe commented 1 year ago

Do you get the same corruption when you use Text2dBundle?

hiibolt commented 1 year ago

Issue not present with Text2dBundle! Issue not present when using DX12 as backend!

Notable overlap between the issue and reproducible test cases:

hymm commented 1 year ago

reopening as #9169 was reverted in #9237