Rename box shadow rendering variable names (#16393)

# Objective

It looks like this file was created based on the `ui_texture_slice`
rendering code and some variable names weren't updated.

## Solution

Rename "texture slice" variable names to "box shadow".
This commit is contained in:
Asier Illarramendi 2024-11-19 02:28:34 +01:00 committed by GitHub
parent 00c2edf7b2
commit 1006a528d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,3 +1,5 @@
//! Box shadows rendering
use core::{hash::Hash, ops::Range}; use core::{hash::Hash, ops::Range};
use crate::{ use crate::{
@ -133,14 +135,14 @@ impl FromWorld for BoxShadowPipeline {
} }
#[derive(Clone, Copy, Hash, PartialEq, Eq)] #[derive(Clone, Copy, Hash, PartialEq, Eq)]
pub struct UiTextureSlicePipelineKey { pub struct BoxShadowPipelineKey {
pub hdr: bool, pub hdr: bool,
/// Number of samples, a higher value results in better quality shadows. /// Number of samples, a higher value results in better quality shadows.
pub samples: u32, pub samples: u32,
} }
impl SpecializedRenderPipeline for BoxShadowPipeline { impl SpecializedRenderPipeline for BoxShadowPipeline {
type Key = UiTextureSlicePipelineKey; type Key = BoxShadowPipelineKey;
fn specialize(&self, key: Self::Key) -> RenderPipelineDescriptor { fn specialize(&self, key: Self::Key) -> RenderPipelineDescriptor {
let vertex_layout = VertexBufferLayout::from_vertex_formats( let vertex_layout = VertexBufferLayout::from_vertex_formats(
@ -333,8 +335,8 @@ pub fn extract_shadows(
} }
pub fn queue_shadows( pub fn queue_shadows(
extracted_ui_slicers: ResMut<ExtractedBoxShadows>, extracted_box_shadows: ResMut<ExtractedBoxShadows>,
ui_slicer_pipeline: Res<BoxShadowPipeline>, box_shadow_pipeline: Res<BoxShadowPipeline>,
mut pipelines: ResMut<SpecializedRenderPipelines<BoxShadowPipeline>>, mut pipelines: ResMut<SpecializedRenderPipelines<BoxShadowPipeline>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<TransparentUi>>, mut transparent_render_phases: ResMut<ViewSortedRenderPhases<TransparentUi>>,
mut views: Query<(Entity, &ExtractedView, Option<&UiBoxShadowSamples>)>, mut views: Query<(Entity, &ExtractedView, Option<&UiBoxShadowSamples>)>,
@ -342,7 +344,7 @@ pub fn queue_shadows(
draw_functions: Res<DrawFunctions<TransparentUi>>, draw_functions: Res<DrawFunctions<TransparentUi>>,
) { ) {
let draw_function = draw_functions.read().id::<DrawBoxShadows>(); let draw_function = draw_functions.read().id::<DrawBoxShadows>();
for (entity, extracted_shadow) in extracted_ui_slicers.box_shadows.iter() { for (entity, extracted_shadow) in extracted_box_shadows.box_shadows.iter() {
let Ok((view_entity, view, shadow_samples)) = views.get_mut(extracted_shadow.camera_entity) let Ok((view_entity, view, shadow_samples)) = views.get_mut(extracted_shadow.camera_entity)
else { else {
continue; continue;
@ -354,8 +356,8 @@ pub fn queue_shadows(
let pipeline = pipelines.specialize( let pipeline = pipelines.specialize(
&pipeline_cache, &pipeline_cache,
&ui_slicer_pipeline, &box_shadow_pipeline,
UiTextureSlicePipelineKey { BoxShadowPipelineKey {
hdr: view.hdr, hdr: view.hdr,
samples: shadow_samples.copied().unwrap_or_default().0, samples: shadow_samples.copied().unwrap_or_default().0,
}, },
@ -384,7 +386,7 @@ pub fn prepare_shadows(
mut ui_meta: ResMut<BoxShadowMeta>, mut ui_meta: ResMut<BoxShadowMeta>,
mut extracted_shadows: ResMut<ExtractedBoxShadows>, mut extracted_shadows: ResMut<ExtractedBoxShadows>,
view_uniforms: Res<ViewUniforms>, view_uniforms: Res<ViewUniforms>,
texture_slicer_pipeline: Res<BoxShadowPipeline>, box_shadow_pipeline: Res<BoxShadowPipeline>,
mut phases: ResMut<ViewSortedRenderPhases<TransparentUi>>, mut phases: ResMut<ViewSortedRenderPhases<TransparentUi>>,
mut previous_len: Local<usize>, mut previous_len: Local<usize>,
) { ) {
@ -394,8 +396,8 @@ pub fn prepare_shadows(
ui_meta.vertices.clear(); ui_meta.vertices.clear();
ui_meta.indices.clear(); ui_meta.indices.clear();
ui_meta.view_bind_group = Some(render_device.create_bind_group( ui_meta.view_bind_group = Some(render_device.create_bind_group(
"ui_texture_slice_view_bind_group", "box_shadow_view_bind_group",
&texture_slicer_pipeline.view_layout, &box_shadow_pipeline.view_layout,
&BindGroupEntries::single(view_binding), &BindGroupEntries::single(view_binding),
)); ));