Skip to content

Commit

Permalink
Document the uniform buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 27, 2023
1 parent 94cc46e commit dbd865e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions crates/re_renderer/shader/depth_cloud.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ fn compute_point_data(quad_idx: i32) -> PointData {
// ---

/// Keep in sync with `DepthCloudInfoUBO` in `depth_cloud.rs`.
///
/// Same for all draw-phases.
struct DepthCloudInfo {
/// The extrinsincs of the camera used for the projection.
world_from_obj: Mat4,
Expand Down Expand Up @@ -84,6 +86,9 @@ var<uniform> depth_cloud_info: DepthCloudInfo;
@group(1) @binding(1)
var depth_texture: texture_2d<f32>;

/// Keep in sync with `DrawDataUniformBuffer` in `depth_cloud.rs`.
///
/// Changes between the opaque and outline draw-phases.
struct DrawDataUniformBuffer {
radius_boost_in_ui_points: f32,
// In actuality there is way more padding than this since we align all our uniform buffers to
Expand Down
9 changes: 6 additions & 3 deletions crates/re_renderer/src/renderer/depth_cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ use super::{
mod gpu_data {
use crate::wgpu_buffer_types;

// - Keep in sync with mirror in depth_cloud.wgsl.
// - See `DepthCloud` for documentation.
/// Uniform buffer that is constant across all draw phases.
///
/// Keep in sync with mirror in `depth_cloud.wgsl.`
#[repr(C, align(256))]
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
pub struct DepthCloudInfoUBO {
Expand Down Expand Up @@ -100,7 +101,9 @@ mod gpu_data {
}
}

/// Uniform buffer that changes once per draw data rendering.
/// Uniform buffer that changes between the opaque and outline draw-phases.
///
/// Keep in sync with mirror in `depth_cloud.wgsl.`
#[repr(C, align(256))]
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
pub struct DrawDataUniformBuffer {
Expand Down

0 comments on commit dbd865e

Please sign in to comment.