Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions crates/bevy_anti_alias/src/smaa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
//! [SMAA]: https://www.iryoku.com/smaa/
use bevy_app::{App, Plugin};
use bevy_asset::{embedded_asset, load_embedded_asset, AssetServer, Handle};
#[cfg(not(feature = "smaa_luts"))]
use bevy_core_pipeline::tonemapping::lut_placeholder;
use bevy_core_pipeline::{
schedule::{Core2d, Core2dSystems, Core3d, Core3dSystems},
tonemapping::tonemapping,
Expand Down Expand Up @@ -322,8 +320,33 @@ impl Plugin for SmaaPlugin {
};
#[cfg(not(feature = "smaa_luts"))]
let smaa_luts = {
use bevy_asset::RenderAssetUsages;
use bevy_image::ImageSampler;
use bevy_render::render_resource::{Extent3d, TextureDataOrder};

let mut images = app.world_mut().resource_mut::<bevy_asset::Assets<Image>>();
let handle = images.add(lut_placeholder());

let format = TextureFormat::Rgba8Unorm;
let data = vec![255, 0, 255, 255];
let handle = images.add(Image {
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 May 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to keep the copy/paste and to help prevent people from asking “why isn’t this using lut_placeholder"

Suggested change
let handle = images.add(Image {
// using lut_placeholder() instead would result in warnings
// the smaa placeholder needs to be a 2d texture
let handle = images.add(Image {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data: Some(data),
data_order: TextureDataOrder::default(),
texture_descriptor: TextureDescriptor {
size: Extent3d::default(),
format,
dimension: TextureDimension::D2,
label: None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Label it please

mip_level_count: 1,
sample_count: 1,
usage: TextureUsages::TEXTURE_BINDING | TextureUsages::COPY_DST,
view_formats: &[],
},
sampler: ImageSampler::Default,
texture_view_descriptor: None,
asset_usage: RenderAssetUsages::RENDER_WORLD,
copy_on_resize: false,
});

SmaaLuts {
area_lut: handle.clone(),
search_lut: handle.clone(),
Expand Down
Loading