Skip to content

Conversation

@Firestar99
Copy link
Collaborator

Requires #2985

  • Adds the trait BufferStruct
  • support for
    • gamma_correction
    • channel_mixer
    • selective_color
    • brightness_contrast_classic
      • The original brightness_contrast node doesn't work with it's non-classic mode. However, we now have a "Brightness Contrast Classic" CPU node next to the "Brightness Contrast" and "Brightness Contrast Classic GPU" nodes.

BufferStruct docs

/// A BufferStruct is a "parallel representation" of the original struct with some fundamental types remapped. This /// struct hierarchy represents how data is stored in GPU Buffers, where all types must be [`Pod`] to allow /// transmuting them to `&[u8]` with [`bytemuck`]. /// /// Notable type remappings (original: buffer): /// * bool: u32 of 0 or 1 /// * any repr(u32) enum: u32 with remapping via [`num_enum`] /// /// By adding `#[derive(ShaderStruct)]` to your struct (or enum), a parallel `{name}Buffer` struct is created with all /// the members of the original struct, but with their types using the associated remapped types as specified by this /// trait. /// /// # Origin /// I (@firestar99) copied this entire mod from my [Nanite-at-home] project, specifically the [buffer-content] crate /// and the [buffer_struct] proc macro. The variant here has quite some modifications, to both cleaned up some of the /// mistakes my implementation has and to customize it a bit for graphite. /// /// Hopefully rust-gpu improves to the point where this remapping becomes unnecessary. /// /// [Nanite-at-home]: https://github.com/Firestar99/nanite-at-home /// [buffer-content]: https://github.com/Firestar99/nanite-at-home/tree/008dac8df656959c71efeddd2d3ddabcb801771c/rust-gpu-bindless/crates/buffer-content /// [buffer_struct]: https://github.com/Firestar99/nanite-at-home/blob/008dac8df656959c71efeddd2d3ddabcb801771c/rust-gpu-bindless/crates/macros/src/buffer_struct.rs /// /// # Safety /// The associated type Transfer must be the same on all targets. Writing followed by reading back a value must result /// in the same value. 
@Firestar99 Firestar99 marked this pull request as ready for review September 3, 2025 08:34
})
}

/// see `BufferStruct` docs
Copy link
Member

Choose a reason for hiding this comment

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

Could we use a proper doc link which allows you to click on the BufferStruct here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh yea with a dev-dependency... I hope the link I made is correct, rustrover isn't linking this

@Firestar99 Firestar99 enabled auto-merge (squash) September 5, 2025 15:44
@Firestar99
Copy link
Collaborator Author

Added one more commit to fix shader name naming

@Firestar99 Firestar99 merged commit f12b4da into master Sep 5, 2025
4 checks passed
@Firestar99 Firestar99 deleted the shaders_struct branch September 5, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants