Misc cleanup (#11134)

Re-exports a few types/functions I need that have no reason to be
private, and some minor code quality changes.
This commit is contained in:
JMS55 2023-12-30 15:27:48 -08:00 committed by GitHub
parent 786abbf3f5
commit 3d3a065820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 34 deletions

View File

@ -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},

View File

@ -418,7 +418,7 @@ pub fn prepare_deferred_lighting_pipelines(
Option<&DebandDither>,
Option<&EnvironmentMapLight>,
Option<&ShadowFilteringMethod>,
Option<&ScreenSpaceAmbientOcclusionSettings>,
Has<ScreenSpaceAmbientOcclusionSettings>,
(
Has<NormalPrepass>,
Has<DepthPrepass>,
@ -480,7 +480,7 @@ pub fn prepare_deferred_lighting_pipelines(
}
}
if ssao.is_some() {
if ssao {
view_key |= MeshPipelineKey::SCREEN_SPACE_AMBIENT_OCCLUSION;
}

View File

@ -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::*;

View File

@ -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,
@ -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 {
@ -472,7 +472,7 @@ pub fn queue_material_meshes<M: Material>(
Option<&DebandDither>,
Option<&EnvironmentMapLight>,
Option<&ShadowFilteringMethod>,
Option<&ScreenSpaceAmbientOcclusionSettings>,
Has<ScreenSpaceAmbientOcclusionSettings>,
(
Has<NormalPrepass>,
Has<DepthPrepass>,
@ -480,7 +480,7 @@ pub fn queue_material_meshes<M: Material>(
Has<DeferredPrepass>,
),
Option<&Camera3d>,
Option<&TemporalJitter>,
Has<TemporalJitter>,
Option<&Projection>,
&mut RenderPhase<Opaque3d>,
&mut RenderPhase<AlphaMask3d>,
@ -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;
}
@ -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 {

View File

@ -272,9 +272,9 @@ 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() {
@ -282,7 +282,7 @@ pub fn extract_meshes(
}
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
@ -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,
},

View File

@ -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},
@ -612,7 +612,7 @@ fn prepare_ssao_pipelines(
views: Query<(
Entity,
&ScreenSpaceAmbientOcclusionSettings,
Option<&TemporalJitter>,
Has<TemporalJitter>,
)>,
) {
for (entity, ssao_settings, temporal_jitter) in &views {
@ -621,7 +621,7 @@ fn prepare_ssao_pipelines(
&pipeline,
SsaoPipelineKey {
ssao_settings: ssao_settings.clone(),
temporal_jitter: temporal_jitter.is_some(),
temporal_jitter,
},
);

View File

@ -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,
};