Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Glitching [Rendering Issue] #8894

Open
hiibolt opened this issue Jun 19, 2023 · 5 comments · Fixed by #9169
Open

Text Glitching [Rendering Issue] #8894

hiibolt opened this issue Jun 19, 2023 · 5 comments · Fixed by #9169
Labels
A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior O-Windows Specific to the Windows desktop operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@hiibolt
Copy link

hiibolt commented Jun 19, 2023

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();
}
@hiibolt hiibolt added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 19, 2023
@Selene-Amanita Selene-Amanita added A-Rendering Drawing game state to the screen O-Windows Specific to the Windows desktop operating system A-UI Graphical user interfaces, styles, layouts, and widgets S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Jun 19, 2023
@nicoburns
Copy link
Contributor

This looks similar to #7944

@hiibolt
Copy link
Author

hiibolt commented Jun 19, 2023

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

@ickshonpe
Copy link
Contributor

Do you get the same corruption when you use Text2dBundle?

@hiibolt
Copy link
Author

hiibolt commented Jun 21, 2023

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

Notable overlap between the issue and reproducible test cases:

  • Common denominator of Vulkan backend
  • Both of my machines and @AmionSky's machine are running Windows 11 Pro (22H2)
  • Both of my machines and @AmionSky's machine use 6-series AMD cards with proprietary drivers

github-merge-queue bot pushed a commit that referenced this issue Jul 19, 2023
# Objective

Fixes #8894 
Fixes #7944 

## Solution

The UI pipeline's `MultisampleState::count` is set to 1 whereas the
`MultisampleState::count` for the camera's ViewTarget is taken from the
`Msaa` resource, and corruption occurs when these two values are
different.

This PR solves the problem by setting `MultisampleState::count` for the
UI pipeline to the value from the Msaa resource too.

I don't know much about Bevy's rendering internals or graphics hardware,
so maybe there is a better solution than this. UI MSAA was probably
disabled for a good reason (performance?).

## Changelog
* Enabled multisampling for the UI pipeline.
@hymm
Copy link
Contributor

hymm commented Jul 25, 2023

reopening as #9169 was reverted in #9237

@hymm hymm reopened this Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior O-Windows Specific to the Windows desktop operating system S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants