Skip to content

Commit

Permalink
use r32float instead of rgba8unorm
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Feb 27, 2024
1 parent 347b58b commit 3784d92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion assets/shaders/game_of_life.wgsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@group(0) @binding(0) var texture: texture_storage_2d<rgba8unorm, read_write>;
@group(0) @binding(0) var texture: texture_storage_2d<r32float, read_write>;

fn hash(value: u32) -> u32 {
var state = value;
Expand Down
4 changes: 2 additions & 2 deletions examples/shader/compute_shader_game_of_life.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn setup(mut commands: Commands, mut images: ResMut<Assets<Image>>) {
},
TextureDimension::D2,
&[0, 0, 0, 255],
TextureFormat::Rgba8Unorm,
TextureFormat::R32Float,
RenderAssetUsages::RENDER_WORLD,
);
image.texture_descriptor.usage =
Expand Down Expand Up @@ -97,7 +97,7 @@ impl Plugin for GameOfLifeComputePlugin {

#[derive(Resource, Clone, Deref, ExtractResource, AsBindGroup)]
struct GameOfLifeImage {
#[storage_texture(0, image_format = Rgba8Unorm, access = ReadWrite)]
#[storage_texture(0, image_format = R32Float, access = ReadWrite)]
texture: Handle<Image>,
}

Expand Down

0 comments on commit 3784d92

Please sign in to comment.