Skip to content

Commit 3d3a065

Browse files
authored
Misc cleanup (#11134)
Re-exports a few types/functions I need that have no reason to be private, and some minor code quality changes.
1 parent 786abbf commit 3d3a065

File tree

7 files changed

+35
-34
lines changed

7 files changed

+35
-34
lines changed

crates/bevy_core_pipeline/src/core_3d/main_opaque_pass_3d_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
prepass::{DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass},
55
skybox::{SkyboxBindGroup, SkyboxPipelineId},
66
};
7-
use bevy_ecs::{prelude::*, query::QueryItem};
7+
use bevy_ecs::{prelude::World, query::QueryItem};
88
use bevy_render::{
99
camera::ExtractedCamera,
1010
render_graph::{NodeRunError, RenderGraphContext, ViewNode},

crates/bevy_pbr/src/deferred/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ pub fn prepare_deferred_lighting_pipelines(
418418
Option<&DebandDither>,
419419
Option<&EnvironmentMapLight>,
420420
Option<&ShadowFilteringMethod>,
421-
Option<&ScreenSpaceAmbientOcclusionSettings>,
421+
Has<ScreenSpaceAmbientOcclusionSettings>,
422422
(
423423
Has<NormalPrepass>,
424424
Has<DepthPrepass>,
@@ -480,7 +480,7 @@ pub fn prepare_deferred_lighting_pipelines(
480480
}
481481
}
482482

483-
if ssao.is_some() {
483+
if ssao {
484484
view_key |= MeshPipelineKey::SCREEN_SPACE_AMBIENT_OCCLUSION;
485485
}
486486

crates/bevy_pbr/src/light.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use bevy_render::{
1515
renderer::RenderDevice,
1616
view::{InheritedVisibility, RenderLayers, ViewVisibility, VisibleEntities},
1717
};
18-
use bevy_transform::{components::GlobalTransform, prelude::Transform};
18+
use bevy_transform::components::{GlobalTransform, Transform};
1919
use bevy_utils::{tracing::warn, HashMap};
2020

2121
use crate::*;

crates/bevy_pbr/src/material.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ const fn alpha_mode_pipeline_key(alpha_mode: AlphaMode) -> MeshPipelineKey {
416416
}
417417
}
418418

419-
const fn tonemapping_pipeline_key(tonemapping: Tonemapping) -> MeshPipelineKey {
419+
pub const fn tonemapping_pipeline_key(tonemapping: Tonemapping) -> MeshPipelineKey {
420420
match tonemapping {
421421
Tonemapping::None => MeshPipelineKey::TONEMAP_METHOD_NONE,
422422
Tonemapping::Reinhard => MeshPipelineKey::TONEMAP_METHOD_REINHARD,
@@ -431,7 +431,7 @@ const fn tonemapping_pipeline_key(tonemapping: Tonemapping) -> MeshPipelineKey {
431431
}
432432
}
433433

434-
const fn screen_space_specular_transmission_pipeline_key(
434+
pub const fn screen_space_specular_transmission_pipeline_key(
435435
screen_space_transmissive_blur_quality: ScreenSpaceTransmissionQuality,
436436
) -> MeshPipelineKey {
437437
match screen_space_transmissive_blur_quality {
@@ -472,15 +472,15 @@ pub fn queue_material_meshes<M: Material>(
472472
Option<&DebandDither>,
473473
Option<&EnvironmentMapLight>,
474474
Option<&ShadowFilteringMethod>,
475-
Option<&ScreenSpaceAmbientOcclusionSettings>,
475+
Has<ScreenSpaceAmbientOcclusionSettings>,
476476
(
477477
Has<NormalPrepass>,
478478
Has<DepthPrepass>,
479479
Has<MotionVectorPrepass>,
480480
Has<DeferredPrepass>,
481481
),
482482
Option<&Camera3d>,
483-
Option<&TemporalJitter>,
483+
Has<TemporalJitter>,
484484
Option<&Projection>,
485485
&mut RenderPhase<Opaque3d>,
486486
&mut RenderPhase<AlphaMask3d>,
@@ -532,7 +532,7 @@ pub fn queue_material_meshes<M: Material>(
532532
view_key |= MeshPipelineKey::DEFERRED_PREPASS;
533533
}
534534

535-
if temporal_jitter.is_some() {
535+
if temporal_jitter {
536536
view_key |= MeshPipelineKey::TEMPORAL_JITTER;
537537
}
538538

@@ -570,7 +570,7 @@ pub fn queue_material_meshes<M: Material>(
570570
view_key |= MeshPipelineKey::DEBAND_DITHER;
571571
}
572572
}
573-
if ssao.is_some() {
573+
if ssao {
574574
view_key |= MeshPipelineKey::SCREEN_SPACE_AMBIENT_OCCLUSION;
575575
}
576576
if let Some(camera_3d) = camera_3d {

crates/bevy_pbr/src/render/mesh.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,17 @@ pub fn extract_meshes(
272272
transform,
273273
previous_transform,
274274
handle,
275-
not_receiver,
275+
not_shadow_receiver,
276276
transmitted_receiver,
277-
not_caster,
277+
not_shadow_caster,
278278
no_automatic_batching,
279279
)| {
280280
if !view_visibility.get() {
281281
return;
282282
}
283283
let transform = transform.affine();
284284
let previous_transform = previous_transform.map(|t| t.0).unwrap_or(transform);
285-
let mut flags = if not_receiver {
285+
let mut flags = if not_shadow_receiver {
286286
MeshFlags::empty()
287287
} else {
288288
MeshFlags::SHADOW_RECEIVER
@@ -305,7 +305,7 @@ pub fn extract_meshes(
305305
RenderMeshInstance {
306306
mesh_asset_id: handle.id(),
307307
transforms,
308-
shadow_caster: !not_caster,
308+
shadow_caster: !not_shadow_caster,
309309
material_bind_group_id: MaterialBindGroupId::default(),
310310
automatic_batching: !no_automatic_batching,
311311
},

crates/bevy_pbr/src/ssao/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use bevy_core_pipeline::{
77
};
88
use bevy_ecs::{
99
prelude::{Bundle, Component, Entity},
10-
query::{QueryItem, With},
10+
query::{Has, QueryItem, With},
1111
reflect::ReflectComponent,
1212
schedule::IntoSystemConfigs,
1313
system::{Commands, Query, Res, ResMut, Resource},
@@ -612,7 +612,7 @@ fn prepare_ssao_pipelines(
612612
views: Query<(
613613
Entity,
614614
&ScreenSpaceAmbientOcclusionSettings,
615-
Option<&TemporalJitter>,
615+
Has<TemporalJitter>,
616616
)>,
617617
) {
618618
for (entity, ssao_settings, temporal_jitter) in &views {
@@ -621,7 +621,7 @@ fn prepare_ssao_pipelines(
621621
&pipeline,
622622
SsaoPipelineKey {
623623
ssao_settings: ssao_settings.clone(),
624-
temporal_jitter: temporal_jitter.is_some(),
624+
temporal_jitter,
625625
},
626626
);
627627

crates/bevy_render/src/render_resource/mod.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,24 @@ pub use uniform_buffer::*;
3232

3333
// TODO: decide where re-exports should go
3434
pub use wgpu::{
35-
util::BufferInitDescriptor, AdapterInfo as WgpuAdapterInfo, AddressMode, BindGroupDescriptor,
36-
BindGroupEntry, BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingResource, BindingType,
37-
BlendComponent, BlendFactor, BlendOperation, BlendState, BufferAddress, BufferAsyncError,
38-
BufferBinding, BufferBindingType, BufferDescriptor, BufferSize, BufferUsages, ColorTargetState,
39-
ColorWrites, CommandEncoder, CommandEncoderDescriptor, CompareFunction, ComputePass,
40-
ComputePassDescriptor, ComputePipelineDescriptor as RawComputePipelineDescriptor,
41-
DepthBiasState, DepthStencilState, Extent3d, Face, Features as WgpuFeatures, FilterMode,
42-
FragmentState as RawFragmentState, FrontFace, ImageCopyBuffer, ImageCopyBufferBase,
43-
ImageCopyTexture, ImageCopyTextureBase, ImageDataLayout, ImageSubresourceRange, IndexFormat,
44-
Limits as WgpuLimits, LoadOp, Maintain, MapMode, MultisampleState, Operations, Origin3d,
45-
PipelineLayout, PipelineLayoutDescriptor, PolygonMode, PrimitiveState, PrimitiveTopology,
46-
PushConstantRange, RenderPassColorAttachment, RenderPassDepthStencilAttachment,
47-
RenderPassDescriptor, RenderPipelineDescriptor as RawRenderPipelineDescriptor,
48-
SamplerBindingType, SamplerDescriptor, ShaderModule, ShaderModuleDescriptor, ShaderSource,
49-
ShaderStages, StencilFaceState, StencilOperation, StencilState, StorageTextureAccess, StoreOp,
50-
TextureAspect, TextureDescriptor, TextureDimension, TextureFormat, TextureSampleType,
51-
TextureUsages, TextureViewDescriptor, TextureViewDimension, VertexAttribute,
35+
util::{BufferInitDescriptor, DrawIndexedIndirect},
36+
AdapterInfo as WgpuAdapterInfo, AddressMode, BindGroupDescriptor, BindGroupEntry,
37+
BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingResource, BindingType, BlendComponent,
38+
BlendFactor, BlendOperation, BlendState, BufferAddress, BufferAsyncError, BufferBinding,
39+
BufferBindingType, BufferDescriptor, BufferSize, BufferUsages, ColorTargetState, ColorWrites,
40+
CommandEncoder, CommandEncoderDescriptor, CompareFunction, ComputePass, ComputePassDescriptor,
41+
ComputePipelineDescriptor as RawComputePipelineDescriptor, DepthBiasState, DepthStencilState,
42+
Extent3d, Face, Features as WgpuFeatures, FilterMode, FragmentState as RawFragmentState,
43+
FrontFace, ImageCopyBuffer, ImageCopyBufferBase, ImageCopyTexture, ImageCopyTextureBase,
44+
ImageDataLayout, ImageSubresourceRange, IndexFormat, Limits as WgpuLimits, LoadOp, Maintain,
45+
MapMode, MultisampleState, Operations, Origin3d, PipelineLayout, PipelineLayoutDescriptor,
46+
PolygonMode, PrimitiveState, PrimitiveTopology, PushConstantRange, RenderPassColorAttachment,
47+
RenderPassDepthStencilAttachment, RenderPassDescriptor,
48+
RenderPipelineDescriptor as RawRenderPipelineDescriptor, SamplerBindingType, SamplerDescriptor,
49+
ShaderModule, ShaderModuleDescriptor, ShaderSource, ShaderStages, StencilFaceState,
50+
StencilOperation, StencilState, StorageTextureAccess, StoreOp, TextureAspect,
51+
TextureDescriptor, TextureDimension, TextureFormat, TextureSampleType, TextureUsages,
52+
TextureViewDescriptor, TextureViewDimension, VertexAttribute,
5253
VertexBufferLayout as RawVertexBufferLayout, VertexFormat, VertexState as RawVertexState,
5354
VertexStepMode,
5455
};

0 commit comments

Comments
 (0)