pub struct GBufferLayout {
pub color_attachments: Vec<GBufferAttachment>,
pub depth_attachment: GBufferAttachment,
pub max_color_attachments: u32,
pub use_octahedral_normals: bool,
pub thin_gbuffer: bool,
}Expand description
Describes the full set of attachments in a G-Buffer.
The default layout provides:
- Position (RGBA32F) at color attachment 0
- Normal (RG16F, octahedral encoding) at color attachment 1
- Albedo (RGBA8) at color attachment 2
- Emission (RGBA16F) at color attachment 3
- MaterialID (R8) at color attachment 4
- Roughness (R8) at color attachment 5
- Metallic (R8) at color attachment 6
- Depth (D32F) as the depth attachment
Fields§
§color_attachments: Vec<GBufferAttachment>Ordered list of color attachments.
depth_attachment: GBufferAttachmentThe depth (or depth-stencil) attachment.
max_color_attachments: u32Maximum number of simultaneous render targets supported.
use_octahedral_normals: boolWhether to use octahedral normal encoding (saves bandwidth vs RGBA16F).
thin_gbuffer: boolWhether thin G-Buffer packing is enabled (combine roughness+metallic into one RG8).
Implementations§
Source§impl GBufferLayout
impl GBufferLayout
Sourcepub fn default_layout() -> Self
pub fn default_layout() -> Self
Create the default G-Buffer layout used by the deferred pipeline.
Sourcepub fn thin_layout() -> Self
pub fn thin_layout() -> Self
Create a thin/minimal G-Buffer layout that packs more data per attachment. Uses fewer render targets at the cost of some precision.
Sourcepub fn add_color_attachment(&mut self, attachment: GBufferAttachment)
pub fn add_color_attachment(&mut self, attachment: GBufferAttachment)
Add a color attachment to the layout.
Sourcepub fn remove_attachment(&mut self, semantic: GBufferSemantic) -> bool
pub fn remove_attachment(&mut self, semantic: GBufferSemantic) -> bool
Remove a color attachment by semantic.
Sourcepub fn find_attachment(
&self,
semantic: GBufferSemantic,
) -> Option<&GBufferAttachment>
pub fn find_attachment( &self, semantic: GBufferSemantic, ) -> Option<&GBufferAttachment>
Find an attachment by semantic.
Sourcepub fn find_attachment_mut(
&mut self,
semantic: GBufferSemantic,
) -> Option<&mut GBufferAttachment>
pub fn find_attachment_mut( &mut self, semantic: GBufferSemantic, ) -> Option<&mut GBufferAttachment>
Find an attachment by semantic (mutable).
Sourcepub fn color_attachment_count(&self) -> u32
pub fn color_attachment_count(&self) -> u32
Total number of color attachments.
Sourcepub fn total_memory_bytes(&self, width: u32, height: u32) -> u64
pub fn total_memory_bytes(&self, width: u32, height: u32) -> u64
Calculate total memory usage for a given resolution.
Trait Implementations§
Source§impl Clone for GBufferLayout
impl Clone for GBufferLayout
Source§fn clone(&self) -> GBufferLayout
fn clone(&self) -> GBufferLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more