Skip to content

Commit

Permalink
Misc cleanup (bevyengine#11134)
Browse files Browse the repository at this point in the history
Re-exports a few types/functions I need that have no reason to be
private, and some minor code quality changes.
  • Loading branch information
JMS55 authored Dec 30, 2023
1 parent 786abbf commit 3d3a065
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
prepass::{DeferredPrepass, DepthPrepass, MotionVectorPrepass, NormalPrepass},
skybox::{SkyboxBindGroup, SkyboxPipelineId},
};
use bevy_ecs::{prelude::*, query::QueryItem};
use bevy_ecs::{prelude::World, query::QueryItem};
use bevy_render::{
camera::ExtractedCamera,
render_graph::{NodeRunError, RenderGraphContext, ViewNode},
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/deferred/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ pub fn prepare_deferred_lighting_pipelines(
Option<&DebandDither>,
Option<&EnvironmentMapLight>,
Option<&ShadowFilteringMethod>,
Option<&ScreenSpaceAmbientOcclusionSettings>,
Has<ScreenSpaceAmbientOcclusionSettings>,
(
Has<NormalPrepass>,
Has<DepthPrepass>,
Expand Down Expand Up @@ -480,7 +480,7 @@ pub fn prepare_deferred_lighting_pipelines(
}
}

if ssao.is_some() {
if ssao {
view_key |= MeshPipelineKey::SCREEN_SPACE_AMBIENT_OCCLUSION;
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use bevy_render::{
renderer::RenderDevice,
view::{InheritedVisibility, RenderLayers, ViewVisibility, VisibleEntities},
};
use bevy_transform::{components::GlobalTransform, prelude::Transform};
use bevy_transform::components::{GlobalTransform, Transform};
use bevy_utils::{tracing::warn, HashMap};

use crate::*;
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_pbr/src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ const fn alpha_mode_pipeline_key(alpha_mode: AlphaMode) -> MeshPipelineKey {
}
}

const fn tonemapping_pipeline_key(tonemapping: Tonemapping) -> MeshPipelineKey {
pub const fn tonemapping_pipeline_key(tonemapping: Tonemapping) -> MeshPipelineKey {
match tonemapping {
Tonemapping::None => MeshPipelineKey::TONEMAP_METHOD_NONE,
Tonemapping::Reinhard => MeshPipelineKey::TONEMAP_METHOD_REINHARD,
Expand All @@ -431,7 +431,7 @@ const fn tonemapping_pipeline_key(tonemapping: Tonemapping) -> MeshPipelineKey {
}
}

const fn screen_space_specular_transmission_pipeline_key(
pub const fn screen_space_specular_transmission_pipeline_key(
screen_space_transmissive_blur_quality: ScreenSpaceTransmissionQuality,
) -> MeshPipelineKey {
match screen_space_transmissive_blur_quality {
Expand Down Expand Up @@ -472,15 +472,15 @@ pub fn queue_material_meshes<M: Material>(
Option<&DebandDither>,
Option<&EnvironmentMapLight>,
Option<&ShadowFilteringMethod>,
Option<&ScreenSpaceAmbientOcclusionSettings>,
Has<ScreenSpaceAmbientOcclusionSettings>,
(
Has<NormalPrepass>,
Has<DepthPrepass>,
Has<MotionVectorPrepass>,
Has<DeferredPrepass>,
),
Option<&Camera3d>,
Option<&TemporalJitter>,
Has<TemporalJitter>,
Option<&Projection>,
&mut RenderPhase<Opaque3d>,
&mut RenderPhase<AlphaMask3d>,
Expand Down Expand Up @@ -532,7 +532,7 @@ pub fn queue_material_meshes<M: Material>(
view_key |= MeshPipelineKey::DEFERRED_PREPASS;
}

if temporal_jitter.is_some() {
if temporal_jitter {
view_key |= MeshPipelineKey::TEMPORAL_JITTER;
}

Expand Down Expand Up @@ -570,7 +570,7 @@ pub fn queue_material_meshes<M: Material>(
view_key |= MeshPipelineKey::DEBAND_DITHER;
}
}
if ssao.is_some() {
if ssao {
view_key |= MeshPipelineKey::SCREEN_SPACE_AMBIENT_OCCLUSION;
}
if let Some(camera_3d) = camera_3d {
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_pbr/src/render/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,17 +272,17 @@ pub fn extract_meshes(
transform,
previous_transform,
handle,
not_receiver,
not_shadow_receiver,
transmitted_receiver,
not_caster,
not_shadow_caster,
no_automatic_batching,
)| {
if !view_visibility.get() {
return;
}
let transform = transform.affine();
let previous_transform = previous_transform.map(|t| t.0).unwrap_or(transform);
let mut flags = if not_receiver {
let mut flags = if not_shadow_receiver {
MeshFlags::empty()
} else {
MeshFlags::SHADOW_RECEIVER
Expand All @@ -305,7 +305,7 @@ pub fn extract_meshes(
RenderMeshInstance {
mesh_asset_id: handle.id(),
transforms,
shadow_caster: !not_caster,
shadow_caster: !not_shadow_caster,
material_bind_group_id: MaterialBindGroupId::default(),
automatic_batching: !no_automatic_batching,
},
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_pbr/src/ssao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bevy_core_pipeline::{
};
use bevy_ecs::{
prelude::{Bundle, Component, Entity},
query::{QueryItem, With},
query::{Has, QueryItem, With},
reflect::ReflectComponent,
schedule::IntoSystemConfigs,
system::{Commands, Query, Res, ResMut, Resource},
Expand Down Expand Up @@ -612,7 +612,7 @@ fn prepare_ssao_pipelines(
views: Query<(
Entity,
&ScreenSpaceAmbientOcclusionSettings,
Option<&TemporalJitter>,
Has<TemporalJitter>,
)>,
) {
for (entity, ssao_settings, temporal_jitter) in &views {
Expand All @@ -621,7 +621,7 @@ fn prepare_ssao_pipelines(
&pipeline,
SsaoPipelineKey {
ssao_settings: ssao_settings.clone(),
temporal_jitter: temporal_jitter.is_some(),
temporal_jitter,
},
);

Expand Down
35 changes: 18 additions & 17 deletions crates/bevy_render/src/render_resource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,24 @@ pub use uniform_buffer::*;

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

0 comments on commit 3d3a065

Please sign in to comment.