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

Fix UI corruption for AMD gpus with Vulkan #9169

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod render_pass;

use bevy_core_pipeline::{core_2d::Camera2d, core_3d::Camera3d};
use bevy_hierarchy::Parent;
use bevy_render::view::Msaa;
use bevy_render::{ExtractSchedule, Render};
use bevy_window::{PrimaryWindow, Window};
pub use pipeline::*;
Expand Down Expand Up @@ -794,6 +795,7 @@ pub fn queue_uinodes(
ui_batches: Query<(Entity, &UiBatch)>,
mut views: Query<(&ExtractedView, &mut RenderPhase<TransparentUi>)>,
events: Res<SpriteAssetEvents>,
msaa: Res<Msaa>,
) {
// If an image has changed, the GpuImage has (probably) changed
for event in &events.images {
Expand All @@ -819,7 +821,10 @@ pub fn queue_uinodes(
let pipeline = pipelines.specialize(
&pipeline_cache,
&ui_pipeline,
UiPipelineKey { hdr: view.hdr },
UiPipelineKey {
hdr: view.hdr,
msaa_samples: msaa.samples(),
},
);
for (entity, batch) in &ui_batches {
image_bind_groups
Expand Down
3 changes: 2 additions & 1 deletion crates/bevy_ui/src/render/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl FromWorld for UiPipeline {
#[derive(Clone, Copy, Hash, PartialEq, Eq)]
pub struct UiPipelineKey {
pub hdr: bool,
pub msaa_samples: u32,
}

impl SpecializedRenderPipeline for UiPipeline {
Expand Down Expand Up @@ -117,7 +118,7 @@ impl SpecializedRenderPipeline for UiPipeline {
},
depth_stencil: None,
multisample: MultisampleState {
count: 1,
count: key.msaa_samples,
mask: !0,
alpha_to_coverage_enabled: false,
},
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/render/render_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Node for UiPassNode {
};
let mut render_pass = render_context.begin_tracked_render_pass(RenderPassDescriptor {
label: Some("ui_pass"),
color_attachments: &[Some(target.get_unsampled_color_attachment(Operations {
color_attachments: &[Some(target.get_color_attachment(Operations {
load: LoadOp::Load,
store: true,
}))],
Expand Down