Skip to content

Commit

Permalink
Fixed issue with material's not respecting z-indices correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
StarArawn committed Dec 16, 2023
1 parent 263e049 commit 980ebe5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/render/material/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::render::{
unified::pipeline::{
queue_quads_inner, DrawUIDraw, ExtractedQuad, ImageBindGroups, PreviousClip, PreviousIndex,
QuadBatch, QuadMeta, QuadTypeOffsets, SetUIViewBindGroup, UIQuadType, UnifiedPipeline,
UnifiedPipelineKey,
UnifiedPipelineKey, MaterialZ,
},
};

Expand Down Expand Up @@ -313,7 +313,7 @@ pub fn queue_material_ui_quads<M: MaterialUI>(
materialui_pipeline: Res<MaterialUIPipeline<M>>,
mut pipelines: ResMut<SpecializedRenderPipelines<MaterialUIPipeline<M>>>,
pipeline_cache: ResMut<PipelineCache>,
mut extracted_quads: Query<(&'static mut ExtractedQuad, &'static Handle<M>)>,
mut extracted_quads: Query<(&'static mut ExtractedQuad, &'static Handle<M>, &'static MaterialZ)>,
mut views: Query<(
Entity,
&'static mut UIRenderPhase<TransparentUI>,
Expand Down Expand Up @@ -374,7 +374,7 @@ pub fn queue_material_ui_quads<M: MaterialUI>(
let mut last_quad = ExtractedQuad::default();
let mut pipeline_id = None;

for (mut quad, material_handle) in extracted_quads.iter_mut() {
for (mut quad, material_handle, material_z) in extracted_quads.iter_mut() {
let asset_id: AssetId<M> = material_handle.clone_weak().into();
if let Some(materialui) = render_materials.get(&asset_id) {
if quad.quad_type == UIQuadType::Clip {
Expand All @@ -394,6 +394,8 @@ pub fn queue_material_ui_quads<M: MaterialUI>(
},
));

quad.z_index = material_z.0;

queue_quads_inner(
&mut commands,
&render_device,
Expand Down

0 comments on commit 980ebe5

Please sign in to comment.