Skip to content

Commit

Permalink
More warning text
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Feb 6, 2024
1 parent 22bb6ab commit 886ab7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/re_renderer/shader/decodings.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ fn decode_nv12_or_yuy2(sample_type: u32, texture: texture_2d<u32>, coords: vec2i
var u: f32;
var v: f32;

// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
// NO MORE NV12 OR YUY2 SAMPLE TYPES CAN BE ADDED TO THIS SHADER!
// The shader is already too large and adding more sample types will push us over the size limit.
// See: https://github.com/rerun-io/rerun/issues/3931, https://github.com/rerun-io/rerun/issues/5073
if sample_type == SAMPLE_TYPE_NV12 {
let uv_offset = u32(floor(texture_dim.y / 1.5));
let uv_row = u32(coords.y / 2);
Expand All @@ -29,6 +33,7 @@ fn decode_nv12_or_yuy2(sample_type: u32, texture: texture_2d<u32>, coords: vec2i
u = f32(textureLoad(texture, vec2u(uv_col + 1u, uv_row), 0).r);
v = f32(textureLoad(texture, vec2u(uv_col + 3u, uv_row), 0).r);
}
// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!

let rgb = set_color_standard(vec3f(y, u, v));

Expand Down
5 changes: 5 additions & 0 deletions crates/re_renderer/shader/rectangle_fs.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ fn fs_main(in: VertexOut) -> @location(0) vec4f {
v11_coord = clamp_to_edge_nearest_neighbor(coord + vec2f(0.5, 0.5), texture_dimensions);
}

// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
// NO MORE NV12 OR YUY2 SAMPLE TYPES CAN BE ADDED TO THIS SHADER!
// The shader is already too large and adding more sample types will push us over the size limit.
// See: https://github.com/rerun-io/rerun/issues/3931, https://github.com/rerun-io/rerun/issues/5073
if rect_info.sample_type == SAMPLE_TYPE_FLOAT {
normalized_value = decode_color_and_filter_nearest_or_bilinear(
filter_nearest,
Expand Down Expand Up @@ -138,6 +142,7 @@ fn fs_main(in: VertexOut) -> @location(0) vec4f {
} else {
return ERROR_RGBA; // unknown sample type
}
// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!

// Apply gamma:
normalized_value = vec4f(pow(normalized_value.rgb, vec3f(rect_info.gamma)), normalized_value.a);
Expand Down

0 comments on commit 886ab7e

Please sign in to comment.