Skip to content

Label component uniform buffers with their component type name - #3

Closed
stuartparmenter wants to merge 4 commits into
mainfrom
hdr-wave1-render-infra
Closed

Label component uniform buffers with their component type name#3
stuartparmenter wants to merge 4 commits into
mainfrom
hdr-wave1-render-infra

Conversation

@stuartparmenter

@stuartparmenter stuartparmenter commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Objective

ComponentUniforms<C> creates its buffer without a label. wgpu-core identifies resources in validation errors as Buffer with '<label>' label, so these come out as Buffer with '' label and there is no way to tell which uniform buffer went wrong.

The type_label_buffers feature fills in a type name at the buffer creation site, but it is off in a default build.

Solution

  • Sets the buffer label to C's type name in Default for ComponentUniforms<C>.
  • Moves set_label and get_label from impl<T: ShaderType + WriteInto> DynamicUniformBuffer<T> to a ShaderType-only block. Neither uses T, so the WriteInto bound was incidental. This keeps Default for ComponentUniforms<C> at C: Component + ShaderType, so nothing breaks and no migration guide is needed.

bevyengine#22698 moved label prepopulation out of constructors because type_name() returns a &'static str while label is an Option<String>, and .to_string() is not const. That only blocks const constructors; this one is not const.

Testing

  • cargo check -p bevy, with and without bevy_render/debug.
  • cargo fmt --check.

This PR was built by me with the assistance of Claude Code w/ Fable 5

@stuartparmenter stuartparmenter changed the title Incidental render infra fixes Label component uniform buffers with their component type name Aug 10, 2026
@stuartparmenter
stuartparmenter marked this pull request as ready for review August 10, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant